geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/product-gallery.js

1 line
32 KiB
JavaScript
Raw Normal View History

2024-02-01 17:24:18 +05:30
(()=>{var e,t={5794:(e,t,l)=>{"use strict";l.r(t);var o=l(5271),r=l(4981);const n=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-gallery","version":"1.0.0","title":"Product Gallery","description":"Showcase your products relevant images and media.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"align":true,"multiple":false,"interactivity":true},"textdomain":"woocommerce","usesContext":["postId"],"providesContext":{"thumbnailsPosition":"thumbnailsPosition","thumbnailsNumberOfThumbnails":"thumbnailsNumberOfThumbnails","productGalleryClientId":"productGalleryClientId","nextPreviousButtonsPosition":"nextPreviousButtonsPosition","pagerDisplayMode":"pagerDisplayMode","hoverZoom":"hoverZoom","fullScreenOnClick":"fullScreenOnClick","mode":"mode","cropImages":"cropImages"},"attributes":{"thumbnailsPosition":{"type":"string","default":"left"},"thumbnailsNumberOfThumbnails":{"type":"number","default":3},"pagerDisplayMode":{"type":"string","default":"dots"},"productGalleryClientId":{"type":"string","default":""},"cropImages":{"type":"boolean","default":false},"hoverZoom":{"type":"boolean","default":true},"fullScreenOnClick":{"type":"boolean","default":true},"nextPreviousButtonsPosition":{"type":"string","default":"insideTheImage"},"mode":{"type":"string","default":"standard"}},"viewScript":"wc-product-gallery-frontend","example":{}}');var i=l(9196),a=l(2175),c=l(9307),s=l(9818);const u=({blocks:e,findCondition:t})=>{for(const l of e){if(t(l))return l;if(l.innerBlocks){const e=u({blocks:l.innerBlocks,findCondition:t});if(e)return e}}};var m=l(3135);const p=e=>{switch(e){case"bottom":case"off":return{type:"flex",orientation:"vertical"};default:return{type:"flex",flexWrap:"nowrap"}}},d=e=>"lock"===e?{lock:{move:!0,remove:!0}}:{lock:{}},g=(e,t)=>{if(void 0!==t){const l={...t,attributes:{...t.attributes,...e}};(0,s.dispatch)("core/block-editor").updateBlock(t.clientId,l)}},h=({blocks:e,lockBlocks:t})=>{for(const l of e)g(d(t?"lock":"unlock"),l)},w=(e,t)=>{const l=(0,s.select)("core/block-editor").getBlock(t);null==l||l.innerBlocks.forEach((t=>{"core/group"===t.name&&g({layout:p(e)},t)}))},b=e=>{var t;return`wc-block-product-gallery--has-next-previous-buttons-${null===(t=(0,m.P)(e))||void 0===t?void 0:t.classname}`};var f=l(5609),v=l(5736),k=l(498),C=l(2742),y=l(7164);const E=({attributes:e,setAttributes:t,context:l})=>{const{cropImages:o,hoverZoom:r,fullScreenOnClick:n}=e,{productGalleryClientId:c,pagerDisplayMode:s,nextPreviousButtonsPosition:u,thumbnailsNumberOfThumbnails:m,thumbnailsPosition:p}=l;return(0,i.createElement)(a.InspectorControls,null,(0,i.createElement)(f.PanelBody,{title:(0,v.__)("Gallery Navigation","woocommerce")},(0,i.createElement)(C.y,{context:{productGalleryClientId:c,pagerDisplayMode:s}}),(0,i.createElement)(y.f,{context:{productGalleryClientId:c,nextPreviousButtonsPosition:u}}),(0,i.createElement)(k.M,{context:{productGalleryClientId:c,thumbnailsNumberOfThumbnails:m,thumbnailsPosition:p}})),(0,i.createElement)(f.PanelBody,{title:(0,v.__)("Media Settings","woocommerce")},(0,i.createElement)(f.ToggleControl,{label:(0,v.__)("Crop images to fit","woocommerce"),help:(0,v.__)("Images will be cropped to fit within a square space.","woocommerce"),checked:o,onChange:()=>t({cropImages:!o}),className:"wc-block-product-gallery__crop-images"}),(0,i.createElement)(f.ToggleControl,{label:(0,v.__)("Zoom while hovering","woocommerce"),help:(0,v.__)("While hovering the large image will zoom in by 30%.","woocommerce"),checked:r,onChange:()=>t({hoverZoom:!r})}),(0,i.createElement)(f.ToggleControl,{label:(0,v.__)("Full-screen when clicked","woocommerce"),help:(0,v.__)("Clicking on the large image will open a full-screen gallery experience.","woocommerce"),checked:n,onChange:()=>t({fullScreenOnClick:!n})})))},x=[["core/group",{layout:{type:"flex",flexWrap:"nowrap"}},[["woocommerce/product-gallery-thumbnails",d("lock")],["core/group",{layout:{type:"flex",orientation:"vertical",justifyContent:"center"},...d("lock")},[["woocommerce/product-gallery-large-image"