woocommerce/packages/woocommerce-blocks/build/checkout-blocks/order-note-frontend.js

1 line
4.2 KiB
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[37],{175:function(e,t,c){"use strict";var n=c(14),a=c.n(n),o=c(23),s=c.n(o),l=c(6),r=c.n(l),i=(c(10),c(248),["children","className","headingLevel"]);t.a=function(e){var t=e.children,c=e.className,n=e.headingLevel,o=s()(e,i),l=r()("wc-block-components-title",c),d="h".concat(n);return React.createElement(d,a()({className:l},o),t)}},248:function(e,t){},346:function(e,t){},347:function(e,t,c){"use strict";var n=c(14),a=c.n(n),o=c(23),s=c.n(o),l=c(24),r=c(6),i=c.n(r),d=(c(348),["className","label","id","instanceId","onChange","children","hasError"]);t.a=Object(l.withInstanceId)((function(e){var t=e.className,c=e.label,n=e.id,o=e.instanceId,l=e.onChange,r=e.children,u=e.hasError,m=void 0!==u&&u,b=s()(e,d),h=n||"checkbox-control-".concat(o);return React.createElement("label",{className:i()("wc-block-components-checkbox",{"has-error":m},t),htmlFor:h},React.createElement("input",a()({id:h,className:"wc-block-components-checkbox__input",type:"checkbox",onChange:function(e){return l(e.target.checked)},"aria-invalid":!0===m},b)),React.createElement("svg",{className:"wc-block-components-checkbox__mark","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20"},React.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"})),c&&React.createElement("span",{className:"wc-block-components-checkbox__label"},c),r)}))},348:function(e,t){},350:function(e,t,c){"use strict";var n=c(6),a=c.n(n),o=(c(10),c(175)),s=(c(346),function(e){var t=e.title,c=e.stepHeadingContent;return React.createElement("div",{className:"wc-block-components-checkout-step__heading"},React.createElement(o.a,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},t),!!c&&React.createElement("span",{className:"wc-block-components-checkout-step__heading-content"},c))});t.a=function(e){var t=e.id,c=e.className,n=e.title,o=e.legend,l=e.description,r=e.children,i=e.disabled,d=void 0!==i&&i,u=e.showStepNumber,m=void 0===u||u,b=e.stepHeadingContent,h=void 0===b?function(){}:b,p=o||n?"fieldset":"div";return React.createElement(p,{className:a()(c,"wc-block-components-checkout-step",{"wc-block-components-checkout-step--with-step-number":m,"wc-block-components-checkout-step--disabled":d}),id:t,disabled:d},!(!o&&!n)&&React.createElement("legend",{className:"screen-reader-text"},o||n),!!n&&React.createElement(s,{title:n,stepHeadingContent:h()}),React.createElement("div",{className:"wc-block-components-checkout-step__container"},!!l&&React.createElement("p",{className:"wc-block-components-checkout-step__description"},l),React.createElement("div",{className:"wc-block-components-checkout-step__content"},r)))}},376:function(e,t){},377:function(e,t){},412:function(e,t,c){"use strict";c.r(t);var n=c(1),a=c(350),o=c(66),s=c(48),l=c(5),r=c.n(l),i=c(0),d=c(347),u=c(6),m=c.n(u),b=c(10),h=c.n(b),p=(c(377),function(e){var t=e.className,c=void 0===t?"":t,n=e.disabled,a=void 0!==n&&n,o=e.onTextChange,s=e.placeholder,l=e.value,r=void 0===l?"":l;return React.createElement("textarea",{className:m()("wc-block-components-textarea",c),disabled:a,onChange:function(e){o(e.target.value)},placeholder:s,rows:2,value:r})});c(376),p.propTypes={onTextChange:h.a.func.isRequired,disabled:h.a.bool,placeholder:h.a.string,value:h.a.string};var k=function(e){var t=e.disabled,c=e.onChange,a=e.placeholder,o=e.value,s=Object(i.useState)(!1),l=r()(s,2),u=l[0],m=l[1],b=Object(i.useState)(""),h=r()(b,2),k=h[0],v=h[1];return React.createElement("div",{className:"wc-block-checkout__add-note"},React.createElement(d.a,{disabled:t,label:Object(n.__)("Add a note to your order",'woocommerce'),checked:u,onChange:function(e){m(e),e?o!==k&&c(k):(c(""),v(o))}}),u&&React.createElement(p,{disabled:t,onTextChange:c,placeholder:a,value:o}))};t.default=function(){var e=Object(o.b)().needsShipping,t=Object(s.b)(),c=t.isProcessing,l=t.orderNotes,r=t.dispatchActions.setOrderNotes;return React.createElement(a.a,{id:"order-notes",showStepNumber:!1,className:"wc-block-checkout__order-notes",disabled:c}