PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.0.43
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.0.43
2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 All 107 releases
b-blocks / build / pricing-table / view.js

view.js in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.0.43, at build/pricing-table/view.js

1 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";var e={5338:(e,t,r)=>{var n=r(5795);t.H=n.createRoot,n.hydrateRoot},5795:e=>{e.exports=window.ReactDOM}},t={};const r=window.React;var n=function r(n){var a=t[n];if(void 0!==a)return a.exports;var c=t[n]={exports:{}};return e[n](c,c.exports,r),c.exports}(5338);const a=(e,t="box")=>{const{hOffset:r="0px",vOffset:n="0px",blur:a="0px",spreed:c="0px",color:s="#7090b0",isInset:l=!1}=e||{},i=`${r} ${n} ${a}`;return("text"===t?`${i} ${s}`:`${i} ${c} ${s} ${l?"inset":""}`)||"none"},c=e=>{const{side:t=2,vertical:r="0px",horizontal:n="0px",top:a="0px",right:c="0px",bottom:s="0px",left:l="0px"}=e||{};return 2===t?`${r} ${n}`:`${a} ${c} ${s} ${l}`},s="bBlocksPricingTable",l=({attributes:e,id:t,isStandard:n})=>{const{pricingTables:l,columnGap:i,rowGap:o,textAlign:m,padding:p,shadow:u}=e,d=`#${t}`,$=`${d} .${s}`;return(0,r.createElement)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${$}{\n\t\t\tgrid-gap: ${o} ${i};\n\t\t\ttext-align: ${m};\n\t\t\tpadding: ${n?"30px 0":"0"}\n\t\t}\n\t\t${$} .priceItem{\n\t\t\tpadding: ${c(p)};\n\t\t\tbox-shadow: ${a(u)};\n\t\t}\n\n\t\t${l?.map(((e,t)=>{const{color:r}=e,n=`${$} #priceItem-${t} .priceItem`,a=e=>`${d}.is-style-${e} .${s} #priceItem-${t} .priceItem`;return`\n\t\t\t\t${n} .priceName,\n\t\t\t\t${a("basic")} .priceAmountWrap,\n\t\t\t\t${a("standard")} .priceAmountWrap{\n\t\t\t\t\tcolor: ${r};\n\t\t\t\t}\n\t\t\t\t${n} .priceLink,\n\t\t\t\t${a("basic")} .priceName,\n\t\t\t\t${a("standard")}::before,\n\t\t\t\t${a("ultimate")} .priceAmountWrap{\n\t\t\t\t\tcolor: #fff;\n\t\t\t\t\tbackground-color: ${r};\n\t\t\t\t}\n\t\t\t\t${a("basic")} .priceName::before{\n\t\t\t\t\tborder-top-color: ${r};\n\t\t\t\t}\n\t\t\t`})).join(" ")}\n\t\t`.replace(/\s+/g," ")}})},i=e=>{try{const t=new URL(e);return["http:","https:"].includes(t.protocol)?t.toString():null}catch(t){return"string"==typeof e&&e.startsWith("/")&&!e.startsWith("//")?e:null}},o=e=>{const t=(new DOMParser).parseFromString(e,"text/html"),r=["b","strong","i","em","span","a","br"],n=["style","href","target","rel","class"];return t.body.querySelectorAll("*").forEach((e=>{r.includes(e.tagName.toLowerCase())?[...e.attributes].forEach((t=>{if(n.includes(t.name)||e.removeAttribute(t.name),"href"===t.name){const r=i(t.value);r?e.setAttribute("href",r):e.removeAttribute("href")}})):e.remove()})),t.body.innerHTML},m=(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"priceFeatureEnabled",viewBox:"0 0 512 512"},(0,r.createElement)("path",{fill:"#01944e",d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"})),p=(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"priceFeatureDisabled",viewBox:"0 0 352 512"},(0,r.createElement)("path",{fill:"#f00025",d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"})),u=({features:e})=>(0,r.createElement)("div",{className:"priceFeatures"},e?.map(((e,t)=>{const{isEnable:n,label:a}=e;return(0,r.createElement)("div",{key:t,className:"priceFeature"},n?m:p,(0,r.createElement)("span",{className:"priceFeatureLabel",dangerouslySetInnerHTML:{__html:o(a)}}))}))),d=({attributes:e,id:t,isBasic:n,isStandard:a,isUltimate:c})=>{const{pricingTables:l,columns:m}=e;(0,r.useEffect)((()=>{const e=document.querySelectorAll(`#${t} .priceItem .priceFeatures`),r=[];e?.forEach((e=>{r.push(e?.clientHeight)})),e?.forEach((e=>{e.style.height=Math.max(...r)+"px"}))}),[l]);const p=({priceTable:e,index:t})=>{const{name:s,price:l,priceCurrency:m,period:p,link:d,linkLabel:$,features:b}=e,f=(0,r.useRef)(null),h=(0,r.useRef)(null);(0,r.useEffect)((()=>{if(c){const e=f?.current?.clientHeight/100*82;h.current.style.width=`${e}px`,h.current.style.top=e/2+"px",h.current.style.left=-e/2+60+"px"}}),[]);const g=(0,r.createElement)("span",{className:"priceAmount"},m,l),x=(0,r.createElement)("span",{className:"pricePeriod",dangerouslySetInnerHTML:{__html:o(p)}});return(0,r.createElement)("div",{key:t,id:`priceItem-${t}`},(0,r.createElement)("div",{className:"priceItem",ref:f},(0,r.createElement)("h3",{className:"priceName",dangerouslySetInnerHTML:{__html:o(s)}}),a||c?(0,r.createElement)("div",{className:"priceAmountWrap",ref:h},g,p?" / ":"",x):"",(0,r.createElement)(u,{features:b}),a||c?"":(0,r.createElement)("div",{className:"priceAmountWrap"},g),!n&&(0,r.createElement)("br",null),$&&(0,r.createElement)("a",{className:"priceLink",href:i(d),dangerouslySetInnerHTML:{__html:o($)}})))};return(0,r.createElement)("div",{className:`${s} columns-${m.desktop} columns-tablet-${m.tablet} columns-mobile-${m.mobile}`},l?.map(((e,t)=>(0,r.createElement)(p,{key:t,priceTable:e,index:t}))))};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-pricing-table").forEach((e=>{const t=JSON.parse(e.dataset.attributes),a=e.className.includes("basic"),c=e.className.includes("standard"),s=e.className.includes("ultimate");(0,n.H)(e).render((0,r.createElement)(r.Fragment,null,(0,r.createElement)(l,{attributes:t,id:e.id,isStandard:c}),(0,r.createElement)(d,{attributes:t,id:e.id,isBasic:a,isStandard:c,isUltimate:s}))),e?.removeAttribute("data-attributes")}))}))})();