diff --git a/build/contact-field.asset.php b/build/contact-field.asset.php index c99ff9a..bc1d72a 100644 --- a/build/contact-field.asset.php +++ b/build/contact-field.asset.php @@ -1 +1 @@ - array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'ac19121b62d36c13d2f2'); + array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'cbf4f7f67603f4e4ffe4'); diff --git a/build/contact-field.css b/build/contact-field.css index aae705f..467ce92 100644 --- a/build/contact-field.css +++ b/build/contact-field.css @@ -1 +1 @@ -.wp-block-oik-contact-field{display:grid;gap:10px;grid-template-columns:1fr 3fr} +.wp-block-oik-contact-field.is-style-grid>div,.wp-block-oik-contact-field.is-style-reversed>div{display:grid;gap:10px;grid-template-columns:1fr 3fr}.wp-block-oik-contact-field.is-style-reversed>div .label{grid-column-start:2;grid-row-start:1}.wp-block-oik-contact-field.is-style-reversed>div .field{grid-column-start:1;grid-row-start:1} diff --git a/build/contact-field.js b/build/contact-field.js index 4c41235..a561c0a 100644 --- a/build/contact-field.js +++ b/build/contact-field.js @@ -1 +1 @@ -!function(){var e={184:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function l(){for(var e=[],t=0;t{let{setAttributes:r,type:n,name:l,required:a}=t;return"textarea"===n?(0,e.createElement)(i.TextareaControl,{type:n,name:l,required:a}):"checkbox"===n?(0,e.createElement)(i.CheckboxControl,{name:l,required:a}):(0,e.createElement)(i.TextControl,{type:n,name:l,required:a})},c=[{label:(0,t.__)("Text","oik"),value:"text"},{label:(0,t.__)("Textarea","oik"),value:"textarea"},{label:(0,t.__)("Email","oik"),value:"email"},{label:(0,t.__)("Checkbox","oik"),value:"checkbox"}];(0,a.registerBlockType)("oik/contact-field",{example:{},edit:r=>{const{attributes:n,setAttributes:a,instanceId:s,focus:d,isSelected:p}=r,{textAlign:m,label:b}=r.attributes,f=(0,o.useBlockProps)({className:l()({[`has-text-align-${m}`]:m})});return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(o.InspectorControls,null,(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.PanelRow,null,(0,e.createElement)(i.TextControl,{label:(0,t.__)("Label","oik"),value:n.label,onChange:e=>{r.setAttributes({label:e})}}))),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.PanelRow,null,(0,e.createElement)(i.SelectControl,{label:(0,t.__)("Type","oik"),value:n.type,onChange:e=>{r.setAttributes({type:e})},options:c}))),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.PanelRow,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Required?","oik"),checked:!!n.required,onChange:e=>{r.setAttributes({required:e})}})),(0,e.createElement)(i.PanelRow,null,(0,e.createElement)(i.TextControl,{label:(0,t.__)("Required indicator","oik"),value:n.requiredIndicator,onChange:e=>{r.setAttributes({requiredIndicator:e})}})))),(0,e.createElement)("div",f,(0,e.createElement)("div",{className:"label"},(0,e.createElement)("label",{for:n.name},n.label,n.required&&(0,e.createElement)("span",{className:"required"},n.requiredIndicator))),(0,e.createElement)("div",{className:"field"},(0,e.createElement)(u,{type:n.type,name:n.name,required:n.required}))))},save(){return null}})}()}(); \ No newline at end of file +!function(){var e,t={793:function(e,t,r){"use strict";var n=window.wp.element,l=window.wp.i18n,a=(r(184),window.wp.blocks),o=window.wp.blockEditor,i=(window.wp.serverSideRender,window.wp.components);window.lodash;const u=e=>{let{setAttributes:t,type:r,name:l,required:a}=e;return"textarea"===r?(0,n.createElement)(i.TextareaControl,{type:r,name:l,required:a}):"checkbox"===r?(0,n.createElement)(i.CheckboxControl,{name:l,required:a}):(0,n.createElement)(i.TextControl,{type:r,name:l,required:a})},c=[{label:(0,l.__)("Text","oik"),value:"text"},{label:(0,l.__)("Textarea","oik"),value:"textarea"},{label:(0,l.__)("Email","oik"),value:"email"},{label:(0,l.__)("Checkbox","oik"),value:"checkbox"}];(0,a.registerBlockType)("oik/contact-field",{example:{},edit:e=>{const{attributes:t,setAttributes:r,instanceId:a,focus:s,isSelected:d}=e,{textAlign:p,label:m}=e.attributes,f=(0,o.useBlockProps)();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(o.InspectorControls,null,(0,n.createElement)(i.PanelBody,null,(0,n.createElement)(i.PanelRow,null,(0,n.createElement)(i.TextControl,{label:(0,l.__)("Label","oik"),value:t.label,onChange:t=>{e.setAttributes({label:t})}}))),(0,n.createElement)(i.PanelBody,null,(0,n.createElement)(i.PanelRow,null,(0,n.createElement)(i.SelectControl,{label:(0,l.__)("Type","oik"),value:t.type,onChange:t=>{e.setAttributes({type:t})},options:c}))),(0,n.createElement)(i.PanelBody,null,(0,n.createElement)(i.PanelRow,null,(0,n.createElement)(i.ToggleControl,{label:(0,l.__)("Required?","oik"),checked:!!t.required,onChange:t=>{e.setAttributes({required:t})}})),(0,n.createElement)(i.PanelRow,null,(0,n.createElement)(i.TextControl,{label:(0,l.__)("Required indicator","oik"),value:t.requiredIndicator,onChange:t=>{e.setAttributes({requiredIndicator:t})}})))),(0,n.createElement)("div",f,(0,n.createElement)("div",null,(0,n.createElement)("div",{className:"label"},(0,n.createElement)("label",{for:t.name},t.label,t.required&&(0,n.createElement)("span",{className:"required"},t.requiredIndicator))),(0,n.createElement)("div",{className:"field"},(0,n.createElement)(u,{type:t.type,name:t.name,required:t.required})))))},save(){return null}})},184:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function l(){for(var e=[],t=0;t=a)&&Object.keys(n.O).every((function(e){return n.O[e](r[u])}))?r.splice(u--,1):(i=!1,a0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[r,l,a]},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={929:0,603:0};n.O.j=function(t){return 0===e[t]};var t=function(t,r){var l,a,o=r[0],i=r[1],u=r[2],c=0;if(o.some((function(t){return 0!==e[t]}))){for(l in i)n.o(i,l)&&(n.m[l]=i[l]);if(u)var s=u(n)}for(t&&t(r);c array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '4933b59e816992dcde1e'); + array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '07594a43391158a7810b'); diff --git a/build/contact-form.js b/build/contact-form.js index d18eaef..ba5f8be 100644 --- a/build/contact-form.js +++ b/build/contact-form.js @@ -1 +1 @@ -!function(){var e,t={290:function(e,t,r){"use strict";var n=window.wp.element,o=window.wp.i18n,i=r(184),a=r.n(i),c=window.wp.blocks,l=window.wp.blockEditor,u=(window.wp.serverSideRender,window.wp.components);window.lodash;const{createBlock:s}=wp.blocks,f={from:[{type:"block",blocks:["oik-block/contact-form"],transform:function(e){return s("oik/contact-form",{})}},{type:"shortcode",tag:"bw_contact_form",attributes:{user:{type:"string",shortcode:e=>{let{named:{user:t}}=e;return t}},contact:{type:"string",shortcode:e=>{let{named:{contact:t}}=e;return t}},email:{type:"string",shortcode:e=>{let{named:{email:t}}=e;return t}}}}]};(0,c.registerBlockType)("oik/contact-form",{example:{},transforms:f,edit:e=>{const{attributes:t,setAttributes:r,instanceId:i,focus:c,isSelected:s}=e,{textAlign:f,label:p}=e.attributes,d=(0,l.useBlockProps)({className:a()({[`has-text-align-${f}`]:f})});return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.InspectorControls,null,(0,n.createElement)(u.PanelBody,null,(0,n.createElement)(u.PanelRow,null,(0,n.createElement)(u.TextControl,{label:(0,o.__)("Text for Submit button","oik"),value:t.contact,onChange:t=>{e.setAttributes({contact:t})}})))),(0,n.createElement)("div",d,!1,(0,n.createElement)(l.InnerBlocks,{template:[["oik/contact-field",{label:"Name",type:"text",required:!0,requiredIndicator:" *"}],["oik/contact-field",{label:"Email",type:"email",required:!0,requiredIndicator:" *"}],["oik/contact-field",{label:"Subject",type:"text",required:!1}],["oik/contact-field",{label:"Message",type:"textarea",required:!0,requiredIndicator:" *"}]],allowedBlocks:["oik/contact-field"]}),(0,n.createElement)("input",{type:"submit",value:e.attributes.contact})))},save(){const e=l.useBlockProps.save();return(0,n.createElement)("div",e,(0,n.createElement)(l.InnerBlocks.Content,null))}})},184:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t=i)&&Object.keys(n.O).every((function(e){return n.O[e](r[l])}))?r.splice(l--,1):(c=!1,i0&&e[s-1][2]>i;s--)e[s]=e[s-1];e[s]=[r,o,i]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={264:0,837:0};n.O.j=function(t){return 0===e[t]};var t=function(t,r){var o,i,a=r[0],c=r[1],l=r[2],u=0;if(a.some((function(t){return 0!==e[t]}))){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(l)var s=l(n)}for(t&&t(r);u{let{named:{user:t}}=e;return t}},contact:{type:"string",shortcode:e=>{let{named:{contact:t}}=e;return t}},email:{type:"string",shortcode:e=>{let{named:{email:t}}=e;return t}}}}]};(0,c.registerBlockType)("oik/contact-form",{example:{},transforms:f,edit:e=>{const{attributes:t,setAttributes:r,instanceId:a,focus:c,isSelected:u}=e,{textAlign:f,label:d}=e.attributes,p=(0,l.useBlockProps)({className:i()({[`has-text-align-${f}`]:f})}),{email:m,contact:b}=t;if(void 0===m||""===m.trim()){const t=wp.data.select("core/blocks").getBlockType("oik/contact-form").attributes;e.setAttributes({email:t.email.default})}if(void 0===b||""===b.trim()){const t=wp.data.select("core/blocks").getBlockType("oik/contact-form").attributes;e.setAttributes({contact:t.contact.default})}return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.InspectorControls,null,(0,n.createElement)(s.PanelBody,null,(0,n.createElement)(s.PanelRow,null,(0,n.createElement)(s.TextControl,{label:(0,o.__)("Email address","oik"),value:t.email,onChange:t=>{e.setAttributes({email:t})}})),(0,n.createElement)(s.PanelRow,null,(0,n.createElement)(s.TextControl,{label:(0,o.__)("Text for Submit button","oik"),value:t.contact,onChange:t=>{e.setAttributes({contact:t})}})))),(0,n.createElement)("div",p,!1,(0,n.createElement)(l.InnerBlocks,{template:[["oik/contact-field",{label:"Name",type:"text",required:!0,requiredIndicator:" *"}],["oik/contact-field",{label:"Email",type:"email",required:!0,requiredIndicator:" *"}],["oik/contact-field",{label:"Subject",type:"text",required:!1}],["oik/contact-field",{label:"Message",type:"textarea",required:!0,requiredIndicator:" *"}]],allowedBlocks:["oik/contact-field"]}),(0,n.createElement)("input",{type:"submit",value:e.attributes.contact})))},save(){const e=l.useBlockProps.save();return(0,n.createElement)("div",e,(0,n.createElement)(l.InnerBlocks.Content,null))}})},184:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t=a)&&Object.keys(n.O).every((function(e){return n.O[e](r[l])}))?r.splice(l--,1):(c=!1,a0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[r,o,a]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={264:0,837:0};n.O.j=function(t){return 0===e[t]};var t=function(t,r){var o,a,i=r[0],c=r[1],l=r[2],s=0;if(i.some((function(t){return 0!==e[t]}))){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(l)var u=l(n)}for(t&&t(r);sdiv,.bw_contact_form bw_grid .is-style-grid{display:grid;gap:10px;grid-template-columns:1fr 3fr}.bw_contact_form .bw_grid .is-style-above,.wp-block-oik-contact-field .is-style-above{display:grid;grid-template-columns:1fr}.bw_contact_form .bw_grid .is-style-reversed,.bw_contact_form .bw_grid .is-style-reversed>div{display:grid;gap:10px;grid-template-columns:1fr 3fr}.bw_contact_form .bw_grid .is-style-reversed>div .label,.bw_contact_form .bw_grid .is-style-reversed>label{grid-column-start:2;grid-row-start:1}.bw_contact_form .bw_grid .is-style-reversed input,.bw_contact_form .bw_grid .is-style-reversed>div .field{grid-column-start:1;grid-row-start:1} diff --git a/build/style-contact-form.css b/build/style-contact-form.css index af1c3f5..8b13789 100644 --- a/build/style-contact-form.css +++ b/build/style-contact-form.css @@ -1 +1 @@ -.bw_contact_form .bw_grid{display:grid;gap:10px;grid-template-columns:1fr 3fr} +