From 78c0478be6a9a9707ed90ca877c3e234a092e2e3 Mon Sep 17 00:00:00 2001 From: Juerg Hunziker Date: Wed, 9 Nov 2022 18:22:10 +0100 Subject: [PATCH 1/3] apply default color if color is not set in styleOptions --- build/index.asset.php | 2 +- build/index.js | 2 +- e2e-test-plugins/button-filters/index.js | 5 ++++- src/button/edit.js | 7 +++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index e282d5fa2..3d867f72f 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '7cf780b987df063ad572'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '6010ac73ad30738b341d'); diff --git a/build/index.js b/build/index.js index 2a9d61966..fe05426b9 100644 --- a/build/index.js +++ b/build/index.js @@ -1 +1 @@ -!function(){"use strict";var t,e={623:function(){var t=window.wp.hooks;(0,t.hasFilter)("wpBootstrapBlocks.container.customMarginOptions")&&console.warn("`wpBootstrapBlocks.container.customMarginOptions` filter was renamed to `wpBootstrapBlocks.container.marginAfterOptions`. Please change your filter definition."),(0,t.hasFilter)("wpBootstrapBlocks.container.useFluidContainerPerDefault")&&console.warn("`wpBootstrapBlocks.container.useFluidContainerPerDefault` filter has been removed. Please use `wp_bootstrap_blocks_container_default_attributes` filter (PHP) instead."),(0,t.hasFilter)("wpBootstrapBlocks.row.useOldObjectTemplateStructure")&&console.warn("`wpBootstrapBlocks.row.useOldObjectTemplateStructure` filter has no effect since the old template structure is not supported anymore. You can safely remove this filter.");var e=window.wp.element,o=window.wp.blocks,n=window.wp.components;o.updateCategory&&(0,o.updateCategory)("wp-bootstrap-blocks",{icon:(0,e.createElement)(n.SVG,{viewBox:"0 0 120 120",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Rect,{stroke:"#979797",fill:"#6EA644",x:"-110.5",y:"-123.5",width:"340",height:"367"}),(0,e.createElement)(n.Path,{d:"M105.362393,45.9570783 C103.695123,44.8177711 101.427637,45.2868976 100.293893,46.9623494 C93.6915059,56.9480422 79.6864416,57.4841867 78.952843,57.4841867 C78.8194614,57.4841867 78.7527707,57.4841867 78.6193891,57.4841867 C61.3464764,57.4841867 54.744089,72.2951807 54.4773258,72.8983434 C53.6770365,74.7748494 54.5440166,76.9194277 56.3446678,77.7236446 C56.8115032,77.9246988 57.3450295,78.0587349 57.811865,78.0587349 C59.2123714,78.0587349 60.5461871,77.2545181 61.1464041,75.8471386 C61.2130949,75.7131024 65.7480681,65.5263554 77.418955,64.8561747 L77.418955,83.8222892 C76.9521195,87.9103916 75.0180868,91.127259 71.6168569,93.5399096 C68.0822455,96.0195783 63.3471999,97.2929217 57.5451018,97.2929217 C50.6092605,97.2929217 44.940544,94.8802711 40.7390247,90.121988 C36.4708146,85.3637048 34.3367095,78.5948795 34.3367095,69.8825301 L34.4034003,48.9728916 C34.7368542,41.2658133 36.8042685,35.1671687 40.7390247,30.810994 C45.0072347,26.0527108 50.6092605,23.6400602 57.5451018,23.6400602 C63.3471999,23.6400602 68.0822455,24.9134036 71.6168569,27.3930723 C75.1514684,29.872741 77.1521919,33.2906627 77.4856458,37.7138554 C77.4856458,37.8478916 77.4856458,38.0489458 77.4856458,38.1829819 C77.4856458,40.7296687 79.5530601,42.8072289 82.0873098,42.8072289 C84.6215595,42.8072289 86.6889738,40.7296687 86.6889738,38.1829819 C86.6889738,38.0489458 86.6889738,37.8478916 86.6889738,37.7138554 C86.022066,31.0790663 83.0209807,25.8516566 77.6190274,21.8975904 C72.217074,17.9435241 65.481305,16 57.3450295,16 C47.674866,16 39.8720445,19.2168675 33.9365648,25.5835843 C28.3345391,31.5481928 25.4001447,39.3893072 25.0666908,49.0399096 C25.0666908,49.7100904 25,50.3802711 25,51.0504518 L25.0666908,69.8825301 L25,69.8825301 C25,80.5384036 28.0010852,89.0496988 33.9365648,95.4164157 C39.8720445,101.783133 47.674866,105 57.3450295,105 C65.481305,105 72.217074,103.056476 77.6190274,99.1024096 C82.5541453,95.4834337 85.4885397,90.7251506 86.4889014,84.8275602 L86.6889738,63.7838855 C92.757835,62.309488 101.027492,58.9585843 106.229373,51.0504518 C107.563189,49.375 107.096353,47.0963855 105.362393,45.9570783 Z",stroke:"#FFFFFF",fill:"#FFFFFF"}))});var r=window.wp.i18n,l=window.wp.blockEditor,a=window.wp.editor;function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var o=0;ot.length)&&(e=t.length);for(var o=0,n=new Array(e);o0}})))(O),z=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"})),P=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"})),S=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"})),M=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z"})),V=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z"})),A=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M9 20h6V9H9v11zM4 4v1.5h16V4H4z"})),H=(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M23.58 26.28c0-.600003.1499985-1.099998.45-1.5.3000015-.400002.7433304-.8399976 1.33-1.32.5600028-.4533356.9833319-.8699981 1.27-1.25s.43-.8433306.43-1.39c0-.5466694-.1733316-1.0566643-.52-1.53s-.986662-.71-1.92-.71c-1.1066722 0-1.8533314.2766639-2.24.83-.3866686.5533361-.58 1.1766632-.58 1.87 0 .1466674.0033333.2666662.01.36.0066667.0933338.01.1533332.01.18h-1.78c-.0133334-.0533336-.0266666-.146666-.04-.28-.0133334-.133334-.02-.2733326-.02-.42 0-.7733372.1766649-1.4666636.53-2.08.3533351-.6133364.8899964-1.0999982 1.61-1.46.7200036-.3600018 1.5999948-.54 2.64-.54 1.2133394 0 2.2033295.3233301 2.97.97s1.15 1.5099946 1.15 2.59c0 .7066702-.1033323 1.3033309-.31 1.79-.2066677.4866691-.4533319.8799985-.74 1.18-.2866681.3000015-.6566644.6233316-1.11.97-.4800024.3866686-.8333322.7166653-1.06.99-.2266678.2733347-.34.6233312-.34 1.05v.82h-1.74zm-.14 2.56h2V31h-2zM39 12c1.1046 0 2 .8954 2 2v20c0 1.1046-.8954 2-2 2H9c-1.10457 0-2-.8954-2-2V14c0-1.1046.89543-2 2-2h30zm0 22V14H9v20h30z"})),j=(0,e.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{d:"M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 12.8h8v-1.5H8v1.5z"})),F=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM6 17.5c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h3v10H6zm13.5-.5c0 .3-.2.5-.5.5h-3v-10h3c.3 0 .5.2.5.5v9z"})),R=(0,e.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{d:"M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-4.1 1.5v10H10v-10h4.9zM5.5 17V8c0-.3.2-.5.5-.5h2.5v10H6c-.3 0-.5-.2-.5-.5zm14 0c0 .3-.2.5-.5.5h-2.6v-10H19c.3 0 .5.2.5.5v9z"})),G=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M16 4v5.2c0 .3-.2.5-.5.5h-7c-.3.1-.5-.2-.5-.5V4H6.5v5.2c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V4H16zm-.5 8.8h-7c-1.1 0-2 .9-2 2V20H8v-5.2c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5V20h1.5v-5.2c0-1.2-.9-2-2-2z"})),L=(l||a).InnerBlocks;function N(){return N=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(r[o]=t[o]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(r[o]=t[o])}return r}(t,T);return(0,e.createElement)(n.RangeControl,N({label:o,value:l,onChange:function(t){a(X({},r,t))},min:0,max:12},c))},K=[{name:"primary",color:q},{name:"secondary",color:I}];K=(0,t.applyFilters)("wpBootstrapBlocks.column.bgColorOptions",K);var Q=[{label:(0,r.__)("None","wp-bootstrap-blocks"),value:""},{label:(0,r.__)("Small","wp-bootstrap-blocks"),value:"p-2"},{label:(0,r.__)("Medium","wp-bootstrap-blocks"),value:"p-3"},{label:(0,r.__)("Large","wp-bootstrap-blocks"),value:"p-5"}];Q=(0,t.applyFilters)("wpBootstrapBlocks.column.paddingOptions",Q);var tt=function(t){u(s,t);var o,l,a=(o=s,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=w(o);if(l){var n=w(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return m(this,t)});function s(){return c(this,s),a.apply(this,arguments)}return i(s,[{key:"render",value:function(){var t=this.props,o=t.attributes,l=t.className,a=t.setAttributes,c=t.hasChildBlocks,s=o.sizeXxl,i=o.sizeXl,p=o.sizeLg,u=o.sizeMd,b=o.sizeSm,m=o.sizeXs,w=o.equalWidthXxl,d=o.equalWidthXl,f=o.equalWidthLg,h=o.equalWidthMd,v=o.equalWidthSm,_=o.equalWidthXs,y=o.bgColor,C=o.padding,B=o.centerContent,E=o.contentVerticalAlignment;return B&&a({contentVerticalAlignment:"center",centerContent:!1}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Z,null,(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Column size","wp-bootstrap-blocks"),initialOpen:!1},(0,e.createElement)(J,{label:(0,r.__)("Xs Column count","wp-bootstrap-blocks"),attributeName:"sizeXs",value:m,disabled:_,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Xs equal-width","wp-bootstrap-blocks"),checked:_,onChange:function(t){return a({equalWidthXs:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Sm Column count","wp-bootstrap-blocks"),attributeName:"sizeSm",value:b,disabled:v,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Sm equal-width","wp-bootstrap-blocks"),checked:v,onChange:function(t){return a({equalWidthSm:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Md Column count","wp-bootstrap-blocks"),attributeName:"sizeMd",value:u,disabled:h,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Md equal-width","wp-bootstrap-blocks"),checked:h,onChange:function(t){return a({equalWidthMd:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Lg Column count","wp-bootstrap-blocks"),attributeName:"sizeLg",value:p,disabled:f,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Lg equal-width","wp-bootstrap-blocks"),checked:f,onChange:function(t){return a({equalWidthLg:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Xl Column count","wp-bootstrap-blocks"),attributeName:"sizeXl",value:i,disabled:d,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Xl equal-width","wp-bootstrap-blocks"),checked:d,onChange:function(t){return a({equalWidthXl:t})}}),k()&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Xxl Column count","wp-bootstrap-blocks"),attributeName:"sizeXxl",value:s,disabled:w,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Xxl equal-width","wp-bootstrap-blocks"),checked:w,onChange:function(t){return a({equalWidthXxl:t})}}))),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Background color","wp-bootstrap-blocks"),initialOpen:!1},(0,e.createElement)(n.ColorPalette,{colors:K,value:y,onChange:function(t){if(t){var e=K.find((function(e){return e.color===t}));e&&a({bgColor:e.name})}else a({bgColor:"",centerContent:!1})},disableCustomColors:!0})),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Padding (inside column)","wp-bootstrap-blocks"),initialOpen:!1},(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Size","wp-bootstrap-blocks"),value:C,options:Q,onChange:function(t){a({padding:t})}}))),(0,e.createElement)(U,null,(0,e.createElement)(Y,{value:E,label:(0,r.__)("Change vertical alignment of content","wp-bootstrap-blocks"),onChange:function(t){return a({contentVerticalAlignment:t})},alignmentControls:$})),(0,e.createElement)("div",{className:l},(0,e.createElement)(D,{templateLock:!1,renderAppender:c?void 0:function(){return(0,e.createElement)(D.ButtonBlockAppender,null)}})))}}]),s}(e.Component),et=(0,v.compose)((0,h.withSelect)((function(t,e){var o=e.clientId;return{hasChildBlocks:(0,(t("core/block-editor")||t("core/editor")).getBlockOrder)(o).length>0}})))(tt),ot=(l||a).InnerBlocks;function nt(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}(0,o.registerBlockType)("wp-bootstrap-blocks/column",{title:(0,r.__)("Column (Bootstrap)","wp-bootstrap-blocks"),icon:F,category:"wp-bootstrap-blocks",keywords:[(0,r.__)("Column","wp-bootstrap-blocks"),(0,r.__)("Bootstrap Column","wp-bootstrap-blocks"),(0,r.__)("Bootstrap","wp-bootstrap-blocks")],parent:["wp-bootstrap-blocks/row"],getEditWrapperProps:function(t){var e=t.sizeXxl,o=t.sizeXl,n=t.sizeLg,r=t.sizeMd,l=t.sizeSm,a=t.sizeXs,c=t.equalWidthXxl,s=t.equalWidthXl,i=t.equalWidthLg,p=t.equalWidthMd,u=t.equalWidthSm,b=t.equalWidthXs,m=t.bgColor,w=t.padding,d=t.contentVerticalAlignment,f={};if(m){var h=K.find((function(t){return t.name===m}));h&&(f={backgroundColor:h.color})}return{"data-size-xs":c||s||i||p||u||b?0:a,"data-size-sm":c||s||i||p||u?0:l,"data-size-md":c||s||i||p?0:r,"data-size-lg":c||s||i?0:n,"data-size-xl":c||s?0:o,"data-size-xxl":c?0:e,"data-bg-color":m,"data-padding":w,"data-content-vertical-alignment":d,style:f}},edit:et,save:function(){return(0,e.createElement)(ot.Content,null)}});var rt=l||a,lt=rt.InnerBlocks,at=rt.InspectorControls,ct=rt.BlockControls,st=rt.AlignmentToolbar,it="custom",pt=["wp-bootstrap-blocks/column"],ut=[{name:"1-1",title:(0,r.__)("2 Columns (1:1)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:6}],["wp-bootstrap-blocks/column",{sizeMd:6}]]},{name:"1-2",title:(0,r.__)("2 Columns (1:2)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H20V34H39ZM18 34H9V14H18V34Z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:4}],["wp-bootstrap-blocks/column",{sizeMd:8}]]},{name:"2-1",title:(0,r.__)("2 Columns (2:1)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H30V34H39ZM28 34H9V14H28V34Z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:8}],["wp-bootstrap-blocks/column",{sizeMd:4}]]},{name:"1-1-1",title:(0,r.__)("3 Columns (1:1:1)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",d:"M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM28.5 34h-9V14h9v20zm2 0V14H39v20h-8.5zm-13 0H9V14h8.5v20z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:4}],["wp-bootstrap-blocks/column",{sizeMd:4}],["wp-bootstrap-blocks/column",{sizeMd:4}]]}];ut=function(t){return t.map((function(t){return function(t){for(var e=1;eo){var n=e.template[o][1];p(t.clientId,n)}})),s({template:t}))}(t.name)},className:u===t.name?"is-active":null},(0,e.createElement)("div",{className:"wp-bootstrap-blocks-template-selector-button-label"},t.title)))})))),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Row options","wp-bootstrap-blocks")},(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("No Gutters","wp-bootstrap-blocks"),checked:b,onChange:function(t){return s({noGutters:t})}}),!b&&(g()?(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Gutters","wp-bootstrap-blocks"),value:v,options:dt,onChange:function(t){s({cssGridGutters:t})}}):k()&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Horizontal Gutters","wp-bootstrap-blocks"),value:f,options:mt,onChange:function(t){s({horizontalGutters:t})}}),(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Vertical Gutters","wp-bootstrap-blocks"),value:h,options:wt,onChange:function(t){s({verticalGutters:t})}}))))),(0,e.createElement)(ct,null,!g()&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(st,{value:m,label:(0,r.__)("Change horizontal alignment of columns","wp-bootstrap-blocks"),onChange:function(t){return s({alignment:t})},alignmentControls:_}),(0,e.createElement)(st,{value:w,label:(0,r.__)("Change vertical alignment of columns","wp-bootstrap-blocks"),onChange:function(t){return s({verticalAlignment:t})},alignmentControls:y}))),(0,e.createElement)("div",{className:a},(0,e.createElement)(lt,{allowedBlocks:pt,template:(t=u,o=ut.find((function(e){return e.name===t})),o?o.template:[]),templateLock:ft(u),orientation:"horizontal"})))}}]),s}(e.Component),vt=(0,h.withSelect)((function(t,e){var o=e.clientId,n=(t("core/block-editor")||t("core/editor")).getBlocksByClientId;return{columns:n(o)[0]?n(o)[0].innerBlocks:[]}})),kt=(0,h.withDispatch)((function(t){return{updateBlockAttributes:(t("core/block-editor")||t("core/editor")).updateBlockAttributes}})),gt=(0,v.compose)(vt,kt)(ht);function _t(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function yt(t){for(var e=1;e0?Vt[0].color:""};if(b){var d=Vt.find((function(t){return t.value===b}));d&&(w={backgroundColor:d.color})}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:l,"data-alignment":m,style:w},(0,e.createElement)(xt,{placeholder:(0,r.__)("Add text...","wp-bootstrap-blocks"),value:u,onChange:function(t){return a({text:t})},formattingControls:[],keepPlaceholderOnFocus:!0}),(0,e.createElement)(Pt,null,(0,e.createElement)(n.PanelBody,null,(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Style","wp-bootstrap-blocks"),value:b,options:Vt,onChange:function(t){a({style:t})}})),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Link settings","wp-bootstrap-blocks")},(0,e.createElement)(n.ToggleControl,{label:(0,r.__)("Open in new tab","wp-bootstrap-blocks"),onChange:function(t){var e=t?"_blank":void 0,o=p;e&&!p?o=At:e||p!==At||(o=void 0),a({linkTarget:e,rel:o})},checked:"_blank"===i}),(0,e.createElement)(n.TextControl,{label:(0,r.__)("Link rel","wp-bootstrap-blocks"),value:p||"",onChange:function(t){a({rel:t})}}))),(0,e.createElement)(St,null,(0,e.createElement)(Mt,{value:m,label:(0,r.__)("Change button alignment","wp-bootstrap-blocks"),onChange:function(t){return a({alignment:t})}}))),c&&(0,e.createElement)("form",{className:"wp-block-wp-bootstrap-blocks-button-link",onSubmit:function(t){return t.preventDefault()}},(0,e.createElement)(n.Dashicon,{icon:"admin-links"}),(0,e.createElement)(zt,{value:s,onChange:function(t){return a({url:t})}}),(0,e.createElement)(n.IconButton,{icon:"editor-break",label:(0,r.__)("Apply","wp-bootstrap-blocks"),type:"submit"})))}}]),s}(e.Component),jt=Ht;(0,o.registerBlockType)("wp-bootstrap-blocks/button",{title:(0,r.__)("Button (Bootstrap)","wp-bootstrap-blocks"),icon:j,category:"wp-bootstrap-blocks",keywords:[(0,r.__)("Button","wp-bootstrap-blocks"),(0,r.__)("Bootstrap Button","wp-bootstrap-blocks"),(0,r.__)("Bootstrap","wp-bootstrap-blocks")],example:{},getEditWrapperProps:function(t){return{"data-alignment":t.alignment,"data-style":t.style}},edit:jt,save:function(){return null}})}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var l=o[t]={exports:{}};return e[t](l,l.exports,n),l.exports}n.m=e,t=[],n.O=function(e,o,r,l){if(!o){var a=1/0;for(p=0;p=l)&&Object.keys(n.O).every((function(t){return n.O[t](o[s])}))?o.splice(s--,1):(c=!1,l0&&t[p-1][2]>l;p--)t[p]=t[p-1];t[p]=[o,r,l]},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){var t={826:0,431:0};n.O.j=function(e){return 0===t[e]};var e=function(e,o){var r,l,a=o[0],c=o[1],s=o[2],i=0;if(a.some((function(e){return 0!==t[e]}))){for(r in c)n.o(c,r)&&(n.m[r]=c[r]);if(s)var p=s(n)}for(e&&e(o);it.length)&&(e=t.length);for(var o=0,n=new Array(e);o0}})))(O),z=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"})),P=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"})),S=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"})),M=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z"})),V=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z"})),A=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M9 20h6V9H9v11zM4 4v1.5h16V4H4z"})),H=(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M23.58 26.28c0-.600003.1499985-1.099998.45-1.5.3000015-.400002.7433304-.8399976 1.33-1.32.5600028-.4533356.9833319-.8699981 1.27-1.25s.43-.8433306.43-1.39c0-.5466694-.1733316-1.0566643-.52-1.53s-.986662-.71-1.92-.71c-1.1066722 0-1.8533314.2766639-2.24.83-.3866686.5533361-.58 1.1766632-.58 1.87 0 .1466674.0033333.2666662.01.36.0066667.0933338.01.1533332.01.18h-1.78c-.0133334-.0533336-.0266666-.146666-.04-.28-.0133334-.133334-.02-.2733326-.02-.42 0-.7733372.1766649-1.4666636.53-2.08.3533351-.6133364.8899964-1.0999982 1.61-1.46.7200036-.3600018 1.5999948-.54 2.64-.54 1.2133394 0 2.2033295.3233301 2.97.97s1.15 1.5099946 1.15 2.59c0 .7066702-.1033323 1.3033309-.31 1.79-.2066677.4866691-.4533319.8799985-.74 1.18-.2866681.3000015-.6566644.6233316-1.11.97-.4800024.3866686-.8333322.7166653-1.06.99-.2266678.2733347-.34.6233312-.34 1.05v.82h-1.74zm-.14 2.56h2V31h-2zM39 12c1.1046 0 2 .8954 2 2v20c0 1.1046-.8954 2-2 2H9c-1.10457 0-2-.8954-2-2V14c0-1.1046.89543-2 2-2h30zm0 22V14H9v20h30z"})),j=(0,e.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{d:"M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 12.8h8v-1.5H8v1.5z"})),F=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM6 17.5c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h3v10H6zm13.5-.5c0 .3-.2.5-.5.5h-3v-10h3c.3 0 .5.2.5.5v9z"})),R=(0,e.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{d:"M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-4.1 1.5v10H10v-10h4.9zM5.5 17V8c0-.3.2-.5.5-.5h2.5v10H6c-.3 0-.5-.2-.5-.5zm14 0c0 .3-.2.5-.5.5h-2.6v-10H19c.3 0 .5.2.5.5v9z"})),G=(0,e.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(n.Path,{d:"M16 4v5.2c0 .3-.2.5-.5.5h-7c-.3.1-.5-.2-.5-.5V4H6.5v5.2c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V4H16zm-.5 8.8h-7c-1.1 0-2 .9-2 2V20H8v-5.2c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5V20h1.5v-5.2c0-1.2-.9-2-2-2z"})),L=(l||a).InnerBlocks;function N(){return N=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(r[o]=t[o]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(r[o]=t[o])}return r}(t,T);return(0,e.createElement)(n.RangeControl,N({label:o,value:l,onChange:function(t){a(X({},r,t))},min:0,max:12},c))},K=[{name:"primary",color:q},{name:"secondary",color:I}];K=(0,t.applyFilters)("wpBootstrapBlocks.column.bgColorOptions",K);var Q=[{label:(0,r.__)("None","wp-bootstrap-blocks"),value:""},{label:(0,r.__)("Small","wp-bootstrap-blocks"),value:"p-2"},{label:(0,r.__)("Medium","wp-bootstrap-blocks"),value:"p-3"},{label:(0,r.__)("Large","wp-bootstrap-blocks"),value:"p-5"}];Q=(0,t.applyFilters)("wpBootstrapBlocks.column.paddingOptions",Q);var tt=function(t){u(s,t);var o,l,a=(o=s,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=w(o);if(l){var n=w(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return m(this,t)});function s(){return c(this,s),a.apply(this,arguments)}return i(s,[{key:"render",value:function(){var t=this.props,o=t.attributes,l=t.className,a=t.setAttributes,c=t.hasChildBlocks,s=o.sizeXxl,i=o.sizeXl,p=o.sizeLg,u=o.sizeMd,b=o.sizeSm,m=o.sizeXs,w=o.equalWidthXxl,d=o.equalWidthXl,f=o.equalWidthLg,h=o.equalWidthMd,v=o.equalWidthSm,_=o.equalWidthXs,y=o.bgColor,C=o.padding,B=o.centerContent,E=o.contentVerticalAlignment;return B&&a({contentVerticalAlignment:"center",centerContent:!1}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Z,null,(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Column size","wp-bootstrap-blocks"),initialOpen:!1},(0,e.createElement)(J,{label:(0,r.__)("Xs Column count","wp-bootstrap-blocks"),attributeName:"sizeXs",value:m,disabled:_,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Xs equal-width","wp-bootstrap-blocks"),checked:_,onChange:function(t){return a({equalWidthXs:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Sm Column count","wp-bootstrap-blocks"),attributeName:"sizeSm",value:b,disabled:v,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Sm equal-width","wp-bootstrap-blocks"),checked:v,onChange:function(t){return a({equalWidthSm:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Md Column count","wp-bootstrap-blocks"),attributeName:"sizeMd",value:u,disabled:h,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Md equal-width","wp-bootstrap-blocks"),checked:h,onChange:function(t){return a({equalWidthMd:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Lg Column count","wp-bootstrap-blocks"),attributeName:"sizeLg",value:p,disabled:f,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Lg equal-width","wp-bootstrap-blocks"),checked:f,onChange:function(t){return a({equalWidthLg:t})}}),(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Xl Column count","wp-bootstrap-blocks"),attributeName:"sizeXl",value:i,disabled:d,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Xl equal-width","wp-bootstrap-blocks"),checked:d,onChange:function(t){return a({equalWidthXl:t})}}),k()&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("hr",null),(0,e.createElement)(J,{label:(0,r.__)("Xxl Column count","wp-bootstrap-blocks"),attributeName:"sizeXxl",value:s,disabled:w,setAttributes:a}),!g()&&(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("Xxl equal-width","wp-bootstrap-blocks"),checked:w,onChange:function(t){return a({equalWidthXxl:t})}}))),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Background color","wp-bootstrap-blocks"),initialOpen:!1},(0,e.createElement)(n.ColorPalette,{colors:K,value:y,onChange:function(t){if(t){var e=K.find((function(e){return e.color===t}));e&&a({bgColor:e.name})}else a({bgColor:"",centerContent:!1})},disableCustomColors:!0})),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Padding (inside column)","wp-bootstrap-blocks"),initialOpen:!1},(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Size","wp-bootstrap-blocks"),value:C,options:Q,onChange:function(t){a({padding:t})}}))),(0,e.createElement)(U,null,(0,e.createElement)(Y,{value:E,label:(0,r.__)("Change vertical alignment of content","wp-bootstrap-blocks"),onChange:function(t){return a({contentVerticalAlignment:t})},alignmentControls:$})),(0,e.createElement)("div",{className:l},(0,e.createElement)(D,{templateLock:!1,renderAppender:c?void 0:function(){return(0,e.createElement)(D.ButtonBlockAppender,null)}})))}}]),s}(e.Component),et=(0,v.compose)((0,h.withSelect)((function(t,e){var o=e.clientId;return{hasChildBlocks:(0,(t("core/block-editor")||t("core/editor")).getBlockOrder)(o).length>0}})))(tt),ot=(l||a).InnerBlocks;function nt(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}(0,o.registerBlockType)("wp-bootstrap-blocks/column",{title:(0,r.__)("Column (Bootstrap)","wp-bootstrap-blocks"),icon:F,category:"wp-bootstrap-blocks",keywords:[(0,r.__)("Column","wp-bootstrap-blocks"),(0,r.__)("Bootstrap Column","wp-bootstrap-blocks"),(0,r.__)("Bootstrap","wp-bootstrap-blocks")],parent:["wp-bootstrap-blocks/row"],getEditWrapperProps:function(t){var e=t.sizeXxl,o=t.sizeXl,n=t.sizeLg,r=t.sizeMd,l=t.sizeSm,a=t.sizeXs,c=t.equalWidthXxl,s=t.equalWidthXl,i=t.equalWidthLg,p=t.equalWidthMd,u=t.equalWidthSm,b=t.equalWidthXs,m=t.bgColor,w=t.padding,d=t.contentVerticalAlignment,f={};if(m){var h=K.find((function(t){return t.name===m}));h&&(f={backgroundColor:h.color})}return{"data-size-xs":c||s||i||p||u||b?0:a,"data-size-sm":c||s||i||p||u?0:l,"data-size-md":c||s||i||p?0:r,"data-size-lg":c||s||i?0:n,"data-size-xl":c||s?0:o,"data-size-xxl":c?0:e,"data-bg-color":m,"data-padding":w,"data-content-vertical-alignment":d,style:f}},edit:et,save:function(){return(0,e.createElement)(ot.Content,null)}});var rt=l||a,lt=rt.InnerBlocks,at=rt.InspectorControls,ct=rt.BlockControls,st=rt.AlignmentToolbar,it="custom",pt=["wp-bootstrap-blocks/column"],ut=[{name:"1-1",title:(0,r.__)("2 Columns (1:1)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:6}],["wp-bootstrap-blocks/column",{sizeMd:6}]]},{name:"1-2",title:(0,r.__)("2 Columns (1:2)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H20V34H39ZM18 34H9V14H18V34Z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:4}],["wp-bootstrap-blocks/column",{sizeMd:8}]]},{name:"2-1",title:(0,r.__)("2 Columns (2:1)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H30V34H39ZM28 34H9V14H28V34Z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:8}],["wp-bootstrap-blocks/column",{sizeMd:4}]]},{name:"1-1-1",title:(0,r.__)("3 Columns (1:1:1)","wp-bootstrap-blocks"),icon:(0,e.createElement)(n.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{fillRule:"evenodd",d:"M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM28.5 34h-9V14h9v20zm2 0V14H39v20h-8.5zm-13 0H9V14h8.5v20z"})),templateLock:"all",template:[["wp-bootstrap-blocks/column",{sizeMd:4}],["wp-bootstrap-blocks/column",{sizeMd:4}],["wp-bootstrap-blocks/column",{sizeMd:4}]]}];ut=function(t){return t.map((function(t){return function(t){for(var e=1;eo){var n=e.template[o][1];p(t.clientId,n)}})),s({template:t}))}(t.name)},className:u===t.name?"is-active":null},(0,e.createElement)("div",{className:"wp-bootstrap-blocks-template-selector-button-label"},t.title)))})))),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Row options","wp-bootstrap-blocks")},(0,e.createElement)(n.CheckboxControl,{label:(0,r.__)("No Gutters","wp-bootstrap-blocks"),checked:b,onChange:function(t){return s({noGutters:t})}}),!b&&(g()?(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Gutters","wp-bootstrap-blocks"),value:v,options:dt,onChange:function(t){s({cssGridGutters:t})}}):k()&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Horizontal Gutters","wp-bootstrap-blocks"),value:f,options:mt,onChange:function(t){s({horizontalGutters:t})}}),(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Vertical Gutters","wp-bootstrap-blocks"),value:h,options:wt,onChange:function(t){s({verticalGutters:t})}}))))),(0,e.createElement)(ct,null,!g()&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(st,{value:m,label:(0,r.__)("Change horizontal alignment of columns","wp-bootstrap-blocks"),onChange:function(t){return s({alignment:t})},alignmentControls:_}),(0,e.createElement)(st,{value:w,label:(0,r.__)("Change vertical alignment of columns","wp-bootstrap-blocks"),onChange:function(t){return s({verticalAlignment:t})},alignmentControls:y}))),(0,e.createElement)("div",{className:a},(0,e.createElement)(lt,{allowedBlocks:pt,template:(t=u,o=ut.find((function(e){return e.name===t})),o?o.template:[]),templateLock:ft(u),orientation:"horizontal"})))}}]),s}(e.Component),vt=(0,h.withSelect)((function(t,e){var o=e.clientId,n=(t("core/block-editor")||t("core/editor")).getBlocksByClientId;return{columns:n(o)[0]?n(o)[0].innerBlocks:[]}})),kt=(0,h.withDispatch)((function(t){return{updateBlockAttributes:(t("core/block-editor")||t("core/editor")).updateBlockAttributes}})),gt=(0,v.compose)(vt,kt)(ht);function _t(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function yt(t){for(var e=1;e0?Vt[0].color:"#007bff"};if(b){var d=Vt.find((function(t){return t.value===b}));null!=d&&d.color&&(w={backgroundColor:d.color})}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:l,"data-alignment":m,style:w},(0,e.createElement)(xt,{placeholder:(0,r.__)("Add text...","wp-bootstrap-blocks"),value:u,onChange:function(t){return a({text:t})},formattingControls:[],keepPlaceholderOnFocus:!0}),(0,e.createElement)(Pt,null,(0,e.createElement)(n.PanelBody,null,(0,e.createElement)(n.SelectControl,{label:(0,r.__)("Style","wp-bootstrap-blocks"),value:b,options:Vt,onChange:function(t){a({style:t})}})),(0,e.createElement)(n.PanelBody,{title:(0,r.__)("Link settings","wp-bootstrap-blocks")},(0,e.createElement)(n.ToggleControl,{label:(0,r.__)("Open in new tab","wp-bootstrap-blocks"),onChange:function(t){var e=t?"_blank":void 0,o=p;e&&!p?o=At:e||p!==At||(o=void 0),a({linkTarget:e,rel:o})},checked:"_blank"===i}),(0,e.createElement)(n.TextControl,{label:(0,r.__)("Link rel","wp-bootstrap-blocks"),value:p||"",onChange:function(t){a({rel:t})}}))),(0,e.createElement)(St,null,(0,e.createElement)(Mt,{value:m,label:(0,r.__)("Change button alignment","wp-bootstrap-blocks"),onChange:function(t){return a({alignment:t})}}))),c&&(0,e.createElement)("form",{className:"wp-block-wp-bootstrap-blocks-button-link",onSubmit:function(t){return t.preventDefault()}},(0,e.createElement)(n.Dashicon,{icon:"admin-links"}),(0,e.createElement)(zt,{value:s,onChange:function(t){return a({url:t})}}),(0,e.createElement)(n.IconButton,{icon:"editor-break",label:(0,r.__)("Apply","wp-bootstrap-blocks"),type:"submit"})))}}]),s}(e.Component),jt=Ht;(0,o.registerBlockType)("wp-bootstrap-blocks/button",{title:(0,r.__)("Button (Bootstrap)","wp-bootstrap-blocks"),icon:j,category:"wp-bootstrap-blocks",keywords:[(0,r.__)("Button","wp-bootstrap-blocks"),(0,r.__)("Bootstrap Button","wp-bootstrap-blocks"),(0,r.__)("Bootstrap","wp-bootstrap-blocks")],example:{},getEditWrapperProps:function(t){return{"data-alignment":t.alignment,"data-style":t.style}},edit:jt,save:function(){return null}})}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var l=o[t]={exports:{}};return e[t](l,l.exports,n),l.exports}n.m=e,t=[],n.O=function(e,o,r,l){if(!o){var a=1/0;for(p=0;p=l)&&Object.keys(n.O).every((function(t){return n.O[t](o[s])}))?o.splice(s--,1):(c=!1,l0&&t[p-1][2]>l;p--)t[p]=t[p-1];t[p]=[o,r,l]},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){var t={826:0,431:0};n.O.j=function(e){return 0===t[e]};var e=function(e,o){var r,l,a=o[0],c=o[1],s=o[2],i=0;if(a.some((function(e){return 0!==t[e]}))){for(r in c)n.o(c,r)&&(n.m[r]=c[r]);if(s)var p=s(n)}for(e&&e(o);i 0 ? styleOptions[ 0 ].color : '', + styleOptions.length > 0 + ? styleOptions[ 0 ].color + : DEFAULT_COLOR, }; if ( style ) { const selectedButtonColor = styleOptions.find( ( styleOption ) => styleOption.value === style ); - if ( selectedButtonColor ) { + if ( selectedButtonColor?.color ) { inlineStyle = { backgroundColor: selectedButtonColor.color, }; From eabdc7fce760f88e693fcf88edb67c004f72db24 Mon Sep 17 00:00:00 2001 From: Juerg Hunziker Date: Wed, 9 Nov 2022 18:25:43 +0100 Subject: [PATCH 2/3] set version to 4.3.1 --- languages/wp-bootstrap-blocks-de_CH.po | 2 +- languages/wp-bootstrap-blocks-de_DE.po | 2 +- languages/wp-bootstrap-blocks.pot | 2 +- package-lock.json | 4 ++-- package.json | 2 +- readme.txt | 6 +++++- src/class-wp-bootstrap-blocks.php | 2 +- wp-bootstrap-blocks.php | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/languages/wp-bootstrap-blocks-de_CH.po b/languages/wp-bootstrap-blocks-de_CH.po index ff1cb28af..9fdc9934b 100644 --- a/languages/wp-bootstrap-blocks-de_CH.po +++ b/languages/wp-bootstrap-blocks-de_CH.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Bootstrap Blocks plugin. msgid "" msgstr "" -"Project-Id-Version: Bootstrap Blocks 4.3.0\n" +"Project-Id-Version: Bootstrap Blocks 4.3.1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-" "blocks\n" "POT-Creation-Date: 2022-05-12T07:38:53+00:00\n" diff --git a/languages/wp-bootstrap-blocks-de_DE.po b/languages/wp-bootstrap-blocks-de_DE.po index d49b94e23..5daf556fe 100644 --- a/languages/wp-bootstrap-blocks-de_DE.po +++ b/languages/wp-bootstrap-blocks-de_DE.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Bootstrap Blocks plugin. msgid "" msgstr "" -"Project-Id-Version: Bootstrap Blocks 4.3.0\n" +"Project-Id-Version: Bootstrap Blocks 4.3.1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-" "blocks\n" "POT-Creation-Date: 2022-05-12T07:38:53+00:00\n" diff --git a/languages/wp-bootstrap-blocks.pot b/languages/wp-bootstrap-blocks.pot index 82b481bd1..745cd0031 100644 --- a/languages/wp-bootstrap-blocks.pot +++ b/languages/wp-bootstrap-blocks.pot @@ -2,7 +2,7 @@ # This file is distributed under the GPL2+. msgid "" msgstr "" -"Project-Id-Version: Bootstrap Blocks 4.3.0\n" +"Project-Id-Version: Bootstrap Blocks 4.3.1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-blocks\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/package-lock.json b/package-lock.json index e5b8e70d4..e445f8ceb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wp-bootstrap-blocks", - "version": "4.3.0", + "version": "4.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "wp-bootstrap-blocks", - "version": "4.3.0", + "version": "4.3.1", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/block-editor": "^9.8.0", diff --git a/package.json b/package.json index 8b639796c..e3c7d3712 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-bootstrap-blocks", - "version": "4.3.0", + "version": "4.3.1", "private": true, "description": "Bootstrap Gutenberg Blocks for WordPress", "author": "Liip AG", diff --git a/readme.txt b/readme.txt index d1b651cd9..5b4639e3c 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: gutenberg, blocks, bootstrap Requires at least: 5.0 Tested up to: 6.1 Requires PHP: 5.6 -Stable tag: 4.3.0 +Stable tag: 4.3.1 License: GPLv2 License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -143,6 +143,10 @@ Please create a new GitHub issue and let us know: [https://github.com/liip/boots == Changelog == += 4.3.1 = + +* [FIX] Apply default color to button if `color` attribute is missing in `styleOptions`. + = 4.3.0 = **NOTICE:** Version 4.x of the plugin will be the last version to support WordPress versions lower than 5.3. diff --git a/src/class-wp-bootstrap-blocks.php b/src/class-wp-bootstrap-blocks.php index 887325b8c..f5ec0cc33 100755 --- a/src/class-wp-bootstrap-blocks.php +++ b/src/class-wp-bootstrap-blocks.php @@ -33,7 +33,7 @@ class WP_Bootstrap_Blocks { * * @var string */ - public static $version = '4.3.0'; + public static $version = '4.3.1'; /** * The plugin token. diff --git a/wp-bootstrap-blocks.php b/wp-bootstrap-blocks.php index 126626431..4189ba6e2 100755 --- a/wp-bootstrap-blocks.php +++ b/wp-bootstrap-blocks.php @@ -5,7 +5,7 @@ * Description: Bootstrap Gutenberg Blocks for WordPress. * Author: Liip AG * Author URI: https://liip.ch - * Version: 4.3.0 + * Version: 4.3.1 * License: GPL2+ * License URI: https://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: wp-bootstrap-blocks From c0b805172c36c45ccc557843badd6eb5c16e58ef Mon Sep 17 00:00:00 2001 From: Juerg Hunziker Date: Thu, 10 Nov 2022 10:16:38 +0100 Subject: [PATCH 3/3] move version 4 notice in changelog --- readme.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.txt b/readme.txt index 5b4639e3c..6ea7c23de 100644 --- a/readme.txt +++ b/readme.txt @@ -145,13 +145,13 @@ Please create a new GitHub issue and let us know: [https://github.com/liip/boots = 4.3.1 = +**NOTICE:** Version 4.x of the plugin will be the last version to support WordPress versions lower than 5.3. +If you're on a lower version of WordPress think about updating it if you still would like receive updates for this plugin. + * [FIX] Apply default color to button if `color` attribute is missing in `styleOptions`. = 4.3.0 = -**NOTICE:** Version 4.x of the plugin will be the last version to support WordPress versions lower than 5.3. -If you're on a lower version of WordPress think about updating it if you still would like receive updates for this plugin. - * [COMPATIBILITY] Tested up to WordPress 6.1. * [CHANGE] Set default `style` attribute of the Button block to `primary`. This shouldn't be a breaking change since the template already added the `btn-primary` class if no `style` was selected. * [FEATURE] Add `color` attribute to the `styleOptions` to be able to display the buttons in the correct color in the editor. If you have changed the `styleOptions` via the [`wpBootstrapBlocks.button.styleOptions`](https://github.com/liip/bootstrap-blocks-wordpress-plugin#wpbootstrapblocksbuttonstyleoptions) JavaScript filter please add the according colors to your style objects.