%PDF- %PDF-
Direktori : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/blocks/ |
Current File : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/blocks/product-search.js |
(()=>{var e,t,o,r={5395:(e,t,o)=>{"use strict";o.r(t);var r=o(1609);const c=window.wp.hooks,l=window.wp.blockEditor,a=window.wp.data;var n=o(7723),s=o(7104),i=o(7850);const u=window.wc.wcSettings,m=window.wc.wcTypes,d=window.wp.components,p=window.wp.blocks;o(3952),o(9086);var b=o(6087);const w="core/search",_="woocommerce/product-search";let h=function(e){return e.OUTSIDE="button-outside",e.INSIDE="button-inside",e.NO_BUTTON="no-button",e.BUTTON_ONLY="button-only",e.INPUT_AND_BUTTON="input-and-button",e}({});function g(e){return"button-outside"===e||"button-inside"===e}function f(e){return g(e)?h.INPUT_AND_BUTTON:e}function v(e){return g(e)?e:h.OUTSIDE}const k=e=>{const{attributes:t,setAttributes:o}=e,{buttonPosition:c,buttonUseIcon:a,showLabel:s}=t,[i,u]=(0,b.useState)(c);return(0,b.useEffect)((()=>{g(c)&&i!==c&&u(c)}),[c]),(0,r.createElement)(l.InspectorControls,{group:"styles"},(0,r.createElement)(d.PanelBody,{title:(0,n.__)("Styles","woocommerce")},(0,r.createElement)(d.RadioControl,{selected:f(c),options:[{label:(0,n.__)("Input and button","woocommerce"),value:h.INPUT_AND_BUTTON},{label:(0,n.__)("Input only","woocommerce"),value:h.NO_BUTTON},{label:(0,n.__)("Button only","woocommerce"),value:h.BUTTON_ONLY}],onChange:e=>{if(e!==h.INPUT_AND_BUTTON)o({buttonPosition:e});else{const e=v(i);o({buttonPosition:e})}}}),c!==h.NO_BUTTON&&(0,r.createElement)(r.Fragment,null,c!==h.BUTTON_ONLY&&(0,r.createElement)(d.__experimentalToggleGroupControl,{label:(0,n.__)("BUTTON POSITION","woocommerce"),isBlock:!0,onChange:e=>{o({buttonPosition:e})},value:v(c)},(0,r.createElement)(d.__experimentalToggleGroupControlOption,{value:h.INSIDE,label:(0,n.__)("Inside","woocommerce")}),(0,r.createElement)(d.__experimentalToggleGroupControlOption,{value:h.OUTSIDE,label:(0,n.__)("Outside","woocommerce")})),(0,r.createElement)(d.__experimentalToggleGroupControl,{label:(0,n.__)("BUTTON APPEARANCE","woocommerce"),isBlock:!0,onChange:e=>{o({buttonUseIcon:e})},value:a},(0,r.createElement)(d.__experimentalToggleGroupControlOption,{value:!1,label:(0,n.__)("Text","woocommerce")}),(0,r.createElement)(d.__experimentalToggleGroupControlOption,{value:!0,label:(0,n.__)("Icon","woocommerce")}))),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show input label","woocommerce"),checked:s,onChange:e=>o({showLabel:e})})))};var y=o(851);const E=({attributes:{label:e,placeholder:t,formId:o,className:c,hasLabel:l,align:a}})=>{const s=(0,y.A)("wc-block-product-search",a?"align"+a:"",c);return(0,r.createElement)("div",{className:s},(0,r.createElement)("form",{role:"search",method:"get",action:u.HOME_URL},(0,r.createElement)("label",{htmlFor:o,className:l?"wc-block-product-search__label":"wc-block-product-search__label screen-reader-text"},e),(0,r.createElement)("div",{className:"wc-block-product-search__fields"},(0,r.createElement)("input",{type:"search",id:o,className:"wc-block-product-search__field",placeholder:t,name:"s"}),(0,r.createElement)("input",{type:"hidden",name:"post_type",value:"product"}),(0,r.createElement)("button",{type:"submit",className:"wc-block-product-search__button","aria-label":(0,n.__)("Search","woocommerce")},(0,r.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},(0,r.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"}))))))},T=(0,o(9491).withInstanceId)((({attributes:{label:e,placeholder:t,formId:o,className:c,hasLabel:a,align:s},instanceId:i,setAttributes:u})=>{const m=(0,y.A)("wc-block-product-search",s?"align"+s:"",c);return(0,b.useEffect)((()=>{o||u({formId:`wc-block-product-search-${i}`})}),[o,u,i]),(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.InspectorControls,{key:"inspector"},(0,r.createElement)(d.PanelBody,{title:(0,n.__)("Content","woocommerce"),initialOpen:!0},(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show search field label","woocommerce"),checked:a,onChange:()=>u({hasLabel:!a})}))),(0,r.createElement)("div",{className:m},!!a&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("label",{className:"screen-reader-text",htmlFor:"wc-block-product-search__label"},(0,n.__)("Search Label","woocommerce")),(0,r.createElement)(l.PlainText,{className:"wc-block-product-search__label",id:"wc-block-product-search__label",value:e,onChange:e=>u({label:e}),style:{backgroundColor:"transparent"}})),(0,r.createElement)("div",{className:"wc-block-product-search__fields"},(0,r.createElement)(d.TextControl,{className:"wc-block-product-search__field input-control",value:t,placeholder:(0,n.__)("Enter search placeholder text","woocommerce"),onChange:e=>u({placeholder:e})}),(0,r.createElement)("button",{type:"submit",className:"wc-block-product-search__button","aria-label":(0,n.__)("Search","woocommerce"),onClick:e=>e.preventDefault(),tabIndex:-1},(0,r.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},(0,r.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"}))))))})),O=(0,u.getSettingWithCoercion)("isBlockVariationAvailable",!1,m.isBoolean),N={hasLabel:{type:"boolean",default:!0},label:{type:"string",default:(0,n.__)("Search","woocommerce")},placeholder:{type:"string",default:(0,n.__)("Search products…","woocommerce")},formId:{type:"string",default:""}},B={label:N.label.default,buttonText:N.label.default,placeholder:N.placeholder.default,query:{post_type:"product"},namespace:_};(0,p.registerBlockType)(_,{title:(0,n.__)("Product Search","woocommerce"),apiVersion:3,icon:{src:(0,r.createElement)(s.A,{icon:i.A,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[(0,n.__)("WooCommerce","woocommerce")],description:(0,n.__)("A search box to allow customers to search for products by keyword.","woocommerce"),supports:{align:["wide","full"],inserter:!O},attributes:N,transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>"woocommerce_product_search"===e&&!(null==t||!t.raw),transform:({instance:e})=>(0,p.createBlock)(_,{label:e.raw.title||B.label})}]},deprecated:[{attributes:N,save:e=>(0,r.createElement)("div",null,(0,r.createElement)(E,{...e}))}],edit:O?({clientId:e})=>{const{replaceBlocks:t}=(0,a.useDispatch)(l.store),o=(0,a.useSelect)((t=>t("core/block-editor").getBlockAttributes(e)),[e]),c=[(0,r.createElement)(d.Button,{key:"update",onClick:()=>{t(e,(0,p.createBlock)("core/search",{label:(null==o?void 0:o.label)||B.label,buttonText:B.buttonText,placeholder:(null==o?void 0:o.placeholder)||B.placeholder,query:B.query}))},variant:"primary"},(0,n.__)("Upgrade Block","woocommerce"))];return(0,r.createElement)(l.Warning,{actions:c,className:"wc-block-components-actions"},(0,n.__)("This version of the Product Search block is outdated. Upgrade to continue using.","woocommerce"))}:T,save:()=>null}),(0,c.addFilter)("blocks.registerBlockType",_,(function(e,t){return"core/search"===t&&(e.attributes={...e.attributes,namespace:{type:"string"}}),e})),O&&((0,p.registerBlockVariation)("core/search",{name:_,title:(0,n.__)("Product Search","woocommerce"),icon:{src:(0,r.createElement)(s.A,{icon:i.A,className:"wc-block-editor-components-block-icon"})},isActive:(e,t)=>{var o;return(null===(o=e.query)||void 0===o?void 0:o.post_type)===t.query.post_type},category:"woocommerce",keywords:[(0,n.__)("WooCommerce","woocommerce")],description:(0,n.__)("A search box to allow customers to search for products by keyword.","woocommerce"),attributes:B}),(0,c.addFilter)("editor.BlockEdit",w,(e=>t=>function(e){var t;return e.name===w&&(null===(t=e.attributes)||void 0===t?void 0:t.namespace)===_}(t)?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(k,{...t}),(0,r.createElement)(e,{...t})):(0,r.createElement)(e,{...t}))))},9086:()=>{},3952:()=>{},1609:e=>{"use strict";e.exports=window.React},9491:e=>{"use strict";e.exports=window.wp.compose},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},5573:e=>{"use strict";e.exports=window.wp.primitives}},c={};function l(e){var t=c[e];if(void 0!==t)return t.exports;var o=c[e]={exports:{}};return r[e].call(o.exports,o,o.exports,l),o.exports}l.m=r,e=[],l.O=(t,o,r,c)=>{if(!o){var a=1/0;for(u=0;u<e.length;u++){for(var[o,r,c]=e[u],n=!0,s=0;s<o.length;s++)(!1&c||a>=c)&&Object.keys(l.O).every((e=>l.O[e](o[s])))?o.splice(s--,1):(n=!1,c<a&&(a=c));if(n){e.splice(u--,1);var i=r();void 0!==i&&(t=i)}}return t}c=c||0;for(var u=e.length;u>0&&e[u-1][2]>c;u--)e[u]=e[u-1];e[u]=[o,r,c]},l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,l.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var c=Object.create(null);l.r(c);var a={};t=t||[null,o({}),o([]),o(o)];for(var n=2&r&&e;"object"==typeof n&&!~t.indexOf(n);n=o(n))Object.getOwnPropertyNames(n).forEach((t=>a[t]=()=>e[t]));return a.default=()=>e,l.d(c,a),c},l.d=(e,t)=>{for(var o in t)l.o(t,o)&&!l.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.j=2545,(()=>{var e={2545:0};l.O.j=t=>0===e[t];var t=(t,o)=>{var r,c,[a,n,s]=o,i=0;if(a.some((t=>0!==e[t]))){for(r in n)l.o(n,r)&&(l.m[r]=n[r]);if(s)var u=s(l)}for(t&&t(o);i<a.length;i++)c=a[i],l.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return l.O(u)},o=self.webpackChunkwebpackWcBlocksMainJsonp=self.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var a=l.O(void 0,[94],(()=>l(5395)));a=l.O(a),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-search"]=a})();