| 1 |
(()=>{"use strict";var t={4288(){const t=window.wp.blocks,e=window.wp.i18n,l=window.GetwidComponents,n=window.wp.blockEditor,i=window.wp.components,o=window.ReactJSXRuntime,a=[{value:"",label:(0,e.__)("Default","getwid")},{value:"small",label:(0,e.__)("Small","getwid")},{value:"medium",label:(0,e.__)("Medium","getwid")},{value:"normal",label:(0,e.__)("Normal","getwid")},{value:"large",label:(0,e.__)("Large","getwid")},{value:"none",label:(0,e.__)("None","getwid")}],s=[{value:"left",label:(0,e.__)("Left","getwid")},{value:"center",label:(0,e.__)("Center","getwid")},{value:"right",label:(0,e.__)("Right","getwid")}],r=[{value:"",label:(0,e.__)("Default","getwid")},...s],d=[{value:"row",label:(0,e.__)("Horizontal","getwid")},{value:"column",label:(0,e.__)("Vertical","getwid")}],c=[{value:"",label:(0,e.__)("Default","getwid")},...d],u=[{value:"auto",label:(0,e.__)("Auto","getwid")},{value:"100",label:(0,e.__)("100%","getwid")},{value:"50",label:(0,e.__)("50%","getwid")},{value:"33",label:(0,e.__)("33%","getwid")},{value:"25",label:(0,e.__)("25%","getwid")},{value:"20",label:(0,e.__)("20%","getwid")}];function g({attributes:t,setAttributes:l}){const{spacing:g,alignment:b,alignmentTablet:w,alignmentMobile:h,direction:p,directionTablet:_,directionMobile:m,width:v,widthTablet:f,widthMobile:x}=t;return(0,o.jsx)(n.InspectorControls,{children:(0,o.jsxs)(i.PanelBody,{title:(0,e.__)("Settings","getwid"),children:[(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Horizontal space between buttons","getwid"),value:void 0!==g?g:"",onChange:t=>l({spacing:t}),options:a}),(0,o.jsx)(i.TabPanel,{className:"getwid-editor-tabs",activeClass:"is-active",tabs:[{name:"desktop",title:(0,e.__)("Desktop","getwid"),className:"components-button is-link is-small"},{name:"tablet",title:(0,e.__)("Tablet","getwid"),className:"components-button is-link is-small"},{name:"mobile",title:(0,e.__)("Mobile","getwid"),className:"components-button is-link is-small"}],children:t=>(0,o.jsxs)(o.Fragment,{children:["desktop"===t.name&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Horizontal Alignment","getwid"),value:b,onChange:t=>l({alignment:t}),options:s}),(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Direction","getwid"),value:p,onChange:t=>l({direction:t}),options:d}),(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Button Width","getwid"),value:v,onChange:t=>l({width:t}),options:u})]}),"tablet"===t.name&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Horizontal Alignment","getwid"),value:w,onChange:t=>l({alignmentTablet:t}),options:r}),(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Direction","getwid"),value:_,onChange:t=>l({directionTablet:t}),options:c}),(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Button Width","getwid"),value:f,onChange:t=>l({widthTablet:t}),options:u})]}),"mobile"===t.name&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Horizontal Alignment","getwid"),value:h,onChange:t=>l({alignmentMobile:t}),options:r}),(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Direction","getwid"),value:m,onChange:t=>l({directionMobile:t}),options:c}),(0,o.jsx)(i.SelectControl,{label:(0,e.__)("Button Width","getwid"),value:x,onChange:t=>l({widthMobile:t}),options:u})]})]})})]})})}function b(t){var e,l,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(l=b(t[e]))&&(n&&(n+=" "),n+=l)}else for(l in t)t[l]&&(n&&(n+=" "),n+=l);return n}function w(t){const{spacing:e,alignment:l,alignmentTablet:n,alignmentMobile:i,direction:o,directionTablet:a,directionMobile:s,width:r,widthTablet:d,widthMobile:c}=t;return function(){for(var t,e,l=0,n="",i=arguments.length;l<i;l++)(t=arguments[l])&&(e=b(t))&&(n&&(n+=" "),n+=e);return n}("wp-block-getwid-button-group__wrapper",{[`has-spacing-${e}`]:""!==e,[`has-alignment-${l}`]:"left"!==l,[`has-alignment-tablet-${n}`]:""!==n,[`has-alignment-mobile-${i}`]:""!==i,[`has-direction-${o}`]:"row"!==o,[`has-direction-tablet-${a}`]:""!==a,[`has-direction-mobile-${s}`]:""!==s,[`has-width-${r}`]:"auto"!==r,[`has-width-tablet-${d}`]:"auto"!==d,[`has-width-mobile-${c}`]:"auto"!==c})}const h=[["core/button",{text:(0,e.__)("Button","getwid")}],["core/button",{text:(0,e.__)("Button","getwid")}]];function p(){return(0,o.jsxs)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,o.jsx)(i.Path,{d:"M22,3v6H2V3H22 M24,1H0v10h24V1L24,1z"}),(0,o.jsx)(i.Rect,{x:"4",y:"5",width:"16",height:"2"}),(0,o.jsx)(i.Path,{d:"M22,15v6H2v-6H22 M24,13H0v10h24V13L24,13z"}),(0,o.jsx)(i.Rect,{x:"4",y:"17",width:"16",height:"2"})]})}const _=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"textdomain":"getwid","name":"getwid/button-group","description":"Arranges buttons in a customizable group.","category":"getwid-blocks","title":"Button Group","attributes":{"spacing":{"type":"string","default":""},"alignment":{"type":"string","default":"left"},"alignmentTablet":{"type":"string","default":""},"alignmentMobile":{"type":"string","default":""},"direction":{"type":"string","default":"row"},"directionTablet":{"type":"string","default":""},"directionMobile":{"type":"string","default":""},"width":{"type":"string","default":"auto"},"widthTablet":{"type":"string","default":"auto"},"widthMobile":{"type":"string","default":"auto"}},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'),m=window.wp.data,v={to:[{type:"block",blocks:["core/button"],transform:()=>{const e=(0,m.select)("core/block-editor"),l=e.getSelectedBlockClientId(),n=l&&e.getBlock(l)?.innerBlocks||[],i=[];return n.forEach(t=>{const e=t.attributes;""!==e.text&&i.push({text:e.text,url:e.url})}),i.map(({text:e,url:l})=>(0,t.createBlock)("core/button",{text:e,url:l}))}}]},f="getwid/button-group";window.wp.hooks.addFilter("blocks.registerBlockType","getwid/button-group/core-button-settings",function(t,e){return"core/button"!==e?t:{...t,parent:[...t.parent||[],f]}}),(0,t.registerBlockType)(_,{title:(0,e.__)("Button Group","getwid"),icon:(0,o.jsx)(p,{}),transforms:v,edit:(0,l.MaybeBlockIsDisabled)(f)||function(t){const{attributes:e}=t,l=(0,n.useBlockProps)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g,{...t}),(0,o.jsx)("div",{...l,children:(0,o.jsx)("div",{className:w(e),children:(0,o.jsx)(n.InnerBlocks,{template:h,allowedBlocks:["core/button"],templateInsertUpdatesSelection:!1})})})]})},save:function({attributes:t}){const e=n.useBlockProps.save();return(0,o.jsx)("div",{...e,children:(0,o.jsx)("div",{className:w(t),children:(0,o.jsx)(n.InnerBlocks.Content,{})})})}})}};const e={};function l(n){const i=e[n];if(void 0!==i)return i.exports;const o=e[n]={exports:{}};return t[n](o,o.exports,l),o.exports}l.m=t,(()=>{const t=[];l.O=(e,n,i,o)=>{if(n){o=o||0;for(var a=t.length;a>0&&t[a-1][2]>o;a--)t[a]=t[a-1];return void(t[a]=[n,i,o])}let s=1/0;for(a=0;a<t.length;a++){let[n,i,o]=t[a],d=!0;for(var r=0;r<n.length;r++)(!1&o||s>=o)&&Object.keys(l.O).every(t=>l.O[t](n[r]))?n.splice(r--,1):(d=!1,o<s&&(s=o));if(d){t.splice(a--,1);const l=i();void 0!==l&&(e=l)}}return e}})(),l.o=(t,e)=>Object.hasOwn(t,e),(()=>{const t={3980:0,6292:0};l.O.j=e=>0===t[e];const e=(e,n)=>{let[i,o,a]=n;var s,r,d=0;if(i.some(e=>0!==t[e])){for(s in o)l.o(o,s)&&(l.m[s]=o[s]);if(a)var c=a(l)}for(e&&e(n);d<i.length;d++)r=i[d],l.o(t,r)&&t[r]&&t[r][0](),t[r]=0;return l.O(c)},n=globalThis.webpackChunkgetwid||=[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();let n=l.O(void 0,[6292],()=>l(4288));n=l.O(n)})(); |