PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.0.40
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.0.40
2.1.8 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 All 108 releases
b-blocks / build / advanced-tabs / view.js

view.js in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.0.40, at build/advanced-tabs/view.js

1 lines 14.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";var t={5795:t=>{t.exports=window.ReactDOM},8744:(t,n,e)=>{var o=e(5795);n.H=o.createRoot,o.hydrateRoot}},n={};const e=window.React;var o=function e(o){var a=n[o];if(void 0!==a)return a.exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}(8744);const a=t=>!(null==t||""===t||Array.isArray(t)&&0===t.length||"object"==typeof t&&0===Object.keys(t).length||"string"==typeof t&&""===t.trim()||"number"==typeof t&&0===t),r="@media only screen and (max-width: 1024px)",l="@media only screen and (max-width: 640px)",i="linear-gradient(135deg, #0040E3, #18D4FD)",s=(t,n,e=!1)=>a(n)?`${t}: ${n}${e?" !important":""};`:"",c=(t,n=!0,e=!0,o=!0)=>{const{type:a="solid",color:r="",gradient:l=i,image:c={},position:b="center center",attachment:d="",repeat:$="no-repeat",size:u="",overlayColor:v=""}=t||{};return"gradient"===a&&e?s("background",l):"image"===a&&o?`background: url(${c?.url});\n\t\t\t\t${s("background-color",v)}\n\t\t\t\t${s("background-position",b)}\n\t\t\t\t${s("background-size",u)}\n\t\t\t\t${s("background-repeat",$)}\n\t\t\t\t${s("background-attachment",d)}\n\t\t\t\t${s("background-repeat",$)}\n\t\t\t\tbackground-blend-mode: overlay;`:n&&s("background",r)},b=t=>{if(!t)return"";const n=t=>{const{color:n="#000000",style:e="solid",width:o="0px"}=t;return`${o} ${e} ${n}`};return"object"!=typeof t||Array.isArray(t)?"":t.hasOwnProperty("top")||t.hasOwnProperty("right")||t.hasOwnProperty("bottom")||t.hasOwnProperty("left")?["top","right","bottom","left"].map((e=>t[e]?`border-${e}: ${n(t[e])};`:"")).join(" ").trim():s("border",n(t))},d=(t,n,e=!0)=>{const{fontFamily:o="Default",fontCategory:a="sans-serif",fontVariant:i=400,fontWeight:c,isUploadFont:b=!0,fontSize:d={desktop:null,tablet:null,mobile:null},fontStyle:$,textTransform:u,textDecoration:v,lineHeight:m,letterSpace:p}=n||{},h=!e||!o||"Default"===o,g=d?.desktop||d,k=d?.tablet||g,f=d?.mobile||k,y=t=>{const n=String(t);return["px","em","rem","%","vh","vw"].some((t=>n.endsWith(t)))?n:"number"==typeof t?`${n}px`:""},w=`\n\t\t${h?"":`font-family: '${o}', ${a};`}\n\t\t${s("font-weight",c)}\n\t\t${s("font-size",y(g))}\n\t\t${s("font-style",$)}\n\t\t${s("text-transform",u)}\n\t\t${s("text-decoration",v)}\n\t\t${s("line-height",m)}\n\t\t${s("letter-spacing",p)}\n\t`,x=i&&400!==i?"400i"===i?":ital@1":i?.includes("00i")?`: ital, wght@1, ${i?.replace("00i","00")} `:`: wght@${i} `:"",S=h?"":`https://fonts.googleapis.com/css2?family=${o?.split(" ").join("+")}${x.replace(/ /g,"")}&display=swap`;return{googleFontLink:!b||h?"":`@import url(${S});`,styles:`${t}{\n\t\t\t${w}\n\t\t}\n\t\t${r} {\n\t\t\t${t}{\n\t\t\t\t${s("font-size",y(k))}\n\t\t\t}\n\t\t}\n\t\t${l} {\n\t\t\t${t}{\n\t\t\t\t${s("font-size",y(f))}\n\t\t\t}\n\t\t}`.replace(/\s+/g," ").trim()}},$=t=>{if(!t)return"";if("string"==typeof t)return t;if("object"==typeof t&&!Array.isArray(t)){const n=["top","right","bottom","left"];return n.map((n=>t[n]||"")).every((t=>!t))?"":n.map((n=>t[n]||"0")).join(" ")}return""},u=(t,n)=>{const{tabs:e,styles:o}=t,{tabContainer:i,tabs:u,tabTitle:v,tabSubTitle:m,icon:p,content:h}=o,g=`#${n} .b-blocks-advanced-tabs-main-wrapper`,k=`${g} .b-blocks-advanced-tabs-wrapper`,f=`${k} .b-blocks-advanced-tabs-button-lists`,y=`${f} .b-blocks-advanced-tabs-button`,w=`${y}.b-blocks-advanced-tabs-button-active`,x=`${y}.b-blocks-advanced-tabs-button-normal`,S=`${y} .b-blocks-advanced-tabs-button-title-container`,A=`${S} .b-blocks-advanced-tabs-button-title`,T=`${w} .b-blocks-advanced-tabs-button-title`,E=`${S} .b-blocks-advanced-tabs-button-subTitle`,J=`${w} .b-blocks-advanced-tabs-button-subTitle`,j=`${y} .b-blocks-advanced-tabs-button-icon`,z=`${g} .b-blocks-advanced-tabs-contents`,L=(t="desktop")=>"row-reverse"===e?.[t].direction||"row"===e?.[t].direction,N=(t="desktop")=>"column"===e?.[t].direction||"column-reverse"===e?.[t].direction,C=(t="normal",n="normal",e="desktop")=>`\n\t\t\t\t\t${s("margin",$(u[t][n][e].margin))}\n\t\t\t\t\t${s("padding",$(u[t][n][e].padding))}\n\t\t\t\t\t${s("border-radius",$(u[t][n][e].radius))}\n\t\t\t\t\t${"desktop"===e?c(u[t][n].bg):""}\n\t\t\t\t\t${"desktop"===e?b(u[t][n].border):""}\n\t\t\t\t`,D=(t="normal",n="normal",e="desktop")=>`\n\t\t\t\t${s("margin",$(p[t][n][e].margin))}\n\t\t\t\t${s("padding",$(p[t][n][e].padding))}\n\t\t\t\t${s("border-radius",$(p[t][n][e].radius))}\n\t\t\t\t${"desktop"===e?c(p[t][n].bg):""}\n\t\t\t\t${"desktop"===e?b(p[t][n].border):""}\n\t`,O=["row","row-reverse"],F=["column","column-reverse"];return`\n\n\t\t\t${d("",v.typography).googleFontLink}\n\t\t\t${d("",m.typography).googleFontLink}\n\n\t\t\t${d(A,v.typography).styles}\n\t\t\t${d(E,m.typography).styles}\n\n\t\t\t${k}{\n\t\t\t\t${s("flex-direction",e.desktop.direction)}\n\t\t\t}\n\n\t\t\t${f}{\n\t\t\t\t${s("justify-content",N("desktop")?e.desktop.columnJustify:e.desktop.rowJustify)}\n\t\t\t\t${s("flex-direction",L("desktop")?"column":"")}\n\t\t\t\t${s("gap",u.desktop.gap)}\n\t\t\t\t${s("padding",$(i.desktop.padding))}\n\t\t\t\t${s("margin",$(i.desktop.margin))}\n\t\t\t\t${s("border-radius",$(i.desktop.radius))}\n\t\t\t\t${b(i.border)}\n\t\t\t\t${c(i.bg)}\n\t\t\t\t${O.includes(e?.desktop?.direction)?s("width",u.desktop.width):""}\n\t\t\t\t${F.includes(e.desktop.direction)?s("flex-wrap",e.desktop.wrap):""}\n\t\t\t}\n\n\t\t\t${y}{\n\t\t\t\t${s("width",N("desktop")&&"stretch"===e.desktop.columnJustify?"100%":"")}\n\t\t\t\t${s("height",L("desktop")&&"stretch"===e.desktop.rowJustify?"100%":"")}\n\t\t\t\t${s("justify-content",e.desktop.contentAlign)}\n\t\t\t\t${s("flex-direction",p.desktop.position)}\n\t\t\t\t${C("normal","normal")}\n\t\t\t\ttransition:all ${u.normal.hover.transition}s ease-in-out; \n\t\t\t}\n\n\t\t\t${x}:hover{\n\t\t\t\t${C("normal","hover")}\n\t\t\t}\n\t\t\t\n\t\t\t${w}{\n\t\t\t\t${C("active","normal")}\n\t\t\t}\n\t\t\t${w}:hover{\n\t\t\t\t${C("active","hover")}\n\t\t\t}\n\n\t\t\t${S}{\n\t\t\t\t${s("text-align",e.desktop.contentAlign)}\n\t\t\t}\n\n\t\t\t${y}:hover .b-blocks-advanced-tabs-button-title{\n\t\t\t\t${s("color",v.normal.hover.color,!0)}\n\t\t\t}\n\n\t\t\t${w}:hover .b-blocks-advanced-tabs-button-title{\n\t\t\t\t${s("color",v.active.hover.color,!0)}\n\t\t\t}\n\n\t\t\t${A}{\n\t\t\t\t${s("color",v.normal.normal.color)}\n\t\t\t\ttransition:all ${u.normal.hover.transition}s ease-in-out; \n\t\t\t}\n\n\t\t\t${T}{\n\t\t\t\t${s("color",v.active.normal.color)}\n\t\t\t}\n\n\t\t\t${E}{\n\t\t\t ${s("color",m.normal.normal.color)}\n\t\t\t\ttransition:all ${u.normal.hover.transition}s ease-in-out;\n\t\t\t\t${e.isShowActiveSubTitle?s("display","none"):""}\n\t\t\t}\n\n\t\t\t${y}:hover .b-blocks-advanced-tabs-button-subTitle{\n\t\t\t\t${s("color",m.normal.hover.color)}\n\t\t\t}\n\n\t\t\t${J}{\n\t\t\t\t${s("color",m.active.normal.color)}\n\t\t\t\t${e.isShowActiveSubTitle?s("display","block"):""}\n\t\t\t}\n\n\t\t\t${w}:hover .b-blocks-advanced-tabs-button-subTitle{\n\t\t\t\t${s("color",a(m.active.hover.color)?m.active.hover.color:m.normal.hover.color)}\n\t\t\t}\n\n\t\t\t${j}{\n\t\t\t\t${D("normal","normal")}\n\t\t\t\ttransition:all ${u.normal.hover.transition}s ease-in-out;\n\t\t\t}\n\n\t\t\t${y}:hover .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t${D("normal","hover")}\n\t\t\t}\n\n\t\t\t${j}>svg{\n\t\t\t\t${s("height",p.desktop.size)}\n\t\t\t\t${s("width",p.desktop.size)}\n\t\t\t\t${s("fill",p.normal.normal.color)}\n\t\t\t\t${s("color",p.normal.normal.color)}\n\t\t\t\ttransition:all ${u.normal.hover.transition}s ease-in-out;\n\t\t\t}\n\n\t\t\t${y}:hover .b-blocks-advanced-tabs-button-icon>svg{\n\t\t\t\t${s("fill",p.normal.hover.color)}\n\t\t\t\t${s("color",p.normal.hover.color)}\n\t\t\t}\n\n\t\t\t${w} .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t${D("active","normal")}\n\t\t\t}\n\n\t\t\t${w} .b-blocks-advanced-tabs-button-icon>svg{\n\t\t\t\t${s("fill",p.active.normal.color)}\n\t\t\t\t${s("color",p.active.normal.color)}\n\t\t\t}\n\n\t\t\t${w}:hover .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t\t${D("active","hover")}\n\t\t\t}\n\n\t\t\t${w}:hover .b-blocks-advanced-tabs-button-icon>svg{\n\t\t\t\t${s("fill",a(p.active.hover.color)?p.active.hover.color:p.normal.hover.color)}\n\t\t\t\t${s("color",a(p.active.hover.color)?p.active.hover.color:p.normal.hover.color)}\n\t\t\t}\n\n\t\t\t${z}{\n\t\t\t\t${O.includes(e?.desktop?.direction)&&s("max-width",h.desktop.width)}\n\t\t\t}\n\n\t\t\t${r}{\n\t\t\t\t${k}{\n\t\t\t\t\t${s("flex-direction",e?.tablet?.direction)}\n\t\t\t\t}\n\t\t\t\t\t${f}{\n\t\t\t\t\t${s("justify-content",N("tablet")?e?.tablet?.columnJustify:e?.tablet?.rowJustify)}\n\t\t\t\t\t${s("flex-direction",L("tablet")?"column":"")}\n\t\t\t\t\t${s("gap",u?.tablet?.gap)}\n\t\t\t\t\t${s("padding",$(i?.tablet?.padding))}\n\t\t\t\t\t${s("margin",$(i?.tablet?.margin))}\n\t\t\t\t\t${s("border-radius",$(i?.tablet?.radius))}\n\t\t\t\t\t${O.includes(e?.tablet?.direction)?s("width",u?.tablet?.width):""}\n\t\t\t\t\t${F.includes(e?.tablet?.direction)?s("flex-wrap",e?.tablet?.wrap):""}\n\t\t\t\t}\n\n\t\t\t\t${y}{\n\t\t\t\t\t${s("width",N("tablet")&&"stretch"===e?.tablet.columnJustify?"100%":"")}\n\t\t\t\t\t${s("height",L("tablet")&&"stretch"===e?.tablet.rowJustify?"100%":"")}\n\t\t\t\t\t${s("justify-content",e?.tablet.contentAlign)}\n\t\t\t\t\t${s("flex-direction",p?.tablet.position)}\n\t\t\t\t\t${C("normal","normal","tablet")}\n\t\t\t\t}\n\t\t\t\t${x}:hover{\n\t\t\t\t\t${C("normal","hover","tablet")}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t${w}{\n\t\t\t\t\t${C("active","normal","tablet")}\n\t\t\t\t}\n\t\t\t\t${w}:hover{\n\t\t\t\t\t${C("active","hover","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${S}{\n\t\t\t\t\t${s("text-align",e?.tablet.contentAlign)}\n\t\t\t\t}\n\n\t\t\t\t${y}:hover .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t\t${D("normal","hover","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${j}>svg{\n\t\t\t\t\t${s("height",p?.tablet.size)}\n\t\t\t\t\t${s("width",p?.tablet.size)}\n\t\t\t\t}\n\n\t\t\t\t${w} .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t\t${D("active","normal","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${w}:hover .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t\t\t${D("active","hover","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${z}{\n\t\t\t\t\t${O.includes(e?.tablet?.direction)&&s("max-width",h?.tablet.width)}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t${l}{\n\t\t\t\t${k}{\n\t\t\t\t\t${s("flex-direction",e?.tablet?.direction)}\n\t\t\t\t}\n\t\t\t\t\t${f}{\n\t\t\t\t\t${s("justify-content",N("tablet")?e?.tablet?.columnJustify:e?.tablet?.rowJustify)}\n\t\t\t\t\t${s("flex-direction",L("tablet")?"column":"")}\n\t\t\t\t\t${s("gap",u?.tablet?.gap)}\n\t\t\t\t\t${s("padding",$(i?.tablet?.padding))}\n\t\t\t\t\t${s("margin",$(i?.tablet?.margin))}\n\t\t\t\t\t${s("border-radius",$(i?.tablet?.radius))}\n\t\t\t\t\t${O.includes(e?.tablet?.direction)?s("width",u?.tablet?.width):""}\n\t\t\t\t\t${F.includes(e?.tablet?.direction)?s("flex-wrap",e?.tablet?.wrap):""}\n\t\t\t\t}\n\n\t\t\t\t${y}{\n\t\t\t\t\t${s("width",N("tablet")&&"stretch"===e?.tablet.columnJustify?"100%":"")}\n\t\t\t\t\t${s("height",L("tablet")&&"stretch"===e?.tablet.rowJustify?"100%":"")}\n\t\t\t\t\t${s("justify-content",e?.tablet.contentAlign)}\n\t\t\t\t\t${s("flex-direction",p?.tablet.position)}\n\t\t\t\t\t${C("normal","normal","tablet")}\n\t\t\t\t}\n\t\t\t\t${x}:hover{\n\t\t\t\t\t${C("normal","hover","tablet")}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t${w}{\n\t\t\t\t\t${C("active","normal","tablet")}\n\t\t\t\t}\n\t\t\t\t${w}:hover{\n\t\t\t\t\t${C("active","hover","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${S}{\n\t\t\t\t\t${s("text-align",e?.tablet.contentAlign)}\n\t\t\t\t}\n\n\t\t\t\t${y}:hover .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t\t${D("normal","hover","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${j}>svg{\n\t\t\t\t\t${s("height",p?.tablet.size)}\n\t\t\t\t\t${s("width",p?.tablet.size)}\n\t\t\t\t}\n\n\t\t\t\t${w} .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t\t${D("active","normal","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${w}:hover .b-blocks-advanced-tabs-button-icon{\n\t\t\t\t\t\t${D("active","hover","tablet")}\n\t\t\t\t}\n\n\t\t\t\t${z}{\n\t\t\t\t\t${O.includes(e?.tablet?.direction)&&s("max-width",h?.tablet.width)}\n\t\t\t\t}\n\t\t\t}\n\n\t`},v=({attributes:t,templateContent:n})=>{const{tabLists:o=[],tabs:a}=t,r=(0,e.useRef)(null),[l,i]=(0,e.useState)(!1),[s,c]=(0,e.useState)(null);(0,e.useEffect)((()=>{if(!r.current||!n)return;if("1"===n.dataset.moved)return void i(!0);const t=Array.from(n.children);r.current.append(...t),n.dataset.moved="1",i(!0)}),[r.current,n]);const b=t=>{c(String(t));const n=r?.current,e=n.querySelectorAll(".b-blocks-advanced-tabs-panel");(Array.from(e)||[]).forEach((n=>{n.classList.contains(`b-blocks-advanced-tabs-panel-${t}`)?n.style.display="block":n.style.display="none"}))};return(0,e.useEffect)((()=>{const t=r?.current,n=t.querySelectorAll(".b-blocks-advanced-tabs-panel");if(l)if(s)b(s);else{const t=(o||[]).find((t=>t.isDefault));if(c(a.isCloseAllTab?"":(t||{id:1})?.id),a.isCloseAllTab)return;(Array.from(n)||[]).forEach((n=>{n.classList.contains(`b-blocks-advanced-tabs-panel-${t.id}`)?n.style.display="block":n.style.display="none"}))}}),[l]),(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"b-blocks-advanced-tabs-main-wrapper"},(0,e.createElement)("div",{className:"b-blocks-advanced-tabs-wrapper","data-close-all":a?.isCloseAllTab},(0,e.createElement)("div",{className:"b-blocks-advanced-tabs-button-lists"},(o||[]).map(((t,n)=>(0,e.createElement)("button",{key:`${n}-${t.id}`,"data-title-tab-id":t.id,className:"b-blocks-advanced-tabs-button "+(s==t.id?"b-blocks-advanced-tabs-button-active":"b-blocks-advanced-tabs-button-normal"),"data-active-tab":t.isDefault,onClick:()=>b(t.id)},a.isShowIcon&&"none"!==t.iconType&&(0,e.createElement)("p",{className:"b-blocks-advanced-tabs-button-icon",dangerouslySetInnerHTML:{__html:t?.[t.iconType]}}),(0,e.createElement)("div",{className:"b-blocks-advanced-tabs-button-title-container"},a.isShowTitle&&(0,e.createElement)("span",{className:"b-blocks-advanced-tabs-button-title",placeholder:"Tab Title",dangerouslySetInnerHTML:{__html:t.title}}),a.isShowSubTitle&&(0,e.createElement)("p",{className:"b-blocks-advanced-tabs-button-subTitle"},t.subTitle)))))),(0,e.createElement)("div",{className:"b-blocks-advanced-tabs-contents",ref:r}))))};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-advanced-tabs[data-attributes]").forEach((t=>{let n={};try{const e=t.dataset.attributes;e&&"undefined"!==e&&""!==e&&(n=JSON.parse(e))}catch(t){console.warn("tab: Invalid attributes JSON",t)}const a=t.querySelector(".b-blocks-advanced-tabs-innerBlocks-contents");a&&((0,o.H)(t).render((0,e.createElement)(e.Fragment,null,(0,e.createElement)("style",{dangerouslySetInnerHTML:{__html:u(n,t.id)}}),(0,e.createElement)(v,{attributes:n,templateContent:a}))),t.removeAttribute("data-attributes"))}))}))})();