1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
(()=>{"use strict";var o,e={8186:()=>{const o=window.wp.blocks,e=window.wp.i18n,r=window.wp.blockEditor,l=window.wp.components,n=window.wp.data;function a(o){if(!o)return!0;let e=o.replace("#","");return 3===e.length&&(e=e.split("").map(o=>o+o).join("")),(.299*parseInt(e.substr(0,2),16)+.587*parseInt(e.substr(2,2),16)+.114*parseInt(e.substr(4,2),16))/255>.5}window.React;const t=window.ReactJSXRuntime;function s({backgroundOrientation:o,backgroundColor:e,borderColor:r}){return(0,t.jsx)("svg",{width:"1440",height:"744",viewBox:"0 0 1440 744",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`content-box__shape content-box__shape--${o}`,preserveAspectRatio:"none",vectorEffect:"non-scaling-stroke",overflow:"visible",children:(0,t.jsx)("path",{d:"M0 0H1440V686.701L0 744V0Z",fill:e,stroke:r,strokeWidth:r?"2px":"0",style:{strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}})})}function c({backgroundOrientation:o,backgroundColor:e,borderColor:r}){return(0,t.jsx)("svg",{className:`content-box__shape content-box__shape--${o}`,width:"1302",height:"654",viewBox:"0 0 1302 654",preserveAspectRatio:"none",vectorEffect:"non-scaling-stroke",overflow:"visible",children:(0,t.jsx)("path",{d:"M1302 0L0 15.8281V654L1302 642.633L1302 0Z",fill:e,stroke:r,strokeWidth:r?"2px":"0",style:{strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}})})}function i({backgroundOrientation:o,backgroundColor:e,borderColor:r}){return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("svg",{width:"1440",height:"997",viewBox:"0 0 1440 997",className:`content-box__shape content-box__shape--${o}`,preserveAspectRatio:"none",vectorEffect:"non-scaling-stroke",overflow:"visible",children:(0,t.jsx)("path",{d:"M1440 29.8887L0 0V997L1440 979.242V29.8887Z",fill:e,stroke:r,strokeWidth:r?"2px":"0",style:{strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}})})})}const d=JSON.parse('{"UU":"carhop-blocks/content-box"}');(0,o.registerBlockType)(d.UU,{icon:{foreground:"#136f63",src:(0,t.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 100 100",children:(0,t.jsxs)("g",{children:[(0,t.jsx)("path",{d:"m50,99.84988l-43.14852,-24.92494l0,-49.84988l43.14852,-24.92494l43.14852,24.92494l0,49.84988l-43.14852,24.92494zm-40.75518,-26.32675l40.75518,23.52312l40.75518,-23.52312l0,-47.04625l-40.75518,-23.55731l-40.75518,23.55731l0,47.04625z"}),(0,t.jsx)("path",{d:"m50,86.13945l-31.28439,-18.05263l0,-36.13945l31.28439,-18.05263l31.28439,18.05263l0,36.13945l-31.28439,18.05263zm-13.50528,-28.344l13.50528,7.79545l13.50528,-7.79545l0,-15.59091l-13.50528,-7.79545l-13.50528,7.79545l0,15.59091z"})]})})},edit:function({attributes:o,setAttributes:d,...p}){const b=(0,r.useSetting)("color.palette.theme"),{hasBackgroundColor:g,align:u,backgroundColor:h,textColor:x,hasLightBackground:k,blockVariant:C,shapeType:f,borderColor:m}=o,v=(0,n.useSelect)(o=>o("core/editor").getCurrentPostType(),[]),_=((o,e)=>e&&"articles"===e?o?.filter(o=>["carhop-green-light","carhop-blue-light","carhop-orange-light","carhop-red-light","carhop-purple-light"].includes(o.slug))||[]:o||[])(b,v),j=((o,e,r)=>e?"page"!==e||a(r)?o||[]:[{name:"White",slug:"white",color:"#ffffff"}]:o||[])(b,v,h),w="full"===u?"alignfull":"wide"===u?"alignwide":"aligncontained";return console.log(u),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(r.InspectorControls,{children:[(0,t.jsxs)(l.PanelBody,{title:(0,e.__)("Aspect","carhop-blocks"),children:[(0,t.jsxs)(l.__experimentalToggleGroupControl,{label:"Modèle de bloc",value:C,onChange:function(o){d({blockVariant:o}),"framed"!==o&&"nude"!==o||(d({backgroundColor:"#fff"}),d({hasLightBackground:!0}))},isBlock:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,children:[(0,t.jsx)(l.__experimentalToggleGroupControlOption,{value:"nude",label:"Nu"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{value:"framed",label:"Encadré"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{value:"backgrounded",label:"Fond coloré"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{value:"framed-backgrounded",label:"Cadre + fond coloré"})]}),(0,t.jsxs)(l.__experimentalToggleGroupControl,{label:"Largeur du bloc",value:u,onChange:o=>d({align:o}),isBlock:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,children:[(0,t.jsx)(l.__experimentalToggleGroupControlOption,{value:"",label:"Contenue"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{value:"wide",label:"Large"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{value:"full",label:"Pleine largeur"})]})]}),"nude"!==C&&(0,t.jsxs)(l.PanelBody,{className:"deligraph-blocks-components-image__panel-body",title:(0,e.__)("Arrière plan","deligraph-blocks"),children:[(0,t.jsxs)(l.__experimentalToggleGroupControl,{className:"deligraph-blocks__variant",isBlock:!0,label:"Type de forme",onChange:o=>d({shapeType:o}),value:f,children:[(0,t.jsx)(l.__experimentalToggleGroupControlOption,{label:"Droite",value:"straight"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{label:"Forme A",value:"shapeA"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{label:"Forme B",value:"shapeB"}),(0,t.jsx)(l.__experimentalToggleGroupControlOption,{label:"Forme C",value:"shapeC"})]}),(0,t.jsx)(l.SelectControl,{__next40pxDefaultSize:!0,label:"Type de forme",onChange:o=>d({shapeType:o}),value:f,options:[{disabled:!0,label:"Type de forme",value:""},{label:"Droite",value:"straight"},{label:"Forme A",value:"shapeA"},{label:"Forme B",value:"shapeB"},{label:"Forme C",value:"shapeC"}]}),(0,t.jsx)(l.ColorPalette,{colors:_,value:h,onChange:function(o){void 0===o&&(d({hasBackgroundColor:!1}),d({backgroundColor:"transparent"}));const e=a(o);d({hasLightBackground:e}),d({backgroundColor:o}),d(e?{textColor:"inherit"}:{textColor:"#fff"})}})]}),("backgrounded"===C||"framed-backgrounded"===C)&&"articles"!==v&&(0,t.jsx)(l.PanelBody,{className:"deligraph-blocks-components-image__panel-body",title:(0,e.__)("Couleur du texte","deligraph-blocks"),children:(0,t.jsx)(l.ColorPalette,{colors:j,value:x,onChange:function(o){d({textColor:o})}})})]}),(0,t.jsxs)("section",{...(0,r.useBlockProps)({className:`${"articles"!==v&&"alignfull"} content-box content-box--variant-${C} content-box--${f} ${k?"content-box--bg-light":"content-box--bg-dark"} ${w}`,style:{"--content-box-text-color":null!=x?x:"inherit","--content-box-background-color":"backgrounded"===C||"framed-backgrounded"===C?h:"transparent"}}),children:["backgrounded"===C&&h&&"shapeA"===f&&(0,t.jsx)(s,{backgroundColor:h,borderColor:"none"}),"backgrounded"===C&&h&&"shapeB"===f&&(0,t.jsx)(c,{backgroundColor:h,borderColor:"none"}),"backgrounded"===C&&h&&"shapeC"===f&&(0,t.jsx)(i,{backgroundColor:h,borderColor:"none"}),"framed"===C&&h&&"shapeA"===f&&(0,t.jsx)(s,{backgroundColor:"none",borderColor:m}),"framed"===C&&h&&"shapeB"===f&&(0,t.jsx)(c,{backgroundColor:"none",borderColor:m}),"framed"===C&&h&&"shapeC"===f&&(0,t.jsx)(i,{backgroundColor:"none",borderColor:m}),"framed-backgrounded"===C&&h&&"shapeA"===f&&(0,t.jsx)(s,{backgroundColor:h,borderColor:m}),"framed-backgrounded"===C&&h&&"shapeB"===f&&(0,t.jsx)(c,{backgroundColor:h,borderColor:m}),"framed-backgrounded"===C&&h&&"shapeC"===f&&(0,t.jsx)(i,{backgroundColor:h,borderColor:m}),(0,t.jsx)("div",{className:"content-box__innerblocks",children:(0,t.jsx)(r.InnerBlocks,{template:[["core/paragraph",{placeholder:"Ajouter ici le texte"}]],allowedBlocks:["core/heading","core/paragraph","core/group","core/list","core/button","core/image","core/buttons","core/columns","core/file","core/post-title","core/embed","core/quote","core/pullquote","core/media-text","core/table","carhop-blocks/chapter-section","carhop-blocks/heading","carhop-blocks/decorative-shapes","carhop-blocks/scroll-story-block","carhop-blocks/cta","carhop-blocks/cta-group","carhop-blocks/audio-player","carhop-blocks/content-box","carhop-blocks/localisation-map","carhop-blocks/notice-panel","carhop-blocks/story-timeline","carhop-blocks/highlight-timeline","acf/statistics-datas","ninja-forms/form","gravityforms/form","dynamiques-blocks/sitemap","mailpoet/subscription-form-block","shortcode"]})})]})]})},save:function({attributes:o}){const{backgroundColor:e,textColor:l,hasLightBackground:n,hasBackgroundColor:a,blockVariant:d,align:p,shapeType:b,borderColor:g}=o,u=n?"content-box--bg-light":"content-box--bg-dark",h="full"===p?"alignfull":"wide"===p?"alignwide":"aligncontained";return(0,t.jsxs)("section",{...r.useBlockProps.save({className:`content-box content-box--variant-${d} content-box--${b} ${u} ${h}`,style:{"--content-box-text-color":null!=l?l:"inherit","--content-box-background-color":"backgrounded"===d||"framed-backgrounded"===d?e:"transparent"}}),children:["backgrounded"===d&&e&&"shapeA"===b&&(0,t.jsx)(s,{backgroundColor:e,borderColor:"none"}),"backgrounded"===d&&e&&"shapeB"===b&&(0,t.jsx)(c,{backgroundColor:e,borderColor:"none"}),"backgrounded"===d&&e&&"shapeC"===b&&(0,t.jsx)(i,{backgroundColor:e,borderColor:"none"}),"framed"===d&&e&&"shapeA"===b&&(0,t.jsx)(s,{backgroundColor:"none",borderColor:g}),"framed"===d&&e&&"shapeB"===b&&(0,t.jsx)(c,{backgroundColor:"none",borderColor:g}),"framed"===d&&e&&"shapeC"===b&&(0,t.jsx)(i,{backgroundColor:"none",borderColor:g}),"framed-backgrounded"===d&&e&&"shapeA"===b&&(0,t.jsx)(s,{backgroundColor:e,borderColor:g}),"framed-backgrounded"===d&&e&&"shapeB"===b&&(0,t.jsx)(c,{backgroundColor:e,borderColor:g}),"framed-backgrounded"===d&&e&&"shapeC"===b&&(0,t.jsx)(i,{backgroundColor:e,borderColor:g}),(0,t.jsx)("div",{className:"content-box__innerblocks",children:(0,t.jsx)(r.InnerBlocks.Content,{})})]})}})}},r={};function l(o){var n=r[o];if(void 0!==n)return n.exports;var a=r[o]={exports:{}};return e[o](a,a.exports,l),a.exports}l.m=e,o=[],l.O=(e,r,n,a)=>{if(!r){var t=1/0;for(d=0;d<o.length;d++){for(var[r,n,a]=o[d],s=!0,c=0;c<r.length;c++)(!1&a||t>=a)&&Object.keys(l.O).every(o=>l.O[o](r[c]))?r.splice(c--,1):(s=!1,a<t&&(t=a));if(s){o.splice(d--,1);var i=n();void 0!==i&&(e=i)}}return e}a=a||0;for(var d=o.length;d>0&&o[d-1][2]>a;d--)o[d]=o[d-1];o[d]=[r,n,a]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={6527:0,7191:0};l.O.j=e=>0===o[e];var e=(e,r)=>{var n,a,[t,s,c]=r,i=0;if(t.some(e=>0!==o[e])){for(n in s)l.o(s,n)&&(l.m[n]=s[n]);if(c)var d=c(l)}for(e&&e(r);i<t.length;i++)a=t[i],l.o(o,a)&&o[a]&&o[a][0](),o[a]=0;return l.O(d)},r=globalThis.webpackChunkcarhop_blocks=globalThis.webpackChunkcarhop_blocks||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})();var n=l.O(void 0,[7191],()=>l(8186));n=l.O(n)})(); |