@cntrl-site/components 1.0.6 → 1.0.7-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/Components/ControlSlider/ControlSlider.d.ts +2 -25
- package/dist/Components/Grid/Grid.d.ts +51 -0
- package/dist/Components/Grid/GridComponent.d.ts +38 -0
- package/dist/Components/Lightbox/Lightbox.d.ts +2 -25
- package/dist/index.js +1897 -1270
- package/dist/index.mjs +4830 -3324
- package/dist/types/TextElementStyles.d.ts +24 -0
- package/package.json +85 -85
package/dist/index.js
CHANGED
|
@@ -1,747 +1,747 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),j=require("react"),de=require("classnames"),I=require("./useScopedStyles-DpVdqfXj.js"),mr=require("react-dom");function fr(e){return e.type==="object"&&e.version===1}const hr="ControlSlider-module__wrapper___sHEkd",yr="ControlSlider-module__hoverArrow___A-dOH",vr="ControlSlider-module__sliderItem___QQSkR",br="ControlSlider-module__sliderImage___9hRl-",Sr="ControlSlider-module__arrow___05ghY",xr="ControlSlider-module__arrowVertical___tBfVN",Cr="ControlSlider-module__nextArrow___-30Yc",$r="ControlSlider-module__arrowInner___aEra3",_r="ControlSlider-module__arrowIcon___S4ztF",wr="ControlSlider-module__arrowImg___2dwJW",Tr="ControlSlider-module__mirror___brd6U",Er="ControlSlider-module__pagination___bicLF",Lr="ControlSlider-module__paginationInner___bT-P-",Ar="ControlSlider-module__paginationVertical___zYqKw",Ir="ControlSlider-module__paginationItem___nTRbk",kr="ControlSlider-module__dot___p1Qun",Fr="ControlSlider-module__activeDot___LHFaj",Rr="ControlSlider-module__paginationInsideBottom___R3FWn",Br="ControlSlider-module__paginationInsideTop___V-qb-",Vr="ControlSlider-module__paginationOutsideBottom___14w8D",Pr="ControlSlider-module__paginationOutsideTop___SCLqB",Or="ControlSlider-module__paginationInsideLeft___yOBRZ",Wr="ControlSlider-module__paginationInsideRight___Rtt3o",Nr="ControlSlider-module__paginationOutsideLeft___lahaw",zr="ControlSlider-module__paginationOutsideRight___EtuQa",jr="ControlSlider-module__imgWrapper___UjEgB",Mr="ControlSlider-module__captionBlock___dJ6-j",Hr="ControlSlider-module__captionTextWrapper___HFlpf",Dr="ControlSlider-module__captionText___uGBVc",Ur="ControlSlider-module__active___WZK4G",Gr="ControlSlider-module__withPointerEvents___t-18M",Yr="ControlSlider-module__topLeftAlignment___zjnGM",qr="ControlSlider-module__topCenterAlignment___gD1xW",Xr="ControlSlider-module__topRightAlignment___NMapS",Kr="ControlSlider-module__middleLeftAlignment___OnUrY",Jr="ControlSlider-module__middleCenterAlignment___Tdkl0",Zr="ControlSlider-module__middleRightAlignment___wEbfX",Qr="ControlSlider-module__bottomLeftAlignment___cTP2-",ei="ControlSlider-module__bottomCenterAlignment___c54fB",ti="ControlSlider-module__bottomRightAlignment___kEwrz",ni="ControlSlider-module__clickOverlay___DZA28",oi="ControlSlider-module__contain___pLyq7",ri="ControlSlider-module__cover___KdDat",G={wrapper:hr,hoverArrow:yr,sliderItem:vr,sliderImage:br,arrow:Sr,arrowVertical:xr,nextArrow:Cr,arrowInner:$r,arrowIcon:_r,arrowImg:wr,mirror:Tr,pagination:Er,paginationInner:Lr,paginationVertical:Ar,paginationItem:Ir,dot:kr,activeDot:Fr,paginationInsideBottom:Rr,paginationInsideTop:Br,paginationOutsideBottom:Vr,paginationOutsideTop:Pr,paginationInsideLeft:Or,paginationInsideRight:Wr,paginationOutsideLeft:Nr,paginationOutsideRight:zr,imgWrapper:jr,captionBlock:Mr,captionTextWrapper:Hr,captionText:Dr,active:Ur,withPointerEvents:Gr,topLeftAlignment:Yr,topCenterAlignment:qr,topRightAlignment:Xr,middleLeftAlignment:Kr,middleCenterAlignment:Jr,middleRightAlignment:Zr,bottomLeftAlignment:Qr,bottomCenterAlignment:ei,bottomRightAlignment:ti,clickOverlay:ni,contain:oi,cover:ri};function ii(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ai(e,t,n){return t&&ii(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var to="(prefers-reduced-motion: reduce)",ut=1,li=2,ft=3,vt=4,Rt=5,qt=6,Zt=7,si={CREATED:ut,MOUNTED:li,IDLE:ft,MOVING:vt,SCROLLING:Rt,DRAGGING:qt,DESTROYED:Zt};function He(e){e.length=0}function Ke(e,t,n){return Array.prototype.slice.call(e,t,n)}function ue(e){return e.bind.apply(e,[null].concat(Ke(arguments,1)))}var $o=setTimeout,$n=function(){};function no(e){return requestAnimationFrame(e)}function on(e,t){return typeof t===e}function Tt(e){return!Rn(e)&&on("object",e)}var Fn=Array.isArray,_o=ue(on,"function"),qe=ue(on,"string"),Bt=ue(on,"undefined");function Rn(e){return e===null}function wo(e){try{return e instanceof(e.ownerDocument.defaultView||window).HTMLElement}catch{return!1}}function Vt(e){return Fn(e)?e:[e]}function Te(e,t){Vt(e).forEach(t)}function Bn(e,t){return e.indexOf(t)>-1}function Xt(e,t){return e.push.apply(e,Vt(t)),e}function ze(e,t,n){e&&Te(t,function(o){o&&e.classList[n?"add":"remove"](o)})}function Fe(e,t){ze(e,qe(t)?t.split(" "):t,!0)}function Pt(e,t){Te(t,e.appendChild.bind(e))}function Vn(e,t){Te(e,function(n){var o=(t||n).parentNode;o&&o.insertBefore(n,t)})}function Et(e,t){return wo(e)&&(e.msMatchesSelector||e.matches).call(e,t)}function To(e,t){var n=e?Ke(e.children):[];return t?n.filter(function(o){return Et(o,t)}):n}function Ot(e,t){return t?To(e,t)[0]:e.firstElementChild}var Lt=Object.keys;function nt(e,t,n){return e&&(n?Lt(e).reverse():Lt(e)).forEach(function(o){o!=="__proto__"&&t(e[o],o)}),e}function At(e){return Ke(arguments,1).forEach(function(t){nt(t,function(n,o){e[o]=t[o]})}),e}function Ye(e){return Ke(arguments,1).forEach(function(t){nt(t,function(n,o){Fn(n)?e[o]=n.slice():Tt(n)?e[o]=Ye({},Tt(e[o])?e[o]:{},n):e[o]=n})}),e}function oo(e,t){Te(t||Lt(e),function(n){delete e[n]})}function Re(e,t){Te(e,function(n){Te(t,function(o){n&&n.removeAttribute(o)})})}function Z(e,t,n){Tt(t)?nt(t,function(o,r){Z(e,r,o)}):Te(e,function(o){Rn(n)||n===""?Re(o,t):o.setAttribute(t,String(n))})}function pt(e,t,n){var o=document.createElement(e);return t&&(qe(t)?Fe(o,t):Z(o,t)),n&&Pt(n,o),o}function Le(e,t,n){if(Bt(n))return getComputedStyle(e)[t];Rn(n)||(e.style[t]=""+n)}function It(e,t){Le(e,"display",t)}function Eo(e){e.setActive&&e.setActive()||e.focus({preventScroll:!0})}function Ae(e,t){return e.getAttribute(t)}function ro(e,t){return e&&e.classList.contains(t)}function _e(e){return e.getBoundingClientRect()}function ot(e){Te(e,function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})}function Lo(e){return Ot(new DOMParser().parseFromString(e,"text/html").body)}function Ne(e,t){e.preventDefault(),t&&(e.stopPropagation(),e.stopImmediatePropagation())}function Ao(e,t){return e&&e.querySelector(t)}function Pn(e,t){return t?Ke(e.querySelectorAll(t)):[]}function je(e,t){ze(e,t,!1)}function _n(e){return e.timeStamp}function et(e){return qe(e)?e:e?e+"px":""}var Wt="splide",On="data-"+Wt;function _t(e,t){if(!e)throw new Error("["+Wt+"] "+(t||""))}var Xe=Math.min,Qt=Math.max,en=Math.floor,kt=Math.ceil,Ce=Math.abs;function Io(e,t,n){return Ce(e-t)<n}function Kt(e,t,n,o){var r=Xe(t,n),a=Qt(t,n);return o?r<e&&e<a:r<=e&&e<=a}function st(e,t,n){var o=Xe(t,n),r=Qt(t,n);return Xe(Qt(o,e),r)}function wn(e){return+(e>0)-+(e<0)}function Tn(e,t){return Te(t,function(n){e=e.replace("%s",""+n)}),e}function Wn(e){return e<10?"0"+e:""+e}var io={};function ci(e){return""+e+Wn(io[e]=(io[e]||0)+1)}function ko(){var e=[];function t(i,l,s,p){r(i,l,function(c,_,v){var g="addEventListener"in c,u=g?c.removeEventListener.bind(c,_,s,p):c.removeListener.bind(c,s);g?c.addEventListener(_,s,p):c.addListener(s),e.push([c,_,v,s,u])})}function n(i,l,s){r(i,l,function(p,c,_){e=e.filter(function(v){return v[0]===p&&v[1]===c&&v[2]===_&&(!s||v[3]===s)?(v[4](),!1):!0})})}function o(i,l,s){var p,c=!0;return typeof CustomEvent=="function"?p=new CustomEvent(l,{bubbles:c,detail:s}):(p=document.createEvent("CustomEvent"),p.initCustomEvent(l,c,!1,s)),i.dispatchEvent(p),p}function r(i,l,s){Te(i,function(p){p&&Te(l,function(c){c.split(" ").forEach(function(_){var v=_.split(".");s(p,v[0],v[1])})})})}function a(){e.forEach(function(i){i[4]()}),He(e)}return{bind:t,unbind:n,dispatch:o,destroy:a}}var Je="mounted",En="ready",De="move",bt="moved",Nn="click",Fo="active",Ro="inactive",Bo="visible",Vo="hidden",ve="refresh",xe="updated",ht="resize",rn="resized",Po="drag",Oo="dragging",Wo="dragged",an="scroll",it="scrolled",ui="overflow",zn="destroy",No="arrows:mounted",zo="arrows:updated",jo="pagination:mounted",Mo="pagination:updated",jn="navigation:mounted",Mn="autoplay:play",Ho="autoplay:playing",Hn="autoplay:pause",Dn="lazyload:loaded",Do="sk",Uo="sh",tn="ei";function ge(e){var t=e?e.event.bus:document.createDocumentFragment(),n=ko();function o(a,i){n.bind(t,Vt(a).join(" "),function(l){i.apply(i,Fn(l.detail)?l.detail:[])})}function r(a){n.dispatch(t,a,Ke(arguments,1))}return e&&e.event.on(zn,n.destroy),At(n,{bus:t,on:o,off:ue(n.unbind,t),emit:r})}function ln(e,t,n,o){var r=Date.now,a,i=0,l,s=!0,p=0;function c(){if(!s){if(i=e?Xe((r()-a)/e,1):1,n&&n(i),i>=1&&(t(),a=r(),o&&++p>=o))return v();l=no(c)}}function _(f){f||u(),a=r()-(f?i*e:0),s=!1,l=no(c)}function v(){s=!0}function g(){a=r(),i=0,n&&n(i)}function u(){l&&cancelAnimationFrame(l),i=0,l=0,s=!0}function d(f){e=f}function x(){return s}return{start:_,rewind:g,pause:v,cancel:u,set:d,isPaused:x}}function pi(e){var t=e;function n(r){t=r}function o(r){return Bn(Vt(r),t)}return{set:n,is:o}}function di(e,t){var n=ln(0,e,null,1);return function(){n.isPaused()&&n.start()}}function gi(e,t,n){var o=e.state,r=n.breakpoints||{},a=n.reducedMotion||{},i=ko(),l=[];function s(){var u=n.mediaQuery==="min";Lt(r).sort(function(d,x){return u?+d-+x:+x-+d}).forEach(function(d){c(r[d],"("+(u?"min":"max")+"-width:"+d+"px)")}),c(a,to),_()}function p(u){u&&i.destroy()}function c(u,d){var x=matchMedia(d);i.bind(x,"change",_),l.push([u,x])}function _(){var u=o.is(Zt),d=n.direction,x=l.reduce(function(f,h){return Ye(f,h[1].matches?h[0]:{})},{});oo(n),g(x),n.destroy?e.destroy(n.destroy==="completely"):u?(p(!0),e.mount()):d!==n.direction&&e.refresh()}function v(u){matchMedia(to).matches&&(u?Ye(n,a):oo(n,Lt(a)))}function g(u,d,x){Ye(n,u),d&&Ye(Object.getPrototypeOf(n),u),(x||!o.is(ut))&&e.emit(xe,n)}return{setup:s,destroy:p,reduce:v,set:g}}var sn="Arrow",cn=sn+"Left",un=sn+"Right",Go=sn+"Up",Yo=sn+"Down",ao="rtl",pn="ttb",yn={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[Go,un],ArrowRight:[Yo,cn]};function mi(e,t,n){function o(a,i,l){l=l||n.direction;var s=l===ao&&!i?1:l===pn?0:-1;return yn[a]&&yn[a][s]||a.replace(/width|left|right/i,function(p,c){var _=yn[p.toLowerCase()][s]||p;return c>0?_.charAt(0).toUpperCase()+_.slice(1):_})}function r(a){return a*(n.direction===ao?1:-1)}return{resolve:o,orient:r}}var Me="role",dt="tabindex",fi="disabled",Ie="aria-",Nt=Ie+"controls",qo=Ie+"current",lo=Ie+"selected",we=Ie+"label",Un=Ie+"labelledby",Xo=Ie+"hidden",Gn=Ie+"orientation",Ft=Ie+"roledescription",so=Ie+"live",co=Ie+"busy",uo=Ie+"atomic",Yn=[Me,dt,fi,Nt,qo,we,Un,Xo,Gn,Ft],Be=Wt+"__",Ze="is-",vn=Wt,po=Be+"track",hi=Be+"list",dn=Be+"slide",Ko=dn+"--clone",yi=dn+"__container",qn=Be+"arrows",gn=Be+"arrow",Jo=gn+"--prev",Zo=gn+"--next",mn=Be+"pagination",Qo=mn+"__page",vi=Be+"progress",bi=vi+"__bar",Si=Be+"toggle",xi=Be+"spinner",Ci=Be+"sr",$i=Ze+"initialized",rt=Ze+"active",er=Ze+"prev",tr=Ze+"next",Ln=Ze+"visible",An=Ze+"loading",nr=Ze+"focus-in",or=Ze+"overflow",_i=[rt,Ln,er,tr,An,nr,or],wi={slide:dn,clone:Ko,arrows:qn,arrow:gn,prev:Jo,next:Zo,pagination:mn,page:Qo,spinner:xi};function Ti(e,t){if(_o(e.closest))return e.closest(t);for(var n=e;n&&n.nodeType===1&&!Et(n,t);)n=n.parentElement;return n}var Ei=5,go=200,rr="touchstart mousedown",bn="touchmove mousemove",Sn="touchend touchcancel mouseup click";function Li(e,t,n){var o=ge(e),r=o.on,a=o.bind,i=e.root,l=n.i18n,s={},p=[],c=[],_=[],v,g,u;function d(){$(),M(),h()}function x(){r(ve,f),r(ve,d),r(xe,h),a(document,rr+" keydown",function(y){u=y.type==="keydown"},{capture:!0}),a(i,"focusin",function(){ze(i,nr,!!u)})}function f(y){var L=Yn.concat("style");He(p),je(i,c),je(v,_),Re([v,g],L),Re(i,y?L:["style",Ft])}function h(){je(i,c),je(v,_),c=w(vn),_=w(po),Fe(i,c),Fe(v,_),Z(i,we,n.label),Z(i,Un,n.labelledby)}function $(){v=O("."+po),g=Ot(v,"."+hi),_t(v&&g,"A track/list element is missing."),Xt(p,To(g,"."+dn+":not(."+Ko+")")),nt({arrows:qn,pagination:mn,prev:Jo,next:Zo,bar:bi,toggle:Si},function(y,L){s[L]=O("."+y)}),At(s,{root:i,track:v,list:g,slides:p})}function M(){var y=i.id||ci(Wt),L=n.role;i.id=y,v.id=v.id||y+"-track",g.id=g.id||y+"-list",!Ae(i,Me)&&i.tagName!=="SECTION"&&L&&Z(i,Me,L),Z(i,Ft,l.carousel),Z(g,Me,"presentation")}function O(y){var L=Ao(i,y);return L&&Ti(L,"."+vn)===i?L:void 0}function w(y){return[y+"--"+n.type,y+"--"+n.direction,n.drag&&y+"--draggable",n.isNavigation&&y+"--nav",y===vn&&rt]}return At(s,{setup:d,mount:x,destroy:f})}var yt="slide",St="loop",zt="fade";function Ai(e,t,n,o){var r=ge(e),a=r.on,i=r.emit,l=r.bind,s=e.Components,p=e.root,c=e.options,_=c.isNavigation,v=c.updateOnMove,g=c.i18n,u=c.pagination,d=c.slideFocus,x=s.Direction.resolve,f=Ae(o,"style"),h=Ae(o,we),$=n>-1,M=Ot(o,"."+yi),O;function w(){$||(o.id=p.id+"-slide"+Wn(t+1),Z(o,Me,u?"tabpanel":"group"),Z(o,Ft,g.slide),Z(o,we,h||Tn(g.slideLabel,[t+1,e.length]))),y()}function y(){l(o,"click",ue(i,Nn,E)),l(o,"keydown",ue(i,Do,E)),a([bt,Uo,it],R),a(jn,B),v&&a(De,N)}function L(){O=!0,r.destroy(),je(o,_i),Re(o,Yn),Z(o,"style",f),Z(o,we,h||"")}function B(){var T=e.splides.map(function(C){var F=C.splide.Components.Slides.getAt(t);return F?F.slide.id:""}).join(" ");Z(o,we,Tn(g.slideX,($?n:t)+1)),Z(o,Nt,T),Z(o,Me,d?"button":""),d&&Re(o,Ft)}function N(){O||R()}function R(){if(!O){var T=e.index;V(),P(),ze(o,er,t===T-1),ze(o,tr,t===T+1)}}function V(){var T=H();T!==ro(o,rt)&&(ze(o,rt,T),Z(o,qo,_&&T||""),i(T?Fo:Ro,E))}function P(){var T=m(),C=!T&&(!H()||$);if(e.state.is([vt,Rt])||Z(o,Xo,C||""),Z(Pn(o,c.focusableNodes||""),dt,C?-1:""),d&&Z(o,dt,C?-1:0),T!==ro(o,Ln)&&(ze(o,Ln,T),i(T?Bo:Vo,E)),!T&&document.activeElement===o){var F=s.Slides.getAt(e.index);F&&Eo(F.slide)}}function U(T,C,F){Le(F&&M||o,T,C)}function H(){var T=e.index;return T===t||c.cloneStatus&&T===n}function m(){if(e.is(zt))return H();var T=_e(s.Elements.track),C=_e(o),F=x("left",!0),Y=x("right",!0);return en(T[F])<=kt(C[F])&&en(C[Y])<=kt(T[Y])}function k(T,C){var F=Ce(T-t);return!$&&(c.rewind||e.is(St))&&(F=Xe(F,e.length-F)),F<=C}var E={index:t,slideIndex:n,slide:o,container:M,isClone:$,mount:w,destroy:L,update:R,style:U,isWithin:k};return E}function Ii(e,t,n){var o=ge(e),r=o.on,a=o.emit,i=o.bind,l=t.Elements,s=l.slides,p=l.list,c=[];function _(){v(),r(ve,g),r(ve,v)}function v(){s.forEach(function(R,V){d(R,V,-1)})}function g(){O(function(R){R.destroy()}),He(c)}function u(){O(function(R){R.update()})}function d(R,V,P){var U=Ai(e,V,P,R);U.mount(),c.push(U),c.sort(function(H,m){return H.index-m.index})}function x(R){return R?w(function(V){return!V.isClone}):c}function f(R){var V=t.Controller,P=V.toIndex(R),U=V.hasFocus()?1:n.perPage;return w(function(H){return Kt(H.index,P,P+U-1)})}function h(R){return w(R)[0]}function $(R,V){Te(R,function(P){if(qe(P)&&(P=Lo(P)),wo(P)){var U=s[V];U?Vn(P,U):Pt(p,P),Fe(P,n.classes.slide),L(P,ue(a,ht))}}),a(ve)}function M(R){ot(w(R).map(function(V){return V.slide})),a(ve)}function O(R,V){x(V).forEach(R)}function w(R){return c.filter(_o(R)?R:function(V){return qe(R)?Et(V.slide,R):Bn(Vt(R),V.index)})}function y(R,V,P){O(function(U){U.style(R,V,P)})}function L(R,V){var P=Pn(R,"img"),U=P.length;U?P.forEach(function(H){i(H,"load error",function(){--U||V()})}):V()}function B(R){return R?s.length:c.length}function N(){return c.length>n.perPage}return{mount:_,destroy:g,update:u,register:d,get:x,getIn:f,getAt:h,add:$,remove:M,forEach:O,filter:w,style:y,getLength:B,isEnough:N}}function ki(e,t,n){var o=ge(e),r=o.on,a=o.bind,i=o.emit,l=t.Slides,s=t.Direction.resolve,p=t.Elements,c=p.root,_=p.track,v=p.list,g=l.getAt,u=l.style,d,x,f;function h(){$(),a(window,"resize load",di(ue(i,ht))),r([xe,ve],$),r(ht,M)}function $(){d=n.direction===pn,Le(c,"maxWidth",et(n.width)),Le(_,s("paddingLeft"),O(!1)),Le(_,s("paddingRight"),O(!0)),M(!0)}function M(E){var T=_e(c);(E||x.width!==T.width||x.height!==T.height)&&(Le(_,"height",w()),u(s("marginRight"),et(n.gap)),u("width",L()),u("height",B(),!0),x=T,i(rn),f!==(f=k())&&(ze(c,or,f),i(ui,f)))}function O(E){var T=n.padding,C=s(E?"right":"left");return T&&et(T[C]||(Tt(T)?0:T))||"0px"}function w(){var E="";return d&&(E=y(),_t(E,"height or heightRatio is missing."),E="calc("+E+" - "+O(!1)+" - "+O(!0)+")"),E}function y(){return et(n.height||_e(v).width*n.heightRatio)}function L(){return n.autoWidth?null:et(n.fixedWidth)||(d?"":N())}function B(){return et(n.fixedHeight)||(d?n.autoHeight?null:N():y())}function N(){var E=et(n.gap);return"calc((100%"+(E&&" + "+E)+")/"+(n.perPage||1)+(E&&" - "+E)+")"}function R(){return _e(v)[s("width")]}function V(E,T){var C=g(E||0);return C?_e(C.slide)[s("width")]+(T?0:H()):0}function P(E,T){var C=g(E);if(C){var F=_e(C.slide)[s("right")],Y=_e(v)[s("left")];return Ce(F-Y)+(T?0:H())}return 0}function U(E){return P(e.length-1)-P(0)+V(0,E)}function H(){var E=g(0);return E&&parseFloat(Le(E.slide,s("marginRight")))||0}function m(E){return parseFloat(Le(_,s("padding"+(E?"Right":"Left"))))||0}function k(){return e.is(zt)||U(!0)>R()}return{mount:h,resize:M,listSize:R,slideSize:V,sliderSize:U,totalSize:P,getPadding:m,isOverflow:k}}var Fi=2;function Ri(e,t,n){var o=ge(e),r=o.on,a=t.Elements,i=t.Slides,l=t.Direction.resolve,s=[],p;function c(){r(ve,_),r([xe,ht],g),(p=x())&&(u(p),t.Layout.resize(!0))}function _(){v(),c()}function v(){ot(s),He(s),o.destroy()}function g(){var f=x();p!==f&&(p<f||!f)&&o.emit(ve)}function u(f){var h=i.get().slice(),$=h.length;if($){for(;h.length<f;)Xt(h,h);Xt(h.slice(-f),h.slice(0,f)).forEach(function(M,O){var w=O<f,y=d(M.slide,O);w?Vn(y,h[0].slide):Pt(a.list,y),Xt(s,y),i.register(y,O-f+(w?0:$),M.index)})}}function d(f,h){var $=f.cloneNode(!0);return Fe($,n.classes.clone),$.id=e.root.id+"-clone"+Wn(h+1),$}function x(){var f=n.clones;if(!e.is(St))f=0;else if(Bt(f)){var h=n[l("fixedWidth")]&&t.Layout.slideSize(0),$=h&&kt(_e(a.track)[l("width")]/h);f=$||n[l("autoWidth")]&&e.length||n.perPage*Fi}return f}return{mount:c,destroy:v}}function Bi(e,t,n){var o=ge(e),r=o.on,a=o.emit,i=e.state.set,l=t.Layout,s=l.slideSize,p=l.getPadding,c=l.totalSize,_=l.listSize,v=l.sliderSize,g=t.Direction,u=g.resolve,d=g.orient,x=t.Elements,f=x.list,h=x.track,$;function M(){$=t.Transition,r([Je,rn,xe,ve],O)}function O(){t.Controller.isBusy()||(t.Scroll.cancel(),y(e.index),t.Slides.update())}function w(C,F,Y,re){C!==F&&E(C>Y)&&(R(),L(N(U(),C>Y),!0)),i(vt),a(De,F,Y,C),$.start(F,function(){i(ft),a(bt,F,Y,C),re&&re()})}function y(C){L(P(C,!0))}function L(C,F){if(!e.is(zt)){var Y=F?C:B(C);Le(f,"transform","translate"+u("X")+"("+Y+"px)"),C!==Y&&a(Uo)}}function B(C){if(e.is(St)){var F=V(C),Y=F>t.Controller.getEnd(),re=F<0;(re||Y)&&(C=N(C,Y))}return C}function N(C,F){var Y=C-k(F),re=v();return C-=d(re*(kt(Ce(Y)/re)||1))*(F?1:-1),C}function R(){L(U(),!0),$.cancel()}function V(C){for(var F=t.Slides.get(),Y=0,re=1/0,te=0;te<F.length;te++){var ie=F[te].index,A=Ce(P(ie,!0)-C);if(A<=re)re=A,Y=ie;else break}return Y}function P(C,F){var Y=d(c(C-1)-m(C));return F?H(Y):Y}function U(){var C=u("left");return _e(f)[C]-_e(h)[C]+d(p(!1))}function H(C){return n.trimSpace&&e.is(yt)&&(C=st(C,0,d(v(!0)-_()))),C}function m(C){var F=n.focus;return F==="center"?(_()-s(C,!0))/2:+F*s(C)||0}function k(C){return P(C?t.Controller.getEnd():0,!!n.trimSpace)}function E(C){var F=d(N(U(),C));return C?F>=0:F<=f[u("scrollWidth")]-_e(h)[u("width")]}function T(C,F){F=Bt(F)?U():F;var Y=C!==!0&&d(F)<d(k(!1)),re=C!==!1&&d(F)>d(k(!0));return Y||re}return{mount:M,move:w,jump:y,translate:L,shift:N,cancel:R,toIndex:V,toPosition:P,getPosition:U,getLimit:k,exceededLimit:T,reposition:O}}function Vi(e,t,n){var o=ge(e),r=o.on,a=o.emit,i=t.Move,l=i.getPosition,s=i.getLimit,p=i.toPosition,c=t.Slides,_=c.isEnough,v=c.getLength,g=n.omitEnd,u=e.is(St),d=e.is(yt),x=ue(U,!1),f=ue(U,!0),h=n.start||0,$,M=h,O,w,y;function L(){B(),r([xe,ve,tn],B),r(rn,N)}function B(){O=v(!0),w=n.perMove,y=n.perPage,$=E();var A=st(h,0,g?$:O-1);A!==h&&(h=A,i.reposition())}function N(){$!==E()&&a(tn)}function R(A,K,me){if(!ie()){var se=P(A),fe=k(se);fe>-1&&(K||fe!==h)&&(Y(fe),i.move(se,fe,M,me))}}function V(A,K,me,se){t.Scroll.scroll(A,K,me,function(){var fe=k(i.toIndex(l()));Y(g?Xe(fe,$):fe),se&&se()})}function P(A){var K=h;if(qe(A)){var me=A.match(/([+\-<>])(\d+)?/)||[],se=me[1],fe=me[2];se==="+"||se==="-"?K=H(h+ +(""+se+(+fe||1)),h):se===">"?K=fe?T(+fe):x(!0):se==="<"&&(K=f(!0))}else K=u?A:st(A,0,$);return K}function U(A,K){var me=w||(te()?1:y),se=H(h+me*(A?-1:1),h,!(w||te()));return se===-1&&d&&!Io(l(),s(!A),1)?A?0:$:K?se:k(se)}function H(A,K,me){if(_()||te()){var se=m(A);se!==A&&(K=A,A=se,me=!1),A<0||A>$?!w&&(Kt(0,A,K,!0)||Kt($,K,A,!0))?A=T(C(A)):u?A=me?A<0?-(O%y||y):O:A:n.rewind?A=A<0?$:0:A=-1:me&&A!==K&&(A=T(C(K)+(A<K?-1:1)))}else A=-1;return A}function m(A){if(d&&n.trimSpace==="move"&&A!==h)for(var K=l();K===p(A,!0)&&Kt(A,0,e.length-1,!n.rewind);)A<h?--A:++A;return A}function k(A){return u?(A+O)%O||0:A}function E(){for(var A=O-(te()||u&&w?1:y);g&&A-- >0;)if(p(O-1,!0)!==p(A,!0)){A++;break}return st(A,0,O-1)}function T(A){return st(te()?A:y*A,0,$)}function C(A){return te()?Xe(A,$):en((A>=$?O-1:A)/y)}function F(A){var K=i.toIndex(A);return d?st(K,0,$):K}function Y(A){A!==h&&(M=h,h=A)}function re(A){return A?M:h}function te(){return!Bt(n.focus)||n.isNavigation}function ie(){return e.state.is([vt,Rt])&&!!n.waitForTransition}return{mount:L,go:R,scroll:V,getNext:x,getPrev:f,getAdjacent:U,getEnd:E,setIndex:Y,getIndex:re,toIndex:T,toPage:C,toDest:F,hasFocus:te,isBusy:ie}}var Pi="http://www.w3.org/2000/svg",Oi="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",Ht=40;function Wi(e,t,n){var o=ge(e),r=o.on,a=o.bind,i=o.emit,l=n.classes,s=n.i18n,p=t.Elements,c=t.Controller,_=p.arrows,v=p.track,g=_,u=p.prev,d=p.next,x,f,h={};function $(){O(),r(xe,M)}function M(){w(),$()}function O(){var V=n.arrows;V&&!(u&&d)&&B(),u&&d&&(At(h,{prev:u,next:d}),It(g,V?"":"none"),Fe(g,f=qn+"--"+n.direction),V&&(y(),R(),Z([u,d],Nt,v.id),i(No,u,d)))}function w(){o.destroy(),je(g,f),x?(ot(_?[u,d]:g),u=d=null):Re([u,d],Yn)}function y(){r([Je,bt,ve,it,tn],R),a(d,"click",ue(L,">")),a(u,"click",ue(L,"<"))}function L(V){c.go(V,!0)}function B(){g=_||pt("div",l.arrows),u=N(!0),d=N(!1),x=!0,Pt(g,[u,d]),!_&&Vn(g,v)}function N(V){var P='<button class="'+l.arrow+" "+(V?l.prev:l.next)+'" type="button"><svg xmlns="'+Pi+'" viewBox="0 0 '+Ht+" "+Ht+'" width="'+Ht+'" height="'+Ht+'" focusable="false"><path d="'+(n.arrowPath||Oi)+'" />';return Lo(P)}function R(){if(u&&d){var V=e.index,P=c.getPrev(),U=c.getNext(),H=P>-1&&V<P?s.last:s.prev,m=U>-1&&V>U?s.first:s.next;u.disabled=P<0,d.disabled=U<0,Z(u,we,H),Z(d,we,m),i(zo,u,d,P,U)}}return{arrows:h,mount:$,destroy:w,update:R}}var Ni=On+"-interval";function zi(e,t,n){var o=ge(e),r=o.on,a=o.bind,i=o.emit,l=ln(n.interval,e.go.bind(e,">"),y),s=l.isPaused,p=t.Elements,c=t.Elements,_=c.root,v=c.toggle,g=n.autoplay,u,d,x=g==="pause";function f(){g&&(h(),v&&Z(v,Nt,p.track.id),x||$(),w())}function h(){n.pauseOnHover&&a(_,"mouseenter mouseleave",function(B){u=B.type==="mouseenter",O()}),n.pauseOnFocus&&a(_,"focusin focusout",function(B){d=B.type==="focusin",O()}),v&&a(v,"click",function(){x?$():M(!0)}),r([De,an,ve],l.rewind),r(De,L)}function $(){s()&&t.Slides.isEnough()&&(l.start(!n.resetProgress),d=u=x=!1,w(),i(Mn))}function M(B){B===void 0&&(B=!0),x=!!B,w(),s()||(l.pause(),i(Hn))}function O(){x||(u||d?M(!1):$())}function w(){v&&(ze(v,rt,!x),Z(v,we,n.i18n[x?"play":"pause"]))}function y(B){var N=p.bar;N&&Le(N,"width",B*100+"%"),i(Ho,B)}function L(B){var N=t.Slides.getAt(B);l.set(N&&+Ae(N.slide,Ni)||n.interval)}return{mount:f,destroy:l.cancel,play:$,pause:M,isPaused:s}}function ji(e,t,n){var o=ge(e),r=o.on;function a(){n.cover&&(r(Dn,ue(l,!0)),r([Je,xe,ve],ue(i,!0)))}function i(s){t.Slides.forEach(function(p){var c=Ot(p.container||p.slide,"img");c&&c.src&&l(s,c,p)})}function l(s,p,c){c.style("background",s?'center/cover no-repeat url("'+p.src+'")':"",!0),It(p,s?"none":"")}return{mount:a,destroy:ue(i,!1)}}var Mi=10,Hi=600,Di=.6,Ui=1.5,Gi=800;function Yi(e,t,n){var o=ge(e),r=o.on,a=o.emit,i=e.state.set,l=t.Move,s=l.getPosition,p=l.getLimit,c=l.exceededLimit,_=l.translate,v=e.is(yt),g,u,d=1;function x(){r(De,M),r([xe,ve],O)}function f(y,L,B,N,R){var V=s();if(M(),B&&(!v||!c())){var P=t.Layout.sliderSize(),U=wn(y)*P*en(Ce(y)/P)||0;y=l.toPosition(t.Controller.toDest(y%P))+U}var H=Io(V,y,1);d=1,L=H?0:L||Qt(Ce(y-V)/Ui,Gi),u=N,g=ln(L,h,ue($,V,y,R),1),i(Rt),a(an),g.start()}function h(){i(ft),u&&u(),a(it)}function $(y,L,B,N){var R=s(),V=y+(L-y)*w(N),P=(V-R)*d;_(R+P),v&&!B&&c()&&(d*=Di,Ce(P)<Mi&&f(p(c(!0)),Hi,!1,u,!0))}function M(){g&&g.cancel()}function O(){g&&!g.isPaused()&&(M(),h())}function w(y){var L=n.easingFunc;return L?L(y):1-Math.pow(1-y,4)}return{mount:x,destroy:M,scroll:f,cancel:O}}var ct={passive:!1,capture:!0};function qi(e,t,n){var o=ge(e),r=o.on,a=o.emit,i=o.bind,l=o.unbind,s=e.state,p=t.Move,c=t.Scroll,_=t.Controller,v=t.Elements.track,g=t.Media.reduce,u=t.Direction,d=u.resolve,x=u.orient,f=p.getPosition,h=p.exceededLimit,$,M,O,w,y,L=!1,B,N,R;function V(){i(v,bn,$n,ct),i(v,Sn,$n,ct),i(v,rr,U,ct),i(v,"click",k,{capture:!0}),i(v,"dragstart",Ne),r([Je,xe],P)}function P(){var z=n.drag;Ue(!z),w=z==="free"}function U(z){if(B=!1,!N){var b=fe(z);se(z.target)&&(b||!z.button)&&(_.isBusy()?Ne(z,!0):(R=b?v:window,y=s.is([vt,Rt]),O=null,i(R,bn,H,ct),i(R,Sn,m,ct),p.cancel(),c.cancel(),E(z)))}}function H(z){if(s.is(qt)||(s.set(qt),a(Po)),z.cancelable)if(y){p.translate($+me(te(z)));var b=ie(z)>go,D=L!==(L=h());(b||D)&&E(z),B=!0,a(Oo),Ne(z)}else F(z)&&(y=C(z),Ne(z))}function m(z){s.is(qt)&&(s.set(ft),a(Wo)),y&&(T(z),Ne(z)),l(R,bn,H),l(R,Sn,m),y=!1}function k(z){!N&&B&&Ne(z,!0)}function E(z){O=M,M=z,$=f()}function T(z){var b=Y(z),D=re(b),q=n.rewind&&n.rewindByDrag;g(!1),w?_.scroll(D,0,n.snap):e.is(zt)?_.go(x(wn(b))<0?q?"<":"-":q?">":"+"):e.is(yt)&&L&&q?_.go(h(!0)?">":"<"):_.go(_.toDest(D),!0),g(!0)}function C(z){var b=n.dragMinThreshold,D=Tt(b),q=D&&b.mouse||0,J=(D?b.touch:+b)||10;return Ce(te(z))>(fe(z)?J:q)}function F(z){return Ce(te(z))>Ce(te(z,!0))}function Y(z){if(e.is(St)||!L){var b=ie(z);if(b&&b<go)return te(z)/b}return 0}function re(z){return f()+wn(z)*Xe(Ce(z)*(n.flickPower||600),w?1/0:t.Layout.listSize()*(n.flickMaxPages||1))}function te(z,b){return K(z,b)-K(A(z),b)}function ie(z){return _n(z)-_n(A(z))}function A(z){return M===z&&O||M}function K(z,b){return(fe(z)?z.changedTouches[0]:z)["page"+d(b?"Y":"X")]}function me(z){return z/(L&&e.is(yt)?Ei:1)}function se(z){var b=n.noDrag;return!Et(z,"."+Qo+", ."+gn)&&(!b||!Et(z,b))}function fe(z){return typeof TouchEvent<"u"&&z instanceof TouchEvent}function Se(){return y}function Ue(z){N=z}return{mount:V,disable:Ue,isDragging:Se}}var Xi={Spacebar:" ",Right:un,Left:cn,Up:Go,Down:Yo};function Xn(e){return e=qe(e)?e:e.key,Xi[e]||e}var mo="keydown";function Ki(e,t,n){var o=ge(e),r=o.on,a=o.bind,i=o.unbind,l=e.root,s=t.Direction.resolve,p,c;function _(){v(),r(xe,g),r(xe,v),r(De,d)}function v(){var f=n.keyboard;f&&(p=f==="global"?window:l,a(p,mo,x))}function g(){i(p,mo)}function u(f){c=f}function d(){var f=c;c=!0,$o(function(){c=f})}function x(f){if(!c){var h=Xn(f);h===s(cn)?e.go("<"):h===s(un)&&e.go(">")}}return{mount:_,destroy:g,disable:u}}var wt=On+"-lazy",Jt=wt+"-srcset",Ji="["+wt+"], ["+Jt+"]";function Zi(e,t,n){var o=ge(e),r=o.on,a=o.off,i=o.bind,l=o.emit,s=n.lazyLoad==="sequential",p=[bt,it],c=[];function _(){n.lazyLoad&&(v(),r(ve,v))}function v(){He(c),g(),s?f():(a(p),r(p,u),u())}function g(){t.Slides.forEach(function(h){Pn(h.slide,Ji).forEach(function($){var M=Ae($,wt),O=Ae($,Jt);if(M!==$.src||O!==$.srcset){var w=n.classes.spinner,y=$.parentElement,L=Ot(y,"."+w)||pt("span",w,y);c.push([$,h,L]),$.src||It($,"none")}})})}function u(){c=c.filter(function(h){var $=n.perPage*((n.preloadPages||1)+1)-1;return h[1].isWithin(e.index,$)?d(h):!0}),c.length||a(p)}function d(h){var $=h[0];Fe(h[1].slide,An),i($,"load error",ue(x,h)),Z($,"src",Ae($,wt)),Z($,"srcset",Ae($,Jt)),Re($,wt),Re($,Jt)}function x(h,$){var M=h[0],O=h[1];je(O.slide,An),$.type!=="error"&&(ot(h[2]),It(M,""),l(Dn,M,O),l(ht)),s&&f()}function f(){c.length&&d(c.shift())}return{mount:_,destroy:ue(He,c),check:u}}function Qi(e,t,n){var o=ge(e),r=o.on,a=o.emit,i=o.bind,l=t.Slides,s=t.Elements,p=t.Controller,c=p.hasFocus,_=p.getIndex,v=p.go,g=t.Direction.resolve,u=s.pagination,d=[],x,f;function h(){$(),r([xe,ve,tn],h);var N=n.pagination;u&&It(u,N?"":"none"),N&&(r([De,an,it],B),M(),B(),a(jo,{list:x,items:d},L(e.index)))}function $(){x&&(ot(u?Ke(x.children):x),je(x,f),He(d),x=null),o.destroy()}function M(){var N=e.length,R=n.classes,V=n.i18n,P=n.perPage,U=c()?p.getEnd()+1:kt(N/P);x=u||pt("ul",R.pagination,s.track.parentElement),Fe(x,f=mn+"--"+y()),Z(x,Me,"tablist"),Z(x,we,V.select),Z(x,Gn,y()===pn?"vertical":"");for(var H=0;H<U;H++){var m=pt("li",null,x),k=pt("button",{class:R.page,type:"button"},m),E=l.getIn(H).map(function(C){return C.slide.id}),T=!c()&&P>1?V.pageX:V.slideX;i(k,"click",ue(O,H)),n.paginationKeyboard&&i(k,"keydown",ue(w,H)),Z(m,Me,"presentation"),Z(k,Me,"tab"),Z(k,Nt,E.join(" ")),Z(k,we,Tn(T,H+1)),Z(k,dt,-1),d.push({li:m,button:k,page:H})}}function O(N){v(">"+N,!0)}function w(N,R){var V=d.length,P=Xn(R),U=y(),H=-1;P===g(un,!1,U)?H=++N%V:P===g(cn,!1,U)?H=(--N+V)%V:P==="Home"?H=0:P==="End"&&(H=V-1);var m=d[H];m&&(Eo(m.button),v(">"+H),Ne(R,!0))}function y(){return n.paginationDirection||n.direction}function L(N){return d[p.toPage(N)]}function B(){var N=L(_(!0)),R=L(_());if(N){var V=N.button;je(V,rt),Re(V,lo),Z(V,dt,-1)}if(R){var P=R.button;Fe(P,rt),Z(P,lo,!0),Z(P,dt,"")}a(Mo,{list:x,items:d},N,R)}return{items:d,mount:h,destroy:$,getAt:L,update:B}}var ea=[" ","Enter"];function ta(e,t,n){var o=n.isNavigation,r=n.slideFocus,a=[];function i(){e.splides.forEach(function(u){u.isParent||(p(e,u.splide),p(u.splide,e))}),o&&c()}function l(){a.forEach(function(u){u.destroy()}),He(a)}function s(){l(),i()}function p(u,d){var x=ge(u);x.on(De,function(f,h,$){d.go(d.is(St)?$:f)}),a.push(x)}function c(){var u=ge(e),d=u.on;d(Nn,v),d(Do,g),d([Je,xe],_),a.push(u),u.emit(jn,e.splides)}function _(){Z(t.Elements.list,Gn,n.direction===pn?"vertical":"")}function v(u){e.go(u.index)}function g(u,d){Bn(ea,Xn(d))&&(v(u),Ne(d))}return{setup:ue(t.Media.set,{slideFocus:Bt(r)?o:r},!0),mount:i,destroy:l,remount:s}}function na(e,t,n){var o=ge(e),r=o.bind,a=0;function i(){n.wheel&&r(t.Elements.track,"wheel",l,ct)}function l(p){if(p.cancelable){var c=p.deltaY,_=c<0,v=_n(p),g=n.wheelMinThreshold||0,u=n.wheelSleep||0;Ce(c)>g&&v-a>u&&(e.go(_?"<":">"),a=v),s(_)&&Ne(p)}}function s(p){return!n.releaseWheel||e.state.is(vt)||t.Controller.getAdjacent(p)!==-1}return{mount:i}}var oa=90;function ra(e,t,n){var o=ge(e),r=o.on,a=t.Elements.track,i=n.live&&!n.isNavigation,l=pt("span",Ci),s=ln(oa,ue(c,!1));function p(){i&&(v(!t.Autoplay.isPaused()),Z(a,uo,!0),l.textContent="…",r(Mn,ue(v,!0)),r(Hn,ue(v,!1)),r([bt,it],ue(c,!0)))}function c(g){Z(a,co,g),g?(Pt(a,l),s.start()):(ot(l),s.cancel())}function _(){Re(a,[so,uo,co]),ot(l)}function v(g){i&&Z(a,so,g?"off":"polite")}return{mount:p,disable:v,destroy:_}}var ia=Object.freeze({__proto__:null,Media:gi,Direction:mi,Elements:Li,Slides:Ii,Layout:ki,Clones:Ri,Move:Bi,Controller:Vi,Arrows:Wi,Autoplay:zi,Cover:ji,Scroll:Yi,Drag:qi,Keyboard:Ki,LazyLoad:Zi,Pagination:Qi,Sync:ta,Wheel:na,Live:ra}),aa={prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},la={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:wi,i18n:aa,reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function sa(e,t,n){var o=t.Slides;function r(){ge(e).on([Je,ve],a)}function a(){o.forEach(function(l){l.style("transform","translateX(-"+100*l.index+"%)")})}function i(l,s){o.style("transition","opacity "+n.speed+"ms "+n.easing),$o(s)}return{mount:r,start:i,cancel:$n}}function ca(e,t,n){var o=t.Move,r=t.Controller,a=t.Scroll,i=t.Elements.list,l=ue(Le,i,"transition"),s;function p(){ge(e).bind(i,"transitionend",function(g){g.target===i&&s&&(_(),s())})}function c(g,u){var d=o.toPosition(g,!0),x=o.getPosition(),f=v(g);Ce(d-x)>=1&&f>=1?n.useScroll?a.scroll(d,f,!1,u):(l("transform "+f+"ms "+n.easing),o.translate(d,!0),s=u):(o.jump(g),u())}function _(){l(""),a.cancel()}function v(g){var u=n.rewindSpeed;if(e.is(yt)&&u){var d=r.getIndex(!0),x=r.getEnd();if(d===0&&g>=x||d>=x&&g===0)return u}return n.speed}return{mount:p,start:c,cancel:_}}var ua=(function(){function e(n,o){this.event=ge(),this.Components={},this.state=pi(ut),this.splides=[],this._o={},this._E={};var r=qe(n)?Ao(document,n):n;_t(r,r+" is invalid."),this.root=r,o=Ye({label:Ae(r,we)||"",labelledby:Ae(r,Un)||""},la,e.defaults,o||{});try{Ye(o,JSON.parse(Ae(r,On)))}catch{_t(!1,"Invalid JSON")}this._o=Object.create(Ye({},o))}var t=e.prototype;return t.mount=function(o,r){var a=this,i=this.state,l=this.Components;_t(i.is([ut,Zt]),"Already mounted!"),i.set(ut),this._C=l,this._T=r||this._T||(this.is(zt)?sa:ca),this._E=o||this._E;var s=At({},ia,this._E,{Transition:this._T});return nt(s,function(p,c){var _=p(a,l,a._o);l[c]=_,_.setup&&_.setup()}),nt(l,function(p){p.mount&&p.mount()}),this.emit(Je),Fe(this.root,$i),i.set(ft),this.emit(En),this},t.sync=function(o){return this.splides.push({splide:o}),o.splides.push({splide:this,isParent:!0}),this.state.is(ft)&&(this._C.Sync.remount(),o.Components.Sync.remount()),this},t.go=function(o){return this._C.Controller.go(o),this},t.on=function(o,r){return this.event.on(o,r),this},t.off=function(o){return this.event.off(o),this},t.emit=function(o){var r;return(r=this.event).emit.apply(r,[o].concat(Ke(arguments,1))),this},t.add=function(o,r){return this._C.Slides.add(o,r),this},t.remove=function(o){return this._C.Slides.remove(o),this},t.is=function(o){return this._o.type===o},t.refresh=function(){return this.emit(ve),this},t.destroy=function(o){o===void 0&&(o=!0);var r=this.event,a=this.state;return a.is(ut)?ge(this).on(En,this.destroy.bind(this,o)):(nt(this._C,function(i){i.destroy&&i.destroy(o)},!0),r.emit(zn),r.destroy(),o&&He(this.splides),a.set(Zt)),this},ai(e,[{key:"options",get:function(){return this._o},set:function(o){this._C.Media.set(o,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),e})(),Kn=ua;Kn.defaults={};Kn.STATES=si;var fo=[[Je,"onMounted"],[En,"onReady"],[De,"onMove"],[bt,"onMoved"],[Nn,"onClick"],[Fo,"onActive"],[Ro,"onInactive"],[Bo,"onVisible"],[Vo,"onHidden"],[ve,"onRefresh"],[xe,"onUpdated"],[ht,"onResize"],[rn,"onResized"],[Po,"onDrag"],[Oo,"onDragging"],[Wo,"onDragged"],[an,"onScroll"],[it,"onScrolled"],[zn,"onDestroy"],[No,"onArrowsMounted"],[zo,"onArrowsUpdated"],[jo,"onPaginationMounted"],[Mo,"onPaginationUpdated"],[jn,"onNavigationMounted"],[Mn,"onAutoplayPlay"],[Ho,"onAutoplayPlaying"],[Hn,"onAutoplayPause"],[Dn,"onLazyLoadLoaded"]];function Jn(...e){return e.filter(Boolean).join(" ")}function nn(e){return e!==null&&typeof e=="object"}function In(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&!e.some((n,o)=>!In(n,t[o]));if(nn(e)&&nn(t)){const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&!n.some(r=>!Object.prototype.hasOwnProperty.call(t,r)||!In(e[r],t[r]))}return e===t}function pa(e,t){return e.length===t.length&&!e.some((n,o)=>n!==t[o])}function da(e,t){if(e){const n=Object.keys(e);for(let o=0;o<n.length;o++){const r=n[o];if(r!=="__proto__"&&t(e[r],r)===!1)break}}return e}function kn(e,t){const n=e;return da(t,(o,r)=>{Array.isArray(o)?n[r]=o.slice():nn(o)?n[r]=kn(nn(n[r])?n[r]:{},o):n[r]=o}),n}var ga=({children:e,className:t,...n})=>j.createElement("div",{className:Jn("splide__track",t),...n},j.createElement("ul",{className:"splide__list"},e)),ir=class extends j.Component{constructor(){super(...arguments),this.splideRef=j.createRef(),this.slides=[]}componentDidMount(){const{options:e,extensions:t,transition:n}=this.props,{current:o}=this.splideRef;o&&(this.splide=new Kn(o,e),this.bind(this.splide),this.splide.mount(t,n),this.options=kn({},e||{}),this.slides=this.getSlides())}componentWillUnmount(){this.splide&&(this.splide.destroy(),this.splide=void 0),this.options=void 0,this.slides.length=0}componentDidUpdate(){if(!this.splide)return;const{options:e}=this.props;e&&!In(this.options,e)&&(this.splide.options=e,this.options=kn({},e));const t=this.getSlides();pa(this.slides,t)||(this.splide.refresh(),this.slides=t)}sync(e){var t;(t=this.splide)==null||t.sync(e)}go(e){var t;(t=this.splide)==null||t.go(e)}getSlides(){var e;if(this.splide){const t=(e=this.splide.Components.Elements)==null?void 0:e.list.children;return t&&Array.prototype.slice.call(t)||[]}return[]}bind(e){fo.forEach(([t,n])=>{const o=this.props[n];typeof o=="function"&&e.on(t,(...r)=>{o(e,...r)})})}omit(e,t){return t.forEach(n=>{Object.prototype.hasOwnProperty.call(e,n)&&delete e[n]}),e}render(){const{className:e,tag:t="div",hasTrack:n=!0,children:o,...r}=this.props;return j.createElement(t,{className:Jn("splide",e),ref:this.splideRef,...this.omit(r,["options",...fo.map(a=>a[1])])},n?j.createElement(ga,null,o):o)}},ar=({children:e,className:t,...n})=>j.createElement("li",{className:Jn("splide__slide",t),...n},e);/*!
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),V=require("react"),yt=require("classnames"),E=require("./useScopedStyles-DpVdqfXj.js"),Lr=require("react-dom");function bo(t){return t.type==="object"&&t.version===1}const vo="ControlSlider-module__wrapper___sHEkd",So="ControlSlider-module__hoverArrow___A-dOH",xo="ControlSlider-module__sliderItem___QQSkR",Co="ControlSlider-module__sliderImage___9hRl-",$o="ControlSlider-module__arrow___05ghY",wo="ControlSlider-module__arrowVertical___tBfVN",_o="ControlSlider-module__nextArrow___-30Yc",To="ControlSlider-module__arrowInner___aEra3",Lo="ControlSlider-module__arrowIcon___S4ztF",Eo="ControlSlider-module__arrowImg___2dwJW",Ao="ControlSlider-module__mirror___brd6U",Io="ControlSlider-module__pagination___bicLF",Fo="ControlSlider-module__paginationInner___bT-P-",ko="ControlSlider-module__paginationVertical___zYqKw",Ro="ControlSlider-module__paginationItem___nTRbk",Oo="ControlSlider-module__dot___p1Qun",Po="ControlSlider-module__activeDot___LHFaj",Bo="ControlSlider-module__paginationInsideBottom___R3FWn",Wo="ControlSlider-module__paginationInsideTop___V-qb-",Vo="ControlSlider-module__paginationOutsideBottom___14w8D",zo="ControlSlider-module__paginationOutsideTop___SCLqB",No="ControlSlider-module__paginationInsideLeft___yOBRZ",jo="ControlSlider-module__paginationInsideRight___Rtt3o",Mo="ControlSlider-module__paginationOutsideLeft___lahaw",Ho="ControlSlider-module__paginationOutsideRight___EtuQa",Do="ControlSlider-module__imgWrapper___UjEgB",Go="ControlSlider-module__captionBlock___dJ6-j",Uo="ControlSlider-module__captionTextWrapper___HFlpf",Xo="ControlSlider-module__captionText___uGBVc",qo="ControlSlider-module__active___WZK4G",Yo="ControlSlider-module__withPointerEvents___t-18M",Ko="ControlSlider-module__topLeftAlignment___zjnGM",Jo="ControlSlider-module__topCenterAlignment___gD1xW",Zo="ControlSlider-module__topRightAlignment___NMapS",Qo="ControlSlider-module__middleLeftAlignment___OnUrY",ti="ControlSlider-module__middleCenterAlignment___Tdkl0",ei="ControlSlider-module__middleRightAlignment___wEbfX",ni="ControlSlider-module__bottomLeftAlignment___cTP2-",ri="ControlSlider-module__bottomCenterAlignment___c54fB",oi="ControlSlider-module__bottomRightAlignment___kEwrz",ii="ControlSlider-module__clickOverlay___DZA28",ai="ControlSlider-module__contain___pLyq7",li="ControlSlider-module__cover___KdDat",U={wrapper:vo,hoverArrow:So,sliderItem:xo,sliderImage:Co,arrow:$o,arrowVertical:wo,nextArrow:_o,arrowInner:To,arrowIcon:Lo,arrowImg:Eo,mirror:Ao,pagination:Io,paginationInner:Fo,paginationVertical:ko,paginationItem:Ro,dot:Oo,activeDot:Po,paginationInsideBottom:Bo,paginationInsideTop:Wo,paginationOutsideBottom:Vo,paginationOutsideTop:zo,paginationInsideLeft:No,paginationInsideRight:jo,paginationOutsideLeft:Mo,paginationOutsideRight:Ho,imgWrapper:Do,captionBlock:Go,captionTextWrapper:Uo,captionText:Xo,active:qo,withPointerEvents:Yo,topLeftAlignment:Ko,topCenterAlignment:Jo,topRightAlignment:Zo,middleLeftAlignment:Qo,middleCenterAlignment:ti,middleRightAlignment:ei,bottomLeftAlignment:ni,bottomCenterAlignment:ri,bottomRightAlignment:oi,clickOverlay:ii,contain:ai,cover:li};function si(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ci(t,e,n){return e&&si(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var ir="(prefers-reduced-motion: reduce)",fe=1,ui=2,ve=3,Ce=4,Be=5,Ze=6,nn=7,pi={CREATED:fe,MOUNTED:ui,IDLE:ve,MOVING:Ce,SCROLLING:Be,DRAGGING:Ze,DESTROYED:nn};function Xt(t){t.length=0}function ee(t,e,n){return Array.prototype.slice.call(t,e,n)}function mt(t){return t.bind.apply(t,[null].concat(ee(arguments,1)))}var Er=setTimeout,Tn=function(){};function ar(t){return requestAnimationFrame(t)}function sn(t,e){return typeof e===t}function Ae(t){return!Bn(t)&&sn("object",t)}var Pn=Array.isArray,Ar=mt(sn,"function"),Qt=mt(sn,"string"),We=mt(sn,"undefined");function Bn(t){return t===null}function Ir(t){try{return t instanceof(t.ownerDocument.defaultView||window).HTMLElement}catch{return!1}}function Ve(t){return Pn(t)?t:[t]}function It(t,e){Ve(t).forEach(e)}function Wn(t,e){return t.indexOf(e)>-1}function Qe(t,e){return t.push.apply(t,Ve(e)),t}function Ht(t,e,n){t&&It(e,function(r){r&&t.classList[n?"add":"remove"](r)})}function Wt(t,e){Ht(t,Qt(e)?e.split(" "):e,!0)}function ze(t,e){It(e,t.appendChild.bind(t))}function Vn(t,e){It(t,function(n){var r=(e||n).parentNode;r&&r.insertBefore(n,e)})}function Ie(t,e){return Ir(t)&&(t.msMatchesSelector||t.matches).call(t,e)}function Fr(t,e){var n=t?ee(t.children):[];return e?n.filter(function(r){return Ie(r,e)}):n}function Ne(t,e){return e?Fr(t,e)[0]:t.firstElementChild}var Fe=Object.keys;function le(t,e,n){return t&&(n?Fe(t).reverse():Fe(t)).forEach(function(r){r!=="__proto__"&&e(t[r],r)}),t}function ke(t){return ee(arguments,1).forEach(function(e){le(e,function(n,r){t[r]=e[r]})}),t}function Jt(t){return ee(arguments,1).forEach(function(e){le(e,function(n,r){Pn(n)?t[r]=n.slice():Ae(n)?t[r]=Jt({},Ae(t[r])?t[r]:{},n):t[r]=n})}),t}function lr(t,e){It(e||Fe(t),function(n){delete t[n]})}function Vt(t,e){It(t,function(n){It(e,function(r){n&&n.removeAttribute(r)})})}function tt(t,e,n){Ae(e)?le(e,function(r,o){tt(t,o,r)}):It(t,function(r){Bn(n)||n===""?Vt(r,e):r.setAttribute(e,String(n))})}function he(t,e,n){var r=document.createElement(t);return e&&(Qt(e)?Wt(r,e):tt(r,e)),n&&ze(n,r),r}function kt(t,e,n){if(We(n))return getComputedStyle(t)[e];Bn(n)||(t.style[e]=""+n)}function Re(t,e){kt(t,"display",e)}function kr(t){t.setActive&&t.setActive()||t.focus({preventScroll:!0})}function Rt(t,e){return t.getAttribute(e)}function sr(t,e){return t&&t.classList.contains(e)}function Et(t){return t.getBoundingClientRect()}function se(t){It(t,function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})}function Rr(t){return Ne(new DOMParser().parseFromString(t,"text/html").body)}function Mt(t,e){t.preventDefault(),e&&(t.stopPropagation(),t.stopImmediatePropagation())}function Or(t,e){return t&&t.querySelector(e)}function zn(t,e){return e?ee(t.querySelectorAll(e)):[]}function Dt(t,e){Ht(t,e,!1)}function Ln(t){return t.timeStamp}function ie(t){return Qt(t)?t:t?t+"px":""}var je="splide",Nn="data-"+je;function Le(t,e){if(!t)throw new Error("["+je+"] "+(e||""))}var te=Math.min,rn=Math.max,on=Math.floor,Oe=Math.ceil,Tt=Math.abs;function Pr(t,e,n){return Tt(t-e)<n}function tn(t,e,n,r){var o=te(e,n),a=rn(e,n);return r?o<t&&t<a:o<=t&&t<=a}function ge(t,e,n){var r=te(e,n),o=rn(e,n);return te(rn(r,t),o)}function En(t){return+(t>0)-+(t<0)}function An(t,e){return It(e,function(n){t=t.replace("%s",""+n)}),t}function jn(t){return t<10?"0"+t:""+t}var cr={};function di(t){return""+t+jn(cr[t]=(cr[t]||0)+1)}function Br(){var t=[];function e(i,c,s,d){o(i,c,function(l,w,b){var g="addEventListener"in l,u=g?l.removeEventListener.bind(l,w,s,d):l.removeListener.bind(l,s);g?l.addEventListener(w,s,d):l.addListener(s),t.push([l,w,b,s,u])})}function n(i,c,s){o(i,c,function(d,l,w){t=t.filter(function(b){return b[0]===d&&b[1]===l&&b[2]===w&&(!s||b[3]===s)?(b[4](),!1):!0})})}function r(i,c,s){var d,l=!0;return typeof CustomEvent=="function"?d=new CustomEvent(c,{bubbles:l,detail:s}):(d=document.createEvent("CustomEvent"),d.initCustomEvent(c,l,!1,s)),i.dispatchEvent(d),d}function o(i,c,s){It(i,function(d){d&&It(c,function(l){l.split(" ").forEach(function(w){var b=w.split(".");s(d,b[0],b[1])})})})}function a(){t.forEach(function(i){i[4]()}),Xt(t)}return{bind:e,unbind:n,dispatch:r,destroy:a}}var ne="mounted",In="ready",qt="move",$e="moved",Mn="click",Wr="active",Vr="inactive",zr="visible",Nr="hidden",vt="refresh",$t="updated",Se="resize",cn="resized",jr="drag",Mr="dragging",Hr="dragged",un="scroll",ue="scrolled",gi="overflow",Hn="destroy",Dr="arrows:mounted",Gr="arrows:updated",Ur="pagination:mounted",Xr="pagination:updated",Dn="navigation:mounted",Gn="autoplay:play",qr="autoplay:playing",Un="autoplay:pause",Xn="lazyload:loaded",Yr="sk",Kr="sh",an="ei";function bt(t){var e=t?t.event.bus:document.createDocumentFragment(),n=Br();function r(a,i){n.bind(e,Ve(a).join(" "),function(c){i.apply(i,Pn(c.detail)?c.detail:[])})}function o(a){n.dispatch(e,a,ee(arguments,1))}return t&&t.event.on(Hn,n.destroy),ke(n,{bus:e,on:r,off:mt(n.unbind,e),emit:o})}function pn(t,e,n,r){var o=Date.now,a,i=0,c,s=!0,d=0;function l(){if(!s){if(i=t?te((o()-a)/t,1):1,n&&n(i),i>=1&&(e(),a=o(),r&&++d>=r))return b();c=ar(l)}}function w(y){y||u(),a=o()-(y?i*t:0),s=!1,c=ar(l)}function b(){s=!0}function g(){a=o(),i=0,n&&n(i)}function u(){c&&cancelAnimationFrame(c),i=0,c=0,s=!0}function m(y){t=y}function S(){return s}return{start:w,rewind:g,pause:b,cancel:u,set:m,isPaused:S}}function mi(t){var e=t;function n(o){e=o}function r(o){return Wn(Ve(o),e)}return{set:n,is:r}}function fi(t,e){var n=pn(0,t,null,1);return function(){n.isPaused()&&n.start()}}function hi(t,e,n){var r=t.state,o=n.breakpoints||{},a=n.reducedMotion||{},i=Br(),c=[];function s(){var u=n.mediaQuery==="min";Fe(o).sort(function(m,S){return u?+m-+S:+S-+m}).forEach(function(m){l(o[m],"("+(u?"min":"max")+"-width:"+m+"px)")}),l(a,ir),w()}function d(u){u&&i.destroy()}function l(u,m){var S=matchMedia(m);i.bind(S,"change",w),c.push([u,S])}function w(){var u=r.is(nn),m=n.direction,S=c.reduce(function(y,v){return Jt(y,v[1].matches?v[0]:{})},{});lr(n),g(S),n.destroy?t.destroy(n.destroy==="completely"):u?(d(!0),t.mount()):m!==n.direction&&t.refresh()}function b(u){matchMedia(ir).matches&&(u?Jt(n,a):lr(n,Fe(a)))}function g(u,m,S){Jt(n,u),m&&Jt(Object.getPrototypeOf(n),u),(S||!r.is(fe))&&t.emit($t,n)}return{setup:s,destroy:d,reduce:b,set:g}}var dn="Arrow",gn=dn+"Left",mn=dn+"Right",Jr=dn+"Up",Zr=dn+"Down",ur="rtl",fn="ttb",Sn={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[Jr,mn],ArrowRight:[Zr,gn]};function yi(t,e,n){function r(a,i,c){c=c||n.direction;var s=c===ur&&!i?1:c===fn?0:-1;return Sn[a]&&Sn[a][s]||a.replace(/width|left|right/i,function(d,l){var w=Sn[d.toLowerCase()][s]||d;return l>0?w.charAt(0).toUpperCase()+w.slice(1):w})}function o(a){return a*(n.direction===ur?1:-1)}return{resolve:r,orient:o}}var Ut="role",ye="tabindex",bi="disabled",Ot="aria-",Me=Ot+"controls",Qr=Ot+"current",pr=Ot+"selected",At=Ot+"label",qn=Ot+"labelledby",to=Ot+"hidden",Yn=Ot+"orientation",Pe=Ot+"roledescription",dr=Ot+"live",gr=Ot+"busy",mr=Ot+"atomic",Kn=[Ut,ye,bi,Me,Qr,At,qn,to,Yn,Pe],zt=je+"__",re="is-",xn=je,fr=zt+"track",vi=zt+"list",hn=zt+"slide",eo=hn+"--clone",Si=hn+"__container",Jn=zt+"arrows",yn=zt+"arrow",no=yn+"--prev",ro=yn+"--next",bn=zt+"pagination",oo=bn+"__page",xi=zt+"progress",Ci=xi+"__bar",$i=zt+"toggle",wi=zt+"spinner",_i=zt+"sr",Ti=re+"initialized",ce=re+"active",io=re+"prev",ao=re+"next",Fn=re+"visible",kn=re+"loading",lo=re+"focus-in",so=re+"overflow",Li=[ce,Fn,io,ao,kn,lo,so],Ei={slide:hn,clone:eo,arrows:Jn,arrow:yn,prev:no,next:ro,pagination:bn,page:oo,spinner:wi};function Ai(t,e){if(Ar(t.closest))return t.closest(e);for(var n=t;n&&n.nodeType===1&&!Ie(n,e);)n=n.parentElement;return n}var Ii=5,hr=200,co="touchstart mousedown",Cn="touchmove mousemove",$n="touchend touchcancel mouseup click";function Fi(t,e,n){var r=bt(t),o=r.on,a=r.bind,i=t.root,c=n.i18n,s={},d=[],l=[],w=[],b,g,u;function m(){C(),M(),v()}function S(){o(vt,y),o(vt,m),o($t,v),a(document,co+" keydown",function(f){u=f.type==="keydown"},{capture:!0}),a(i,"focusin",function(){Ht(i,lo,!!u)})}function y(f){var T=Kn.concat("style");Xt(d),Dt(i,l),Dt(b,w),Vt([b,g],T),Vt(i,f?T:["style",Pe])}function v(){Dt(i,l),Dt(b,w),l=$(xn),w=$(fr),Wt(i,l),Wt(b,w),tt(i,At,n.label),tt(i,qn,n.labelledby)}function C(){b=B("."+fr),g=Ne(b,"."+vi),Le(b&&g,"A track/list element is missing."),Qe(d,Fr(g,"."+hn+":not(."+eo+")")),le({arrows:Jn,pagination:bn,prev:no,next:ro,bar:Ci,toggle:$i},function(f,T){s[T]=B("."+f)}),ke(s,{root:i,track:b,list:g,slides:d})}function M(){var f=i.id||di(je),T=n.role;i.id=f,b.id=b.id||f+"-track",g.id=g.id||f+"-list",!Rt(i,Ut)&&i.tagName!=="SECTION"&&T&&tt(i,Ut,T),tt(i,Pe,c.carousel),tt(g,Ut,"presentation")}function B(f){var T=Or(i,f);return T&&Ai(T,"."+xn)===i?T:void 0}function $(f){return[f+"--"+n.type,f+"--"+n.direction,n.drag&&f+"--draggable",n.isNavigation&&f+"--nav",f===xn&&ce]}return ke(s,{setup:m,mount:S,destroy:y})}var xe="slide",we="loop",He="fade";function ki(t,e,n,r){var o=bt(t),a=o.on,i=o.emit,c=o.bind,s=t.Components,d=t.root,l=t.options,w=l.isNavigation,b=l.updateOnMove,g=l.i18n,u=l.pagination,m=l.slideFocus,S=s.Direction.resolve,y=Rt(r,"style"),v=Rt(r,At),C=n>-1,M=Ne(r,"."+Si),B;function $(){C||(r.id=d.id+"-slide"+jn(e+1),tt(r,Ut,u?"tabpanel":"group"),tt(r,Pe,g.slide),tt(r,At,v||An(g.slideLabel,[e+1,t.length]))),f()}function f(){c(r,"click",mt(i,Mn,F)),c(r,"keydown",mt(i,Yr,F)),a([$e,Kr,ue],L),a(Dn,A),b&&a(qt,z)}function T(){B=!0,o.destroy(),Dt(r,Li),Vt(r,Kn),tt(r,"style",y),tt(r,At,v||"")}function A(){var I=t.splides.map(function(_){var P=_.splide.Components.Slides.getAt(e);return P?P.slide.id:""}).join(" ");tt(r,At,An(g.slideX,(C?n:e)+1)),tt(r,Me,I),tt(r,Ut,m?"button":""),m&&Vt(r,Pe)}function z(){B||L()}function L(){if(!B){var I=t.index;k(),W(),Ht(r,io,e===I-1),Ht(r,ao,e===I+1)}}function k(){var I=H();I!==sr(r,ce)&&(Ht(r,ce,I),tt(r,Qr,w&&I||""),i(I?Wr:Vr,F))}function W(){var I=h(),_=!I&&(!H()||C);if(t.state.is([Ce,Be])||tt(r,to,_||""),tt(zn(r,l.focusableNodes||""),ye,_?-1:""),m&&tt(r,ye,_?-1:0),I!==sr(r,Fn)&&(Ht(r,Fn,I),i(I?zr:Nr,F)),!I&&document.activeElement===r){var P=s.Slides.getAt(t.index);P&&kr(P.slide)}}function D(I,_,P){kt(P&&M||r,I,_)}function H(){var I=t.index;return I===e||l.cloneStatus&&I===n}function h(){if(t.is(He))return H();var I=Et(s.Elements.track),_=Et(r),P=S("left",!0),X=S("right",!0);return on(I[P])<=Oe(_[P])&&on(_[X])<=Oe(I[X])}function O(I,_){var P=Tt(I-e);return!C&&(l.rewind||t.is(we))&&(P=te(P,t.length-P)),P<=_}var F={index:e,slideIndex:n,slide:r,container:M,isClone:C,mount:$,destroy:T,update:L,style:D,isWithin:O};return F}function Ri(t,e,n){var r=bt(t),o=r.on,a=r.emit,i=r.bind,c=e.Elements,s=c.slides,d=c.list,l=[];function w(){b(),o(vt,g),o(vt,b)}function b(){s.forEach(function(L,k){m(L,k,-1)})}function g(){B(function(L){L.destroy()}),Xt(l)}function u(){B(function(L){L.update()})}function m(L,k,W){var D=ki(t,k,W,L);D.mount(),l.push(D),l.sort(function(H,h){return H.index-h.index})}function S(L){return L?$(function(k){return!k.isClone}):l}function y(L){var k=e.Controller,W=k.toIndex(L),D=k.hasFocus()?1:n.perPage;return $(function(H){return tn(H.index,W,W+D-1)})}function v(L){return $(L)[0]}function C(L,k){It(L,function(W){if(Qt(W)&&(W=Rr(W)),Ir(W)){var D=s[k];D?Vn(W,D):ze(d,W),Wt(W,n.classes.slide),T(W,mt(a,Se))}}),a(vt)}function M(L){se($(L).map(function(k){return k.slide})),a(vt)}function B(L,k){S(k).forEach(L)}function $(L){return l.filter(Ar(L)?L:function(k){return Qt(L)?Ie(k.slide,L):Wn(Ve(L),k.index)})}function f(L,k,W){B(function(D){D.style(L,k,W)})}function T(L,k){var W=zn(L,"img"),D=W.length;D?W.forEach(function(H){i(H,"load error",function(){--D||k()})}):k()}function A(L){return L?s.length:l.length}function z(){return l.length>n.perPage}return{mount:w,destroy:g,update:u,register:m,get:S,getIn:y,getAt:v,add:C,remove:M,forEach:B,filter:$,style:f,getLength:A,isEnough:z}}function Oi(t,e,n){var r=bt(t),o=r.on,a=r.bind,i=r.emit,c=e.Slides,s=e.Direction.resolve,d=e.Elements,l=d.root,w=d.track,b=d.list,g=c.getAt,u=c.style,m,S,y;function v(){C(),a(window,"resize load",fi(mt(i,Se))),o([$t,vt],C),o(Se,M)}function C(){m=n.direction===fn,kt(l,"maxWidth",ie(n.width)),kt(w,s("paddingLeft"),B(!1)),kt(w,s("paddingRight"),B(!0)),M(!0)}function M(F){var I=Et(l);(F||S.width!==I.width||S.height!==I.height)&&(kt(w,"height",$()),u(s("marginRight"),ie(n.gap)),u("width",T()),u("height",A(),!0),S=I,i(cn),y!==(y=O())&&(Ht(l,so,y),i(gi,y)))}function B(F){var I=n.padding,_=s(F?"right":"left");return I&&ie(I[_]||(Ae(I)?0:I))||"0px"}function $(){var F="";return m&&(F=f(),Le(F,"height or heightRatio is missing."),F="calc("+F+" - "+B(!1)+" - "+B(!0)+")"),F}function f(){return ie(n.height||Et(b).width*n.heightRatio)}function T(){return n.autoWidth?null:ie(n.fixedWidth)||(m?"":z())}function A(){return ie(n.fixedHeight)||(m?n.autoHeight?null:z():f())}function z(){var F=ie(n.gap);return"calc((100%"+(F&&" + "+F)+")/"+(n.perPage||1)+(F&&" - "+F)+")"}function L(){return Et(b)[s("width")]}function k(F,I){var _=g(F||0);return _?Et(_.slide)[s("width")]+(I?0:H()):0}function W(F,I){var _=g(F);if(_){var P=Et(_.slide)[s("right")],X=Et(b)[s("left")];return Tt(P-X)+(I?0:H())}return 0}function D(F){return W(t.length-1)-W(0)+k(0,F)}function H(){var F=g(0);return F&&parseFloat(kt(F.slide,s("marginRight")))||0}function h(F){return parseFloat(kt(w,s("padding"+(F?"Right":"Left"))))||0}function O(){return t.is(He)||D(!0)>L()}return{mount:v,resize:M,listSize:L,slideSize:k,sliderSize:D,totalSize:W,getPadding:h,isOverflow:O}}var Pi=2;function Bi(t,e,n){var r=bt(t),o=r.on,a=e.Elements,i=e.Slides,c=e.Direction.resolve,s=[],d;function l(){o(vt,w),o([$t,Se],g),(d=S())&&(u(d),e.Layout.resize(!0))}function w(){b(),l()}function b(){se(s),Xt(s),r.destroy()}function g(){var y=S();d!==y&&(d<y||!y)&&r.emit(vt)}function u(y){var v=i.get().slice(),C=v.length;if(C){for(;v.length<y;)Qe(v,v);Qe(v.slice(-y),v.slice(0,y)).forEach(function(M,B){var $=B<y,f=m(M.slide,B);$?Vn(f,v[0].slide):ze(a.list,f),Qe(s,f),i.register(f,B-y+($?0:C),M.index)})}}function m(y,v){var C=y.cloneNode(!0);return Wt(C,n.classes.clone),C.id=t.root.id+"-clone"+jn(v+1),C}function S(){var y=n.clones;if(!t.is(we))y=0;else if(We(y)){var v=n[c("fixedWidth")]&&e.Layout.slideSize(0),C=v&&Oe(Et(a.track)[c("width")]/v);y=C||n[c("autoWidth")]&&t.length||n.perPage*Pi}return y}return{mount:l,destroy:b}}function Wi(t,e,n){var r=bt(t),o=r.on,a=r.emit,i=t.state.set,c=e.Layout,s=c.slideSize,d=c.getPadding,l=c.totalSize,w=c.listSize,b=c.sliderSize,g=e.Direction,u=g.resolve,m=g.orient,S=e.Elements,y=S.list,v=S.track,C;function M(){C=e.Transition,o([ne,cn,$t,vt],B)}function B(){e.Controller.isBusy()||(e.Scroll.cancel(),f(t.index),e.Slides.update())}function $(_,P,X,it){_!==P&&F(_>X)&&(L(),T(z(D(),_>X),!0)),i(Ce),a(qt,P,X,_),C.start(P,function(){i(ve),a($e,P,X,_),it&&it()})}function f(_){T(W(_,!0))}function T(_,P){if(!t.is(He)){var X=P?_:A(_);kt(y,"transform","translate"+u("X")+"("+X+"px)"),_!==X&&a(Kr)}}function A(_){if(t.is(we)){var P=k(_),X=P>e.Controller.getEnd(),it=P<0;(it||X)&&(_=z(_,X))}return _}function z(_,P){var X=_-O(P),it=b();return _-=m(it*(Oe(Tt(X)/it)||1))*(P?1:-1),_}function L(){T(D(),!0),C.cancel()}function k(_){for(var P=e.Slides.get(),X=0,it=1/0,et=0;et<P.length;et++){var st=P[et].index,R=Tt(W(st,!0)-_);if(R<=it)it=R,X=st;else break}return X}function W(_,P){var X=m(l(_-1)-h(_));return P?H(X):X}function D(){var _=u("left");return Et(y)[_]-Et(v)[_]+m(d(!1))}function H(_){return n.trimSpace&&t.is(xe)&&(_=ge(_,0,m(b(!0)-w()))),_}function h(_){var P=n.focus;return P==="center"?(w()-s(_,!0))/2:+P*s(_)||0}function O(_){return W(_?e.Controller.getEnd():0,!!n.trimSpace)}function F(_){var P=m(z(D(),_));return _?P>=0:P<=y[u("scrollWidth")]-Et(v)[u("width")]}function I(_,P){P=We(P)?D():P;var X=_!==!0&&m(P)<m(O(!1)),it=_!==!1&&m(P)>m(O(!0));return X||it}return{mount:M,move:$,jump:f,translate:T,shift:z,cancel:L,toIndex:k,toPosition:W,getPosition:D,getLimit:O,exceededLimit:I,reposition:B}}function Vi(t,e,n){var r=bt(t),o=r.on,a=r.emit,i=e.Move,c=i.getPosition,s=i.getLimit,d=i.toPosition,l=e.Slides,w=l.isEnough,b=l.getLength,g=n.omitEnd,u=t.is(we),m=t.is(xe),S=mt(D,!1),y=mt(D,!0),v=n.start||0,C,M=v,B,$,f;function T(){A(),o([$t,vt,an],A),o(cn,z)}function A(){B=b(!0),$=n.perMove,f=n.perPage,C=F();var R=ge(v,0,g?C:B-1);R!==v&&(v=R,i.reposition())}function z(){C!==F()&&a(an)}function L(R,K,ft){if(!st()){var ct=W(R),dt=O(ct);dt>-1&&(K||dt!==v)&&(X(dt),i.move(ct,dt,M,ft))}}function k(R,K,ft,ct){e.Scroll.scroll(R,K,ft,function(){var dt=O(i.toIndex(c()));X(g?te(dt,C):dt),ct&&ct()})}function W(R){var K=v;if(Qt(R)){var ft=R.match(/([+\-<>])(\d+)?/)||[],ct=ft[1],dt=ft[2];ct==="+"||ct==="-"?K=H(v+ +(""+ct+(+dt||1)),v):ct===">"?K=dt?I(+dt):S(!0):ct==="<"&&(K=y(!0))}else K=u?R:ge(R,0,C);return K}function D(R,K){var ft=$||(et()?1:f),ct=H(v+ft*(R?-1:1),v,!($||et()));return ct===-1&&m&&!Pr(c(),s(!R),1)?R?0:C:K?ct:O(ct)}function H(R,K,ft){if(w()||et()){var ct=h(R);ct!==R&&(K=R,R=ct,ft=!1),R<0||R>C?!$&&(tn(0,R,K,!0)||tn(C,K,R,!0))?R=I(_(R)):u?R=ft?R<0?-(B%f||f):B:R:n.rewind?R=R<0?C:0:R=-1:ft&&R!==K&&(R=I(_(K)+(R<K?-1:1)))}else R=-1;return R}function h(R){if(m&&n.trimSpace==="move"&&R!==v)for(var K=c();K===d(R,!0)&&tn(R,0,t.length-1,!n.rewind);)R<v?--R:++R;return R}function O(R){return u?(R+B)%B||0:R}function F(){for(var R=B-(et()||u&&$?1:f);g&&R-- >0;)if(d(B-1,!0)!==d(R,!0)){R++;break}return ge(R,0,B-1)}function I(R){return ge(et()?R:f*R,0,C)}function _(R){return et()?te(R,C):on((R>=C?B-1:R)/f)}function P(R){var K=i.toIndex(R);return m?ge(K,0,C):K}function X(R){R!==v&&(M=v,v=R)}function it(R){return R?M:v}function et(){return!We(n.focus)||n.isNavigation}function st(){return t.state.is([Ce,Be])&&!!n.waitForTransition}return{mount:T,go:L,scroll:k,getNext:S,getPrev:y,getAdjacent:D,getEnd:F,setIndex:X,getIndex:it,toIndex:I,toPage:_,toDest:P,hasFocus:et,isBusy:st}}var zi="http://www.w3.org/2000/svg",Ni="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",Xe=40;function ji(t,e,n){var r=bt(t),o=r.on,a=r.bind,i=r.emit,c=n.classes,s=n.i18n,d=e.Elements,l=e.Controller,w=d.arrows,b=d.track,g=w,u=d.prev,m=d.next,S,y,v={};function C(){B(),o($t,M)}function M(){$(),C()}function B(){var k=n.arrows;k&&!(u&&m)&&A(),u&&m&&(ke(v,{prev:u,next:m}),Re(g,k?"":"none"),Wt(g,y=Jn+"--"+n.direction),k&&(f(),L(),tt([u,m],Me,b.id),i(Dr,u,m)))}function $(){r.destroy(),Dt(g,y),S?(se(w?[u,m]:g),u=m=null):Vt([u,m],Kn)}function f(){o([ne,$e,vt,ue,an],L),a(m,"click",mt(T,">")),a(u,"click",mt(T,"<"))}function T(k){l.go(k,!0)}function A(){g=w||he("div",c.arrows),u=z(!0),m=z(!1),S=!0,ze(g,[u,m]),!w&&Vn(g,b)}function z(k){var W='<button class="'+c.arrow+" "+(k?c.prev:c.next)+'" type="button"><svg xmlns="'+zi+'" viewBox="0 0 '+Xe+" "+Xe+'" width="'+Xe+'" height="'+Xe+'" focusable="false"><path d="'+(n.arrowPath||Ni)+'" />';return Rr(W)}function L(){if(u&&m){var k=t.index,W=l.getPrev(),D=l.getNext(),H=W>-1&&k<W?s.last:s.prev,h=D>-1&&k>D?s.first:s.next;u.disabled=W<0,m.disabled=D<0,tt(u,At,H),tt(m,At,h),i(Gr,u,m,W,D)}}return{arrows:v,mount:C,destroy:$,update:L}}var Mi=Nn+"-interval";function Hi(t,e,n){var r=bt(t),o=r.on,a=r.bind,i=r.emit,c=pn(n.interval,t.go.bind(t,">"),f),s=c.isPaused,d=e.Elements,l=e.Elements,w=l.root,b=l.toggle,g=n.autoplay,u,m,S=g==="pause";function y(){g&&(v(),b&&tt(b,Me,d.track.id),S||C(),$())}function v(){n.pauseOnHover&&a(w,"mouseenter mouseleave",function(A){u=A.type==="mouseenter",B()}),n.pauseOnFocus&&a(w,"focusin focusout",function(A){m=A.type==="focusin",B()}),b&&a(b,"click",function(){S?C():M(!0)}),o([qt,un,vt],c.rewind),o(qt,T)}function C(){s()&&e.Slides.isEnough()&&(c.start(!n.resetProgress),m=u=S=!1,$(),i(Gn))}function M(A){A===void 0&&(A=!0),S=!!A,$(),s()||(c.pause(),i(Un))}function B(){S||(u||m?M(!1):C())}function $(){b&&(Ht(b,ce,!S),tt(b,At,n.i18n[S?"play":"pause"]))}function f(A){var z=d.bar;z&&kt(z,"width",A*100+"%"),i(qr,A)}function T(A){var z=e.Slides.getAt(A);c.set(z&&+Rt(z.slide,Mi)||n.interval)}return{mount:y,destroy:c.cancel,play:C,pause:M,isPaused:s}}function Di(t,e,n){var r=bt(t),o=r.on;function a(){n.cover&&(o(Xn,mt(c,!0)),o([ne,$t,vt],mt(i,!0)))}function i(s){e.Slides.forEach(function(d){var l=Ne(d.container||d.slide,"img");l&&l.src&&c(s,l,d)})}function c(s,d,l){l.style("background",s?'center/cover no-repeat url("'+d.src+'")':"",!0),Re(d,s?"none":"")}return{mount:a,destroy:mt(i,!1)}}var Gi=10,Ui=600,Xi=.6,qi=1.5,Yi=800;function Ki(t,e,n){var r=bt(t),o=r.on,a=r.emit,i=t.state.set,c=e.Move,s=c.getPosition,d=c.getLimit,l=c.exceededLimit,w=c.translate,b=t.is(xe),g,u,m=1;function S(){o(qt,M),o([$t,vt],B)}function y(f,T,A,z,L){var k=s();if(M(),A&&(!b||!l())){var W=e.Layout.sliderSize(),D=En(f)*W*on(Tt(f)/W)||0;f=c.toPosition(e.Controller.toDest(f%W))+D}var H=Pr(k,f,1);m=1,T=H?0:T||rn(Tt(f-k)/qi,Yi),u=z,g=pn(T,v,mt(C,k,f,L),1),i(Be),a(un),g.start()}function v(){i(ve),u&&u(),a(ue)}function C(f,T,A,z){var L=s(),k=f+(T-f)*$(z),W=(k-L)*m;w(L+W),b&&!A&&l()&&(m*=Xi,Tt(W)<Gi&&y(d(l(!0)),Ui,!1,u,!0))}function M(){g&&g.cancel()}function B(){g&&!g.isPaused()&&(M(),v())}function $(f){var T=n.easingFunc;return T?T(f):1-Math.pow(1-f,4)}return{mount:S,destroy:M,scroll:y,cancel:B}}var me={passive:!1,capture:!0};function Ji(t,e,n){var r=bt(t),o=r.on,a=r.emit,i=r.bind,c=r.unbind,s=t.state,d=e.Move,l=e.Scroll,w=e.Controller,b=e.Elements.track,g=e.Media.reduce,u=e.Direction,m=u.resolve,S=u.orient,y=d.getPosition,v=d.exceededLimit,C,M,B,$,f,T=!1,A,z,L;function k(){i(b,Cn,Tn,me),i(b,$n,Tn,me),i(b,co,D,me),i(b,"click",O,{capture:!0}),i(b,"dragstart",Mt),o([ne,$t],W)}function W(){var j=n.drag;Pt(!j),$=j==="free"}function D(j){if(A=!1,!z){var x=dt(j);ct(j.target)&&(x||!j.button)&&(w.isBusy()?Mt(j,!0):(L=x?b:window,f=s.is([Ce,Be]),B=null,i(L,Cn,H,me),i(L,$n,h,me),d.cancel(),l.cancel(),F(j)))}}function H(j){if(s.is(Ze)||(s.set(Ze),a(jr)),j.cancelable)if(f){d.translate(C+ft(et(j)));var x=st(j)>hr,G=T!==(T=v());(x||G)&&F(j),A=!0,a(Mr),Mt(j)}else P(j)&&(f=_(j),Mt(j))}function h(j){s.is(Ze)&&(s.set(ve),a(Hr)),f&&(I(j),Mt(j)),c(L,Cn,H),c(L,$n,h),f=!1}function O(j){!z&&A&&Mt(j,!0)}function F(j){B=M,M=j,C=y()}function I(j){var x=X(j),G=it(x),q=n.rewind&&n.rewindByDrag;g(!1),$?w.scroll(G,0,n.snap):t.is(He)?w.go(S(En(x))<0?q?"<":"-":q?">":"+"):t.is(xe)&&T&&q?w.go(v(!0)?">":"<"):w.go(w.toDest(G),!0),g(!0)}function _(j){var x=n.dragMinThreshold,G=Ae(x),q=G&&x.mouse||0,J=(G?x.touch:+x)||10;return Tt(et(j))>(dt(j)?J:q)}function P(j){return Tt(et(j))>Tt(et(j,!0))}function X(j){if(t.is(we)||!T){var x=st(j);if(x&&x<hr)return et(j)/x}return 0}function it(j){return y()+En(j)*te(Tt(j)*(n.flickPower||600),$?1/0:e.Layout.listSize()*(n.flickMaxPages||1))}function et(j,x){return K(j,x)-K(R(j),x)}function st(j){return Ln(j)-Ln(R(j))}function R(j){return M===j&&B||M}function K(j,x){return(dt(j)?j.changedTouches[0]:j)["page"+m(x?"Y":"X")]}function ft(j){return j/(T&&t.is(xe)?Ii:1)}function ct(j){var x=n.noDrag;return!Ie(j,"."+oo+", ."+yn)&&(!x||!Ie(j,x))}function dt(j){return typeof TouchEvent<"u"&&j instanceof TouchEvent}function St(){return f}function Pt(j){z=j}return{mount:k,disable:Pt,isDragging:St}}var Zi={Spacebar:" ",Right:mn,Left:gn,Up:Jr,Down:Zr};function Zn(t){return t=Qt(t)?t:t.key,Zi[t]||t}var yr="keydown";function Qi(t,e,n){var r=bt(t),o=r.on,a=r.bind,i=r.unbind,c=t.root,s=e.Direction.resolve,d,l;function w(){b(),o($t,g),o($t,b),o(qt,m)}function b(){var y=n.keyboard;y&&(d=y==="global"?window:c,a(d,yr,S))}function g(){i(d,yr)}function u(y){l=y}function m(){var y=l;l=!0,Er(function(){l=y})}function S(y){if(!l){var v=Zn(y);v===s(gn)?t.go("<"):v===s(mn)&&t.go(">")}}return{mount:w,destroy:g,disable:u}}var Ee=Nn+"-lazy",en=Ee+"-srcset",ta="["+Ee+"], ["+en+"]";function ea(t,e,n){var r=bt(t),o=r.on,a=r.off,i=r.bind,c=r.emit,s=n.lazyLoad==="sequential",d=[$e,ue],l=[];function w(){n.lazyLoad&&(b(),o(vt,b))}function b(){Xt(l),g(),s?y():(a(d),o(d,u),u())}function g(){e.Slides.forEach(function(v){zn(v.slide,ta).forEach(function(C){var M=Rt(C,Ee),B=Rt(C,en);if(M!==C.src||B!==C.srcset){var $=n.classes.spinner,f=C.parentElement,T=Ne(f,"."+$)||he("span",$,f);l.push([C,v,T]),C.src||Re(C,"none")}})})}function u(){l=l.filter(function(v){var C=n.perPage*((n.preloadPages||1)+1)-1;return v[1].isWithin(t.index,C)?m(v):!0}),l.length||a(d)}function m(v){var C=v[0];Wt(v[1].slide,kn),i(C,"load error",mt(S,v)),tt(C,"src",Rt(C,Ee)),tt(C,"srcset",Rt(C,en)),Vt(C,Ee),Vt(C,en)}function S(v,C){var M=v[0],B=v[1];Dt(B.slide,kn),C.type!=="error"&&(se(v[2]),Re(M,""),c(Xn,M,B),c(Se)),s&&y()}function y(){l.length&&m(l.shift())}return{mount:w,destroy:mt(Xt,l),check:u}}function na(t,e,n){var r=bt(t),o=r.on,a=r.emit,i=r.bind,c=e.Slides,s=e.Elements,d=e.Controller,l=d.hasFocus,w=d.getIndex,b=d.go,g=e.Direction.resolve,u=s.pagination,m=[],S,y;function v(){C(),o([$t,vt,an],v);var z=n.pagination;u&&Re(u,z?"":"none"),z&&(o([qt,un,ue],A),M(),A(),a(Ur,{list:S,items:m},T(t.index)))}function C(){S&&(se(u?ee(S.children):S),Dt(S,y),Xt(m),S=null),r.destroy()}function M(){var z=t.length,L=n.classes,k=n.i18n,W=n.perPage,D=l()?d.getEnd()+1:Oe(z/W);S=u||he("ul",L.pagination,s.track.parentElement),Wt(S,y=bn+"--"+f()),tt(S,Ut,"tablist"),tt(S,At,k.select),tt(S,Yn,f()===fn?"vertical":"");for(var H=0;H<D;H++){var h=he("li",null,S),O=he("button",{class:L.page,type:"button"},h),F=c.getIn(H).map(function(_){return _.slide.id}),I=!l()&&W>1?k.pageX:k.slideX;i(O,"click",mt(B,H)),n.paginationKeyboard&&i(O,"keydown",mt($,H)),tt(h,Ut,"presentation"),tt(O,Ut,"tab"),tt(O,Me,F.join(" ")),tt(O,At,An(I,H+1)),tt(O,ye,-1),m.push({li:h,button:O,page:H})}}function B(z){b(">"+z,!0)}function $(z,L){var k=m.length,W=Zn(L),D=f(),H=-1;W===g(mn,!1,D)?H=++z%k:W===g(gn,!1,D)?H=(--z+k)%k:W==="Home"?H=0:W==="End"&&(H=k-1);var h=m[H];h&&(kr(h.button),b(">"+H),Mt(L,!0))}function f(){return n.paginationDirection||n.direction}function T(z){return m[d.toPage(z)]}function A(){var z=T(w(!0)),L=T(w());if(z){var k=z.button;Dt(k,ce),Vt(k,pr),tt(k,ye,-1)}if(L){var W=L.button;Wt(W,ce),tt(W,pr,!0),tt(W,ye,"")}a(Xr,{list:S,items:m},z,L)}return{items:m,mount:v,destroy:C,getAt:T,update:A}}var ra=[" ","Enter"];function oa(t,e,n){var r=n.isNavigation,o=n.slideFocus,a=[];function i(){t.splides.forEach(function(u){u.isParent||(d(t,u.splide),d(u.splide,t))}),r&&l()}function c(){a.forEach(function(u){u.destroy()}),Xt(a)}function s(){c(),i()}function d(u,m){var S=bt(u);S.on(qt,function(y,v,C){m.go(m.is(we)?C:y)}),a.push(S)}function l(){var u=bt(t),m=u.on;m(Mn,b),m(Yr,g),m([ne,$t],w),a.push(u),u.emit(Dn,t.splides)}function w(){tt(e.Elements.list,Yn,n.direction===fn?"vertical":"")}function b(u){t.go(u.index)}function g(u,m){Wn(ra,Zn(m))&&(b(u),Mt(m))}return{setup:mt(e.Media.set,{slideFocus:We(o)?r:o},!0),mount:i,destroy:c,remount:s}}function ia(t,e,n){var r=bt(t),o=r.bind,a=0;function i(){n.wheel&&o(e.Elements.track,"wheel",c,me)}function c(d){if(d.cancelable){var l=d.deltaY,w=l<0,b=Ln(d),g=n.wheelMinThreshold||0,u=n.wheelSleep||0;Tt(l)>g&&b-a>u&&(t.go(w?"<":">"),a=b),s(w)&&Mt(d)}}function s(d){return!n.releaseWheel||t.state.is(Ce)||e.Controller.getAdjacent(d)!==-1}return{mount:i}}var aa=90;function la(t,e,n){var r=bt(t),o=r.on,a=e.Elements.track,i=n.live&&!n.isNavigation,c=he("span",_i),s=pn(aa,mt(l,!1));function d(){i&&(b(!e.Autoplay.isPaused()),tt(a,mr,!0),c.textContent="…",o(Gn,mt(b,!0)),o(Un,mt(b,!1)),o([$e,ue],mt(l,!0)))}function l(g){tt(a,gr,g),g?(ze(a,c),s.start()):(se(c),s.cancel())}function w(){Vt(a,[dr,mr,gr]),se(c)}function b(g){i&&tt(a,dr,g?"off":"polite")}return{mount:d,disable:b,destroy:w}}var sa=Object.freeze({__proto__:null,Media:hi,Direction:yi,Elements:Fi,Slides:Ri,Layout:Oi,Clones:Bi,Move:Wi,Controller:Vi,Arrows:ji,Autoplay:Hi,Cover:Di,Scroll:Ki,Drag:Ji,Keyboard:Qi,LazyLoad:ea,Pagination:na,Sync:oa,Wheel:ia,Live:la}),ca={prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},ua={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:Ei,i18n:ca,reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function pa(t,e,n){var r=e.Slides;function o(){bt(t).on([ne,vt],a)}function a(){r.forEach(function(c){c.style("transform","translateX(-"+100*c.index+"%)")})}function i(c,s){r.style("transition","opacity "+n.speed+"ms "+n.easing),Er(s)}return{mount:o,start:i,cancel:Tn}}function da(t,e,n){var r=e.Move,o=e.Controller,a=e.Scroll,i=e.Elements.list,c=mt(kt,i,"transition"),s;function d(){bt(t).bind(i,"transitionend",function(g){g.target===i&&s&&(w(),s())})}function l(g,u){var m=r.toPosition(g,!0),S=r.getPosition(),y=b(g);Tt(m-S)>=1&&y>=1?n.useScroll?a.scroll(m,y,!1,u):(c("transform "+y+"ms "+n.easing),r.translate(m,!0),s=u):(r.jump(g),u())}function w(){c(""),a.cancel()}function b(g){var u=n.rewindSpeed;if(t.is(xe)&&u){var m=o.getIndex(!0),S=o.getEnd();if(m===0&&g>=S||m>=S&&g===0)return u}return n.speed}return{mount:d,start:l,cancel:w}}var ga=(function(){function t(n,r){this.event=bt(),this.Components={},this.state=mi(fe),this.splides=[],this._o={},this._E={};var o=Qt(n)?Or(document,n):n;Le(o,o+" is invalid."),this.root=o,r=Jt({label:Rt(o,At)||"",labelledby:Rt(o,qn)||""},ua,t.defaults,r||{});try{Jt(r,JSON.parse(Rt(o,Nn)))}catch{Le(!1,"Invalid JSON")}this._o=Object.create(Jt({},r))}var e=t.prototype;return e.mount=function(r,o){var a=this,i=this.state,c=this.Components;Le(i.is([fe,nn]),"Already mounted!"),i.set(fe),this._C=c,this._T=o||this._T||(this.is(He)?pa:da),this._E=r||this._E;var s=ke({},sa,this._E,{Transition:this._T});return le(s,function(d,l){var w=d(a,c,a._o);c[l]=w,w.setup&&w.setup()}),le(c,function(d){d.mount&&d.mount()}),this.emit(ne),Wt(this.root,Ti),i.set(ve),this.emit(In),this},e.sync=function(r){return this.splides.push({splide:r}),r.splides.push({splide:this,isParent:!0}),this.state.is(ve)&&(this._C.Sync.remount(),r.Components.Sync.remount()),this},e.go=function(r){return this._C.Controller.go(r),this},e.on=function(r,o){return this.event.on(r,o),this},e.off=function(r){return this.event.off(r),this},e.emit=function(r){var o;return(o=this.event).emit.apply(o,[r].concat(ee(arguments,1))),this},e.add=function(r,o){return this._C.Slides.add(r,o),this},e.remove=function(r){return this._C.Slides.remove(r),this},e.is=function(r){return this._o.type===r},e.refresh=function(){return this.emit(vt),this},e.destroy=function(r){r===void 0&&(r=!0);var o=this.event,a=this.state;return a.is(fe)?bt(this).on(In,this.destroy.bind(this,r)):(le(this._C,function(i){i.destroy&&i.destroy(r)},!0),o.emit(Hn),o.destroy(),r&&Xt(this.splides),a.set(nn)),this},ci(t,[{key:"options",get:function(){return this._o},set:function(r){this._C.Media.set(r,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),t})(),Qn=ga;Qn.defaults={};Qn.STATES=pi;var br=[[ne,"onMounted"],[In,"onReady"],[qt,"onMove"],[$e,"onMoved"],[Mn,"onClick"],[Wr,"onActive"],[Vr,"onInactive"],[zr,"onVisible"],[Nr,"onHidden"],[vt,"onRefresh"],[$t,"onUpdated"],[Se,"onResize"],[cn,"onResized"],[jr,"onDrag"],[Mr,"onDragging"],[Hr,"onDragged"],[un,"onScroll"],[ue,"onScrolled"],[Hn,"onDestroy"],[Dr,"onArrowsMounted"],[Gr,"onArrowsUpdated"],[Ur,"onPaginationMounted"],[Xr,"onPaginationUpdated"],[Dn,"onNavigationMounted"],[Gn,"onAutoplayPlay"],[qr,"onAutoplayPlaying"],[Un,"onAutoplayPause"],[Xn,"onLazyLoadLoaded"]];function tr(...t){return t.filter(Boolean).join(" ")}function ln(t){return t!==null&&typeof t=="object"}function Rn(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&!t.some((n,r)=>!Rn(n,e[r]));if(ln(t)&&ln(e)){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&!n.some(o=>!Object.prototype.hasOwnProperty.call(e,o)||!Rn(t[o],e[o]))}return t===e}function ma(t,e){return t.length===e.length&&!t.some((n,r)=>n!==e[r])}function fa(t,e){if(t){const n=Object.keys(t);for(let r=0;r<n.length;r++){const o=n[r];if(o!=="__proto__"&&e(t[o],o)===!1)break}}return t}function On(t,e){const n=t;return fa(e,(r,o)=>{Array.isArray(r)?n[o]=r.slice():ln(r)?n[o]=On(ln(n[o])?n[o]:{},r):n[o]=r}),n}var ha=({children:t,className:e,...n})=>V.createElement("div",{className:tr("splide__track",e),...n},V.createElement("ul",{className:"splide__list"},t)),er=class extends V.Component{constructor(){super(...arguments),this.splideRef=V.createRef(),this.slides=[]}componentDidMount(){const{options:t,extensions:e,transition:n}=this.props,{current:r}=this.splideRef;r&&(this.splide=new Qn(r,t),this.bind(this.splide),this.splide.mount(e,n),this.options=On({},t||{}),this.slides=this.getSlides())}componentWillUnmount(){this.splide&&(this.splide.destroy(),this.splide=void 0),this.options=void 0,this.slides.length=0}componentDidUpdate(){if(!this.splide)return;const{options:t}=this.props;t&&!Rn(this.options,t)&&(this.splide.options=t,this.options=On({},t));const e=this.getSlides();ma(this.slides,e)||(this.splide.refresh(),this.slides=e)}sync(t){var e;(e=this.splide)==null||e.sync(t)}go(t){var e;(e=this.splide)==null||e.go(t)}getSlides(){var t;if(this.splide){const e=(t=this.splide.Components.Elements)==null?void 0:t.list.children;return e&&Array.prototype.slice.call(e)||[]}return[]}bind(t){br.forEach(([e,n])=>{const r=this.props[n];typeof r=="function"&&t.on(e,(...o)=>{r(t,...o)})})}omit(t,e){return e.forEach(n=>{Object.prototype.hasOwnProperty.call(t,n)&&delete t[n]}),t}render(){const{className:t,tag:e="div",hasTrack:n=!0,children:r,...o}=this.props;return V.createElement(e,{className:tr("splide",t),ref:this.splideRef,...this.omit(o,["options",...br.map(a=>a[1])])},n?V.createElement(ha,null,r):r)}},nr=({children:t,className:e,...n})=>V.createElement("li",{className:tr("splide__slide",e),...n},t);/*!
|
|
2
2
|
* Splide.js
|
|
3
3
|
* Version : 4.1.3
|
|
4
4
|
* License : MIT
|
|
5
5
|
* Copyright: 2022 Naotoshi Fujita
|
|
6
|
-
*/const ma="RichTextRenderer-module__link___BWeZ2",fa={link:ma},lr=({content:e})=>{const t=n=>n.map((o,r)=>o.type==="link"?S.jsx("a",{className:fa.link,href:o.value,target:o.target,children:t(o.children)},r):S.jsx("span",{style:ha(o),children:o.text},r));return S.jsx(S.Fragment,{children:e.map((n,o)=>{const r=n.children;return S.jsx("div",{children:t(r)},o)})})};function ha(e){return{...e.fontFamily&&{fontFamily:e.fontFamily},...e.fontWeight&&{fontWeight:e.fontWeight},...e.fontStyle&&{fontStyle:e.fontStyle},...e.textDecoration&&{textDecoration:e.textDecoration},...e.textTransform&&{textTransform:e.textTransform},...e.fontVariant&&{fontVariant:e.fontVariant},...e.verticalAlign&&{verticalAlign:e.verticalAlign,lineHeight:"0px"}}}const ya="SvgImage-module__svg___q3xE-",va="SvgImage-module__img___VsTm-",ho={svg:ya,img:va},ba=e=>{const t=e.trim();return t.startsWith("data:image/svg+xml")?!0:(t.split(/[?#]/)[0]??t).endsWith(".svg")},Sa=e=>`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`,gt=({url:e,fill:t="#000000",hoverFill:n="#CCCCCC",className:o="",style:r})=>{const[a,i]=j.useState(()=>typeof window>"u"?!0:CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")'));return j.useEffect(()=>{if(typeof window<"u"&&window.CSS){const l=CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")');i(l)}},[]),!ba(e)||!a?S.jsx("img",{src:e,alt:"",className:de(ho.img,o),style:r}):S.jsx("span",{"data-supports-mask":a,className:de(ho.svg,o),style:{"--svg":Sa(e),"--fill":t,"--hover-fill":n,...r??{}}})},xa={"top-left":G.topLeftAlignment,"top-center":G.topCenterAlignment,"top-right":G.topRightAlignment,"middle-left":G.middleLeftAlignment,"middle-center":G.middleCenterAlignment,"middle-right":G.middleRightAlignment,"bottom-left":G.bottomLeftAlignment,"bottom-center":G.bottomCenterAlignment,"bottom-right":G.bottomRightAlignment};function Ca({settings:e,content:t,styles:n,isEditor:o}){const[r,a]=j.useState(null),{widthSettings:i,fontSettings:l,letterSpacing:s,textAlign:p,wordSpacing:c,fontSizeLineHeight:_,textAppearance:v,color:g}=n.imageCaption,[u,d]=j.useState(void 0),[x,f]=j.useState(null),[h,$]=j.useState(0),[M,O]=j.useState(0),{direction:w,transition:y,controls:L,pagination:B,imageCaption:N,triggers:R}=e,V=j.useRef(y.type),{x:P,y:U}=e.controls.offset,H=m=>{r&&r.go(m)};return j.useEffect(()=>{if(!x)return;const m=new ResizeObserver(k=>{if(!r)return;const[E]=k;d({width:Math.round(E.contentRect.width),height:Math.round(E.contentRect.height)})});return m.observe(x),()=>m.unobserve(x)},[x]),j.useEffect(()=>{!r||V.current===y.type||(O(m=>m+1),V.current=y.type)},[y.type]),S.jsx("div",{className:de(G.wrapper,{[G.editor]:o}),ref:f,children:S.jsxs("div",{className:G.sliderInner,style:{width:u?u.width:"100%",height:u?u.height:"100%",backgroundColor:y.backgroundColor&&y.type==="fade in"?y.backgroundColor:"transparent"},children:[e.imageCaption.isActive&&S.jsx("div",{className:de(G.captionBlock),children:S.jsx("div",{className:G.captionTextWrapper,children:t.map((m,k)=>S.jsx("div",{className:de(G.captionText,xa[N.alignment],{[G.withPointerEvents]:k===h&&o,[G.active]:k===h}),style:{fontFamily:l.fontFamily,fontWeight:l.fontWeight,fontStyle:l.fontStyle,width:i.sizing==="auto"?"max-content":I.scalingValue(i.width,o),letterSpacing:I.scalingValue(s,o),wordSpacing:I.scalingValue(c,o),textAlign:p,fontSize:I.scalingValue(_.fontSize,o),lineHeight:I.scalingValue(_.lineHeight,o),textTransform:v.textTransform??"none",textDecoration:v.textDecoration??"none",fontVariant:v.fontVariant??"normal",color:g,transitionDuration:y.duration?`${Math.round(parseInt(y.duration)/2)}ms`:"500ms"},children:S.jsx("div",{"data-styles":"imageCaption",className:G.captionTextInner,style:{"--link-hover-color":N.linkHoverColor,"--link-color":N.linkColor,position:"relative",top:I.scalingValue(N.offset.y,o),left:I.scalingValue(N.offset.x,o)},children:S.jsx(lr,{content:m.imageCaption})})},k))})}),S.jsx(ir,{onMove:m=>{$(m.index)},ref:a,options:{arrows:!1,speed:y.duration?parseInt(y.duration):500,autoplay:R.autoPlay!==null,...R.autoPlay!==null&&{interval:parseInt(R.autoPlay)*1e3},direction:w==="horiz"||y.type==="fade in"?"ltr":"ttb",pagination:!1,drag:R.triggersList.drag,perPage:1,width:u?u.width:"100%",height:u?u.height:"100%",type:y.type==="fade in"?"fade":"loop",rewind:!0},children:t.map((m,k)=>S.jsx(ar,{children:S.jsx("div",{className:G.sliderItem,children:S.jsx("div",{className:G.imgWrapper,children:S.jsx("img",{className:de(G.sliderImage,{[G.contain]:m.image.objectFit==="contain",[G.cover]:m.image.objectFit==="cover"}),src:m.image.url,alt:m.image.name??""})})})},k))},M),L.isActive&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:de(G.arrow,{[G.arrowVertical]:w==="vert",[G.hoverArrow]:L.show==="on hover"}),style:{color:L.color,"--arrow-hover-color":L.hover},children:S.jsxs("button",{onClick:()=>{H("-1")},className:G.arrowInner,style:{transform:`translate(${I.scalingValue(P,o)}, ${I.scalingValue(U*(w==="horiz"?1:-1),o)}) scale(${e.controls.scale/100}) rotate(${w==="horiz"?"0deg":"90deg"})`},children:[L.arrowsImgUrl&&S.jsx(gt,{url:L.arrowsImgUrl,fill:L.color,hoverFill:L.hover,className:de(G.arrowImg,G.mirror)}),!L.arrowsImgUrl&&S.jsx(yo,{color:L.color,className:de(G.arrowIcon,G.arrowImg,G.mirror)})]})}),S.jsx("div",{className:de(G.arrow,G.nextArrow,{[G.arrowVertical]:w==="vert",[G.hoverArrow]:L.show==="on hover"}),style:{color:L.color,"--arrow-hover-color":L.hover},children:S.jsxs("button",{className:G.arrowInner,onClick:()=>H("+1"),style:{transform:`translate(${I.scalingValue(P*(w==="horiz"?-1:1),o)}, ${I.scalingValue(U,o)}) scale(${e.controls.scale/100}) rotate(${w==="horiz"?"0deg":"90deg"})`},children:[L.arrowsImgUrl&&S.jsx(gt,{url:L.arrowsImgUrl,fill:L.color,hoverFill:L.hover,className:G.arrowImg}),!L.arrowsImgUrl&&S.jsx(yo,{color:L.color,className:de(G.arrowIcon,G.arrowImg)})]})})]}),R.triggersList.click&&S.jsx("div",{className:G.clickOverlay,onClick:()=>{r&&r.go("+1")}}),B.isActive&&S.jsx("div",{className:de(G.pagination,{[G.paginationInsideBottom]:B.position==="inside-1"&&w==="horiz",[G.paginationInsideTop]:B.position==="inside-2"&&w==="horiz",[G.paginationOutsideBottom]:B.position==="outside-1"&&w==="horiz",[G.paginationOutsideTop]:B.position==="outside-2"&&w==="horiz",[G.paginationInsideLeft]:B.position==="inside-1"&&w==="vert",[G.paginationInsideRight]:B.position==="inside-2"&&w==="vert",[G.paginationOutsideLeft]:B.position==="outside-1"&&w==="vert",[G.paginationOutsideRight]:B.position==="outside-2"&&w==="vert",[G.paginationVertical]:w==="vert"}),children:S.jsx("div",{className:G.paginationInner,style:{backgroundColor:B.colors[2],transform:`scale(${B.scale/100}) translate(${I.scalingValue(B.offset.x,o)}, ${I.scalingValue(B.offset.y,o)}) rotate(${w==="horiz"?"0deg":"90deg"})`},children:t.map((m,k)=>S.jsx("button",{onClick:()=>{r&&r.go(k)},className:de(G.paginationItem),children:S.jsx("div",{className:de(G.dot,{[G.activeDot]:k===h}),style:{backgroundColor:k===h?B.colors[0]:B.colors[1],"--pagination-hover-color":B.hover}})},k))})})]})})}function yo({color:e,className:t}){return S.jsx("svg",{viewBox:"0 0 10 18",className:t,children:S.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:S.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:e,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}const $a={element:Ca,id:"control-slider",name:"Slider",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/sliderImg.png"},defaultSize:{width:400,height:400},assetsPaths:{content:[{path:"image.url",placeholderEnabled:!0}],parameters:[{path:"settings.controls.arrowsImgUrl"}]},fontSettingsPaths:{content:[],parameters:[{path:"styles.imageCaption.fontSettings"}]},schema:{type:"object",properties:{settings:{type:"object",display:{type:"settings-block"},properties:{triggers:{title:"triggers",icon:"target",tooltip:"Triggers",type:"object",properties:{triggersList:{type:"object",display:{type:"toggle-ratio-group"},properties:{click:{type:"boolean"},drag:{type:"boolean"}}},autoPlay:{type:["string","null"],label:"Auto",display:{type:"step-selector"},enum:[null,"1s","2s","3s","4s","5s"]}}},direction:{icon:"horizontal-resize",tooltip:"Direction",type:"string",display:{type:"ratio-group"},enum:["horiz","vert"]},transition:{title:"transit",icon:"transition",tooltip:"Transition",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["slide","fade in"]},backgroundColor:{type:["string","null"],title:"BG Color",display:{visible:!1,type:"settings-color-picker",format:"single"}},duration:{type:"string",label:"icon:hourglass",display:{type:"step-selector"},enum:["100ms","250ms","500ms","1000ms","1500ms","2000ms"]}}},controls:{title:"controls",icon:"controls",tooltip:"Controls",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},arrowsImgUrl:{type:["string","null"],display:{type:"settings-image-input"}},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},scale:{type:"number",title:"scale",min:50,max:600,display:{type:"range-control"}},color:{title:"color",type:"string",display:{type:"settings-color-picker",format:"single"}},hover:{title:"hover",type:"string",display:{type:"settings-color-picker",format:"single"}},show:{title:"Show",type:"string",display:{type:"ratio-group"},enum:["always","on hover"]}}},pagination:{title:"nav",icon:"pagination",tooltip:"Navigation",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},position:{display:{type:"socket",direction:"horizontal"},type:"string",enum:["outside-1","outside-2","inside-1","inside-2"]},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},scale:{type:"number",title:"scale",min:10,max:400,display:{type:"range-control"}},colors:{display:{type:"settings-color-picker",format:"multiple"},title:"color",type:"array",items:{type:"string"}},hover:{title:"hover",type:"string",display:{type:"settings-color-picker",format:"single"}}}},imageCaption:{title:"Caption",icon:"text-icon",tooltip:"Caption",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},alignment:{type:"string",display:{type:"align-grid"},enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},linkColor:{title:"Link",type:"string",display:{type:"settings-color-picker",format:"single"}},linkHoverColor:{title:"Link Hov",type:"string",display:{type:"settings-color-picker",format:"single"}}}}},default:{triggers:{triggersList:{click:!1,drag:!0},autoPlay:null},controls:{isActive:!0,arrowsImgUrl:null,offset:{x:0,y:0},scale:100,color:"#000000",hover:"#cccccc",show:"always"},transition:{type:"slide",duration:"500ms",backgroundColor:null},pagination:{isActive:!0,scale:50,position:"outside-1",offset:{x:0,y:0},colors:["#cccccc","#cccccc","#000000"],hover:"#cccccc"},direction:"horiz",imageCaption:{offset:{x:0,y:0},isActive:!0,alignment:"middle-center",linkColor:"#cccccc",linkHoverColor:"#cccccc"}},displayRules:[{if:{name:"direction",value:"vert"},then:{name:"properties.pagination.properties.position.display.direction",value:"vertical"}},{if:{name:"transition.type",value:"fade in"},then:{name:"properties.transition.properties.backgroundColor.display.visible",value:!0}}]},content:{type:"array",settings:{addItemFromFileExplorer:!0},items:{type:"object",properties:{image:{type:"object",label:"Image",display:{type:"media-input"},properties:{url:{type:"string"},name:{type:"string"},objectFit:{type:"string",enum:["cover","contain"]}},required:["url","name"]},imageCaption:{placeholder:"Add Caption...",label:"Description",display:{type:"rich-text"}}},required:["image"]},default:[{image:{objectFit:"cover",url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-1.png",name:"Slider-1.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-2.png",name:"Slider-2.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-3.png",name:"Slider-3.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]}]},styles:{type:"object",properties:{imageCaption:{dataName:"caption",type:"object",properties:{fontSettings:{type:"object",display:{type:"font-settings"},properties:{fontFamily:{type:"string"},fontWeight:{type:"number"},fontStyle:{type:"string"}}},widthSettings:{display:{type:"text-width-control"},type:"object",properties:{width:{type:"number"},sizing:{type:"string",enum:["auto","manual"]}}},fontSizeLineHeight:{type:"object",display:{type:"font-size-line-height"},properties:{fontSize:{type:"number"},lineHeight:{type:"number"}}},letterSpacing:{display:{type:"letter-spacing-input"},type:"number"},wordSpacing:{display:{type:"word-spacing-input"},type:"number"},textAlign:{display:{type:"text-align-control"},type:"string",enum:["left","center","right","justify"]},textAppearance:{display:{type:"text-appearance"},properties:{textTransform:{type:"string",enum:["none","uppercase","lowercase","capitalize"]},textDecoration:{type:"string",enum:["none","underline"]},fontVariant:{type:"string",enum:["normal","small-caps"]}}},color:{display:{type:"style-panel-color-picker"},type:"string"}}}},default:{imageCaption:{widthSettings:{width:.13,sizing:"auto"},fontSettings:{fontFamily:"Arial",fontWeight:400,fontStyle:"normal"},fontSizeLineHeight:{fontSize:.02,lineHeight:.02},letterSpacing:0,wordSpacing:0,textAlign:"left",textAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},color:"#000000"}}}},required:["settings","content","styles"]}},_a="ImageRevealSlider-module__imageRevealSlider___UE5Ob",wa="ImageRevealSlider-module__image___Qjt-e",Ta="ImageRevealSlider-module__link___N-iLG",Ea="ImageRevealSlider-module__cursor___2U03d",lt={imageRevealSlider:_a,image:wa,link:Ta,cursor:Ea};function vo(e,t,n){for(const o of n){const r=new Image;r.src=o.url;const a=o.width?Number.parseFloat(o.width):r.naturalWidth,i=r.naturalHeight/r.naturalWidth*a,l=a/2,s=i/2;if(e>=o.x-l&&e<=o.x+l&&t>=o.y-s&&t<=o.y+s)return!0}return!1}function xn(e){return new Promise(t=>{const n=new Image;n.src=e,n.onload=()=>{t({width:n.naturalWidth,height:n.naturalHeight})}})}async function La(e,t,n,o){let r,a;if(t==="custom"){r=n;const i=await xn(e);a=i.height/i.width*r}else if(t==="random"){r=Math.random()*(o.max-o.min)+o.min;const i=await xn(e);a=i.height/i.width*r}else{const i=await xn(e);r=i.width,a=i.height}return{width:r,height:a,finalWidth:`${r}px`}}function Aa({settings:e,content:t,isEditor:n}){const[o,r]=j.useState(null),[a,i]=j.useState([]),[l,s]=j.useState(0),p=j.useRef(0),[c,_]=j.useState({x:0,y:0}),[v,g]=j.useState(1),[u,d]=j.useState("none"),x=j.useRef({x:0,y:0}),[f,h]=j.useState(!1),{sizeType:$,imageWidth:M,randomRangeImageWidth:O}=e.imageSize,{revealPosition:w,visible:y}=e.position,{cursorType:L,target:B,defaultCursorScale:N,defaultCursor:R,hoverCursorScale:V,hoverCursor:P}=e.cursor;j.useEffect(()=>{if(!o)return;const m=(T,C)=>{const F=o.getBoundingClientRect(),Y=T-F.left,re=C-F.top;if(_({x:Y,y:re}),L==="system"){d("none"),g(1);return}const te=Y,ie=re,A=document.elementFromPoint(F.left+te,F.top+ie);if(A&&A.closest("a")){d("none"),g(1);return}const K=vo(te,ie,a)||B==="area"?{img:P??"none",scale:V}:{img:R??"none",scale:N};d(K.img),g(K.scale)},k=T=>{T.stopPropagation(),x.current={x:T.clientX,y:T.clientY},m(T.clientX,T.clientY)},E=()=>{f&&m(x.current.x,x.current.y)};return o.addEventListener("mousemove",k),window.addEventListener("scroll",E,!0),()=>{o.removeEventListener("mousemove",k),window.removeEventListener("scroll",E,!0)}},[o,f,c,L,B,P,R,V,N,a]),j.useEffect(()=>{f||(d("none"),g(0))},[f]);const U=async(m,k,E,T={})=>{const{width:C,height:F,finalWidth:Y}=await La(m.image.url,$,M,O);let re=0,te=0;w==="same"?(re=k/2,te=E/2):(re=T.x??Math.random()*k,te=T.y??Math.random()*E);const ie=Math.min(Math.max(re,C/2),k-C/2),A=Math.min(Math.max(te,F/2),E-F/2);return{id:p.current++,url:m.image.url,link:m.link,name:m.image.name,x:ie,y:A,width:Y}};j.useEffect(()=>{if(!o||t.length===0)return;const m=o.getBoundingClientRect(),k=m.width,E=m.height,T=[];(async()=>{const F=t[0],Y=await U(F,k,E);T.push(Y),i(T),s(1)})()},[$,M,O,w,o]),j.useEffect(()=>{y==="last One"&&i(m=>m.length>0?[m[m.length-1]]:[])},[y]);const H=async m=>{if(!o)return;const k=o.getBoundingClientRect(),E=m.clientX-k.left,T=m.clientY-k.top;if(B==="image"&&!vo(E,T,a))return;let C=0,F=0;w==="on Click"?(C=E,F=T):w==="same"?(C=k.width/2,F=k.height/2):(C=Math.random()*k.width,F=Math.random()*k.height);const Y=t[l],re=await U(Y,k.width,k.height,{x:C,y:F});i(te=>y==="all"?[...te,re]:[re]),s(te=>te>=t.length-1?0:te+1)};return S.jsxs("div",{ref:r,onClick:H,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:lt.imageRevealSlider,style:{cursor:u==="none"?"default":"none"},children:[a.map(m=>S.jsx("div",{className:lt.wrapper,style:{top:`${m.y}px`,left:`${m.x}px`,position:"absolute",transform:"translate(-50%, -50%)",width:m.width??"auto",height:"auto",cursor:u==="none"?"default":"none"},children:B==="area"&&m.link?S.jsx("a",{href:m.link,target:"_blank",className:lt.link,children:S.jsx("img",{src:m.url,alt:m.name,className:lt.image},m.id)}):S.jsx("img",{src:m.url,alt:m.name,className:lt.image},m.id)},m.id)),f&&S.jsx("div",{className:lt.cursor,style:{left:`${c.x}px`,top:`${c.y}px`,transform:`translate(-50%, -50%) scale(${v})`,backgroundImage:`url('${u}')`,backgroundSize:"cover",backgroundPosition:"center",position:"absolute",pointerEvents:"none"}})]})}const Ia={element:Aa,id:"control-image-reveal",name:"Click Gallery",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/clickGalleryImg.png"},defaultSize:{width:"100%",height:"100%"},assetsPaths:{content:[{path:"image.url",placeholderEnabled:!0}],parameters:[{path:"settings.cursor.defaultCursor"},{path:"settings.cursor.hoverCursor"}]},fontSettingsPaths:{content:[],parameters:[]},schema:{type:"object",properties:{settings:{type:"object",display:{type:"settings-block"},properties:{imageSize:{title:"IMG SIZE",icon:"size",tooltip:"IMG SIZE",type:"object",properties:{sizeType:{type:"string",display:{type:"ratio-group"},enum:["as Is","custom","random"]},imageWidth:{type:"number",label:"W",display:{type:"numeric-input",visible:!1}},randomRangeImageWidth:{type:"object",display:{type:"random-range-controls",visible:!1},properties:{min:{type:"number"},max:{type:"number"}}}}},cursor:{title:"cursor",icon:"cursor",tooltip:"cursor",type:"object",properties:{cursorType:{type:"string",display:{type:"ratio-group"},enum:["system","custom"]},target:{type:"string",title:"Target",display:{type:"ratio-group"},enum:["area","image"]},defaultCursor:{type:["string","null"],title:"Default",display:{type:"settings-image-input",visible:!1}},defaultCursorScale:{type:"number",title:"Scale",min:1,max:5,step:.1,display:{type:"range-control",visible:!1}},hoverCursor:{type:["string","null"],title:"Hover",display:{type:"settings-image-input",visible:!1}},hoverCursorScale:{type:"number",title:"Scale",min:1,max:5,step:.1,display:{type:"range-control",visible:!1}}}},position:{title:"position",icon:"transition",tooltip:"Position",type:"object",properties:{revealPosition:{type:"string",display:{type:"ratio-group"},enum:["random","same","on Click"]},visible:{type:"string",title:"Visible",display:{type:"ratio-group"},enum:["all","last One"]}}}},default:{imageSize:{sizeType:"custom",imageWidth:500,randomRangeImageWidth:{min:100,max:1e3}},cursor:{cursorType:"system",target:"area",defaultCursor:null,defaultCursorScale:2,hoverCursor:null,hoverCursorScale:2},position:{revealPosition:"random",visible:"all"}},displayRules:[{if:{name:"imageSize.sizeType",value:"custom"},then:{name:"properties.imageSize.properties.imageWidth.display.visible",value:!0}},{if:{name:"imageSize.sizeType",value:"random"},then:{name:"properties.imageSize.properties.randomRangeImageWidth.display.visible",value:!0}},{if:[{name:"cursor.target",value:"image"},{name:"cursor.cursorType",value:"custom"}],then:{name:"properties.cursor.properties.defaultCursor.display.visible",value:!0}},{if:[{name:"cursor.target",value:"image"},{name:"cursor.cursorType",value:"custom"},{name:"cursor.defaultCursor",value:null,isNotEqual:!0}],then:{name:"properties.cursor.properties.defaultCursorScale.display.visible",value:!0}},{if:{name:"cursor.cursorType",value:"custom"},then:{name:"properties.cursor.properties.hoverCursor.display.visible",value:!0}},{if:[{name:"cursor.cursorType",value:"custom"},{name:"cursor.hoverCursor",value:null,isNotEqual:!0}],then:{name:"properties.cursor.properties.hoverCursorScale.display.visible",value:!0}}]},content:{type:"array",settings:{addItemFromFileExplorer:!0},items:{type:"object",properties:{image:{type:"object",label:"Image",display:{isObjectFitEditable:!1,type:"media-input"},properties:{url:{type:"string"},name:{type:"string"},objectFit:{type:"string",enum:["cover","contain"]}},required:["url","name"]},link:{label:"URL",placeholder:"Enter link...",display:{type:"text-input"}}},required:["image"]},default:[{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQK9211QXBE9W284ZNKB8.png",name:"Slider-1.png"},link:""},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQMFT72JD18WKP0Q2DVAT.png",name:"Slider-2.png"},link:""},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQNEVRXPSRX5K1YTMJQY9.png",name:"Slider-3.png"},link:""},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQP84JKRDT7WNWDQZR4Y9.png",name:"Slider-4.png"},link:""}]}}}},ka="LightBox-module__hidden___9s-9x",Fa="LightBox-module__heroImage___sTxNF",Ra="LightBox-module__background___rm9ml",Ba="LightBox-module__editor___4ACaY",Va="LightBox-module__contentStyle___Bgnsq",Pa="LightBox-module__imageStyle___tLIlB",Oa="LightBox-module__imgWrapper___LuFUp",Wa="LightBox-module__contain___8-yaS",Na="LightBox-module__cover___hNvOG",za="LightBox-module__caption___b6L2I",ja="LightBox-module__captionTextInner___rCGNH",Ma="LightBox-module__lightboxSplide___XFuWC",Ha="LightBox-module__arrow___iz38X",Da="LightBox-module__arrowVertical___Zfz81",Ua="LightBox-module__nextArrow___zkAQN",Ga="LightBox-module__arrowInner___p48sW",Ya="LightBox-module__arrowIcon___3VaFf",qa="LightBox-module__arrowImg___pNV88",Xa="LightBox-module__mirror___pjeXc",Ka="LightBox-module__thumbsWrapper___GB-nU",Ja="LightBox-module__thumbsContainerVertical___wttk5",Za="LightBox-module__thumbsContainer___osSma",Qa="LightBox-module__thumbsAlignStart___MO6tY",el="LightBox-module__thumbsAlignCenter___Q4sUx",tl="LightBox-module__thumbsAlignEnd___p4y9R",nl="LightBox-module__thumbItem___HvnF3",ol="LightBox-module__closeButton___g2khP",rl="LightBox-module__fadeIn___0m5GW",il="LightBox-module__slideInLeft___gPYwC",al="LightBox-module__slideInRight___S-pPp",ll="LightBox-module__slideInTop___DFdAj",sl="LightBox-module__slideInBottom___m27kZ",cl="LightBox-module__fadeOut___55qBR",ul="LightBox-module__slideOutLeft___NvU7P",pl="LightBox-module__slideOutRight___SK7eC",dl="LightBox-module__slideOutTop___Vgg0z",gl="LightBox-module__slideOutBottom___nJ0Ef",ml="LightBox-module__scaleSlide___vZriG",W={hidden:ka,heroImage:Fa,background:Ra,editor:Ba,contentStyle:Va,imageStyle:Pa,imgWrapper:Oa,contain:Wa,cover:Na,caption:za,captionTextInner:ja,lightboxSplide:Ma,arrow:Ha,arrowVertical:Da,nextArrow:Ua,arrowInner:Ga,arrowIcon:Ya,arrowImg:qa,mirror:Xa,thumbsWrapper:Ka,thumbsContainerVertical:Ja,thumbsContainer:Za,thumbsAlignStart:Qa,thumbsAlignCenter:el,thumbsAlignEnd:tl,thumbItem:nl,closeButton:ol,fadeIn:rl,slideInLeft:il,slideInRight:al,slideInTop:ll,slideInBottom:sl,fadeOut:cl,slideOutLeft:ul,slideOutRight:pl,slideOutTop:dl,slideOutBottom:gl,scaleSlide:ml},Dt=(e,t,n)=>{const o={},[r,a]=e.split("-");return r==="top"?(o.top="0",o.bottom="auto"):r==="middle"?(o.top="50%",o.bottom="auto"):r==="bottom"&&(o.top="auto",o.bottom="0"),a==="left"?(o.left="0",o.right="auto"):a==="center"?(o.left="50%",o.right="auto"):a==="right"&&(o.left="auto",o.right="0"),r==="middle"&&a==="center"?o.transform=`translate(calc(-50% + ${I.scalingValue(t.x,n)}), calc(-50% + ${I.scalingValue(t.y,n)}))`:r==="middle"?o.transform=`translate(${I.scalingValue(t.x,n)}, calc(-50% + ${I.scalingValue(t.y,n)}))`:a==="center"?o.transform=`translate(calc(-50% + ${I.scalingValue(t.x,n)}), ${I.scalingValue(t.y,n)})`:o.transform=`translate(${I.scalingValue(t.x,n)}, ${I.scalingValue(t.y,n)})`,o};function sr(e){const t=window.getComputedStyle(e);return{top:parseFloat(t.paddingTop)||0,right:parseFloat(t.paddingRight)||0,bottom:parseFloat(t.paddingBottom)||0,left:parseFloat(t.paddingLeft)||0}}function bo(e){const t=e.getBoundingClientRect(),n=sr(e),o=Math.max(0,t.width-n.left-n.right),r=Math.max(0,t.height-n.top-n.bottom),a=e.naturalWidth,i=e.naturalHeight,l=o/r,s=a/i;let p,c;s>l?(p=o,c=o/s):(c=r,p=r*s);const _=t.left+n.left,v=t.top+n.top,g=(o-p)/2+_,u=(r-c)/2+v;return{x:g,y:u,width:p,height:c}}function So(e){const t=e.getBoundingClientRect(),n=sr(e);return{left:t.left+n.left,right:t.right-n.right,top:t.top+n.top,bottom:t.bottom-n.bottom}}function xo(e){const t=e.match(/rgba?\(([^)]+)\)/);if(t){const o=t[1].split(",").map(r=>parseFloat(r.trim()));return o.length===4?o[3]:1}const n=e.match(/^#([0-9a-fA-F]{8})$/);if(n){const o=n[1].substring(6,8);return parseInt(o,16)/255}return e.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/),1}function fl(e,t){const n=(()=>{if(e==="fade in")return W.fadeIn;if(e==="slide in"||e==="mix")switch(t){case"left":return W.slideInLeft;case"right":return W.slideInRight;case"top":return W.slideInTop;case"bottom":return W.slideInBottom;default:return W.slideInRight}return W.fadeIn})(),o=(()=>{if(e==="fade in"||e==="mix")return W.fadeIn;if(e==="slide in")switch(t){case"left":return W.slideInLeft;case"right":return W.slideInRight;case"top":return W.slideInTop;case"bottom":return W.slideInBottom;default:return W.slideInRight}return W.fadeIn})(),r=(()=>{if(e==="fade in"||e==="mix")return W.fadeOut;if(e==="slide in")switch(t){case"left":return W.slideOutLeft;case"right":return W.slideOutRight;case"top":return W.slideOutTop;case"bottom":return W.slideOutBottom;default:return W.slideOutRight}return W.fadeOut})(),a=(()=>{if(e==="fade in")return W.fadeOut;if(e==="slide in"||e==="mix")switch(t){case"left":return W.slideOutLeft;case"right":return W.slideOutRight;case"top":return W.slideOutTop;case"bottom":return W.slideOutBottom;default:return W.slideOutRight}return W.fadeOut})();return{appearClass:n,backdropAppearClass:o,backdropDisappearClass:r,disappearClass:a}}const hl=({settings:e,content:t,styles:n,portalId:o,activeEvent:r,isEditor:a})=>{const[i,l]=j.useState(!1),{url:s}=e.thumbnailBlock.cover;return j.useEffect(()=>{r==="close"&&l(!1),r==="open"&&l(!0)},[r]),S.jsxs(S.Fragment,{children:[S.jsx("img",{src:s,alt:"Cover",className:W.heroImage,onClick:()=>l(!0)}),S.jsx(yl,{isOpen:i,onClose:()=>l(!1),content:t,settings:e,lightboxStyles:n,portalId:o,isEditor:a})]})},yl=({isOpen:e,onClose:t,content:n,lightboxStyles:o,settings:r,portalId:a,isEditor:i,metadata:l})=>{var z;const[s,p]=j.useState(0),[c,_]=j.useState(0),[v,g]=j.useState(!1),[u,d]=j.useState(!1),[x,f]=j.useState({}),h=j.useRef(null),$=j.useRef(null),M=j.useRef(null),O=j.useRef(!1),w=j.useRef(null),y=j.useRef(null),L=j.useRef(null),B=j.useRef(null),N=j.useRef(!1),R=j.useRef(null),[V,P]=j.useState(!1),{appear:U,triggers:H,slider:m,thumbnail:k,controls:E,area:T,caption:C,layout:F}=r.lightboxBlock,{appearClass:Y,backdropAppearClass:re,backdropDisappearClass:te,disappearClass:ie}=fl(U.type,U.direction),A=(l==null?void 0:l.itemId)??null;j.useEffect(()=>{const b=()=>{setTimeout(()=>{var q,J;(J=(q=h.current)==null?void 0:q.splide)==null||J.refresh()},16)},D=()=>{_(q=>q+1)};return window.addEventListener("ArticleEditor.Layout:change",b),window.addEventListener("ArticleEditor.ComponentContent:change",D),()=>{window.removeEventListener("ArticleEditor.Layout:change",b),window.removeEventListener("ArticleEditor.ComponentContent:change",D)}},[]),j.useEffect(()=>{if(!e||!k.isActive){P(!1);return}const b=R.current;if(!b)return;const D=()=>{m.direction==="horiz"?P(b.scrollWidth>b.clientWidth):P(b.scrollHeight>b.clientHeight)};D();const q=new ResizeObserver(D);return q.observe(b),()=>q.disconnect()},[e,k.isActive,n.length,x,m.direction]);const K=j.useCallback(()=>{const b=window.matchMedia("(max-width: 768px)").matches,D=xo(T.color);b&&!i&&D>.9&&(document.body.style.backgroundColor=""),g(!0),O.current=!0;const q=J=>{J.target===w.current&&J.animationName&&(w.current&&y.current&&w.current.removeEventListener("animationend",y.current),y.current=null,O.current&&(O.current=!1,t()),g(!1))};w.current&&(y.current=q,w.current.addEventListener("animationend",q))},[t,T.color,i]),me=(b,D,q)=>{var J,ne;if(b){if(H.type==="click"&&H.switch==="image")H.repeat==="close"&&s===n.length-1?K():(J=h.current)==null||J.go("+1");else if(H.type==="click"&&H.switch==="50/50"){const Q=b.getBoundingClientRect(),X=D-Q.left,oe=q-Q.top,ye=Q.width,ae=Q.height;let pe;m.direction==="horiz"?pe=X<ye/2?"-1":"+1":pe=oe<ae/2?"-1":"+1",(ne=h.current)==null||ne.go(pe)}}},se=b=>{if(N.current){N.current=!1;return}const D=n[s],q=(D==null?void 0:D.image.objectFit)==="cover";let J,ne;if("changedTouches"in b&&b.changedTouches.length>0)J=b.changedTouches[0].clientX,ne=b.changedTouches[0].clientY;else if("clientX"in b)J=b.clientX,ne=b.clientY;else return;let Q;if(q&&M.current){const X=So(M.current);Q=J>=X.left&&J<=X.right&&ne>=X.top&&ne<=X.bottom}else{const X=M.current?bo(M.current):null;if(!X){b.target===b.currentTarget&&K();return}Q=J>=X.x&&J<=X.x+X.width&&ne>=X.y&&ne<=X.y+X.height}Q?me(M.current,J,ne):K()},fe=b=>{const D=b.target;(D.classList.contains(W.thumbsWrapper)||D.classList.contains(W.thumbsContainer))&&se(b)};j.useEffect(()=>{if(!e)return;const b=D=>{var q,J;if(D.key==="Escape"){K();return}if(D.key==="ArrowRight"){p(ne=>(ne+1)%Math.max(n.length,1)),(q=h.current)==null||q.go("+1");return}D.key==="ArrowLeft"&&(p(ne=>(ne-1+Math.max(n.length,1))%Math.max(n.length,1)),(J=h.current)==null||J.go("-1"))};return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b)}},[e,K,n.length]),j.useEffect(()=>{if(e){if(p(0),_(D=>D+1),O.current=!1,g(!1),d(!1),f({}),!A)return;const b=new CustomEvent("page-overlay",{detail:{itemId:A}});window.dispatchEvent(b)}return()=>{w.current&&y.current&&(w.current.removeEventListener("animationend",y.current),y.current=null),d(!1)}},[e,A]),j.useEffect(()=>{$.current!==null&&$.current!==m.type&&_(b=>b+1),$.current=m.type},[m.type]),j.useEffect(()=>{if(!e)return;const b=document.body.style.overflow,D=window.matchMedia("(max-width: 768px)").matches,q=xo(T.color);document.body.style.overflow="hidden",d(!1);const J=Q=>{Q.target===w.current&&!O.current&&Q.animationName&&(D&&!i&&q>.9&&(document.body.style.backgroundColor=T.color),d(!0),w.current&&L.current&&w.current.removeEventListener("animationend",L.current),L.current=null)};w.current&&(L.current=J,w.current.addEventListener("animationend",J));const ne=Q=>{const X=Q.target;X&&(X.closest(`.${W.thumbsWrapper}`)||X.closest(`.${W.thumbsContainer}`))||m.type!=="slide"&&Q.preventDefault()};return document.addEventListener("touchmove",ne,{passive:!1}),()=>{document.body.style.overflow=b,document.removeEventListener("touchmove",ne),w.current&&L.current&&(w.current.removeEventListener("animationend",L.current),L.current=null),d(!1)}},[e,i,T.color,m.type]),j.useEffect(()=>{if(!e)return;const b=D=>{var J,ne;if(O.current){D.stopPropagation();return}if(N.current){N.current=!1;return}const q=D.target;if(!(q&&(q.closest(`.${W.thumbsContainer}`)||q.closest(`.${W.thumbItem}`)))){if(m.type==="slide"&&H.type==="drag"&&((ne=(J=h.current)==null?void 0:J.splide)!=null&&ne.root)){const Q=h.current.splide.root;if(q&&(Q.contains(q)||Q===q))return}if(D.touches.length===0&&D.changedTouches.length>0){const Q=n[s],X=(Q==null?void 0:Q.image.objectFit)==="cover",oe=D.changedTouches[0];let ye;if(X&&M.current){const ae=So(M.current);ye=oe.clientX>=ae.left&&oe.clientX<=ae.right&&oe.clientY>=ae.top&&oe.clientY<=ae.bottom}else{const ae=M.current?bo(M.current):null;if(!ae)return;ye=oe.clientX>=ae.x&&oe.clientX<=ae.x+ae.width&&oe.clientY>=ae.y&&oe.clientY<=ae.y+ae.height}if(!ye){D.stopPropagation(),O.current=!0;const ae=pe=>{pe.stopPropagation(),pe.preventDefault(),document.removeEventListener("click",ae,!0)};document.addEventListener("click",ae,!0),K()}}}};return document.addEventListener("touchend",b,{passive:!0}),()=>{document.removeEventListener("touchend",b)}},[e,K,s,n]);const Se=(m.type==="scale"||m.type==="fade")&&m.direction==="vert"&&H.type==="drag";j.useEffect(()=>{var pe,Ve;if(!e||!Se||!((Ve=(pe=h.current)==null?void 0:pe.splide)!=null&&Ve.root))return;const b=h.current.splide.root,D=30,q=(ee,ce)=>{if(B.current){const $e=Math.abs(ee-B.current.x),Ge=Math.abs(ce-B.current.y);($e>0||Ge>0)&&(N.current=!0)}},J=ee=>{B.current&&(ee.preventDefault(),q(ee.clientX,ee.clientY))},ne=ee=>{B.current&&ee.touches.length>0&&(ee.preventDefault(),q(ee.touches[0].clientX,ee.touches[0].clientY))},Q=(ee,ce)=>{if(!B.current||!h.current){B.current=null;return}const $e=Math.abs(ee-B.current.x),Ge=Math.abs(ce-B.current.y);Ge>D&&Ge>$e&&h.current.go(ce<B.current.y?"+1":"-1"),B.current=null},X=ee=>{B.current&&Q(ee.clientX,ee.clientY),document.removeEventListener("pointerup",X),document.removeEventListener("pointercancel",X),document.removeEventListener("pointermove",J)},oe=ee=>{if(B.current){if(ee.changedTouches.length>0){const ce=ee.changedTouches[0];Q(ce.clientX,ce.clientY)}document.removeEventListener("touchend",oe),document.removeEventListener("touchcancel",oe),document.removeEventListener("touchmove",ne)}},ye=ee=>{B.current={x:ee.clientX,y:ee.clientY},N.current=!1,document.addEventListener("pointermove",J,{passive:!1}),document.addEventListener("pointerup",X),document.addEventListener("pointercancel",X)},ae=ee=>{ee.touches.length>0&&(B.current={x:ee.touches[0].clientX,y:ee.touches[0].clientY},N.current=!1,document.addEventListener("touchmove",ne,{passive:!1}),document.addEventListener("touchend",oe),document.addEventListener("touchcancel",oe))};return b.addEventListener("pointerdown",ye),b.addEventListener("touchstart",ae),()=>{b.removeEventListener("pointerdown",ye),b.removeEventListener("touchstart",ae),document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",X),document.removeEventListener("pointercancel",X),document.removeEventListener("touchmove",ne),document.removeEventListener("touchend",oe),document.removeEventListener("touchcancel",oe),B.current=null,N.current=!1}},[e,Se,c]);const Ue={backgroundColor:T.color,backdropFilter:`blur(${T.blur}px)`,animationDuration:`${parseInt(U.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"};return typeof document>"u"||!document.getElementById(a)?null:mr.createPortal(S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:i?null:w,className:de(W.background,v?te:re,{[W.editor]:i},{[W.hidden]:!e}),style:{...Ue,...u&&!i&&!v?{position:"absolute"}:{}}}),S.jsxs("div",{ref:i?w:null,className:de(W.contentStyle,v?ie:Y,{[W.editor]:i},{[W.hidden]:!e}),style:{animationDuration:`${parseInt(U.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"},children:[S.jsx(ir,{onMove:b=>p(b.index),ref:h,className:W.lightboxSplide,options:{arrows:!1,speed:m.duration?parseInt(m.duration):500,direction:m.direction==="horiz"||m.type==="fade"||m.type==="scale"?"ltr":"ttb",pagination:!1,drag:H.type==="drag"&&!Se,perPage:1,width:"100%",height:"100%",type:m.type==="fade"||m.type==="scale"?"fade":"loop",padding:0,rewind:H.repeat!=="close",start:0},style:{"--splide-speed":m.duration},children:n.map((b,D)=>{const q=Dt(F.position,F.offset,i),J=`${I.scalingValue(F.padding.top,i)} ${I.scalingValue(F.padding.right,i)} ${I.scalingValue(F.padding.bottom,i)} ${I.scalingValue(F.padding.left,i)}`,ne=m.type==="scale"?(()=>{const{transform:Q,...X}=q;return{...X,position:"absolute",padding:J,boxSizing:"border-box","--position-transform":Q||"none"}})():{...q,position:"absolute",padding:J,boxSizing:"border-box"};return S.jsx(ar,{children:S.jsx("div",{className:W.imgWrapper,onClick:se,children:S.jsx("img",{ref:D===s?M:null,className:de(W.imageStyle,{[W.contain]:b.image.objectFit==="contain",[W.cover]:b.image.objectFit==="cover",[W.scaleSlide]:m.type==="scale"}),src:b.image.url,alt:b.image.name??"",style:{...ne,pointerEvents:b.image.objectFit==="contain"?"none":"auto"}})})},D)})},c),E.isActive&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:de(W.arrow,{[W.arrowVertical]:m.direction==="vert"}),style:{color:E.color,"--arrow-hover-color":E.hover},children:S.jsxs("button",{className:W.arrowInner,style:{transform:`translate(${I.scalingValue(E.offset.x,i)}, ${I.scalingValue(E.offset.y*(m.direction==="horiz"?1:-1),i)}) scale(${E.scale}) rotate(${m.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var b;return(b=h.current)==null?void 0:b.go("-1")},"aria-label":"Previous",children:[E.arrowsImgUrl&&S.jsx(gt,{url:E.arrowsImgUrl,fill:E.color,hoverFill:E.hover,className:de(W.arrowImg,W.mirror)}),!E.arrowsImgUrl&&S.jsx(Co,{color:E.color,className:de(W.arrowIcon,W.arrowImg,W.mirror)})]})}),S.jsx("div",{className:de(W.arrow,W.nextArrow,{[W.arrowVertical]:m.direction==="vert"}),style:{color:E.color,"--arrow-hover-color":E.hover},children:S.jsxs("button",{className:W.arrowInner,style:{transform:`translate(${I.scalingValue(E.offset.x*(m.direction==="horiz"?-1:1),i)}, ${I.scalingValue(E.offset.y,i)}) scale(${E.scale}) rotate(${m.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var b;return(b=h.current)==null?void 0:b.go("+1")},"aria-label":"Next",children:[E.arrowsImgUrl&&S.jsx(gt,{url:E.arrowsImgUrl,fill:E.color,hoverFill:E.hover,className:W.arrowImg}),!E.arrowsImgUrl&&S.jsx(Co,{color:E.color,className:de(W.arrowIcon,W.arrowImg)})]})})]}),T.closeIconUrl&&(()=>{const b=Dt(T.closeIconAlign,T.closeIconOffset,i),D=`scale(${T.closeIconScale})`,q=b.transform?`${b.transform} ${D}`:D;return S.jsx("button",{className:W.closeButton,style:{...b,transform:q},onClick:K,"aria-label":"Close lightbox",children:S.jsx(gt,{url:T.closeIconUrl,fill:T.closeIconColor??"#000000",hoverFill:T.closeIconHover??"#cccccc"})})})(),C&&C.isActive&&o.imageCaption&&((z=n[s])==null?void 0:z.imageCaption)&&(()=>{const{widthSettings:b,fontSettings:D,letterSpacing:q,textAlign:J,wordSpacing:ne,fontSizeLineHeight:Q,textAppearance:X,color:oe}=o.imageCaption;return S.jsx("div",{className:W.caption,style:{...Dt(C.alignment,C.offset,i),fontFamily:D.fontFamily,fontWeight:D.fontWeight,fontStyle:D.fontStyle,width:b.sizing==="auto"?"max-content":I.scalingValue(b.width,i),letterSpacing:I.scalingValue(q,i),wordSpacing:I.scalingValue(ne,i),textAlign:J,fontSize:I.scalingValue(Q.fontSize,i),lineHeight:I.scalingValue(Q.lineHeight,i),textTransform:X.textTransform??"none",textDecoration:X.textDecoration??"none",fontVariant:X.fontVariant??"normal",color:oe},onClick:ye=>ye.stopPropagation(),children:S.jsx("div",{"data-styles":"imageCaption",className:W.captionTextInner,style:{"--link-color":C.linkColor,"--link-hover-color":C.linkHoverColor},children:S.jsx(lr,{content:n[s].imageCaption})})})})(),k.isActive&&(()=>{const[b,D]=k.position.split("-"),q=m.direction==="horiz"?`${b}-left`:k.position,J=Dt(q,k.offset,i),ne=()=>{if(m.direction==="horiz"){if(D==="left")return"flex-start";if(D==="center")return"center";if(D==="right")return"flex-end"}else{if(b==="top")return"flex-start";if(b==="middle")return"center";if(b==="bottom")return"flex-end"}return"flex-start"};return S.jsx("div",{ref:R,className:W.thumbsWrapper,onClick:Q=>fe(Q),style:{position:i?"absolute":"fixed",...J,...m.direction==="horiz"?{maxWidth:"100vw",width:"100%",overflowX:"auto",overflowY:"hidden"}:{maxHeight:"100vh",overflowY:"auto",overflowX:"hidden"}},children:S.jsx("div",{className:de(W.thumbsContainer,{[W.thumbsContainerVertical]:m.direction==="vert",[W.thumbsAlignStart]:k.align==="start",[W.thumbsAlignCenter]:k.align==="center",[W.thumbsAlignEnd]:k.align==="end"}),style:{gap:I.scalingValue(k.grid.gap,i),justifyContent:V?"flex-start":ne()},children:n.map((Q,X)=>{const oe=X===s,ye=x[X],pe=k.grid.size*(oe?k.activeState.scale:1),Ve=()=>{if(k.fit!=="fit")return{};if(!ye)return m.direction==="horiz"?{height:I.scalingValue(pe,i)}:{width:I.scalingValue(pe,i)};const ee=ye.width/ye.height;if(m.direction==="horiz"){const ce=pe,$e=ce*ee;return{width:I.scalingValue($e,i),height:I.scalingValue(ce,i)}}else{const ce=pe,$e=ce/ee;return{width:I.scalingValue(ce,i),height:I.scalingValue($e,i)}}};return S.jsx("button",{className:W.thumbItem,style:{...m.direction==="horiz"&&k.fit!=="fit"?{height:I.scalingValue(pe,i)}:{},...m.direction==="vert"&&k.fit!=="fit"?{width:I.scalingValue(pe,i)}:{},...k.fit==="cover"?{width:I.scalingValue(pe,i),height:I.scalingValue(pe,i)}:{},...Ve(),transition:oe?"all 0.25s ease-out":"none",opacity:oe?k.activeState.opacity/100:k.opacity/100,"--thumb-hover":k.activeState.opacity/100},onClick:ee=>{var ce;ee.stopPropagation(),p(X),(ce=h.current)==null||ce.go(X)},onMouseEnter:()=>{var ee;k.triggers==="hov"&&((ee=h.current)==null||ee.go(X))},children:S.jsx("img",{src:Q.image.url,alt:Q.image.name??"",onLoad:ee=>{const ce=ee.currentTarget;ce.naturalWidth&&ce.naturalHeight&&f($e=>({...$e,[X]:{width:ce.naturalWidth,height:ce.naturalHeight}}))},style:{objectFit:k.fit==="cover"?"cover":"contain",...k.fit==="fit"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{},...k.fit==="cover"?{width:"100%",height:"100%"}:{}}})},`${Q.image.name}-${X}`)})})})})()]})]}),document.getElementById(a))};function Co({color:e,className:t}){return S.jsx("svg",{viewBox:"0 0 10 18",className:t,children:S.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:S.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:e,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}const vl={element:hl,id:"lightbox",name:"Lightbox",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/lightboxImg.png"},defaultSize:{width:440,height:550},fontSettingsPaths:{content:[],parameters:[{path:"styles.imageCaption.fontSettings"}]},assetsPaths:{content:[{path:"image.url",placeholderEnabled:!0}],parameters:[{path:"settings.thumbnailBlock.cover.url",placeholderEnabled:!0},{path:"settings.controls.arrowsImgUrl"},{path:"settings.area.closeIconUrl"}]},schema:{type:"object",properties:{settings:{type:"object",properties:{thumbnailBlock:{display:{type:"settings-block",triggerEvent:"close"},type:"object",properties:{cover:{title:"COVER",icon:"cover",tooltip:"Cover Image",type:"object",properties:{url:{type:"string",display:{type:"cover-image-input"}}}}}},lightboxBlock:{display:{type:"settings-block",triggerEvent:"open"},type:"object",properties:{appear:{title:"APPEAR",icon:"transition",tooltip:"Appearance",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["slide in","fade in","mix"]},duration:{type:"string",label:"T",display:{type:"step-selector"},enum:["100ms","250ms","500ms","1000ms","1500ms","2000ms"]},direction:{type:"string",title:"From",display:{type:"direction-control"},enum:["top","left","right","bottom"]}}},triggers:{title:"TRIGGERS",icon:"target",tooltip:"Triggers",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["click","drag"]},switch:{type:"string",display:{type:"ratio-group"},enum:["image","50/50"]},repeat:{type:"string",title:"Repeat",display:{visible:!1,type:"ratio-group"},enum:["close","loop"]}}},slider:{title:"SLIDER",icon:"horizontal-resize",tooltip:"Slider",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["slide","fade","scale"]},direction:{type:"string",display:{type:"ratio-group"},enum:["horiz","vert"]},duration:{type:"string",label:"T",display:{type:"step-selector"},enum:["100ms","250ms","500ms","1000ms","1500ms","2000ms"]}}},thumbnail:{title:"THUMB",icon:"thumbnail",tooltip:"Thumbnail",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},position:{display:{type:"align-grid"},type:"string",enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},fit:{type:"string",display:{type:"ratio-group"},enum:["cover","fit"]},align:{type:"string",title:"Align",display:{type:"align-group",direction:"horizontal"},enum:["start","center","end"]},triggers:{type:"string",title:"Triggers",display:{type:"ratio-group",direction:"horizontal"},enum:["clk","hov"]},grid:{type:"object",title:"Grid",display:{type:"group"},properties:{size:{type:"number",label:"Box",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},gap:{type:"number",label:"Gap",scalingEnabled:!0,min:0,display:{type:"numeric-input"}}}},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},opacity:{type:"number",title:"Opacity",label:"icon:opacity",min:0,max:100,step:1,display:{type:"numeric-input"}},activeState:{type:"object",title:"ACTIVE",display:{type:"group"},properties:{scale:{type:"number",title:"Scale",min:1,max:5,step:.1,display:{type:"range-control"}},opacity:{type:"number",title:"Opacity",label:"icon:opacity",min:0,max:100,step:1,display:{type:"numeric-input"}}}}}},layout:{title:"LAYOUT",icon:"layout",tooltip:"Layout",type:"object",properties:{position:{display:{type:"align-grid"},type:"string",enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},padding:{type:"object",title:"Padding",display:{type:"padding-controls"},properties:{top:{min:0,step:1,type:"number"},left:{min:0,step:1,type:"number"},right:{min:0,step:1,type:"number"},bottom:{min:0,step:1,type:"number"}}}}},controls:{title:"CONTROLS",icon:"controls",tooltip:"Controls",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},arrowsImgUrl:{type:["string","null"],display:{type:"settings-image-input"}},offset:{title:"Offset",type:"object",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},scale:{type:"number",title:"Scale",min:.5,max:5,step:.1,display:{type:"range-control"}},color:{title:"Color",type:"string",display:{type:"settings-color-picker",format:"single"}},hover:{title:"Hover",type:"string",display:{type:"settings-color-picker",format:"single"}}}},area:{title:"AREA",icon:"area",tooltip:"Area",type:"object",properties:{color:{type:"string",display:{type:"settings-color-picker",format:"single"}},blur:{type:"number",label:"icon:blur",display:{type:"numeric-input"}},closeIconUrl:{type:["string","null"],title:"Close Icon",display:{type:"settings-image-input"}},closeIconAlign:{display:{type:"align-grid",direction:"horizontal"},type:"string",enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},closeIconScale:{type:"number",title:"Scale",min:.5,max:5,step:.1,display:{type:"range-control"}},closeIconOffset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},closeIconColor:{title:"Color",type:"string",display:{type:"settings-color-picker",format:"single"}},closeIconHover:{title:"Hover",type:"string",display:{type:"settings-color-picker",format:"single"}}}},caption:{title:"DESC",icon:"text-icon",tooltip:"Description",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},alignment:{type:"string",display:{type:"align-grid"},enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},offset:{title:"Offset",type:"object",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},linkColor:{title:"Link",type:"string",display:{type:"settings-color-picker",format:"single"}},linkHoverColor:{title:"Link Hov",type:"string",display:{type:"settings-color-picker",format:"single"}}}}}}},default:{d:{thumbnailBlock:{cover:{url:"https://cdn.cntrl.site/component-assets/Cover.jpg"}},lightboxBlock:{appear:{type:"slide in",duration:"1000ms",direction:"bottom"},triggers:{type:"click",switch:"image",repeat:"loop"},slider:{type:"slide",direction:"vert",duration:"1000ms"},thumbnail:{isActive:!0,position:"middle-left",fit:"fit",align:"start",triggers:"hov",grid:{size:.05,gap:.01},offset:{x:.01,y:0},opacity:50,activeState:{scale:1,opacity:100}},layout:{position:"middle-center",offset:{x:0,y:0},padding:{top:.06,right:0,bottom:.06,left:0}},controls:{isActive:!1,arrowsImgUrl:null,offset:{x:0,y:0},scale:1,color:"#000000",hover:"#cccccc"},area:{color:"rgba(28,31,34,0.9)",blur:0,closeIconUrl:null,closeIconColor:"#000000",closeIconHover:"#cccccc",closeIconAlign:"top-right",closeIconOffset:{x:0,y:0},closeIconScale:1},caption:{isActive:!0,alignment:"middle-center",offset:{x:0,y:0},linkColor:"#cccccc",linkHoverColor:"#cccccc"}}},m:{thumbnailBlock:{cover:{url:"https://cdn.cntrl.site/component-assets/Cover.jpg"}},lightboxBlock:{appear:{type:"fade in",duration:"500ms",direction:"bottom"},triggers:{type:"click",switch:"image",repeat:"loop"},slider:{type:"slide",direction:"horiz",duration:"1000ms"},thumbnail:{isActive:!0,position:"bottom-center",fit:"fit",align:"start",triggers:"hov",grid:{size:.1,gap:.05},offset:{x:.01,y:-.05},opacity:50,activeState:{scale:1,opacity:100}},layout:{position:"middle-center",offset:{x:0,y:0},padding:{top:.06,right:.05,bottom:.06,left:.05}},controls:{isActive:!1,arrowsImgUrl:null,offset:{x:0,y:0},scale:1,color:"#000000",hover:"#cccccc"},area:{color:"rgba(28,31,34,0.9)",blur:0,closeIconUrl:null,closeIconColor:"#000000",closeIconHover:"#cccccc",closeIconAlign:"top-right",closeIconOffset:{x:0,y:0},closeIconScale:1},caption:{isActive:!0,alignment:"middle-center",offset:{x:0,y:0},hover:"#cccccc"}}},t:{thumbnailBlock:{cover:{url:"https://cdn.cntrl.site/component-assets/Cover.jpg"}},lightboxBlock:{appear:{type:"fade in",duration:"500ms",direction:"bottom"},triggers:{type:"click",switch:"image",repeat:"loop"},slider:{type:"slide",direction:"vert",duration:"1000ms"},thumbnail:{isActive:!0,position:"middle-left",fit:"fit",align:"start",triggers:"hov",grid:{size:.05,gap:.01},offset:{x:.03,y:0},opacity:50,activeState:{scale:1,opacity:100}},layout:{position:"middle-center",offset:{x:0,y:0},padding:{top:.06,right:.1,bottom:.06,left:.1}},controls:{isActive:!1,arrowsImgUrl:null,offset:{x:0,y:0},scale:1,color:"#000000",hover:"#cccccc"},area:{color:"rgba(28,31,34,0.9)",blur:0,closeIconUrl:null,closeIconColor:"#000000",closeIconHover:"#cccccc",closeIconAlign:"top-right",closeIconOffset:{x:0,y:0},closeIconScale:1},caption:{isActive:!0,alignment:"middle-center",offset:{x:0,y:0},hover:"#cccccc"}}}},displayRules:[{if:{name:"lightboxBlock.appear.type",value:"slide in"},then:{name:"properties.lightboxBlock.properties.appear.properties.direction.display.visible",value:!0}},{if:{name:"lightboxBlock.slider.direction",value:"vert"},then:{name:"properties.lightboxBlock.properties.thumbnail.properties.align.display.direction",value:"vertical"}},{if:{name:"lightboxBlock.appear.type",value:"mix"},then:{name:"properties.lightboxBlock.properties.appear.properties.direction.display.visible",value:!0}},{if:{name:"lightboxBlock.appear.type",value:"fade in"},then:{name:"properties.lightboxBlock.properties.appear.properties.direction.display.visible",value:!1}},{if:[{name:"lightboxBlock.triggers.type",value:"click"},{name:"lightboxBlock.triggers.switch",value:"image"}],then:{name:"properties.lightboxBlock.properties.triggers.properties.repeat.display.visible",value:!0}}]},content:{type:"array",settings:{addItemFromFileExplorer:!0},items:{type:"object",properties:{image:{type:"object",label:"Image",display:{type:"media-input"},properties:{url:{type:"string"},name:{type:"string"},objectFit:{type:"string",enum:["cover","contain"]}},required:["url","name"]},imageCaption:{label:"Description",placeholder:"Add Caption...",display:{type:"rich-text"}}},required:["image"]},default:[{image:{objectFit:"contain",url:"https://cdn.cntrl.site/component-assets/2.jpg",name:"Slider-1.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"contain",url:"https://cdn.cntrl.site/component-assets/3.jpg",name:"Slider-2.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"contain",url:"https://cdn.cntrl.site/component-assets/4.jpg",name:"Slider-3.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]}]},styles:{type:"object",properties:{imageCaption:{dataName:"caption",type:"object",properties:{fontSettings:{type:"object",display:{type:"font-settings"},properties:{fontFamily:{type:"string"},fontWeight:{type:"number"},fontStyle:{type:"string"}}},widthSettings:{display:{type:"text-width-control"},type:"object",properties:{width:{type:"number"},sizing:{type:"string",enum:["auto","manual"]}}},fontSizeLineHeight:{type:"object",display:{type:"font-size-line-height"},properties:{fontSize:{type:"number"},lineHeight:{type:"number"}}},letterSpacing:{display:{type:"letter-spacing-input"},type:"number"},wordSpacing:{display:{type:"word-spacing-input"},type:"number"},textAlign:{display:{type:"text-align-control"},type:"string",enum:["left","center","right","justify"]},textAppearance:{display:{type:"text-appearance"},properties:{textTransform:{type:"string",enum:["none","uppercase","lowercase","capitalize"]},textDecoration:{type:"string",enum:["none","underline"]},fontVariant:{type:"string",enum:["normal","small-caps"]}}},color:{display:{type:"style-panel-color-picker"},type:"string"}}}},default:{imageCaption:{widthSettings:{width:.13,sizing:"auto"},fontSettings:{fontFamily:"Arial",fontWeight:400,fontStyle:"normal"},fontSizeLineHeight:{fontSize:.02,lineHeight:.02},letterSpacing:0,wordSpacing:0,textAlign:"left",textAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},color:"#000000"}}}},required:["settings","content","styles"]}};function mt(e){const{color:t,...n}=e;return n}function tt(e,t){var n,o,r;return{fontFamily:e.fontSettings.fontFamily,fontWeight:e.fontSettings.fontWeight,fontStyle:e.fontSettings.fontStyle,letterSpacing:I.scalingValue(e.letterSpacing,t),wordSpacing:I.scalingValue(e.wordSpacing,t),fontSize:I.scalingValue(e.fontSize,t),lineHeight:e.lineHeight!==void 0?I.scalingValue(e.lineHeight,t):void 0,textTransform:(n=e.textAppearance)==null?void 0:n.textTransform,textDecoration:(o=e.textAppearance)==null?void 0:o.textDecoration,fontVariant:(r=e.textAppearance)==null?void 0:r.fontVariant,color:e.color}}function Ut(e){return`calc(var(--cntrl-article-width, 100vw) * ${e/1440})`}function bl(e){return`
|
|
7
|
-
.${
|
|
6
|
+
*/const ya="RichTextRenderer-module__link___BWeZ2",ba={link:ya},uo=({content:t})=>{const e=n=>n.map((r,o)=>r.type==="link"?p.jsx("a",{className:ba.link,href:r.value,target:r.target,children:e(r.children)},o):p.jsx("span",{style:va(r),children:r.text},o));return p.jsx(p.Fragment,{children:t.map((n,r)=>{const o=n.children;return p.jsx("div",{children:e(o)},r)})})};function va(t){return{...t.fontFamily&&{fontFamily:t.fontFamily},...t.fontWeight&&{fontWeight:t.fontWeight},...t.fontStyle&&{fontStyle:t.fontStyle},...t.textDecoration&&{textDecoration:t.textDecoration},...t.textTransform&&{textTransform:t.textTransform},...t.fontVariant&&{fontVariant:t.fontVariant},...t.verticalAlign&&{verticalAlign:t.verticalAlign,lineHeight:"0px"}}}const Sa="SvgImage-module__svg___q3xE-",xa="SvgImage-module__img___VsTm-",vr={svg:Sa,img:xa},Ca=t=>{const e=t.trim();return e.startsWith("data:image/svg+xml")?!0:(e.split(/[?#]/)[0]??e).endsWith(".svg")},$a=t=>`url("${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`,be=({url:t,fill:e="#000000",hoverFill:n="#CCCCCC",className:r="",style:o})=>{const[a,i]=V.useState(()=>typeof window>"u"?!0:CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")'));return V.useEffect(()=>{if(typeof window<"u"&&window.CSS){const c=CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")');i(c)}},[]),!Ca(t)||!a?p.jsx("img",{src:t,alt:"",className:yt(vr.img,r),style:o}):p.jsx("span",{"data-supports-mask":a,className:yt(vr.svg,r),style:{"--svg":$a(t),"--fill":e,"--hover-fill":n,...o??{}}})},wa={"top-left":U.topLeftAlignment,"top-center":U.topCenterAlignment,"top-right":U.topRightAlignment,"middle-left":U.middleLeftAlignment,"middle-center":U.middleCenterAlignment,"middle-right":U.middleRightAlignment,"bottom-left":U.bottomLeftAlignment,"bottom-center":U.bottomCenterAlignment,"bottom-right":U.bottomRightAlignment};function _a({settings:t,content:e,styles:n,isEditor:r}){const[o,a]=V.useState(null),{widthSettings:i,fontSettings:c,letterSpacing:s,textAlign:d,wordSpacing:l,fontSizeLineHeight:w,textAppearance:b,color:g}=n.imageCaption,[u,m]=V.useState(void 0),[S,y]=V.useState(null),[v,C]=V.useState(0),[M,B]=V.useState(0),{direction:$,transition:f,controls:T,pagination:A,imageCaption:z,triggers:L}=t,k=V.useRef(f.type),{x:W,y:D}=t.controls.offset,H=h=>{o&&o.go(h)};return V.useEffect(()=>{if(!S)return;const h=new ResizeObserver(O=>{if(!o)return;const[F]=O;m({width:Math.round(F.contentRect.width),height:Math.round(F.contentRect.height)})});return h.observe(S),()=>h.unobserve(S)},[S]),V.useEffect(()=>{!o||k.current===f.type||(B(h=>h+1),k.current=f.type)},[f.type]),p.jsx("div",{className:yt(U.wrapper,{[U.editor]:r}),ref:y,children:p.jsxs("div",{className:U.sliderInner,style:{width:u?u.width:"100%",height:u?u.height:"100%",backgroundColor:f.backgroundColor&&f.type==="fade in"?f.backgroundColor:"transparent"},children:[t.imageCaption.isActive&&p.jsx("div",{className:yt(U.captionBlock),children:p.jsx("div",{className:U.captionTextWrapper,children:e.map((h,O)=>p.jsx("div",{className:yt(U.captionText,wa[z.alignment],{[U.withPointerEvents]:O===v&&r,[U.active]:O===v}),style:{fontFamily:c.fontFamily,fontWeight:c.fontWeight,fontStyle:c.fontStyle,width:i.sizing==="auto"?"max-content":E.scalingValue(i.width,r),letterSpacing:E.scalingValue(s,r),wordSpacing:E.scalingValue(l,r),textAlign:d,fontSize:E.scalingValue(w.fontSize,r),lineHeight:E.scalingValue(w.lineHeight,r),textTransform:b.textTransform??"none",textDecoration:b.textDecoration??"none",fontVariant:b.fontVariant??"normal",color:g,transitionDuration:f.duration?`${Math.round(parseInt(f.duration)/2)}ms`:"500ms"},children:p.jsx("div",{"data-styles":"imageCaption",className:U.captionTextInner,style:{"--link-hover-color":z.linkHoverColor,"--link-color":z.linkColor,position:"relative",top:E.scalingValue(z.offset.y,r),left:E.scalingValue(z.offset.x,r)},children:p.jsx(uo,{content:h.imageCaption})})},O))})}),p.jsx(er,{onMove:h=>{C(h.index)},ref:a,options:{arrows:!1,speed:f.duration?parseInt(f.duration):500,autoplay:L.autoPlay!==null,...L.autoPlay!==null&&{interval:parseInt(L.autoPlay)*1e3},direction:$==="horiz"||f.type==="fade in"?"ltr":"ttb",pagination:!1,drag:L.triggersList.drag,perPage:1,width:u?u.width:"100%",height:u?u.height:"100%",type:f.type==="fade in"?"fade":"loop",rewind:!0},children:e.map((h,O)=>p.jsx(nr,{children:p.jsx("div",{className:U.sliderItem,children:p.jsx("div",{className:U.imgWrapper,children:p.jsx("img",{className:yt(U.sliderImage,{[U.contain]:h.image.objectFit==="contain",[U.cover]:h.image.objectFit==="cover"}),src:h.image.url,alt:h.image.name??""})})})},O))},M),T.isActive&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:yt(U.arrow,{[U.arrowVertical]:$==="vert",[U.hoverArrow]:T.show==="on hover"}),style:{color:T.color,"--arrow-hover-color":T.hover},children:p.jsxs("button",{onClick:()=>{H("-1")},className:U.arrowInner,style:{transform:`translate(${E.scalingValue(W,r)}, ${E.scalingValue(D*($==="horiz"?1:-1),r)}) scale(${t.controls.scale/100}) rotate(${$==="horiz"?"0deg":"90deg"})`},children:[T.arrowsImgUrl&&p.jsx(be,{url:T.arrowsImgUrl,fill:T.color,hoverFill:T.hover,className:yt(U.arrowImg,U.mirror)}),!T.arrowsImgUrl&&p.jsx(Sr,{color:T.color,className:yt(U.arrowIcon,U.arrowImg,U.mirror)})]})}),p.jsx("div",{className:yt(U.arrow,U.nextArrow,{[U.arrowVertical]:$==="vert",[U.hoverArrow]:T.show==="on hover"}),style:{color:T.color,"--arrow-hover-color":T.hover},children:p.jsxs("button",{className:U.arrowInner,onClick:()=>H("+1"),style:{transform:`translate(${E.scalingValue(W*($==="horiz"?-1:1),r)}, ${E.scalingValue(D,r)}) scale(${t.controls.scale/100}) rotate(${$==="horiz"?"0deg":"90deg"})`},children:[T.arrowsImgUrl&&p.jsx(be,{url:T.arrowsImgUrl,fill:T.color,hoverFill:T.hover,className:U.arrowImg}),!T.arrowsImgUrl&&p.jsx(Sr,{color:T.color,className:yt(U.arrowIcon,U.arrowImg)})]})})]}),L.triggersList.click&&p.jsx("div",{className:U.clickOverlay,onClick:()=>{o&&o.go("+1")}}),A.isActive&&p.jsx("div",{className:yt(U.pagination,{[U.paginationInsideBottom]:A.position==="inside-1"&&$==="horiz",[U.paginationInsideTop]:A.position==="inside-2"&&$==="horiz",[U.paginationOutsideBottom]:A.position==="outside-1"&&$==="horiz",[U.paginationOutsideTop]:A.position==="outside-2"&&$==="horiz",[U.paginationInsideLeft]:A.position==="inside-1"&&$==="vert",[U.paginationInsideRight]:A.position==="inside-2"&&$==="vert",[U.paginationOutsideLeft]:A.position==="outside-1"&&$==="vert",[U.paginationOutsideRight]:A.position==="outside-2"&&$==="vert",[U.paginationVertical]:$==="vert"}),children:p.jsx("div",{className:U.paginationInner,style:{backgroundColor:A.colors[2],transform:`scale(${A.scale/100}) translate(${E.scalingValue(A.offset.x,r)}, ${E.scalingValue(A.offset.y,r)}) rotate(${$==="horiz"?"0deg":"90deg"})`},children:e.map((h,O)=>p.jsx("button",{onClick:()=>{o&&o.go(O)},className:yt(U.paginationItem),children:p.jsx("div",{className:yt(U.dot,{[U.activeDot]:O===v}),style:{backgroundColor:O===v?A.colors[0]:A.colors[1],"--pagination-hover-color":A.hover}})},O))})})]})})}function Sr({color:t,className:e}){return p.jsx("svg",{viewBox:"0 0 10 18",className:e,children:p.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:p.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:t,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}const Ta={element:_a,id:"control-slider",name:"Slider",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/sliderImg.png"},defaultSize:{width:400,height:400},assetsPaths:{content:[{path:"image.url",placeholderEnabled:!0}],parameters:[{path:"settings.controls.arrowsImgUrl"}]},fontSettingsPaths:{content:[],parameters:[{path:"styles.imageCaption.fontSettings"}]},schema:{type:"object",properties:{settings:{type:"object",display:{type:"settings-block"},properties:{triggers:{title:"triggers",icon:"target",tooltip:"Triggers",type:"object",properties:{triggersList:{type:"object",display:{type:"toggle-ratio-group"},properties:{click:{type:"boolean"},drag:{type:"boolean"}}},autoPlay:{type:["string","null"],label:"Auto",display:{type:"step-selector"},enum:[null,"1s","2s","3s","4s","5s"]}}},direction:{icon:"horizontal-resize",tooltip:"Direction",type:"string",display:{type:"ratio-group"},enum:["horiz","vert"]},transition:{title:"transit",icon:"transition",tooltip:"Transition",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["slide","fade in"]},backgroundColor:{type:["string","null"],title:"BG Color",display:{visible:!1,type:"settings-color-picker",format:"single"}},duration:{type:"string",label:"icon:hourglass",display:{type:"step-selector"},enum:["100ms","250ms","500ms","1000ms","1500ms","2000ms"]}}},controls:{title:"controls",icon:"controls",tooltip:"Controls",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},arrowsImgUrl:{type:["string","null"],display:{type:"settings-image-input"}},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},scale:{type:"number",title:"scale",min:50,max:600,display:{type:"range-control"}},color:{title:"color",type:"string",display:{type:"settings-color-picker",format:"single"}},hover:{title:"hover",type:"string",display:{type:"settings-color-picker",format:"single"}},show:{title:"Show",type:"string",display:{type:"ratio-group"},enum:["always","on hover"]}}},pagination:{title:"nav",icon:"pagination",tooltip:"Navigation",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},position:{display:{type:"socket",direction:"horizontal"},type:"string",enum:["outside-1","outside-2","inside-1","inside-2"]},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},scale:{type:"number",title:"scale",min:10,max:400,display:{type:"range-control"}},colors:{display:{type:"settings-color-picker",format:"multiple"},title:"color",type:"array",items:{type:"string"}},hover:{title:"hover",type:"string",display:{type:"settings-color-picker",format:"single"}}}},imageCaption:{title:"Caption",icon:"text-icon",tooltip:"Caption",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},alignment:{type:"string",display:{type:"align-grid"},enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},linkColor:{title:"Link",type:"string",display:{type:"settings-color-picker",format:"single"}},linkHoverColor:{title:"Link Hov",type:"string",display:{type:"settings-color-picker",format:"single"}}}}},default:{triggers:{triggersList:{click:!1,drag:!0},autoPlay:null},controls:{isActive:!0,arrowsImgUrl:null,offset:{x:0,y:0},scale:100,color:"#000000",hover:"#cccccc",show:"always"},transition:{type:"slide",duration:"500ms",backgroundColor:null},pagination:{isActive:!0,scale:50,position:"outside-1",offset:{x:0,y:0},colors:["#cccccc","#cccccc","#000000"],hover:"#cccccc"},direction:"horiz",imageCaption:{offset:{x:0,y:0},isActive:!0,alignment:"middle-center",linkColor:"#cccccc",linkHoverColor:"#cccccc"}},displayRules:[{if:{name:"direction",value:"vert"},then:{name:"properties.pagination.properties.position.display.direction",value:"vertical"}},{if:{name:"transition.type",value:"fade in"},then:{name:"properties.transition.properties.backgroundColor.display.visible",value:!0}}]},content:{type:"array",settings:{addItemFromFileExplorer:!0},items:{type:"object",properties:{image:{type:"object",label:"Image",display:{type:"media-input"},properties:{url:{type:"string"},name:{type:"string"},objectFit:{type:"string",enum:["cover","contain"]}},required:["url","name"]},imageCaption:{placeholder:"Add Caption...",label:"Description",display:{type:"rich-text"}}},required:["image"]},default:[{image:{objectFit:"cover",url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-1.png",name:"Slider-1.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-2.png",name:"Slider-2.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-3.png",name:"Slider-3.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]}]},styles:{type:"object",properties:{imageCaption:{dataName:"caption",type:"object",properties:{fontSettings:{type:"object",display:{type:"font-settings"},properties:{fontFamily:{type:"string"},fontWeight:{type:"number"},fontStyle:{type:"string"}}},widthSettings:{display:{type:"text-width-control"},type:"object",properties:{width:{type:"number"},sizing:{type:"string",enum:["auto","manual"]}}},fontSizeLineHeight:{type:"object",display:{type:"font-size-line-height"},properties:{fontSize:{type:"number"},lineHeight:{type:"number"}}},letterSpacing:{display:{type:"letter-spacing-input"},type:"number"},wordSpacing:{display:{type:"word-spacing-input"},type:"number"},textAlign:{display:{type:"text-align-control"},type:"string",enum:["left","center","right","justify"]},textAppearance:{display:{type:"text-appearance"},properties:{textTransform:{type:"string",enum:["none","uppercase","lowercase","capitalize"]},textDecoration:{type:"string",enum:["none","underline"]},fontVariant:{type:"string",enum:["normal","small-caps"]}}},color:{display:{type:"style-panel-color-picker"},type:"string"}}}},default:{imageCaption:{widthSettings:{width:.13,sizing:"auto"},fontSettings:{fontFamily:"Arial",fontWeight:400,fontStyle:"normal"},fontSizeLineHeight:{fontSize:.02,lineHeight:.02},letterSpacing:0,wordSpacing:0,textAlign:"left",textAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},color:"#000000"}}}},required:["settings","content","styles"]}},La="ImageRevealSlider-module__imageRevealSlider___UE5Ob",Ea="ImageRevealSlider-module__image___Qjt-e",Aa="ImageRevealSlider-module__link___N-iLG",Ia="ImageRevealSlider-module__cursor___2U03d",de={imageRevealSlider:La,image:Ea,link:Aa,cursor:Ia};function xr(t,e,n){for(const r of n){const o=new Image;o.src=r.url;const a=r.width?Number.parseFloat(r.width):o.naturalWidth,i=o.naturalHeight/o.naturalWidth*a,c=a/2,s=i/2;if(t>=r.x-c&&t<=r.x+c&&e>=r.y-s&&e<=r.y+s)return!0}return!1}function wn(t){return new Promise(e=>{const n=new Image;n.src=t,n.onload=()=>{e({width:n.naturalWidth,height:n.naturalHeight})}})}async function Fa(t,e,n,r){let o,a;if(e==="custom"){o=n;const i=await wn(t);a=i.height/i.width*o}else if(e==="random"){o=Math.random()*(r.max-r.min)+r.min;const i=await wn(t);a=i.height/i.width*o}else{const i=await wn(t);o=i.width,a=i.height}return{width:o,height:a,finalWidth:`${o}px`}}function ka({settings:t,content:e,isEditor:n}){const[r,o]=V.useState(null),[a,i]=V.useState([]),[c,s]=V.useState(0),d=V.useRef(0),[l,w]=V.useState({x:0,y:0}),[b,g]=V.useState(1),[u,m]=V.useState("none"),S=V.useRef({x:0,y:0}),[y,v]=V.useState(!1),{sizeType:C,imageWidth:M,randomRangeImageWidth:B}=t.imageSize,{revealPosition:$,visible:f}=t.position,{cursorType:T,target:A,defaultCursorScale:z,defaultCursor:L,hoverCursorScale:k,hoverCursor:W}=t.cursor;V.useEffect(()=>{if(!r)return;const h=(I,_)=>{const P=r.getBoundingClientRect(),X=I-P.left,it=_-P.top;if(w({x:X,y:it}),T==="system"){m("none"),g(1);return}const et=X,st=it,R=document.elementFromPoint(P.left+et,P.top+st);if(R&&R.closest("a")){m("none"),g(1);return}const K=xr(et,st,a)||A==="area"?{img:W??"none",scale:k}:{img:L??"none",scale:z};m(K.img),g(K.scale)},O=I=>{I.stopPropagation(),S.current={x:I.clientX,y:I.clientY},h(I.clientX,I.clientY)},F=()=>{y&&h(S.current.x,S.current.y)};return r.addEventListener("mousemove",O),window.addEventListener("scroll",F,!0),()=>{r.removeEventListener("mousemove",O),window.removeEventListener("scroll",F,!0)}},[r,y,l,T,A,W,L,k,z,a]),V.useEffect(()=>{y||(m("none"),g(0))},[y]);const D=async(h,O,F,I={})=>{const{width:_,height:P,finalWidth:X}=await Fa(h.image.url,C,M,B);let it=0,et=0;$==="same"?(it=O/2,et=F/2):(it=I.x??Math.random()*O,et=I.y??Math.random()*F);const st=Math.min(Math.max(it,_/2),O-_/2),R=Math.min(Math.max(et,P/2),F-P/2);return{id:d.current++,url:h.image.url,link:h.link,name:h.image.name,x:st,y:R,width:X}};V.useEffect(()=>{if(!r||e.length===0)return;const h=r.getBoundingClientRect(),O=h.width,F=h.height,I=[];(async()=>{const P=e[0],X=await D(P,O,F);I.push(X),i(I),s(1)})()},[C,M,B,$,r]),V.useEffect(()=>{f==="last One"&&i(h=>h.length>0?[h[h.length-1]]:[])},[f]);const H=async h=>{if(!r)return;const O=r.getBoundingClientRect(),F=h.clientX-O.left,I=h.clientY-O.top;if(A==="image"&&!xr(F,I,a))return;let _=0,P=0;$==="on Click"?(_=F,P=I):$==="same"?(_=O.width/2,P=O.height/2):(_=Math.random()*O.width,P=Math.random()*O.height);const X=e[c],it=await D(X,O.width,O.height,{x:_,y:P});i(et=>f==="all"?[...et,it]:[it]),s(et=>et>=e.length-1?0:et+1)};return p.jsxs("div",{ref:o,onClick:H,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),className:de.imageRevealSlider,style:{cursor:u==="none"?"default":"none"},children:[a.map(h=>p.jsx("div",{className:de.wrapper,style:{top:`${h.y}px`,left:`${h.x}px`,position:"absolute",transform:"translate(-50%, -50%)",width:h.width??"auto",height:"auto",cursor:u==="none"?"default":"none"},children:A==="area"&&h.link?p.jsx("a",{href:h.link,target:"_blank",className:de.link,children:p.jsx("img",{src:h.url,alt:h.name,className:de.image},h.id)}):p.jsx("img",{src:h.url,alt:h.name,className:de.image},h.id)},h.id)),y&&p.jsx("div",{className:de.cursor,style:{left:`${l.x}px`,top:`${l.y}px`,transform:`translate(-50%, -50%) scale(${b})`,backgroundImage:`url('${u}')`,backgroundSize:"cover",backgroundPosition:"center",position:"absolute",pointerEvents:"none"}})]})}const Ra={element:ka,id:"control-image-reveal",name:"Click Gallery",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/clickGalleryImg.png"},defaultSize:{width:"100%",height:"100%"},assetsPaths:{content:[{path:"image.url",placeholderEnabled:!0}],parameters:[{path:"settings.cursor.defaultCursor"},{path:"settings.cursor.hoverCursor"}]},fontSettingsPaths:{content:[],parameters:[]},schema:{type:"object",properties:{settings:{type:"object",display:{type:"settings-block"},properties:{imageSize:{title:"IMG SIZE",icon:"size",tooltip:"IMG SIZE",type:"object",properties:{sizeType:{type:"string",display:{type:"ratio-group"},enum:["as Is","custom","random"]},imageWidth:{type:"number",label:"W",display:{type:"numeric-input",visible:!1}},randomRangeImageWidth:{type:"object",display:{type:"random-range-controls",visible:!1},properties:{min:{type:"number"},max:{type:"number"}}}}},cursor:{title:"cursor",icon:"cursor",tooltip:"cursor",type:"object",properties:{cursorType:{type:"string",display:{type:"ratio-group"},enum:["system","custom"]},target:{type:"string",title:"Target",display:{type:"ratio-group"},enum:["area","image"]},defaultCursor:{type:["string","null"],title:"Default",display:{type:"settings-image-input",visible:!1}},defaultCursorScale:{type:"number",title:"Scale",min:1,max:5,step:.1,display:{type:"range-control",visible:!1}},hoverCursor:{type:["string","null"],title:"Hover",display:{type:"settings-image-input",visible:!1}},hoverCursorScale:{type:"number",title:"Scale",min:1,max:5,step:.1,display:{type:"range-control",visible:!1}}}},position:{title:"position",icon:"transition",tooltip:"Position",type:"object",properties:{revealPosition:{type:"string",display:{type:"ratio-group"},enum:["random","same","on Click"]},visible:{type:"string",title:"Visible",display:{type:"ratio-group"},enum:["all","last One"]}}}},default:{imageSize:{sizeType:"custom",imageWidth:500,randomRangeImageWidth:{min:100,max:1e3}},cursor:{cursorType:"system",target:"area",defaultCursor:null,defaultCursorScale:2,hoverCursor:null,hoverCursorScale:2},position:{revealPosition:"random",visible:"all"}},displayRules:[{if:{name:"imageSize.sizeType",value:"custom"},then:{name:"properties.imageSize.properties.imageWidth.display.visible",value:!0}},{if:{name:"imageSize.sizeType",value:"random"},then:{name:"properties.imageSize.properties.randomRangeImageWidth.display.visible",value:!0}},{if:[{name:"cursor.target",value:"image"},{name:"cursor.cursorType",value:"custom"}],then:{name:"properties.cursor.properties.defaultCursor.display.visible",value:!0}},{if:[{name:"cursor.target",value:"image"},{name:"cursor.cursorType",value:"custom"},{name:"cursor.defaultCursor",value:null,isNotEqual:!0}],then:{name:"properties.cursor.properties.defaultCursorScale.display.visible",value:!0}},{if:{name:"cursor.cursorType",value:"custom"},then:{name:"properties.cursor.properties.hoverCursor.display.visible",value:!0}},{if:[{name:"cursor.cursorType",value:"custom"},{name:"cursor.hoverCursor",value:null,isNotEqual:!0}],then:{name:"properties.cursor.properties.hoverCursorScale.display.visible",value:!0}}]},content:{type:"array",settings:{addItemFromFileExplorer:!0},items:{type:"object",properties:{image:{type:"object",label:"Image",display:{isObjectFitEditable:!1,type:"media-input"},properties:{url:{type:"string"},name:{type:"string"},objectFit:{type:"string",enum:["cover","contain"]}},required:["url","name"]},link:{label:"URL",placeholder:"Enter link...",display:{type:"text-input"}}},required:["image"]},default:[{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQK9211QXBE9W284ZNKB8.png",name:"Slider-1.png"},link:""},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQMFT72JD18WKP0Q2DVAT.png",name:"Slider-2.png"},link:""},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQNEVRXPSRX5K1YTMJQY9.png",name:"Slider-3.png"},link:""},{image:{objectFit:"cover",url:"https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7ERQP84JKRDT7WNWDQZR4Y9.png",name:"Slider-4.png"},link:""}]}}}},Oa="LightBox-module__hidden___9s-9x",Pa="LightBox-module__heroImage___sTxNF",Ba="LightBox-module__background___rm9ml",Wa="LightBox-module__editor___4ACaY",Va="LightBox-module__contentStyle___Bgnsq",za="LightBox-module__imageStyle___tLIlB",Na="LightBox-module__imgWrapper___LuFUp",ja="LightBox-module__contain___8-yaS",Ma="LightBox-module__cover___hNvOG",Ha="LightBox-module__caption___b6L2I",Da="LightBox-module__captionTextInner___rCGNH",Ga="LightBox-module__lightboxSplide___XFuWC",Ua="LightBox-module__arrow___iz38X",Xa="LightBox-module__arrowVertical___Zfz81",qa="LightBox-module__nextArrow___zkAQN",Ya="LightBox-module__arrowInner___p48sW",Ka="LightBox-module__arrowIcon___3VaFf",Ja="LightBox-module__arrowImg___pNV88",Za="LightBox-module__mirror___pjeXc",Qa="LightBox-module__thumbsWrapper___GB-nU",tl="LightBox-module__thumbsContainerVertical___wttk5",el="LightBox-module__thumbsContainer___osSma",nl="LightBox-module__thumbsAlignStart___MO6tY",rl="LightBox-module__thumbsAlignCenter___Q4sUx",ol="LightBox-module__thumbsAlignEnd___p4y9R",il="LightBox-module__thumbItem___HvnF3",al="LightBox-module__closeButton___g2khP",ll="LightBox-module__fadeIn___0m5GW",sl="LightBox-module__slideInLeft___gPYwC",cl="LightBox-module__slideInRight___S-pPp",ul="LightBox-module__slideInTop___DFdAj",pl="LightBox-module__slideInBottom___m27kZ",dl="LightBox-module__fadeOut___55qBR",gl="LightBox-module__slideOutLeft___NvU7P",ml="LightBox-module__slideOutRight___SK7eC",fl="LightBox-module__slideOutTop___Vgg0z",hl="LightBox-module__slideOutBottom___nJ0Ef",yl="LightBox-module__scaleSlide___vZriG",N={hidden:Oa,heroImage:Pa,background:Ba,editor:Wa,contentStyle:Va,imageStyle:za,imgWrapper:Na,contain:ja,cover:Ma,caption:Ha,captionTextInner:Da,lightboxSplide:Ga,arrow:Ua,arrowVertical:Xa,nextArrow:qa,arrowInner:Ya,arrowIcon:Ka,arrowImg:Ja,mirror:Za,thumbsWrapper:Qa,thumbsContainerVertical:tl,thumbsContainer:el,thumbsAlignStart:nl,thumbsAlignCenter:rl,thumbsAlignEnd:ol,thumbItem:il,closeButton:al,fadeIn:ll,slideInLeft:sl,slideInRight:cl,slideInTop:ul,slideInBottom:pl,fadeOut:dl,slideOutLeft:gl,slideOutRight:ml,slideOutTop:fl,slideOutBottom:hl,scaleSlide:yl},qe=(t,e,n)=>{const r={},[o,a]=t.split("-");return o==="top"?(r.top="0",r.bottom="auto"):o==="middle"?(r.top="50%",r.bottom="auto"):o==="bottom"&&(r.top="auto",r.bottom="0"),a==="left"?(r.left="0",r.right="auto"):a==="center"?(r.left="50%",r.right="auto"):a==="right"&&(r.left="auto",r.right="0"),o==="middle"&&a==="center"?r.transform=`translate(calc(-50% + ${E.scalingValue(e.x,n)}), calc(-50% + ${E.scalingValue(e.y,n)}))`:o==="middle"?r.transform=`translate(${E.scalingValue(e.x,n)}, calc(-50% + ${E.scalingValue(e.y,n)}))`:a==="center"?r.transform=`translate(calc(-50% + ${E.scalingValue(e.x,n)}), ${E.scalingValue(e.y,n)})`:r.transform=`translate(${E.scalingValue(e.x,n)}, ${E.scalingValue(e.y,n)})`,r};function po(t){const e=window.getComputedStyle(t);return{top:parseFloat(e.paddingTop)||0,right:parseFloat(e.paddingRight)||0,bottom:parseFloat(e.paddingBottom)||0,left:parseFloat(e.paddingLeft)||0}}function Cr(t){const e=t.getBoundingClientRect(),n=po(t),r=Math.max(0,e.width-n.left-n.right),o=Math.max(0,e.height-n.top-n.bottom),a=t.naturalWidth,i=t.naturalHeight,c=r/o,s=a/i;let d,l;s>c?(d=r,l=r/s):(l=o,d=o*s);const w=e.left+n.left,b=e.top+n.top,g=(r-d)/2+w,u=(o-l)/2+b;return{x:g,y:u,width:d,height:l}}function $r(t){const e=t.getBoundingClientRect(),n=po(t);return{left:e.left+n.left,right:e.right-n.right,top:e.top+n.top,bottom:e.bottom-n.bottom}}function wr(t){const e=t.match(/rgba?\(([^)]+)\)/);if(e){const r=e[1].split(",").map(o=>parseFloat(o.trim()));return r.length===4?r[3]:1}const n=t.match(/^#([0-9a-fA-F]{8})$/);if(n){const r=n[1].substring(6,8);return parseInt(r,16)/255}return t.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/),1}function bl(t,e){const n=(()=>{if(t==="fade in")return N.fadeIn;if(t==="slide in"||t==="mix")switch(e){case"left":return N.slideInLeft;case"right":return N.slideInRight;case"top":return N.slideInTop;case"bottom":return N.slideInBottom;default:return N.slideInRight}return N.fadeIn})(),r=(()=>{if(t==="fade in"||t==="mix")return N.fadeIn;if(t==="slide in")switch(e){case"left":return N.slideInLeft;case"right":return N.slideInRight;case"top":return N.slideInTop;case"bottom":return N.slideInBottom;default:return N.slideInRight}return N.fadeIn})(),o=(()=>{if(t==="fade in"||t==="mix")return N.fadeOut;if(t==="slide in")switch(e){case"left":return N.slideOutLeft;case"right":return N.slideOutRight;case"top":return N.slideOutTop;case"bottom":return N.slideOutBottom;default:return N.slideOutRight}return N.fadeOut})(),a=(()=>{if(t==="fade in")return N.fadeOut;if(t==="slide in"||t==="mix")switch(e){case"left":return N.slideOutLeft;case"right":return N.slideOutRight;case"top":return N.slideOutTop;case"bottom":return N.slideOutBottom;default:return N.slideOutRight}return N.fadeOut})();return{appearClass:n,backdropAppearClass:r,backdropDisappearClass:o,disappearClass:a}}const vl=({settings:t,content:e,styles:n,portalId:r,activeEvent:o,isEditor:a})=>{const[i,c]=V.useState(!1),{url:s}=t.thumbnailBlock.cover;return V.useEffect(()=>{o==="close"&&c(!1),o==="open"&&c(!0)},[o]),p.jsxs(p.Fragment,{children:[p.jsx("img",{src:s,alt:"Cover",className:N.heroImage,onClick:()=>c(!0)}),p.jsx(Sl,{isOpen:i,onClose:()=>c(!1),content:e,settings:t,lightboxStyles:n,portalId:r,isEditor:a})]})},Sl=({isOpen:t,onClose:e,content:n,lightboxStyles:r,settings:o,portalId:a,isEditor:i,metadata:c})=>{var j;const[s,d]=V.useState(0),[l,w]=V.useState(0),[b,g]=V.useState(!1),[u,m]=V.useState(!1),[S,y]=V.useState({}),v=V.useRef(null),C=V.useRef(null),M=V.useRef(null),B=V.useRef(!1),$=V.useRef(null),f=V.useRef(null),T=V.useRef(null),A=V.useRef(null),z=V.useRef(!1),L=V.useRef(null),[k,W]=V.useState(!1),{appear:D,triggers:H,slider:h,thumbnail:O,controls:F,area:I,caption:_,layout:P}=o.lightboxBlock,{appearClass:X,backdropAppearClass:it,backdropDisappearClass:et,disappearClass:st}=bl(D.type,D.direction),R=(c==null?void 0:c.itemId)??null;V.useEffect(()=>{const x=()=>{setTimeout(()=>{var q,J;(J=(q=v.current)==null?void 0:q.splide)==null||J.refresh()},16)},G=()=>{w(q=>q+1)};return window.addEventListener("ArticleEditor.Layout:change",x),window.addEventListener("ArticleEditor.ComponentContent:change",G),()=>{window.removeEventListener("ArticleEditor.Layout:change",x),window.removeEventListener("ArticleEditor.ComponentContent:change",G)}},[]),V.useEffect(()=>{if(!t||!O.isActive){W(!1);return}const x=L.current;if(!x)return;const G=()=>{h.direction==="horiz"?W(x.scrollWidth>x.clientWidth):W(x.scrollHeight>x.clientHeight)};G();const q=new ResizeObserver(G);return q.observe(x),()=>q.disconnect()},[t,O.isActive,n.length,S,h.direction]);const K=V.useCallback(()=>{const x=window.matchMedia("(max-width: 768px)").matches,G=wr(I.color);x&&!i&&G>.9&&(document.body.style.backgroundColor=""),g(!0),B.current=!0;const q=J=>{J.target===$.current&&J.animationName&&($.current&&f.current&&$.current.removeEventListener("animationend",f.current),f.current=null,B.current&&(B.current=!1,e()),g(!1))};$.current&&(f.current=q,$.current.addEventListener("animationend",q))},[e,I.color,i]),ft=(x,G,q)=>{var J,nt;if(x){if(H.type==="click"&&H.switch==="image")H.repeat==="close"&&s===n.length-1?K():(J=v.current)==null||J.go("+1");else if(H.type==="click"&&H.switch==="50/50"){const Z=x.getBoundingClientRect(),Y=G-Z.left,ot=q-Z.top,ht=Z.width,lt=Z.height;let gt;h.direction==="horiz"?gt=Y<ht/2?"-1":"+1":gt=ot<lt/2?"-1":"+1",(nt=v.current)==null||nt.go(gt)}}},ct=x=>{if(z.current){z.current=!1;return}const G=n[s],q=(G==null?void 0:G.image.objectFit)==="cover";let J,nt;if("changedTouches"in x&&x.changedTouches.length>0)J=x.changedTouches[0].clientX,nt=x.changedTouches[0].clientY;else if("clientX"in x)J=x.clientX,nt=x.clientY;else return;let Z;if(q&&M.current){const Y=$r(M.current);Z=J>=Y.left&&J<=Y.right&&nt>=Y.top&&nt<=Y.bottom}else{const Y=M.current?Cr(M.current):null;if(!Y){x.target===x.currentTarget&&K();return}Z=J>=Y.x&&J<=Y.x+Y.width&&nt>=Y.y&&nt<=Y.y+Y.height}Z?ft(M.current,J,nt):K()},dt=x=>{const G=x.target;(G.classList.contains(N.thumbsWrapper)||G.classList.contains(N.thumbsContainer))&&ct(x)};V.useEffect(()=>{if(!t)return;const x=G=>{var q,J;if(G.key==="Escape"){K();return}if(G.key==="ArrowRight"){d(nt=>(nt+1)%Math.max(n.length,1)),(q=v.current)==null||q.go("+1");return}G.key==="ArrowLeft"&&(d(nt=>(nt-1+Math.max(n.length,1))%Math.max(n.length,1)),(J=v.current)==null||J.go("-1"))};return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}},[t,K,n.length]),V.useEffect(()=>{if(t){if(d(0),w(G=>G+1),B.current=!1,g(!1),m(!1),y({}),!R)return;const x=new CustomEvent("page-overlay",{detail:{itemId:R}});window.dispatchEvent(x)}return()=>{$.current&&f.current&&($.current.removeEventListener("animationend",f.current),f.current=null),m(!1)}},[t,R]),V.useEffect(()=>{C.current!==null&&C.current!==h.type&&w(x=>x+1),C.current=h.type},[h.type]),V.useEffect(()=>{if(!t)return;const x=document.body.style.overflow,G=window.matchMedia("(max-width: 768px)").matches,q=wr(I.color);document.body.style.overflow="hidden",m(!1);const J=Z=>{Z.target===$.current&&!B.current&&Z.animationName&&(G&&!i&&q>.9&&(document.body.style.backgroundColor=I.color),m(!0),$.current&&T.current&&$.current.removeEventListener("animationend",T.current),T.current=null)};$.current&&(T.current=J,$.current.addEventListener("animationend",J));const nt=Z=>{const Y=Z.target;Y&&(Y.closest(`.${N.thumbsWrapper}`)||Y.closest(`.${N.thumbsContainer}`))||h.type!=="slide"&&Z.preventDefault()};return document.addEventListener("touchmove",nt,{passive:!1}),()=>{document.body.style.overflow=x,document.removeEventListener("touchmove",nt),$.current&&T.current&&($.current.removeEventListener("animationend",T.current),T.current=null),m(!1)}},[t,i,I.color,h.type]),V.useEffect(()=>{if(!t)return;const x=G=>{var J,nt;if(B.current){G.stopPropagation();return}if(z.current){z.current=!1;return}const q=G.target;if(!(q&&(q.closest(`.${N.thumbsContainer}`)||q.closest(`.${N.thumbItem}`)))){if(h.type==="slide"&&H.type==="drag"&&((nt=(J=v.current)==null?void 0:J.splide)!=null&&nt.root)){const Z=v.current.splide.root;if(q&&(Z.contains(q)||Z===q))return}if(G.touches.length===0&&G.changedTouches.length>0){const Z=n[s],Y=(Z==null?void 0:Z.image.objectFit)==="cover",ot=G.changedTouches[0];let ht;if(Y&&M.current){const lt=$r(M.current);ht=ot.clientX>=lt.left&&ot.clientX<=lt.right&&ot.clientY>=lt.top&&ot.clientY<=lt.bottom}else{const lt=M.current?Cr(M.current):null;if(!lt)return;ht=ot.clientX>=lt.x&&ot.clientX<=lt.x+lt.width&&ot.clientY>=lt.y&&ot.clientY<=lt.y+lt.height}if(!ht){G.stopPropagation(),B.current=!0;const lt=gt=>{gt.stopPropagation(),gt.preventDefault(),document.removeEventListener("click",lt,!0)};document.addEventListener("click",lt,!0),K()}}}};return document.addEventListener("touchend",x,{passive:!0}),()=>{document.removeEventListener("touchend",x)}},[t,K,s,n]);const St=(h.type==="scale"||h.type==="fade")&&h.direction==="vert"&&H.type==="drag";V.useEffect(()=>{var gt,wt;if(!t||!St||!((wt=(gt=v.current)==null?void 0:gt.splide)!=null&&wt.root))return;const x=v.current.splide.root,G=30,q=(Q,ut)=>{if(A.current){const xt=Math.abs(Q-A.current.x),Bt=Math.abs(ut-A.current.y);(xt>0||Bt>0)&&(z.current=!0)}},J=Q=>{A.current&&(Q.preventDefault(),q(Q.clientX,Q.clientY))},nt=Q=>{A.current&&Q.touches.length>0&&(Q.preventDefault(),q(Q.touches[0].clientX,Q.touches[0].clientY))},Z=(Q,ut)=>{if(!A.current||!v.current){A.current=null;return}const xt=Math.abs(Q-A.current.x),Bt=Math.abs(ut-A.current.y);Bt>G&&Bt>xt&&v.current.go(ut<A.current.y?"+1":"-1"),A.current=null},Y=Q=>{A.current&&Z(Q.clientX,Q.clientY),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),document.removeEventListener("pointermove",J)},ot=Q=>{if(A.current){if(Q.changedTouches.length>0){const ut=Q.changedTouches[0];Z(ut.clientX,ut.clientY)}document.removeEventListener("touchend",ot),document.removeEventListener("touchcancel",ot),document.removeEventListener("touchmove",nt)}},ht=Q=>{A.current={x:Q.clientX,y:Q.clientY},z.current=!1,document.addEventListener("pointermove",J,{passive:!1}),document.addEventListener("pointerup",Y),document.addEventListener("pointercancel",Y)},lt=Q=>{Q.touches.length>0&&(A.current={x:Q.touches[0].clientX,y:Q.touches[0].clientY},z.current=!1,document.addEventListener("touchmove",nt,{passive:!1}),document.addEventListener("touchend",ot),document.addEventListener("touchcancel",ot))};return x.addEventListener("pointerdown",ht),x.addEventListener("touchstart",lt),()=>{x.removeEventListener("pointerdown",ht),x.removeEventListener("touchstart",lt),document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),document.removeEventListener("touchmove",nt),document.removeEventListener("touchend",ot),document.removeEventListener("touchcancel",ot),A.current=null,z.current=!1}},[t,St,l]);const Pt={backgroundColor:I.color,backdropFilter:`blur(${I.blur}px)`,animationDuration:`${parseInt(D.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"};return typeof document>"u"||!document.getElementById(a)?null:Lr.createPortal(p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:i?null:$,className:yt(N.background,b?et:it,{[N.editor]:i},{[N.hidden]:!t}),style:{...Pt,...u&&!i&&!b?{position:"absolute"}:{}}}),p.jsxs("div",{ref:i?$:null,className:yt(N.contentStyle,b?st:X,{[N.editor]:i},{[N.hidden]:!t}),style:{animationDuration:`${parseInt(D.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"},children:[p.jsx(er,{onMove:x=>d(x.index),ref:v,className:N.lightboxSplide,options:{arrows:!1,speed:h.duration?parseInt(h.duration):500,direction:h.direction==="horiz"||h.type==="fade"||h.type==="scale"?"ltr":"ttb",pagination:!1,drag:H.type==="drag"&&!St,perPage:1,width:"100%",height:"100%",type:h.type==="fade"||h.type==="scale"?"fade":"loop",padding:0,rewind:H.repeat!=="close",start:0},style:{"--splide-speed":h.duration},children:n.map((x,G)=>{const q=qe(P.position,P.offset,i),J=`${E.scalingValue(P.padding.top,i)} ${E.scalingValue(P.padding.right,i)} ${E.scalingValue(P.padding.bottom,i)} ${E.scalingValue(P.padding.left,i)}`,nt=h.type==="scale"?(()=>{const{transform:Z,...Y}=q;return{...Y,position:"absolute",padding:J,boxSizing:"border-box","--position-transform":Z||"none"}})():{...q,position:"absolute",padding:J,boxSizing:"border-box"};return p.jsx(nr,{children:p.jsx("div",{className:N.imgWrapper,onClick:ct,children:p.jsx("img",{ref:G===s?M:null,className:yt(N.imageStyle,{[N.contain]:x.image.objectFit==="contain",[N.cover]:x.image.objectFit==="cover",[N.scaleSlide]:h.type==="scale"}),src:x.image.url,alt:x.image.name??"",style:{...nt,pointerEvents:x.image.objectFit==="contain"?"none":"auto"}})})},G)})},l),F.isActive&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:yt(N.arrow,{[N.arrowVertical]:h.direction==="vert"}),style:{color:F.color,"--arrow-hover-color":F.hover},children:p.jsxs("button",{className:N.arrowInner,style:{transform:`translate(${E.scalingValue(F.offset.x,i)}, ${E.scalingValue(F.offset.y*(h.direction==="horiz"?1:-1),i)}) scale(${F.scale}) rotate(${h.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var x;return(x=v.current)==null?void 0:x.go("-1")},"aria-label":"Previous",children:[F.arrowsImgUrl&&p.jsx(be,{url:F.arrowsImgUrl,fill:F.color,hoverFill:F.hover,className:yt(N.arrowImg,N.mirror)}),!F.arrowsImgUrl&&p.jsx(_r,{color:F.color,className:yt(N.arrowIcon,N.arrowImg,N.mirror)})]})}),p.jsx("div",{className:yt(N.arrow,N.nextArrow,{[N.arrowVertical]:h.direction==="vert"}),style:{color:F.color,"--arrow-hover-color":F.hover},children:p.jsxs("button",{className:N.arrowInner,style:{transform:`translate(${E.scalingValue(F.offset.x*(h.direction==="horiz"?-1:1),i)}, ${E.scalingValue(F.offset.y,i)}) scale(${F.scale}) rotate(${h.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var x;return(x=v.current)==null?void 0:x.go("+1")},"aria-label":"Next",children:[F.arrowsImgUrl&&p.jsx(be,{url:F.arrowsImgUrl,fill:F.color,hoverFill:F.hover,className:N.arrowImg}),!F.arrowsImgUrl&&p.jsx(_r,{color:F.color,className:yt(N.arrowIcon,N.arrowImg)})]})})]}),I.closeIconUrl&&(()=>{const x=qe(I.closeIconAlign,I.closeIconOffset,i),G=`scale(${I.closeIconScale})`,q=x.transform?`${x.transform} ${G}`:G;return p.jsx("button",{className:N.closeButton,style:{...x,transform:q},onClick:K,"aria-label":"Close lightbox",children:p.jsx(be,{url:I.closeIconUrl,fill:I.closeIconColor??"#000000",hoverFill:I.closeIconHover??"#cccccc"})})})(),_&&_.isActive&&r.imageCaption&&((j=n[s])==null?void 0:j.imageCaption)&&(()=>{const{widthSettings:x,fontSettings:G,letterSpacing:q,textAlign:J,wordSpacing:nt,fontSizeLineHeight:Z,textAppearance:Y,color:ot}=r.imageCaption;return p.jsx("div",{className:N.caption,style:{...qe(_.alignment,_.offset,i),fontFamily:G.fontFamily,fontWeight:G.fontWeight,fontStyle:G.fontStyle,width:x.sizing==="auto"?"max-content":E.scalingValue(x.width,i),letterSpacing:E.scalingValue(q,i),wordSpacing:E.scalingValue(nt,i),textAlign:J,fontSize:E.scalingValue(Z.fontSize,i),lineHeight:E.scalingValue(Z.lineHeight,i),textTransform:Y.textTransform??"none",textDecoration:Y.textDecoration??"none",fontVariant:Y.fontVariant??"normal",color:ot},onClick:ht=>ht.stopPropagation(),children:p.jsx("div",{"data-styles":"imageCaption",className:N.captionTextInner,style:{"--link-color":_.linkColor,"--link-hover-color":_.linkHoverColor},children:p.jsx(uo,{content:n[s].imageCaption})})})})(),O.isActive&&(()=>{const[x,G]=O.position.split("-"),q=h.direction==="horiz"?`${x}-left`:O.position,J=qe(q,O.offset,i),nt=()=>{if(h.direction==="horiz"){if(G==="left")return"flex-start";if(G==="center")return"center";if(G==="right")return"flex-end"}else{if(x==="top")return"flex-start";if(x==="middle")return"center";if(x==="bottom")return"flex-end"}return"flex-start"};return p.jsx("div",{ref:L,className:N.thumbsWrapper,onClick:Z=>dt(Z),style:{position:i?"absolute":"fixed",...J,...h.direction==="horiz"?{maxWidth:"100vw",width:"100%",overflowX:"auto",overflowY:"hidden"}:{maxHeight:"100vh",overflowY:"auto",overflowX:"hidden"}},children:p.jsx("div",{className:yt(N.thumbsContainer,{[N.thumbsContainerVertical]:h.direction==="vert",[N.thumbsAlignStart]:O.align==="start",[N.thumbsAlignCenter]:O.align==="center",[N.thumbsAlignEnd]:O.align==="end"}),style:{gap:E.scalingValue(O.grid.gap,i),justifyContent:k?"flex-start":nt()},children:n.map((Z,Y)=>{const ot=Y===s,ht=S[Y],gt=O.grid.size*(ot?O.activeState.scale:1),wt=()=>{if(O.fit!=="fit")return{};if(!ht)return h.direction==="horiz"?{height:E.scalingValue(gt,i)}:{width:E.scalingValue(gt,i)};const Q=ht.width/ht.height;if(h.direction==="horiz"){const ut=gt,xt=ut*Q;return{width:E.scalingValue(xt,i),height:E.scalingValue(ut,i)}}else{const ut=gt,xt=ut/Q;return{width:E.scalingValue(ut,i),height:E.scalingValue(xt,i)}}};return p.jsx("button",{className:N.thumbItem,style:{...h.direction==="horiz"&&O.fit!=="fit"?{height:E.scalingValue(gt,i)}:{},...h.direction==="vert"&&O.fit!=="fit"?{width:E.scalingValue(gt,i)}:{},...O.fit==="cover"?{width:E.scalingValue(gt,i),height:E.scalingValue(gt,i)}:{},...wt(),transition:ot?"all 0.25s ease-out":"none",opacity:ot?O.activeState.opacity/100:O.opacity/100,"--thumb-hover":O.activeState.opacity/100},onClick:Q=>{var ut;Q.stopPropagation(),d(Y),(ut=v.current)==null||ut.go(Y)},onMouseEnter:()=>{var Q;O.triggers==="hov"&&((Q=v.current)==null||Q.go(Y))},children:p.jsx("img",{src:Z.image.url,alt:Z.image.name??"",onLoad:Q=>{const ut=Q.currentTarget;ut.naturalWidth&&ut.naturalHeight&&y(xt=>({...xt,[Y]:{width:ut.naturalWidth,height:ut.naturalHeight}}))},style:{objectFit:O.fit==="cover"?"cover":"contain",...O.fit==="fit"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{},...O.fit==="cover"?{width:"100%",height:"100%"}:{}}})},`${Z.image.name}-${Y}`)})})})})()]})]}),document.getElementById(a))};function _r({color:t,className:e}){return p.jsx("svg",{viewBox:"0 0 10 18",className:e,children:p.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:p.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:t,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}const xl={element:vl,id:"lightbox",name:"Lightbox",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/lightboxImg.png"},defaultSize:{width:440,height:550},fontSettingsPaths:{content:[],parameters:[{path:"styles.imageCaption.fontSettings"}]},assetsPaths:{content:[{path:"image.url",placeholderEnabled:!0}],parameters:[{path:"settings.thumbnailBlock.cover.url",placeholderEnabled:!0},{path:"settings.controls.arrowsImgUrl"},{path:"settings.area.closeIconUrl"}]},schema:{type:"object",properties:{settings:{type:"object",properties:{thumbnailBlock:{display:{type:"settings-block",triggerEvent:"close"},type:"object",properties:{cover:{title:"COVER",icon:"cover",tooltip:"Cover Image",type:"object",properties:{url:{type:"string",display:{type:"cover-image-input"}}}}}},lightboxBlock:{display:{type:"settings-block",triggerEvent:"open"},type:"object",properties:{appear:{title:"APPEAR",icon:"transition",tooltip:"Appearance",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["slide in","fade in","mix"]},duration:{type:"string",label:"T",display:{type:"step-selector"},enum:["100ms","250ms","500ms","1000ms","1500ms","2000ms"]},direction:{type:"string",title:"From",display:{type:"direction-control"},enum:["top","left","right","bottom"]}}},triggers:{title:"TRIGGERS",icon:"target",tooltip:"Triggers",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["click","drag"]},switch:{type:"string",display:{type:"ratio-group"},enum:["image","50/50"]},repeat:{type:"string",title:"Repeat",display:{visible:!1,type:"ratio-group"},enum:["close","loop"]}}},slider:{title:"SLIDER",icon:"horizontal-resize",tooltip:"Slider",type:"object",properties:{type:{type:"string",display:{type:"ratio-group"},enum:["slide","fade","scale"]},direction:{type:"string",display:{type:"ratio-group"},enum:["horiz","vert"]},duration:{type:"string",label:"T",display:{type:"step-selector"},enum:["100ms","250ms","500ms","1000ms","1500ms","2000ms"]}}},thumbnail:{title:"THUMB",icon:"thumbnail",tooltip:"Thumbnail",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},position:{display:{type:"align-grid"},type:"string",enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},fit:{type:"string",display:{type:"ratio-group"},enum:["cover","fit"]},align:{type:"string",title:"Align",display:{type:"align-group",direction:"horizontal"},enum:["start","center","end"]},triggers:{type:"string",title:"Triggers",display:{type:"ratio-group",direction:"horizontal"},enum:["clk","hov"]},grid:{type:"object",title:"Grid",display:{type:"group"},properties:{size:{type:"number",label:"Box",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},gap:{type:"number",label:"Gap",scalingEnabled:!0,min:0,display:{type:"numeric-input"}}}},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},opacity:{type:"number",title:"Opacity",label:"icon:opacity",min:0,max:100,step:1,display:{type:"numeric-input"}},activeState:{type:"object",title:"ACTIVE",display:{type:"group"},properties:{scale:{type:"number",title:"Scale",min:1,max:5,step:.1,display:{type:"range-control"}},opacity:{type:"number",title:"Opacity",label:"icon:opacity",min:0,max:100,step:1,display:{type:"numeric-input"}}}}}},layout:{title:"LAYOUT",icon:"layout",tooltip:"Layout",type:"object",properties:{position:{display:{type:"align-grid"},type:"string",enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},offset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},padding:{type:"object",title:"Padding",display:{type:"padding-controls"},properties:{top:{min:0,step:1,type:"number"},left:{min:0,step:1,type:"number"},right:{min:0,step:1,type:"number"},bottom:{min:0,step:1,type:"number"}}}}},controls:{title:"CONTROLS",icon:"controls",tooltip:"Controls",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},arrowsImgUrl:{type:["string","null"],display:{type:"settings-image-input"}},offset:{title:"Offset",type:"object",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},scale:{type:"number",title:"Scale",min:.5,max:5,step:.1,display:{type:"range-control"}},color:{title:"Color",type:"string",display:{type:"settings-color-picker",format:"single"}},hover:{title:"Hover",type:"string",display:{type:"settings-color-picker",format:"single"}}}},area:{title:"AREA",icon:"area",tooltip:"Area",type:"object",properties:{color:{type:"string",display:{type:"settings-color-picker",format:"single"}},blur:{type:"number",label:"icon:blur",display:{type:"numeric-input"}},closeIconUrl:{type:["string","null"],title:"Close Icon",display:{type:"settings-image-input"}},closeIconAlign:{display:{type:"align-grid",direction:"horizontal"},type:"string",enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},closeIconScale:{type:"number",title:"Scale",min:.5,max:5,step:.1,display:{type:"range-control"}},closeIconOffset:{type:"object",title:"Offset",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},closeIconColor:{title:"Color",type:"string",display:{type:"settings-color-picker",format:"single"}},closeIconHover:{title:"Hover",type:"string",display:{type:"settings-color-picker",format:"single"}}}},caption:{title:"DESC",icon:"text-icon",tooltip:"Description",type:"object",properties:{isActive:{type:"boolean",display:{type:"setting-toggle"}},alignment:{type:"string",display:{type:"align-grid"},enum:["top-left","top-center","top-right","middle-left","middle-center","middle-right","bottom-left","bottom-center","bottom-right"]},offset:{title:"Offset",type:"object",display:{type:"group"},properties:{x:{type:"number",label:"X",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}},y:{type:"number",label:"Y",scalingEnabled:!0,display:{type:"numeric-input",visible:!0}}}},linkColor:{title:"Link",type:"string",display:{type:"settings-color-picker",format:"single"}},linkHoverColor:{title:"Link Hov",type:"string",display:{type:"settings-color-picker",format:"single"}}}}}}},default:{d:{thumbnailBlock:{cover:{url:"https://cdn.cntrl.site/component-assets/Cover.jpg"}},lightboxBlock:{appear:{type:"slide in",duration:"1000ms",direction:"bottom"},triggers:{type:"click",switch:"image",repeat:"loop"},slider:{type:"slide",direction:"vert",duration:"1000ms"},thumbnail:{isActive:!0,position:"middle-left",fit:"fit",align:"start",triggers:"hov",grid:{size:.05,gap:.01},offset:{x:.01,y:0},opacity:50,activeState:{scale:1,opacity:100}},layout:{position:"middle-center",offset:{x:0,y:0},padding:{top:.06,right:0,bottom:.06,left:0}},controls:{isActive:!1,arrowsImgUrl:null,offset:{x:0,y:0},scale:1,color:"#000000",hover:"#cccccc"},area:{color:"rgba(28,31,34,0.9)",blur:0,closeIconUrl:null,closeIconColor:"#000000",closeIconHover:"#cccccc",closeIconAlign:"top-right",closeIconOffset:{x:0,y:0},closeIconScale:1},caption:{isActive:!0,alignment:"middle-center",offset:{x:0,y:0},linkColor:"#cccccc",linkHoverColor:"#cccccc"}}},m:{thumbnailBlock:{cover:{url:"https://cdn.cntrl.site/component-assets/Cover.jpg"}},lightboxBlock:{appear:{type:"fade in",duration:"500ms",direction:"bottom"},triggers:{type:"click",switch:"image",repeat:"loop"},slider:{type:"slide",direction:"horiz",duration:"1000ms"},thumbnail:{isActive:!0,position:"bottom-center",fit:"fit",align:"start",triggers:"hov",grid:{size:.1,gap:.05},offset:{x:.01,y:-.05},opacity:50,activeState:{scale:1,opacity:100}},layout:{position:"middle-center",offset:{x:0,y:0},padding:{top:.06,right:.05,bottom:.06,left:.05}},controls:{isActive:!1,arrowsImgUrl:null,offset:{x:0,y:0},scale:1,color:"#000000",hover:"#cccccc"},area:{color:"rgba(28,31,34,0.9)",blur:0,closeIconUrl:null,closeIconColor:"#000000",closeIconHover:"#cccccc",closeIconAlign:"top-right",closeIconOffset:{x:0,y:0},closeIconScale:1},caption:{isActive:!0,alignment:"middle-center",offset:{x:0,y:0},hover:"#cccccc"}}},t:{thumbnailBlock:{cover:{url:"https://cdn.cntrl.site/component-assets/Cover.jpg"}},lightboxBlock:{appear:{type:"fade in",duration:"500ms",direction:"bottom"},triggers:{type:"click",switch:"image",repeat:"loop"},slider:{type:"slide",direction:"vert",duration:"1000ms"},thumbnail:{isActive:!0,position:"middle-left",fit:"fit",align:"start",triggers:"hov",grid:{size:.05,gap:.01},offset:{x:.03,y:0},opacity:50,activeState:{scale:1,opacity:100}},layout:{position:"middle-center",offset:{x:0,y:0},padding:{top:.06,right:.1,bottom:.06,left:.1}},controls:{isActive:!1,arrowsImgUrl:null,offset:{x:0,y:0},scale:1,color:"#000000",hover:"#cccccc"},area:{color:"rgba(28,31,34,0.9)",blur:0,closeIconUrl:null,closeIconColor:"#000000",closeIconHover:"#cccccc",closeIconAlign:"top-right",closeIconOffset:{x:0,y:0},closeIconScale:1},caption:{isActive:!0,alignment:"middle-center",offset:{x:0,y:0},hover:"#cccccc"}}}},displayRules:[{if:{name:"lightboxBlock.appear.type",value:"slide in"},then:{name:"properties.lightboxBlock.properties.appear.properties.direction.display.visible",value:!0}},{if:{name:"lightboxBlock.slider.direction",value:"vert"},then:{name:"properties.lightboxBlock.properties.thumbnail.properties.align.display.direction",value:"vertical"}},{if:{name:"lightboxBlock.appear.type",value:"mix"},then:{name:"properties.lightboxBlock.properties.appear.properties.direction.display.visible",value:!0}},{if:{name:"lightboxBlock.appear.type",value:"fade in"},then:{name:"properties.lightboxBlock.properties.appear.properties.direction.display.visible",value:!1}},{if:[{name:"lightboxBlock.triggers.type",value:"click"},{name:"lightboxBlock.triggers.switch",value:"image"}],then:{name:"properties.lightboxBlock.properties.triggers.properties.repeat.display.visible",value:!0}}]},content:{type:"array",settings:{addItemFromFileExplorer:!0},items:{type:"object",properties:{image:{type:"object",label:"Image",display:{type:"media-input"},properties:{url:{type:"string"},name:{type:"string"},objectFit:{type:"string",enum:["cover","contain"]}},required:["url","name"]},imageCaption:{label:"Description",placeholder:"Add Caption...",display:{type:"rich-text"}}},required:["image"]},default:[{image:{objectFit:"contain",url:"https://cdn.cntrl.site/component-assets/2.jpg",name:"Slider-1.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"contain",url:"https://cdn.cntrl.site/component-assets/3.jpg",name:"Slider-2.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]},{image:{objectFit:"contain",url:"https://cdn.cntrl.site/component-assets/4.jpg",name:"Slider-3.png"},imageCaption:[{type:"paragraph",children:[{text:""}]}]}]},styles:{type:"object",properties:{imageCaption:{dataName:"caption",type:"object",properties:{fontSettings:{type:"object",display:{type:"font-settings"},properties:{fontFamily:{type:"string"},fontWeight:{type:"number"},fontStyle:{type:"string"}}},widthSettings:{display:{type:"text-width-control"},type:"object",properties:{width:{type:"number"},sizing:{type:"string",enum:["auto","manual"]}}},fontSizeLineHeight:{type:"object",display:{type:"font-size-line-height"},properties:{fontSize:{type:"number"},lineHeight:{type:"number"}}},letterSpacing:{display:{type:"letter-spacing-input"},type:"number"},wordSpacing:{display:{type:"word-spacing-input"},type:"number"},textAlign:{display:{type:"text-align-control"},type:"string",enum:["left","center","right","justify"]},textAppearance:{display:{type:"text-appearance"},properties:{textTransform:{type:"string",enum:["none","uppercase","lowercase","capitalize"]},textDecoration:{type:"string",enum:["none","underline"]},fontVariant:{type:"string",enum:["normal","small-caps"]}}},color:{display:{type:"style-panel-color-picker"},type:"string"}}}},default:{imageCaption:{widthSettings:{width:.13,sizing:"auto"},fontSettings:{fontFamily:"Arial",fontWeight:400,fontStyle:"normal"},fontSizeLineHeight:{fontSize:.02,lineHeight:.02},letterSpacing:0,wordSpacing:0,textAlign:"left",textAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},color:"#000000"}}}},required:["settings","content","styles"]}};function Zt(t){const{color:e,...n}=t;return n}function Gt(t,e){var n,r,o;return{fontFamily:t.fontSettings.fontFamily,fontWeight:t.fontSettings.fontWeight,fontStyle:t.fontSettings.fontStyle,letterSpacing:E.scalingValue(t.letterSpacing,e),wordSpacing:E.scalingValue(t.wordSpacing,e),fontSize:E.scalingValue(t.fontSize,e),lineHeight:t.lineHeight!==void 0?E.scalingValue(t.lineHeight,e):void 0,textTransform:(n=t.textAppearance)==null?void 0:n.textTransform,textDecoration:(r=t.textAppearance)==null?void 0:r.textDecoration,fontVariant:(o=t.textAppearance)==null?void 0:o.fontVariant,color:t.color}}function Ye(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function Cl(t){return`
|
|
7
|
+
.${t}-wrapper {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
width: 100%;
|
|
11
|
-
min-height: ${
|
|
11
|
+
min-height: ${Ye(48)};
|
|
12
12
|
}
|
|
13
|
-
.${
|
|
14
|
-
.${
|
|
13
|
+
.${t}-wrapper.${t}-type-C .${t}-input:focus-visible,
|
|
14
|
+
.${t}-wrapper.${t}-type-C .${t}-button:focus-visible {
|
|
15
15
|
outline: none;
|
|
16
16
|
}
|
|
17
|
-
.${
|
|
17
|
+
.${t}-form {
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-direction: column;
|
|
20
20
|
width: 100%;
|
|
21
21
|
}
|
|
22
|
-
.${
|
|
22
|
+
.${t}-fields {
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
flex: 1;
|
|
26
26
|
min-width: 0;
|
|
27
27
|
}
|
|
28
|
-
.${
|
|
28
|
+
.${t}-field-group {
|
|
29
29
|
display: flex;
|
|
30
30
|
flex-direction: column;
|
|
31
31
|
flex: 1;
|
|
32
32
|
min-width: 0;
|
|
33
33
|
}
|
|
34
|
-
.${
|
|
35
|
-
gap: ${
|
|
34
|
+
.${t}-field-group.${t}-labeled {
|
|
35
|
+
gap: ${Ye(4)};
|
|
36
36
|
}
|
|
37
|
-
.${
|
|
37
|
+
.${t}-field-label {
|
|
38
38
|
white-space: nowrap;
|
|
39
|
-
color: var(--${
|
|
39
|
+
color: var(--${t}-label-text-color);
|
|
40
40
|
}
|
|
41
|
-
.${
|
|
41
|
+
.${t}-input {
|
|
42
42
|
width: 100%;
|
|
43
43
|
box-sizing: border-box;
|
|
44
44
|
outline: none;
|
|
45
45
|
-webkit-tap-highlight-color: transparent;
|
|
46
|
-
background-color: var(--${
|
|
47
|
-
color: var(--${
|
|
48
|
-
border-color: var(--${
|
|
46
|
+
background-color: var(--${t}-input-color);
|
|
47
|
+
color: var(--${t}-input-text-color);
|
|
48
|
+
border-color: var(--${t}-input-border-color);
|
|
49
49
|
transition: color 250ms, border-color 250ms, background-color 250ms;
|
|
50
50
|
}
|
|
51
|
-
.${
|
|
52
|
-
color: var(--${
|
|
51
|
+
.${t}-input::placeholder {
|
|
52
|
+
color: var(--${t}-placeholder-color);
|
|
53
53
|
opacity: 1;
|
|
54
54
|
transition: color 250ms, opacity 250ms;
|
|
55
55
|
}
|
|
56
|
-
.${
|
|
57
|
-
background-color: var(--${
|
|
58
|
-
color: var(--${
|
|
59
|
-
border-color: var(--${
|
|
60
|
-
}
|
|
61
|
-
.${
|
|
62
|
-
background-color: var(--${
|
|
63
|
-
color: var(--${
|
|
64
|
-
border-color: var(--${
|
|
65
|
-
}
|
|
66
|
-
.${
|
|
67
|
-
.${
|
|
68
|
-
.${
|
|
69
|
-
background-color: var(--${
|
|
70
|
-
color: var(--${
|
|
71
|
-
border-color: var(--${
|
|
72
|
-
}
|
|
73
|
-
.${
|
|
74
|
-
background-color: var(--${
|
|
75
|
-
color: var(--${
|
|
76
|
-
border-color: var(--${
|
|
77
|
-
}
|
|
78
|
-
.${
|
|
79
|
-
background-color: var(--${
|
|
80
|
-
color: var(--${
|
|
81
|
-
border-color: var(--${
|
|
82
|
-
}
|
|
83
|
-
.${
|
|
84
|
-
.${
|
|
56
|
+
.${t}-input:hover {
|
|
57
|
+
background-color: var(--${t}-hover-input-color, var(--${t}-input-color));
|
|
58
|
+
color: var(--${t}-hover-input-text-color, var(--${t}-input-text-color));
|
|
59
|
+
border-color: var(--${t}-hover-input-border-color, var(--${t}-input-border-color));
|
|
60
|
+
}
|
|
61
|
+
.${t}-wrapper.${t}-state-hover .${t}-input {
|
|
62
|
+
background-color: var(--${t}-hover-input-color, var(--${t}-input-color));
|
|
63
|
+
color: var(--${t}-hover-input-text-color, var(--${t}-input-text-color));
|
|
64
|
+
border-color: var(--${t}-hover-input-border-color, var(--${t}-input-border-color));
|
|
65
|
+
}
|
|
66
|
+
.${t}-input:focus,
|
|
67
|
+
.${t}-input:focus-visible,
|
|
68
|
+
.${t}-wrapper.${t}-state-focus .${t}-input {
|
|
69
|
+
background-color: var(--${t}-focus-input-color, var(--${t}-input-color));
|
|
70
|
+
color: var(--${t}-focus-input-text-color, var(--${t}-input-text-color));
|
|
71
|
+
border-color: var(--${t}-focus-input-border-color, var(--${t}-input-border-color));
|
|
72
|
+
}
|
|
73
|
+
.${t}-input[data-filled="true"] {
|
|
74
|
+
background-color: var(--${t}-filled-input-color, var(--${t}-input-color));
|
|
75
|
+
color: var(--${t}-filled-input-text-color, var(--${t}-input-text-color));
|
|
76
|
+
border-color: var(--${t}-filled-input-border-color, var(--${t}-input-border-color));
|
|
77
|
+
}
|
|
78
|
+
.${t}-wrapper.${t}-state-filled .${t}-button {
|
|
79
|
+
background-color: var(--${t}-filled-button-color, var(--${t}-button-color));
|
|
80
|
+
color: var(--${t}-filled-button-text-color, var(--${t}-button-text-color));
|
|
81
|
+
border-color: var(--${t}-filled-button-border-color, var(--${t}-button-border-color));
|
|
82
|
+
}
|
|
83
|
+
.${t}-wrapper.${t}-state-success .${t}-input,
|
|
84
|
+
.${t}-wrapper.${t}-state-success .${t}-button {
|
|
85
85
|
pointer-events: none;
|
|
86
86
|
}
|
|
87
|
-
.${
|
|
87
|
+
.${t}-wrapper.${t}-state-error .${t}-input {
|
|
88
88
|
}
|
|
89
|
-
.${
|
|
89
|
+
.${t}-input[data-field-type="textarea"] {
|
|
90
90
|
resize: vertical;
|
|
91
91
|
}
|
|
92
|
-
.${
|
|
92
|
+
.${t}-input:disabled {
|
|
93
93
|
cursor: not-allowed;
|
|
94
94
|
}
|
|
95
|
-
.${
|
|
95
|
+
.${t}-button {
|
|
96
96
|
cursor: pointer;
|
|
97
97
|
white-space: nowrap;
|
|
98
98
|
box-sizing: border-box;
|
|
99
99
|
outline: none;
|
|
100
|
-
background-color: var(--${
|
|
101
|
-
color: var(--${
|
|
102
|
-
border-color: var(--${
|
|
100
|
+
background-color: var(--${t}-button-color);
|
|
101
|
+
color: var(--${t}-button-text-color);
|
|
102
|
+
border-color: var(--${t}-button-border-color);
|
|
103
103
|
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
104
104
|
}
|
|
105
|
-
.${
|
|
106
|
-
background-color: var(--${
|
|
107
|
-
color: var(--${
|
|
108
|
-
border-color: var(--${
|
|
109
|
-
}
|
|
110
|
-
.${
|
|
111
|
-
background-color: var(--${
|
|
112
|
-
color: var(--${
|
|
113
|
-
border-color: var(--${
|
|
114
|
-
}
|
|
115
|
-
.${
|
|
116
|
-
.${
|
|
117
|
-
.${
|
|
118
|
-
background-color: var(--${
|
|
119
|
-
color: var(--${
|
|
120
|
-
border-color: var(--${
|
|
121
|
-
}
|
|
122
|
-
.${
|
|
123
|
-
.${
|
|
105
|
+
.${t}-button:hover {
|
|
106
|
+
background-color: var(--${t}-hover-button-color, var(--${t}-button-color));
|
|
107
|
+
color: var(--${t}-hover-button-text-color, var(--${t}-button-text-color));
|
|
108
|
+
border-color: var(--${t}-hover-button-border-color, var(--${t}-button-border-color));
|
|
109
|
+
}
|
|
110
|
+
.${t}-wrapper.${t}-state-hover .${t}-button {
|
|
111
|
+
background-color: var(--${t}-hover-button-color, var(--${t}-button-color));
|
|
112
|
+
color: var(--${t}-hover-button-text-color, var(--${t}-button-text-color));
|
|
113
|
+
border-color: var(--${t}-hover-button-border-color, var(--${t}-button-border-color));
|
|
114
|
+
}
|
|
115
|
+
.${t}-button:focus,
|
|
116
|
+
.${t}-button:focus-visible,
|
|
117
|
+
.${t}-wrapper.${t}-state-focus .${t}-button {
|
|
118
|
+
background-color: var(--${t}-focus-button-color, var(--${t}-button-color));
|
|
119
|
+
color: var(--${t}-focus-button-text-color, var(--${t}-button-text-color));
|
|
120
|
+
border-color: var(--${t}-focus-button-border-color, var(--${t}-button-border-color));
|
|
121
|
+
}
|
|
122
|
+
.${t}-input:focus-visible,
|
|
123
|
+
.${t}-wrapper.${t}-state-focus .${t}-input {
|
|
124
124
|
outline: none;
|
|
125
125
|
}
|
|
126
|
-
.${
|
|
127
|
-
.${
|
|
126
|
+
.${t}-button:focus-visible,
|
|
127
|
+
.${t}-wrapper.${t}-state-focus .${t}-button {
|
|
128
128
|
outline: none;
|
|
129
129
|
}
|
|
130
|
-
.${
|
|
131
|
-
margin-top: ${
|
|
132
|
-
color: var(--${
|
|
130
|
+
.${t}-success {
|
|
131
|
+
margin-top: ${Ye(8)};
|
|
132
|
+
color: var(--${t}-success-success-color, var(--${t}-success-color));
|
|
133
133
|
}
|
|
134
|
-
.${
|
|
135
|
-
margin-top: ${
|
|
136
|
-
color: var(--${
|
|
134
|
+
.${t}-error {
|
|
135
|
+
margin-top: ${Ye(8)};
|
|
136
|
+
color: var(--${t}-error-error-color, var(--${t}-error-color));
|
|
137
137
|
}
|
|
138
|
-
.${
|
|
138
|
+
.${t}-overlay-anchor {
|
|
139
139
|
position: relative;
|
|
140
140
|
height: auto;
|
|
141
141
|
}
|
|
142
|
-
`}function
|
|
143
|
-
import { CommonComponentProps } from '../props'
|
|
144
|
-
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index'
|
|
145
|
-
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss'
|
|
146
|
-
|
|
147
|
-
function sv(px: number): string {
|
|
148
|
-
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function getCSS(P: string): string {
|
|
152
|
-
return
|
|
153
|
-
.\${P}-wrapper {
|
|
154
|
-
display: flex
|
|
155
|
-
flex-direction: column
|
|
156
|
-
width: 100
|
|
157
|
-
min-height: \${sv(48)}
|
|
158
|
-
}
|
|
159
|
-
.\${P}-wrapper.\${P}-type-C .\${P}-input:focus-visible
|
|
160
|
-
.\${P}-wrapper.\${P}-type-C .\${P}-button:focus-visible {
|
|
161
|
-
outline: none
|
|
162
|
-
}
|
|
163
|
-
.\${P}-form {
|
|
164
|
-
display: flex
|
|
165
|
-
flex-direction: column
|
|
166
|
-
width: 100
|
|
167
|
-
}
|
|
168
|
-
.\${P}-fields {
|
|
169
|
-
display: flex
|
|
170
|
-
flex-direction: column
|
|
171
|
-
flex: 1
|
|
172
|
-
min-width: 0
|
|
173
|
-
}
|
|
174
|
-
.\${P}-field-group {
|
|
175
|
-
display: flex
|
|
176
|
-
flex-direction: column
|
|
177
|
-
flex: 1
|
|
178
|
-
min-width: 0
|
|
179
|
-
}
|
|
180
|
-
.\${P}-field-group.\${P}-labeled {
|
|
181
|
-
gap: \${sv(4)}
|
|
182
|
-
}
|
|
183
|
-
.\${P}-field-label {
|
|
184
|
-
white-space: nowrap
|
|
185
|
-
color: var(--\${P}-label-text-color)
|
|
186
|
-
}
|
|
187
|
-
.\${P}-input {
|
|
188
|
-
width: 100
|
|
189
|
-
box-sizing: border-box
|
|
190
|
-
outline: none
|
|
191
|
-
-webkit-tap-highlight-color: transparent
|
|
192
|
-
background-color: var(--\${P}-input-color)
|
|
193
|
-
color: var(--\${P}-input-text-color)
|
|
194
|
-
border-color: var(--\${P}-input-border-color)
|
|
195
|
-
transition: color 250ms, border-color 250ms, background-color 250ms
|
|
196
|
-
}
|
|
197
|
-
.\${P}-input::placeholder {
|
|
198
|
-
color: var(--\${P}-placeholder-color)
|
|
199
|
-
opacity: 1
|
|
200
|
-
transition: color 250ms, opacity 250ms
|
|
201
|
-
}
|
|
202
|
-
.\${P}-input:hover {
|
|
203
|
-
background-color: var(--\${P}-hover-input-color, var(--\${P}-input-color))
|
|
204
|
-
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color))
|
|
205
|
-
border-color: var(--\${P}-hover-input-border-color, var(--\${P}-input-border-color))
|
|
206
|
-
}
|
|
207
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-input {
|
|
208
|
-
background-color: var(--\${P}-hover-input-color, var(--\${P}-input-color))
|
|
209
|
-
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color))
|
|
210
|
-
border-color: var(--\${P}-hover-input-border-color, var(--\${P}-input-border-color))
|
|
211
|
-
}
|
|
212
|
-
.\${P}-input:focus
|
|
213
|
-
.\${P}-input:focus-visible
|
|
214
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-input {
|
|
215
|
-
background-color: var(--\${P}-focus-input-color, var(--\${P}-input-color))
|
|
216
|
-
color: var(--\${P}-focus-input-text-color, var(--\${P}-input-text-color))
|
|
217
|
-
border-color: var(--\${P}-focus-input-border-color, var(--\${P}-input-border-color))
|
|
218
|
-
}
|
|
219
|
-
.\${P}-input[data-filled="true"] {
|
|
220
|
-
background-color: var(--\${P}-filled-input-color, var(--\${P}-input-color))
|
|
221
|
-
color: var(--\${P}-filled-input-text-color, var(--\${P}-input-text-color))
|
|
222
|
-
border-color: var(--\${P}-filled-input-border-color, var(--\${P}-input-border-color))
|
|
223
|
-
}
|
|
224
|
-
.\${P}-wrapper.\${P}-state-filled .\${P}-button {
|
|
225
|
-
background-color: var(--\${P}-filled-button-color, var(--\${P}-button-color))
|
|
226
|
-
color: var(--\${P}-filled-button-text-color, var(--\${P}-button-text-color))
|
|
227
|
-
border-color: var(--\${P}-filled-button-border-color, var(--\${P}-button-border-color))
|
|
228
|
-
}
|
|
229
|
-
.\${P}-wrapper.\${P}-state-success .\${P}-input
|
|
230
|
-
.\${P}-wrapper.\${P}-state-success .\${P}-button {
|
|
231
|
-
pointer-events: none
|
|
232
|
-
}
|
|
233
|
-
.\${P}-wrapper.\${P}-state-error .\${P}-input {
|
|
234
|
-
}
|
|
235
|
-
.\${P}-input[data-field-type="textarea"] {
|
|
236
|
-
resize: vertical
|
|
237
|
-
}
|
|
238
|
-
.\${P}-input:disabled {
|
|
239
|
-
cursor: not-allowed
|
|
240
|
-
}
|
|
241
|
-
.\${P}-button {
|
|
242
|
-
cursor: pointer
|
|
243
|
-
white-space: nowrap
|
|
244
|
-
box-sizing: border-box
|
|
245
|
-
outline: none
|
|
246
|
-
background-color: var(--\${P}-button-color)
|
|
247
|
-
color: var(--\${P}-button-text-color)
|
|
248
|
-
border-color: var(--\${P}-button-border-color)
|
|
249
|
-
transition: color 250ms, background-color 250ms, border-color 250ms
|
|
250
|
-
}
|
|
251
|
-
.\${P}-button:hover {
|
|
252
|
-
background-color: var(--\${P}-hover-button-color, var(--\${P}-button-color))
|
|
253
|
-
color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color))
|
|
254
|
-
border-color: var(--\${P}-hover-button-border-color, var(--\${P}-button-border-color))
|
|
255
|
-
}
|
|
256
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-button {
|
|
257
|
-
background-color: var(--\${P}-hover-button-color, var(--\${P}-button-color))
|
|
258
|
-
color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color))
|
|
259
|
-
border-color: var(--\${P}-hover-button-border-color, var(--\${P}-button-border-color))
|
|
260
|
-
}
|
|
261
|
-
.\${P}-button:focus
|
|
262
|
-
.\${P}-button:focus-visible
|
|
263
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-button {
|
|
264
|
-
background-color: var(--\${P}-focus-button-color, var(--\${P}-button-color))
|
|
265
|
-
color: var(--\${P}-focus-button-text-color, var(--\${P}-button-text-color))
|
|
266
|
-
border-color: var(--\${P}-focus-button-border-color, var(--\${P}-button-border-color))
|
|
267
|
-
}
|
|
268
|
-
.\${P}-input:focus-visible
|
|
269
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-input {
|
|
270
|
-
outline: none
|
|
271
|
-
}
|
|
272
|
-
.\${P}-button:focus-visible
|
|
273
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-button {
|
|
274
|
-
outline: none
|
|
275
|
-
}
|
|
276
|
-
.\${P}-success {
|
|
277
|
-
margin-top: \${sv(8)}
|
|
278
|
-
color: var(--\${P}-success-success-color, var(--\${P}-success-color))
|
|
279
|
-
}
|
|
280
|
-
.\${P}-error {
|
|
281
|
-
margin-top: \${sv(8)}
|
|
282
|
-
color: var(--\${P}-error-error-color, var(--\${P}-error-color))
|
|
283
|
-
}
|
|
284
|
-
.\${P}-overlay-anchor {
|
|
285
|
-
position: relative
|
|
286
|
-
height: auto
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
type FormProps = {
|
|
292
|
-
settings: FormSettings
|
|
293
|
-
content?: unknown
|
|
294
|
-
isEditor?: boolean
|
|
295
|
-
activeEvent: string | undefined
|
|
296
|
-
onUpdateSettings?: (settings: FormSettings) => void
|
|
297
|
-
} & CommonComponentProps
|
|
298
|
-
|
|
299
|
-
export function Form({ settings, isEditor, metadata, activeEvent }: FormProps) {
|
|
300
|
-
const { prefix: P } = useScopedStyles()
|
|
301
|
-
const {
|
|
302
|
-
type = 'A'
|
|
303
|
-
fieldsToShow = 2
|
|
304
|
-
fields = []
|
|
305
|
-
buttonLabel
|
|
306
|
-
gap
|
|
307
|
-
fieldsGap
|
|
308
|
-
buttonCorners
|
|
309
|
-
buttonStroke
|
|
310
|
-
buttonPadding
|
|
311
|
-
isButtonFullWidth
|
|
312
|
-
inputCorners
|
|
313
|
-
inputStroke
|
|
314
|
-
inputPadding
|
|
315
|
-
inputColor
|
|
316
|
-
inputTextColor
|
|
317
|
-
inputBorderColor
|
|
318
|
-
placeholderColor
|
|
319
|
-
buttonColor
|
|
320
|
-
buttonTextColor
|
|
321
|
-
buttonBorderColor
|
|
322
|
-
labelTextColor
|
|
323
|
-
successColor
|
|
324
|
-
errorColor
|
|
325
|
-
fontFamily
|
|
326
|
-
inputFontSettings
|
|
327
|
-
inputFontSize
|
|
328
|
-
inputLineHeight
|
|
329
|
-
inputLetterSpacing
|
|
330
|
-
inputWordSpacing
|
|
331
|
-
inputTextAppearance
|
|
332
|
-
buttonFontSettings
|
|
333
|
-
buttonFontSize
|
|
334
|
-
buttonLineHeight
|
|
335
|
-
buttonLetterSpacing
|
|
336
|
-
buttonWordSpacing
|
|
337
|
-
buttonTextAppearance
|
|
338
|
-
labelFontSettings
|
|
339
|
-
labelFontSize
|
|
340
|
-
labelLineHeight
|
|
341
|
-
labelLetterSpacing
|
|
342
|
-
labelWordSpacing
|
|
343
|
-
labelTextAppearance
|
|
344
|
-
statusFontSettings
|
|
345
|
-
statusFontSize
|
|
346
|
-
statusLineHeight
|
|
347
|
-
statusLetterSpacing
|
|
348
|
-
statusWordSpacing
|
|
349
|
-
statusTextAppearance
|
|
350
|
-
successMessage
|
|
351
|
-
errorMessage: errorMessageText
|
|
352
|
-
stateOverrides
|
|
353
|
-
} = settings
|
|
354
|
-
|
|
355
|
-
const showLabels = type === 'B'
|
|
356
|
-
const visibleFields = fields.slice(0, Math.min(fieldsToShow, fields.length))
|
|
357
|
-
|
|
358
|
-
const resolvedInputTextStyle: TextStyles = {
|
|
359
|
-
fontSettings: {
|
|
360
|
-
fontFamily
|
|
361
|
-
fontWeight: inputFontSettings?.fontWeight ?? 400
|
|
362
|
-
fontStyle: inputFontSettings?.fontStyle ?? 'normal'
|
|
363
|
-
}
|
|
364
|
-
fontSize: inputFontSize ?? 0.01
|
|
365
|
-
lineHeight: inputLineHeight
|
|
366
|
-
letterSpacing: inputLetterSpacing ?? 0
|
|
367
|
-
wordSpacing: inputWordSpacing ?? 0
|
|
368
|
-
textAppearance: inputTextAppearance
|
|
369
|
-
color: inputTextColor
|
|
370
|
-
}
|
|
371
|
-
const inputTypographyCss = omitTextColors(textStylesToCss(resolvedInputTextStyle, isEditor))
|
|
372
|
-
const strokeForInput = scalingValue(inputStroke ?? 0, isEditor)
|
|
373
|
-
const inputBaseHeight = scalingValue(
|
|
374
|
-
(inputLineHeight ?? inputFontSize ?? 0.01)
|
|
375
|
-
(inputPadding?.top ?? 0)
|
|
376
|
-
(inputPadding?.bottom ?? 0)
|
|
377
|
-
(type === 'C' ? (inputStroke ?? 0) : (inputStroke ?? 0) * 2)
|
|
378
|
-
isEditor
|
|
379
|
-
)
|
|
380
|
-
const inputFieldCss = {
|
|
381
|
-
...inputTypographyCss
|
|
382
|
-
borderStyle: 'solid'
|
|
383
|
-
borderRadius: type === 'C' ? 0 : scalingValue(inputCorners ?? 0, isEditor)
|
|
384
|
-
...(type === 'C'
|
|
385
|
-
? {
|
|
386
|
-
borderTopWidth: 0
|
|
387
|
-
borderRightWidth: 0
|
|
388
|
-
borderBottomWidth: strokeForInput
|
|
389
|
-
borderLeftWidth: 0
|
|
390
|
-
}
|
|
391
|
-
: { borderWidth: strokeForInput })
|
|
392
|
-
paddingTop: scalingValue(inputPadding?.top ?? 0, isEditor)
|
|
393
|
-
paddingRight: scalingValue(inputPadding?.right ?? 0, isEditor)
|
|
394
|
-
paddingBottom: scalingValue(inputPadding?.bottom ?? 0, isEditor)
|
|
395
|
-
paddingLeft: scalingValue(inputPadding?.left ?? 0, isEditor)
|
|
396
|
-
height: inputBaseHeight
|
|
397
|
-
minHeight: inputBaseHeight
|
|
398
|
-
} as React.CSSProperties
|
|
399
|
-
|
|
400
|
-
const resolvedButtonTextStyle: TextStyles = {
|
|
401
|
-
fontSettings: {
|
|
402
|
-
fontFamily
|
|
403
|
-
fontWeight: buttonFontSettings?.fontWeight ?? 400
|
|
404
|
-
fontStyle: buttonFontSettings?.fontStyle ?? 'normal'
|
|
405
|
-
}
|
|
406
|
-
fontSize: buttonFontSize ?? 0.01
|
|
407
|
-
lineHeight: buttonLineHeight
|
|
408
|
-
letterSpacing: buttonLetterSpacing ?? 0
|
|
409
|
-
wordSpacing: buttonWordSpacing ?? 0
|
|
410
|
-
textAppearance: buttonTextAppearance
|
|
411
|
-
color: buttonTextColor
|
|
412
|
-
}
|
|
413
|
-
const buttonTypographyCss = omitTextColors(textStylesToCss(resolvedButtonTextStyle, isEditor))
|
|
414
|
-
const strokeForButton = scalingValue(buttonStroke ?? 0, isEditor)
|
|
415
|
-
|
|
416
|
-
const resolvedLabelTextStyle: TextStyles = {
|
|
417
|
-
fontSettings: {
|
|
418
|
-
fontFamily
|
|
419
|
-
fontWeight: labelFontSettings?.fontWeight ?? 400
|
|
420
|
-
fontStyle: labelFontSettings?.fontStyle ?? 'normal'
|
|
421
|
-
}
|
|
422
|
-
fontSize: labelFontSize ?? 0.01
|
|
423
|
-
lineHeight: labelLineHeight
|
|
424
|
-
letterSpacing: labelLetterSpacing ?? 0
|
|
425
|
-
wordSpacing: labelWordSpacing ?? 0
|
|
426
|
-
textAppearance: labelTextAppearance
|
|
427
|
-
color: labelTextColor
|
|
428
|
-
}
|
|
429
|
-
const labelTextCss = textStylesToCss(resolvedLabelTextStyle, isEditor)
|
|
430
|
-
|
|
431
|
-
const resolvedStatusTextStyle: TextStyles = {
|
|
432
|
-
fontSettings: {
|
|
433
|
-
fontFamily
|
|
434
|
-
fontWeight: statusFontSettings?.fontWeight ?? 400
|
|
435
|
-
fontStyle: statusFontSettings?.fontStyle ?? 'normal'
|
|
436
|
-
}
|
|
437
|
-
fontSize: statusFontSize ?? 0.01
|
|
438
|
-
lineHeight: statusLineHeight
|
|
439
|
-
letterSpacing: statusLetterSpacing ?? 0
|
|
440
|
-
wordSpacing: statusWordSpacing ?? 0
|
|
441
|
-
textAppearance: statusTextAppearance
|
|
442
|
-
color: successColor
|
|
443
|
-
}
|
|
444
|
-
const statusTypographyCss = omitTextColors(textStylesToCss(resolvedStatusTextStyle, isEditor))
|
|
445
|
-
|
|
446
|
-
const colorVars = buildColorVars(P, {
|
|
447
|
-
inputColor
|
|
448
|
-
inputTextColor
|
|
449
|
-
inputBorderColor
|
|
450
|
-
placeholderColor: placeholderColor?.trim() ? placeholderColor : '#cccccc'
|
|
451
|
-
buttonColor
|
|
452
|
-
buttonTextColor
|
|
453
|
-
buttonBorderColor
|
|
454
|
-
labelTextColor
|
|
455
|
-
successColor
|
|
456
|
-
errorColor
|
|
457
|
-
}, COLOR_VAR_MAP, STATE_KEYS, stateOverrides)
|
|
458
|
-
|
|
459
|
-
const [fieldValues, setFieldValues] = useState<Record<string, string>>(()
|
|
460
|
-
Object.fromEntries(visibleFields.map((f) => [f.name, '']))
|
|
461
|
-
)
|
|
462
|
-
const [status, setStatus] = useState<'idle' | 'submitting' | 'success' | 'error'>('idle')
|
|
463
|
-
const [errorMessage, setErrorMessage] = useState<string | null>(null)
|
|
464
|
-
|
|
465
|
-
const displayStatus = activeEvent === 'success' ? 'success'
|
|
466
|
-
: activeEvent === 'error' ? 'error'
|
|
467
|
-
: status
|
|
468
|
-
const displayError = activeEvent === 'error' ? errorMessageText : errorMessage
|
|
469
|
-
const isFilledPreview = activeEvent === 'filled'
|
|
470
|
-
const displayValues = useMemo(() => {
|
|
471
|
-
if (!isFilledPreview) return fieldValues
|
|
472
|
-
|
|
473
|
-
let next: Record<string, string> | null = null
|
|
474
|
-
for (const f of visibleFields) {
|
|
475
|
-
const current = fieldValues[f.name] ?? ''
|
|
476
|
-
if (current.trim().length > 0) continue
|
|
477
|
-
next = next ?? { ...fieldValues }
|
|
478
|
-
next[f.name] = 'Filled'
|
|
479
|
-
}
|
|
480
|
-
return next ?? fieldValues
|
|
481
|
-
}, [fieldValues, isFilledPreview, visibleFields])
|
|
482
|
-
const validationErrorMessage
|
|
483
|
-
displayStatus === 'error'
|
|
484
|
-
? getFormFieldValidationError(visibleFields, displayValues)
|
|
485
|
-
: null
|
|
486
|
-
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : ''
|
|
487
|
-
const wrapperStateClasses = \`\${stateClass}\`.trim()
|
|
488
|
-
|
|
489
|
-
const submitUrl = metadata?.submitUrl as string | undefined
|
|
490
|
-
const handleFieldChange = (name: string, value: string) => {
|
|
491
|
-
setFieldValues((prev) => ({ ...prev, [name]: value }))
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
const handleSubmit = async (e: React.FormEvent) => {
|
|
495
|
-
e.preventDefault()
|
|
496
|
-
const payload = Object.fromEntries(
|
|
497
|
-
visibleFields.map((f) => [f.name, fieldValues[f.name]?.trim() ?? '']).filter(([, v]) => v)
|
|
498
|
-
)
|
|
499
|
-
if (!submitUrl) {
|
|
500
|
-
setStatus('error')
|
|
501
|
-
setErrorMessage('No integrations were found for this form.')
|
|
502
|
-
return
|
|
503
|
-
}
|
|
504
|
-
if (Object.keys(payload).length === 0) return
|
|
505
|
-
|
|
506
|
-
const validationError = getFormFieldValidationError(visibleFields, fieldValues)
|
|
507
|
-
if (validationError) {
|
|
508
|
-
setStatus('error')
|
|
509
|
-
setErrorMessage(validationError)
|
|
510
|
-
return
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
setStatus('submitting')
|
|
514
|
-
setErrorMessage(null)
|
|
515
|
-
|
|
516
|
-
try {
|
|
517
|
-
const res = await fetch(submitUrl, {
|
|
518
|
-
method: 'POST'
|
|
519
|
-
headers: { 'Content-Type': 'application/json' }
|
|
520
|
-
body: JSON.stringify(payload)
|
|
521
|
-
})
|
|
522
|
-
if (!res.ok) {
|
|
523
|
-
const text = await res.text()
|
|
524
|
-
throw new Error(text || \`Request failed: \${res.status}\`)
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
setStatus('success')
|
|
528
|
-
setFieldValues(Object.fromEntries(visibleFields.map((f) => [f.name, ''])))
|
|
529
|
-
} catch (err) {
|
|
530
|
-
setStatus('error')
|
|
531
|
-
setErrorMessage(err instanceof Error ? err.message : 'Something went wrong')
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return (
|
|
536
|
-
<div className={\`\${P}-wrapper \${P}-type-\${type} \${wrapperStateClasses}\`.trim()} style={colorVars}
|
|
537
|
-
<style dangerouslySetInnerHTML={{ __html: getCSS(P) }}
|
|
538
|
-
<form
|
|
539
|
-
onSubmit={handleSubmit}
|
|
540
|
-
className={\`\${P}-form\`}
|
|
541
|
-
style={{ gap: scalingValue(gap ?? 0, isEditor) }}
|
|
542
|
-
|
|
543
|
-
<div
|
|
544
|
-
className={\`\${P}-fields\`}
|
|
545
|
-
style={{ gap: scalingValue(fieldsGap ?? 0, isEditor) }}
|
|
546
|
-
|
|
547
|
-
{visibleFields.map((field, index) => (
|
|
548
|
-
<div key={index} className={\`\${P}-field-group\${showLabels ? \` \${P}-labeled\` : ''}\`}
|
|
549
|
-
{showLabels && (
|
|
550
|
-
<span className={\`\${P}-field-label\`} style={labelTextCss ? { ...labelTextCss, lineHeight: labelTextCss.fontSize } : undefined}
|
|
551
|
-
{field.label || field.name}
|
|
552
|
-
</span
|
|
553
|
-
)}
|
|
554
|
-
{field.type === 'textarea' ? (
|
|
555
|
-
<textarea
|
|
556
|
-
name={field.name}
|
|
557
|
-
autoComplete="off"
|
|
558
|
-
value={displayValues[field.name] ?? ''}
|
|
559
|
-
onChange={(e) => handleFieldChange(field.name, e.target.value)}
|
|
560
|
-
placeholder={field.placeholder}
|
|
561
|
-
className={\`\${P}-input\`}
|
|
562
|
-
style={inputFieldCss}
|
|
563
|
-
rows={1}
|
|
564
|
-
data-filled={isFilledPreview || ((displayValues[field.name] ?? '') as string).trim().length > 0}
|
|
565
|
-
data-field-type="textarea"
|
|
566
|
-
|
|
567
|
-
) : (
|
|
568
|
-
<input
|
|
569
|
-
type={field.type === 'phone' ? 'tel' : field.type === 'email' ? 'email' : 'text'}
|
|
570
|
-
name={field.name}
|
|
571
|
-
autoComplete="off"
|
|
572
|
-
value={displayValues[field.name] ?? ''}
|
|
573
|
-
onChange={(e) => handleFieldChange(field.name, e.target.value)}
|
|
574
|
-
placeholder={field.placeholder}
|
|
575
|
-
required={field.isRequired ?? field.type === 'email'}
|
|
576
|
-
className={\`\${P}-input\`}
|
|
577
|
-
style={inputFieldCss}
|
|
578
|
-
data-filled={isFilledPreview || ((displayValues[field.name] ?? '') as string).trim().length > 0}
|
|
579
|
-
|
|
580
|
-
)}
|
|
581
|
-
</div
|
|
582
|
-
))}
|
|
583
|
-
</div
|
|
584
|
-
<div className={\`\${P}-overlay-anchor\`}
|
|
585
|
-
<button
|
|
586
|
-
type="submit"
|
|
587
|
-
className={\`\${P}-button\`}
|
|
588
|
-
style={{
|
|
589
|
-
borderStyle: 'solid'
|
|
590
|
-
borderRadius: scalingValue(buttonCorners ?? 0, isEditor)
|
|
591
|
-
borderWidth: strokeForButton
|
|
592
|
-
paddingTop: scalingValue(buttonPadding?.top ?? 0, isEditor)
|
|
593
|
-
paddingRight: scalingValue(buttonPadding?.right ?? 0, isEditor)
|
|
594
|
-
paddingBottom: scalingValue(buttonPadding?.bottom ?? 0, isEditor)
|
|
595
|
-
paddingLeft: scalingValue(buttonPadding?.left ?? 0, isEditor)
|
|
596
|
-
...buttonTypographyCss
|
|
597
|
-
...(isButtonFullWidth
|
|
598
|
-
? {
|
|
599
|
-
width: '100%'
|
|
600
|
-
textAlign: 'center'
|
|
601
|
-
whiteSpace: 'normal'
|
|
602
|
-
}
|
|
603
|
-
: {})
|
|
604
|
-
}}
|
|
605
|
-
|
|
606
|
-
<span
|
|
607
|
-
className={\`\${P}-overlay-anchor\`}
|
|
608
|
-
style={isButtonFullWidth
|
|
609
|
-
? {
|
|
610
|
-
display: 'inline-block'
|
|
611
|
-
maxWidth: '100%'
|
|
612
|
-
whiteSpace: 'normal'
|
|
613
|
-
textAlign: 'center'
|
|
614
|
-
}
|
|
615
|
-
: undefined}
|
|
616
|
-
|
|
617
|
-
{status === 'submitting' ? '...' : buttonLabel}
|
|
618
|
-
</span
|
|
619
|
-
</button
|
|
620
|
-
</div
|
|
621
|
-
</form
|
|
622
|
-
{displayStatus === 'success' && (
|
|
623
|
-
<p
|
|
624
|
-
className={\`\${P}-success\`}
|
|
625
|
-
style={{ ...statusTypographyCss }}
|
|
626
|
-
|
|
627
|
-
{successMessage}
|
|
628
|
-
</p
|
|
629
|
-
)}
|
|
630
|
-
{displayStatus === 'error' && (
|
|
631
|
-
<p
|
|
632
|
-
className={\`\${P}-error\`}
|
|
633
|
-
style={{ ...statusTypographyCss }}
|
|
634
|
-
role="alert"
|
|
635
|
-
|
|
636
|
-
{validationErrorMessage ?? displayError ?? errorMessageText}
|
|
637
|
-
</p
|
|
638
|
-
)}
|
|
639
|
-
</div
|
|
640
|
-
)
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
export type FormFieldType = 'text' | 'textarea' | 'phone' | 'email'
|
|
644
|
-
|
|
645
|
-
export type FormFieldItem = {
|
|
646
|
-
name: string
|
|
647
|
-
type: FormFieldType
|
|
648
|
-
placeholder: string
|
|
649
|
-
label?: string
|
|
650
|
-
isRequired?: boolean
|
|
651
|
-
error?: string
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
type Padding = {
|
|
655
|
-
top?: number
|
|
656
|
-
right?: number
|
|
657
|
-
bottom?: number
|
|
658
|
-
left?: number
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
type ColorKeys
|
|
662
|
-
| 'inputColor'
|
|
663
|
-
| 'inputTextColor'
|
|
664
|
-
| 'inputBorderColor'
|
|
665
|
-
| 'placeholderColor'
|
|
666
|
-
| 'buttonColor'
|
|
667
|
-
| 'buttonTextColor'
|
|
668
|
-
| 'buttonBorderColor'
|
|
669
|
-
| 'labelTextColor'
|
|
670
|
-
| 'successColor'
|
|
671
|
-
| 'errorColor'
|
|
672
|
-
|
|
673
|
-
type StateColorOverrides = Partial<Record<ColorKeys, string
|
|
674
|
-
|
|
675
|
-
type FormSettings = {
|
|
676
|
-
type: 'A' | 'B' | 'C'
|
|
677
|
-
fontFamily: string
|
|
678
|
-
fieldsToShow: number
|
|
679
|
-
fields: FormFieldItem[]
|
|
680
|
-
buttonLabel?: string
|
|
681
|
-
gap?: number
|
|
682
|
-
fieldsGap?: number
|
|
683
|
-
inputFontSettings?: { fontWeight: number; fontStyle: string }
|
|
684
|
-
inputFontSize?: number
|
|
685
|
-
inputLineHeight?: number
|
|
686
|
-
inputLetterSpacing?: number
|
|
687
|
-
inputWordSpacing?: number
|
|
688
|
-
inputTextAppearance?: TextStyles['textAppearance']
|
|
689
|
-
buttonFontSettings?: { fontWeight: number; fontStyle: string }
|
|
690
|
-
buttonFontSize?: number
|
|
691
|
-
buttonLineHeight?: number
|
|
692
|
-
buttonLetterSpacing?: number
|
|
693
|
-
buttonWordSpacing?: number
|
|
694
|
-
buttonTextAppearance?: TextStyles['textAppearance']
|
|
695
|
-
labelFontSettings?: { fontWeight: number; fontStyle: string }
|
|
696
|
-
labelFontSize?: number
|
|
697
|
-
labelLineHeight?: number
|
|
698
|
-
labelLetterSpacing?: number
|
|
699
|
-
labelWordSpacing?: number
|
|
700
|
-
labelTextAppearance?: TextStyles['textAppearance']
|
|
701
|
-
statusFontSettings?: { fontWeight: number; fontStyle: string }
|
|
702
|
-
statusFontSize?: number
|
|
703
|
-
statusLineHeight?: number
|
|
704
|
-
statusLetterSpacing?: number
|
|
705
|
-
statusWordSpacing?: number
|
|
706
|
-
statusTextAppearance?: TextStyles['textAppearance']
|
|
707
|
-
buttonCorners?: number
|
|
708
|
-
buttonStroke?: number
|
|
709
|
-
buttonPadding?: Padding
|
|
710
|
-
isButtonFullWidth?: boolean
|
|
711
|
-
inputCorners?: number
|
|
712
|
-
inputStroke?: number
|
|
713
|
-
inputPadding?: Padding
|
|
714
|
-
inputColor: string
|
|
715
|
-
inputTextColor: string
|
|
716
|
-
inputBorderColor: string
|
|
717
|
-
buttonColor: string
|
|
718
|
-
buttonTextColor: string
|
|
719
|
-
buttonBorderColor: string
|
|
720
|
-
placeholderColor: string
|
|
721
|
-
labelTextColor: string
|
|
722
|
-
successColor: string
|
|
723
|
-
errorColor: string
|
|
724
|
-
successMessage: string
|
|
725
|
-
errorMessage: string
|
|
726
|
-
stateOverrides?: Record<string, StateColorOverrides
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
730
|
-
inputColor: 'input-color'
|
|
731
|
-
inputTextColor: 'input-text-color'
|
|
732
|
-
inputBorderColor: 'input-border-color'
|
|
733
|
-
placeholderColor: 'placeholder-color'
|
|
734
|
-
buttonColor: 'button-color'
|
|
735
|
-
buttonTextColor: 'button-text-color'
|
|
736
|
-
buttonBorderColor: 'button-border-color'
|
|
737
|
-
labelTextColor: 'label-text-color'
|
|
738
|
-
successColor: 'success-color'
|
|
739
|
-
errorColor: 'error-color'
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const
|
|
743
|
-
`,_l=[{name:"email",type:"email",placeholder:"Enter your email",label:"Email",isRequired:!0,error:"Please, enter a valid e-mail."},{name:"name",type:"text",placeholder:"Enter your name",label:"Name",isRequired:!1,error:"Please, enter your name."},{name:"company",type:"text",placeholder:"Enter company",label:"Company",isRequired:!1,error:"Please, enter your company name."},{name:"phone",type:"phone",placeholder:"Enter your phone",label:"Phone",isRequired:!1,error:"Please, enter a valid phone number."},{name:"message",type:"textarea",placeholder:"Enter your message",label:"Message",isRequired:!1,error:"Message is required"},{name:"message2",type:"textarea",placeholder:"Enter your message 2",label:"Message 2",isRequired:!1,error:"Message 2 is required"},{name:"message3",type:"textarea",placeholder:"Enter your message 3",label:"Message 3",isRequired:!1,error:"Message 3 is required"}],Gt={fontSettings:{type:"object",display:{type:"font-settings-weight"},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}}},wl=["inputColor","inputTextColor","inputBorderColor","placeholderColor","buttonColor","buttonTextColor","buttonBorderColor","labelTextColor","successColor","errorColor"],Tl={type:"object",version:1,settings:{sizing:"auto manual",properties:{fieldsToShow:{type:"number",scope:"common",title:"Fields",display:{type:"number"},min:1,max:7},fields:{type:"array",scope:"common",display:{type:"fields-group"},items:{type:"object",properties:{name:{type:"string"},type:{type:"string",enum:["text","textarea","phone","email"]},placeholder:{type:"string"},label:{type:"string"},isRequired:{type:"boolean"},error:{type:"string"}}}},buttonLabel:{type:"string",scope:"common",title:"Button Label",display:{type:"text-input"}},successMessage:{type:"string",scope:"common",title:"Success Message",display:{type:"text-input"}},errorMessage:{type:"string",scope:"common",title:"Error Message",display:{type:"text-input"}},type:{type:"string",scope:"common",title:"",display:{type:"radio-group"},enum:["A","B","C"]},gap:{type:"number",scope:"layout",title:"Gap",display:{type:"range-control"},min:0,max:100},fieldsGap:{type:"number",scope:"layout",title:"Gap",display:{type:"range-control",enabled:!0},min:0,max:100},buttonPadding:{type:"object",scope:"layout",title:"Padding",display:{type:"padding-controls"}},inputPadding:{type:"object",scope:"layout",title:"Padding",display:{type:"padding-controls"}},buttonStroke:{type:"number",scope:"layout",title:"Stroke",display:{type:"range-control"},min:0,max:20},buttonCorners:{type:"number",scope:"layout",title:"Corners",display:{type:"range-control",enabled:!0},min:0,max:100},inputStroke:{type:"number",scope:"layout",title:"Stroke",display:{type:"range-control"},min:0,max:20},inputCorners:{type:"number",scope:"layout",title:"Corners",display:{type:"range-control",enabled:!0},min:0,max:100},inputColor:{type:"string",scope:"common",title:"Input Fill",display:{type:"palette-color-picker"}},inputTextColor:{type:"string",scope:"common",title:"Input Label",display:{type:"palette-color-picker"}},inputBorderColor:{type:"string",scope:"common",title:"Input Stroke",display:{type:"palette-color-picker"}},placeholderColor:{type:"string",scope:"common",title:"Filler text",display:{type:"palette-color-picker"}},buttonColor:{type:"string",scope:"common",title:"Button Fill",display:{type:"palette-color-picker"}},buttonTextColor:{type:"string",scope:"common",title:"Button Label",display:{type:"palette-color-picker"}},isButtonFullWidth:{type:"boolean",scope:"common",title:"Full Width",display:{type:"toggle",enum:["On","Off"]}},buttonBorderColor:{type:"string",scope:"common",title:"Button Stroke",display:{type:"palette-color-picker"}},labelTextColor:{type:"string",scope:"common",title:"Label Color",display:{type:"palette-color-picker",visible:!1}},successColor:{type:"string",scope:"common",title:"Success Message Color",display:{type:"palette-color-picker"}},errorColor:{type:"string",scope:"common",title:"Error Message Color",display:{type:"palette-color-picker"}},stateOverrides:{type:"object",scope:"common"},fontFamily:{type:"string",scope:"common",title:"Font family",display:{type:"font-family-select"}},inputFontSettings:{...Gt.fontSettings,scope:"common",title:"Input",display:{type:"font-settings-weight"}},inputFontSize:{type:"number",scope:"layout",title:"Input Font Size",display:{type:"font-size"}},inputLineHeight:{type:"number",scope:"layout",title:"Input Line Height",display:{type:"line-height-input"}},inputLetterSpacing:{type:"number",scope:"layout",title:"Input Letter Spacing",display:{type:"letter-spacing-input"}},inputWordSpacing:{type:"number",scope:"layout",title:"Input Word Spacing",display:{type:"word-spacing-input"}},inputTextAppearance:{type:"object",scope:"layout",title:"Input Text Appearance",display:{type:"text-appearance"}},buttonFontSettings:{...Gt.fontSettings,scope:"common",title:"Button",display:{type:"font-settings-weight"}},buttonFontSize:{type:"number",scope:"layout",title:"Button Font Size",display:{type:"font-size"}},buttonLineHeight:{type:"number",scope:"layout",title:"Button Line Height",display:{type:"line-height-input"}},buttonLetterSpacing:{type:"number",scope:"layout",title:"Button Letter Spacing",display:{type:"letter-spacing-input"}},buttonWordSpacing:{type:"number",scope:"layout",title:"Button Word Spacing",display:{type:"word-spacing-input"}},buttonTextAppearance:{type:"object",scope:"layout",title:"Button Text Appearance",display:{type:"text-appearance"}},labelFontSettings:{...Gt.fontSettings,scope:"common",title:"Label",display:{type:"font-settings-weight",visible:!1}},labelFontSize:{type:"number",scope:"layout",title:"Label Font Size",display:{type:"font-size",visible:!1}},labelLineHeight:{type:"number",scope:"layout",title:"Label Line Height",display:{type:"line-height-input",visible:!1}},labelLetterSpacing:{type:"number",scope:"layout",title:"Label Letter Spacing",display:{type:"letter-spacing-input",visible:!1}},labelWordSpacing:{type:"number",scope:"layout",title:"Label Word Spacing",display:{type:"word-spacing-input",visible:!1}},labelTextAppearance:{type:"object",scope:"layout",title:"Label Text Appearance",display:{type:"text-appearance",visible:!1}},statusFontSettings:{...Gt.fontSettings,scope:"common",title:"Success/Error"},statusFontSize:{type:"number",scope:"layout",title:"Success/Error Font Size",display:{type:"font-size"}},statusLineHeight:{type:"number",scope:"layout",title:"Success/Error Line Height",display:{type:"line-height-input"}},statusLetterSpacing:{type:"number",scope:"layout",title:"Success/Error Letter Spacing",display:{type:"letter-spacing-input"}},statusWordSpacing:{type:"number",scope:"layout",title:"Success/Error Word Spacing",display:{type:"word-spacing-input"}},statusTextAppearance:{type:"object",scope:"layout",title:"Success/Error Text Appearance",display:{type:"text-appearance"}}},defaults:{fieldsToShow:2,fields:_l,type:"A",inputColor:"#FFFFFF",inputTextColor:"#0A00F8",inputBorderColor:"#E2E2E2",placeholderColor:"#808080",buttonColor:"#0A00F8",buttonTextColor:"#ffffff",buttonBorderColor:"#0A00F8",labelTextColor:"#999999",successColor:"#22c55e",errorColor:"#ef4444",stateOverrides:{hover:{buttonColor:"#194EFF"}},fontFamily:"Arial",inputFontSettings:{fontWeight:400,fontStyle:"normal"},inputLetterSpacing:0,inputWordSpacing:0,inputTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},buttonFontSettings:{fontWeight:400,fontStyle:"normal"},buttonLetterSpacing:0,buttonWordSpacing:0,buttonTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},labelFontSettings:{fontWeight:400,fontStyle:"normal"},labelLetterSpacing:0,labelWordSpacing:0,labelTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},statusFontSettings:{fontWeight:400,fontStyle:"normal"},statusLetterSpacing:0,statusWordSpacing:0,statusTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},isButtonFullWidth:!1,buttonLabel:"Sign up",successMessage:"Thanks for subscribing!",errorMessage:"Please, fill all required fields."},layoutDefaults:{m:{gap:.032,fieldsGap:.032,buttonStroke:0,buttonCorners:.192,inputStroke:.003,inputCorners:.192,buttonPadding:{top:.0373,right:.0373,bottom:.0373,left:.0373},inputPadding:{top:.0373,right:.0373,bottom:.0373,left:.0373},inputFontSize:.043,inputLineHeight:.043,buttonFontSize:.0373,buttonLineHeight:.0373,labelFontSize:.0373,labelLineHeight:.0373,statusFontSize:.0373,statusLineHeight:.0373},d:{gap:.0083,fieldsGap:.0083,buttonStroke:0,buttonCorners:.05,inputStroke:.001,inputCorners:.05,buttonPadding:{top:.01,right:.01,bottom:.01,left:.01},inputPadding:{top:.01,right:.01,bottom:.01,left:.01},inputFontSize:.01,inputLineHeight:.01,buttonFontSize:.01,buttonLineHeight:.01,labelFontSize:.01,labelLineHeight:.01,statusFontSize:.01,statusLineHeight:.01}},displayRules:[{if:{name:"type",value:"B"},then:{name:"properties.labelTextColor.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelFontSettings.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelFontSize.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelLineHeight.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelLetterSpacing.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelWordSpacing.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelTextAppearance.display.visible",value:!0}},{if:{name:"type",value:"C"},then:{name:"properties.buttonCorners.display.enabled",value:!1}},{if:{name:"type",value:"C"},then:{name:"properties.inputCorners.display.enabled",value:!1}},{if:{name:"buttonStroke",value:0},then:{name:"properties.buttonBorderColor.display.visible",value:!1}},{if:{name:"inputStroke",value:0},then:{name:"properties.inputBorderColor.display.visible",value:!1}},{if:{name:"fieldsToShow",value:1},then:{name:"properties.fieldsGap.display.enabled",value:!1}}]},panels:[{id:"general",icon:"cursor",title:"General",tooltip:"General Settings",layout:[{type:"row",items:["__componentName__","name","fieldsToShow"]},"type",{type:"group",title:"",items:[{type:"row",title:"Input",items:[{type:"group",title:"",items:["fieldsGap","inputStroke","inputCorners"]},{type:"group",title:"",items:["inputPadding"]}]},{type:"group",title:"Button",items:[{type:"row",items:["isButtonFullWidth"]},{type:"row",items:[{type:"group",title:"",items:["gap","buttonStroke","buttonCorners"]},{type:"group",title:"",items:["buttonPadding"]}]}]}]}]},{id:"typeStyle",icon:"text-icon",title:"Type Style",tooltip:"Typography",layout:["fontFamily",{type:"group",title:"",items:["inputFontSettings",{type:"row",items:["inputFontSize","inputLineHeight","inputLetterSpacing","inputWordSpacing"]},"inputTextAppearance"]},{type:"group",title:"",items:["buttonFontSettings",{type:"row",items:["buttonFontSize","buttonLineHeight","buttonLetterSpacing","buttonWordSpacing"]},"buttonTextAppearance"]},{type:"group",title:"",items:["labelFontSettings",{type:"row",items:["labelFontSize","labelLineHeight","labelLetterSpacing","labelWordSpacing"]},"labelTextAppearance"]},{type:"group",title:"",items:["statusFontSettings",{type:"row",items:["statusFontSize","statusLineHeight","statusLetterSpacing","statusWordSpacing"]},"statusTextAppearance"]}]},{id:"fields",icon:"layers",title:"Fields",tooltip:"Fields",layout:["fields","buttonLabel","successMessage","errorMessage"]}],paletteBookmark:{items:[...wl],panelIds:["general","typeStyle"],stateItems:{default:["placeholderColor","inputColor","inputBorderColor","buttonTextColor","buttonColor","buttonBorderColor","labelTextColor"],hover:["inputColor","inputBorderColor","buttonTextColor","buttonColor","buttonBorderColor"],focus:["inputColor","inputBorderColor","buttonTextColor","buttonColor","buttonBorderColor"],filled:["inputTextColor","inputColor","inputBorderColor","buttonTextColor"],success:["successColor"],error:["errorColor"]}},allowedPlugins:["newsletter"],states:["default","hover","focus","filled","success","error"]},El={element:Sl,id:"form",name:"Newsletter Stacked",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/formImg.jpg"},version:1,defaultSize:{width:300,height:42},schema:Tl,sourceCode:$l};function Yt(e){return`calc(var(--cntrl-article-width, 100vw) * ${e/1440})`}function Ll(e){return`
|
|
744
|
-
.${
|
|
142
|
+
`}function $l({settings:t,isEditor:e,metadata:n,activeEvent:r}){const{prefix:o}=E.useScopedStyles(),{type:a="A",fieldsToShow:i=2,fields:c=[],buttonLabel:s,gap:d,fieldsGap:l,buttonCorners:w,buttonStroke:b,buttonPadding:g,isButtonFullWidth:u,inputCorners:m,inputStroke:S,inputPadding:y,inputColor:v,inputTextColor:C,inputBorderColor:M,placeholderColor:B,buttonColor:$,buttonTextColor:f,buttonBorderColor:T,labelTextColor:A,successColor:z,errorColor:L,fontFamily:k,inputFontSettings:W,inputFontSize:D,inputLineHeight:H,inputLetterSpacing:h,inputWordSpacing:O,inputTextAppearance:F,buttonFontSettings:I,buttonFontSize:_,buttonLineHeight:P,buttonLetterSpacing:X,buttonWordSpacing:it,buttonTextAppearance:et,labelFontSettings:st,labelFontSize:R,labelLineHeight:K,labelLetterSpacing:ft,labelWordSpacing:ct,labelTextAppearance:dt,statusFontSettings:St,statusFontSize:Pt,statusLineHeight:j,statusLetterSpacing:x,statusWordSpacing:G,statusTextAppearance:q,successMessage:J,errorMessage:nt,stateOverrides:Z}=t,Y=a==="B",ot=c.slice(0,Math.min(i,c.length)),ht={fontSettings:{fontFamily:k,fontWeight:(W==null?void 0:W.fontWeight)??400,fontStyle:(W==null?void 0:W.fontStyle)??"normal"},fontSize:D??.01,lineHeight:H,letterSpacing:h??0,wordSpacing:O??0,textAppearance:F,color:C},lt=Zt(Gt(ht,e)),gt=E.scalingValue(S??0,e),wt=E.scalingValue((H??D??.01)+((y==null?void 0:y.top)??0)+((y==null?void 0:y.bottom)??0)+(a==="C"?S??0:(S??0)*2),e),Q={...lt,borderStyle:"solid",borderRadius:a==="C"?0:E.scalingValue(m??0,e),...a==="C"?{borderTopWidth:0,borderRightWidth:0,borderBottomWidth:gt,borderLeftWidth:0}:{borderWidth:gt},paddingTop:E.scalingValue((y==null?void 0:y.top)??0,e),paddingRight:E.scalingValue((y==null?void 0:y.right)??0,e),paddingBottom:E.scalingValue((y==null?void 0:y.bottom)??0,e),paddingLeft:E.scalingValue((y==null?void 0:y.left)??0,e),height:wt,minHeight:wt},ut={fontSettings:{fontFamily:k,fontWeight:(I==null?void 0:I.fontWeight)??400,fontStyle:(I==null?void 0:I.fontStyle)??"normal"},fontSize:_??.01,lineHeight:P,letterSpacing:X??0,wordSpacing:it??0,textAppearance:et,color:f},xt=Zt(Gt(ut,e)),Bt=E.scalingValue(b??0,e),_e={fontSettings:{fontFamily:k,fontWeight:(st==null?void 0:st.fontWeight)??400,fontStyle:(st==null?void 0:st.fontStyle)??"normal"},fontSize:R??.01,lineHeight:K,letterSpacing:ft??0,wordSpacing:ct??0,textAppearance:dt,color:A},Yt=Gt(_e,e),rt={fontSettings:{fontFamily:k,fontWeight:(St==null?void 0:St.fontWeight)??400,fontStyle:(St==null?void 0:St.fontStyle)??"normal"},fontSize:Pt??.01,lineHeight:j,letterSpacing:x??0,wordSpacing:G??0,textAppearance:q,color:z},_t=Zt(Gt(rt,e)),Lt=E.buildColorVars(o,{inputColor:v,inputTextColor:C,inputBorderColor:M,placeholderColor:B!=null&&B.trim()?B:"#cccccc",buttonColor:$,buttonTextColor:f,buttonBorderColor:T,labelTextColor:A,successColor:z,errorColor:L},wl,_l,Z),[at,Ct]=V.useState(()=>Object.fromEntries(ot.map(pt=>[pt.name,""]))),[De,oe]=V.useState("idle"),[go,Ge]=V.useState(null),vn=r==="success"?"success":r==="error"?"error":De,mo=r==="error"?nt:go,Ue=r==="filled",Te=V.useMemo(()=>{if(!Ue)return at;let pt=null;for(const Nt of ot)(at[Nt.name]??"").trim().length>0||(pt=pt??{...at},pt[Nt.name]="Filled");return pt??at},[at,Ue,ot]),fo=vn==="error"?E.getFormFieldValidationError(ot,Te):null,ho=`${r&&r!=="default"?`${o}-state-${r}`:""}`.trim(),rr=n==null?void 0:n.submitUrl,or=(pt,Nt)=>{Ct(jt=>({...jt,[pt]:Nt}))},yo=async pt=>{pt.preventDefault();const Nt=Object.fromEntries(ot.map(Ft=>{var pe;return[Ft.name,((pe=at[Ft.name])==null?void 0:pe.trim())??""]}).filter(([,Ft])=>Ft));if(!rr){oe("error"),Ge("No integrations were found for this form.");return}if(Object.keys(Nt).length===0)return;const jt=E.getFormFieldValidationError(ot,at);if(jt){oe("error"),Ge(jt);return}oe("submitting"),Ge(null);try{const Ft=await fetch(rr,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Nt)});if(!Ft.ok){const pe=await Ft.text();throw new Error(pe||`Request failed: ${Ft.status}`)}oe("success"),Ct(Object.fromEntries(ot.map(pe=>[pe.name,""])))}catch(Ft){oe("error"),Ge(Ft instanceof Error?Ft.message:"Something went wrong")}};return p.jsxs("div",{className:`${o}-wrapper ${o}-type-${a} ${ho}`.trim(),style:Lt,children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:Cl(o)}}),p.jsxs("form",{onSubmit:yo,className:`${o}-form`,style:{gap:E.scalingValue(d??0,e)},children:[p.jsx("div",{className:`${o}-fields`,style:{gap:E.scalingValue(l??0,e)},children:ot.map((pt,Nt)=>p.jsxs("div",{className:`${o}-field-group${Y?` ${o}-labeled`:""}`,children:[Y&&p.jsx("span",{className:`${o}-field-label`,style:Yt?{...Yt,lineHeight:Yt.fontSize}:void 0,children:pt.label||pt.name}),pt.type==="textarea"?p.jsx("textarea",{name:pt.name,autoComplete:"off",value:Te[pt.name]??"",onChange:jt=>or(pt.name,jt.target.value),placeholder:pt.placeholder,className:`${o}-input`,style:Q,rows:1,"data-filled":Ue||(Te[pt.name]??"").trim().length>0,"data-field-type":"textarea"}):p.jsx("input",{type:pt.type==="phone"?"tel":pt.type==="email"?"email":"text",name:pt.name,autoComplete:"off",value:Te[pt.name]??"",onChange:jt=>or(pt.name,jt.target.value),placeholder:pt.placeholder,required:pt.isRequired??pt.type==="email",className:`${o}-input`,style:Q,"data-filled":Ue||(Te[pt.name]??"").trim().length>0})]},Nt))}),p.jsx("div",{className:`${o}-overlay-anchor`,children:p.jsx("button",{type:"submit",className:`${o}-button`,style:{borderStyle:"solid",borderRadius:E.scalingValue(w??0,e),borderWidth:Bt,paddingTop:E.scalingValue((g==null?void 0:g.top)??0,e),paddingRight:E.scalingValue((g==null?void 0:g.right)??0,e),paddingBottom:E.scalingValue((g==null?void 0:g.bottom)??0,e),paddingLeft:E.scalingValue((g==null?void 0:g.left)??0,e),...xt,...u?{width:"100%",textAlign:"center",whiteSpace:"normal"}:{}},children:p.jsx("span",{className:`${o}-overlay-anchor`,style:u?{display:"inline-block",maxWidth:"100%",whiteSpace:"normal",textAlign:"center"}:void 0,children:De==="submitting"?"...":s})})})]}),vn==="success"&&p.jsx("p",{className:`${o}-success`,style:{..._t},children:J}),vn==="error"&&p.jsx("p",{className:`${o}-error`,style:{..._t},role:"alert",children:fo??mo??nt})]})}const wl={inputColor:"input-color",inputTextColor:"input-text-color",inputBorderColor:"input-border-color",placeholderColor:"placeholder-color",buttonColor:"button-color",buttonTextColor:"button-text-color",buttonBorderColor:"button-border-color",labelTextColor:"label-text-color",successColor:"success-color",errorColor:"error-color"},_l=["hover","focus","filled","success","error"],Tl=`import React, { useMemo, useState } from 'react';\r
|
|
143
|
+
import { CommonComponentProps } from '../props';\r
|
|
144
|
+
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';\r
|
|
145
|
+
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';\r
|
|
146
|
+
\r
|
|
147
|
+
function sv(px: number): string {\r
|
|
148
|
+
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;\r
|
|
149
|
+
}\r
|
|
150
|
+
\r
|
|
151
|
+
function getCSS(P: string): string {\r
|
|
152
|
+
return \`\r
|
|
153
|
+
.\${P}-wrapper {\r
|
|
154
|
+
display: flex;\r
|
|
155
|
+
flex-direction: column;\r
|
|
156
|
+
width: 100%;\r
|
|
157
|
+
min-height: \${sv(48)};\r
|
|
158
|
+
}\r
|
|
159
|
+
.\${P}-wrapper.\${P}-type-C .\${P}-input:focus-visible,\r
|
|
160
|
+
.\${P}-wrapper.\${P}-type-C .\${P}-button:focus-visible {\r
|
|
161
|
+
outline: none;\r
|
|
162
|
+
}\r
|
|
163
|
+
.\${P}-form {\r
|
|
164
|
+
display: flex;\r
|
|
165
|
+
flex-direction: column;\r
|
|
166
|
+
width: 100%;\r
|
|
167
|
+
}\r
|
|
168
|
+
.\${P}-fields {\r
|
|
169
|
+
display: flex;\r
|
|
170
|
+
flex-direction: column;\r
|
|
171
|
+
flex: 1;\r
|
|
172
|
+
min-width: 0;\r
|
|
173
|
+
}\r
|
|
174
|
+
.\${P}-field-group {\r
|
|
175
|
+
display: flex;\r
|
|
176
|
+
flex-direction: column;\r
|
|
177
|
+
flex: 1;\r
|
|
178
|
+
min-width: 0;\r
|
|
179
|
+
}\r
|
|
180
|
+
.\${P}-field-group.\${P}-labeled {\r
|
|
181
|
+
gap: \${sv(4)};\r
|
|
182
|
+
}\r
|
|
183
|
+
.\${P}-field-label {\r
|
|
184
|
+
white-space: nowrap;\r
|
|
185
|
+
color: var(--\${P}-label-text-color);\r
|
|
186
|
+
}\r
|
|
187
|
+
.\${P}-input {\r
|
|
188
|
+
width: 100%;\r
|
|
189
|
+
box-sizing: border-box;\r
|
|
190
|
+
outline: none;\r
|
|
191
|
+
-webkit-tap-highlight-color: transparent;\r
|
|
192
|
+
background-color: var(--\${P}-input-color);\r
|
|
193
|
+
color: var(--\${P}-input-text-color);\r
|
|
194
|
+
border-color: var(--\${P}-input-border-color);\r
|
|
195
|
+
transition: color 250ms, border-color 250ms, background-color 250ms;\r
|
|
196
|
+
}\r
|
|
197
|
+
.\${P}-input::placeholder {\r
|
|
198
|
+
color: var(--\${P}-placeholder-color);\r
|
|
199
|
+
opacity: 1;\r
|
|
200
|
+
transition: color 250ms, opacity 250ms;\r
|
|
201
|
+
}\r
|
|
202
|
+
.\${P}-input:hover {\r
|
|
203
|
+
background-color: var(--\${P}-hover-input-color, var(--\${P}-input-color));\r
|
|
204
|
+
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color));\r
|
|
205
|
+
border-color: var(--\${P}-hover-input-border-color, var(--\${P}-input-border-color));\r
|
|
206
|
+
}\r
|
|
207
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-input {\r
|
|
208
|
+
background-color: var(--\${P}-hover-input-color, var(--\${P}-input-color));\r
|
|
209
|
+
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color));\r
|
|
210
|
+
border-color: var(--\${P}-hover-input-border-color, var(--\${P}-input-border-color));\r
|
|
211
|
+
}\r
|
|
212
|
+
.\${P}-input:focus,\r
|
|
213
|
+
.\${P}-input:focus-visible,\r
|
|
214
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-input {\r
|
|
215
|
+
background-color: var(--\${P}-focus-input-color, var(--\${P}-input-color));\r
|
|
216
|
+
color: var(--\${P}-focus-input-text-color, var(--\${P}-input-text-color));\r
|
|
217
|
+
border-color: var(--\${P}-focus-input-border-color, var(--\${P}-input-border-color));\r
|
|
218
|
+
}\r
|
|
219
|
+
.\${P}-input[data-filled="true"] {\r
|
|
220
|
+
background-color: var(--\${P}-filled-input-color, var(--\${P}-input-color));\r
|
|
221
|
+
color: var(--\${P}-filled-input-text-color, var(--\${P}-input-text-color));\r
|
|
222
|
+
border-color: var(--\${P}-filled-input-border-color, var(--\${P}-input-border-color));\r
|
|
223
|
+
}\r
|
|
224
|
+
.\${P}-wrapper.\${P}-state-filled .\${P}-button {\r
|
|
225
|
+
background-color: var(--\${P}-filled-button-color, var(--\${P}-button-color));\r
|
|
226
|
+
color: var(--\${P}-filled-button-text-color, var(--\${P}-button-text-color));\r
|
|
227
|
+
border-color: var(--\${P}-filled-button-border-color, var(--\${P}-button-border-color));\r
|
|
228
|
+
}\r
|
|
229
|
+
.\${P}-wrapper.\${P}-state-success .\${P}-input,\r
|
|
230
|
+
.\${P}-wrapper.\${P}-state-success .\${P}-button {\r
|
|
231
|
+
pointer-events: none;\r
|
|
232
|
+
}\r
|
|
233
|
+
.\${P}-wrapper.\${P}-state-error .\${P}-input {\r
|
|
234
|
+
}\r
|
|
235
|
+
.\${P}-input[data-field-type="textarea"] {\r
|
|
236
|
+
resize: vertical;\r
|
|
237
|
+
}\r
|
|
238
|
+
.\${P}-input:disabled {\r
|
|
239
|
+
cursor: not-allowed;\r
|
|
240
|
+
}\r
|
|
241
|
+
.\${P}-button {\r
|
|
242
|
+
cursor: pointer;\r
|
|
243
|
+
white-space: nowrap;\r
|
|
244
|
+
box-sizing: border-box;\r
|
|
245
|
+
outline: none;\r
|
|
246
|
+
background-color: var(--\${P}-button-color);\r
|
|
247
|
+
color: var(--\${P}-button-text-color);\r
|
|
248
|
+
border-color: var(--\${P}-button-border-color);\r
|
|
249
|
+
transition: color 250ms, background-color 250ms, border-color 250ms;\r
|
|
250
|
+
}\r
|
|
251
|
+
.\${P}-button:hover {\r
|
|
252
|
+
background-color: var(--\${P}-hover-button-color, var(--\${P}-button-color));\r
|
|
253
|
+
color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color));\r
|
|
254
|
+
border-color: var(--\${P}-hover-button-border-color, var(--\${P}-button-border-color));\r
|
|
255
|
+
}\r
|
|
256
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-button {\r
|
|
257
|
+
background-color: var(--\${P}-hover-button-color, var(--\${P}-button-color));\r
|
|
258
|
+
color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color));\r
|
|
259
|
+
border-color: var(--\${P}-hover-button-border-color, var(--\${P}-button-border-color));\r
|
|
260
|
+
}\r
|
|
261
|
+
.\${P}-button:focus,\r
|
|
262
|
+
.\${P}-button:focus-visible,\r
|
|
263
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-button {\r
|
|
264
|
+
background-color: var(--\${P}-focus-button-color, var(--\${P}-button-color));\r
|
|
265
|
+
color: var(--\${P}-focus-button-text-color, var(--\${P}-button-text-color));\r
|
|
266
|
+
border-color: var(--\${P}-focus-button-border-color, var(--\${P}-button-border-color));\r
|
|
267
|
+
}\r
|
|
268
|
+
.\${P}-input:focus-visible,\r
|
|
269
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-input {\r
|
|
270
|
+
outline: none;\r
|
|
271
|
+
}\r
|
|
272
|
+
.\${P}-button:focus-visible,\r
|
|
273
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-button {\r
|
|
274
|
+
outline: none;\r
|
|
275
|
+
}\r
|
|
276
|
+
.\${P}-success {\r
|
|
277
|
+
margin-top: \${sv(8)};\r
|
|
278
|
+
color: var(--\${P}-success-success-color, var(--\${P}-success-color));\r
|
|
279
|
+
}\r
|
|
280
|
+
.\${P}-error {\r
|
|
281
|
+
margin-top: \${sv(8)};\r
|
|
282
|
+
color: var(--\${P}-error-error-color, var(--\${P}-error-color));\r
|
|
283
|
+
}\r
|
|
284
|
+
.\${P}-overlay-anchor {\r
|
|
285
|
+
position: relative;\r
|
|
286
|
+
height: auto;\r
|
|
287
|
+
}\r
|
|
288
|
+
\`;\r
|
|
289
|
+
}\r
|
|
290
|
+
\r
|
|
291
|
+
type FormProps = {\r
|
|
292
|
+
settings: FormSettings;\r
|
|
293
|
+
content?: unknown;\r
|
|
294
|
+
isEditor?: boolean;\r
|
|
295
|
+
activeEvent: string | undefined;\r
|
|
296
|
+
onUpdateSettings?: (settings: FormSettings) => void;\r
|
|
297
|
+
} & CommonComponentProps;\r
|
|
298
|
+
\r
|
|
299
|
+
export function Form({ settings, isEditor, metadata, activeEvent }: FormProps) {\r
|
|
300
|
+
const { prefix: P } = useScopedStyles();\r
|
|
301
|
+
const {\r
|
|
302
|
+
type = 'A',\r
|
|
303
|
+
fieldsToShow = 2,\r
|
|
304
|
+
fields = [],\r
|
|
305
|
+
buttonLabel,\r
|
|
306
|
+
gap,\r
|
|
307
|
+
fieldsGap,\r
|
|
308
|
+
buttonCorners,\r
|
|
309
|
+
buttonStroke,\r
|
|
310
|
+
buttonPadding,\r
|
|
311
|
+
isButtonFullWidth,\r
|
|
312
|
+
inputCorners,\r
|
|
313
|
+
inputStroke,\r
|
|
314
|
+
inputPadding,\r
|
|
315
|
+
inputColor,\r
|
|
316
|
+
inputTextColor,\r
|
|
317
|
+
inputBorderColor,\r
|
|
318
|
+
placeholderColor,\r
|
|
319
|
+
buttonColor,\r
|
|
320
|
+
buttonTextColor,\r
|
|
321
|
+
buttonBorderColor,\r
|
|
322
|
+
labelTextColor,\r
|
|
323
|
+
successColor,\r
|
|
324
|
+
errorColor,\r
|
|
325
|
+
fontFamily,\r
|
|
326
|
+
inputFontSettings,\r
|
|
327
|
+
inputFontSize,\r
|
|
328
|
+
inputLineHeight,\r
|
|
329
|
+
inputLetterSpacing,\r
|
|
330
|
+
inputWordSpacing,\r
|
|
331
|
+
inputTextAppearance,\r
|
|
332
|
+
buttonFontSettings,\r
|
|
333
|
+
buttonFontSize,\r
|
|
334
|
+
buttonLineHeight,\r
|
|
335
|
+
buttonLetterSpacing,\r
|
|
336
|
+
buttonWordSpacing,\r
|
|
337
|
+
buttonTextAppearance,\r
|
|
338
|
+
labelFontSettings,\r
|
|
339
|
+
labelFontSize,\r
|
|
340
|
+
labelLineHeight,\r
|
|
341
|
+
labelLetterSpacing,\r
|
|
342
|
+
labelWordSpacing,\r
|
|
343
|
+
labelTextAppearance,\r
|
|
344
|
+
statusFontSettings,\r
|
|
345
|
+
statusFontSize,\r
|
|
346
|
+
statusLineHeight,\r
|
|
347
|
+
statusLetterSpacing,\r
|
|
348
|
+
statusWordSpacing,\r
|
|
349
|
+
statusTextAppearance,\r
|
|
350
|
+
successMessage,\r
|
|
351
|
+
errorMessage: errorMessageText,\r
|
|
352
|
+
stateOverrides,\r
|
|
353
|
+
} = settings;\r
|
|
354
|
+
\r
|
|
355
|
+
const showLabels = type === 'B';\r
|
|
356
|
+
const visibleFields = fields.slice(0, Math.min(fieldsToShow, fields.length));\r
|
|
357
|
+
\r
|
|
358
|
+
const resolvedInputTextStyle: TextStyles = {\r
|
|
359
|
+
fontSettings: {\r
|
|
360
|
+
fontFamily,\r
|
|
361
|
+
fontWeight: inputFontSettings?.fontWeight ?? 400,\r
|
|
362
|
+
fontStyle: inputFontSettings?.fontStyle ?? 'normal',\r
|
|
363
|
+
},\r
|
|
364
|
+
fontSize: inputFontSize ?? 0.01,\r
|
|
365
|
+
lineHeight: inputLineHeight,\r
|
|
366
|
+
letterSpacing: inputLetterSpacing ?? 0,\r
|
|
367
|
+
wordSpacing: inputWordSpacing ?? 0,\r
|
|
368
|
+
textAppearance: inputTextAppearance,\r
|
|
369
|
+
color: inputTextColor,\r
|
|
370
|
+
};\r
|
|
371
|
+
const inputTypographyCss = omitTextColors(textStylesToCss(resolvedInputTextStyle, isEditor));\r
|
|
372
|
+
const strokeForInput = scalingValue(inputStroke ?? 0, isEditor);\r
|
|
373
|
+
const inputBaseHeight = scalingValue(\r
|
|
374
|
+
(inputLineHeight ?? inputFontSize ?? 0.01) +\r
|
|
375
|
+
(inputPadding?.top ?? 0) +\r
|
|
376
|
+
(inputPadding?.bottom ?? 0) +\r
|
|
377
|
+
(type === 'C' ? (inputStroke ?? 0) : (inputStroke ?? 0) * 2),\r
|
|
378
|
+
isEditor,\r
|
|
379
|
+
);\r
|
|
380
|
+
const inputFieldCss = {\r
|
|
381
|
+
...inputTypographyCss,\r
|
|
382
|
+
borderStyle: 'solid',\r
|
|
383
|
+
borderRadius: type === 'C' ? 0 : scalingValue(inputCorners ?? 0, isEditor),\r
|
|
384
|
+
...(type === 'C'\r
|
|
385
|
+
? {\r
|
|
386
|
+
borderTopWidth: 0,\r
|
|
387
|
+
borderRightWidth: 0,\r
|
|
388
|
+
borderBottomWidth: strokeForInput,\r
|
|
389
|
+
borderLeftWidth: 0,\r
|
|
390
|
+
}\r
|
|
391
|
+
: { borderWidth: strokeForInput }),\r
|
|
392
|
+
paddingTop: scalingValue(inputPadding?.top ?? 0, isEditor),\r
|
|
393
|
+
paddingRight: scalingValue(inputPadding?.right ?? 0, isEditor),\r
|
|
394
|
+
paddingBottom: scalingValue(inputPadding?.bottom ?? 0, isEditor),\r
|
|
395
|
+
paddingLeft: scalingValue(inputPadding?.left ?? 0, isEditor),\r
|
|
396
|
+
height: inputBaseHeight,\r
|
|
397
|
+
minHeight: inputBaseHeight,\r
|
|
398
|
+
} as React.CSSProperties;\r
|
|
399
|
+
\r
|
|
400
|
+
const resolvedButtonTextStyle: TextStyles = {\r
|
|
401
|
+
fontSettings: {\r
|
|
402
|
+
fontFamily,\r
|
|
403
|
+
fontWeight: buttonFontSettings?.fontWeight ?? 400,\r
|
|
404
|
+
fontStyle: buttonFontSettings?.fontStyle ?? 'normal',\r
|
|
405
|
+
},\r
|
|
406
|
+
fontSize: buttonFontSize ?? 0.01,\r
|
|
407
|
+
lineHeight: buttonLineHeight,\r
|
|
408
|
+
letterSpacing: buttonLetterSpacing ?? 0,\r
|
|
409
|
+
wordSpacing: buttonWordSpacing ?? 0,\r
|
|
410
|
+
textAppearance: buttonTextAppearance,\r
|
|
411
|
+
color: buttonTextColor,\r
|
|
412
|
+
};\r
|
|
413
|
+
const buttonTypographyCss = omitTextColors(textStylesToCss(resolvedButtonTextStyle, isEditor));\r
|
|
414
|
+
const strokeForButton = scalingValue(buttonStroke ?? 0, isEditor);\r
|
|
415
|
+
\r
|
|
416
|
+
const resolvedLabelTextStyle: TextStyles = {\r
|
|
417
|
+
fontSettings: {\r
|
|
418
|
+
fontFamily,\r
|
|
419
|
+
fontWeight: labelFontSettings?.fontWeight ?? 400,\r
|
|
420
|
+
fontStyle: labelFontSettings?.fontStyle ?? 'normal',\r
|
|
421
|
+
},\r
|
|
422
|
+
fontSize: labelFontSize ?? 0.01,\r
|
|
423
|
+
lineHeight: labelLineHeight,\r
|
|
424
|
+
letterSpacing: labelLetterSpacing ?? 0,\r
|
|
425
|
+
wordSpacing: labelWordSpacing ?? 0,\r
|
|
426
|
+
textAppearance: labelTextAppearance,\r
|
|
427
|
+
color: labelTextColor,\r
|
|
428
|
+
};\r
|
|
429
|
+
const labelTextCss = textStylesToCss(resolvedLabelTextStyle, isEditor);\r
|
|
430
|
+
\r
|
|
431
|
+
const resolvedStatusTextStyle: TextStyles = {\r
|
|
432
|
+
fontSettings: {\r
|
|
433
|
+
fontFamily,\r
|
|
434
|
+
fontWeight: statusFontSettings?.fontWeight ?? 400,\r
|
|
435
|
+
fontStyle: statusFontSettings?.fontStyle ?? 'normal',\r
|
|
436
|
+
},\r
|
|
437
|
+
fontSize: statusFontSize ?? 0.01,\r
|
|
438
|
+
lineHeight: statusLineHeight,\r
|
|
439
|
+
letterSpacing: statusLetterSpacing ?? 0,\r
|
|
440
|
+
wordSpacing: statusWordSpacing ?? 0,\r
|
|
441
|
+
textAppearance: statusTextAppearance,\r
|
|
442
|
+
color: successColor,\r
|
|
443
|
+
};\r
|
|
444
|
+
const statusTypographyCss = omitTextColors(textStylesToCss(resolvedStatusTextStyle, isEditor));\r
|
|
445
|
+
\r
|
|
446
|
+
const colorVars = buildColorVars(P, {\r
|
|
447
|
+
inputColor,\r
|
|
448
|
+
inputTextColor,\r
|
|
449
|
+
inputBorderColor,\r
|
|
450
|
+
placeholderColor: placeholderColor?.trim() ? placeholderColor : '#cccccc',\r
|
|
451
|
+
buttonColor,\r
|
|
452
|
+
buttonTextColor,\r
|
|
453
|
+
buttonBorderColor,\r
|
|
454
|
+
labelTextColor,\r
|
|
455
|
+
successColor,\r
|
|
456
|
+
errorColor,\r
|
|
457
|
+
}, COLOR_VAR_MAP, STATE_KEYS, stateOverrides);\r
|
|
458
|
+
\r
|
|
459
|
+
const [fieldValues, setFieldValues] = useState<Record<string, string>>(() =>\r
|
|
460
|
+
Object.fromEntries(visibleFields.map((f) => [f.name, '']))\r
|
|
461
|
+
);\r
|
|
462
|
+
const [status, setStatus] = useState<'idle' | 'submitting' | 'success' | 'error'>('idle');\r
|
|
463
|
+
const [errorMessage, setErrorMessage] = useState<string | null>(null);\r
|
|
464
|
+
\r
|
|
465
|
+
const displayStatus = activeEvent === 'success' ? 'success'\r
|
|
466
|
+
: activeEvent === 'error' ? 'error'\r
|
|
467
|
+
: status;\r
|
|
468
|
+
const displayError = activeEvent === 'error' ? errorMessageText : errorMessage;\r
|
|
469
|
+
const isFilledPreview = activeEvent === 'filled';\r
|
|
470
|
+
const displayValues = useMemo(() => {\r
|
|
471
|
+
if (!isFilledPreview) return fieldValues;\r
|
|
472
|
+
\r
|
|
473
|
+
let next: Record<string, string> | null = null;\r
|
|
474
|
+
for (const f of visibleFields) {\r
|
|
475
|
+
const current = fieldValues[f.name] ?? '';\r
|
|
476
|
+
if (current.trim().length > 0) continue;\r
|
|
477
|
+
next = next ?? { ...fieldValues };\r
|
|
478
|
+
next[f.name] = 'Filled';\r
|
|
479
|
+
}\r
|
|
480
|
+
return next ?? fieldValues;\r
|
|
481
|
+
}, [fieldValues, isFilledPreview, visibleFields]);\r
|
|
482
|
+
const validationErrorMessage =\r
|
|
483
|
+
displayStatus === 'error'\r
|
|
484
|
+
? getFormFieldValidationError(visibleFields, displayValues)\r
|
|
485
|
+
: null;\r
|
|
486
|
+
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';\r
|
|
487
|
+
const wrapperStateClasses = \`\${stateClass}\`.trim();\r
|
|
488
|
+
\r
|
|
489
|
+
const submitUrl = metadata?.submitUrl as string | undefined;\r
|
|
490
|
+
const handleFieldChange = (name: string, value: string) => {\r
|
|
491
|
+
setFieldValues((prev) => ({ ...prev, [name]: value }));\r
|
|
492
|
+
};\r
|
|
493
|
+
\r
|
|
494
|
+
const handleSubmit = async (e: React.FormEvent) => {\r
|
|
495
|
+
e.preventDefault();\r
|
|
496
|
+
const payload = Object.fromEntries(\r
|
|
497
|
+
visibleFields.map((f) => [f.name, fieldValues[f.name]?.trim() ?? '']).filter(([, v]) => v)\r
|
|
498
|
+
);\r
|
|
499
|
+
if (!submitUrl) {\r
|
|
500
|
+
setStatus('error');\r
|
|
501
|
+
setErrorMessage('No integrations were found for this form.');\r
|
|
502
|
+
return;\r
|
|
503
|
+
}\r
|
|
504
|
+
if (Object.keys(payload).length === 0) return;\r
|
|
505
|
+
\r
|
|
506
|
+
const validationError = getFormFieldValidationError(visibleFields, fieldValues);\r
|
|
507
|
+
if (validationError) {\r
|
|
508
|
+
setStatus('error');\r
|
|
509
|
+
setErrorMessage(validationError);\r
|
|
510
|
+
return;\r
|
|
511
|
+
}\r
|
|
512
|
+
\r
|
|
513
|
+
setStatus('submitting');\r
|
|
514
|
+
setErrorMessage(null);\r
|
|
515
|
+
\r
|
|
516
|
+
try {\r
|
|
517
|
+
const res = await fetch(submitUrl, {\r
|
|
518
|
+
method: 'POST',\r
|
|
519
|
+
headers: { 'Content-Type': 'application/json' },\r
|
|
520
|
+
body: JSON.stringify(payload),\r
|
|
521
|
+
});\r
|
|
522
|
+
if (!res.ok) {\r
|
|
523
|
+
const text = await res.text();\r
|
|
524
|
+
throw new Error(text || \`Request failed: \${res.status}\`);\r
|
|
525
|
+
}\r
|
|
526
|
+
\r
|
|
527
|
+
setStatus('success');\r
|
|
528
|
+
setFieldValues(Object.fromEntries(visibleFields.map((f) => [f.name, ''])));\r
|
|
529
|
+
} catch (err) {\r
|
|
530
|
+
setStatus('error');\r
|
|
531
|
+
setErrorMessage(err instanceof Error ? err.message : 'Something went wrong');\r
|
|
532
|
+
}\r
|
|
533
|
+
};\r
|
|
534
|
+
\r
|
|
535
|
+
return (\r
|
|
536
|
+
<div className={\`\${P}-wrapper \${P}-type-\${type} \${wrapperStateClasses}\`.trim()} style={colorVars}>\r
|
|
537
|
+
<style dangerouslySetInnerHTML={{ __html: getCSS(P) }} />\r
|
|
538
|
+
<form\r
|
|
539
|
+
onSubmit={handleSubmit}\r
|
|
540
|
+
className={\`\${P}-form\`}\r
|
|
541
|
+
style={{ gap: scalingValue(gap ?? 0, isEditor) }}\r
|
|
542
|
+
>\r
|
|
543
|
+
<div\r
|
|
544
|
+
className={\`\${P}-fields\`}\r
|
|
545
|
+
style={{ gap: scalingValue(fieldsGap ?? 0, isEditor) }}\r
|
|
546
|
+
>\r
|
|
547
|
+
{visibleFields.map((field, index) => (\r
|
|
548
|
+
<div key={index} className={\`\${P}-field-group\${showLabels ? \` \${P}-labeled\` : ''}\`}>\r
|
|
549
|
+
{showLabels && (\r
|
|
550
|
+
<span className={\`\${P}-field-label\`} style={labelTextCss ? { ...labelTextCss, lineHeight: labelTextCss.fontSize } : undefined}>\r
|
|
551
|
+
{field.label || field.name}\r
|
|
552
|
+
</span>\r
|
|
553
|
+
)}\r
|
|
554
|
+
{field.type === 'textarea' ? (\r
|
|
555
|
+
<textarea\r
|
|
556
|
+
name={field.name}\r
|
|
557
|
+
autoComplete="off"\r
|
|
558
|
+
value={displayValues[field.name] ?? ''}\r
|
|
559
|
+
onChange={(e) => handleFieldChange(field.name, e.target.value)}\r
|
|
560
|
+
placeholder={field.placeholder}\r
|
|
561
|
+
className={\`\${P}-input\`}\r
|
|
562
|
+
style={inputFieldCss}\r
|
|
563
|
+
rows={1}\r
|
|
564
|
+
data-filled={isFilledPreview || ((displayValues[field.name] ?? '') as string).trim().length > 0}\r
|
|
565
|
+
data-field-type="textarea"\r
|
|
566
|
+
/>\r
|
|
567
|
+
) : (\r
|
|
568
|
+
<input\r
|
|
569
|
+
type={field.type === 'phone' ? 'tel' : field.type === 'email' ? 'email' : 'text'}\r
|
|
570
|
+
name={field.name}\r
|
|
571
|
+
autoComplete="off"\r
|
|
572
|
+
value={displayValues[field.name] ?? ''}\r
|
|
573
|
+
onChange={(e) => handleFieldChange(field.name, e.target.value)}\r
|
|
574
|
+
placeholder={field.placeholder}\r
|
|
575
|
+
required={field.isRequired ?? field.type === 'email'}\r
|
|
576
|
+
className={\`\${P}-input\`}\r
|
|
577
|
+
style={inputFieldCss}\r
|
|
578
|
+
data-filled={isFilledPreview || ((displayValues[field.name] ?? '') as string).trim().length > 0}\r
|
|
579
|
+
/>\r
|
|
580
|
+
)}\r
|
|
581
|
+
</div>\r
|
|
582
|
+
))}\r
|
|
583
|
+
</div>\r
|
|
584
|
+
<div className={\`\${P}-overlay-anchor\`}>\r
|
|
585
|
+
<button\r
|
|
586
|
+
type="submit"\r
|
|
587
|
+
className={\`\${P}-button\`}\r
|
|
588
|
+
style={{\r
|
|
589
|
+
borderStyle: 'solid',\r
|
|
590
|
+
borderRadius: scalingValue(buttonCorners ?? 0, isEditor),\r
|
|
591
|
+
borderWidth: strokeForButton,\r
|
|
592
|
+
paddingTop: scalingValue(buttonPadding?.top ?? 0, isEditor),\r
|
|
593
|
+
paddingRight: scalingValue(buttonPadding?.right ?? 0, isEditor),\r
|
|
594
|
+
paddingBottom: scalingValue(buttonPadding?.bottom ?? 0, isEditor),\r
|
|
595
|
+
paddingLeft: scalingValue(buttonPadding?.left ?? 0, isEditor),\r
|
|
596
|
+
...buttonTypographyCss,\r
|
|
597
|
+
...(isButtonFullWidth\r
|
|
598
|
+
? {\r
|
|
599
|
+
width: '100%',\r
|
|
600
|
+
textAlign: 'center',\r
|
|
601
|
+
whiteSpace: 'normal',\r
|
|
602
|
+
}\r
|
|
603
|
+
: {}),\r
|
|
604
|
+
}}\r
|
|
605
|
+
>\r
|
|
606
|
+
<span\r
|
|
607
|
+
className={\`\${P}-overlay-anchor\`}\r
|
|
608
|
+
style={isButtonFullWidth\r
|
|
609
|
+
? {\r
|
|
610
|
+
display: 'inline-block',\r
|
|
611
|
+
maxWidth: '100%',\r
|
|
612
|
+
whiteSpace: 'normal',\r
|
|
613
|
+
textAlign: 'center',\r
|
|
614
|
+
}\r
|
|
615
|
+
: undefined}\r
|
|
616
|
+
>\r
|
|
617
|
+
{status === 'submitting' ? '...' : buttonLabel}\r
|
|
618
|
+
</span>\r
|
|
619
|
+
</button>\r
|
|
620
|
+
</div>\r
|
|
621
|
+
</form>\r
|
|
622
|
+
{displayStatus === 'success' && (\r
|
|
623
|
+
<p\r
|
|
624
|
+
className={\`\${P}-success\`}\r
|
|
625
|
+
style={{ ...statusTypographyCss }}\r
|
|
626
|
+
>\r
|
|
627
|
+
{successMessage}\r
|
|
628
|
+
</p>\r
|
|
629
|
+
)}\r
|
|
630
|
+
{displayStatus === 'error' && (\r
|
|
631
|
+
<p\r
|
|
632
|
+
className={\`\${P}-error\`}\r
|
|
633
|
+
style={{ ...statusTypographyCss }}\r
|
|
634
|
+
role="alert"\r
|
|
635
|
+
>\r
|
|
636
|
+
{validationErrorMessage ?? displayError ?? errorMessageText}\r
|
|
637
|
+
</p>\r
|
|
638
|
+
)}\r
|
|
639
|
+
</div>\r
|
|
640
|
+
);\r
|
|
641
|
+
}\r
|
|
642
|
+
\r
|
|
643
|
+
export type FormFieldType = 'text' | 'textarea' | 'phone' | 'email';\r
|
|
644
|
+
\r
|
|
645
|
+
export type FormFieldItem = {\r
|
|
646
|
+
name: string;\r
|
|
647
|
+
type: FormFieldType;\r
|
|
648
|
+
placeholder: string;\r
|
|
649
|
+
label?: string;\r
|
|
650
|
+
isRequired?: boolean;\r
|
|
651
|
+
error?: string;\r
|
|
652
|
+
};\r
|
|
653
|
+
\r
|
|
654
|
+
type Padding = {\r
|
|
655
|
+
top?: number;\r
|
|
656
|
+
right?: number;\r
|
|
657
|
+
bottom?: number;\r
|
|
658
|
+
left?: number;\r
|
|
659
|
+
};\r
|
|
660
|
+
\r
|
|
661
|
+
type ColorKeys =\r
|
|
662
|
+
| 'inputColor'\r
|
|
663
|
+
| 'inputTextColor'\r
|
|
664
|
+
| 'inputBorderColor'\r
|
|
665
|
+
| 'placeholderColor'\r
|
|
666
|
+
| 'buttonColor'\r
|
|
667
|
+
| 'buttonTextColor'\r
|
|
668
|
+
| 'buttonBorderColor'\r
|
|
669
|
+
| 'labelTextColor'\r
|
|
670
|
+
| 'successColor'\r
|
|
671
|
+
| 'errorColor';\r
|
|
672
|
+
\r
|
|
673
|
+
type StateColorOverrides = Partial<Record<ColorKeys, string>>;\r
|
|
674
|
+
\r
|
|
675
|
+
type FormSettings = {\r
|
|
676
|
+
type: 'A' | 'B' | 'C';\r
|
|
677
|
+
fontFamily: string;\r
|
|
678
|
+
fieldsToShow: number;\r
|
|
679
|
+
fields: FormFieldItem[];\r
|
|
680
|
+
buttonLabel?: string;\r
|
|
681
|
+
gap?: number;\r
|
|
682
|
+
fieldsGap?: number;\r
|
|
683
|
+
inputFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
684
|
+
inputFontSize?: number;\r
|
|
685
|
+
inputLineHeight?: number;\r
|
|
686
|
+
inputLetterSpacing?: number;\r
|
|
687
|
+
inputWordSpacing?: number;\r
|
|
688
|
+
inputTextAppearance?: TextStyles['textAppearance'];\r
|
|
689
|
+
buttonFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
690
|
+
buttonFontSize?: number;\r
|
|
691
|
+
buttonLineHeight?: number;\r
|
|
692
|
+
buttonLetterSpacing?: number;\r
|
|
693
|
+
buttonWordSpacing?: number;\r
|
|
694
|
+
buttonTextAppearance?: TextStyles['textAppearance'];\r
|
|
695
|
+
labelFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
696
|
+
labelFontSize?: number;\r
|
|
697
|
+
labelLineHeight?: number;\r
|
|
698
|
+
labelLetterSpacing?: number;\r
|
|
699
|
+
labelWordSpacing?: number;\r
|
|
700
|
+
labelTextAppearance?: TextStyles['textAppearance'];\r
|
|
701
|
+
statusFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
702
|
+
statusFontSize?: number;\r
|
|
703
|
+
statusLineHeight?: number;\r
|
|
704
|
+
statusLetterSpacing?: number;\r
|
|
705
|
+
statusWordSpacing?: number;\r
|
|
706
|
+
statusTextAppearance?: TextStyles['textAppearance'];\r
|
|
707
|
+
buttonCorners?: number;\r
|
|
708
|
+
buttonStroke?: number;\r
|
|
709
|
+
buttonPadding?: Padding;\r
|
|
710
|
+
isButtonFullWidth?: boolean;\r
|
|
711
|
+
inputCorners?: number;\r
|
|
712
|
+
inputStroke?: number;\r
|
|
713
|
+
inputPadding?: Padding;\r
|
|
714
|
+
inputColor: string;\r
|
|
715
|
+
inputTextColor: string;\r
|
|
716
|
+
inputBorderColor: string;\r
|
|
717
|
+
buttonColor: string;\r
|
|
718
|
+
buttonTextColor: string;\r
|
|
719
|
+
buttonBorderColor: string;\r
|
|
720
|
+
placeholderColor: string;\r
|
|
721
|
+
labelTextColor: string;\r
|
|
722
|
+
successColor: string;\r
|
|
723
|
+
errorColor: string;\r
|
|
724
|
+
successMessage: string;\r
|
|
725
|
+
errorMessage: string;\r
|
|
726
|
+
stateOverrides?: Record<string, StateColorOverrides>;\r
|
|
727
|
+
};\r
|
|
728
|
+
\r
|
|
729
|
+
const COLOR_VAR_MAP: Record<ColorKeys, string> = {\r
|
|
730
|
+
inputColor: 'input-color',\r
|
|
731
|
+
inputTextColor: 'input-text-color',\r
|
|
732
|
+
inputBorderColor: 'input-border-color',\r
|
|
733
|
+
placeholderColor: 'placeholder-color',\r
|
|
734
|
+
buttonColor: 'button-color',\r
|
|
735
|
+
buttonTextColor: 'button-text-color',\r
|
|
736
|
+
buttonBorderColor: 'button-border-color',\r
|
|
737
|
+
labelTextColor: 'label-text-color',\r
|
|
738
|
+
successColor: 'success-color',\r
|
|
739
|
+
errorColor: 'error-color',\r
|
|
740
|
+
};\r
|
|
741
|
+
\r
|
|
742
|
+
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;\r
|
|
743
|
+
`,Ll=[{name:"email",type:"email",placeholder:"Enter your email",label:"Email",isRequired:!0,error:"Please, enter a valid e-mail."},{name:"name",type:"text",placeholder:"Enter your name",label:"Name",isRequired:!1,error:"Please, enter your name."},{name:"company",type:"text",placeholder:"Enter company",label:"Company",isRequired:!1,error:"Please, enter your company name."},{name:"phone",type:"phone",placeholder:"Enter your phone",label:"Phone",isRequired:!1,error:"Please, enter a valid phone number."},{name:"message",type:"textarea",placeholder:"Enter your message",label:"Message",isRequired:!1,error:"Message is required"},{name:"message2",type:"textarea",placeholder:"Enter your message 2",label:"Message 2",isRequired:!1,error:"Message 2 is required"},{name:"message3",type:"textarea",placeholder:"Enter your message 3",label:"Message 3",isRequired:!1,error:"Message 3 is required"}],Ke={fontSettings:{type:"object",display:{type:"font-settings-weight"},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}}},El=["inputColor","inputTextColor","inputBorderColor","placeholderColor","buttonColor","buttonTextColor","buttonBorderColor","labelTextColor","successColor","errorColor"],Al={type:"object",version:1,settings:{sizing:"auto manual",properties:{fieldsToShow:{type:"number",scope:"common",title:"Fields",display:{type:"number"},min:1,max:7},fields:{type:"array",scope:"common",display:{type:"fields-group"},items:{type:"object",properties:{name:{type:"string"},type:{type:"string",enum:["text","textarea","phone","email"]},placeholder:{type:"string"},label:{type:"string"},isRequired:{type:"boolean"},error:{type:"string"}}}},buttonLabel:{type:"string",scope:"common",title:"Button Label",display:{type:"text-input"}},successMessage:{type:"string",scope:"common",title:"Success Message",display:{type:"text-input"}},errorMessage:{type:"string",scope:"common",title:"Error Message",display:{type:"text-input"}},type:{type:"string",scope:"common",title:"",display:{type:"radio-group"},enum:["A","B","C"]},gap:{type:"number",scope:"layout",title:"Gap",display:{type:"range-control"},min:0,max:100},fieldsGap:{type:"number",scope:"layout",title:"Gap",display:{type:"range-control",enabled:!0},min:0,max:100},buttonPadding:{type:"object",scope:"layout",title:"Padding",display:{type:"padding-controls"}},inputPadding:{type:"object",scope:"layout",title:"Padding",display:{type:"padding-controls"}},buttonStroke:{type:"number",scope:"layout",title:"Stroke",display:{type:"range-control"},min:0,max:20},buttonCorners:{type:"number",scope:"layout",title:"Corners",display:{type:"range-control",enabled:!0},min:0,max:100},inputStroke:{type:"number",scope:"layout",title:"Stroke",display:{type:"range-control"},min:0,max:20},inputCorners:{type:"number",scope:"layout",title:"Corners",display:{type:"range-control",enabled:!0},min:0,max:100},inputColor:{type:"string",scope:"common",title:"Input Fill",display:{type:"palette-color-picker"}},inputTextColor:{type:"string",scope:"common",title:"Input Label",display:{type:"palette-color-picker"}},inputBorderColor:{type:"string",scope:"common",title:"Input Stroke",display:{type:"palette-color-picker"}},placeholderColor:{type:"string",scope:"common",title:"Filler text",display:{type:"palette-color-picker"}},buttonColor:{type:"string",scope:"common",title:"Button Fill",display:{type:"palette-color-picker"}},buttonTextColor:{type:"string",scope:"common",title:"Button Label",display:{type:"palette-color-picker"}},isButtonFullWidth:{type:"boolean",scope:"common",title:"Full Width",display:{type:"toggle",enum:["On","Off"]}},buttonBorderColor:{type:"string",scope:"common",title:"Button Stroke",display:{type:"palette-color-picker"}},labelTextColor:{type:"string",scope:"common",title:"Label Color",display:{type:"palette-color-picker",visible:!1}},successColor:{type:"string",scope:"common",title:"Success Message Color",display:{type:"palette-color-picker"}},errorColor:{type:"string",scope:"common",title:"Error Message Color",display:{type:"palette-color-picker"}},stateOverrides:{type:"object",scope:"common"},fontFamily:{type:"string",scope:"common",title:"Font family",display:{type:"font-family-select"}},inputFontSettings:{...Ke.fontSettings,scope:"common",title:"Input",display:{type:"font-settings-weight"}},inputFontSize:{type:"number",scope:"layout",title:"Input Font Size",display:{type:"font-size"}},inputLineHeight:{type:"number",scope:"layout",title:"Input Line Height",display:{type:"line-height-input"}},inputLetterSpacing:{type:"number",scope:"layout",title:"Input Letter Spacing",display:{type:"letter-spacing-input"}},inputWordSpacing:{type:"number",scope:"layout",title:"Input Word Spacing",display:{type:"word-spacing-input"}},inputTextAppearance:{type:"object",scope:"layout",title:"Input Text Appearance",display:{type:"text-appearance"}},buttonFontSettings:{...Ke.fontSettings,scope:"common",title:"Button",display:{type:"font-settings-weight"}},buttonFontSize:{type:"number",scope:"layout",title:"Button Font Size",display:{type:"font-size"}},buttonLineHeight:{type:"number",scope:"layout",title:"Button Line Height",display:{type:"line-height-input"}},buttonLetterSpacing:{type:"number",scope:"layout",title:"Button Letter Spacing",display:{type:"letter-spacing-input"}},buttonWordSpacing:{type:"number",scope:"layout",title:"Button Word Spacing",display:{type:"word-spacing-input"}},buttonTextAppearance:{type:"object",scope:"layout",title:"Button Text Appearance",display:{type:"text-appearance"}},labelFontSettings:{...Ke.fontSettings,scope:"common",title:"Label",display:{type:"font-settings-weight",visible:!1}},labelFontSize:{type:"number",scope:"layout",title:"Label Font Size",display:{type:"font-size",visible:!1}},labelLineHeight:{type:"number",scope:"layout",title:"Label Line Height",display:{type:"line-height-input",visible:!1}},labelLetterSpacing:{type:"number",scope:"layout",title:"Label Letter Spacing",display:{type:"letter-spacing-input",visible:!1}},labelWordSpacing:{type:"number",scope:"layout",title:"Label Word Spacing",display:{type:"word-spacing-input",visible:!1}},labelTextAppearance:{type:"object",scope:"layout",title:"Label Text Appearance",display:{type:"text-appearance",visible:!1}},statusFontSettings:{...Ke.fontSettings,scope:"common",title:"Success/Error"},statusFontSize:{type:"number",scope:"layout",title:"Success/Error Font Size",display:{type:"font-size"}},statusLineHeight:{type:"number",scope:"layout",title:"Success/Error Line Height",display:{type:"line-height-input"}},statusLetterSpacing:{type:"number",scope:"layout",title:"Success/Error Letter Spacing",display:{type:"letter-spacing-input"}},statusWordSpacing:{type:"number",scope:"layout",title:"Success/Error Word Spacing",display:{type:"word-spacing-input"}},statusTextAppearance:{type:"object",scope:"layout",title:"Success/Error Text Appearance",display:{type:"text-appearance"}}},defaults:{fieldsToShow:2,fields:Ll,type:"A",inputColor:"#FFFFFF",inputTextColor:"#0A00F8",inputBorderColor:"#E2E2E2",placeholderColor:"#808080",buttonColor:"#0A00F8",buttonTextColor:"#ffffff",buttonBorderColor:"#0A00F8",labelTextColor:"#999999",successColor:"#22c55e",errorColor:"#ef4444",stateOverrides:{hover:{buttonColor:"#194EFF"}},fontFamily:"Arial",inputFontSettings:{fontWeight:400,fontStyle:"normal"},inputLetterSpacing:0,inputWordSpacing:0,inputTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},buttonFontSettings:{fontWeight:400,fontStyle:"normal"},buttonLetterSpacing:0,buttonWordSpacing:0,buttonTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},labelFontSettings:{fontWeight:400,fontStyle:"normal"},labelLetterSpacing:0,labelWordSpacing:0,labelTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},statusFontSettings:{fontWeight:400,fontStyle:"normal"},statusLetterSpacing:0,statusWordSpacing:0,statusTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},isButtonFullWidth:!1,buttonLabel:"Sign up",successMessage:"Thanks for subscribing!",errorMessage:"Please, fill all required fields."},layoutDefaults:{m:{gap:.032,fieldsGap:.032,buttonStroke:0,buttonCorners:.192,inputStroke:.003,inputCorners:.192,buttonPadding:{top:.0373,right:.0373,bottom:.0373,left:.0373},inputPadding:{top:.0373,right:.0373,bottom:.0373,left:.0373},inputFontSize:.043,inputLineHeight:.043,buttonFontSize:.0373,buttonLineHeight:.0373,labelFontSize:.0373,labelLineHeight:.0373,statusFontSize:.0373,statusLineHeight:.0373},d:{gap:.0083,fieldsGap:.0083,buttonStroke:0,buttonCorners:.05,inputStroke:.001,inputCorners:.05,buttonPadding:{top:.01,right:.01,bottom:.01,left:.01},inputPadding:{top:.01,right:.01,bottom:.01,left:.01},inputFontSize:.01,inputLineHeight:.01,buttonFontSize:.01,buttonLineHeight:.01,labelFontSize:.01,labelLineHeight:.01,statusFontSize:.01,statusLineHeight:.01}},displayRules:[{if:{name:"type",value:"B"},then:{name:"properties.labelTextColor.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelFontSettings.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelFontSize.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelLineHeight.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelLetterSpacing.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelWordSpacing.display.visible",value:!0}},{if:{name:"type",value:"B"},then:{name:"properties.labelTextAppearance.display.visible",value:!0}},{if:{name:"type",value:"C"},then:{name:"properties.buttonCorners.display.enabled",value:!1}},{if:{name:"type",value:"C"},then:{name:"properties.inputCorners.display.enabled",value:!1}},{if:{name:"buttonStroke",value:0},then:{name:"properties.buttonBorderColor.display.visible",value:!1}},{if:{name:"inputStroke",value:0},then:{name:"properties.inputBorderColor.display.visible",value:!1}},{if:{name:"fieldsToShow",value:1},then:{name:"properties.fieldsGap.display.enabled",value:!1}}]},panels:[{id:"general",icon:"cursor",title:"General",tooltip:"General Settings",layout:[{type:"row",items:["__componentName__","name","fieldsToShow"]},"type",{type:"group",title:"",items:[{type:"row",title:"Input",items:[{type:"group",title:"",items:["fieldsGap","inputStroke","inputCorners"]},{type:"group",title:"",items:["inputPadding"]}]},{type:"group",title:"Button",items:[{type:"row",items:["isButtonFullWidth"]},{type:"row",items:[{type:"group",title:"",items:["gap","buttonStroke","buttonCorners"]},{type:"group",title:"",items:["buttonPadding"]}]}]}]}]},{id:"typeStyle",icon:"text-icon",title:"Type Style",tooltip:"Typography",layout:["fontFamily",{type:"group",title:"",items:["inputFontSettings",{type:"row",items:["inputFontSize","inputLineHeight","inputLetterSpacing","inputWordSpacing"]},"inputTextAppearance"]},{type:"group",title:"",items:["buttonFontSettings",{type:"row",items:["buttonFontSize","buttonLineHeight","buttonLetterSpacing","buttonWordSpacing"]},"buttonTextAppearance"]},{type:"group",title:"",items:["labelFontSettings",{type:"row",items:["labelFontSize","labelLineHeight","labelLetterSpacing","labelWordSpacing"]},"labelTextAppearance"]},{type:"group",title:"",items:["statusFontSettings",{type:"row",items:["statusFontSize","statusLineHeight","statusLetterSpacing","statusWordSpacing"]},"statusTextAppearance"]}]},{id:"fields",icon:"layers",title:"Fields",tooltip:"Fields",layout:["fields","buttonLabel","successMessage","errorMessage"]}],paletteBookmark:{items:[...El],panelIds:["general","typeStyle"],stateItems:{default:["placeholderColor","inputColor","inputBorderColor","buttonTextColor","buttonColor","buttonBorderColor","labelTextColor"],hover:["inputColor","inputBorderColor","buttonTextColor","buttonColor","buttonBorderColor"],focus:["inputColor","inputBorderColor","buttonTextColor","buttonColor","buttonBorderColor"],filled:["inputTextColor","inputColor","inputBorderColor","buttonTextColor"],success:["successColor"],error:["errorColor"]}},allowedPlugins:["newsletter"],states:["default","hover","focus","filled","success","error"]},Il={element:$l,id:"form",name:"Newsletter Stacked",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/formImg.jpg"},version:1,defaultSize:{width:300,height:42},schema:Al,sourceCode:Tl};function Je(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function Fl(t){return`
|
|
744
|
+
.${t}-wrapper {
|
|
745
745
|
display: flex;
|
|
746
746
|
flex-direction: column;
|
|
747
747
|
width: 100%;
|
|
@@ -749,90 +749,90 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
749
749
|
align-items: stretch;
|
|
750
750
|
justify-content: center;
|
|
751
751
|
}
|
|
752
|
-
.${
|
|
752
|
+
.${t}-form {
|
|
753
753
|
display: flex;
|
|
754
754
|
width: 100%;
|
|
755
755
|
align-items: stretch;
|
|
756
756
|
overflow: hidden;
|
|
757
|
-
border-color: var(--${
|
|
757
|
+
border-color: var(--${t}-stroke-color);
|
|
758
758
|
transition: border-color 250ms;
|
|
759
759
|
}
|
|
760
|
-
.${
|
|
761
|
-
border-color: var(--${
|
|
760
|
+
.${t}-form:hover {
|
|
761
|
+
border-color: var(--${t}-hover-stroke-color, var(--${t}-stroke-color));
|
|
762
762
|
}
|
|
763
|
-
.${
|
|
764
|
-
border-color: var(--${
|
|
763
|
+
.${t}-form:focus-within {
|
|
764
|
+
border-color: var(--${t}-focus-stroke-color, var(--${t}-stroke-color));
|
|
765
765
|
}
|
|
766
|
-
.${
|
|
767
|
-
border-color: var(--${
|
|
766
|
+
.${t}-wrapper.${t}-state-hover .${t}-form {
|
|
767
|
+
border-color: var(--${t}-hover-stroke-color, var(--${t}-stroke-color));
|
|
768
768
|
}
|
|
769
|
-
.${
|
|
770
|
-
border-color: var(--${
|
|
769
|
+
.${t}-wrapper.${t}-state-focus .${t}-form {
|
|
770
|
+
border-color: var(--${t}-focus-stroke-color, var(--${t}-stroke-color));
|
|
771
771
|
}
|
|
772
|
-
.${
|
|
773
|
-
border-color: var(--${
|
|
772
|
+
.${t}-wrapper.${t}-state-filled .${t}-form {
|
|
773
|
+
border-color: var(--${t}-filled-stroke-color, var(--${t}-stroke-color));
|
|
774
774
|
}
|
|
775
|
-
.${
|
|
775
|
+
.${t}-inputWrap {
|
|
776
776
|
position: relative;
|
|
777
777
|
display: flex;
|
|
778
778
|
align-items: center;
|
|
779
779
|
flex: 1;
|
|
780
780
|
min-width: 0;
|
|
781
|
-
background-color: var(--${
|
|
781
|
+
background-color: var(--${t}-input-color);
|
|
782
782
|
transition: background-color 250ms;
|
|
783
783
|
}
|
|
784
|
-
.${
|
|
785
|
-
.${
|
|
786
|
-
background-color: var(--${
|
|
784
|
+
.${t}-inputWrap:hover,
|
|
785
|
+
.${t}-wrapper.${t}-state-hover .${t}-inputWrap {
|
|
786
|
+
background-color: var(--${t}-hover-input-color, var(--${t}-input-color));
|
|
787
787
|
}
|
|
788
|
-
.${
|
|
789
|
-
.${
|
|
790
|
-
background-color: var(--${
|
|
788
|
+
.${t}-inputWrap:focus-within,
|
|
789
|
+
.${t}-wrapper.${t}-state-focus .${t}-inputWrap {
|
|
790
|
+
background-color: var(--${t}-focus-input-color, var(--${t}-input-color));
|
|
791
791
|
}
|
|
792
|
-
.${
|
|
793
|
-
background-color: var(--${
|
|
792
|
+
.${t}-wrapper.${t}-state-filled .${t}-inputWrap {
|
|
793
|
+
background-color: var(--${t}-filled-input-color, var(--${t}-input-color));
|
|
794
794
|
}
|
|
795
|
-
.${
|
|
795
|
+
.${t}-input {
|
|
796
796
|
flex: 1;
|
|
797
797
|
min-width: 0;
|
|
798
798
|
background: transparent;
|
|
799
799
|
border: none;
|
|
800
800
|
outline: none;
|
|
801
801
|
-webkit-tap-highlight-color: transparent;
|
|
802
|
-
color: var(--${
|
|
802
|
+
color: var(--${t}-input-text-color);
|
|
803
803
|
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
804
804
|
}
|
|
805
|
-
.${
|
|
806
|
-
color: var(--${
|
|
805
|
+
.${t}-input:hover {
|
|
806
|
+
color: var(--${t}-hover-input-text-color, var(--${t}-input-text-color));
|
|
807
807
|
}
|
|
808
|
-
.${
|
|
809
|
-
.${
|
|
810
|
-
color: var(--${
|
|
808
|
+
.${t}-inputWrap:hover .${t}-input,
|
|
809
|
+
.${t}-wrapper.${t}-state-hover .${t}-input {
|
|
810
|
+
color: var(--${t}-hover-input-text-color, var(--${t}-input-text-color));
|
|
811
811
|
}
|
|
812
|
-
.${
|
|
813
|
-
.${
|
|
814
|
-
color: var(--${
|
|
812
|
+
.${t}-input:focus,
|
|
813
|
+
.${t}-wrapper.${t}-state-focus .${t}-input {
|
|
814
|
+
color: var(--${t}-focus-input-text-color, var(--${t}-input-text-color));
|
|
815
815
|
}
|
|
816
|
-
.${
|
|
817
|
-
color: var(--${
|
|
816
|
+
.${t}-wrapper.${t}-state-filled .${t}-input {
|
|
817
|
+
color: var(--${t}-filled-input-text-color, var(--${t}-input-text-color));
|
|
818
818
|
}
|
|
819
|
-
.${
|
|
820
|
-
color: var(--${
|
|
819
|
+
.${t}-input::placeholder {
|
|
820
|
+
color: var(--${t}-placeholder-color);
|
|
821
821
|
opacity: 1;
|
|
822
822
|
transition: color 250ms, opacity 250ms;
|
|
823
823
|
}
|
|
824
|
-
.${
|
|
825
|
-
.${
|
|
826
|
-
color: var(--${
|
|
824
|
+
.${t}-inputWrap:hover .${t}-input::placeholder,
|
|
825
|
+
.${t}-wrapper.${t}-state-hover .${t}-input::placeholder {
|
|
826
|
+
color: var(--${t}-hover-placeholder-color, var(--${t}-placeholder-color));
|
|
827
827
|
}
|
|
828
|
-
.${
|
|
829
|
-
.${
|
|
830
|
-
color: var(--${
|
|
828
|
+
.${t}-inputWrap:focus-within .${t}-input::placeholder,
|
|
829
|
+
.${t}-wrapper.${t}-state-focus .${t}-input::placeholder {
|
|
830
|
+
color: var(--${t}-focus-placeholder-color, var(--${t}-placeholder-color));
|
|
831
831
|
}
|
|
832
|
-
.${
|
|
833
|
-
color: var(--${
|
|
832
|
+
.${t}-wrapper.${t}-state-filled .${t}-input::placeholder {
|
|
833
|
+
color: var(--${t}-filled-placeholder-color, var(--${t}-placeholder-color));
|
|
834
834
|
}
|
|
835
|
-
.${
|
|
835
|
+
.${t}-submitBtn {
|
|
836
836
|
box-sizing: border-box;
|
|
837
837
|
height: 100%;
|
|
838
838
|
display: flex;
|
|
@@ -841,13 +841,13 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
841
841
|
border: none;
|
|
842
842
|
cursor: pointer;
|
|
843
843
|
white-space: nowrap;
|
|
844
|
-
background-color: var(--${
|
|
845
|
-
color: var(--${
|
|
844
|
+
background-color: var(--${t}-button-color);
|
|
845
|
+
color: var(--${t}-button-text-color);
|
|
846
846
|
border-left-style: solid;
|
|
847
|
-
border-left-color: var(--${
|
|
847
|
+
border-left-color: var(--${t}-stroke-color);
|
|
848
848
|
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
849
849
|
}
|
|
850
|
-
.${
|
|
850
|
+
.${t}-submitBtn img {
|
|
851
851
|
display: block;
|
|
852
852
|
box-sizing: border-box;
|
|
853
853
|
flex: 0 1 auto;
|
|
@@ -858,7 +858,7 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
858
858
|
max-height: 100%;
|
|
859
859
|
object-fit: contain;
|
|
860
860
|
}
|
|
861
|
-
.${
|
|
861
|
+
.${t}-submitBtn svg {
|
|
862
862
|
display: block;
|
|
863
863
|
box-sizing: border-box;
|
|
864
864
|
flex: 0 1 auto;
|
|
@@ -868,7 +868,7 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
868
868
|
max-width: 100%;
|
|
869
869
|
max-height: 100%;
|
|
870
870
|
}
|
|
871
|
-
.${
|
|
871
|
+
.${t}-submitBtn .${t}-submitBtnIcon {
|
|
872
872
|
position: relative;
|
|
873
873
|
top: auto;
|
|
874
874
|
left: auto;
|
|
@@ -884,58 +884,687 @@ const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
|
884
884
|
max-width: 100%;
|
|
885
885
|
max-height: 100%;
|
|
886
886
|
}
|
|
887
|
-
.${
|
|
888
|
-
.${
|
|
889
|
-
background-color: var(--${
|
|
890
|
-
color: var(--${
|
|
891
|
-
border-left-color: var(--${
|
|
887
|
+
.${t}-submitBtn:hover,
|
|
888
|
+
.${t}-wrapper.${t}-state-hover .${t}-submitBtn {
|
|
889
|
+
background-color: var(--${t}-hover-button-color, var(--${t}-button-color));
|
|
890
|
+
color: var(--${t}-hover-button-text-color, var(--${t}-button-text-color));
|
|
891
|
+
border-left-color: var(--${t}-hover-stroke-color, var(--${t}-stroke-color));
|
|
892
892
|
}
|
|
893
|
-
.${
|
|
894
|
-
.${
|
|
895
|
-
background-color: var(--${
|
|
896
|
-
color: var(--${
|
|
897
|
-
border-left-color: var(--${
|
|
893
|
+
.${t}-submitBtn:focus,
|
|
894
|
+
.${t}-wrapper.${t}-state-focus .${t}-submitBtn {
|
|
895
|
+
background-color: var(--${t}-focus-button-color, var(--${t}-button-color));
|
|
896
|
+
color: var(--${t}-focus-button-text-color, var(--${t}-button-text-color));
|
|
897
|
+
border-left-color: var(--${t}-focus-stroke-color, var(--${t}-stroke-color));
|
|
898
898
|
}
|
|
899
|
-
.${
|
|
900
|
-
background-color: var(--${
|
|
901
|
-
color: var(--${
|
|
902
|
-
border-left-color: var(--${
|
|
899
|
+
.${t}-wrapper.${t}-state-filled .${t}-submitBtn {
|
|
900
|
+
background-color: var(--${t}-filled-button-color, var(--${t}-button-color));
|
|
901
|
+
color: var(--${t}-filled-button-text-color, var(--${t}-button-text-color));
|
|
902
|
+
border-left-color: var(--${t}-filled-stroke-color, var(--${t}-stroke-color));
|
|
903
903
|
}
|
|
904
|
-
.${
|
|
905
|
-
.${
|
|
906
|
-
background-color: var(--${
|
|
904
|
+
.${t}-submitBtn:hover .${t}-submitBtnIcon,
|
|
905
|
+
.${t}-wrapper.${t}-state-hover .${t}-submitBtn .${t}-submitBtnIcon {
|
|
906
|
+
background-color: var(--${t}-hover-button-text-color, var(--${t}-button-text-color));
|
|
907
907
|
}
|
|
908
|
-
.${
|
|
909
|
-
.${
|
|
910
|
-
background-color: var(--${
|
|
908
|
+
.${t}-submitBtn:focus .${t}-submitBtnIcon,
|
|
909
|
+
.${t}-wrapper.${t}-state-focus .${t}-submitBtn .${t}-submitBtnIcon {
|
|
910
|
+
background-color: var(--${t}-focus-button-text-color, var(--${t}-button-text-color));
|
|
911
911
|
}
|
|
912
|
-
.${
|
|
913
|
-
background-color: var(--${
|
|
912
|
+
.${t}-wrapper.${t}-state-filled .${t}-submitBtn .${t}-submitBtnIcon {
|
|
913
|
+
background-color: var(--${t}-filled-button-text-color, var(--${t}-button-text-color));
|
|
914
914
|
}
|
|
915
|
-
.${
|
|
916
|
-
.${
|
|
915
|
+
.${t}-wrapper.${t}-state-success .${t}-input,
|
|
916
|
+
.${t}-wrapper.${t}-state-success .${t}-submitBtn {
|
|
917
917
|
pointer-events: none;
|
|
918
918
|
}
|
|
919
|
-
.${
|
|
919
|
+
.${t}-overlayAnchor {
|
|
920
920
|
position: relative;
|
|
921
921
|
display: flex;
|
|
922
922
|
align-items: center;
|
|
923
923
|
}
|
|
924
|
-
.${
|
|
925
|
-
margin-top: ${
|
|
926
|
-
font-size: ${
|
|
927
|
-
color: var(--${
|
|
924
|
+
.${t}-success {
|
|
925
|
+
margin-top: ${Je(8)};
|
|
926
|
+
font-size: ${Je(14)};
|
|
927
|
+
color: var(--${t}-success-success-color, var(--${t}-success-color));
|
|
928
|
+
}
|
|
929
|
+
.${t}-error {
|
|
930
|
+
margin-top: ${Je(8)};
|
|
931
|
+
font-size: ${Je(14)};
|
|
932
|
+
color: var(--${t}-error-error-color, var(--${t}-error-color));
|
|
933
|
+
}
|
|
934
|
+
`}const kl=({settings:t,isEditor:e,metadata:n,activeEvent:r})=>{const{prefix:o}=E.useScopedStyles(),{fields:a=[{name:"email",type:"email",placeholder:"Your email"}],buttonIcon:i,buttonLabel:c,fieldsToShow:s=1,fontFamily:d,inputFontSettings:l,inputFontSize:w,inputLineHeight:b,inputLetterSpacing:g,inputWordSpacing:u,inputTextAppearance:m,buttonFontSettings:S,buttonFontSize:y,buttonLineHeight:v,buttonLetterSpacing:C,buttonWordSpacing:M,buttonTextAppearance:B,statusFontSettings:$,statusFontSize:f,statusLineHeight:T,statusLetterSpacing:A,statusWordSpacing:z,statusTextAppearance:L,iconMaxWidth:k,minHeight:W,corners:D,stroke:H,stateOverrides:h,inputPadding:O,buttonPadding:F,successMessage:I="Thanks for subscribing!",errorMessage:_="Please, fill all required fields."}=t,P=a.slice(0,Math.min(s,a.length)),[X,it]=V.useState(()=>Object.fromEntries(P.map(rt=>[rt.name,""]))),[et,st]=V.useState("idle"),[R,K]=V.useState(null),ft=r==="success"?"success":r==="error"?"error":et,ct=r==="error"?_:R,dt=r==="filled",St=V.useMemo(()=>{if(!dt)return X;let rt=null;for(const _t of P)(X[_t.name]??"").trim().length>0||(rt=rt??{...X},rt[_t.name]="Filled");return rt??X},[dt,X,P]),Pt=ft==="error"?E.getFormFieldValidationError(P,St):null,j=r&&r!=="default"?`${o}-state-${r}`:"",x=P.some(rt=>(St[rt.name]??"").trim().length>0),G=j!==`${o}-state-filled`&&x?`${o}-state-filled`:"",q=`${j} ${G}`.trim(),J=n==null?void 0:n.submitUrl,nt=c??"",Z=(i==null?void 0:i.icon)??"",Y=(i==null?void 0:i.mode)==="On",ot=nt||"Submit",ht={fontSettings:{fontFamily:d,fontWeight:(l==null?void 0:l.fontWeight)??400,fontStyle:(l==null?void 0:l.fontStyle)??"normal"},fontSize:w??.01,lineHeight:b,letterSpacing:g??0,wordSpacing:u??0,textAppearance:m,color:t.inputTextColor??"#111111"},lt={fontSettings:{fontFamily:d,fontWeight:(S==null?void 0:S.fontWeight)??400,fontStyle:(S==null?void 0:S.fontStyle)??"normal"},fontSize:y??.01,lineHeight:v,letterSpacing:C??0,wordSpacing:M??0,textAppearance:B,color:t.buttonTextColor??"#ffffff"},gt={fontSettings:{fontFamily:d,fontWeight:($==null?void 0:$.fontWeight)??400,fontStyle:($==null?void 0:$.fontStyle)??"normal"},fontSize:f??.01,lineHeight:T,letterSpacing:A??0,wordSpacing:z??0,textAppearance:L,color:t.successColor??"#22c55e"},wt=Zt(Gt(ht,e)),Q=Zt(Gt(lt,e)),ut=Zt(Gt(gt,e)),xt=E.buildColorVars(o,{strokeColor:t.strokeColor,inputColor:t.inputColor,placeholderColor:t.placeholderColor,buttonColor:t.buttonColor,successColor:t.successColor,errorColor:t.errorColor,inputTextColor:t.inputTextColor??(ht==null?void 0:ht.color)??"#111111",buttonTextColor:t.buttonTextColor??(lt==null?void 0:lt.color)??"#ffffff"},Rl,Ol,h),Bt={borderRadius:E.scalingValue(D,e),borderWidth:E.scalingValue(H,e),borderStyle:"solid"},_e={borderLeftWidth:E.scalingValue(H,e)},Yt=async rt=>{rt.preventDefault();const _t=Object.fromEntries(P.map(at=>{var Ct;return[at.name,((Ct=X[at.name])==null?void 0:Ct.trim())??""]}).filter(([,at])=>at));if(!J){st("error"),K("No integrations were found for this form.");return}if(Object.keys(_t).length===0)return;const Lt=E.getFormFieldValidationError(P,X);if(Lt){st("error"),K(Lt);return}st("submitting"),K(null);try{const at=await fetch(J,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_t)});if(!at.ok){const Ct=await at.text();throw new Error(Ct||`Request failed: ${at.status}`)}st("success"),it(Object.fromEntries(P.map(Ct=>[Ct.name,""])))}catch(at){st("error"),K(at instanceof Error?at.message:"Something went wrong")}};return p.jsxs("div",{className:`${o}-wrapper ${q}`.trim(),style:xt,children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:Fl(o)}}),p.jsxs("form",{onSubmit:Yt,className:`${o}-form`,style:{...Bt,height:E.scalingValue(W,e),minHeight:E.scalingValue(W,e)},children:[p.jsx("div",{className:`${o}-inputWrap ${o}-overlayAnchor`,style:{flex:1,minWidth:0},children:P.map(rt=>p.jsx("input",{type:rt.type==="email"?"email":rt.type==="phone"?"tel":"text",name:rt.name,autoComplete:"off",value:St[rt.name]??"",onChange:_t=>it(Lt=>({...Lt,[rt.name]:_t.target.value})),placeholder:rt.placeholder,required:rt.isRequired??rt.type==="email",className:`${o}-input`,style:{...wt,paddingRight:E.scalingValue(O.right,e),paddingLeft:E.scalingValue(O.left,e),paddingTop:E.scalingValue(O.top,e),paddingBottom:E.scalingValue(O.bottom,e)}},rt.name))}),p.jsx("div",{className:`${o}-overlayAnchor`,children:p.jsx("button",{type:"submit",className:`${o}-submitBtn`,"aria-label":ot,style:{...Q,..._e,paddingRight:E.scalingValue(F.right,e),paddingLeft:E.scalingValue(F.left,e),paddingTop:E.scalingValue(F.top,e),paddingBottom:E.scalingValue(F.bottom,e)},children:et==="submitting"?"...":Y?Z&&p.jsx(be,{url:Z,className:`${o}-submitBtnIcon`,style:{maxWidth:E.scalingValue(k??0,e)},fill:`var(--${o}-button-text-color)`,hoverFill:`var(--${o}-button-text-color)`}):nt})})]}),ft==="success"&&p.jsx("p",{className:`${o}-success`,style:{...ut},children:I}),ft==="error"&&p.jsx("p",{className:`${o}-error`,style:{...ut},role:"alert",children:Pt??ct??_})]})},Rl={strokeColor:"stroke-color",inputColor:"input-color",placeholderColor:"placeholder-color",buttonColor:"button-color",inputTextColor:"input-text-color",buttonTextColor:"button-text-color",successColor:"success-color",errorColor:"error-color"},Ol=["hover","focus","filled","success","error"],Pl=`import React, { useMemo, useState } from 'react';\r
|
|
935
|
+
import { CommonComponentProps } from '../props';\r
|
|
936
|
+
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';\r
|
|
937
|
+
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';\r
|
|
938
|
+
import { SvgImage } from '../helpers/SvgImage/SvgImage';\r
|
|
939
|
+
\r
|
|
940
|
+
function sv(px: number): string {\r
|
|
941
|
+
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;\r
|
|
942
|
+
}\r
|
|
943
|
+
\r
|
|
944
|
+
function getCSS(P: string): string {\r
|
|
945
|
+
return \`\r
|
|
946
|
+
.\${P}-wrapper {\r
|
|
947
|
+
display: flex;\r
|
|
948
|
+
flex-direction: column;\r
|
|
949
|
+
width: 100%;\r
|
|
950
|
+
height: 100%;\r
|
|
951
|
+
align-items: stretch;\r
|
|
952
|
+
justify-content: center;\r
|
|
953
|
+
}\r
|
|
954
|
+
.\${P}-form {\r
|
|
955
|
+
display: flex;\r
|
|
956
|
+
width: 100%;\r
|
|
957
|
+
align-items: stretch;\r
|
|
958
|
+
overflow: hidden;\r
|
|
959
|
+
border-color: var(--\${P}-stroke-color);\r
|
|
960
|
+
transition: border-color 250ms;\r
|
|
961
|
+
}\r
|
|
962
|
+
.\${P}-form:hover {\r
|
|
963
|
+
border-color: var(--\${P}-hover-stroke-color, var(--\${P}-stroke-color));\r
|
|
964
|
+
}\r
|
|
965
|
+
.\${P}-form:focus-within {\r
|
|
966
|
+
border-color: var(--\${P}-focus-stroke-color, var(--\${P}-stroke-color));\r
|
|
967
|
+
}\r
|
|
968
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-form {\r
|
|
969
|
+
border-color: var(--\${P}-hover-stroke-color, var(--\${P}-stroke-color));\r
|
|
970
|
+
}\r
|
|
971
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-form {\r
|
|
972
|
+
border-color: var(--\${P}-focus-stroke-color, var(--\${P}-stroke-color));\r
|
|
973
|
+
}\r
|
|
974
|
+
.\${P}-wrapper.\${P}-state-filled .\${P}-form {\r
|
|
975
|
+
border-color: var(--\${P}-filled-stroke-color, var(--\${P}-stroke-color));\r
|
|
976
|
+
}\r
|
|
977
|
+
.\${P}-inputWrap {\r
|
|
978
|
+
position: relative;\r
|
|
979
|
+
display: flex;\r
|
|
980
|
+
align-items: center;\r
|
|
981
|
+
flex: 1;\r
|
|
982
|
+
min-width: 0;\r
|
|
983
|
+
background-color: var(--\${P}-input-color);\r
|
|
984
|
+
transition: background-color 250ms;\r
|
|
985
|
+
}\r
|
|
986
|
+
.\${P}-inputWrap:hover,\r
|
|
987
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-inputWrap {\r
|
|
988
|
+
background-color: var(--\${P}-hover-input-color, var(--\${P}-input-color));\r
|
|
989
|
+
}\r
|
|
990
|
+
.\${P}-inputWrap:focus-within,\r
|
|
991
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-inputWrap {\r
|
|
992
|
+
background-color: var(--\${P}-focus-input-color, var(--\${P}-input-color));\r
|
|
993
|
+
}\r
|
|
994
|
+
.\${P}-wrapper.\${P}-state-filled .\${P}-inputWrap {\r
|
|
995
|
+
background-color: var(--\${P}-filled-input-color, var(--\${P}-input-color));\r
|
|
996
|
+
}\r
|
|
997
|
+
.\${P}-input {\r
|
|
998
|
+
flex: 1;\r
|
|
999
|
+
min-width: 0;\r
|
|
1000
|
+
background: transparent;\r
|
|
1001
|
+
border: none;\r
|
|
1002
|
+
outline: none;\r
|
|
1003
|
+
-webkit-tap-highlight-color: transparent;\r
|
|
1004
|
+
color: var(--\${P}-input-text-color);\r
|
|
1005
|
+
transition: color 250ms, background-color 250ms, border-color 250ms;\r
|
|
1006
|
+
}\r
|
|
1007
|
+
.\${P}-input:hover {\r
|
|
1008
|
+
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color));\r
|
|
1009
|
+
}\r
|
|
1010
|
+
.\${P}-inputWrap:hover .\${P}-input,\r
|
|
1011
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-input {\r
|
|
1012
|
+
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color));\r
|
|
1013
|
+
}\r
|
|
1014
|
+
.\${P}-input:focus,\r
|
|
1015
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-input {\r
|
|
1016
|
+
color: var(--\${P}-focus-input-text-color, var(--\${P}-input-text-color));\r
|
|
1017
|
+
}\r
|
|
1018
|
+
.\${P}-wrapper.\${P}-state-filled .\${P}-input {\r
|
|
1019
|
+
color: var(--\${P}-filled-input-text-color, var(--\${P}-input-text-color));\r
|
|
1020
|
+
}\r
|
|
1021
|
+
.\${P}-input::placeholder {\r
|
|
1022
|
+
color: var(--\${P}-placeholder-color);\r
|
|
1023
|
+
opacity: 1;\r
|
|
1024
|
+
transition: color 250ms, opacity 250ms;\r
|
|
1025
|
+
}\r
|
|
1026
|
+
.\${P}-inputWrap:hover .\${P}-input::placeholder,\r
|
|
1027
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-input::placeholder {\r
|
|
1028
|
+
color: var(--\${P}-hover-placeholder-color, var(--\${P}-placeholder-color));\r
|
|
1029
|
+
}\r
|
|
1030
|
+
.\${P}-inputWrap:focus-within .\${P}-input::placeholder,\r
|
|
1031
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-input::placeholder {\r
|
|
1032
|
+
color: var(--\${P}-focus-placeholder-color, var(--\${P}-placeholder-color));\r
|
|
1033
|
+
}\r
|
|
1034
|
+
.\${P}-wrapper.\${P}-state-filled .\${P}-input::placeholder {\r
|
|
1035
|
+
color: var(--\${P}-filled-placeholder-color, var(--\${P}-placeholder-color));\r
|
|
1036
|
+
}\r
|
|
1037
|
+
.\${P}-submitBtn {\r
|
|
1038
|
+
box-sizing: border-box;\r
|
|
1039
|
+
height: 100%;\r
|
|
1040
|
+
display: flex;\r
|
|
1041
|
+
align-items: center;\r
|
|
1042
|
+
justify-content: center;\r
|
|
1043
|
+
border: none;\r
|
|
1044
|
+
cursor: pointer;\r
|
|
1045
|
+
white-space: nowrap;\r
|
|
1046
|
+
background-color: var(--\${P}-button-color);\r
|
|
1047
|
+
color: var(--\${P}-button-text-color);\r
|
|
1048
|
+
border-left-style: solid;\r
|
|
1049
|
+
border-left-color: var(--\${P}-stroke-color);\r
|
|
1050
|
+
transition: color 250ms, background-color 250ms, border-color 250ms;\r
|
|
1051
|
+
}\r
|
|
1052
|
+
.\${P}-submitBtn img {\r
|
|
1053
|
+
display: block;\r
|
|
1054
|
+
box-sizing: border-box;\r
|
|
1055
|
+
flex: 0 1 auto;\r
|
|
1056
|
+
min-width: 0;\r
|
|
1057
|
+
height: 100%;\r
|
|
1058
|
+
width: auto;\r
|
|
1059
|
+
max-width: 100%;\r
|
|
1060
|
+
max-height: 100%;\r
|
|
1061
|
+
object-fit: contain;\r
|
|
1062
|
+
}\r
|
|
1063
|
+
.\${P}-submitBtn svg {\r
|
|
1064
|
+
display: block;\r
|
|
1065
|
+
box-sizing: border-box;\r
|
|
1066
|
+
flex: 0 1 auto;\r
|
|
1067
|
+
min-width: 0;\r
|
|
1068
|
+
height: 100%;\r
|
|
1069
|
+
width: auto;\r
|
|
1070
|
+
max-width: 100%;\r
|
|
1071
|
+
max-height: 100%;\r
|
|
1072
|
+
}\r
|
|
1073
|
+
.\${P}-submitBtn .\${P}-submitBtnIcon {\r
|
|
1074
|
+
position: relative;\r
|
|
1075
|
+
top: auto;\r
|
|
1076
|
+
left: auto;\r
|
|
1077
|
+
transform: none;\r
|
|
1078
|
+
display: block;\r
|
|
1079
|
+
box-sizing: border-box;\r
|
|
1080
|
+
flex: 0 1 auto;\r
|
|
1081
|
+
align-self: stretch;\r
|
|
1082
|
+
min-width: 0;\r
|
|
1083
|
+
width: auto;\r
|
|
1084
|
+
height: auto;\r
|
|
1085
|
+
aspect-ratio: 1;\r
|
|
1086
|
+
max-width: 100%;\r
|
|
1087
|
+
max-height: 100%;\r
|
|
1088
|
+
}\r
|
|
1089
|
+
.\${P}-submitBtn:hover,\r
|
|
1090
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-submitBtn {\r
|
|
1091
|
+
background-color: var(--\${P}-hover-button-color, var(--\${P}-button-color));\r
|
|
1092
|
+
color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color));\r
|
|
1093
|
+
border-left-color: var(--\${P}-hover-stroke-color, var(--\${P}-stroke-color));\r
|
|
1094
|
+
}\r
|
|
1095
|
+
.\${P}-submitBtn:focus,\r
|
|
1096
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-submitBtn {\r
|
|
1097
|
+
background-color: var(--\${P}-focus-button-color, var(--\${P}-button-color));\r
|
|
1098
|
+
color: var(--\${P}-focus-button-text-color, var(--\${P}-button-text-color));\r
|
|
1099
|
+
border-left-color: var(--\${P}-focus-stroke-color, var(--\${P}-stroke-color));\r
|
|
1100
|
+
}\r
|
|
1101
|
+
.\${P}-wrapper.\${P}-state-filled .\${P}-submitBtn {\r
|
|
1102
|
+
background-color: var(--\${P}-filled-button-color, var(--\${P}-button-color));\r
|
|
1103
|
+
color: var(--\${P}-filled-button-text-color, var(--\${P}-button-text-color));\r
|
|
1104
|
+
border-left-color: var(--\${P}-filled-stroke-color, var(--\${P}-stroke-color));\r
|
|
1105
|
+
}\r
|
|
1106
|
+
.\${P}-submitBtn:hover .\${P}-submitBtnIcon,\r
|
|
1107
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-submitBtn .\${P}-submitBtnIcon {\r
|
|
1108
|
+
background-color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color));\r
|
|
1109
|
+
}\r
|
|
1110
|
+
.\${P}-submitBtn:focus .\${P}-submitBtnIcon,\r
|
|
1111
|
+
.\${P}-wrapper.\${P}-state-focus .\${P}-submitBtn .\${P}-submitBtnIcon {\r
|
|
1112
|
+
background-color: var(--\${P}-focus-button-text-color, var(--\${P}-button-text-color));\r
|
|
1113
|
+
}\r
|
|
1114
|
+
.\${P}-wrapper.\${P}-state-filled .\${P}-submitBtn .\${P}-submitBtnIcon {\r
|
|
1115
|
+
background-color: var(--\${P}-filled-button-text-color, var(--\${P}-button-text-color));\r
|
|
1116
|
+
}\r
|
|
1117
|
+
.\${P}-wrapper.\${P}-state-success .\${P}-input,\r
|
|
1118
|
+
.\${P}-wrapper.\${P}-state-success .\${P}-submitBtn {\r
|
|
1119
|
+
pointer-events: none;\r
|
|
1120
|
+
}\r
|
|
1121
|
+
.\${P}-overlayAnchor {\r
|
|
1122
|
+
position: relative;\r
|
|
1123
|
+
display: flex;\r
|
|
1124
|
+
align-items: center;\r
|
|
1125
|
+
}\r
|
|
1126
|
+
.\${P}-success {\r
|
|
1127
|
+
margin-top: \${sv(8)};\r
|
|
1128
|
+
font-size: \${sv(14)};\r
|
|
1129
|
+
color: var(--\${P}-success-success-color, var(--\${P}-success-color));\r
|
|
1130
|
+
}\r
|
|
1131
|
+
.\${P}-error {\r
|
|
1132
|
+
margin-top: \${sv(8)};\r
|
|
1133
|
+
font-size: \${sv(14)};\r
|
|
1134
|
+
color: var(--\${P}-error-error-color, var(--\${P}-error-color));\r
|
|
1135
|
+
}\r
|
|
1136
|
+
\`;\r
|
|
1137
|
+
}\r
|
|
1138
|
+
\r
|
|
1139
|
+
type OnelinerFormProps = {\r
|
|
1140
|
+
settings: OnelinerFormSettings;\r
|
|
1141
|
+
content?: unknown;\r
|
|
1142
|
+
isEditor?: boolean;\r
|
|
1143
|
+
activeEvent?: string;\r
|
|
1144
|
+
} & CommonComponentProps;\r
|
|
1145
|
+
\r
|
|
1146
|
+
export const OnelinerForm = ({ settings, isEditor, metadata, activeEvent }: OnelinerFormProps) => {\r
|
|
1147
|
+
const { prefix: P } = useScopedStyles();\r
|
|
1148
|
+
const {\r
|
|
1149
|
+
fields = [{ name: 'email', type: 'email', placeholder: 'Your email' }],\r
|
|
1150
|
+
buttonIcon,\r
|
|
1151
|
+
buttonLabel,\r
|
|
1152
|
+
fieldsToShow = 1,\r
|
|
1153
|
+
fontFamily,\r
|
|
1154
|
+
inputFontSettings,\r
|
|
1155
|
+
inputFontSize,\r
|
|
1156
|
+
inputLineHeight,\r
|
|
1157
|
+
inputLetterSpacing,\r
|
|
1158
|
+
inputWordSpacing,\r
|
|
1159
|
+
inputTextAppearance,\r
|
|
1160
|
+
buttonFontSettings,\r
|
|
1161
|
+
buttonFontSize,\r
|
|
1162
|
+
buttonLineHeight,\r
|
|
1163
|
+
buttonLetterSpacing,\r
|
|
1164
|
+
buttonWordSpacing,\r
|
|
1165
|
+
buttonTextAppearance,\r
|
|
1166
|
+
statusFontSettings,\r
|
|
1167
|
+
statusFontSize,\r
|
|
1168
|
+
statusLineHeight,\r
|
|
1169
|
+
statusLetterSpacing,\r
|
|
1170
|
+
statusWordSpacing,\r
|
|
1171
|
+
statusTextAppearance,\r
|
|
1172
|
+
iconMaxWidth,\r
|
|
1173
|
+
minHeight,\r
|
|
1174
|
+
corners,\r
|
|
1175
|
+
stroke,\r
|
|
1176
|
+
stateOverrides,\r
|
|
1177
|
+
inputPadding,\r
|
|
1178
|
+
buttonPadding,\r
|
|
1179
|
+
successMessage = 'Thanks for subscribing!',\r
|
|
1180
|
+
errorMessage: errorMessageText = 'Please, fill all required fields.',\r
|
|
1181
|
+
} = settings;\r
|
|
1182
|
+
\r
|
|
1183
|
+
const visibleFields = fields.slice(0, Math.min(fieldsToShow, fields.length));\r
|
|
1184
|
+
const [values, setValues] = useState<Record<string, string>>(() =>\r
|
|
1185
|
+
Object.fromEntries(visibleFields.map((f) => [f.name, '']))\r
|
|
1186
|
+
);\r
|
|
1187
|
+
const [status, setStatus] = useState<'idle' | 'submitting' | 'success' | 'error'>('idle');\r
|
|
1188
|
+
const [errorMessage, setErrorMessage] = useState<string | null>(null);\r
|
|
1189
|
+
\r
|
|
1190
|
+
const displayStatus = activeEvent === 'success' ? 'success'\r
|
|
1191
|
+
: activeEvent === 'error' ? 'error'\r
|
|
1192
|
+
: status;\r
|
|
1193
|
+
const displayError = activeEvent === 'error' ? errorMessageText : errorMessage;\r
|
|
1194
|
+
const isFilledPreview = activeEvent === 'filled';\r
|
|
1195
|
+
const displayValues = useMemo(() => {\r
|
|
1196
|
+
if (!isFilledPreview) return values;\r
|
|
1197
|
+
\r
|
|
1198
|
+
let next: Record<string, string> | null = null;\r
|
|
1199
|
+
for (const f of visibleFields) {\r
|
|
1200
|
+
const current = values[f.name] ?? '';\r
|
|
1201
|
+
if (current.trim().length > 0) continue;\r
|
|
1202
|
+
next = next ?? { ...values };\r
|
|
1203
|
+
next[f.name] = 'Filled';\r
|
|
1204
|
+
}\r
|
|
1205
|
+
return next ?? values;\r
|
|
1206
|
+
}, [isFilledPreview, values, visibleFields]);\r
|
|
1207
|
+
const validationErrorMessage = displayStatus === 'error'\r
|
|
1208
|
+
? getFormFieldValidationError(visibleFields, displayValues)\r
|
|
1209
|
+
: null;\r
|
|
1210
|
+
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';\r
|
|
1211
|
+
const hasFilledFieldValue = visibleFields.some((f) => (displayValues[f.name] ?? '').trim().length > 0);\r
|
|
1212
|
+
const filledStateClass =\r
|
|
1213
|
+
stateClass !== \`\${P}-state-filled\` && hasFilledFieldValue ? \`\${P}-state-filled\` : '';\r
|
|
1214
|
+
const wrapperStateClasses = \`\${stateClass} \${filledStateClass}\`.trim();\r
|
|
1215
|
+
\r
|
|
1216
|
+
const submitUrl = metadata?.submitUrl as string | undefined;\r
|
|
1217
|
+
const labelText = buttonLabel ?? '';\r
|
|
1218
|
+
const iconSrc = buttonIcon?.icon ?? '';\r
|
|
1219
|
+
const useIconButton = buttonIcon?.mode === 'On';\r
|
|
1220
|
+
const submitAriaLabel = labelText || 'Submit';\r
|
|
1221
|
+
\r
|
|
1222
|
+
const resolvedInputTextStyle: TextStyles = {\r
|
|
1223
|
+
fontSettings: {\r
|
|
1224
|
+
fontFamily,\r
|
|
1225
|
+
fontWeight: inputFontSettings?.fontWeight ?? 400,\r
|
|
1226
|
+
fontStyle: inputFontSettings?.fontStyle ?? 'normal',\r
|
|
1227
|
+
},\r
|
|
1228
|
+
fontSize: inputFontSize ?? 0.01,\r
|
|
1229
|
+
lineHeight: inputLineHeight,\r
|
|
1230
|
+
letterSpacing: inputLetterSpacing ?? 0,\r
|
|
1231
|
+
wordSpacing: inputWordSpacing ?? 0,\r
|
|
1232
|
+
textAppearance: inputTextAppearance,\r
|
|
1233
|
+
color: settings.inputTextColor ?? '#111111',\r
|
|
1234
|
+
};\r
|
|
1235
|
+
\r
|
|
1236
|
+
const resolvedButtonTextStyle: TextStyles = {\r
|
|
1237
|
+
fontSettings: {\r
|
|
1238
|
+
fontFamily,\r
|
|
1239
|
+
fontWeight: buttonFontSettings?.fontWeight ?? 400,\r
|
|
1240
|
+
fontStyle: buttonFontSettings?.fontStyle ?? 'normal',\r
|
|
1241
|
+
},\r
|
|
1242
|
+
fontSize: buttonFontSize ?? 0.01,\r
|
|
1243
|
+
lineHeight: buttonLineHeight,\r
|
|
1244
|
+
letterSpacing: buttonLetterSpacing ?? 0,\r
|
|
1245
|
+
wordSpacing: buttonWordSpacing ?? 0,\r
|
|
1246
|
+
textAppearance: buttonTextAppearance,\r
|
|
1247
|
+
color: settings.buttonTextColor ?? '#ffffff',\r
|
|
1248
|
+
};\r
|
|
1249
|
+
\r
|
|
1250
|
+
const resolvedStatusTextStyle: TextStyles = {\r
|
|
1251
|
+
fontSettings: {\r
|
|
1252
|
+
fontFamily,\r
|
|
1253
|
+
fontWeight: statusFontSettings?.fontWeight ?? 400,\r
|
|
1254
|
+
fontStyle: statusFontSettings?.fontStyle ?? 'normal',\r
|
|
1255
|
+
},\r
|
|
1256
|
+
fontSize: statusFontSize ?? 0.01,\r
|
|
1257
|
+
lineHeight: statusLineHeight,\r
|
|
1258
|
+
letterSpacing: statusLetterSpacing ?? 0,\r
|
|
1259
|
+
wordSpacing: statusWordSpacing ?? 0,\r
|
|
1260
|
+
textAppearance: statusTextAppearance,\r
|
|
1261
|
+
color: settings.successColor ?? '#22c55e',\r
|
|
1262
|
+
};\r
|
|
1263
|
+
\r
|
|
1264
|
+
const inputTypographyCss = omitTextColors(textStylesToCss(resolvedInputTextStyle, isEditor));\r
|
|
1265
|
+
const buttonTypographyCss = omitTextColors(textStylesToCss(resolvedButtonTextStyle, isEditor));\r
|
|
1266
|
+
const statusTypographyCss = omitTextColors(textStylesToCss(resolvedStatusTextStyle, isEditor));\r
|
|
1267
|
+
const colorVars = buildColorVars(P, {\r
|
|
1268
|
+
strokeColor: settings.strokeColor,\r
|
|
1269
|
+
inputColor: settings.inputColor,\r
|
|
1270
|
+
placeholderColor: settings.placeholderColor,\r
|
|
1271
|
+
buttonColor: settings.buttonColor,\r
|
|
1272
|
+
successColor: settings.successColor,\r
|
|
1273
|
+
errorColor: settings.errorColor,\r
|
|
1274
|
+
inputTextColor: settings.inputTextColor ?? resolvedInputTextStyle?.color ?? '#111111',\r
|
|
1275
|
+
buttonTextColor: settings.buttonTextColor ?? resolvedButtonTextStyle?.color ?? '#ffffff',\r
|
|
1276
|
+
}, COLOR_VAR_MAP, STATE_KEYS, stateOverrides);\r
|
|
1277
|
+
\r
|
|
1278
|
+
const formStyle: React.CSSProperties = {\r
|
|
1279
|
+
borderRadius: scalingValue(corners, isEditor),\r
|
|
1280
|
+
borderWidth: scalingValue(stroke, isEditor),\r
|
|
1281
|
+
borderStyle: 'solid',\r
|
|
1282
|
+
};\r
|
|
1283
|
+
\r
|
|
1284
|
+
const dividerWidthStyle = { borderLeftWidth: scalingValue(stroke, isEditor) };\r
|
|
1285
|
+
\r
|
|
1286
|
+
const handleSubmit = async (e: React.FormEvent) => {\r
|
|
1287
|
+
e.preventDefault();\r
|
|
1288
|
+
const payload = Object.fromEntries(\r
|
|
1289
|
+
visibleFields.map((f) => [f.name, values[f.name]?.trim() ?? '']).filter(([, v]) => v)\r
|
|
1290
|
+
);\r
|
|
1291
|
+
if (!submitUrl) {\r
|
|
1292
|
+
setStatus('error');\r
|
|
1293
|
+
setErrorMessage('No integrations were found for this form.');\r
|
|
1294
|
+
return;\r
|
|
1295
|
+
}\r
|
|
1296
|
+
if (Object.keys(payload).length === 0) return;\r
|
|
1297
|
+
\r
|
|
1298
|
+
const validationError = getFormFieldValidationError(visibleFields, values);\r
|
|
1299
|
+
if (validationError) {\r
|
|
1300
|
+
setStatus('error');\r
|
|
1301
|
+
setErrorMessage(validationError);\r
|
|
1302
|
+
return;\r
|
|
1303
|
+
}\r
|
|
1304
|
+
\r
|
|
1305
|
+
setStatus('submitting');\r
|
|
1306
|
+
setErrorMessage(null);\r
|
|
1307
|
+
\r
|
|
1308
|
+
try {\r
|
|
1309
|
+
const res = await fetch(submitUrl, {\r
|
|
1310
|
+
method: 'POST',\r
|
|
1311
|
+
headers: { 'Content-Type': 'application/json' },\r
|
|
1312
|
+
body: JSON.stringify(payload),\r
|
|
1313
|
+
});\r
|
|
1314
|
+
\r
|
|
1315
|
+
if (!res.ok) {\r
|
|
1316
|
+
const text = await res.text();\r
|
|
1317
|
+
throw new Error(text || \`Request failed: \${res.status}\`);\r
|
|
1318
|
+
}\r
|
|
1319
|
+
\r
|
|
1320
|
+
setStatus('success');\r
|
|
1321
|
+
setValues(Object.fromEntries(visibleFields.map((f) => [f.name, ''])));\r
|
|
1322
|
+
} catch (err) {\r
|
|
1323
|
+
setStatus('error');\r
|
|
1324
|
+
setErrorMessage(err instanceof Error ? err.message : 'Something went wrong');\r
|
|
1325
|
+
}\r
|
|
1326
|
+
};\r
|
|
1327
|
+
\r
|
|
1328
|
+
return (\r
|
|
1329
|
+
<div className={\`\${P}-wrapper \${wrapperStateClasses}\`.trim()} style={colorVars}>\r
|
|
1330
|
+
<style dangerouslySetInnerHTML={{ __html: getCSS(P) }} />\r
|
|
1331
|
+
<form\r
|
|
1332
|
+
onSubmit={handleSubmit}\r
|
|
1333
|
+
className={\`\${P}-form\`}\r
|
|
1334
|
+
style={{\r
|
|
1335
|
+
...formStyle,\r
|
|
1336
|
+
height: scalingValue(minHeight, isEditor),\r
|
|
1337
|
+
minHeight: scalingValue(minHeight, isEditor),\r
|
|
1338
|
+
}}\r
|
|
1339
|
+
>\r
|
|
1340
|
+
<div\r
|
|
1341
|
+
className={\`\${P}-inputWrap \${P}-overlayAnchor\`}\r
|
|
1342
|
+
style={{ flex: 1, minWidth: 0 }}\r
|
|
1343
|
+
>\r
|
|
1344
|
+
{visibleFields.map((field) => (\r
|
|
1345
|
+
<input\r
|
|
1346
|
+
key={field.name}\r
|
|
1347
|
+
type={field.type === 'email' ? 'email' : field.type === 'phone' ? 'tel' : 'text'}\r
|
|
1348
|
+
name={field.name}\r
|
|
1349
|
+
autoComplete="off"\r
|
|
1350
|
+
value={displayValues[field.name] ?? ''}\r
|
|
1351
|
+
onChange={(e) => setValues((prev) => ({ ...prev, [field.name]: e.target.value }))}\r
|
|
1352
|
+
placeholder={field.placeholder}\r
|
|
1353
|
+
required={field.isRequired ?? field.type === 'email'}\r
|
|
1354
|
+
className={\`\${P}-input\`}\r
|
|
1355
|
+
style={{\r
|
|
1356
|
+
...inputTypographyCss,\r
|
|
1357
|
+
paddingRight: scalingValue(inputPadding.right, isEditor),\r
|
|
1358
|
+
paddingLeft: scalingValue(inputPadding.left, isEditor),\r
|
|
1359
|
+
paddingTop: scalingValue(inputPadding.top, isEditor),\r
|
|
1360
|
+
paddingBottom: scalingValue(inputPadding.bottom, isEditor),\r
|
|
1361
|
+
}}\r
|
|
1362
|
+
/>\r
|
|
1363
|
+
))}\r
|
|
1364
|
+
</div>\r
|
|
1365
|
+
<div className={\`\${P}-overlayAnchor\`}>\r
|
|
1366
|
+
<button\r
|
|
1367
|
+
type="submit"\r
|
|
1368
|
+
className={\`\${P}-submitBtn\`}\r
|
|
1369
|
+
aria-label={submitAriaLabel}\r
|
|
1370
|
+
style={{\r
|
|
1371
|
+
...buttonTypographyCss,\r
|
|
1372
|
+
...dividerWidthStyle,\r
|
|
1373
|
+
paddingRight: scalingValue(buttonPadding.right, isEditor),\r
|
|
1374
|
+
paddingLeft: scalingValue(buttonPadding.left, isEditor),\r
|
|
1375
|
+
paddingTop: scalingValue(buttonPadding.top, isEditor),\r
|
|
1376
|
+
paddingBottom: scalingValue(buttonPadding.bottom, isEditor),\r
|
|
1377
|
+
}}\r
|
|
1378
|
+
>\r
|
|
1379
|
+
{status === 'submitting'\r
|
|
1380
|
+
? '...'\r
|
|
1381
|
+
: useIconButton\r
|
|
1382
|
+
? (iconSrc && (\r
|
|
1383
|
+
<SvgImage\r
|
|
1384
|
+
url={iconSrc}\r
|
|
1385
|
+
className={\`\${P}-submitBtnIcon\`}\r
|
|
1386
|
+
style={{ maxWidth: scalingValue(iconMaxWidth ?? 0, isEditor) }}\r
|
|
1387
|
+
fill={\`var(--\${P}-button-text-color)\`}\r
|
|
1388
|
+
hoverFill={\`var(--\${P}-button-text-color)\`}\r
|
|
1389
|
+
/>\r
|
|
1390
|
+
))\r
|
|
1391
|
+
: labelText}\r
|
|
1392
|
+
</button>\r
|
|
1393
|
+
</div>\r
|
|
1394
|
+
</form>\r
|
|
1395
|
+
{displayStatus === 'success' && (\r
|
|
1396
|
+
<p\r
|
|
1397
|
+
className={\`\${P}-success\`}\r
|
|
1398
|
+
style={{ ...statusTypographyCss }}\r
|
|
1399
|
+
>\r
|
|
1400
|
+
{successMessage}\r
|
|
1401
|
+
</p>\r
|
|
1402
|
+
)}\r
|
|
1403
|
+
{displayStatus === 'error' && (\r
|
|
1404
|
+
<p\r
|
|
1405
|
+
className={\`\${P}-error\`}\r
|
|
1406
|
+
style={{ ...statusTypographyCss }}\r
|
|
1407
|
+
role="alert"\r
|
|
1408
|
+
>\r
|
|
1409
|
+
{validationErrorMessage ?? displayError ?? errorMessageText}\r
|
|
1410
|
+
</p>\r
|
|
1411
|
+
)}\r
|
|
1412
|
+
</div>\r
|
|
1413
|
+
);\r
|
|
1414
|
+
};\r
|
|
1415
|
+
\r
|
|
1416
|
+
type FieldConfig = {\r
|
|
1417
|
+
name: string;\r
|
|
1418
|
+
type: 'text' | 'phone' | 'email';\r
|
|
1419
|
+
placeholder: string;\r
|
|
1420
|
+
isRequired?: boolean;\r
|
|
1421
|
+
error?: string;\r
|
|
1422
|
+
};\r
|
|
1423
|
+
\r
|
|
1424
|
+
type OnelinerColorKeys =\r
|
|
1425
|
+
| 'strokeColor'\r
|
|
1426
|
+
| 'inputColor'\r
|
|
1427
|
+
| 'placeholderColor'\r
|
|
1428
|
+
| 'buttonColor'\r
|
|
1429
|
+
| 'inputTextColor'\r
|
|
1430
|
+
| 'buttonTextColor'\r
|
|
1431
|
+
| 'successColor'\r
|
|
1432
|
+
| 'errorColor';\r
|
|
1433
|
+
\r
|
|
1434
|
+
type StateColorOverrides = Partial<Record<OnelinerColorKeys, string>>;\r
|
|
1435
|
+
\r
|
|
1436
|
+
export type OnelinerFormButtonIcon = {\r
|
|
1437
|
+
mode?: 'On' | 'Off';\r
|
|
1438
|
+
icon?: string | null;\r
|
|
1439
|
+
};\r
|
|
1440
|
+
\r
|
|
1441
|
+
export type OnelinerFormSettings = {\r
|
|
1442
|
+
fields: FieldConfig[];\r
|
|
1443
|
+
fieldsToShow: number;\r
|
|
1444
|
+
buttonLabel?: string | null;\r
|
|
1445
|
+
buttonIcon?: OnelinerFormButtonIcon | null;\r
|
|
1446
|
+
iconMaxWidth?: number;\r
|
|
1447
|
+
fontFamily?: string;\r
|
|
1448
|
+
inputFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
1449
|
+
inputFontSize?: number;\r
|
|
1450
|
+
inputLineHeight?: number;\r
|
|
1451
|
+
inputLetterSpacing?: number;\r
|
|
1452
|
+
inputWordSpacing?: number;\r
|
|
1453
|
+
inputTextAppearance?: TextStyles['textAppearance'];\r
|
|
1454
|
+
buttonFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
1455
|
+
buttonFontSize?: number;\r
|
|
1456
|
+
buttonLineHeight?: number;\r
|
|
1457
|
+
buttonLetterSpacing?: number;\r
|
|
1458
|
+
buttonWordSpacing?: number;\r
|
|
1459
|
+
buttonTextAppearance?: TextStyles['textAppearance'];\r
|
|
1460
|
+
statusFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
1461
|
+
statusFontSize?: number;\r
|
|
1462
|
+
statusLineHeight?: number;\r
|
|
1463
|
+
statusLetterSpacing?: number;\r
|
|
1464
|
+
statusWordSpacing?: number;\r
|
|
1465
|
+
statusTextAppearance?: TextStyles['textAppearance'];\r
|
|
1466
|
+
minHeight: number;\r
|
|
1467
|
+
corners: number;\r
|
|
1468
|
+
stroke: number;\r
|
|
1469
|
+
inputPadding: {\r
|
|
1470
|
+
left: number;\r
|
|
1471
|
+
right: number;\r
|
|
1472
|
+
top: number;\r
|
|
1473
|
+
bottom: number;\r
|
|
1474
|
+
};\r
|
|
1475
|
+
buttonPadding: {\r
|
|
1476
|
+
left: number;\r
|
|
1477
|
+
right: number;\r
|
|
1478
|
+
top: number;\r
|
|
1479
|
+
bottom: number;\r
|
|
1480
|
+
};\r
|
|
1481
|
+
strokeColor: string;\r
|
|
1482
|
+
inputColor: string;\r
|
|
1483
|
+
placeholderColor: string;\r
|
|
1484
|
+
buttonColor: string;\r
|
|
1485
|
+
successColor: string;\r
|
|
1486
|
+
errorColor: string;\r
|
|
1487
|
+
inputTextColor?: string;\r
|
|
1488
|
+
buttonTextColor?: string;\r
|
|
1489
|
+
stateOverrides?: Record<string, StateColorOverrides>;\r
|
|
1490
|
+
successMessage?: string;\r
|
|
1491
|
+
errorMessage?: string;\r
|
|
1492
|
+
};\r
|
|
1493
|
+
\r
|
|
1494
|
+
const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {\r
|
|
1495
|
+
strokeColor: 'stroke-color',\r
|
|
1496
|
+
inputColor: 'input-color',\r
|
|
1497
|
+
placeholderColor: 'placeholder-color',\r
|
|
1498
|
+
buttonColor: 'button-color',\r
|
|
1499
|
+
inputTextColor: 'input-text-color',\r
|
|
1500
|
+
buttonTextColor: 'button-text-color',\r
|
|
1501
|
+
successColor: 'success-color',\r
|
|
1502
|
+
errorColor: 'error-color',\r
|
|
1503
|
+
};\r
|
|
1504
|
+
\r
|
|
1505
|
+
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;\r
|
|
1506
|
+
`,Bl="data:image/svg+xml,"+encodeURIComponent('<svg width="23px" height="20px" viewBox="0 0 23 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Newsletter" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="Tutorials-pop-up-Copy-12" transform="translate(-43, -687)" fill="#FFFFFF" fill-rule="nonzero"><path d="M66,697 C66,697.552285 65.5522847,698 65,698 L44,698 C43.4477153,698 43,697.552285 43,697 C43,696.447715 43.4477153,696 44,696 L65,696 C65.5522847,696 66,696.447715 66,697 Z M55.6689647,687.256706 L65.6689647,696.256706 C66.1103451,696.653948 66.1103451,697.346052 65.6689647,697.743294 L55.6689647,706.743294 C55.2584547,707.112753 54.6261649,707.079475 54.2567059,706.668965 C53.8872468,706.258455 53.9205252,705.626165 54.3310353,705.256706 L63.5051529,697 L54.3310353,688.743294 C53.9205252,688.373835 53.8872468,687.741545 54.2567059,687.331035 C54.6261649,686.920525 55.2584547,686.887247 55.6689647,687.256706 Z" id="Combined-Shape"></path></g></g></svg>'),Wl=[{name:"email",type:"email",placeholder:"Enter your email",label:"Email",isRequired:!0,error:"Please, enter a valid e-mail."},{name:"name",type:"text",placeholder:"Enter your name",label:"Name",isRequired:!1,error:"Please, enter your name."},{name:"company",type:"text",placeholder:"Enter company",label:"Company",isRequired:!1,error:"Please, enter your company name."},{name:"phone",type:"phone",placeholder:"Enter your phone",label:"Phone",isRequired:!1,error:"Please, enter a valid phone number."}],_n={fontSettings:{type:"object",display:{type:"font-settings-weight",visible:!0},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}}},Vl=["strokeColor","inputColor","inputTextColor","placeholderColor","buttonColor","buttonTextColor","successColor","errorColor"],zl={type:"object",version:1,settings:{sizing:"auto manual",properties:{fieldsToShow:{type:"number",scope:"common",title:"Fields",display:{type:"number"},min:1,max:3},fields:{type:"array",scope:"common",display:{type:"fields-group"},items:{type:"object",properties:{name:{type:"string"},type:{type:"string",enum:["text","phone","email"]},placeholder:{type:"string"},label:{type:"string"},isRequired:{type:"boolean"},error:{type:"string"}}}},buttonLabel:{type:"string",scope:"common",title:"Button Label",display:{type:"text-input"}},buttonIcon:{type:"object",scope:"common",title:"Button Icon",display:{type:"button-icon-switch"},properties:{mode:{type:"string",enum:["On","Off"]},icon:{type:["string","null"],title:"Icon",display:{type:"settings-image-input"}}}},iconMaxWidth:{type:"number",scope:"common",title:"Icon Max Width",display:{type:"full-width-input"},min:0,max:1},fontFamily:{type:"string",scope:"common",title:"Font family",display:{type:"font-family-select"}},inputPadding:{type:"object",scope:"layout",title:"",display:{type:"padding-controls"}},buttonPadding:{type:"object",scope:"layout",title:"",display:{type:"padding-controls"}},minHeight:{type:"number",scope:"layout",title:"min Height",display:{type:"range-control"},min:0,max:200},corners:{type:"number",scope:"layout",title:"Corners",display:{type:"range-control"},min:0,max:100},stroke:{type:"number",scope:"layout",title:"Stroke",display:{type:"range-control"},min:0,max:20},strokeColor:{type:"string",scope:"common",title:"Stroke",display:{type:"palette-color-picker"}},inputColor:{type:"string",scope:"common",title:"Input Fill",display:{type:"palette-color-picker"}},inputTextColor:{type:"string",scope:"common",title:"Input Label",display:{type:"palette-color-picker"}},placeholderColor:{type:"string",scope:"common",title:"Filler Text",display:{type:"palette-color-picker"}},buttonColor:{type:"string",scope:"common",title:"Button Fill",display:{type:"palette-color-picker"}},buttonTextColor:{type:"string",scope:"common",title:"Button Label",display:{type:"palette-color-picker"}},successColor:{type:"string",scope:"common",title:"Success Message Color",display:{type:"palette-color-picker"}},errorColor:{type:"string",scope:"common",title:"Error Message Color",display:{type:"palette-color-picker"}},successMessage:{type:"string",scope:"common",title:"Success Message",display:{type:"text-input"}},errorMessage:{type:"string",scope:"common",title:"Error Message",display:{type:"text-input"}},stateOverrides:{type:"object",scope:"common"},inputFontSettings:{..._n.fontSettings,scope:"common",title:"Input"},inputFontSize:{type:"number",scope:"layout",title:"Input Font Size",display:{type:"font-size"}},inputLineHeight:{type:"number",scope:"layout",title:"Input Line Height",display:{type:"line-height-input"}},inputLetterSpacing:{type:"number",scope:"layout",title:"Input Letter Spacing",display:{type:"letter-spacing-input"}},inputWordSpacing:{type:"number",scope:"layout",title:"Input Word Spacing",display:{type:"word-spacing-input"}},inputTextAppearance:{type:"object",scope:"layout",title:"Input Text Appearance",display:{type:"text-appearance"}},buttonFontSettings:{..._n.fontSettings,scope:"common",title:"Button"},buttonFontSize:{type:"number",scope:"layout",title:"Button Font Size",display:{type:"font-size"}},buttonLineHeight:{type:"number",scope:"layout",title:"Button Line Height",display:{type:"line-height-input"}},buttonLetterSpacing:{type:"number",scope:"layout",title:"Button Letter Spacing",display:{type:"letter-spacing-input"}},buttonWordSpacing:{type:"number",scope:"layout",title:"Button Word Spacing",display:{type:"word-spacing-input"}},buttonTextAppearance:{type:"object",scope:"layout",title:"Button Text Appearance",display:{type:"text-appearance"}},statusFontSettings:{..._n.fontSettings,scope:"common",title:"Success/Error"},statusFontSize:{type:"number",scope:"layout",title:"Success/Error Font Size",display:{type:"font-size"}},statusLineHeight:{type:"number",scope:"layout",title:"Success/Error Line Height",display:{type:"line-height-input"}},statusLetterSpacing:{type:"number",scope:"layout",title:"Success/Error Letter Spacing",display:{type:"letter-spacing-input"}},statusWordSpacing:{type:"number",scope:"layout",title:"Success/Error Word Spacing",display:{type:"word-spacing-input"}},statusTextAppearance:{type:"object",scope:"layout",title:"Success/Error Text Appearance",display:{type:"text-appearance"}}},defaults:{fields:Wl,fieldsToShow:1,buttonLabel:"Subscribe",buttonIcon:{mode:"Off",icon:Bl},fontFamily:"Arial",strokeColor:"#0A00F8",inputColor:"#ffffff",inputTextColor:"#0A00F8",placeholderColor:"#000000",buttonColor:"#0088D7",buttonTextColor:"#ffffff",errorColor:"#ef4444",successColor:"#22c55e",successMessage:"Thanks for subscribing!",errorMessage:"Please, fill all required fields.",stateOverrides:{hover:{buttonColor:"#33A2F2"}},inputFontSettings:{fontWeight:400,fontStyle:"normal"},inputLetterSpacing:0,inputWordSpacing:0,inputTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},buttonFontSettings:{fontWeight:400,fontStyle:"normal"},buttonLetterSpacing:0,buttonWordSpacing:0,buttonTextAppearance:{textTransform:"uppercase",textDecoration:"none",fontVariant:"normal"},statusFontSettings:{fontWeight:400,fontStyle:"normal"},statusLetterSpacing:0,statusWordSpacing:0,statusTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"}},layoutDefaults:{m:{minHeight:.1,iconMaxWidth:.1,stroke:0,corners:0,buttonPadding:{top:.02,right:.04,bottom:.02,left:.04},inputPadding:{top:.01,right:.03,bottom:.01,left:.03},inputFontSize:.043,inputLineHeight:.043,buttonFontSize:.0373,buttonLineHeight:.0373,statusFontSize:.0373,statusLineHeight:.0373},d:{minHeight:.028,iconMaxWidth:.028,stroke:0,corners:0,buttonPadding:{right:.0175,left:.0175,top:.005,bottom:.004},inputPadding:{top:.01,right:.01,bottom:.01,left:.01},inputFontSize:.01,inputLineHeight:.01,buttonFontSize:.009,buttonLineHeight:.01,statusFontSize:.01,statusLineHeight:.01}},displayRules:[{if:{name:"stroke",value:0},then:{name:"properties.strokeColor.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonFontSettings.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonFontSize.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonLineHeight.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonLetterSpacing.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonWordSpacing.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonTextAppearance.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"Off"},then:{name:"properties.iconMaxWidth.display.visible",value:!1}}]},panels:[{id:"general",icon:"cursor",title:"General",tooltip:"General Settings",layout:[{type:"row",items:["__componentName__","fieldsToShow"]},{type:"row",items:["minHeight","corners"]},{type:"row",items:[{type:"group",title:"",items:["stroke","buttonIcon"]},{type:"switcher",title:"Padding",options:{Input:["inputPadding"],Button:["buttonPadding"]}}]},"iconMaxWidth"]},{id:"typeStyle",icon:"text-icon",title:"Type Style",tooltip:"Typography",layout:["fontFamily",{type:"group",title:"",items:["inputFontSettings",{type:"row",items:["inputFontSize","inputLineHeight","inputLetterSpacing","inputWordSpacing"]},"inputTextAppearance"]},{type:"group",title:"",items:["buttonFontSettings",{type:"row",items:["buttonFontSize","buttonLineHeight","buttonLetterSpacing","buttonWordSpacing"]},"buttonTextAppearance"]},{type:"group",title:"",items:["statusFontSettings",{type:"row",items:["statusFontSize","statusLineHeight","statusLetterSpacing","statusWordSpacing"]},"statusTextAppearance"]}]},{id:"fields",icon:"layers",title:"Fields",tooltip:"Fields",layout:["fields","buttonLabel","successMessage","errorMessage"]}],paletteBookmark:{items:[...Vl],panelIds:["general","typeStyle"],stateItems:{default:["strokeColor","placeholderColor","inputColor","buttonTextColor","buttonColor"],hover:["strokeColor","inputColor","buttonTextColor","buttonColor"],focus:["strokeColor","inputTextColor","buttonTextColor","buttonColor"],filled:["strokeColor","inputColor","inputTextColor","buttonTextColor"],success:["successColor"],error:["errorColor"]}},allowedPlugins:["newsletter"],states:["default","hover","focus","filled","success","error"]},Nl={element:kl,id:"oneliner-form",name:"Newsletter Single Line",version:1,preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/onelinerImg.jpg"},defaultSize:{width:400,height:60},assetsPaths:{content:[],parameters:[{path:"buttonIcon.icon"}]},schema:zl,sourceCode:Pl};function jl(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function Ml(t){return`
|
|
1507
|
+
.${t}-wrapper {
|
|
1508
|
+
display: grid;
|
|
1509
|
+
align-items: start;
|
|
1510
|
+
width: 100%;
|
|
1511
|
+
column-gap: 10%;
|
|
1512
|
+
min-height: ${jl(48)};
|
|
928
1513
|
}
|
|
929
|
-
.${
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1514
|
+
.${t}-item {
|
|
1515
|
+
display: flex;
|
|
1516
|
+
flex-direction: column;
|
|
1517
|
+
justify-content: center;
|
|
1518
|
+
align-items: center;
|
|
1519
|
+
gap: 12px;
|
|
933
1520
|
}
|
|
934
|
-
|
|
1521
|
+
.${t}-item-image-wrapper {
|
|
1522
|
+
display: flex;
|
|
1523
|
+
justify-content: center;
|
|
1524
|
+
align-items: center;
|
|
1525
|
+
}
|
|
1526
|
+
.${t}-item-image {
|
|
1527
|
+
width: 100%;
|
|
1528
|
+
height: 100%;
|
|
1529
|
+
display: block;
|
|
1530
|
+
}
|
|
1531
|
+
.${t}-item-slider,
|
|
1532
|
+
.${t}-item-slider .splide__track,
|
|
1533
|
+
.${t}-item-slider .splide__list,
|
|
1534
|
+
.${t}-item-slider .splide__slide {
|
|
1535
|
+
width: 100%;
|
|
1536
|
+
height: 100%;
|
|
1537
|
+
}
|
|
1538
|
+
.${t}-item-slider .splide__slide {
|
|
1539
|
+
display: flex;
|
|
1540
|
+
justify-content: center;
|
|
1541
|
+
align-items: center;
|
|
1542
|
+
}
|
|
1543
|
+
.${t}-item-title {
|
|
1544
|
+
white-space: normal;
|
|
1545
|
+
overflow-wrap: anywhere;
|
|
1546
|
+
word-break: break-word;
|
|
1547
|
+
text-align: center;
|
|
1548
|
+
margin-bottom: 0px;
|
|
1549
|
+
margin-top: 0px;
|
|
1550
|
+
color: var(--${t}-title-color);
|
|
1551
|
+
}
|
|
1552
|
+
.${t}-item-subtitle {
|
|
1553
|
+
white-space: normal;
|
|
1554
|
+
overflow-wrap: anywhere;
|
|
1555
|
+
word-break: break-word;
|
|
1556
|
+
text-align: center;
|
|
1557
|
+
margin-bottom: 0px;
|
|
1558
|
+
margin-top: 0px;
|
|
1559
|
+
color: var(--${t}-subtitle-color);
|
|
1560
|
+
}
|
|
1561
|
+
`}const Kt=500,ae="cubic-bezier(0.22, 1, 0.36, 1)";function Hl({images:t,index:e,imageDisplay:n,originRect:r,reverseClose:o,onClose:a,onPrev:i,onNext:c}){const s=V.useRef(null),d=V.useRef(null),[l,w]=V.useState(null),[b,g]=V.useState(r?"opening":"open"),[u,m]=V.useState(!0),S=V.useRef(e),y=V.useCallback(()=>{const f=s.current,T=d.current;if(!f||!T)return;const A=f.getBoundingClientRect(),z=A.width,L=A.height,k=T.naturalWidth,W=T.naturalHeight;if(!z||!L||!k||!W)return;if(n==="Cover"){w({width:z,height:L,left:A.left,top:A.top});return}const D=k/W,H=z/L;if(D>H){const h=z/D;w({width:z,height:h,left:A.left,top:A.top+(L-h)/2})}else{const h=L*D;w({width:h,height:L,left:A.left+(z-h)/2,top:A.top})}},[n]);V.useEffect(()=>{y();const f=s.current;if(!f)return;const T=new ResizeObserver(()=>y());return T.observe(f),()=>T.disconnect()},[y,e]),V.useEffect(()=>{if(b!=="opening"||!l)return;const f={id:0};return f.id=requestAnimationFrame(()=>{f.id=requestAnimationFrame(()=>g("open"))}),()=>cancelAnimationFrame(f.id)},[b,l]),V.useEffect(()=>{if(b!=="closing")return;const f=setTimeout(()=>a(),Kt);return()=>clearTimeout(f)},[b,a]),V.useEffect(()=>{S.current!==e&&m(!1),S.current=e},[e]);const v=()=>{b!=="closing"&&g("closing")},C=b==="open",M=b==="closing",B=M&&o&&!!r,$=b==="opening"?r??l:B?r:l;return p.jsxs("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:9997},onClick:v,children:[p.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(28,31,34,0.9)",opacity:C?1:0,transition:`opacity ${Kt}ms ${ae}`,pointerEvents:"none"}}),p.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[p.jsx("div",{style:{height:"10%"}}),p.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:p.jsx("div",{ref:s,style:{width:"100%",height:"100%"}})}),p.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",color:"#E6E6E6",letterSpacing:"-0.6px",lineHeight:"16px",opacity:C?1:0,transition:`opacity ${Kt}ms ${ae}`},children:[p.jsx("p",{children:e+1}),p.jsx("p",{children:"/"}),p.jsx("p",{children:t.length})]})]}),$&&p.jsx("img",{ref:d,src:t[e],onLoad:y,style:{position:"fixed",top:$.top,left:$.left,width:$.width,height:$.height,objectFit:n==="Cover"?"cover":"contain",opacity:M&&!B?0:1,transition:M&&!B?`opacity ${Kt}ms ${ae}`:B||u?`top ${Kt}ms ${ae}, left ${Kt}ms ${ae}, width ${Kt}ms ${ae}, height ${Kt}ms ${ae}`:"none",pointerEvents:"none",zIndex:9998}}),C&&l&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,width:l.width/2,height:l.height,cursor:"w-resize",zIndex:9999},onClick:f=>{f.stopPropagation(),i()}}),p.jsx("div",{style:{position:"fixed",top:l.top,left:l.left+l.width/2,width:l.width/2,height:l.height,cursor:"e-resize",zIndex:9999},onClick:f=>{f.stopPropagation(),c()}})]})]})}function Dl({settings:t,content:e,isEditor:n,metadata:r,activeEvent:o}){const{prefix:a}=E.useScopedStyles(),{type:i="A",fieldsToShow:c=2,textBoxWidth:s,verticalGap:d,entriesCount:l,lightbox:w,imageSize:b,imageDisplay:g,slider:u,sliderTiming:m,direction:S,transition:y,titleColor:v,subtitleColor:C,titleFontFamily:M,titleFontSettings:B,titleFontSize:$,titleLineHeight:f,titleLetterSpacing:T,titleWordSpacing:A,titleTextAppearance:z,subtitleFontFamily:L,subtitleFontSettings:k,subtitleFontSize:W,subtitleLineHeight:D,subtitleLetterSpacing:H,subtitleWordSpacing:h,subtitleTextAppearance:O}=t,F={fontSettings:{fontFamily:M,fontWeight:(B==null?void 0:B.fontWeight)??400,fontStyle:(B==null?void 0:B.fontStyle)??"normal"},fontSize:$??.01,lineHeight:f,letterSpacing:T??0,wordSpacing:A??0,textAppearance:z,color:v},_={...Zt(Gt(F,n))},P={fontSettings:{fontFamily:L,fontWeight:(k==null?void 0:k.fontWeight)??400,fontStyle:(k==null?void 0:k.fontStyle)??"normal"},fontSize:W??.01,lineHeight:D,letterSpacing:H??0,wordSpacing:h??0,textAppearance:O,color:C},it={...Zt(Gt(P,n))},et=E.buildColorVars(a,{titleColor:v,subtitleColor:C},Gl,Ul),R=`${o&&o!=="default"?`${a}-state-${o}`:""}`.trim(),K=l===0?1/0:l,ft=(e??[]).slice(0,K),dt={Small:.1,Medium:.2,Big:.3}[b]??.2,St=(g==null?void 0:g.display)==="Cover",Pt=(g==null?void 0:g.ratioValue)??"1:1",j=(g==null?void 0:g.reversed)??!1,[x,G]=Pt.split(":").map(Number),q=j?G:x,J=j?x:G,nt=`${q} / ${J}`,Z=q>=J,Y={objectFit:St?"cover":"contain",...St&&{aspectRatio:nt,width:Z?"100%":"auto",height:Z?"auto":"100%"}},[ot,ht]=V.useState("ltr"),[lt,gt]=V.useState(!1),[wt,Q]=V.useState([]),[ut,xt]=V.useState(0),[Bt,_e]=V.useState(null),Yt=(rt,_t,Lt)=>{if(w==="Off")return;const at=rt.currentTarget.getBoundingClientRect();_e({top:at.top,left:at.left,width:at.width,height:at.height}),Q(_t),xt(Lt),gt(!0)};return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:Ml(a)}}),p.jsx("div",{style:et,children:p.jsx("div",{className:`${a}-wrapper ${a}-type-${i} ${R}`.trim(),style:{gridTemplateColumns:`repeat(${c}, 1fr)`,rowGap:E.scalingValue(d??0,n)},children:ft.map((rt,_t)=>{var Lt;return p.jsxs("div",{className:`${a}-item`.trim(),children:[p.jsx("div",{className:`${a}-item-image-wrapper`,style:{width:E.scalingValue(dt??0,n),height:E.scalingValue(dt??0,n)},children:(((Lt=rt.image)==null?void 0:Lt.length)??0)===0?null:u==="Off"?p.jsx("img",{src:rt.image[0].url,alt:rt.image[0].name,className:`${a}-item-image`.trim(),style:Y,onClick:at=>Yt(at,rt.image.map(Ct=>Ct.url),0)}):p.jsx(er,{className:`${a}-item-slider`,options:{arrows:!1,pagination:!1,drag:!1,perPage:1,autoplay:!0,interval:m*1e3,width:"100%",height:"100%",speed:500,type:y==="Fade"?"fade":"loop",rewind:y==="Fade",pauseOnHover:!1,pauseOnFocus:!1,direction:y==="Fade"?"ltr":S!=="Random"?S==="Horizontal"?"ltr":"ttb":ot},onMoved:at=>{if(S!=="Random"||y==="Fade")return;const Ct=Math.random()>.5?Math.random()>.5?"rtl":"ltr":Math.random()>.5?"btt":"ttb";ht(Ct),setTimeout(()=>{at.refresh()},0)},children:rt.image.map((at,Ct)=>p.jsx(nr,{children:p.jsx("img",{src:at.url,alt:at.name,className:`${a}-item-image`.trim(),style:Y,onClick:De=>Yt(De,rt.image.map(oe=>oe.url),Ct)})},Ct))},`${y}-${b}-${S}-${m}`)}),p.jsx("p",{className:`${a}-item-title`.trim(),style:{width:`calc(${E.scalingValue(dt??0,n)} * (${s} / 100))`,..._},children:rt.title}),i==="B"&&p.jsx("p",{className:`${a}-item-subtitle`.trim(),style:{width:`calc(${E.scalingValue(dt??0,n)} * (${s} / 100))`,...it},children:rt.subtitle})]},_t)})})}),lt&&typeof document&&document.getElementById("grid-component-lightbox-portal")&&w==="On"&&Lr.createPortal(p.jsx("div",{"data-selection":"none",children:p.jsx(Hl,{images:wt,index:ut,imageDisplay:g.display,originRect:Bt,reverseClose:u==="Off",onClose:()=>gt(!1),onPrev:()=>xt(rt=>(rt-1+wt.length)%wt.length),onNext:()=>xt(rt=>(rt+1)%wt.length)})}),document.body)]})}const Gl={titleColor:"title-color",subtitleColor:"subtitle-color"},Ul=["hover","focus","filled","success","error"],Xl=`import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
1562
|
+
import '@splidejs/react-splide/css/core';
|
|
935
1563
|
import { CommonComponentProps } from '../props';
|
|
936
1564
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
937
|
-
import {
|
|
938
|
-
import {
|
|
1565
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
1566
|
+
import { createPortal } from 'react-dom';
|
|
1567
|
+
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
939
1568
|
|
|
940
1569
|
function sv(px: number): string {
|
|
941
1570
|
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;
|
|
@@ -944,563 +1573,561 @@ function sv(px: number): string {
|
|
|
944
1573
|
function getCSS(P: string): string {
|
|
945
1574
|
return \`
|
|
946
1575
|
.\${P}-wrapper {
|
|
947
|
-
display:
|
|
948
|
-
|
|
949
|
-
width: 100%;
|
|
950
|
-
height: 100%;
|
|
951
|
-
align-items: stretch;
|
|
952
|
-
justify-content: center;
|
|
953
|
-
}
|
|
954
|
-
.\${P}-form {
|
|
955
|
-
display: flex;
|
|
1576
|
+
display: grid;
|
|
1577
|
+
align-items: start;
|
|
956
1578
|
width: 100%;
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
border-color: var(--\${P}-stroke-color);
|
|
960
|
-
transition: border-color 250ms;
|
|
961
|
-
}
|
|
962
|
-
.\${P}-form:hover {
|
|
963
|
-
border-color: var(--\${P}-hover-stroke-color, var(--\${P}-stroke-color));
|
|
964
|
-
}
|
|
965
|
-
.\${P}-form:focus-within {
|
|
966
|
-
border-color: var(--\${P}-focus-stroke-color, var(--\${P}-stroke-color));
|
|
967
|
-
}
|
|
968
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-form {
|
|
969
|
-
border-color: var(--\${P}-hover-stroke-color, var(--\${P}-stroke-color));
|
|
970
|
-
}
|
|
971
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-form {
|
|
972
|
-
border-color: var(--\${P}-focus-stroke-color, var(--\${P}-stroke-color));
|
|
973
|
-
}
|
|
974
|
-
.\${P}-wrapper.\${P}-state-filled .\${P}-form {
|
|
975
|
-
border-color: var(--\${P}-filled-stroke-color, var(--\${P}-stroke-color));
|
|
1579
|
+
column-gap: 10%;
|
|
1580
|
+
min-height: \${sv(48)};
|
|
976
1581
|
}
|
|
977
|
-
.\${P}-
|
|
978
|
-
position: relative;
|
|
1582
|
+
.\${P}-item {
|
|
979
1583
|
display: flex;
|
|
1584
|
+
flex-direction: column;
|
|
1585
|
+
justify-content: center;
|
|
980
1586
|
align-items: center;
|
|
981
|
-
|
|
982
|
-
min-width: 0;
|
|
983
|
-
background-color: var(--\${P}-input-color);
|
|
984
|
-
transition: background-color 250ms;
|
|
985
|
-
}
|
|
986
|
-
.\${P}-inputWrap:hover,
|
|
987
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-inputWrap {
|
|
988
|
-
background-color: var(--\${P}-hover-input-color, var(--\${P}-input-color));
|
|
989
|
-
}
|
|
990
|
-
.\${P}-inputWrap:focus-within,
|
|
991
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-inputWrap {
|
|
992
|
-
background-color: var(--\${P}-focus-input-color, var(--\${P}-input-color));
|
|
993
|
-
}
|
|
994
|
-
.\${P}-wrapper.\${P}-state-filled .\${P}-inputWrap {
|
|
995
|
-
background-color: var(--\${P}-filled-input-color, var(--\${P}-input-color));
|
|
996
|
-
}
|
|
997
|
-
.\${P}-input {
|
|
998
|
-
flex: 1;
|
|
999
|
-
min-width: 0;
|
|
1000
|
-
background: transparent;
|
|
1001
|
-
border: none;
|
|
1002
|
-
outline: none;
|
|
1003
|
-
-webkit-tap-highlight-color: transparent;
|
|
1004
|
-
color: var(--\${P}-input-text-color);
|
|
1005
|
-
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
1006
|
-
}
|
|
1007
|
-
.\${P}-input:hover {
|
|
1008
|
-
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color));
|
|
1009
|
-
}
|
|
1010
|
-
.\${P}-inputWrap:hover .\${P}-input,
|
|
1011
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-input {
|
|
1012
|
-
color: var(--\${P}-hover-input-text-color, var(--\${P}-input-text-color));
|
|
1013
|
-
}
|
|
1014
|
-
.\${P}-input:focus,
|
|
1015
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-input {
|
|
1016
|
-
color: var(--\${P}-focus-input-text-color, var(--\${P}-input-text-color));
|
|
1017
|
-
}
|
|
1018
|
-
.\${P}-wrapper.\${P}-state-filled .\${P}-input {
|
|
1019
|
-
color: var(--\${P}-filled-input-text-color, var(--\${P}-input-text-color));
|
|
1020
|
-
}
|
|
1021
|
-
.\${P}-input::placeholder {
|
|
1022
|
-
color: var(--\${P}-placeholder-color);
|
|
1023
|
-
opacity: 1;
|
|
1024
|
-
transition: color 250ms, opacity 250ms;
|
|
1025
|
-
}
|
|
1026
|
-
.\${P}-inputWrap:hover .\${P}-input::placeholder,
|
|
1027
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-input::placeholder {
|
|
1028
|
-
color: var(--\${P}-hover-placeholder-color, var(--\${P}-placeholder-color));
|
|
1587
|
+
gap: 12px;
|
|
1029
1588
|
}
|
|
1030
|
-
.\${P}-
|
|
1031
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-input::placeholder {
|
|
1032
|
-
color: var(--\${P}-focus-placeholder-color, var(--\${P}-placeholder-color));
|
|
1033
|
-
}
|
|
1034
|
-
.\${P}-wrapper.\${P}-state-filled .\${P}-input::placeholder {
|
|
1035
|
-
color: var(--\${P}-filled-placeholder-color, var(--\${P}-placeholder-color));
|
|
1036
|
-
}
|
|
1037
|
-
.\${P}-submitBtn {
|
|
1038
|
-
box-sizing: border-box;
|
|
1039
|
-
height: 100%;
|
|
1589
|
+
.\${P}-item-image-wrapper {
|
|
1040
1590
|
display: flex;
|
|
1041
|
-
align-items: center;
|
|
1042
1591
|
justify-content: center;
|
|
1043
|
-
|
|
1044
|
-
cursor: pointer;
|
|
1045
|
-
white-space: nowrap;
|
|
1046
|
-
background-color: var(--\${P}-button-color);
|
|
1047
|
-
color: var(--\${P}-button-text-color);
|
|
1048
|
-
border-left-style: solid;
|
|
1049
|
-
border-left-color: var(--\${P}-stroke-color);
|
|
1050
|
-
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
1051
|
-
}
|
|
1052
|
-
.\${P}-submitBtn img {
|
|
1053
|
-
display: block;
|
|
1054
|
-
box-sizing: border-box;
|
|
1055
|
-
flex: 0 1 auto;
|
|
1056
|
-
min-width: 0;
|
|
1057
|
-
height: 100%;
|
|
1058
|
-
width: auto;
|
|
1059
|
-
max-width: 100%;
|
|
1060
|
-
max-height: 100%;
|
|
1061
|
-
object-fit: contain;
|
|
1592
|
+
align-items: center;
|
|
1062
1593
|
}
|
|
1063
|
-
.\${P}-
|
|
1064
|
-
|
|
1065
|
-
box-sizing: border-box;
|
|
1066
|
-
flex: 0 1 auto;
|
|
1067
|
-
min-width: 0;
|
|
1594
|
+
.\${P}-item-image {
|
|
1595
|
+
width: 100%;
|
|
1068
1596
|
height: 100%;
|
|
1069
|
-
width: auto;
|
|
1070
|
-
max-width: 100%;
|
|
1071
|
-
max-height: 100%;
|
|
1072
|
-
}
|
|
1073
|
-
.\${P}-submitBtn .\${P}-submitBtnIcon {
|
|
1074
|
-
position: relative;
|
|
1075
|
-
top: auto;
|
|
1076
|
-
left: auto;
|
|
1077
|
-
transform: none;
|
|
1078
1597
|
display: block;
|
|
1079
|
-
box-sizing: border-box;
|
|
1080
|
-
flex: 0 1 auto;
|
|
1081
|
-
align-self: stretch;
|
|
1082
|
-
min-width: 0;
|
|
1083
|
-
width: auto;
|
|
1084
|
-
height: auto;
|
|
1085
|
-
aspect-ratio: 1;
|
|
1086
|
-
max-width: 100%;
|
|
1087
|
-
max-height: 100%;
|
|
1088
|
-
}
|
|
1089
|
-
.\${P}-submitBtn:hover,
|
|
1090
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-submitBtn {
|
|
1091
|
-
background-color: var(--\${P}-hover-button-color, var(--\${P}-button-color));
|
|
1092
|
-
color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color));
|
|
1093
|
-
border-left-color: var(--\${P}-hover-stroke-color, var(--\${P}-stroke-color));
|
|
1094
|
-
}
|
|
1095
|
-
.\${P}-submitBtn:focus,
|
|
1096
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-submitBtn {
|
|
1097
|
-
background-color: var(--\${P}-focus-button-color, var(--\${P}-button-color));
|
|
1098
|
-
color: var(--\${P}-focus-button-text-color, var(--\${P}-button-text-color));
|
|
1099
|
-
border-left-color: var(--\${P}-focus-stroke-color, var(--\${P}-stroke-color));
|
|
1100
|
-
}
|
|
1101
|
-
.\${P}-wrapper.\${P}-state-filled .\${P}-submitBtn {
|
|
1102
|
-
background-color: var(--\${P}-filled-button-color, var(--\${P}-button-color));
|
|
1103
|
-
color: var(--\${P}-filled-button-text-color, var(--\${P}-button-text-color));
|
|
1104
|
-
border-left-color: var(--\${P}-filled-stroke-color, var(--\${P}-stroke-color));
|
|
1105
1598
|
}
|
|
1106
|
-
.\${P}-
|
|
1107
|
-
.\${P}-
|
|
1108
|
-
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
background-color: var(--\${P}-focus-button-text-color, var(--\${P}-button-text-color));
|
|
1113
|
-
}
|
|
1114
|
-
.\${P}-wrapper.\${P}-state-filled .\${P}-submitBtn .\${P}-submitBtnIcon {
|
|
1115
|
-
background-color: var(--\${P}-filled-button-text-color, var(--\${P}-button-text-color));
|
|
1116
|
-
}
|
|
1117
|
-
.\${P}-wrapper.\${P}-state-success .\${P}-input,
|
|
1118
|
-
.\${P}-wrapper.\${P}-state-success .\${P}-submitBtn {
|
|
1119
|
-
pointer-events: none;
|
|
1599
|
+
.\${P}-item-slider,
|
|
1600
|
+
.\${P}-item-slider .splide__track,
|
|
1601
|
+
.\${P}-item-slider .splide__list,
|
|
1602
|
+
.\${P}-item-slider .splide__slide {
|
|
1603
|
+
width: 100%;
|
|
1604
|
+
height: 100%;
|
|
1120
1605
|
}
|
|
1121
|
-
.\${P}-
|
|
1122
|
-
position: relative;
|
|
1606
|
+
.\${P}-item-slider .splide__slide {
|
|
1123
1607
|
display: flex;
|
|
1608
|
+
justify-content: center;
|
|
1124
1609
|
align-items: center;
|
|
1125
1610
|
}
|
|
1126
|
-
.\${P}-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
margin-top:
|
|
1133
|
-
|
|
1134
|
-
|
|
1611
|
+
.\${P}-item-title {
|
|
1612
|
+
white-space: normal;
|
|
1613
|
+
overflow-wrap: anywhere;
|
|
1614
|
+
word-break: break-word;
|
|
1615
|
+
text-align: center;
|
|
1616
|
+
margin-bottom: 0px;
|
|
1617
|
+
margin-top: 0px;
|
|
1618
|
+
color: var(--\${P}-title-color);
|
|
1619
|
+
}
|
|
1620
|
+
.\${P}-item-subtitle {
|
|
1621
|
+
white-space: normal;
|
|
1622
|
+
overflow-wrap: anywhere;
|
|
1623
|
+
word-break: break-word;
|
|
1624
|
+
text-align: center;
|
|
1625
|
+
margin-bottom: 0px;
|
|
1626
|
+
margin-top: 0px;
|
|
1627
|
+
color: var(--\${P}-subtitle-color);
|
|
1135
1628
|
}
|
|
1136
1629
|
\`;
|
|
1137
1630
|
}
|
|
1138
1631
|
|
|
1139
|
-
type
|
|
1140
|
-
settings:
|
|
1141
|
-
content?:
|
|
1632
|
+
type GridProps = {
|
|
1633
|
+
settings: GridSettings;
|
|
1634
|
+
content?: any;
|
|
1142
1635
|
isEditor?: boolean;
|
|
1143
|
-
activeEvent
|
|
1636
|
+
activeEvent: string | undefined;
|
|
1637
|
+
onUpdateSettings?: (settings: GridSettings) => void;
|
|
1144
1638
|
} & CommonComponentProps;
|
|
1145
1639
|
|
|
1146
|
-
|
|
1147
|
-
const { prefix: P } = useScopedStyles();
|
|
1148
|
-
const {
|
|
1149
|
-
fields = [{ name: 'email', type: 'email', placeholder: 'Your email' }],
|
|
1150
|
-
buttonIcon,
|
|
1151
|
-
buttonLabel,
|
|
1152
|
-
fieldsToShow = 1,
|
|
1153
|
-
fontFamily,
|
|
1154
|
-
inputFontSettings,
|
|
1155
|
-
inputFontSize,
|
|
1156
|
-
inputLineHeight,
|
|
1157
|
-
inputLetterSpacing,
|
|
1158
|
-
inputWordSpacing,
|
|
1159
|
-
inputTextAppearance,
|
|
1160
|
-
buttonFontSettings,
|
|
1161
|
-
buttonFontSize,
|
|
1162
|
-
buttonLineHeight,
|
|
1163
|
-
buttonLetterSpacing,
|
|
1164
|
-
buttonWordSpacing,
|
|
1165
|
-
buttonTextAppearance,
|
|
1166
|
-
statusFontSettings,
|
|
1167
|
-
statusFontSize,
|
|
1168
|
-
statusLineHeight,
|
|
1169
|
-
statusLetterSpacing,
|
|
1170
|
-
statusWordSpacing,
|
|
1171
|
-
statusTextAppearance,
|
|
1172
|
-
iconMaxWidth,
|
|
1173
|
-
minHeight,
|
|
1174
|
-
corners,
|
|
1175
|
-
stroke,
|
|
1176
|
-
stateOverrides,
|
|
1177
|
-
inputPadding,
|
|
1178
|
-
buttonPadding,
|
|
1179
|
-
successMessage = 'Thanks for subscribing!',
|
|
1180
|
-
errorMessage: errorMessageText = 'Please, fill all required fields.',
|
|
1181
|
-
} = settings;
|
|
1640
|
+
type AnimRect = { top: number; left: number; width: number; height: number };
|
|
1182
1641
|
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1642
|
+
type LightboxProps = {
|
|
1643
|
+
images: string[];
|
|
1644
|
+
index: number;
|
|
1645
|
+
imageDisplay: 'Fit' | 'Cover';
|
|
1646
|
+
originRect: AnimRect | null;
|
|
1647
|
+
reverseClose: boolean;
|
|
1648
|
+
onClose: () => void;
|
|
1649
|
+
onPrev: () => void;
|
|
1650
|
+
onNext: () => void;
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
const LIGHTBOX_ANIM_MS = 500;
|
|
1654
|
+
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
1189
1655
|
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
const
|
|
1194
|
-
const
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1656
|
+
function Lightbox({ images, index, imageDisplay, originRect, reverseClose, onClose, onPrev, onNext }: LightboxProps) {
|
|
1657
|
+
const ghostRef = useRef<HTMLDivElement>(null);
|
|
1658
|
+
const imgRef = useRef<HTMLImageElement>(null);
|
|
1659
|
+
const [finalRect, setFinalRect] = useState<AnimRect | null>(null);
|
|
1660
|
+
const [phase, setPhase] = useState<'opening' | 'open' | 'closing'>(originRect ? 'opening' : 'open');
|
|
1661
|
+
const [transitionsEnabled, setTransitionsEnabled] = useState(true);
|
|
1662
|
+
const prevIndexRef = useRef(index);
|
|
1197
1663
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1664
|
+
const computeFinalRect = useCallback(() => {
|
|
1665
|
+
const ghost = ghostRef.current;
|
|
1666
|
+
const img = imgRef.current;
|
|
1667
|
+
if (!ghost || !img) return;
|
|
1668
|
+
const cb = ghost.getBoundingClientRect();
|
|
1669
|
+
const cw = cb.width;
|
|
1670
|
+
const ch = cb.height;
|
|
1671
|
+
const nw = img.naturalWidth;
|
|
1672
|
+
const nh = img.naturalHeight;
|
|
1673
|
+
if (!cw || !ch || !nw || !nh) return;
|
|
1674
|
+
if (imageDisplay === 'Cover') {
|
|
1675
|
+
setFinalRect({ width: cw, height: ch, left: cb.left, top: cb.top });
|
|
1676
|
+
return;
|
|
1204
1677
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1678
|
+
const ir = nw / nh;
|
|
1679
|
+
const cr = cw / ch;
|
|
1680
|
+
if (ir > cr) {
|
|
1681
|
+
const dh = cw / ir;
|
|
1682
|
+
setFinalRect({ width: cw, height: dh, left: cb.left, top: cb.top + (ch - dh) / 2 });
|
|
1683
|
+
} else {
|
|
1684
|
+
const dw = ch * ir;
|
|
1685
|
+
setFinalRect({ width: dw, height: ch, left: cb.left + (cw - dw) / 2, top: cb.top });
|
|
1686
|
+
}
|
|
1687
|
+
}, [imageDisplay]);
|
|
1215
1688
|
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1689
|
+
useEffect(() => {
|
|
1690
|
+
computeFinalRect();
|
|
1691
|
+
const c = ghostRef.current;
|
|
1692
|
+
if (!c) return;
|
|
1693
|
+
const ro = new ResizeObserver(() => computeFinalRect());
|
|
1694
|
+
ro.observe(c);
|
|
1695
|
+
return () => ro.disconnect();
|
|
1696
|
+
}, [computeFinalRect, index]);
|
|
1221
1697
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1698
|
+
useEffect(() => {
|
|
1699
|
+
if (phase !== 'opening' || !finalRect) return;
|
|
1700
|
+
const handle = { id: 0 };
|
|
1701
|
+
handle.id = requestAnimationFrame(() => {
|
|
1702
|
+
handle.id = requestAnimationFrame(() => setPhase('open'));
|
|
1703
|
+
});
|
|
1704
|
+
return () => cancelAnimationFrame(handle.id);
|
|
1705
|
+
}, [phase, finalRect]);
|
|
1706
|
+
|
|
1707
|
+
useEffect(() => {
|
|
1708
|
+
if (phase !== 'closing') return;
|
|
1709
|
+
const t = setTimeout(() => onClose(), LIGHTBOX_ANIM_MS);
|
|
1710
|
+
return () => clearTimeout(t);
|
|
1711
|
+
}, [phase, onClose]);
|
|
1712
|
+
|
|
1713
|
+
useEffect(() => {
|
|
1714
|
+
if (prevIndexRef.current !== index) {
|
|
1715
|
+
setTransitionsEnabled(false);
|
|
1716
|
+
}
|
|
1717
|
+
prevIndexRef.current = index;
|
|
1718
|
+
}, [index]);
|
|
1719
|
+
|
|
1720
|
+
const handleClose = () => {
|
|
1721
|
+
if (phase === 'closing') return;
|
|
1722
|
+
setPhase('closing');
|
|
1234
1723
|
};
|
|
1235
1724
|
|
|
1236
|
-
const
|
|
1725
|
+
const isOpen = phase === 'open';
|
|
1726
|
+
const isClosing = phase === 'closing';
|
|
1727
|
+
const reverseAnimateClose = isClosing && reverseClose && !!originRect;
|
|
1728
|
+
const animatedRect = phase === 'opening'
|
|
1729
|
+
? (originRect ?? finalRect)
|
|
1730
|
+
: reverseAnimateClose
|
|
1731
|
+
? originRect
|
|
1732
|
+
: finalRect;
|
|
1733
|
+
|
|
1734
|
+
return (
|
|
1735
|
+
<div
|
|
1736
|
+
style={{
|
|
1737
|
+
position: 'fixed',
|
|
1738
|
+
top: 0,
|
|
1739
|
+
left: 0,
|
|
1740
|
+
width: '100vw',
|
|
1741
|
+
height: '100vh',
|
|
1742
|
+
zIndex: 9997,
|
|
1743
|
+
}}
|
|
1744
|
+
onClick={handleClose}
|
|
1745
|
+
>
|
|
1746
|
+
<div
|
|
1747
|
+
style={{
|
|
1748
|
+
position: 'absolute',
|
|
1749
|
+
inset: 0,
|
|
1750
|
+
background: 'rgba(28,31,34,0.9)',
|
|
1751
|
+
opacity: isOpen ? 1 : 0,
|
|
1752
|
+
transition: \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`,
|
|
1753
|
+
pointerEvents: 'none',
|
|
1754
|
+
}}
|
|
1755
|
+
/>
|
|
1756
|
+
<div
|
|
1757
|
+
style={{
|
|
1758
|
+
position: 'relative',
|
|
1759
|
+
width: '100%',
|
|
1760
|
+
height: '100%',
|
|
1761
|
+
display: 'flex',
|
|
1762
|
+
flexDirection: 'column',
|
|
1763
|
+
alignItems: 'center',
|
|
1764
|
+
justifyContent: 'center',
|
|
1765
|
+
}}
|
|
1766
|
+
>
|
|
1767
|
+
<div style={{ height: '10%' }}></div>
|
|
1768
|
+
<div
|
|
1769
|
+
style={{
|
|
1770
|
+
width: '70%',
|
|
1771
|
+
height: '80%',
|
|
1772
|
+
display: 'flex',
|
|
1773
|
+
justifyContent: 'center',
|
|
1774
|
+
alignItems: 'center'
|
|
1775
|
+
}}>
|
|
1776
|
+
<div ref={ghostRef} style={{ width: '100%', height: '100%' }} />
|
|
1777
|
+
</div>
|
|
1778
|
+
<div
|
|
1779
|
+
style={{
|
|
1780
|
+
display: 'flex',
|
|
1781
|
+
flexDirection: 'row',
|
|
1782
|
+
justifyContent: 'center',
|
|
1783
|
+
alignItems: 'center',
|
|
1784
|
+
height: '10%',
|
|
1785
|
+
color: '#E6E6E6',
|
|
1786
|
+
letterSpacing: '-0.6px',
|
|
1787
|
+
lineHeight: '16px',
|
|
1788
|
+
opacity: isOpen ? 1 : 0,
|
|
1789
|
+
transition: \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`,
|
|
1790
|
+
}}
|
|
1791
|
+
>
|
|
1792
|
+
<p>{index + 1}</p>
|
|
1793
|
+
<p>/</p>
|
|
1794
|
+
<p>{images.length}</p>
|
|
1795
|
+
</div>
|
|
1796
|
+
</div>
|
|
1797
|
+
|
|
1798
|
+
{animatedRect && (
|
|
1799
|
+
<img
|
|
1800
|
+
ref={imgRef}
|
|
1801
|
+
src={images[index]}
|
|
1802
|
+
onLoad={computeFinalRect}
|
|
1803
|
+
style={{
|
|
1804
|
+
position: 'fixed',
|
|
1805
|
+
top: animatedRect.top,
|
|
1806
|
+
left: animatedRect.left,
|
|
1807
|
+
width: animatedRect.width,
|
|
1808
|
+
height: animatedRect.height,
|
|
1809
|
+
objectFit: imageDisplay === 'Cover' ? 'cover' : 'contain',
|
|
1810
|
+
opacity: isClosing && !reverseAnimateClose ? 0 : 1,
|
|
1811
|
+
transition: isClosing && !reverseAnimateClose
|
|
1812
|
+
? \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`
|
|
1813
|
+
: (reverseAnimateClose || transitionsEnabled)
|
|
1814
|
+
? \`top \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}, left \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}, width \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}, height \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`
|
|
1815
|
+
: 'none',
|
|
1816
|
+
pointerEvents: 'none',
|
|
1817
|
+
zIndex: 9998,
|
|
1818
|
+
}}
|
|
1819
|
+
/>
|
|
1820
|
+
)}
|
|
1821
|
+
|
|
1822
|
+
{isOpen && finalRect && (
|
|
1823
|
+
<>
|
|
1824
|
+
<div
|
|
1825
|
+
style={{
|
|
1826
|
+
position: 'fixed',
|
|
1827
|
+
top: finalRect.top,
|
|
1828
|
+
left: finalRect.left,
|
|
1829
|
+
width: finalRect.width / 2,
|
|
1830
|
+
height: finalRect.height,
|
|
1831
|
+
cursor: 'w-resize',
|
|
1832
|
+
zIndex: 9999,
|
|
1833
|
+
}}
|
|
1834
|
+
onClick={(e) => {
|
|
1835
|
+
e.stopPropagation();
|
|
1836
|
+
onPrev();
|
|
1837
|
+
}}
|
|
1838
|
+
/>
|
|
1839
|
+
<div
|
|
1840
|
+
style={{
|
|
1841
|
+
position: 'fixed',
|
|
1842
|
+
top: finalRect.top,
|
|
1843
|
+
left: finalRect.left + finalRect.width / 2,
|
|
1844
|
+
width: finalRect.width / 2,
|
|
1845
|
+
height: finalRect.height,
|
|
1846
|
+
cursor: 'e-resize',
|
|
1847
|
+
zIndex: 9999,
|
|
1848
|
+
}}
|
|
1849
|
+
onClick={(e) => {
|
|
1850
|
+
e.stopPropagation();
|
|
1851
|
+
onNext();
|
|
1852
|
+
}}
|
|
1853
|
+
/>
|
|
1854
|
+
</>
|
|
1855
|
+
)}
|
|
1856
|
+
</div>
|
|
1857
|
+
);
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
export function Grid({ settings, content, isEditor, metadata, activeEvent }: GridProps) {
|
|
1861
|
+
const { prefix: P } = useScopedStyles();
|
|
1862
|
+
const {
|
|
1863
|
+
type = 'A',
|
|
1864
|
+
fieldsToShow = 2,
|
|
1865
|
+
textBoxWidth,
|
|
1866
|
+
verticalGap,
|
|
1867
|
+
entriesCount,
|
|
1868
|
+
lightbox,
|
|
1869
|
+
imageSize,
|
|
1870
|
+
imageDisplay,
|
|
1871
|
+
slider,
|
|
1872
|
+
sliderTiming,
|
|
1873
|
+
direction,
|
|
1874
|
+
transition,
|
|
1875
|
+
titleColor,
|
|
1876
|
+
subtitleColor,
|
|
1877
|
+
titleFontFamily,
|
|
1878
|
+
titleFontSettings,
|
|
1879
|
+
titleFontSize,
|
|
1880
|
+
titleLineHeight,
|
|
1881
|
+
titleLetterSpacing,
|
|
1882
|
+
titleWordSpacing,
|
|
1883
|
+
titleTextAppearance,
|
|
1884
|
+
subtitleFontFamily,
|
|
1885
|
+
subtitleFontSettings,
|
|
1886
|
+
subtitleFontSize,
|
|
1887
|
+
subtitleLineHeight,
|
|
1888
|
+
subtitleLetterSpacing,
|
|
1889
|
+
subtitleWordSpacing,
|
|
1890
|
+
subtitleTextAppearance,
|
|
1891
|
+
} = settings;
|
|
1892
|
+
|
|
1893
|
+
const resolvedTitleTextStyle: TextStyles = {
|
|
1237
1894
|
fontSettings: {
|
|
1238
|
-
fontFamily,
|
|
1239
|
-
fontWeight:
|
|
1240
|
-
fontStyle:
|
|
1895
|
+
fontFamily: titleFontFamily,
|
|
1896
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
1897
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
1241
1898
|
},
|
|
1242
|
-
fontSize:
|
|
1243
|
-
lineHeight:
|
|
1244
|
-
letterSpacing:
|
|
1245
|
-
wordSpacing:
|
|
1246
|
-
textAppearance:
|
|
1247
|
-
color:
|
|
1899
|
+
fontSize: titleFontSize ?? 0.01,
|
|
1900
|
+
lineHeight: titleLineHeight,
|
|
1901
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
1902
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
1903
|
+
textAppearance: titleTextAppearance,
|
|
1904
|
+
color: titleColor,
|
|
1248
1905
|
};
|
|
1906
|
+
const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));
|
|
1907
|
+
const titleFieldCss = {
|
|
1908
|
+
...titleTypographyCss,
|
|
1909
|
+
} as React.CSSProperties;
|
|
1249
1910
|
|
|
1250
|
-
const
|
|
1911
|
+
const resolvedSubtitleTextStyle: TextStyles = {
|
|
1251
1912
|
fontSettings: {
|
|
1252
|
-
fontFamily,
|
|
1253
|
-
fontWeight:
|
|
1254
|
-
fontStyle:
|
|
1913
|
+
fontFamily: subtitleFontFamily,
|
|
1914
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
1915
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
1255
1916
|
},
|
|
1256
|
-
fontSize:
|
|
1257
|
-
lineHeight:
|
|
1258
|
-
letterSpacing:
|
|
1259
|
-
wordSpacing:
|
|
1260
|
-
textAppearance:
|
|
1261
|
-
color:
|
|
1917
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
1918
|
+
lineHeight: subtitleLineHeight,
|
|
1919
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
1920
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
1921
|
+
textAppearance: subtitleTextAppearance,
|
|
1922
|
+
color: subtitleColor,
|
|
1262
1923
|
};
|
|
1924
|
+
const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));
|
|
1925
|
+
const subtitleFieldCss = {
|
|
1926
|
+
...subtitleTypographyCss,
|
|
1927
|
+
} as React.CSSProperties;
|
|
1263
1928
|
|
|
1264
|
-
const inputTypographyCss = omitTextColors(textStylesToCss(resolvedInputTextStyle, isEditor));
|
|
1265
|
-
const buttonTypographyCss = omitTextColors(textStylesToCss(resolvedButtonTextStyle, isEditor));
|
|
1266
|
-
const statusTypographyCss = omitTextColors(textStylesToCss(resolvedStatusTextStyle, isEditor));
|
|
1267
1929
|
const colorVars = buildColorVars(P, {
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
buttonColor: settings.buttonColor,
|
|
1272
|
-
successColor: settings.successColor,
|
|
1273
|
-
errorColor: settings.errorColor,
|
|
1274
|
-
inputTextColor: settings.inputTextColor ?? resolvedInputTextStyle?.color ?? '#111111',
|
|
1275
|
-
buttonTextColor: settings.buttonTextColor ?? resolvedButtonTextStyle?.color ?? '#ffffff',
|
|
1276
|
-
}, COLOR_VAR_MAP, STATE_KEYS, stateOverrides);
|
|
1930
|
+
titleColor,
|
|
1931
|
+
subtitleColor,
|
|
1932
|
+
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
1277
1933
|
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1280
|
-
borderWidth: scalingValue(stroke, isEditor),
|
|
1281
|
-
borderStyle: 'solid',
|
|
1282
|
-
};
|
|
1934
|
+
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
1935
|
+
const wrapperStateClasses = \`\${stateClass}\`.trim();
|
|
1283
1936
|
|
|
1284
|
-
const
|
|
1937
|
+
const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
|
|
1285
1938
|
|
|
1286
|
-
const
|
|
1287
|
-
e.preventDefault();
|
|
1288
|
-
const payload = Object.fromEntries(
|
|
1289
|
-
visibleFields.map((f) => [f.name, values[f.name]?.trim() ?? '']).filter(([, v]) => v)
|
|
1290
|
-
);
|
|
1291
|
-
if (!submitUrl) {
|
|
1292
|
-
setStatus('error');
|
|
1293
|
-
setErrorMessage('No integrations were found for this form.');
|
|
1294
|
-
return;
|
|
1295
|
-
}
|
|
1296
|
-
if (Object.keys(payload).length === 0) return;
|
|
1939
|
+
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
1297
1940
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
}
|
|
1941
|
+
const imageSizeMap = {
|
|
1942
|
+
Small: 0.1,
|
|
1943
|
+
Medium: 0.2,
|
|
1944
|
+
Big: 0.3,
|
|
1945
|
+
} as const;
|
|
1304
1946
|
|
|
1305
|
-
|
|
1306
|
-
setErrorMessage(null);
|
|
1947
|
+
const size = imageSizeMap[imageSize] ?? 0.2;
|
|
1307
1948
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1949
|
+
const isCover = imageDisplay?.display === 'Cover';
|
|
1950
|
+
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
1951
|
+
const ratioReversed = imageDisplay?.reversed ?? false;
|
|
1952
|
+
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
1953
|
+
const effW = ratioReversed ? rH : rW;
|
|
1954
|
+
const effH = ratioReversed ? rW : rH;
|
|
1955
|
+
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
1956
|
+
const isLandscape = effW >= effH;
|
|
1314
1957
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1958
|
+
const imageStyle: React.CSSProperties = {
|
|
1959
|
+
objectFit: isCover ? 'cover' : 'contain',
|
|
1960
|
+
...(isCover && {
|
|
1961
|
+
aspectRatio,
|
|
1962
|
+
width: isLandscape ? '100%' : 'auto',
|
|
1963
|
+
height: isLandscape ? 'auto' : '100%',
|
|
1964
|
+
}),
|
|
1965
|
+
};
|
|
1319
1966
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1967
|
+
const [dir, setDir] = useState('ltr');
|
|
1968
|
+
|
|
1969
|
+
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
1970
|
+
const [lightboxImages, setLightboxImages] = useState<string[]>([]);
|
|
1971
|
+
const [lightboxIndex, setLightboxIndex] = useState(0);
|
|
1972
|
+
const [lightboxOriginRect, setLightboxOriginRect] = useState<AnimRect | null>(null);
|
|
1973
|
+
|
|
1974
|
+
const openLightbox = (e: React.MouseEvent<HTMLImageElement>, urls: string[], idx: number) => {
|
|
1975
|
+
if (lightbox === 'Off') return;
|
|
1976
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
1977
|
+
setLightboxOriginRect({ top: r.top, left: r.left, width: r.width, height: r.height });
|
|
1978
|
+
setLightboxImages(urls);
|
|
1979
|
+
setLightboxIndex(idx);
|
|
1980
|
+
setLightboxOpen(true);
|
|
1326
1981
|
};
|
|
1327
1982
|
|
|
1328
1983
|
return (
|
|
1329
|
-
|
|
1984
|
+
<>
|
|
1330
1985
|
<style dangerouslySetInnerHTML={{ __html: getCSS(P) }} />
|
|
1331
|
-
<
|
|
1332
|
-
onSubmit={handleSubmit}
|
|
1333
|
-
className={\`\${P}-form\`}
|
|
1334
|
-
style={{
|
|
1335
|
-
...formStyle,
|
|
1336
|
-
height: scalingValue(minHeight, isEditor),
|
|
1337
|
-
minHeight: scalingValue(minHeight, isEditor),
|
|
1338
|
-
}}
|
|
1339
|
-
>
|
|
1986
|
+
<div style={colorVars}>
|
|
1340
1987
|
<div
|
|
1341
|
-
className={\`\${P}-
|
|
1342
|
-
style={{
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
/>
|
|
1363
|
-
))}
|
|
1364
|
-
</div>
|
|
1365
|
-
<div className={\`\${P}-overlayAnchor\`}>
|
|
1366
|
-
<button
|
|
1367
|
-
type="submit"
|
|
1368
|
-
className={\`\${P}-submitBtn\`}
|
|
1369
|
-
aria-label={submitAriaLabel}
|
|
1370
|
-
style={{
|
|
1371
|
-
...buttonTypographyCss,
|
|
1372
|
-
...dividerWidthStyle,
|
|
1373
|
-
paddingRight: scalingValue(buttonPadding.right, isEditor),
|
|
1374
|
-
paddingLeft: scalingValue(buttonPadding.left, isEditor),
|
|
1375
|
-
paddingTop: scalingValue(buttonPadding.top, isEditor),
|
|
1376
|
-
paddingBottom: scalingValue(buttonPadding.bottom, isEditor),
|
|
1377
|
-
}}
|
|
1378
|
-
>
|
|
1379
|
-
{status === 'submitting'
|
|
1380
|
-
? '...'
|
|
1381
|
-
: useIconButton
|
|
1382
|
-
? (iconSrc && (
|
|
1383
|
-
<SvgImage
|
|
1384
|
-
url={iconSrc}
|
|
1385
|
-
className={\`\${P}-submitBtnIcon\`}
|
|
1386
|
-
style={{ maxWidth: scalingValue(iconMaxWidth ?? 0, isEditor) }}
|
|
1387
|
-
fill={\`var(--\${P}-button-text-color)\`}
|
|
1388
|
-
hoverFill={\`var(--\${P}-button-text-color)\`}
|
|
1988
|
+
className={\`\${P}-wrapper \${P}-type-\${type} \${wrapperStateClasses}\`.trim()}
|
|
1989
|
+
style={{
|
|
1990
|
+
gridTemplateColumns: \`repeat(\${fieldsToShow}, 1fr)\`,
|
|
1991
|
+
rowGap: scalingValue(verticalGap ?? 0, isEditor),
|
|
1992
|
+
}}>
|
|
1993
|
+
{cropContent.map((item, index) => (
|
|
1994
|
+
<div
|
|
1995
|
+
key={index}
|
|
1996
|
+
className={\`\${P}-item\`.trim()}
|
|
1997
|
+
>
|
|
1998
|
+
<div className={\`\${P}-item-image-wrapper\`} style={{ width: scalingValue(size ?? 0, isEditor), height: scalingValue(size ?? 0, isEditor) }}>
|
|
1999
|
+
{(item.image?.length ?? 0) === 0
|
|
2000
|
+
? null
|
|
2001
|
+
: slider === 'Off'
|
|
2002
|
+
?
|
|
2003
|
+
<img
|
|
2004
|
+
src={item.image[0].url}
|
|
2005
|
+
alt={item.image[0].name}
|
|
2006
|
+
className={\`\${P}-item-image\`.trim()}
|
|
2007
|
+
style={imageStyle}
|
|
2008
|
+
onClick={(e) => openLightbox(e, item.image.map((i: any) => i.url), 0)}
|
|
1389
2009
|
/>
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
2010
|
+
:
|
|
2011
|
+
<Splide
|
|
2012
|
+
key={\`\${transition}-\${imageSize}-\${direction}-\${sliderTiming}\`}
|
|
2013
|
+
className={\`\${P}-item-slider\`}
|
|
2014
|
+
options={{
|
|
2015
|
+
arrows: false,
|
|
2016
|
+
pagination: false,
|
|
2017
|
+
drag: false,
|
|
2018
|
+
perPage: 1,
|
|
2019
|
+
autoplay: true,
|
|
2020
|
+
interval: sliderTiming * 1000,
|
|
2021
|
+
width: '100%',
|
|
2022
|
+
height: '100%',
|
|
2023
|
+
speed: 500,
|
|
2024
|
+
type: transition === 'Fade' ? 'fade' : 'loop',
|
|
2025
|
+
rewind: transition === 'Fade',
|
|
2026
|
+
pauseOnHover: false,
|
|
2027
|
+
pauseOnFocus: false,
|
|
2028
|
+
direction: transition === 'Fade' ? 'ltr' : direction !== 'Random'
|
|
2029
|
+
? direction === 'Horizontal'
|
|
2030
|
+
? 'ltr'
|
|
2031
|
+
: 'ttb'
|
|
2032
|
+
: dir,
|
|
2033
|
+
}}
|
|
2034
|
+
onMoved={(splide) => {
|
|
2035
|
+
if (direction !== 'Random' || transition === 'Fade') return;
|
|
2036
|
+
const next = Math.random() > 0.5 ? Math.random() > 0.5 ? 'rtl' : 'ltr' : Math.random() > 0.5 ? 'btt' : 'ttb';
|
|
2037
|
+
setDir(next);
|
|
2038
|
+
|
|
2039
|
+
setTimeout(() => {
|
|
2040
|
+
splide.refresh();
|
|
2041
|
+
}, 0);
|
|
2042
|
+
}}
|
|
2043
|
+
>
|
|
2044
|
+
{item.image.map((img: { url: string; name?: string }, imgIndex: number) => (
|
|
2045
|
+
<SplideSlide key={imgIndex}>
|
|
2046
|
+
<img
|
|
2047
|
+
src={img.url}
|
|
2048
|
+
alt={img.name}
|
|
2049
|
+
className={\`\${P}-item-image\`.trim()}
|
|
2050
|
+
style={imageStyle}
|
|
2051
|
+
onClick={(e) => openLightbox(e, item.image.map((i: any) => i.url), imgIndex)}
|
|
2052
|
+
/>
|
|
2053
|
+
</SplideSlide>
|
|
2054
|
+
))}
|
|
2055
|
+
</Splide>
|
|
2056
|
+
}
|
|
2057
|
+
</div>
|
|
2058
|
+
<p className={\`\${P}-item-title\`.trim()} style={{ width: \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`, ...titleFieldCss }}>
|
|
2059
|
+
{item.title}
|
|
2060
|
+
</p>
|
|
2061
|
+
{type === 'B' && <p className={\`\${P}-item-subtitle\`.trim()} style={{ width: \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`, ...subtitleFieldCss }}>
|
|
2062
|
+
{item.subtitle}
|
|
2063
|
+
</p>}
|
|
2064
|
+
</div>
|
|
2065
|
+
))}
|
|
1393
2066
|
</div>
|
|
1394
|
-
</
|
|
1395
|
-
{
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
</div>
|
|
2067
|
+
</div>
|
|
2068
|
+
{lightboxOpen && typeof document && document.getElementById("grid-component-lightbox-portal") && lightbox === 'On' &&
|
|
2069
|
+
createPortal(
|
|
2070
|
+
<div data-selection="none">
|
|
2071
|
+
<Lightbox
|
|
2072
|
+
images={lightboxImages}
|
|
2073
|
+
index={lightboxIndex}
|
|
2074
|
+
imageDisplay={imageDisplay.display}
|
|
2075
|
+
originRect={lightboxOriginRect}
|
|
2076
|
+
reverseClose={slider === 'Off'}
|
|
2077
|
+
onClose={() => setLightboxOpen(false)}
|
|
2078
|
+
onPrev={() => setLightboxIndex((prev) => (prev - 1 + lightboxImages.length) % lightboxImages.length)}
|
|
2079
|
+
onNext={() => setLightboxIndex((prev) => (prev + 1) % lightboxImages.length)}
|
|
2080
|
+
/>
|
|
2081
|
+
</div>,
|
|
2082
|
+
document.body
|
|
2083
|
+
)}
|
|
2084
|
+
</>
|
|
1413
2085
|
);
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
type FieldConfig = {
|
|
1417
|
-
name: string;
|
|
1418
|
-
type: 'text' | 'phone' | 'email';
|
|
1419
|
-
placeholder: string;
|
|
1420
|
-
isRequired?: boolean;
|
|
1421
|
-
error?: string;
|
|
1422
|
-
};
|
|
1423
|
-
|
|
1424
|
-
type OnelinerColorKeys =
|
|
1425
|
-
| 'strokeColor'
|
|
1426
|
-
| 'inputColor'
|
|
1427
|
-
| 'placeholderColor'
|
|
1428
|
-
| 'buttonColor'
|
|
1429
|
-
| 'inputTextColor'
|
|
1430
|
-
| 'buttonTextColor'
|
|
1431
|
-
| 'successColor'
|
|
1432
|
-
| 'errorColor';
|
|
1433
|
-
|
|
1434
|
-
type StateColorOverrides = Partial<Record<OnelinerColorKeys, string>>;
|
|
1435
|
-
|
|
1436
|
-
export type OnelinerFormButtonIcon = {
|
|
1437
|
-
mode?: 'On' | 'Off';
|
|
1438
|
-
icon?: string | null;
|
|
1439
|
-
};
|
|
2086
|
+
}
|
|
1440
2087
|
|
|
1441
|
-
|
|
1442
|
-
|
|
2088
|
+
type GridSettings = {
|
|
2089
|
+
type: 'A' | 'B';
|
|
1443
2090
|
fieldsToShow: number;
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
inputTextAppearance?: TextStyles['textAppearance'];
|
|
1454
|
-
buttonFontSettings?: { fontWeight: number; fontStyle: string };
|
|
1455
|
-
buttonFontSize?: number;
|
|
1456
|
-
buttonLineHeight?: number;
|
|
1457
|
-
buttonLetterSpacing?: number;
|
|
1458
|
-
buttonWordSpacing?: number;
|
|
1459
|
-
buttonTextAppearance?: TextStyles['textAppearance'];
|
|
1460
|
-
statusFontSettings?: { fontWeight: number; fontStyle: string };
|
|
1461
|
-
statusFontSize?: number;
|
|
1462
|
-
statusLineHeight?: number;
|
|
1463
|
-
statusLetterSpacing?: number;
|
|
1464
|
-
statusWordSpacing?: number;
|
|
1465
|
-
statusTextAppearance?: TextStyles['textAppearance'];
|
|
1466
|
-
minHeight: number;
|
|
1467
|
-
corners: number;
|
|
1468
|
-
stroke: number;
|
|
1469
|
-
inputPadding: {
|
|
1470
|
-
left: number;
|
|
1471
|
-
right: number;
|
|
1472
|
-
top: number;
|
|
1473
|
-
bottom: number;
|
|
1474
|
-
};
|
|
1475
|
-
buttonPadding: {
|
|
1476
|
-
left: number;
|
|
1477
|
-
right: number;
|
|
1478
|
-
top: number;
|
|
1479
|
-
bottom: number;
|
|
2091
|
+
textBoxWidth: number;
|
|
2092
|
+
verticalGap: number;
|
|
2093
|
+
entriesCount: number;
|
|
2094
|
+
lightbox: 'On' | 'Off';
|
|
2095
|
+
imageSize: 'Small' | 'Medium' | 'Big';
|
|
2096
|
+
imageDisplay: {
|
|
2097
|
+
display: 'Fit' | 'Cover';
|
|
2098
|
+
ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
2099
|
+
reversed: boolean;
|
|
1480
2100
|
};
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
2101
|
+
slider: 'On' | 'Off';
|
|
2102
|
+
sliderTiming: number;
|
|
2103
|
+
direction: 'Horizontal' | 'Vertical' | 'Random',
|
|
2104
|
+
transition: 'Fade' | 'Slide',
|
|
2105
|
+
titleColor: string;
|
|
2106
|
+
subtitleColor: string;
|
|
2107
|
+
titleFontFamily: string;
|
|
2108
|
+
titleFontSettings?: { fontWeight: number; fontStyle: string };
|
|
2109
|
+
titleFontSize?: number;
|
|
2110
|
+
titleLineHeight?: number;
|
|
2111
|
+
titleLetterSpacing?: number;
|
|
2112
|
+
titleWordSpacing?: number;
|
|
2113
|
+
titleTextAppearance?: TextStyles['textAppearance'];
|
|
2114
|
+
subtitleFontFamily: string;
|
|
2115
|
+
subtitleFontSettings?: { fontWeight: number; fontStyle: string };
|
|
2116
|
+
subtitleFontSize?: number;
|
|
2117
|
+
subtitleLineHeight?: number;
|
|
2118
|
+
subtitleLetterSpacing?: number;
|
|
2119
|
+
subtitleWordSpacing?: number;
|
|
2120
|
+
subtitleTextAppearance?: TextStyles['textAppearance'];
|
|
1492
2121
|
};
|
|
1493
2122
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
successColor: 'success-color',
|
|
1502
|
-
errorColor: 'error-color',
|
|
2123
|
+
type ColorKeys =
|
|
2124
|
+
| 'titleColor'
|
|
2125
|
+
| 'subtitleColor'
|
|
2126
|
+
|
|
2127
|
+
const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
2128
|
+
titleColor: 'title-color',
|
|
2129
|
+
subtitleColor: 'subtitle-color',
|
|
1503
2130
|
};
|
|
1504
2131
|
|
|
1505
2132
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
1506
|
-
`,Rl="data:image/svg+xml,"+encodeURIComponent('<svg width="23px" height="20px" viewBox="0 0 23 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Newsletter" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="Tutorials-pop-up-Copy-12" transform="translate(-43, -687)" fill="#FFFFFF" fill-rule="nonzero"><path d="M66,697 C66,697.552285 65.5522847,698 65,698 L44,698 C43.4477153,698 43,697.552285 43,697 C43,696.447715 43.4477153,696 44,696 L65,696 C65.5522847,696 66,696.447715 66,697 Z M55.6689647,687.256706 L65.6689647,696.256706 C66.1103451,696.653948 66.1103451,697.346052 65.6689647,697.743294 L55.6689647,706.743294 C55.2584547,707.112753 54.6261649,707.079475 54.2567059,706.668965 C53.8872468,706.258455 53.9205252,705.626165 54.3310353,705.256706 L63.5051529,697 L54.3310353,688.743294 C53.9205252,688.373835 53.8872468,687.741545 54.2567059,687.331035 C54.6261649,686.920525 55.2584547,686.887247 55.6689647,687.256706 Z" id="Combined-Shape"></path></g></g></svg>'),Bl=[{name:"email",type:"email",placeholder:"Enter your email",label:"Email",isRequired:!0,error:"Please, enter a valid e-mail."},{name:"name",type:"text",placeholder:"Enter your name",label:"Name",isRequired:!1,error:"Please, enter your name."},{name:"company",type:"text",placeholder:"Enter company",label:"Company",isRequired:!1,error:"Please, enter your company name."},{name:"phone",type:"phone",placeholder:"Enter your phone",label:"Phone",isRequired:!1,error:"Please, enter a valid phone number."}],Cn={fontSettings:{type:"object",display:{type:"font-settings-weight",visible:!0},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}}},Vl=["strokeColor","inputColor","inputTextColor","placeholderColor","buttonColor","buttonTextColor","successColor","errorColor"],Pl={type:"object",version:1,settings:{sizing:"auto manual",properties:{fieldsToShow:{type:"number",scope:"common",title:"Fields",display:{type:"number"},min:1,max:3},fields:{type:"array",scope:"common",display:{type:"fields-group"},items:{type:"object",properties:{name:{type:"string"},type:{type:"string",enum:["text","phone","email"]},placeholder:{type:"string"},label:{type:"string"},isRequired:{type:"boolean"},error:{type:"string"}}}},buttonLabel:{type:"string",scope:"common",title:"Button Label",display:{type:"text-input"}},buttonIcon:{type:"object",scope:"common",title:"Button Icon",display:{type:"button-icon-switch"},properties:{mode:{type:"string",enum:["On","Off"]},icon:{type:["string","null"],title:"Icon",display:{type:"settings-image-input"}}}},iconMaxWidth:{type:"number",scope:"common",title:"Icon Max Width",display:{type:"full-width-input"},min:0,max:1},fontFamily:{type:"string",scope:"common",title:"Font family",display:{type:"font-family-select"}},inputPadding:{type:"object",scope:"layout",title:"",display:{type:"padding-controls"}},buttonPadding:{type:"object",scope:"layout",title:"",display:{type:"padding-controls"}},minHeight:{type:"number",scope:"layout",title:"min Height",display:{type:"range-control"},min:0,max:200},corners:{type:"number",scope:"layout",title:"Corners",display:{type:"range-control"},min:0,max:100},stroke:{type:"number",scope:"layout",title:"Stroke",display:{type:"range-control"},min:0,max:20},strokeColor:{type:"string",scope:"common",title:"Stroke",display:{type:"palette-color-picker"}},inputColor:{type:"string",scope:"common",title:"Input Fill",display:{type:"palette-color-picker"}},inputTextColor:{type:"string",scope:"common",title:"Input Label",display:{type:"palette-color-picker"}},placeholderColor:{type:"string",scope:"common",title:"Filler Text",display:{type:"palette-color-picker"}},buttonColor:{type:"string",scope:"common",title:"Button Fill",display:{type:"palette-color-picker"}},buttonTextColor:{type:"string",scope:"common",title:"Button Label",display:{type:"palette-color-picker"}},successColor:{type:"string",scope:"common",title:"Success Message Color",display:{type:"palette-color-picker"}},errorColor:{type:"string",scope:"common",title:"Error Message Color",display:{type:"palette-color-picker"}},successMessage:{type:"string",scope:"common",title:"Success Message",display:{type:"text-input"}},errorMessage:{type:"string",scope:"common",title:"Error Message",display:{type:"text-input"}},stateOverrides:{type:"object",scope:"common"},inputFontSettings:{...Cn.fontSettings,scope:"common",title:"Input"},inputFontSize:{type:"number",scope:"layout",title:"Input Font Size",display:{type:"font-size"}},inputLineHeight:{type:"number",scope:"layout",title:"Input Line Height",display:{type:"line-height-input"}},inputLetterSpacing:{type:"number",scope:"layout",title:"Input Letter Spacing",display:{type:"letter-spacing-input"}},inputWordSpacing:{type:"number",scope:"layout",title:"Input Word Spacing",display:{type:"word-spacing-input"}},inputTextAppearance:{type:"object",scope:"layout",title:"Input Text Appearance",display:{type:"text-appearance"}},buttonFontSettings:{...Cn.fontSettings,scope:"common",title:"Button"},buttonFontSize:{type:"number",scope:"layout",title:"Button Font Size",display:{type:"font-size"}},buttonLineHeight:{type:"number",scope:"layout",title:"Button Line Height",display:{type:"line-height-input"}},buttonLetterSpacing:{type:"number",scope:"layout",title:"Button Letter Spacing",display:{type:"letter-spacing-input"}},buttonWordSpacing:{type:"number",scope:"layout",title:"Button Word Spacing",display:{type:"word-spacing-input"}},buttonTextAppearance:{type:"object",scope:"layout",title:"Button Text Appearance",display:{type:"text-appearance"}},statusFontSettings:{...Cn.fontSettings,scope:"common",title:"Success/Error"},statusFontSize:{type:"number",scope:"layout",title:"Success/Error Font Size",display:{type:"font-size"}},statusLineHeight:{type:"number",scope:"layout",title:"Success/Error Line Height",display:{type:"line-height-input"}},statusLetterSpacing:{type:"number",scope:"layout",title:"Success/Error Letter Spacing",display:{type:"letter-spacing-input"}},statusWordSpacing:{type:"number",scope:"layout",title:"Success/Error Word Spacing",display:{type:"word-spacing-input"}},statusTextAppearance:{type:"object",scope:"layout",title:"Success/Error Text Appearance",display:{type:"text-appearance"}}},defaults:{fields:Bl,fieldsToShow:1,buttonLabel:"Subscribe",buttonIcon:{mode:"Off",icon:Rl},fontFamily:"Arial",strokeColor:"#0A00F8",inputColor:"#ffffff",inputTextColor:"#0A00F8",placeholderColor:"#000000",buttonColor:"#0088D7",buttonTextColor:"#ffffff",errorColor:"#ef4444",successColor:"#22c55e",successMessage:"Thanks for subscribing!",errorMessage:"Please, fill all required fields.",stateOverrides:{hover:{buttonColor:"#33A2F2"}},inputFontSettings:{fontWeight:400,fontStyle:"normal"},inputLetterSpacing:0,inputWordSpacing:0,inputTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},buttonFontSettings:{fontWeight:400,fontStyle:"normal"},buttonLetterSpacing:0,buttonWordSpacing:0,buttonTextAppearance:{textTransform:"uppercase",textDecoration:"none",fontVariant:"normal"},statusFontSettings:{fontWeight:400,fontStyle:"normal"},statusLetterSpacing:0,statusWordSpacing:0,statusTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"}},layoutDefaults:{m:{minHeight:.1,iconMaxWidth:.1,stroke:0,corners:0,buttonPadding:{top:.02,right:.04,bottom:.02,left:.04},inputPadding:{top:.01,right:.03,bottom:.01,left:.03},inputFontSize:.043,inputLineHeight:.043,buttonFontSize:.0373,buttonLineHeight:.0373,statusFontSize:.0373,statusLineHeight:.0373},d:{minHeight:.028,iconMaxWidth:.028,stroke:0,corners:0,buttonPadding:{right:.0175,left:.0175,top:.005,bottom:.004},inputPadding:{top:.01,right:.01,bottom:.01,left:.01},inputFontSize:.01,inputLineHeight:.01,buttonFontSize:.009,buttonLineHeight:.01,statusFontSize:.01,statusLineHeight:.01}},displayRules:[{if:{name:"stroke",value:0},then:{name:"properties.strokeColor.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonFontSettings.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonFontSize.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonLineHeight.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonLetterSpacing.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonWordSpacing.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"On"},then:{name:"properties.buttonTextAppearance.display.visible",value:!1}},{if:{name:"buttonIcon.mode",value:"Off"},then:{name:"properties.iconMaxWidth.display.visible",value:!1}}]},panels:[{id:"general",icon:"cursor",title:"General",tooltip:"General Settings",layout:[{type:"row",items:["__componentName__","fieldsToShow"]},{type:"row",items:["minHeight","corners"]},{type:"row",items:[{type:"group",title:"",items:["stroke","buttonIcon"]},{type:"switcher",title:"Padding",options:{Input:["inputPadding"],Button:["buttonPadding"]}}]},"iconMaxWidth"]},{id:"typeStyle",icon:"text-icon",title:"Type Style",tooltip:"Typography",layout:["fontFamily",{type:"group",title:"",items:["inputFontSettings",{type:"row",items:["inputFontSize","inputLineHeight","inputLetterSpacing","inputWordSpacing"]},"inputTextAppearance"]},{type:"group",title:"",items:["buttonFontSettings",{type:"row",items:["buttonFontSize","buttonLineHeight","buttonLetterSpacing","buttonWordSpacing"]},"buttonTextAppearance"]},{type:"group",title:"",items:["statusFontSettings",{type:"row",items:["statusFontSize","statusLineHeight","statusLetterSpacing","statusWordSpacing"]},"statusTextAppearance"]}]},{id:"fields",icon:"layers",title:"Fields",tooltip:"Fields",layout:["fields","buttonLabel","successMessage","errorMessage"]}],paletteBookmark:{items:[...Vl],panelIds:["general","typeStyle"],stateItems:{default:["strokeColor","placeholderColor","inputColor","buttonTextColor","buttonColor"],hover:["strokeColor","inputColor","buttonTextColor","buttonColor"],focus:["strokeColor","inputTextColor","buttonTextColor","buttonColor"],filled:["strokeColor","inputColor","inputTextColor","buttonTextColor"],success:["successColor"],error:["errorColor"]}},allowedPlugins:["newsletter"],states:["default","hover","focus","filled","success","error"]},Ol={element:Al,id:"oneliner-form",name:"Newsletter Single Line",version:1,preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/onelinerImg.jpg"},defaultSize:{width:400,height:60},assetsPaths:{content:[],parameters:[{path:"buttonIcon.icon"}]},schema:Pl,sourceCode:Fl},Wl=[$a,Ia,vl,El,Ol];exports.components=Wl;exports.isSchemaV1=fr;
|
|
2133
|
+
`,Tr={fontSettings:{type:"object",display:{type:"font-settings-weight"},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}}},ql=["titleColor","subtitleColor"],Yl={type:"object",version:1,properties:{content:{type:"array",settings:{addItemFromFileExplorer:!0},items:{type:"object",properties:{title:{type:"string",label:"Title",placeholder:"Add Title...",display:{type:"text-input"}},subtitle:{type:"string",label:"Subtitle",placeholder:"Add Subtitle...",display:{type:"text-input"}},image:{type:"object",label:"Image",display:{type:"media-list-input"},properties:{url:{type:"string"},name:{type:"string"},objectFit:{type:"string",enum:["cover","contain"]}},required:["url","name"]}},required:["image"]},default:[{title:"Title 1",subtitle:"Subtitle 1",image:[{url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-1.png",name:"Grid-1.png",objectFit:"cover"}]},{title:"Title 2",subtitle:"Subtitle 2",image:[{url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-2.png",name:"Grid-2.png",objectFit:"cover"}]},{title:"Title 3",subtitle:"Subtitle 3",image:[{url:"https://cdn.cntrl.site/component-assets/Control-slider-default-picture-3.png",name:"Grid-3.png",objectFit:"cover"}]}]}},settings:{sizing:"auto manual",properties:{fieldsToShow:{type:"number",scope:"layout",title:"Columns",display:{type:"count-number"}},type:{type:"string",scope:"common",title:"",display:{type:"radio-group"},enum:["A","B"]},textBoxWidth:{type:"number",scope:"layout",title:"Textbox Width",display:{type:"percentage-input"},min:0,max:200},verticalGap:{type:"number",scope:"layout",title:"Vertical Gap",display:{type:"numeric-input"},min:0,max:1e3},entriesCount:{type:"number",scope:"layout",title:"Entries #",display:{type:"toggle-numeric-input",enum:["Auto","Fixed"]},min:1},lightbox:{type:"boolean",scope:"common",title:"Lightbox",display:{type:"toggle-cycle",enum:["On","Off"]}},imageSize:{type:"string",scope:"layout",title:"Size",display:{type:"toggle-cycle",enum:["Small","Medium","Big"]}},imageDisplay:{type:"object",scope:"common",title:"Display",display:{type:"image-ratio-control"},properties:{display:{type:"string",enum:["Fit","Cover"]},ratioValue:{type:"string",enum:["1:1","2:3","3:4","4:5","16:9"]},reversed:{type:"boolean"}}},slider:{type:"boolean",scope:"common",title:"Slider",display:{type:"toggle-cycle",enum:["On","Off"]}},sliderTiming:{type:"number",scope:"common",title:"Timing (S)",display:{type:"common-numeric-input"},min:1,max:10},direction:{type:"string",scope:"common",title:"Direction",display:{type:"toggle-cycle",enum:["Horizontal","Vertical","Random"],enabled:!0}},transition:{type:"string",scope:"common",title:"Transition",display:{type:"toggle-cycle",enum:["Fade","Slide"]}},titleColor:{type:"string",scope:"common",title:"Title Color",display:{type:"palette-color-picker"}},subtitleColor:{type:"string",scope:"common",title:"Subtitle Color",display:{type:"palette-color-picker",visible:!1}},titleFontFamily:{type:"string",scope:"common",title:"Font family",display:{type:"font-family-select"}},titleFontSettings:{...Tr.fontSettings,scope:"common",title:"",display:{type:"font-settings-weight"}},titleFontSize:{type:"number",scope:"layout",title:"Input Font Size",display:{type:"font-size"}},titleLineHeight:{type:"number",scope:"layout",title:"Input Line Height",display:{type:"line-height-input"}},titleLetterSpacing:{type:"number",scope:"layout",title:"Input Letter Spacing",display:{type:"letter-spacing-input"}},titleWordSpacing:{type:"number",scope:"layout",title:"Input Word Spacing",display:{type:"word-spacing-input"}},titleTextAppearance:{type:"object",scope:"layout",title:"Input Text Appearance",display:{type:"text-appearance"}},subtitleFontFamily:{type:"string",scope:"common",title:"Font family",display:{type:"font-family-select"}},subtitleFontSettings:{...Tr.fontSettings,scope:"common",title:"",display:{type:"font-settings-weight"}},subtitleFontSize:{type:"number",scope:"layout",title:"Subtitle Font Size",display:{type:"font-size"}},subtitleLineHeight:{type:"number",scope:"layout",title:"Subtitle Line Height",display:{type:"line-height-input"}},subtitleLetterSpacing:{type:"number",scope:"layout",title:"Subtitle Letter Spacing",display:{type:"letter-spacing-input"}},subtitleWordSpacing:{type:"number",scope:"layout",title:"Subtitle Word Spacing",display:{type:"word-spacing-input"}},subtitleTextAppearance:{type:"object",scope:"layout",title:"Subtitle Text Appearance",display:{type:"text-appearance"}}},defaults:{fieldsToShow:2,lightbox:"Off",imageDisplay:{display:"Fit",ratioValue:"16:9",reversed:!1},type:"A",slider:"Off",sliderTiming:5,direction:"Horizontal",transition:"Slide",titleColor:"#767676",subtitleColor:"#DEDDDD",titleFontFamily:"Arial",titleFontSettings:{fontWeight:400,fontStyle:"normal"},titleLetterSpacing:0,titleWordSpacing:0,titleTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"},subtitleFontFamily:"Arial",subtitleFontSettings:{fontWeight:400,fontStyle:"normal"},subtitleLetterSpacing:0,subtitleWordSpacing:0,subtitleTextAppearance:{textTransform:"none",textDecoration:"none",fontVariant:"normal"}},layoutDefaults:{m:{textBoxWidth:100,verticalGap:.0083,entriesCount:0,imageSize:"Medium",titleStroke:.003,titleCorners:.192,subtitlePadding:{top:.0373,right:.0373,bottom:.0373,left:.0373},titlePadding:{top:.0373,right:.0373,bottom:.0373,left:.0373},titleFontSize:.043,titleLineHeight:.043,subtitleFontSize:.0373,subtitleLineHeight:.0373},d:{textBoxWidth:100,verticalGap:.0083,entriesCount:0,imageSize:"Medium",titleStroke:.001,titleCorners:.05,subtitlePadding:{top:.01,right:.01,bottom:.01,left:.01},titlePadding:{top:.01,right:.01,bottom:.01,left:.01},titleFontSize:.01,titleLineHeight:.01,subtitleFontSize:.01,subtitleLineHeight:.01}},displayRules:[{if:{name:"transition",value:"Fade"},then:{name:"properties.direction.display.enabled",value:!1}},{if:{name:"type",value:"B"},then:{name:"properties.subtitleColor.display.visible",value:!0}}]},panels:[{id:"general",icon:"cursor",title:"General",tooltip:"General Settings",layout:[{type:"row",items:["__componentName__","name","fieldsToShow"]},"type",{type:"group",title:"",items:[{type:"row",title:"",items:[{type:"row",title:"",items:["textBoxWidth"]},{type:"row",title:"",items:["verticalGap"]}]},{type:"row",title:"",items:[{type:"row",title:"",items:["entriesCount"]},{type:"row",title:"",items:["lightbox"]}]}]},{type:"group",title:"Image",items:[{type:"row",title:"",items:[{type:"row",title:"",items:["imageSize"]},{type:"row",title:"",items:["imageDisplay"]}]}]},{type:"group",title:"Slider",items:[{type:"row",title:"",items:[{type:"row",title:"",items:["slider"]},{type:"row",title:"",items:["sliderTiming"]}]},{type:"row",title:"",items:[{type:"row",title:"",items:["direction"]},{type:"row",title:"",items:["transition"]}]}]}]},{id:"typeStyle",icon:"text-icon",title:"Type Style",tooltip:"Typography",layout:[{type:"group",title:"Title",items:["titleFontFamily","titleFontSettings",{type:"row",items:["titleFontSize","titleLineHeight","titleLetterSpacing","titleWordSpacing"]},"titleTextAppearance"]},{type:"group",title:"Subtitle",items:["subtitleFontFamily","subtitleFontSettings",{type:"row",items:["subtitleFontSize","subtitleLineHeight","subtitleLetterSpacing","subtitleWordSpacing"]},"subtitleTextAppearance"]}]}],paletteBookmark:{items:[...ql],panelIds:["general","typeStyle"],stateItems:{default:["titleColor","subtitleColor"]}}},Kl={element:Dl,id:"grid",name:"Neptune",preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/formImg.png"},version:1,defaultSize:{width:720,height:540},assetsPaths:{content:[{path:"image.url",placeholderEnabled:!0}],parameters:[]},schema:Yl,sourceCode:Xl},Jl=[Ta,Ra,xl,Il,Nl,Kl];exports.components=Jl;exports.isSchemaV1=bo;
|