1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
(()=>{"use strict";var e,o={3603:()=>{const e=window.wp.blocks,o=window.wp.i18n,r=window.wp.blockEditor,l=(window.React,window.ReactJSXRuntime);function a({backgroundOrientation:e,backgroundColor:o,borderColor:r}){return(0,l.jsx)("svg",{width:"1440",height:"744",viewBox:"0 0 1440 744",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`chapter-section__background chapter-section__background--${e}`,preserveAspectRatio:"none",vectorEffect:"non-scaling-stroke",overflow:"visible",children:(0,l.jsx)("path",{d:"M0 0H1440V686.701L0 744V0Z",fill:o,stroke:r,strokeWidth:r?"2px":"0",style:{strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}})})}function t({backgroundOrientation:e,backgroundColor:o,borderColor:r}){return(0,l.jsx)("svg",{className:`chapter-section__background chapter-section__background--${e}`,width:"1302",height:"654",viewBox:"0 0 1302 654",preserveAspectRatio:"none",vectorEffect:"non-scaling-stroke",overflow:"visible",children:(0,l.jsx)("path",{d:"M1302 0L0 15.8281V654L1302 642.633L1302 0Z",fill:o,stroke:r,strokeWidth:r?"2px":"0",style:{strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}})})}const n=window.wp.primitives;var i=(0,l.jsx)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,l.jsx)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});const c=window.wp.components,s=JSON.parse('{"UU":"carhop-blocks/chapter-section"}');(0,e.registerBlockType)(s.UU,{icon:{src:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M21,7H3V4A1,1,0,0,1,4,3H20a1,1,0,0,1,1,1ZM3,20V9H21V20a1,1,0,0,1-1,1H4A1,1,0,0,1,3,20Zm3-6H18V12H6Zm0,4h6V16H6Z"})}),foreground:"#136f63"},edit:function({attributes:e,setAttributes:n,...s}){const p=(0,r.useSetting)("color.palette.theme"),{hasLightBackground:d,disposition:g,coverType:u,coverUrl:h,coverAlt:b,coverId:m,coverSize:v,backgroundColor:_,blockWidth:x,textColor:k,shapeType:C,blockVariant:j,borderColor:f}=e;function w(e){n({coverId:e.id,coverAlt:e.alt,coverUrl:e.url})}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.InspectorControls,{children:[(0,l.jsxs)(c.PanelBody,{className:"deligraph-blocks-components-image__panel-body",title:(0,o.__)("Aspect & Variante de bloc","deligraph-blocks"),children:[(0,l.jsxs)(c.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Largeur du bloc",onChange:e=>n({blockWidth:e}),value:x,children:[(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Contenue",value:"contained"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Pleine largeur",value:"full"})]}),(0,l.jsxs)(c.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Modèle de bloc",onChange:function(e){n({blockVariant:e}),"framed"!==e&&"nude"!==e||(n({backgroundColor:"#fff"}),n({hasLightBackground:!0}))},value:j,children:[(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Nu",value:"nude"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Encadré",value:"framed"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Fond Coloré",value:"backgrounded"})]}),(0,l.jsxs)(c.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Disposition",onChange:function(e){n({disposition:e})},value:g,children:[(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Gauche",value:"left"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Droite",value:"right"})]})]}),"backgrounded"===j&&(0,l.jsxs)(c.PanelBody,{className:"deligraph-blocks-components-image__panel-body",title:(0,o.__)("Arrière plan","deligraph-blocks"),children:[(0,l.jsxs)(c.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Type de forme",onChange:e=>n({shapeType:e}),value:C,children:[(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Variation A",value:"variationA"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Variation B",value:"variationB"})]}),(0,l.jsx)(c.ColorPalette,{colors:p,value:_,onChange:function(e){e&&(n({backgroundColor:e}),function(e){if(!e)return;const o=function(e){if(!e)return!0;let o=e.replace("#","");return 3===o.length&&(o=o.split("").map(e=>e+e).join("")),(.299*parseInt(o.substr(0,2),16)+.587*parseInt(o.substr(2,2),16)+.114*parseInt(o.substr(4,2),16))/255>.5}(e);n({hasLightBackground:o})}(e))}})]}),"framed"===j&&(0,l.jsxs)(c.PanelBody,{className:"deligraph-blocks-components-image__panel-body",title:(0,o.__)("Bordure","deligraph-blocks"),children:[(0,l.jsxs)(c.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Type de forme",onChange:e=>n({shapeType:e}),value:C,children:[(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Variation A",value:"variationA"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Variation B",value:"variationB"})]}),(0,l.jsx)(c.ColorPalette,{colors:p,value:f,onChange:e=>n({borderColor:e})})]}),(0,l.jsxs)(c.PanelBody,{className:"deligraph-blocks-components-image__panel-body",title:(0,o.__)("Image d'accompagnement","deligraph-blocks"),initialOpen:!1,children:[h&&(0,l.jsx)("img",{src:h,alt:b}),(0,l.jsxs)("div",{className:"media-replace-container",children:[(0,l.jsx)(r.MediaReplaceFlow,{mediaId:m,mediaUrl:h,allowedTypes:["image"],accept:"image/*",onSelect:w,name:h?(0,o.__)("Remplacer","homegrade-blocks"):(0,o.__)("Ajouter votre image manuellement","homegrade-blocks")}),h&&(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(c.Button,{className:"custom-flow-button",variant:"primary",icon:i,label:"Supprimer",onClick:function(){n({coverId:null,coverAlt:null,coverUrl:null})}})})]}),(0,l.jsxs)(c.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Type d'image",onChange:function(e){n({coverType:e})},value:u,children:[(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Classique",value:"classic"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Encadrée",value:"photoframe"})]}),(0,l.jsxs)(c.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Taille de l'image",onChange:e=>n({coverSize:e}),value:v,children:[(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Big",value:"large"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Grande",value:"grande"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Moyenne",value:"medium"}),(0,l.jsx)(c.__experimentalToggleGroupControlOption,{label:"Petite",value:"small"})]})]}),(0,l.jsx)(c.PanelBody,{className:"deligraph-blocks-components-image__panel-body",title:(0,o.__)("Couleur du texte","deligraph-blocks"),initialOpen:!1,children:(0,l.jsx)(c.ColorPalette,{colors:p,value:k,onChange:e=>n({textColor:e})})})]}),(0,l.jsxs)("section",{...(0,r.useBlockProps)({className:`deligraph-blocks-chapter-section chapter-section chapter-section--${g} chapter-section--${j}\n\t\t\t\t\t\t${"full"===x?"chapter-section--width-full":"chapter-section--width-contained"}\n\t\t\t\n\t\t\t\t\t\t${d?"chapter-section--bg-light":"chapter-section--bg-dark"}`,style:{"--chapter-section-text-color":k||"#136f63","--cta-current-color":"backgrounded"===j?"inherit":"var(--wp--preset--color--primary) !important"}}),children:["backgrounded"===j&&_&&"variationA"===C&&(0,l.jsx)(a,{backgroundColor:_,borderColor:"none"}),"backgrounded"===j&&_&&"variationB"===C&&(0,l.jsx)(t,{backgroundColor:_,borderColor:"none"}),"framed"===j&&_&&"variationA"===C&&(0,l.jsx)(a,{backgroundColor:"none",borderColor:f}),"framed"===j&&_&&"variationB"===C&&(0,l.jsx)(t,{backgroundColor:"none",borderColor:f}),(0,l.jsx)("div",{className:"chapter-section__content",children:(0,l.jsx)("div",{className:"chapter-section__innerblocks",children:(0,l.jsx)(r.InnerBlocks,{template:[["carhop-blocks/heading",{innerBlocks:[["core/heading",{content:"Un titre précis "}]]}],["core/paragraph",{className:"chapter-section__title",placeholder:"Chapter Title",content:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse augue augue, sagittis quis mauris in, consequat vehicula est. Aliquam quis nulla ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras bibendum eget lorem eget aliquet. Fusce vel consequat neque. "}]],allowedBlocks:["core/heading","core/paragraph","core/list","core/file","core/button","core/buttons","carhop-blocks/heading","carhop-blocks/cta","carhop-blocks/cta-group"]})})}),h&&(0,l.jsx)("img",{className:`chapter-section__cover chapter-section__cover--${v} chapter-section__cover--${u}`,src:h,alt:b}),!h&&(0,l.jsx)(r.MediaPlaceholder,{accept:"image/*",allowedTypes:["image"],onSelect:w,multiple:!1,handleUpload:!0})]})]})},save:function({attributes:e}){const{hasLightBackground:o,disposition:n,coverUrl:i,coverAlt:c,coverSize:s,coverType:p,backgroundColor:d,blockWidth:g,textColor:u,shapeType:h,blockVariant:b,borderColor:m}=e;return(0,l.jsxs)("section",{...r.useBlockProps.save({className:`deligraph-blocks-chapter-section chapter-section chapter-section--${n} chapter-section--${b}\n\t\t\t${"full"===g?"chapter-section--width-full":"chapter-section--width-contained"}\n\t\t\t\n\t\t\t\t\t${o?"chapter-section--bg-light":"chapter-section--bg-dark"}`,style:{"--chapter-section-text-color":u||"var(--advised-text-color)","--cta-current-color":"backgrounded"===b?"inherit":"var(--wp--preset--color--primary) !important"}}),children:["backgrounded"===b&&d&&"variationA"===h&&(0,l.jsx)(a,{backgroundColor:d,borderColor:"none"}),"backgrounded"===b&&d&&"variationB"===h&&(0,l.jsx)(t,{backgroundColor:d,borderColor:"none"}),"framed"===b&&d&&"variationA"===h&&(0,l.jsx)(a,{backgroundColor:"none",borderColor:m}),"framed"===b&&d&&"variationB"===h&&(0,l.jsx)(t,{backgroundColor:"none",borderColor:m}),(0,l.jsx)("div",{className:"chapter-section__content",children:(0,l.jsx)("div",{className:"chapter-section__innerblocks",children:(0,l.jsx)(r.InnerBlocks.Content,{})})}),i&&(0,l.jsx)("img",{className:`chapter-section__cover chapter-section__cover--${s} chapter-section__cover--${p}`,src:i,alt:c})]})}})}},r={};function l(e){var a=r[e];if(void 0!==a)return a.exports;var t=r[e]={exports:{}};return o[e](t,t.exports,l),t.exports}l.m=o,e=[],l.O=(o,r,a,t)=>{if(!r){var n=1/0;for(p=0;p<e.length;p++){for(var[r,a,t]=e[p],i=!0,c=0;c<r.length;c++)(!1&t||n>=t)&&Object.keys(l.O).every(e=>l.O[e](r[c]))?r.splice(c--,1):(i=!1,t<n&&(n=t));if(i){e.splice(p--,1);var s=a();void 0!==s&&(o=s)}}return o}t=t||0;for(var p=e.length;p>0&&e[p-1][2]>t;p--)e[p]=e[p-1];e[p]=[r,a,t]},l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={1509:0,6969:0};l.O.j=o=>0===e[o];var o=(o,r)=>{var a,t,[n,i,c]=r,s=0;if(n.some(o=>0!==e[o])){for(a in i)l.o(i,a)&&(l.m[a]=i[a]);if(c)var p=c(l)}for(o&&o(r);s<n.length;s++)t=n[s],l.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return l.O(p)},r=globalThis.webpackChunkcarhop_blocks=globalThis.webpackChunkcarhop_blocks||[];r.forEach(o.bind(null,0)),r.push=o.bind(null,r.push.bind(r))})();var a=l.O(void 0,[6969],()=>l(3603));a=l.O(a)})(); |