@cntrl-site/components 1.0.6 → 1.0.7-0
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 +47 -0
- package/dist/Components/Grid/GridComponent.d.ts +38 -0
- package/dist/Components/Lightbox/Lightbox.d.ts +2 -25
- package/dist/index.js +1921 -1333
- package/dist/index.mjs +4766 -3331
- 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 d=require("react/jsx-runtime"),z=require("react"),ft=require("classnames"),E=require("./useScopedStyles-DpVdqfXj.js"),Ln=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-",zo="ControlSlider-module__paginationOutsideBottom___14w8D",Vo="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",ri="ControlSlider-module__bottomLeftAlignment___cTP2-",ni="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:zo,paginationOutsideTop:Vo,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:ri,bottomCenterAlignment:ni,bottomRightAlignment:oi,clickOverlay:ii,contain:ai,cover:li};function si(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ci(t,e,r){return e&&si(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var on="(prefers-reduced-motion: reduce)",ge=1,ui=2,ye=3,Se=4,Pe=5,Ke=6,tr=7,pi={CREATED:ge,MOUNTED:ui,IDLE:ye,MOVING:Se,SCROLLING:Pe,DRAGGING:Ke,DESTROYED:tr};function Gt(t){t.length=0}function Qt(t,e,r){return Array.prototype.slice.call(t,e,r)}function gt(t){return t.bind.apply(t,[null].concat(Qt(arguments,1)))}var En=setTimeout,wr=function(){};function an(t){return requestAnimationFrame(t)}function ir(t,e){return typeof e===t}function Ee(t){return!Or(t)&&ir("object",t)}var Rr=Array.isArray,An=gt(ir,"function"),Jt=gt(ir,"string"),Be=gt(ir,"undefined");function Or(t){return t===null}function In(t){try{return t instanceof(t.ownerDocument.defaultView||window).HTMLElement}catch{return!1}}function We(t){return Rr(t)?t:[t]}function Lt(t,e){We(t).forEach(e)}function Pr(t,e){return t.indexOf(e)>-1}function Je(t,e){return t.push.apply(t,We(e)),t}function jt(t,e,r){t&&Lt(e,function(n){n&&t.classList[r?"add":"remove"](n)})}function Ot(t,e){jt(t,Jt(e)?e.split(" "):e,!0)}function ze(t,e){Lt(e,t.appendChild.bind(t))}function Br(t,e){Lt(t,function(r){var n=(e||r).parentNode;n&&n.insertBefore(r,e)})}function Ae(t,e){return In(t)&&(t.msMatchesSelector||t.matches).call(t,e)}function Fn(t,e){var r=t?Qt(t.children):[];return e?r.filter(function(n){return Ae(n,e)}):r}function Ve(t,e){return e?Fn(t,e)[0]:t.firstElementChild}var Ie=Object.keys;function ie(t,e,r){return t&&(r?Ie(t).reverse():Ie(t)).forEach(function(n){n!=="__proto__"&&e(t[n],n)}),t}function Fe(t){return Qt(arguments,1).forEach(function(e){ie(e,function(r,n){t[n]=e[n]})}),t}function Yt(t){return Qt(arguments,1).forEach(function(e){ie(e,function(r,n){Rr(r)?t[n]=r.slice():Ee(r)?t[n]=Yt({},Ee(t[n])?t[n]:{},r):t[n]=r})}),t}function ln(t,e){Lt(e||Ie(t),function(r){delete t[r]})}function Pt(t,e){Lt(t,function(r){Lt(e,function(n){r&&r.removeAttribute(n)})})}function tt(t,e,r){Ee(e)?ie(e,function(n,o){tt(t,o,n)}):Lt(t,function(n){Or(r)||r===""?Pt(n,e):n.setAttribute(e,String(r))})}function me(t,e,r){var n=document.createElement(t);return e&&(Jt(e)?Ot(n,e):tt(n,e)),r&&ze(r,n),n}function At(t,e,r){if(Be(r))return getComputedStyle(t)[e];Or(r)||(t.style[e]=""+r)}function ke(t,e){At(t,"display",e)}function kn(t){t.setActive&&t.setActive()||t.focus({preventScroll:!0})}function It(t,e){return t.getAttribute(e)}function sn(t,e){return t&&t.classList.contains(e)}function _t(t){return t.getBoundingClientRect()}function ae(t){Lt(t,function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})}function Rn(t){return Ve(new DOMParser().parseFromString(t,"text/html").body)}function Nt(t,e){t.preventDefault(),e&&(t.stopPropagation(),t.stopImmediatePropagation())}function On(t,e){return t&&t.querySelector(e)}function Wr(t,e){return e?Qt(t.querySelectorAll(e)):[]}function Mt(t,e){jt(t,e,!1)}function _r(t){return t.timeStamp}function ne(t){return Jt(t)?t:t?t+"px":""}var Ne="splide",zr="data-"+Ne;function Te(t,e){if(!t)throw new Error("["+Ne+"] "+(e||""))}var Zt=Math.min,er=Math.max,rr=Math.floor,Re=Math.ceil,$t=Math.abs;function Pn(t,e,r){return $t(t-e)<r}function Ze(t,e,r,n){var o=Zt(e,r),a=er(e,r);return n?o<t&&t<a:o<=t&&t<=a}function pe(t,e,r){var n=Zt(e,r),o=er(e,r);return Zt(er(n,t),o)}function Tr(t){return+(t>0)-+(t<0)}function Lr(t,e){return Lt(e,function(r){t=t.replace("%s",""+r)}),t}function Vr(t){return t<10?"0"+t:""+t}var cn={};function di(t){return""+t+Vr(cn[t]=(cn[t]||0)+1)}function Bn(){var t=[];function e(i,s,c,l){o(i,s,function(u,C,v){var m="addEventListener"in u,p=m?u.removeEventListener.bind(u,C,c,l):u.removeListener.bind(u,c);m?u.addEventListener(C,c,l):u.addListener(c),t.push([u,C,v,c,p])})}function r(i,s,c){o(i,s,function(l,u,C){t=t.filter(function(v){return v[0]===l&&v[1]===u&&v[2]===C&&(!c||v[3]===c)?(v[4](),!1):!0})})}function n(i,s,c){var l,u=!0;return typeof CustomEvent=="function"?l=new CustomEvent(s,{bubbles:u,detail:c}):(l=document.createEvent("CustomEvent"),l.initCustomEvent(s,u,!1,c)),i.dispatchEvent(l),l}function o(i,s,c){Lt(i,function(l){l&&Lt(s,function(u){u.split(" ").forEach(function(C){var v=C.split(".");c(l,v[0],v[1])})})})}function a(){t.forEach(function(i){i[4]()}),Gt(t)}return{bind:e,unbind:r,dispatch:n,destroy:a}}var te="mounted",Er="ready",Ut="move",xe="moved",Nr="click",Wn="active",zn="inactive",Vn="visible",Nn="hidden",vt="refresh",Ct="updated",be="resize",ar="resized",jn="drag",Mn="dragging",Hn="dragged",lr="scroll",se="scrolled",gi="overflow",jr="destroy",Dn="arrows:mounted",Gn="arrows:updated",Un="pagination:mounted",Xn="pagination:updated",Mr="navigation:mounted",Hr="autoplay:play",qn="autoplay:playing",Dr="autoplay:pause",Gr="lazyload:loaded",Yn="sk",Kn="sh",nr="ei";function ht(t){var e=t?t.event.bus:document.createDocumentFragment(),r=Bn();function n(a,i){r.bind(e,We(a).join(" "),function(s){i.apply(i,Rr(s.detail)?s.detail:[])})}function o(a){r.dispatch(e,a,Qt(arguments,1))}return t&&t.event.on(jr,r.destroy),Fe(r,{bus:e,on:n,off:gt(r.unbind,e),emit:o})}function sr(t,e,r,n){var o=Date.now,a,i=0,s,c=!0,l=0;function u(){if(!c){if(i=t?Zt((o()-a)/t,1):1,r&&r(i),i>=1&&(e(),a=o(),n&&++l>=n))return v();s=an(u)}}function C(h){h||p(),a=o()-(h?i*t:0),c=!1,s=an(u)}function v(){c=!0}function m(){a=o(),i=0,r&&r(i)}function p(){s&&cancelAnimationFrame(s),i=0,s=0,c=!0}function g(h){t=h}function S(){return c}return{start:C,rewind:m,pause:v,cancel:p,set:g,isPaused:S}}function mi(t){var e=t;function r(o){e=o}function n(o){return Pr(We(o),e)}return{set:r,is:n}}function fi(t,e){var r=sr(0,t,null,1);return function(){r.isPaused()&&r.start()}}function hi(t,e,r){var n=t.state,o=r.breakpoints||{},a=r.reducedMotion||{},i=Bn(),s=[];function c(){var p=r.mediaQuery==="min";Ie(o).sort(function(g,S){return p?+g-+S:+S-+g}).forEach(function(g){u(o[g],"("+(p?"min":"max")+"-width:"+g+"px)")}),u(a,on),C()}function l(p){p&&i.destroy()}function u(p,g){var S=matchMedia(g);i.bind(S,"change",C),s.push([p,S])}function C(){var p=n.is(tr),g=r.direction,S=s.reduce(function(h,f){return Yt(h,f[1].matches?f[0]:{})},{});ln(r),m(S),r.destroy?t.destroy(r.destroy==="completely"):p?(l(!0),t.mount()):g!==r.direction&&t.refresh()}function v(p){matchMedia(on).matches&&(p?Yt(r,a):ln(r,Ie(a)))}function m(p,g,S){Yt(r,p),g&&Yt(Object.getPrototypeOf(r),p),(S||!n.is(ge))&&t.emit(Ct,r)}return{setup:c,destroy:l,reduce:v,set:m}}var cr="Arrow",ur=cr+"Left",pr=cr+"Right",Jn=cr+"Up",Zn=cr+"Down",un="rtl",dr="ttb",br={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[Jn,pr],ArrowRight:[Zn,ur]};function yi(t,e,r){function n(a,i,s){s=s||r.direction;var c=s===un&&!i?1:s===dr?0:-1;return br[a]&&br[a][c]||a.replace(/width|left|right/i,function(l,u){var C=br[l.toLowerCase()][c]||l;return u>0?C.charAt(0).toUpperCase()+C.slice(1):C})}function o(a){return a*(r.direction===un?1:-1)}return{resolve:n,orient:o}}var Dt="role",fe="tabindex",bi="disabled",Ft="aria-",je=Ft+"controls",Qn=Ft+"current",pn=Ft+"selected",Tt=Ft+"label",Ur=Ft+"labelledby",to=Ft+"hidden",Xr=Ft+"orientation",Oe=Ft+"roledescription",dn=Ft+"live",gn=Ft+"busy",mn=Ft+"atomic",qr=[Dt,fe,bi,je,Qn,Tt,Ur,to,Xr,Oe],Bt=Ne+"__",ee="is-",vr=Ne,fn=Bt+"track",vi=Bt+"list",gr=Bt+"slide",eo=gr+"--clone",Si=gr+"__container",Yr=Bt+"arrows",mr=Bt+"arrow",ro=mr+"--prev",no=mr+"--next",fr=Bt+"pagination",oo=fr+"__page",xi=Bt+"progress",Ci=xi+"__bar",$i=Bt+"toggle",wi=Bt+"spinner",_i=Bt+"sr",Ti=ee+"initialized",le=ee+"active",io=ee+"prev",ao=ee+"next",Ar=ee+"visible",Ir=ee+"loading",lo=ee+"focus-in",so=ee+"overflow",Li=[le,Ar,io,ao,Ir,lo,so],Ei={slide:gr,clone:eo,arrows:Yr,arrow:mr,prev:ro,next:no,pagination:fr,page:oo,spinner:wi};function Ai(t,e){if(An(t.closest))return t.closest(e);for(var r=t;r&&r.nodeType===1&&!Ae(r,e);)r=r.parentElement;return r}var Ii=5,hn=200,co="touchstart mousedown",Sr="touchmove mousemove",xr="touchend touchcancel mouseup click";function Fi(t,e,r){var n=ht(t),o=n.on,a=n.bind,i=t.root,s=r.i18n,c={},l=[],u=[],C=[],v,m,p;function g(){$(),M(),f()}function S(){o(vt,h),o(vt,g),o(Ct,f),a(document,co+" keydown",function(y){p=y.type==="keydown"},{capture:!0}),a(i,"focusin",function(){jt(i,lo,!!p)})}function h(y){var L=qr.concat("style");Gt(l),Mt(i,u),Mt(v,C),Pt([v,m],L),Pt(i,y?L:["style",Oe])}function f(){Mt(i,u),Mt(v,C),u=w(vr),C=w(fn),Ot(i,u),Ot(v,C),tt(i,Tt,r.label),tt(i,Ur,r.labelledby)}function $(){v=T("."+fn),m=Ve(v,"."+vi),Te(v&&m,"A track/list element is missing."),Je(l,Fn(m,"."+gr+":not(."+eo+")")),ie({arrows:Yr,pagination:fr,prev:ro,next:no,bar:Ci,toggle:$i},function(y,L){c[L]=T("."+y)}),Fe(c,{root:i,track:v,list:m,slides:l})}function M(){var y=i.id||di(Ne),L=r.role;i.id=y,v.id=v.id||y+"-track",m.id=m.id||y+"-list",!It(i,Dt)&&i.tagName!=="SECTION"&&L&&tt(i,Dt,L),tt(i,Oe,s.carousel),tt(m,Dt,"presentation")}function T(y){var L=On(i,y);return L&&Ai(L,"."+vr)===i?L:void 0}function w(y){return[y+"--"+r.type,y+"--"+r.direction,r.drag&&y+"--draggable",r.isNavigation&&y+"--nav",y===vr&&le]}return Fe(c,{setup:g,mount:S,destroy:h})}var ve="slide",Ce="loop",Me="fade";function ki(t,e,r,n){var o=ht(t),a=o.on,i=o.emit,s=o.bind,c=t.Components,l=t.root,u=t.options,C=u.isNavigation,v=u.updateOnMove,m=u.i18n,p=u.pagination,g=u.slideFocus,S=c.Direction.resolve,h=It(n,"style"),f=It(n,Tt),$=r>-1,M=Ve(n,"."+Si),T;function w(){$||(n.id=l.id+"-slide"+Vr(e+1),tt(n,Dt,p?"tabpanel":"group"),tt(n,Oe,m.slide),tt(n,Tt,f||Lr(m.slideLabel,[e+1,t.length]))),y()}function y(){s(n,"click",gt(i,Nr,k)),s(n,"keydown",gt(i,Yn,k)),a([xe,Kn,se],R),a(Mr,I),v&&a(Ut,V)}function L(){T=!0,o.destroy(),Mt(n,Li),Pt(n,qr),tt(n,"style",h),tt(n,Tt,f||"")}function I(){var A=t.splides.map(function(_){var B=_.splide.Components.Slides.getAt(e);return B?B.slide.id:""}).join(" ");tt(n,Tt,Lr(m.slideX,($?r:e)+1)),tt(n,je,A),tt(n,Dt,g?"button":""),g&&Pt(n,Oe)}function V(){T||R()}function R(){if(!T){var A=t.index;F(),W(),jt(n,io,e===A-1),jt(n,ao,e===A+1)}}function F(){var A=G();A!==sn(n,le)&&(jt(n,le,A),tt(n,Qn,C&&A||""),i(A?Wn:zn,k))}function W(){var A=b(),_=!A&&(!G()||$);if(t.state.is([Se,Pe])||tt(n,to,_||""),tt(Wr(n,u.focusableNodes||""),fe,_?-1:""),g&&tt(n,fe,_?-1:0),A!==sn(n,Ar)&&(jt(n,Ar,A),i(A?Vn:Nn,k)),!A&&document.activeElement===n){var B=c.Slides.getAt(t.index);B&&kn(B.slide)}}function H(A,_,B){At(B&&M||n,A,_)}function G(){var A=t.index;return A===e||u.cloneStatus&&A===r}function b(){if(t.is(Me))return G();var A=_t(c.Elements.track),_=_t(n),B=S("left",!0),X=S("right",!0);return rr(A[B])<=Re(_[B])&&rr(_[X])<=Re(A[X])}function P(A,_){var B=$t(A-e);return!$&&(u.rewind||t.is(Ce))&&(B=Zt(B,t.length-B)),B<=_}var k={index:e,slideIndex:r,slide:n,container:M,isClone:$,mount:w,destroy:L,update:R,style:H,isWithin:P};return k}function Ri(t,e,r){var n=ht(t),o=n.on,a=n.emit,i=n.bind,s=e.Elements,c=s.slides,l=s.list,u=[];function C(){v(),o(vt,m),o(vt,v)}function v(){c.forEach(function(R,F){g(R,F,-1)})}function m(){T(function(R){R.destroy()}),Gt(u)}function p(){T(function(R){R.update()})}function g(R,F,W){var H=ki(t,F,W,R);H.mount(),u.push(H),u.sort(function(G,b){return G.index-b.index})}function S(R){return R?w(function(F){return!F.isClone}):u}function h(R){var F=e.Controller,W=F.toIndex(R),H=F.hasFocus()?1:r.perPage;return w(function(G){return Ze(G.index,W,W+H-1)})}function f(R){return w(R)[0]}function $(R,F){Lt(R,function(W){if(Jt(W)&&(W=Rn(W)),In(W)){var H=c[F];H?Br(W,H):ze(l,W),Ot(W,r.classes.slide),L(W,gt(a,be))}}),a(vt)}function M(R){ae(w(R).map(function(F){return F.slide})),a(vt)}function T(R,F){S(F).forEach(R)}function w(R){return u.filter(An(R)?R:function(F){return Jt(R)?Ae(F.slide,R):Pr(We(R),F.index)})}function y(R,F,W){T(function(H){H.style(R,F,W)})}function L(R,F){var W=Wr(R,"img"),H=W.length;H?W.forEach(function(G){i(G,"load error",function(){--H||F()})}):F()}function I(R){return R?c.length:u.length}function V(){return u.length>r.perPage}return{mount:C,destroy:m,update:p,register:g,get:S,getIn:h,getAt:f,add:$,remove:M,forEach:T,filter:w,style:y,getLength:I,isEnough:V}}function Oi(t,e,r){var n=ht(t),o=n.on,a=n.bind,i=n.emit,s=e.Slides,c=e.Direction.resolve,l=e.Elements,u=l.root,C=l.track,v=l.list,m=s.getAt,p=s.style,g,S,h;function f(){$(),a(window,"resize load",fi(gt(i,be))),o([Ct,vt],$),o(be,M)}function $(){g=r.direction===dr,At(u,"maxWidth",ne(r.width)),At(C,c("paddingLeft"),T(!1)),At(C,c("paddingRight"),T(!0)),M(!0)}function M(k){var A=_t(u);(k||S.width!==A.width||S.height!==A.height)&&(At(C,"height",w()),p(c("marginRight"),ne(r.gap)),p("width",L()),p("height",I(),!0),S=A,i(ar),h!==(h=P())&&(jt(u,so,h),i(gi,h)))}function T(k){var A=r.padding,_=c(k?"right":"left");return A&&ne(A[_]||(Ee(A)?0:A))||"0px"}function w(){var k="";return g&&(k=y(),Te(k,"height or heightRatio is missing."),k="calc("+k+" - "+T(!1)+" - "+T(!0)+")"),k}function y(){return ne(r.height||_t(v).width*r.heightRatio)}function L(){return r.autoWidth?null:ne(r.fixedWidth)||(g?"":V())}function I(){return ne(r.fixedHeight)||(g?r.autoHeight?null:V():y())}function V(){var k=ne(r.gap);return"calc((100%"+(k&&" + "+k)+")/"+(r.perPage||1)+(k&&" - "+k)+")"}function R(){return _t(v)[c("width")]}function F(k,A){var _=m(k||0);return _?_t(_.slide)[c("width")]+(A?0:G()):0}function W(k,A){var _=m(k);if(_){var B=_t(_.slide)[c("right")],X=_t(v)[c("left")];return $t(B-X)+(A?0:G())}return 0}function H(k){return W(t.length-1)-W(0)+F(0,k)}function G(){var k=m(0);return k&&parseFloat(At(k.slide,c("marginRight")))||0}function b(k){return parseFloat(At(C,c("padding"+(k?"Right":"Left"))))||0}function P(){return t.is(Me)||H(!0)>R()}return{mount:f,resize:M,listSize:R,slideSize:F,sliderSize:H,totalSize:W,getPadding:b,isOverflow:P}}var Pi=2;function Bi(t,e,r){var n=ht(t),o=n.on,a=e.Elements,i=e.Slides,s=e.Direction.resolve,c=[],l;function u(){o(vt,C),o([Ct,be],m),(l=S())&&(p(l),e.Layout.resize(!0))}function C(){v(),u()}function v(){ae(c),Gt(c),n.destroy()}function m(){var h=S();l!==h&&(l<h||!h)&&n.emit(vt)}function p(h){var f=i.get().slice(),$=f.length;if($){for(;f.length<h;)Je(f,f);Je(f.slice(-h),f.slice(0,h)).forEach(function(M,T){var w=T<h,y=g(M.slide,T);w?Br(y,f[0].slide):ze(a.list,y),Je(c,y),i.register(y,T-h+(w?0:$),M.index)})}}function g(h,f){var $=h.cloneNode(!0);return Ot($,r.classes.clone),$.id=t.root.id+"-clone"+Vr(f+1),$}function S(){var h=r.clones;if(!t.is(Ce))h=0;else if(Be(h)){var f=r[s("fixedWidth")]&&e.Layout.slideSize(0),$=f&&Re(_t(a.track)[s("width")]/f);h=$||r[s("autoWidth")]&&t.length||r.perPage*Pi}return h}return{mount:u,destroy:v}}function Wi(t,e,r){var n=ht(t),o=n.on,a=n.emit,i=t.state.set,s=e.Layout,c=s.slideSize,l=s.getPadding,u=s.totalSize,C=s.listSize,v=s.sliderSize,m=e.Direction,p=m.resolve,g=m.orient,S=e.Elements,h=S.list,f=S.track,$;function M(){$=e.Transition,o([te,ar,Ct,vt],T)}function T(){e.Controller.isBusy()||(e.Scroll.cancel(),y(t.index),e.Slides.update())}function w(_,B,X,ot){_!==B&&k(_>X)&&(R(),L(V(H(),_>X),!0)),i(Se),a(Ut,B,X,_),$.start(B,function(){i(ye),a(xe,B,X,_),ot&&ot()})}function y(_){L(W(_,!0))}function L(_,B){if(!t.is(Me)){var X=B?_:I(_);At(h,"transform","translate"+p("X")+"("+X+"px)"),_!==X&&a(Kn)}}function I(_){if(t.is(Ce)){var B=F(_),X=B>e.Controller.getEnd(),ot=B<0;(ot||X)&&(_=V(_,X))}return _}function V(_,B){var X=_-P(B),ot=v();return _-=g(ot*(Re($t(X)/ot)||1))*(B?1:-1),_}function R(){L(H(),!0),$.cancel()}function F(_){for(var B=e.Slides.get(),X=0,ot=1/0,rt=0;rt<B.length;rt++){var st=B[rt].index,O=$t(W(st,!0)-_);if(O<=ot)ot=O,X=st;else break}return X}function W(_,B){var X=g(u(_-1)-b(_));return B?G(X):X}function H(){var _=p("left");return _t(h)[_]-_t(f)[_]+g(l(!1))}function G(_){return r.trimSpace&&t.is(ve)&&(_=pe(_,0,g(v(!0)-C()))),_}function b(_){var B=r.focus;return B==="center"?(C()-c(_,!0))/2:+B*c(_)||0}function P(_){return W(_?e.Controller.getEnd():0,!!r.trimSpace)}function k(_){var B=g(V(H(),_));return _?B>=0:B<=h[p("scrollWidth")]-_t(f)[p("width")]}function A(_,B){B=Be(B)?H():B;var X=_!==!0&&g(B)<g(P(!1)),ot=_!==!1&&g(B)>g(P(!0));return X||ot}return{mount:M,move:w,jump:y,translate:L,shift:V,cancel:R,toIndex:F,toPosition:W,getPosition:H,getLimit:P,exceededLimit:A,reposition:T}}function zi(t,e,r){var n=ht(t),o=n.on,a=n.emit,i=e.Move,s=i.getPosition,c=i.getLimit,l=i.toPosition,u=e.Slides,C=u.isEnough,v=u.getLength,m=r.omitEnd,p=t.is(Ce),g=t.is(ve),S=gt(H,!1),h=gt(H,!0),f=r.start||0,$,M=f,T,w,y;function L(){I(),o([Ct,vt,nr],I),o(ar,V)}function I(){T=v(!0),w=r.perMove,y=r.perPage,$=k();var O=pe(f,0,m?$:T-1);O!==f&&(f=O,i.reposition())}function V(){$!==k()&&a(nr)}function R(O,K,mt){if(!st()){var ct=W(O),dt=P(ct);dt>-1&&(K||dt!==f)&&(X(dt),i.move(ct,dt,M,mt))}}function F(O,K,mt,ct){e.Scroll.scroll(O,K,mt,function(){var dt=P(i.toIndex(s()));X(m?Zt(dt,$):dt),ct&&ct()})}function W(O){var K=f;if(Jt(O)){var mt=O.match(/([+\-<>])(\d+)?/)||[],ct=mt[1],dt=mt[2];ct==="+"||ct==="-"?K=G(f+ +(""+ct+(+dt||1)),f):ct===">"?K=dt?A(+dt):S(!0):ct==="<"&&(K=h(!0))}else K=p?O:pe(O,0,$);return K}function H(O,K){var mt=w||(rt()?1:y),ct=G(f+mt*(O?-1:1),f,!(w||rt()));return ct===-1&&g&&!Pn(s(),c(!O),1)?O?0:$:K?ct:P(ct)}function G(O,K,mt){if(C()||rt()){var ct=b(O);ct!==O&&(K=O,O=ct,mt=!1),O<0||O>$?!w&&(Ze(0,O,K,!0)||Ze($,K,O,!0))?O=A(_(O)):p?O=mt?O<0?-(T%y||y):T:O:r.rewind?O=O<0?$:0:O=-1:mt&&O!==K&&(O=A(_(K)+(O<K?-1:1)))}else O=-1;return O}function b(O){if(g&&r.trimSpace==="move"&&O!==f)for(var K=s();K===l(O,!0)&&Ze(O,0,t.length-1,!r.rewind);)O<f?--O:++O;return O}function P(O){return p?(O+T)%T||0:O}function k(){for(var O=T-(rt()||p&&w?1:y);m&&O-- >0;)if(l(T-1,!0)!==l(O,!0)){O++;break}return pe(O,0,T-1)}function A(O){return pe(rt()?O:y*O,0,$)}function _(O){return rt()?Zt(O,$):rr((O>=$?T-1:O)/y)}function B(O){var K=i.toIndex(O);return g?pe(K,0,$):K}function X(O){O!==f&&(M=f,f=O)}function ot(O){return O?M:f}function rt(){return!Be(r.focus)||r.isNavigation}function st(){return t.state.is([Se,Pe])&&!!r.waitForTransition}return{mount:L,go:R,scroll:F,getNext:S,getPrev:h,getAdjacent:H,getEnd:k,setIndex:X,getIndex:ot,toIndex:A,toPage:_,toDest:B,hasFocus:rt,isBusy:st}}var Vi="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",Ge=40;function ji(t,e,r){var n=ht(t),o=n.on,a=n.bind,i=n.emit,s=r.classes,c=r.i18n,l=e.Elements,u=e.Controller,C=l.arrows,v=l.track,m=C,p=l.prev,g=l.next,S,h,f={};function $(){T(),o(Ct,M)}function M(){w(),$()}function T(){var F=r.arrows;F&&!(p&&g)&&I(),p&&g&&(Fe(f,{prev:p,next:g}),ke(m,F?"":"none"),Ot(m,h=Yr+"--"+r.direction),F&&(y(),R(),tt([p,g],je,v.id),i(Dn,p,g)))}function w(){n.destroy(),Mt(m,h),S?(ae(C?[p,g]:m),p=g=null):Pt([p,g],qr)}function y(){o([te,xe,vt,se,nr],R),a(g,"click",gt(L,">")),a(p,"click",gt(L,"<"))}function L(F){u.go(F,!0)}function I(){m=C||me("div",s.arrows),p=V(!0),g=V(!1),S=!0,ze(m,[p,g]),!C&&Br(m,v)}function V(F){var W='<button class="'+s.arrow+" "+(F?s.prev:s.next)+'" type="button"><svg xmlns="'+Vi+'" viewBox="0 0 '+Ge+" "+Ge+'" width="'+Ge+'" height="'+Ge+'" focusable="false"><path d="'+(r.arrowPath||Ni)+'" />';return Rn(W)}function R(){if(p&&g){var F=t.index,W=u.getPrev(),H=u.getNext(),G=W>-1&&F<W?c.last:c.prev,b=H>-1&&F>H?c.first:c.next;p.disabled=W<0,g.disabled=H<0,tt(p,Tt,G),tt(g,Tt,b),i(Gn,p,g,W,H)}}return{arrows:f,mount:$,destroy:w,update:R}}var Mi=zr+"-interval";function Hi(t,e,r){var n=ht(t),o=n.on,a=n.bind,i=n.emit,s=sr(r.interval,t.go.bind(t,">"),y),c=s.isPaused,l=e.Elements,u=e.Elements,C=u.root,v=u.toggle,m=r.autoplay,p,g,S=m==="pause";function h(){m&&(f(),v&&tt(v,je,l.track.id),S||$(),w())}function f(){r.pauseOnHover&&a(C,"mouseenter mouseleave",function(I){p=I.type==="mouseenter",T()}),r.pauseOnFocus&&a(C,"focusin focusout",function(I){g=I.type==="focusin",T()}),v&&a(v,"click",function(){S?$():M(!0)}),o([Ut,lr,vt],s.rewind),o(Ut,L)}function $(){c()&&e.Slides.isEnough()&&(s.start(!r.resetProgress),g=p=S=!1,w(),i(Hr))}function M(I){I===void 0&&(I=!0),S=!!I,w(),c()||(s.pause(),i(Dr))}function T(){S||(p||g?M(!1):$())}function w(){v&&(jt(v,le,!S),tt(v,Tt,r.i18n[S?"play":"pause"]))}function y(I){var V=l.bar;V&&At(V,"width",I*100+"%"),i(qn,I)}function L(I){var V=e.Slides.getAt(I);s.set(V&&+It(V.slide,Mi)||r.interval)}return{mount:h,destroy:s.cancel,play:$,pause:M,isPaused:c}}function Di(t,e,r){var n=ht(t),o=n.on;function a(){r.cover&&(o(Gr,gt(s,!0)),o([te,Ct,vt],gt(i,!0)))}function i(c){e.Slides.forEach(function(l){var u=Ve(l.container||l.slide,"img");u&&u.src&&s(c,u,l)})}function s(c,l,u){u.style("background",c?'center/cover no-repeat url("'+l.src+'")':"",!0),ke(l,c?"none":"")}return{mount:a,destroy:gt(i,!1)}}var Gi=10,Ui=600,Xi=.6,qi=1.5,Yi=800;function Ki(t,e,r){var n=ht(t),o=n.on,a=n.emit,i=t.state.set,s=e.Move,c=s.getPosition,l=s.getLimit,u=s.exceededLimit,C=s.translate,v=t.is(ve),m,p,g=1;function S(){o(Ut,M),o([Ct,vt],T)}function h(y,L,I,V,R){var F=c();if(M(),I&&(!v||!u())){var W=e.Layout.sliderSize(),H=Tr(y)*W*rr($t(y)/W)||0;y=s.toPosition(e.Controller.toDest(y%W))+H}var G=Pn(F,y,1);g=1,L=G?0:L||er($t(y-F)/qi,Yi),p=V,m=sr(L,f,gt($,F,y,R),1),i(Pe),a(lr),m.start()}function f(){i(ye),p&&p(),a(se)}function $(y,L,I,V){var R=c(),F=y+(L-y)*w(V),W=(F-R)*g;C(R+W),v&&!I&&u()&&(g*=Xi,$t(W)<Gi&&h(l(u(!0)),Ui,!1,p,!0))}function M(){m&&m.cancel()}function T(){m&&!m.isPaused()&&(M(),f())}function w(y){var L=r.easingFunc;return L?L(y):1-Math.pow(1-y,4)}return{mount:S,destroy:M,scroll:h,cancel:T}}var de={passive:!1,capture:!0};function Ji(t,e,r){var n=ht(t),o=n.on,a=n.emit,i=n.bind,s=n.unbind,c=t.state,l=e.Move,u=e.Scroll,C=e.Controller,v=e.Elements.track,m=e.Media.reduce,p=e.Direction,g=p.resolve,S=p.orient,h=l.getPosition,f=l.exceededLimit,$,M,T,w,y,L=!1,I,V,R;function F(){i(v,Sr,wr,de),i(v,xr,wr,de),i(v,co,H,de),i(v,"click",P,{capture:!0}),i(v,"dragstart",Nt),o([te,Ct],W)}function W(){var j=r.drag;kt(!j),w=j==="free"}function H(j){if(I=!1,!V){var x=dt(j);ct(j.target)&&(x||!j.button)&&(C.isBusy()?Nt(j,!0):(R=x?v:window,y=c.is([Se,Pe]),T=null,i(R,Sr,G,de),i(R,xr,b,de),l.cancel(),u.cancel(),k(j)))}}function G(j){if(c.is(Ke)||(c.set(Ke),a(jn)),j.cancelable)if(y){l.translate($+mt(rt(j)));var x=st(j)>hn,D=L!==(L=f());(x||D)&&k(j),I=!0,a(Mn),Nt(j)}else B(j)&&(y=_(j),Nt(j))}function b(j){c.is(Ke)&&(c.set(ye),a(Hn)),y&&(A(j),Nt(j)),s(R,Sr,G),s(R,xr,b),y=!1}function P(j){!V&&I&&Nt(j,!0)}function k(j){T=M,M=j,$=h()}function A(j){var x=X(j),D=ot(x),q=r.rewind&&r.rewindByDrag;m(!1),w?C.scroll(D,0,r.snap):t.is(Me)?C.go(S(Tr(x))<0?q?"<":"-":q?">":"+"):t.is(ve)&&L&&q?C.go(f(!0)?">":"<"):C.go(C.toDest(D),!0),m(!0)}function _(j){var x=r.dragMinThreshold,D=Ee(x),q=D&&x.mouse||0,J=(D?x.touch:+x)||10;return $t(rt(j))>(dt(j)?J:q)}function B(j){return $t(rt(j))>$t(rt(j,!0))}function X(j){if(t.is(Ce)||!L){var x=st(j);if(x&&x<hn)return rt(j)/x}return 0}function ot(j){return h()+Tr(j)*Zt($t(j)*(r.flickPower||600),w?1/0:e.Layout.listSize()*(r.flickMaxPages||1))}function rt(j,x){return K(j,x)-K(O(j),x)}function st(j){return _r(j)-_r(O(j))}function O(j){return M===j&&T||M}function K(j,x){return(dt(j)?j.changedTouches[0]:j)["page"+g(x?"Y":"X")]}function mt(j){return j/(L&&t.is(ve)?Ii:1)}function ct(j){var x=r.noDrag;return!Ae(j,"."+oo+", ."+mr)&&(!x||!Ae(j,x))}function dt(j){return typeof TouchEvent<"u"&&j instanceof TouchEvent}function xt(){return y}function kt(j){V=j}return{mount:F,disable:kt,isDragging:xt}}var Zi={Spacebar:" ",Right:pr,Left:ur,Up:Jn,Down:Zn};function Kr(t){return t=Jt(t)?t:t.key,Zi[t]||t}var yn="keydown";function Qi(t,e,r){var n=ht(t),o=n.on,a=n.bind,i=n.unbind,s=t.root,c=e.Direction.resolve,l,u;function C(){v(),o(Ct,m),o(Ct,v),o(Ut,g)}function v(){var h=r.keyboard;h&&(l=h==="global"?window:s,a(l,yn,S))}function m(){i(l,yn)}function p(h){u=h}function g(){var h=u;u=!0,En(function(){u=h})}function S(h){if(!u){var f=Kr(h);f===c(ur)?t.go("<"):f===c(pr)&&t.go(">")}}return{mount:C,destroy:m,disable:p}}var Le=zr+"-lazy",Qe=Le+"-srcset",ta="["+Le+"], ["+Qe+"]";function ea(t,e,r){var n=ht(t),o=n.on,a=n.off,i=n.bind,s=n.emit,c=r.lazyLoad==="sequential",l=[xe,se],u=[];function C(){r.lazyLoad&&(v(),o(vt,v))}function v(){Gt(u),m(),c?h():(a(l),o(l,p),p())}function m(){e.Slides.forEach(function(f){Wr(f.slide,ta).forEach(function($){var M=It($,Le),T=It($,Qe);if(M!==$.src||T!==$.srcset){var w=r.classes.spinner,y=$.parentElement,L=Ve(y,"."+w)||me("span",w,y);u.push([$,f,L]),$.src||ke($,"none")}})})}function p(){u=u.filter(function(f){var $=r.perPage*((r.preloadPages||1)+1)-1;return f[1].isWithin(t.index,$)?g(f):!0}),u.length||a(l)}function g(f){var $=f[0];Ot(f[1].slide,Ir),i($,"load error",gt(S,f)),tt($,"src",It($,Le)),tt($,"srcset",It($,Qe)),Pt($,Le),Pt($,Qe)}function S(f,$){var M=f[0],T=f[1];Mt(T.slide,Ir),$.type!=="error"&&(ae(f[2]),ke(M,""),s(Gr,M,T),s(be)),c&&h()}function h(){u.length&&g(u.shift())}return{mount:C,destroy:gt(Gt,u),check:p}}function ra(t,e,r){var n=ht(t),o=n.on,a=n.emit,i=n.bind,s=e.Slides,c=e.Elements,l=e.Controller,u=l.hasFocus,C=l.getIndex,v=l.go,m=e.Direction.resolve,p=c.pagination,g=[],S,h;function f(){$(),o([Ct,vt,nr],f);var V=r.pagination;p&&ke(p,V?"":"none"),V&&(o([Ut,lr,se],I),M(),I(),a(Un,{list:S,items:g},L(t.index)))}function $(){S&&(ae(p?Qt(S.children):S),Mt(S,h),Gt(g),S=null),n.destroy()}function M(){var V=t.length,R=r.classes,F=r.i18n,W=r.perPage,H=u()?l.getEnd()+1:Re(V/W);S=p||me("ul",R.pagination,c.track.parentElement),Ot(S,h=fr+"--"+y()),tt(S,Dt,"tablist"),tt(S,Tt,F.select),tt(S,Xr,y()===dr?"vertical":"");for(var G=0;G<H;G++){var b=me("li",null,S),P=me("button",{class:R.page,type:"button"},b),k=s.getIn(G).map(function(_){return _.slide.id}),A=!u()&&W>1?F.pageX:F.slideX;i(P,"click",gt(T,G)),r.paginationKeyboard&&i(P,"keydown",gt(w,G)),tt(b,Dt,"presentation"),tt(P,Dt,"tab"),tt(P,je,k.join(" ")),tt(P,Tt,Lr(A,G+1)),tt(P,fe,-1),g.push({li:b,button:P,page:G})}}function T(V){v(">"+V,!0)}function w(V,R){var F=g.length,W=Kr(R),H=y(),G=-1;W===m(pr,!1,H)?G=++V%F:W===m(ur,!1,H)?G=(--V+F)%F:W==="Home"?G=0:W==="End"&&(G=F-1);var b=g[G];b&&(kn(b.button),v(">"+G),Nt(R,!0))}function y(){return r.paginationDirection||r.direction}function L(V){return g[l.toPage(V)]}function I(){var V=L(C(!0)),R=L(C());if(V){var F=V.button;Mt(F,le),Pt(F,pn),tt(F,fe,-1)}if(R){var W=R.button;Ot(W,le),tt(W,pn,!0),tt(W,fe,"")}a(Xn,{list:S,items:g},V,R)}return{items:g,mount:f,destroy:$,getAt:L,update:I}}var na=[" ","Enter"];function oa(t,e,r){var n=r.isNavigation,o=r.slideFocus,a=[];function i(){t.splides.forEach(function(p){p.isParent||(l(t,p.splide),l(p.splide,t))}),n&&u()}function s(){a.forEach(function(p){p.destroy()}),Gt(a)}function c(){s(),i()}function l(p,g){var S=ht(p);S.on(Ut,function(h,f,$){g.go(g.is(Ce)?$:h)}),a.push(S)}function u(){var p=ht(t),g=p.on;g(Nr,v),g(Yn,m),g([te,Ct],C),a.push(p),p.emit(Mr,t.splides)}function C(){tt(e.Elements.list,Xr,r.direction===dr?"vertical":"")}function v(p){t.go(p.index)}function m(p,g){Pr(na,Kr(g))&&(v(p),Nt(g))}return{setup:gt(e.Media.set,{slideFocus:Be(o)?n:o},!0),mount:i,destroy:s,remount:c}}function ia(t,e,r){var n=ht(t),o=n.bind,a=0;function i(){r.wheel&&o(e.Elements.track,"wheel",s,de)}function s(l){if(l.cancelable){var u=l.deltaY,C=u<0,v=_r(l),m=r.wheelMinThreshold||0,p=r.wheelSleep||0;$t(u)>m&&v-a>p&&(t.go(C?"<":">"),a=v),c(C)&&Nt(l)}}function c(l){return!r.releaseWheel||t.state.is(Se)||e.Controller.getAdjacent(l)!==-1}return{mount:i}}var aa=90;function la(t,e,r){var n=ht(t),o=n.on,a=e.Elements.track,i=r.live&&!r.isNavigation,s=me("span",_i),c=sr(aa,gt(u,!1));function l(){i&&(v(!e.Autoplay.isPaused()),tt(a,mn,!0),s.textContent="…",o(Hr,gt(v,!0)),o(Dr,gt(v,!1)),o([xe,se],gt(u,!0)))}function u(m){tt(a,gn,m),m?(ze(a,s),c.start()):(ae(s),c.cancel())}function C(){Pt(a,[dn,mn,gn]),ae(s)}function v(m){i&&tt(a,dn,m?"off":"polite")}return{mount:l,disable:v,destroy:C}}var sa=Object.freeze({__proto__:null,Media:hi,Direction:yi,Elements:Fi,Slides:Ri,Layout:Oi,Clones:Bi,Move:Wi,Controller:zi,Arrows:ji,Autoplay:Hi,Cover:Di,Scroll:Ki,Drag:Ji,Keyboard:Qi,LazyLoad:ea,Pagination:ra,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,r){var n=e.Slides;function o(){ht(t).on([te,vt],a)}function a(){n.forEach(function(s){s.style("transform","translateX(-"+100*s.index+"%)")})}function i(s,c){n.style("transition","opacity "+r.speed+"ms "+r.easing),En(c)}return{mount:o,start:i,cancel:wr}}function da(t,e,r){var n=e.Move,o=e.Controller,a=e.Scroll,i=e.Elements.list,s=gt(At,i,"transition"),c;function l(){ht(t).bind(i,"transitionend",function(m){m.target===i&&c&&(C(),c())})}function u(m,p){var g=n.toPosition(m,!0),S=n.getPosition(),h=v(m);$t(g-S)>=1&&h>=1?r.useScroll?a.scroll(g,h,!1,p):(s("transform "+h+"ms "+r.easing),n.translate(g,!0),c=p):(n.jump(m),p())}function C(){s(""),a.cancel()}function v(m){var p=r.rewindSpeed;if(t.is(ve)&&p){var g=o.getIndex(!0),S=o.getEnd();if(g===0&&m>=S||g>=S&&m===0)return p}return r.speed}return{mount:l,start:u,cancel:C}}var ga=(function(){function t(r,n){this.event=ht(),this.Components={},this.state=mi(ge),this.splides=[],this._o={},this._E={};var o=Jt(r)?On(document,r):r;Te(o,o+" is invalid."),this.root=o,n=Yt({label:It(o,Tt)||"",labelledby:It(o,Ur)||""},ua,t.defaults,n||{});try{Yt(n,JSON.parse(It(o,zr)))}catch{Te(!1,"Invalid JSON")}this._o=Object.create(Yt({},n))}var e=t.prototype;return e.mount=function(n,o){var a=this,i=this.state,s=this.Components;Te(i.is([ge,tr]),"Already mounted!"),i.set(ge),this._C=s,this._T=o||this._T||(this.is(Me)?pa:da),this._E=n||this._E;var c=Fe({},sa,this._E,{Transition:this._T});return ie(c,function(l,u){var C=l(a,s,a._o);s[u]=C,C.setup&&C.setup()}),ie(s,function(l){l.mount&&l.mount()}),this.emit(te),Ot(this.root,Ti),i.set(ye),this.emit(Er),this},e.sync=function(n){return this.splides.push({splide:n}),n.splides.push({splide:this,isParent:!0}),this.state.is(ye)&&(this._C.Sync.remount(),n.Components.Sync.remount()),this},e.go=function(n){return this._C.Controller.go(n),this},e.on=function(n,o){return this.event.on(n,o),this},e.off=function(n){return this.event.off(n),this},e.emit=function(n){var o;return(o=this.event).emit.apply(o,[n].concat(Qt(arguments,1))),this},e.add=function(n,o){return this._C.Slides.add(n,o),this},e.remove=function(n){return this._C.Slides.remove(n),this},e.is=function(n){return this._o.type===n},e.refresh=function(){return this.emit(vt),this},e.destroy=function(n){n===void 0&&(n=!0);var o=this.event,a=this.state;return a.is(ge)?ht(this).on(Er,this.destroy.bind(this,n)):(ie(this._C,function(i){i.destroy&&i.destroy(n)},!0),o.emit(jr),o.destroy(),n&&Gt(this.splides),a.set(tr)),this},ci(t,[{key:"options",get:function(){return this._o},set:function(n){this._C.Media.set(n,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),t})(),Jr=ga;Jr.defaults={};Jr.STATES=pi;var bn=[[te,"onMounted"],[Er,"onReady"],[Ut,"onMove"],[xe,"onMoved"],[Nr,"onClick"],[Wn,"onActive"],[zn,"onInactive"],[Vn,"onVisible"],[Nn,"onHidden"],[vt,"onRefresh"],[Ct,"onUpdated"],[be,"onResize"],[ar,"onResized"],[jn,"onDrag"],[Mn,"onDragging"],[Hn,"onDragged"],[lr,"onScroll"],[se,"onScrolled"],[jr,"onDestroy"],[Dn,"onArrowsMounted"],[Gn,"onArrowsUpdated"],[Un,"onPaginationMounted"],[Xn,"onPaginationUpdated"],[Mr,"onNavigationMounted"],[Hr,"onAutoplayPlay"],[qn,"onAutoplayPlaying"],[Dr,"onAutoplayPause"],[Gr,"onLazyLoadLoaded"]];function Zr(...t){return t.filter(Boolean).join(" ")}function or(t){return t!==null&&typeof t=="object"}function Fr(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&!t.some((r,n)=>!Fr(r,e[n]));if(or(t)&&or(e)){const r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&!r.some(o=>!Object.prototype.hasOwnProperty.call(e,o)||!Fr(t[o],e[o]))}return t===e}function ma(t,e){return t.length===e.length&&!t.some((r,n)=>r!==e[n])}function fa(t,e){if(t){const r=Object.keys(t);for(let n=0;n<r.length;n++){const o=r[n];if(o!=="__proto__"&&e(t[o],o)===!1)break}}return t}function kr(t,e){const r=t;return fa(e,(n,o)=>{Array.isArray(n)?r[o]=n.slice():or(n)?r[o]=kr(or(r[o])?r[o]:{},n):r[o]=n}),r}var ha=({children:t,className:e,...r})=>z.createElement("div",{className:Zr("splide__track",e),...r},z.createElement("ul",{className:"splide__list"},t)),Qr=class extends z.Component{constructor(){super(...arguments),this.splideRef=z.createRef(),this.slides=[]}componentDidMount(){const{options:t,extensions:e,transition:r}=this.props,{current:n}=this.splideRef;n&&(this.splide=new Jr(n,t),this.bind(this.splide),this.splide.mount(e,r),this.options=kr({},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&&!Fr(this.options,t)&&(this.splide.options=t,this.options=kr({},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){bn.forEach(([e,r])=>{const n=this.props[r];typeof n=="function"&&t.on(e,(...o)=>{n(t,...o)})})}omit(t,e){return e.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&delete t[r]}),t}render(){const{className:t,tag:e="div",hasTrack:r=!0,children:n,...o}=this.props;return z.createElement(e,{className:Zr("splide",t),ref:this.splideRef,...this.omit(o,["options",...bn.map(a=>a[1])])},r?z.createElement(ha,null,n):n)}},tn=({children:t,className:e,...r})=>z.createElement("li",{className:Zr("splide__slide",e),...r},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=r=>r.map((n,o)=>n.type==="link"?d.jsx("a",{className:ba.link,href:n.value,target:n.target,children:e(n.children)},o):d.jsx("span",{style:va(n),children:n.text},o));return d.jsx(d.Fragment,{children:t.map((r,n)=>{const o=r.children;return d.jsx("div",{children:e(o)},n)})})};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-",vn={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,'\\"')}")`,he=({url:t,fill:e="#000000",hoverFill:r="#CCCCCC",className:n="",style:o})=>{const[a,i]=z.useState(()=>typeof window>"u"?!0:CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")'));return z.useEffect(()=>{if(typeof window<"u"&&window.CSS){const s=CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")');i(s)}},[]),!Ca(t)||!a?d.jsx("img",{src:t,alt:"",className:ft(vn.img,n),style:o}):d.jsx("span",{"data-supports-mask":a,className:ft(vn.svg,n),style:{"--svg":$a(t),"--fill":e,"--hover-fill":r,...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:r,isEditor:n}){const[o,a]=z.useState(null),{widthSettings:i,fontSettings:s,letterSpacing:c,textAlign:l,wordSpacing:u,fontSizeLineHeight:C,textAppearance:v,color:m}=r.imageCaption,[p,g]=z.useState(void 0),[S,h]=z.useState(null),[f,$]=z.useState(0),[M,T]=z.useState(0),{direction:w,transition:y,controls:L,pagination:I,imageCaption:V,triggers:R}=t,F=z.useRef(y.type),{x:W,y:H}=t.controls.offset,G=b=>{o&&o.go(b)};return z.useEffect(()=>{if(!S)return;const b=new ResizeObserver(P=>{if(!o)return;const[k]=P;g({width:Math.round(k.contentRect.width),height:Math.round(k.contentRect.height)})});return b.observe(S),()=>b.unobserve(S)},[S]),z.useEffect(()=>{!o||F.current===y.type||(T(b=>b+1),F.current=y.type)},[y.type]),d.jsx("div",{className:ft(U.wrapper,{[U.editor]:n}),ref:h,children:d.jsxs("div",{className:U.sliderInner,style:{width:p?p.width:"100%",height:p?p.height:"100%",backgroundColor:y.backgroundColor&&y.type==="fade in"?y.backgroundColor:"transparent"},children:[t.imageCaption.isActive&&d.jsx("div",{className:ft(U.captionBlock),children:d.jsx("div",{className:U.captionTextWrapper,children:e.map((b,P)=>d.jsx("div",{className:ft(U.captionText,wa[V.alignment],{[U.withPointerEvents]:P===f&&n,[U.active]:P===f}),style:{fontFamily:s.fontFamily,fontWeight:s.fontWeight,fontStyle:s.fontStyle,width:i.sizing==="auto"?"max-content":E.scalingValue(i.width,n),letterSpacing:E.scalingValue(c,n),wordSpacing:E.scalingValue(u,n),textAlign:l,fontSize:E.scalingValue(C.fontSize,n),lineHeight:E.scalingValue(C.lineHeight,n),textTransform:v.textTransform??"none",textDecoration:v.textDecoration??"none",fontVariant:v.fontVariant??"normal",color:m,transitionDuration:y.duration?`${Math.round(parseInt(y.duration)/2)}ms`:"500ms"},children:d.jsx("div",{"data-styles":"imageCaption",className:U.captionTextInner,style:{"--link-hover-color":V.linkHoverColor,"--link-color":V.linkColor,position:"relative",top:E.scalingValue(V.offset.y,n),left:E.scalingValue(V.offset.x,n)},children:d.jsx(uo,{content:b.imageCaption})})},P))})}),d.jsx(Qr,{onMove:b=>{$(b.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:p?p.width:"100%",height:p?p.height:"100%",type:y.type==="fade in"?"fade":"loop",rewind:!0},children:e.map((b,P)=>d.jsx(tn,{children:d.jsx("div",{className:U.sliderItem,children:d.jsx("div",{className:U.imgWrapper,children:d.jsx("img",{className:ft(U.sliderImage,{[U.contain]:b.image.objectFit==="contain",[U.cover]:b.image.objectFit==="cover"}),src:b.image.url,alt:b.image.name??""})})})},P))},M),L.isActive&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:ft(U.arrow,{[U.arrowVertical]:w==="vert",[U.hoverArrow]:L.show==="on hover"}),style:{color:L.color,"--arrow-hover-color":L.hover},children:d.jsxs("button",{onClick:()=>{G("-1")},className:U.arrowInner,style:{transform:`translate(${E.scalingValue(W,n)}, ${E.scalingValue(H*(w==="horiz"?1:-1),n)}) scale(${t.controls.scale/100}) rotate(${w==="horiz"?"0deg":"90deg"})`},children:[L.arrowsImgUrl&&d.jsx(he,{url:L.arrowsImgUrl,fill:L.color,hoverFill:L.hover,className:ft(U.arrowImg,U.mirror)}),!L.arrowsImgUrl&&d.jsx(Sn,{color:L.color,className:ft(U.arrowIcon,U.arrowImg,U.mirror)})]})}),d.jsx("div",{className:ft(U.arrow,U.nextArrow,{[U.arrowVertical]:w==="vert",[U.hoverArrow]:L.show==="on hover"}),style:{color:L.color,"--arrow-hover-color":L.hover},children:d.jsxs("button",{className:U.arrowInner,onClick:()=>G("+1"),style:{transform:`translate(${E.scalingValue(W*(w==="horiz"?-1:1),n)}, ${E.scalingValue(H,n)}) scale(${t.controls.scale/100}) rotate(${w==="horiz"?"0deg":"90deg"})`},children:[L.arrowsImgUrl&&d.jsx(he,{url:L.arrowsImgUrl,fill:L.color,hoverFill:L.hover,className:U.arrowImg}),!L.arrowsImgUrl&&d.jsx(Sn,{color:L.color,className:ft(U.arrowIcon,U.arrowImg)})]})})]}),R.triggersList.click&&d.jsx("div",{className:U.clickOverlay,onClick:()=>{o&&o.go("+1")}}),I.isActive&&d.jsx("div",{className:ft(U.pagination,{[U.paginationInsideBottom]:I.position==="inside-1"&&w==="horiz",[U.paginationInsideTop]:I.position==="inside-2"&&w==="horiz",[U.paginationOutsideBottom]:I.position==="outside-1"&&w==="horiz",[U.paginationOutsideTop]:I.position==="outside-2"&&w==="horiz",[U.paginationInsideLeft]:I.position==="inside-1"&&w==="vert",[U.paginationInsideRight]:I.position==="inside-2"&&w==="vert",[U.paginationOutsideLeft]:I.position==="outside-1"&&w==="vert",[U.paginationOutsideRight]:I.position==="outside-2"&&w==="vert",[U.paginationVertical]:w==="vert"}),children:d.jsx("div",{className:U.paginationInner,style:{backgroundColor:I.colors[2],transform:`scale(${I.scale/100}) translate(${E.scalingValue(I.offset.x,n)}, ${E.scalingValue(I.offset.y,n)}) rotate(${w==="horiz"?"0deg":"90deg"})`},children:e.map((b,P)=>d.jsx("button",{onClick:()=>{o&&o.go(P)},className:ft(U.paginationItem),children:d.jsx("div",{className:ft(U.dot,{[U.activeDot]:P===f}),style:{backgroundColor:P===f?I.colors[0]:I.colors[1],"--pagination-hover-color":I.hover}})},P))})})]})})}function Sn({color:t,className:e}){return d.jsx("svg",{viewBox:"0 0 10 18",className:e,children:d.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:d.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",ue={imageRevealSlider:La,image:Ea,link:Aa,cursor:Ia};function xn(t,e,r){for(const n of r){const o=new Image;o.src=n.url;const a=n.width?Number.parseFloat(n.width):o.naturalWidth,i=o.naturalHeight/o.naturalWidth*a,s=a/2,c=i/2;if(t>=n.x-s&&t<=n.x+s&&e>=n.y-c&&e<=n.y+c)return!0}return!1}function Cr(t){return new Promise(e=>{const r=new Image;r.src=t,r.onload=()=>{e({width:r.naturalWidth,height:r.naturalHeight})}})}async function Fa(t,e,r,n){let o,a;if(e==="custom"){o=r;const i=await Cr(t);a=i.height/i.width*o}else if(e==="random"){o=Math.random()*(n.max-n.min)+n.min;const i=await Cr(t);a=i.height/i.width*o}else{const i=await Cr(t);o=i.width,a=i.height}return{width:o,height:a,finalWidth:`${o}px`}}function ka({settings:t,content:e,isEditor:r}){const[n,o]=z.useState(null),[a,i]=z.useState([]),[s,c]=z.useState(0),l=z.useRef(0),[u,C]=z.useState({x:0,y:0}),[v,m]=z.useState(1),[p,g]=z.useState("none"),S=z.useRef({x:0,y:0}),[h,f]=z.useState(!1),{sizeType:$,imageWidth:M,randomRangeImageWidth:T}=t.imageSize,{revealPosition:w,visible:y}=t.position,{cursorType:L,target:I,defaultCursorScale:V,defaultCursor:R,hoverCursorScale:F,hoverCursor:W}=t.cursor;z.useEffect(()=>{if(!n)return;const b=(A,_)=>{const B=n.getBoundingClientRect(),X=A-B.left,ot=_-B.top;if(C({x:X,y:ot}),L==="system"){g("none"),m(1);return}const rt=X,st=ot,O=document.elementFromPoint(B.left+rt,B.top+st);if(O&&O.closest("a")){g("none"),m(1);return}const K=xn(rt,st,a)||I==="area"?{img:W??"none",scale:F}:{img:R??"none",scale:V};g(K.img),m(K.scale)},P=A=>{A.stopPropagation(),S.current={x:A.clientX,y:A.clientY},b(A.clientX,A.clientY)},k=()=>{h&&b(S.current.x,S.current.y)};return n.addEventListener("mousemove",P),window.addEventListener("scroll",k,!0),()=>{n.removeEventListener("mousemove",P),window.removeEventListener("scroll",k,!0)}},[n,h,u,L,I,W,R,F,V,a]),z.useEffect(()=>{h||(g("none"),m(0))},[h]);const H=async(b,P,k,A={})=>{const{width:_,height:B,finalWidth:X}=await Fa(b.image.url,$,M,T);let ot=0,rt=0;w==="same"?(ot=P/2,rt=k/2):(ot=A.x??Math.random()*P,rt=A.y??Math.random()*k);const st=Math.min(Math.max(ot,_/2),P-_/2),O=Math.min(Math.max(rt,B/2),k-B/2);return{id:l.current++,url:b.image.url,link:b.link,name:b.image.name,x:st,y:O,width:X}};z.useEffect(()=>{if(!n||e.length===0)return;const b=n.getBoundingClientRect(),P=b.width,k=b.height,A=[];(async()=>{const B=e[0],X=await H(B,P,k);A.push(X),i(A),c(1)})()},[$,M,T,w,n]),z.useEffect(()=>{y==="last One"&&i(b=>b.length>0?[b[b.length-1]]:[])},[y]);const G=async b=>{if(!n)return;const P=n.getBoundingClientRect(),k=b.clientX-P.left,A=b.clientY-P.top;if(I==="image"&&!xn(k,A,a))return;let _=0,B=0;w==="on Click"?(_=k,B=A):w==="same"?(_=P.width/2,B=P.height/2):(_=Math.random()*P.width,B=Math.random()*P.height);const X=e[s],ot=await H(X,P.width,P.height,{x:_,y:B});i(rt=>y==="all"?[...rt,ot]:[ot]),c(rt=>rt>=e.length-1?0:rt+1)};return d.jsxs("div",{ref:o,onClick:G,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),className:ue.imageRevealSlider,style:{cursor:p==="none"?"default":"none"},children:[a.map(b=>d.jsx("div",{className:ue.wrapper,style:{top:`${b.y}px`,left:`${b.x}px`,position:"absolute",transform:"translate(-50%, -50%)",width:b.width??"auto",height:"auto",cursor:p==="none"?"default":"none"},children:I==="area"&&b.link?d.jsx("a",{href:b.link,target:"_blank",className:ue.link,children:d.jsx("img",{src:b.url,alt:b.name,className:ue.image},b.id)}):d.jsx("img",{src:b.url,alt:b.name,className:ue.image},b.id)},b.id)),h&&d.jsx("div",{className:ue.cursor,style:{left:`${u.x}px`,top:`${u.y}px`,transform:`translate(-50%, -50%) scale(${v})`,backgroundImage:`url('${p}')`,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",za="LightBox-module__contentStyle___Bgnsq",Va="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",rl="LightBox-module__thumbsAlignStart___MO6tY",nl="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:za,imageStyle:Va,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:rl,thumbsAlignCenter:nl,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},Ue=(t,e,r)=>{const n={},[o,a]=t.split("-");return o==="top"?(n.top="0",n.bottom="auto"):o==="middle"?(n.top="50%",n.bottom="auto"):o==="bottom"&&(n.top="auto",n.bottom="0"),a==="left"?(n.left="0",n.right="auto"):a==="center"?(n.left="50%",n.right="auto"):a==="right"&&(n.left="auto",n.right="0"),o==="middle"&&a==="center"?n.transform=`translate(calc(-50% + ${E.scalingValue(e.x,r)}), calc(-50% + ${E.scalingValue(e.y,r)}))`:o==="middle"?n.transform=`translate(${E.scalingValue(e.x,r)}, calc(-50% + ${E.scalingValue(e.y,r)}))`:a==="center"?n.transform=`translate(calc(-50% + ${E.scalingValue(e.x,r)}), ${E.scalingValue(e.y,r)})`:n.transform=`translate(${E.scalingValue(e.x,r)}, ${E.scalingValue(e.y,r)})`,n};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 Cn(t){const e=t.getBoundingClientRect(),r=po(t),n=Math.max(0,e.width-r.left-r.right),o=Math.max(0,e.height-r.top-r.bottom),a=t.naturalWidth,i=t.naturalHeight,s=n/o,c=a/i;let l,u;c>s?(l=n,u=n/c):(u=o,l=o*c);const C=e.left+r.left,v=e.top+r.top,m=(n-l)/2+C,p=(o-u)/2+v;return{x:m,y:p,width:l,height:u}}function $n(t){const e=t.getBoundingClientRect(),r=po(t);return{left:e.left+r.left,right:e.right-r.right,top:e.top+r.top,bottom:e.bottom-r.bottom}}function wn(t){const e=t.match(/rgba?\(([^)]+)\)/);if(e){const n=e[1].split(",").map(o=>parseFloat(o.trim()));return n.length===4?n[3]:1}const r=t.match(/^#([0-9a-fA-F]{8})$/);if(r){const n=r[1].substring(6,8);return parseInt(n,16)/255}return t.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/),1}function bl(t,e){const r=(()=>{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})(),n=(()=>{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:r,backdropAppearClass:n,backdropDisappearClass:o,disappearClass:a}}const vl=({settings:t,content:e,styles:r,portalId:n,activeEvent:o,isEditor:a})=>{const[i,s]=z.useState(!1),{url:c}=t.thumbnailBlock.cover;return z.useEffect(()=>{o==="close"&&s(!1),o==="open"&&s(!0)},[o]),d.jsxs(d.Fragment,{children:[d.jsx("img",{src:c,alt:"Cover",className:N.heroImage,onClick:()=>s(!0)}),d.jsx(Sl,{isOpen:i,onClose:()=>s(!1),content:e,settings:t,lightboxStyles:r,portalId:n,isEditor:a})]})},Sl=({isOpen:t,onClose:e,content:r,lightboxStyles:n,settings:o,portalId:a,isEditor:i,metadata:s})=>{var j;const[c,l]=z.useState(0),[u,C]=z.useState(0),[v,m]=z.useState(!1),[p,g]=z.useState(!1),[S,h]=z.useState({}),f=z.useRef(null),$=z.useRef(null),M=z.useRef(null),T=z.useRef(!1),w=z.useRef(null),y=z.useRef(null),L=z.useRef(null),I=z.useRef(null),V=z.useRef(!1),R=z.useRef(null),[F,W]=z.useState(!1),{appear:H,triggers:G,slider:b,thumbnail:P,controls:k,area:A,caption:_,layout:B}=o.lightboxBlock,{appearClass:X,backdropAppearClass:ot,backdropDisappearClass:rt,disappearClass:st}=bl(H.type,H.direction),O=(s==null?void 0:s.itemId)??null;z.useEffect(()=>{const x=()=>{setTimeout(()=>{var q,J;(J=(q=f.current)==null?void 0:q.splide)==null||J.refresh()},16)},D=()=>{C(q=>q+1)};return window.addEventListener("ArticleEditor.Layout:change",x),window.addEventListener("ArticleEditor.ComponentContent:change",D),()=>{window.removeEventListener("ArticleEditor.Layout:change",x),window.removeEventListener("ArticleEditor.ComponentContent:change",D)}},[]),z.useEffect(()=>{if(!t||!P.isActive){W(!1);return}const x=R.current;if(!x)return;const D=()=>{b.direction==="horiz"?W(x.scrollWidth>x.clientWidth):W(x.scrollHeight>x.clientHeight)};D();const q=new ResizeObserver(D);return q.observe(x),()=>q.disconnect()},[t,P.isActive,r.length,S,b.direction]);const K=z.useCallback(()=>{const x=window.matchMedia("(max-width: 768px)").matches,D=wn(A.color);x&&!i&&D>.9&&(document.body.style.backgroundColor=""),m(!0),T.current=!0;const q=J=>{J.target===w.current&&J.animationName&&(w.current&&y.current&&w.current.removeEventListener("animationend",y.current),y.current=null,T.current&&(T.current=!1,e()),m(!1))};w.current&&(y.current=q,w.current.addEventListener("animationend",q))},[e,A.color,i]),mt=(x,D,q)=>{var J,et;if(x){if(G.type==="click"&&G.switch==="image")G.repeat==="close"&&c===r.length-1?K():(J=f.current)==null||J.go("+1");else if(G.type==="click"&&G.switch==="50/50"){const Z=x.getBoundingClientRect(),Y=D-Z.left,nt=q-Z.top,it=Z.width,at=Z.height;let lt;b.direction==="horiz"?lt=Y<it/2?"-1":"+1":lt=nt<at/2?"-1":"+1",(et=f.current)==null||et.go(lt)}}},ct=x=>{if(V.current){V.current=!1;return}const D=r[c],q=(D==null?void 0:D.image.objectFit)==="cover";let J,et;if("changedTouches"in x&&x.changedTouches.length>0)J=x.changedTouches[0].clientX,et=x.changedTouches[0].clientY;else if("clientX"in x)J=x.clientX,et=x.clientY;else return;let Z;if(q&&M.current){const Y=$n(M.current);Z=J>=Y.left&&J<=Y.right&&et>=Y.top&&et<=Y.bottom}else{const Y=M.current?Cn(M.current):null;if(!Y){x.target===x.currentTarget&&K();return}Z=J>=Y.x&&J<=Y.x+Y.width&&et>=Y.y&&et<=Y.y+Y.height}Z?mt(M.current,J,et):K()},dt=x=>{const D=x.target;(D.classList.contains(N.thumbsWrapper)||D.classList.contains(N.thumbsContainer))&&ct(x)};z.useEffect(()=>{if(!t)return;const x=D=>{var q,J;if(D.key==="Escape"){K();return}if(D.key==="ArrowRight"){l(et=>(et+1)%Math.max(r.length,1)),(q=f.current)==null||q.go("+1");return}D.key==="ArrowLeft"&&(l(et=>(et-1+Math.max(r.length,1))%Math.max(r.length,1)),(J=f.current)==null||J.go("-1"))};return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}},[t,K,r.length]),z.useEffect(()=>{if(t){if(l(0),C(D=>D+1),T.current=!1,m(!1),g(!1),h({}),!O)return;const x=new CustomEvent("page-overlay",{detail:{itemId:O}});window.dispatchEvent(x)}return()=>{w.current&&y.current&&(w.current.removeEventListener("animationend",y.current),y.current=null),g(!1)}},[t,O]),z.useEffect(()=>{$.current!==null&&$.current!==b.type&&C(x=>x+1),$.current=b.type},[b.type]),z.useEffect(()=>{if(!t)return;const x=document.body.style.overflow,D=window.matchMedia("(max-width: 768px)").matches,q=wn(A.color);document.body.style.overflow="hidden",g(!1);const J=Z=>{Z.target===w.current&&!T.current&&Z.animationName&&(D&&!i&&q>.9&&(document.body.style.backgroundColor=A.color),g(!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 et=Z=>{const Y=Z.target;Y&&(Y.closest(`.${N.thumbsWrapper}`)||Y.closest(`.${N.thumbsContainer}`))||b.type!=="slide"&&Z.preventDefault()};return document.addEventListener("touchmove",et,{passive:!1}),()=>{document.body.style.overflow=x,document.removeEventListener("touchmove",et),w.current&&L.current&&(w.current.removeEventListener("animationend",L.current),L.current=null),g(!1)}},[t,i,A.color,b.type]),z.useEffect(()=>{if(!t)return;const x=D=>{var J,et;if(T.current){D.stopPropagation();return}if(V.current){V.current=!1;return}const q=D.target;if(!(q&&(q.closest(`.${N.thumbsContainer}`)||q.closest(`.${N.thumbItem}`)))){if(b.type==="slide"&&G.type==="drag"&&((et=(J=f.current)==null?void 0:J.splide)!=null&&et.root)){const Z=f.current.splide.root;if(q&&(Z.contains(q)||Z===q))return}if(D.touches.length===0&&D.changedTouches.length>0){const Z=r[c],Y=(Z==null?void 0:Z.image.objectFit)==="cover",nt=D.changedTouches[0];let it;if(Y&&M.current){const at=$n(M.current);it=nt.clientX>=at.left&&nt.clientX<=at.right&&nt.clientY>=at.top&&nt.clientY<=at.bottom}else{const at=M.current?Cn(M.current):null;if(!at)return;it=nt.clientX>=at.x&&nt.clientX<=at.x+at.width&&nt.clientY>=at.y&&nt.clientY<=at.y+at.height}if(!it){D.stopPropagation(),T.current=!0;const at=lt=>{lt.stopPropagation(),lt.preventDefault(),document.removeEventListener("click",at,!0)};document.addEventListener("click",at,!0),K()}}}};return document.addEventListener("touchend",x,{passive:!0}),()=>{document.removeEventListener("touchend",x)}},[t,K,c,r]);const xt=(b.type==="scale"||b.type==="fade")&&b.direction==="vert"&&G.type==="drag";z.useEffect(()=>{var lt,bt;if(!t||!xt||!((bt=(lt=f.current)==null?void 0:lt.splide)!=null&&bt.root))return;const x=f.current.splide.root,D=30,q=(Q,ut)=>{if(I.current){const wt=Math.abs(Q-I.current.x),Xt=Math.abs(ut-I.current.y);(wt>0||Xt>0)&&(V.current=!0)}},J=Q=>{I.current&&(Q.preventDefault(),q(Q.clientX,Q.clientY))},et=Q=>{I.current&&Q.touches.length>0&&(Q.preventDefault(),q(Q.touches[0].clientX,Q.touches[0].clientY))},Z=(Q,ut)=>{if(!I.current||!f.current){I.current=null;return}const wt=Math.abs(Q-I.current.x),Xt=Math.abs(ut-I.current.y);Xt>D&&Xt>wt&&f.current.go(ut<I.current.y?"+1":"-1"),I.current=null},Y=Q=>{I.current&&Z(Q.clientX,Q.clientY),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),document.removeEventListener("pointermove",J)},nt=Q=>{if(I.current){if(Q.changedTouches.length>0){const ut=Q.changedTouches[0];Z(ut.clientX,ut.clientY)}document.removeEventListener("touchend",nt),document.removeEventListener("touchcancel",nt),document.removeEventListener("touchmove",et)}},it=Q=>{I.current={x:Q.clientX,y:Q.clientY},V.current=!1,document.addEventListener("pointermove",J,{passive:!1}),document.addEventListener("pointerup",Y),document.addEventListener("pointercancel",Y)},at=Q=>{Q.touches.length>0&&(I.current={x:Q.touches[0].clientX,y:Q.touches[0].clientY},V.current=!1,document.addEventListener("touchmove",et,{passive:!1}),document.addEventListener("touchend",nt),document.addEventListener("touchcancel",nt))};return x.addEventListener("pointerdown",it),x.addEventListener("touchstart",at),()=>{x.removeEventListener("pointerdown",it),x.removeEventListener("touchstart",at),document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),document.removeEventListener("touchmove",et),document.removeEventListener("touchend",nt),document.removeEventListener("touchcancel",nt),I.current=null,V.current=!1}},[t,xt,u]);const kt={backgroundColor:A.color,backdropFilter:`blur(${A.blur}px)`,animationDuration:`${parseInt(H.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"};return typeof document>"u"||!document.getElementById(a)?null:Ln.createPortal(d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:i?null:w,className:ft(N.background,v?rt:ot,{[N.editor]:i},{[N.hidden]:!t}),style:{...kt,...p&&!i&&!v?{position:"absolute"}:{}}}),d.jsxs("div",{ref:i?w:null,className:ft(N.contentStyle,v?st:X,{[N.editor]:i},{[N.hidden]:!t}),style:{animationDuration:`${parseInt(H.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"},children:[d.jsx(Qr,{onMove:x=>l(x.index),ref:f,className:N.lightboxSplide,options:{arrows:!1,speed:b.duration?parseInt(b.duration):500,direction:b.direction==="horiz"||b.type==="fade"||b.type==="scale"?"ltr":"ttb",pagination:!1,drag:G.type==="drag"&&!xt,perPage:1,width:"100%",height:"100%",type:b.type==="fade"||b.type==="scale"?"fade":"loop",padding:0,rewind:G.repeat!=="close",start:0},style:{"--splide-speed":b.duration},children:r.map((x,D)=>{const q=Ue(B.position,B.offset,i),J=`${E.scalingValue(B.padding.top,i)} ${E.scalingValue(B.padding.right,i)} ${E.scalingValue(B.padding.bottom,i)} ${E.scalingValue(B.padding.left,i)}`,et=b.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 d.jsx(tn,{children:d.jsx("div",{className:N.imgWrapper,onClick:ct,children:d.jsx("img",{ref:D===c?M:null,className:ft(N.imageStyle,{[N.contain]:x.image.objectFit==="contain",[N.cover]:x.image.objectFit==="cover",[N.scaleSlide]:b.type==="scale"}),src:x.image.url,alt:x.image.name??"",style:{...et,pointerEvents:x.image.objectFit==="contain"?"none":"auto"}})})},D)})},u),k.isActive&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:ft(N.arrow,{[N.arrowVertical]:b.direction==="vert"}),style:{color:k.color,"--arrow-hover-color":k.hover},children:d.jsxs("button",{className:N.arrowInner,style:{transform:`translate(${E.scalingValue(k.offset.x,i)}, ${E.scalingValue(k.offset.y*(b.direction==="horiz"?1:-1),i)}) scale(${k.scale}) rotate(${b.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var x;return(x=f.current)==null?void 0:x.go("-1")},"aria-label":"Previous",children:[k.arrowsImgUrl&&d.jsx(he,{url:k.arrowsImgUrl,fill:k.color,hoverFill:k.hover,className:ft(N.arrowImg,N.mirror)}),!k.arrowsImgUrl&&d.jsx(_n,{color:k.color,className:ft(N.arrowIcon,N.arrowImg,N.mirror)})]})}),d.jsx("div",{className:ft(N.arrow,N.nextArrow,{[N.arrowVertical]:b.direction==="vert"}),style:{color:k.color,"--arrow-hover-color":k.hover},children:d.jsxs("button",{className:N.arrowInner,style:{transform:`translate(${E.scalingValue(k.offset.x*(b.direction==="horiz"?-1:1),i)}, ${E.scalingValue(k.offset.y,i)}) scale(${k.scale}) rotate(${b.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var x;return(x=f.current)==null?void 0:x.go("+1")},"aria-label":"Next",children:[k.arrowsImgUrl&&d.jsx(he,{url:k.arrowsImgUrl,fill:k.color,hoverFill:k.hover,className:N.arrowImg}),!k.arrowsImgUrl&&d.jsx(_n,{color:k.color,className:ft(N.arrowIcon,N.arrowImg)})]})})]}),A.closeIconUrl&&(()=>{const x=Ue(A.closeIconAlign,A.closeIconOffset,i),D=`scale(${A.closeIconScale})`,q=x.transform?`${x.transform} ${D}`:D;return d.jsx("button",{className:N.closeButton,style:{...x,transform:q},onClick:K,"aria-label":"Close lightbox",children:d.jsx(he,{url:A.closeIconUrl,fill:A.closeIconColor??"#000000",hoverFill:A.closeIconHover??"#cccccc"})})})(),_&&_.isActive&&n.imageCaption&&((j=r[c])==null?void 0:j.imageCaption)&&(()=>{const{widthSettings:x,fontSettings:D,letterSpacing:q,textAlign:J,wordSpacing:et,fontSizeLineHeight:Z,textAppearance:Y,color:nt}=n.imageCaption;return d.jsx("div",{className:N.caption,style:{...Ue(_.alignment,_.offset,i),fontFamily:D.fontFamily,fontWeight:D.fontWeight,fontStyle:D.fontStyle,width:x.sizing==="auto"?"max-content":E.scalingValue(x.width,i),letterSpacing:E.scalingValue(q,i),wordSpacing:E.scalingValue(et,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:nt},onClick:it=>it.stopPropagation(),children:d.jsx("div",{"data-styles":"imageCaption",className:N.captionTextInner,style:{"--link-color":_.linkColor,"--link-hover-color":_.linkHoverColor},children:d.jsx(uo,{content:r[c].imageCaption})})})})(),P.isActive&&(()=>{const[x,D]=P.position.split("-"),q=b.direction==="horiz"?`${x}-left`:P.position,J=Ue(q,P.offset,i),et=()=>{if(b.direction==="horiz"){if(D==="left")return"flex-start";if(D==="center")return"center";if(D==="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 d.jsx("div",{ref:R,className:N.thumbsWrapper,onClick:Z=>dt(Z),style:{position:i?"absolute":"fixed",...J,...b.direction==="horiz"?{maxWidth:"100vw",width:"100%",overflowX:"auto",overflowY:"hidden"}:{maxHeight:"100vh",overflowY:"auto",overflowX:"hidden"}},children:d.jsx("div",{className:ft(N.thumbsContainer,{[N.thumbsContainerVertical]:b.direction==="vert",[N.thumbsAlignStart]:P.align==="start",[N.thumbsAlignCenter]:P.align==="center",[N.thumbsAlignEnd]:P.align==="end"}),style:{gap:E.scalingValue(P.grid.gap,i),justifyContent:F?"flex-start":et()},children:r.map((Z,Y)=>{const nt=Y===c,it=S[Y],lt=P.grid.size*(nt?P.activeState.scale:1),bt=()=>{if(P.fit!=="fit")return{};if(!it)return b.direction==="horiz"?{height:E.scalingValue(lt,i)}:{width:E.scalingValue(lt,i)};const Q=it.width/it.height;if(b.direction==="horiz"){const ut=lt,wt=ut*Q;return{width:E.scalingValue(wt,i),height:E.scalingValue(ut,i)}}else{const ut=lt,wt=ut/Q;return{width:E.scalingValue(ut,i),height:E.scalingValue(wt,i)}}};return d.jsx("button",{className:N.thumbItem,style:{...b.direction==="horiz"&&P.fit!=="fit"?{height:E.scalingValue(lt,i)}:{},...b.direction==="vert"&&P.fit!=="fit"?{width:E.scalingValue(lt,i)}:{},...P.fit==="cover"?{width:E.scalingValue(lt,i),height:E.scalingValue(lt,i)}:{},...bt(),transition:nt?"all 0.25s ease-out":"none",opacity:nt?P.activeState.opacity/100:P.opacity/100,"--thumb-hover":P.activeState.opacity/100},onClick:Q=>{var ut;Q.stopPropagation(),l(Y),(ut=f.current)==null||ut.go(Y)},onMouseEnter:()=>{var Q;P.triggers==="hov"&&((Q=f.current)==null||Q.go(Y))},children:d.jsx("img",{src:Z.image.url,alt:Z.image.name??"",onLoad:Q=>{const ut=Q.currentTarget;ut.naturalWidth&&ut.naturalHeight&&h(wt=>({...wt,[Y]:{width:ut.naturalWidth,height:ut.naturalHeight}}))},style:{objectFit:P.fit==="cover"?"cover":"contain",...P.fit==="fit"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{},...P.fit==="cover"?{width:"100%",height:"100%"}:{}}})},`${Z.image.name}-${Y}`)})})})})()]})]}),document.getElementById(a))};function _n({color:t,className:e}){return d.jsx("svg",{viewBox:"0 0 10 18",className:e,children:d.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:d.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 Kt(t){const{color:e,...r}=t;return r}function Ht(t,e){var r,n,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:(r=t.textAppearance)==null?void 0:r.textTransform,textDecoration:(n=t.textAppearance)==null?void 0:n.textDecoration,fontVariant:(o=t.textAppearance)==null?void 0:o.fontVariant,color:t.color}}function Xe(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: ${Xe(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: ${Xe(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: ${Xe(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: ${Xe(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:r,activeEvent:n}){const{prefix:o}=E.useScopedStyles(),{type:a="A",fieldsToShow:i=2,fields:s=[],buttonLabel:c,gap:l,fieldsGap:u,buttonCorners:C,buttonStroke:v,buttonPadding:m,isButtonFullWidth:p,inputCorners:g,inputStroke:S,inputPadding:h,inputColor:f,inputTextColor:$,inputBorderColor:M,placeholderColor:T,buttonColor:w,buttonTextColor:y,buttonBorderColor:L,labelTextColor:I,successColor:V,errorColor:R,fontFamily:F,inputFontSettings:W,inputFontSize:H,inputLineHeight:G,inputLetterSpacing:b,inputWordSpacing:P,inputTextAppearance:k,buttonFontSettings:A,buttonFontSize:_,buttonLineHeight:B,buttonLetterSpacing:X,buttonWordSpacing:ot,buttonTextAppearance:rt,labelFontSettings:st,labelFontSize:O,labelLineHeight:K,labelLetterSpacing:mt,labelWordSpacing:ct,labelTextAppearance:dt,statusFontSettings:xt,statusFontSize:kt,statusLineHeight:j,statusLetterSpacing:x,statusWordSpacing:D,statusTextAppearance:q,successMessage:J,errorMessage:et,stateOverrides:Z}=t,Y=a==="B",nt=s.slice(0,Math.min(i,s.length)),it={fontSettings:{fontFamily:F,fontWeight:(W==null?void 0:W.fontWeight)??400,fontStyle:(W==null?void 0:W.fontStyle)??"normal"},fontSize:H??.01,lineHeight:G,letterSpacing:b??0,wordSpacing:P??0,textAppearance:k,color:$},at=Kt(Ht(it,e)),lt=E.scalingValue(S??0,e),bt=E.scalingValue((G??H??.01)+((h==null?void 0:h.top)??0)+((h==null?void 0:h.bottom)??0)+(a==="C"?S??0:(S??0)*2),e),Q={...at,borderStyle:"solid",borderRadius:a==="C"?0:E.scalingValue(g??0,e),...a==="C"?{borderTopWidth:0,borderRightWidth:0,borderBottomWidth:lt,borderLeftWidth:0}:{borderWidth:lt},paddingTop:E.scalingValue((h==null?void 0:h.top)??0,e),paddingRight:E.scalingValue((h==null?void 0:h.right)??0,e),paddingBottom:E.scalingValue((h==null?void 0:h.bottom)??0,e),paddingLeft:E.scalingValue((h==null?void 0:h.left)??0,e),height:bt,minHeight:bt},ut={fontSettings:{fontFamily:F,fontWeight:(A==null?void 0:A.fontWeight)??400,fontStyle:(A==null?void 0:A.fontStyle)??"normal"},fontSize:_??.01,lineHeight:B,letterSpacing:X??0,wordSpacing:ot??0,textAppearance:rt,color:y},wt=Kt(Ht(ut,e)),Xt=E.scalingValue(v??0,e),hr={fontSettings:{fontFamily:F,fontWeight:(st==null?void 0:st.fontWeight)??400,fontStyle:(st==null?void 0:st.fontStyle)??"normal"},fontSize:O??.01,lineHeight:K,letterSpacing:mt??0,wordSpacing:ct??0,textAppearance:dt,color:I},$e=Ht(hr,e),yt={fontSettings:{fontFamily:F,fontWeight:(xt==null?void 0:xt.fontWeight)??400,fontStyle:(xt==null?void 0:xt.fontStyle)??"normal"},fontSize:kt??.01,lineHeight:j,letterSpacing:x??0,wordSpacing:D??0,textAppearance:q,color:V},Rt=Kt(Ht(yt,e)),re=E.buildColorVars(o,{inputColor:f,inputTextColor:$,inputBorderColor:M,placeholderColor:T!=null&&T.trim()?T:"#cccccc",buttonColor:w,buttonTextColor:y,buttonBorderColor:L,labelTextColor:I,successColor:V,errorColor:R},wl,_l,Z),[St,Wt]=z.useState(()=>Object.fromEntries(nt.map(pt=>[pt.name,""]))),[en,we]=z.useState("idle"),[go,He]=z.useState(null),yr=n==="success"?"success":n==="error"?"error":en,mo=n==="error"?et:go,De=n==="filled",_e=z.useMemo(()=>{if(!De)return St;let pt=null;for(const zt of nt)(St[zt.name]??"").trim().length>0||(pt=pt??{...St},pt[zt.name]="Filled");return pt??St},[St,De,nt]),fo=yr==="error"?E.getFormFieldValidationError(nt,_e):null,ho=`${n&&n!=="default"?`${o}-state-${n}`:""}`.trim(),rn=r==null?void 0:r.submitUrl,nn=(pt,zt)=>{Wt(Vt=>({...Vt,[pt]:zt}))},yo=async pt=>{pt.preventDefault();const zt=Object.fromEntries(nt.map(Et=>{var ce;return[Et.name,((ce=St[Et.name])==null?void 0:ce.trim())??""]}).filter(([,Et])=>Et));if(!rn){we("error"),He("No integrations were found for this form.");return}if(Object.keys(zt).length===0)return;const Vt=E.getFormFieldValidationError(nt,St);if(Vt){we("error"),He(Vt);return}we("submitting"),He(null);try{const Et=await fetch(rn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(zt)});if(!Et.ok){const ce=await Et.text();throw new Error(ce||`Request failed: ${Et.status}`)}we("success"),Wt(Object.fromEntries(nt.map(ce=>[ce.name,""])))}catch(Et){we("error"),He(Et instanceof Error?Et.message:"Something went wrong")}};return d.jsxs("div",{className:`${o}-wrapper ${o}-type-${a} ${ho}`.trim(),style:re,children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:Cl(o)}}),d.jsxs("form",{onSubmit:yo,className:`${o}-form`,style:{gap:E.scalingValue(l??0,e)},children:[d.jsx("div",{className:`${o}-fields`,style:{gap:E.scalingValue(u??0,e)},children:nt.map((pt,zt)=>d.jsxs("div",{className:`${o}-field-group${Y?` ${o}-labeled`:""}`,children:[Y&&d.jsx("span",{className:`${o}-field-label`,style:$e?{...$e,lineHeight:$e.fontSize}:void 0,children:pt.label||pt.name}),pt.type==="textarea"?d.jsx("textarea",{name:pt.name,autoComplete:"off",value:_e[pt.name]??"",onChange:Vt=>nn(pt.name,Vt.target.value),placeholder:pt.placeholder,className:`${o}-input`,style:Q,rows:1,"data-filled":De||(_e[pt.name]??"").trim().length>0,"data-field-type":"textarea"}):d.jsx("input",{type:pt.type==="phone"?"tel":pt.type==="email"?"email":"text",name:pt.name,autoComplete:"off",value:_e[pt.name]??"",onChange:Vt=>nn(pt.name,Vt.target.value),placeholder:pt.placeholder,required:pt.isRequired??pt.type==="email",className:`${o}-input`,style:Q,"data-filled":De||(_e[pt.name]??"").trim().length>0})]},zt))}),d.jsx("div",{className:`${o}-overlay-anchor`,children:d.jsx("button",{type:"submit",className:`${o}-button`,style:{borderStyle:"solid",borderRadius:E.scalingValue(C??0,e),borderWidth:Xt,paddingTop:E.scalingValue((m==null?void 0:m.top)??0,e),paddingRight:E.scalingValue((m==null?void 0:m.right)??0,e),paddingBottom:E.scalingValue((m==null?void 0:m.bottom)??0,e),paddingLeft:E.scalingValue((m==null?void 0:m.left)??0,e),...wt,...p?{width:"100%",textAlign:"center",whiteSpace:"normal"}:{}},children:d.jsx("span",{className:`${o}-overlay-anchor`,style:p?{display:"inline-block",maxWidth:"100%",whiteSpace:"normal",textAlign:"center"}:void 0,children:en==="submitting"?"...":c})})})]}),yr==="success"&&d.jsx("p",{className:`${o}-success`,style:{...Rt},children:J}),yr==="error"&&d.jsx("p",{className:`${o}-error`,style:{...Rt},role:"alert",children:fo??mo??et})]})}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"}],qe={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:{...qe.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:{...qe.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:{...qe.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:{...qe.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 Ye(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,623 +884,1211 @@ 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(--${
|
|
928
|
-
}
|
|
929
|
-
.${
|
|
930
|
-
margin-top: ${
|
|
931
|
-
font-size: ${
|
|
932
|
-
color: var(--${
|
|
933
|
-
}
|
|
934
|
-
`}const
|
|
935
|
-
import { CommonComponentProps } from '../props'
|
|
936
|
-
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index'
|
|
937
|
-
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss'
|
|
938
|
-
import { SvgImage } from '../helpers/SvgImage/SvgImage'
|
|
939
|
-
|
|
940
|
-
function sv(px: number): string {
|
|
941
|
-
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
function getCSS(P: string): string {
|
|
945
|
-
return
|
|
946
|
-
.\${P}-wrapper {
|
|
947
|
-
display: flex
|
|
948
|
-
flex-direction: column
|
|
924
|
+
.${t}-success {
|
|
925
|
+
margin-top: ${Ye(8)};
|
|
926
|
+
font-size: ${Ye(14)};
|
|
927
|
+
color: var(--${t}-success-success-color, var(--${t}-success-color));
|
|
928
|
+
}
|
|
929
|
+
.${t}-error {
|
|
930
|
+
margin-top: ${Ye(8)};
|
|
931
|
+
font-size: ${Ye(14)};
|
|
932
|
+
color: var(--${t}-error-error-color, var(--${t}-error-color));
|
|
933
|
+
}
|
|
934
|
+
`}const kl=({settings:t,isEditor:e,metadata:r,activeEvent:n})=>{const{prefix:o}=E.useScopedStyles(),{fields:a=[{name:"email",type:"email",placeholder:"Your email"}],buttonIcon:i,buttonLabel:s,fieldsToShow:c=1,fontFamily:l,inputFontSettings:u,inputFontSize:C,inputLineHeight:v,inputLetterSpacing:m,inputWordSpacing:p,inputTextAppearance:g,buttonFontSettings:S,buttonFontSize:h,buttonLineHeight:f,buttonLetterSpacing:$,buttonWordSpacing:M,buttonTextAppearance:T,statusFontSettings:w,statusFontSize:y,statusLineHeight:L,statusLetterSpacing:I,statusWordSpacing:V,statusTextAppearance:R,iconMaxWidth:F,minHeight:W,corners:H,stroke:G,stateOverrides:b,inputPadding:P,buttonPadding:k,successMessage:A="Thanks for subscribing!",errorMessage:_="Please, fill all required fields."}=t,B=a.slice(0,Math.min(c,a.length)),[X,ot]=z.useState(()=>Object.fromEntries(B.map(yt=>[yt.name,""]))),[rt,st]=z.useState("idle"),[O,K]=z.useState(null),mt=n==="success"?"success":n==="error"?"error":rt,ct=n==="error"?_:O,dt=n==="filled",xt=z.useMemo(()=>{if(!dt)return X;let yt=null;for(const Rt of B)(X[Rt.name]??"").trim().length>0||(yt=yt??{...X},yt[Rt.name]="Filled");return yt??X},[dt,X,B]),kt=mt==="error"?E.getFormFieldValidationError(B,xt):null,j=n&&n!=="default"?`${o}-state-${n}`:"",x=B.some(yt=>(xt[yt.name]??"").trim().length>0),D=j!==`${o}-state-filled`&&x?`${o}-state-filled`:"",q=`${j} ${D}`.trim(),J=r==null?void 0:r.submitUrl,et=s??"",Z=(i==null?void 0:i.icon)??"",Y=(i==null?void 0:i.mode)==="On",nt=et||"Submit",it={fontSettings:{fontFamily:l,fontWeight:(u==null?void 0:u.fontWeight)??400,fontStyle:(u==null?void 0:u.fontStyle)??"normal"},fontSize:C??.01,lineHeight:v,letterSpacing:m??0,wordSpacing:p??0,textAppearance:g,color:t.inputTextColor??"#111111"},at={fontSettings:{fontFamily:l,fontWeight:(S==null?void 0:S.fontWeight)??400,fontStyle:(S==null?void 0:S.fontStyle)??"normal"},fontSize:h??.01,lineHeight:f,letterSpacing:$??0,wordSpacing:M??0,textAppearance:T,color:t.buttonTextColor??"#ffffff"},lt={fontSettings:{fontFamily:l,fontWeight:(w==null?void 0:w.fontWeight)??400,fontStyle:(w==null?void 0:w.fontStyle)??"normal"},fontSize:y??.01,lineHeight:L,letterSpacing:I??0,wordSpacing:V??0,textAppearance:R,color:t.successColor??"#22c55e"},bt=Kt(Ht(it,e)),Q=Kt(Ht(at,e)),ut=Kt(Ht(lt,e)),wt=E.buildColorVars(o,{strokeColor:t.strokeColor,inputColor:t.inputColor,placeholderColor:t.placeholderColor,buttonColor:t.buttonColor,successColor:t.successColor,errorColor:t.errorColor,inputTextColor:t.inputTextColor??(it==null?void 0:it.color)??"#111111",buttonTextColor:t.buttonTextColor??(at==null?void 0:at.color)??"#ffffff"},Rl,Ol,b),Xt={borderRadius:E.scalingValue(H,e),borderWidth:E.scalingValue(G,e),borderStyle:"solid"},hr={borderLeftWidth:E.scalingValue(G,e)},$e=async yt=>{yt.preventDefault();const Rt=Object.fromEntries(B.map(St=>{var Wt;return[St.name,((Wt=X[St.name])==null?void 0:Wt.trim())??""]}).filter(([,St])=>St));if(!J){st("error"),K("No integrations were found for this form.");return}if(Object.keys(Rt).length===0)return;const re=E.getFormFieldValidationError(B,X);if(re){st("error"),K(re);return}st("submitting"),K(null);try{const St=await fetch(J,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Rt)});if(!St.ok){const Wt=await St.text();throw new Error(Wt||`Request failed: ${St.status}`)}st("success"),ot(Object.fromEntries(B.map(Wt=>[Wt.name,""])))}catch(St){st("error"),K(St instanceof Error?St.message:"Something went wrong")}};return d.jsxs("div",{className:`${o}-wrapper ${q}`.trim(),style:wt,children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:Fl(o)}}),d.jsxs("form",{onSubmit:$e,className:`${o}-form`,style:{...Xt,height:E.scalingValue(W,e),minHeight:E.scalingValue(W,e)},children:[d.jsx("div",{className:`${o}-inputWrap ${o}-overlayAnchor`,style:{flex:1,minWidth:0},children:B.map(yt=>d.jsx("input",{type:yt.type==="email"?"email":yt.type==="phone"?"tel":"text",name:yt.name,autoComplete:"off",value:xt[yt.name]??"",onChange:Rt=>ot(re=>({...re,[yt.name]:Rt.target.value})),placeholder:yt.placeholder,required:yt.isRequired??yt.type==="email",className:`${o}-input`,style:{...bt,paddingRight:E.scalingValue(P.right,e),paddingLeft:E.scalingValue(P.left,e),paddingTop:E.scalingValue(P.top,e),paddingBottom:E.scalingValue(P.bottom,e)}},yt.name))}),d.jsx("div",{className:`${o}-overlayAnchor`,children:d.jsx("button",{type:"submit",className:`${o}-submitBtn`,"aria-label":nt,style:{...Q,...hr,paddingRight:E.scalingValue(k.right,e),paddingLeft:E.scalingValue(k.left,e),paddingTop:E.scalingValue(k.top,e),paddingBottom:E.scalingValue(k.bottom,e)},children:rt==="submitting"?"...":Y?Z&&d.jsx(he,{url:Z,className:`${o}-submitBtnIcon`,style:{maxWidth:E.scalingValue(F??0,e)},fill:`var(--${o}-button-text-color)`,hoverFill:`var(--${o}-button-text-color)`}):et})})]}),mt==="success"&&d.jsx("p",{className:`${o}-success`,style:{...ut},children:A}),mt==="error"&&d.jsx("p",{className:`${o}-error`,style:{...ut},role:"alert",children:kt??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."}],$r={fontSettings:{type:"object",display:{type:"font-settings-weight",visible:!0},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}}},zl=["strokeColor","inputColor","inputTextColor","placeholderColor","buttonColor","buttonTextColor","successColor","errorColor"],Vl={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:{...$r.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:{...$r.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:{...$r.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:[...zl],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:Vl,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;
|
|
949
1510
|
width: 100%;
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
justify-content: center;
|
|
953
|
-
}
|
|
954
|
-
.\${P}-form {
|
|
955
|
-
display: flex;
|
|
956
|
-
width: 100%;
|
|
957
|
-
align-items: stretch;
|
|
958
|
-
overflow: hidden;
|
|
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));
|
|
1511
|
+
column-gap: 10%;
|
|
1512
|
+
min-height: ${jl(48)};
|
|
964
1513
|
}
|
|
965
|
-
|
|
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));
|
|
976
|
-
}
|
|
977
|
-
.\${P}-inputWrap {
|
|
978
|
-
position: relative;
|
|
1514
|
+
.${t}-item {
|
|
979
1515
|
display: flex;
|
|
1516
|
+
flex-direction: column;
|
|
1517
|
+
justify-content: center;
|
|
980
1518
|
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;
|
|
1519
|
+
gap: 12px;
|
|
1025
1520
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
color: var(--\${P}-hover-placeholder-color, var(--\${P}-placeholder-color));
|
|
1029
|
-
}
|
|
1030
|
-
.\${P}-inputWrap:focus-within .\${P}-input::placeholder,
|
|
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;
|
|
1521
|
+
.${t}-item-image {
|
|
1522
|
+
width: 100%;
|
|
1039
1523
|
height: 100%;
|
|
1040
|
-
display: flex;
|
|
1041
|
-
align-items: center;
|
|
1042
|
-
justify-content: center;
|
|
1043
|
-
border: none;
|
|
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
1524
|
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;
|
|
1062
1525
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1526
|
+
.${t}-item-slider,
|
|
1527
|
+
.${t}-item-slider .splide__track,
|
|
1528
|
+
.${t}-item-slider .splide__list,
|
|
1529
|
+
.${t}-item-slider .splide__slide {
|
|
1530
|
+
width: 100%;
|
|
1068
1531
|
height: 100%;
|
|
1069
|
-
width: auto;
|
|
1070
|
-
max-width: 100%;
|
|
1071
|
-
max-height: 100%;
|
|
1072
1532
|
}
|
|
1073
|
-
|
|
1074
|
-
position: relative;
|
|
1075
|
-
top: auto;
|
|
1076
|
-
left: auto;
|
|
1077
|
-
transform: none;
|
|
1078
|
-
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
|
-
}
|
|
1106
|
-
.\${P}-submitBtn:hover .\${P}-submitBtnIcon,
|
|
1107
|
-
.\${P}-wrapper.\${P}-state-hover .\${P}-submitBtn .\${P}-submitBtnIcon {
|
|
1108
|
-
background-color: var(--\${P}-hover-button-text-color, var(--\${P}-button-text-color));
|
|
1109
|
-
}
|
|
1110
|
-
.\${P}-submitBtn:focus .\${P}-submitBtnIcon,
|
|
1111
|
-
.\${P}-wrapper.\${P}-state-focus .\${P}-submitBtn .\${P}-submitBtnIcon {
|
|
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;
|
|
1120
|
-
}
|
|
1121
|
-
.\${P}-overlayAnchor {
|
|
1122
|
-
position: relative;
|
|
1533
|
+
.${t}-item-slider .splide__slide {
|
|
1123
1534
|
display: flex;
|
|
1124
|
-
align-items: center;
|
|
1125
1535
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
margin-top:
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
<div
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
<
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
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;
|
|
1536
|
+
.${t}-item-title {
|
|
1537
|
+
white-space: normal;
|
|
1538
|
+
overflow-wrap: anywhere;
|
|
1539
|
+
word-break: break-word;
|
|
1540
|
+
text-align: center;
|
|
1541
|
+
margin-bottom: 0px;
|
|
1542
|
+
margin-top: 0px;
|
|
1543
|
+
color: var(--${t}-title-color);
|
|
1544
|
+
}
|
|
1545
|
+
.${t}-item-subtitle {
|
|
1546
|
+
white-space: normal;
|
|
1547
|
+
overflow-wrap: anywhere;
|
|
1548
|
+
word-break: break-word;
|
|
1549
|
+
text-align: center;
|
|
1550
|
+
margin-bottom: 0px;
|
|
1551
|
+
margin-top: 0px;
|
|
1552
|
+
color: var(--${t}-subtitle-color);
|
|
1553
|
+
}
|
|
1554
|
+
`}const qt=500,oe="cubic-bezier(0.22, 1, 0.36, 1)";function Hl({images:t,index:e,imageDisplay:r,originRect:n,onClose:o,onPrev:a,onNext:i}){const s=z.useRef(null),c=z.useRef(null),[l,u]=z.useState(null),[C,v]=z.useState(n?"opening":"open"),[m,p]=z.useState(!0),g=z.useRef(e),S=z.useCallback(()=>{const T=s.current,w=c.current;if(!T||!w)return;const y=T.getBoundingClientRect(),L=y.width,I=y.height,V=w.naturalWidth,R=w.naturalHeight;if(!L||!I||!V||!R)return;if(r==="Cover"){u({width:L,height:I,left:y.left,top:y.top});return}const F=V/R,W=L/I;if(F>W){const H=L/F;u({width:L,height:H,left:y.left,top:y.top+(I-H)/2})}else{const H=I*F;u({width:H,height:I,left:y.left+(L-H)/2,top:y.top})}},[r]);z.useEffect(()=>{S();const T=s.current;if(!T)return;const w=new ResizeObserver(()=>S());return w.observe(T),()=>w.disconnect()},[S,e]),z.useEffect(()=>{if(C!=="opening"||!l)return;const T={id:0};return T.id=requestAnimationFrame(()=>{T.id=requestAnimationFrame(()=>v("open"))}),()=>cancelAnimationFrame(T.id)},[C,l]),z.useEffect(()=>{if(C!=="closing")return;const T=setTimeout(()=>o(),qt);return()=>clearTimeout(T)},[C,o]),z.useEffect(()=>{g.current!==e&&p(!1),g.current=e},[e]);const h=()=>{C!=="closing"&&v("closing")},f=C==="opening"?n??l:l,$=C==="open",M=C==="closing";return d.jsxs("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:9997},onClick:h,children:[d.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(28,31,34,0.9)",opacity:$?1:0,transition:`opacity ${qt}ms ${oe}`,pointerEvents:"none"}}),d.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[d.jsx("div",{style:{height:"10%"}}),d.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:d.jsx("div",{ref:s,style:{width:"100%",height:"100%"}})}),d.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",color:"#E6E6E6",letterSpacing:"-0.6px",lineHeight:"16px",opacity:$?1:0,transition:`opacity ${qt}ms ${oe}`},children:[d.jsx("p",{children:e+1}),d.jsx("p",{children:"/"}),d.jsx("p",{children:t.length})]})]}),f&&d.jsx("img",{ref:c,src:t[e],onLoad:S,style:{position:"fixed",top:f.top,left:f.left,width:f.width,height:f.height,objectFit:r==="Cover"?"cover":"contain",opacity:M?0:1,transition:M?`opacity ${qt}ms ${oe}`:m?`top ${qt}ms ${oe}, left ${qt}ms ${oe}, width ${qt}ms ${oe}, height ${qt}ms ${oe}`:"none",pointerEvents:"none",zIndex:9998}}),$&&l&&d.jsxs(d.Fragment,{children:[d.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,width:l.width/2,height:l.height,cursor:"w-resize",zIndex:9999},onClick:T=>{T.stopPropagation(),a()}}),d.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:T=>{T.stopPropagation(),i()}})]})]})}function Dl({settings:t,content:e,isEditor:r,metadata:n,activeEvent:o}){const{prefix:a}=E.useScopedStyles(),{type:i="A",fieldsToShow:s=2,textBoxWidth:c,verticalGap:l,entriesCount:u,lightbox:C,imageSize:v,imageDisplay:m,slider:p,sliderTiming:g,direction:S,transition:h,titleColor:f,subtitleColor:$,titleFontFamily:M,titleFontSettings:T,titleFontSize:w,titleLineHeight:y,titleLetterSpacing:L,titleWordSpacing:I,titleTextAppearance:V,subtitleFontFamily:R,subtitleFontSettings:F,subtitleFontSize:W,subtitleLineHeight:H,subtitleLetterSpacing:G,subtitleWordSpacing:b,subtitleTextAppearance:P}=t,k={fontSettings:{fontFamily:M,fontWeight:(T==null?void 0:T.fontWeight)??400,fontStyle:(T==null?void 0:T.fontStyle)??"normal"},fontSize:w??.01,lineHeight:y,letterSpacing:L??0,wordSpacing:I??0,textAppearance:V,color:f},_={...Kt(Ht(k,r))},B={fontSettings:{fontFamily:R,fontWeight:(F==null?void 0:F.fontWeight)??400,fontStyle:(F==null?void 0:F.fontStyle)??"normal"},fontSize:W??.01,lineHeight:H,letterSpacing:G??0,wordSpacing:b??0,textAppearance:P,color:$},ot={...Kt(Ht(B,r))},rt=E.buildColorVars(a,{titleColor:f,subtitleColor:$},Gl,Ul),O=`${o&&o!=="default"?`${a}-state-${o}`:""}`.trim(),K=u===0?1/0:u,mt=(e??[]).slice(0,K),dt={Small:.1,Medium:.2,Big:.3}[v]??.2,[xt,kt]=z.useState("ltr"),[j,x]=z.useState(!1),[D,q]=z.useState([]),[J,et]=z.useState(0),[Z,Y]=z.useState(null),nt=(it,at,lt)=>{if(C==="Off")return;const bt=it.currentTarget.getBoundingClientRect();Y({top:bt.top,left:bt.left,width:bt.width,height:bt.height}),q(at),et(lt),x(!0)};return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:Ml(a)}}),d.jsx("div",{style:rt,children:d.jsx("div",{className:`${a}-wrapper ${a}-type-${i} ${O}`.trim(),style:{gridTemplateColumns:`repeat(${s}, 1fr)`,rowGap:E.scalingValue(l??0,r)},children:mt.map((it,at)=>d.jsxs("div",{className:`${a}-item`.trim(),children:[d.jsx("div",{className:`${a}-item-image-wrapper`,style:{width:E.scalingValue(dt??0,r),height:E.scalingValue(dt??0,r)},children:p==="Off"?d.jsx("img",{src:it.image[0].url,alt:it.image[0].name,className:`${a}-item-image`.trim(),style:{objectFit:m==="Cover"?"cover":"contain"},onClick:lt=>nt(lt,it.image.map(bt=>bt.url),0)}):d.jsx(Qr,{className:`${a}-item-slider`,options:{arrows:!1,pagination:!1,drag:!1,perPage:1,autoplay:!0,interval:g*1e3,width:"100%",height:"100%",speed:500,type:h==="Fade"?"fade":"loop",rewind:h==="Fade",pauseOnHover:!1,pauseOnFocus:!1,direction:h==="Fade"?"ltr":S!=="Random"?S==="Horizontal"?"ltr":"ttb":xt},onMoved:lt=>{if(S!=="Random"||h==="Fade")return;const bt=Math.random()>.5?Math.random()>.5?"rtl":"ltr":Math.random()>.5?"btt":"ttb";kt(bt),setTimeout(()=>{lt.refresh()},0)},children:it.image.map((lt,bt)=>d.jsx(tn,{children:d.jsx("img",{src:lt.url,alt:lt.name,className:`${a}-item-image`.trim(),style:{objectFit:m==="Cover"?"cover":"contain"},onClick:Q=>nt(Q,it.image.map(ut=>ut.url),bt)})},bt))},`${h}-${v}-${S}-${g}`)}),d.jsx("p",{className:`${a}-item-title`.trim(),style:{width:`calc(${E.scalingValue(dt??0,r)} * (${c} / 100))`,..._},children:it.title}),i==="B"&&d.jsx("p",{className:`${a}-item-subtitle`.trim(),style:{width:`calc(${E.scalingValue(dt??0,r)} * (${c} / 100))`,...ot},children:it.subtitle})]},at))})}),j&&typeof document&&document.getElementById("grid-component-lightbox-portal")&&C==="On"&&Ln.createPortal(d.jsx("div",{"data-selection":"none",children:d.jsx(Hl,{images:D,index:J,imageDisplay:m,originRect:Z,onClose:()=>x(!1),onPrev:()=>et(it=>(it-1+D.length)%D.length),onNext:()=>et(it=>(it+1)%D.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';\r
|
|
1555
|
+
import '@splidejs/react-splide/css/core';\r
|
|
1556
|
+
import { CommonComponentProps } from '../props';\r
|
|
1557
|
+
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';\r
|
|
1558
|
+
import { useCallback, useEffect, useRef, useState } from 'react';\r
|
|
1559
|
+
import { createPortal } from 'react-dom';\r
|
|
1560
|
+
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';\r
|
|
1561
|
+
\r
|
|
1562
|
+
function sv(px: number): string {\r
|
|
1563
|
+
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;\r
|
|
1564
|
+
}\r
|
|
1565
|
+
\r
|
|
1566
|
+
function getCSS(P: string): string {\r
|
|
1567
|
+
return \`\r
|
|
1568
|
+
.\${P}-wrapper {\r
|
|
1569
|
+
display: grid;\r
|
|
1570
|
+
align-items: start;\r
|
|
1571
|
+
width: 100%;\r
|
|
1572
|
+
column-gap: 10%;\r
|
|
1573
|
+
min-height: \${sv(48)};\r
|
|
1574
|
+
}\r
|
|
1575
|
+
.\${P}-item {\r
|
|
1576
|
+
display: flex;\r
|
|
1577
|
+
flex-direction: column;\r
|
|
1578
|
+
justify-content: center;\r
|
|
1579
|
+
align-items: center;\r
|
|
1580
|
+
gap: 12px;\r
|
|
1581
|
+
}\r
|
|
1582
|
+
.\${P}-item-image {\r
|
|
1583
|
+
width: 100%;\r
|
|
1584
|
+
height: 100%;\r
|
|
1585
|
+
display: block;\r
|
|
1586
|
+
}\r
|
|
1587
|
+
.\${P}-item-slider,\r
|
|
1588
|
+
.\${P}-item-slider .splide__track,\r
|
|
1589
|
+
.\${P}-item-slider .splide__list,\r
|
|
1590
|
+
.\${P}-item-slider .splide__slide {\r
|
|
1591
|
+
width: 100%;\r
|
|
1592
|
+
height: 100%;\r
|
|
1593
|
+
}\r
|
|
1594
|
+
.\${P}-item-slider .splide__slide {\r
|
|
1595
|
+
display: flex;\r
|
|
1596
|
+
}\r
|
|
1597
|
+
.\${P}-item-title {\r
|
|
1598
|
+
white-space: normal;\r
|
|
1599
|
+
overflow-wrap: anywhere;\r
|
|
1600
|
+
word-break: break-word;\r
|
|
1601
|
+
text-align: center;\r
|
|
1602
|
+
margin-bottom: 0px;\r
|
|
1603
|
+
margin-top: 0px;\r
|
|
1604
|
+
color: var(--\${P}-title-color);\r
|
|
1605
|
+
}\r
|
|
1606
|
+
.\${P}-item-subtitle {\r
|
|
1607
|
+
white-space: normal;\r
|
|
1608
|
+
overflow-wrap: anywhere;\r
|
|
1609
|
+
word-break: break-word;\r
|
|
1610
|
+
text-align: center;\r
|
|
1611
|
+
margin-bottom: 0px;\r
|
|
1612
|
+
margin-top: 0px;\r
|
|
1613
|
+
color: var(--\${P}-subtitle-color);\r
|
|
1614
|
+
}\r
|
|
1615
|
+
\`;\r
|
|
1616
|
+
}\r
|
|
1617
|
+
\r
|
|
1618
|
+
type GridProps = {\r
|
|
1619
|
+
settings: GridSettings;\r
|
|
1620
|
+
content?: any;\r
|
|
1621
|
+
isEditor?: boolean;\r
|
|
1622
|
+
activeEvent: string | undefined;\r
|
|
1623
|
+
onUpdateSettings?: (settings: GridSettings) => void;\r
|
|
1624
|
+
} & CommonComponentProps;\r
|
|
1625
|
+
\r
|
|
1626
|
+
type AnimRect = { top: number; left: number; width: number; height: number };\r
|
|
1627
|
+
\r
|
|
1628
|
+
type LightboxProps = {\r
|
|
1629
|
+
images: string[];\r
|
|
1630
|
+
index: number;\r
|
|
1631
|
+
imageDisplay: 'Fit' | 'Cover';\r
|
|
1632
|
+
originRect: AnimRect | null;\r
|
|
1633
|
+
onClose: () => void;\r
|
|
1634
|
+
onPrev: () => void;\r
|
|
1635
|
+
onNext: () => void;\r
|
|
1636
|
+
};\r
|
|
1637
|
+
\r
|
|
1638
|
+
const LIGHTBOX_ANIM_MS = 500;\r
|
|
1639
|
+
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';\r
|
|
1640
|
+
\r
|
|
1641
|
+
function Lightbox({ images, index, imageDisplay, originRect, onClose, onPrev, onNext }: LightboxProps) {\r
|
|
1642
|
+
const ghostRef = useRef<HTMLDivElement>(null);\r
|
|
1643
|
+
const imgRef = useRef<HTMLImageElement>(null);\r
|
|
1644
|
+
const [finalRect, setFinalRect] = useState<AnimRect | null>(null);\r
|
|
1645
|
+
const [phase, setPhase] = useState<'opening' | 'open' | 'closing'>(originRect ? 'opening' : 'open');\r
|
|
1646
|
+
const [transitionsEnabled, setTransitionsEnabled] = useState(true);\r
|
|
1647
|
+
const prevIndexRef = useRef(index);\r
|
|
1648
|
+
\r
|
|
1649
|
+
const computeFinalRect = useCallback(() => {\r
|
|
1650
|
+
const ghost = ghostRef.current;\r
|
|
1651
|
+
const img = imgRef.current;\r
|
|
1652
|
+
if (!ghost || !img) return;\r
|
|
1653
|
+
const cb = ghost.getBoundingClientRect();\r
|
|
1654
|
+
const cw = cb.width;\r
|
|
1655
|
+
const ch = cb.height;\r
|
|
1656
|
+
const nw = img.naturalWidth;\r
|
|
1657
|
+
const nh = img.naturalHeight;\r
|
|
1658
|
+
if (!cw || !ch || !nw || !nh) return;\r
|
|
1659
|
+
if (imageDisplay === 'Cover') {\r
|
|
1660
|
+
setFinalRect({ width: cw, height: ch, left: cb.left, top: cb.top });\r
|
|
1661
|
+
return;\r
|
|
1662
|
+
}\r
|
|
1663
|
+
const ir = nw / nh;\r
|
|
1664
|
+
const cr = cw / ch;\r
|
|
1665
|
+
if (ir > cr) {\r
|
|
1666
|
+
const dh = cw / ir;\r
|
|
1667
|
+
setFinalRect({ width: cw, height: dh, left: cb.left, top: cb.top + (ch - dh) / 2 });\r
|
|
1668
|
+
} else {\r
|
|
1669
|
+
const dw = ch * ir;\r
|
|
1670
|
+
setFinalRect({ width: dw, height: ch, left: cb.left + (cw - dw) / 2, top: cb.top });\r
|
|
1671
|
+
}\r
|
|
1672
|
+
}, [imageDisplay]);\r
|
|
1673
|
+
\r
|
|
1674
|
+
useEffect(() => {\r
|
|
1675
|
+
computeFinalRect();\r
|
|
1676
|
+
const c = ghostRef.current;\r
|
|
1677
|
+
if (!c) return;\r
|
|
1678
|
+
const ro = new ResizeObserver(() => computeFinalRect());\r
|
|
1679
|
+
ro.observe(c);\r
|
|
1680
|
+
return () => ro.disconnect();\r
|
|
1681
|
+
}, [computeFinalRect, index]);\r
|
|
1682
|
+
\r
|
|
1683
|
+
useEffect(() => {\r
|
|
1684
|
+
if (phase !== 'opening' || !finalRect) return;\r
|
|
1685
|
+
const handle = { id: 0 };\r
|
|
1686
|
+
handle.id = requestAnimationFrame(() => {\r
|
|
1687
|
+
handle.id = requestAnimationFrame(() => setPhase('open'));\r
|
|
1688
|
+
});\r
|
|
1689
|
+
return () => cancelAnimationFrame(handle.id);\r
|
|
1690
|
+
}, [phase, finalRect]);\r
|
|
1691
|
+
\r
|
|
1692
|
+
useEffect(() => {\r
|
|
1693
|
+
if (phase !== 'closing') return;\r
|
|
1694
|
+
const t = setTimeout(() => onClose(), LIGHTBOX_ANIM_MS);\r
|
|
1695
|
+
return () => clearTimeout(t);\r
|
|
1696
|
+
}, [phase, onClose]);\r
|
|
1697
|
+
\r
|
|
1698
|
+
// Once the user starts switching images, drop the size/position transition so that\r
|
|
1699
|
+
// finalRect updates (driven by each image's aspect ratio) apply instantly instead of animating.\r
|
|
1700
|
+
useEffect(() => {\r
|
|
1701
|
+
if (prevIndexRef.current !== index) {\r
|
|
1702
|
+
setTransitionsEnabled(false);\r
|
|
1703
|
+
}\r
|
|
1704
|
+
prevIndexRef.current = index;\r
|
|
1705
|
+
}, [index]);\r
|
|
1706
|
+
\r
|
|
1707
|
+
const handleClose = () => {\r
|
|
1708
|
+
if (phase === 'closing') return;\r
|
|
1709
|
+
setPhase('closing');\r
|
|
1710
|
+
};\r
|
|
1711
|
+
\r
|
|
1712
|
+
const animatedRect = phase === 'opening' ? (originRect ?? finalRect) : finalRect;\r
|
|
1713
|
+
const isOpen = phase === 'open';\r
|
|
1714
|
+
const isClosing = phase === 'closing';\r
|
|
1715
|
+
\r
|
|
1716
|
+
return (\r
|
|
1717
|
+
<div\r
|
|
1718
|
+
style={{\r
|
|
1719
|
+
position: 'fixed',\r
|
|
1720
|
+
top: 0,\r
|
|
1721
|
+
left: 0,\r
|
|
1722
|
+
width: '100vw',\r
|
|
1723
|
+
height: '100vh',\r
|
|
1724
|
+
zIndex: 9997,\r
|
|
1725
|
+
}}\r
|
|
1726
|
+
onClick={handleClose}\r
|
|
1727
|
+
>\r
|
|
1728
|
+
<div\r
|
|
1729
|
+
style={{\r
|
|
1730
|
+
position: 'absolute',\r
|
|
1731
|
+
inset: 0,\r
|
|
1732
|
+
background: 'rgba(28,31,34,0.9)',\r
|
|
1733
|
+
opacity: isOpen ? 1 : 0,\r
|
|
1734
|
+
transition: \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`,\r
|
|
1735
|
+
pointerEvents: 'none',\r
|
|
1736
|
+
}}\r
|
|
1737
|
+
/>\r
|
|
1738
|
+
<div\r
|
|
1739
|
+
style={{\r
|
|
1740
|
+
position: 'relative',\r
|
|
1741
|
+
width: '100%',\r
|
|
1742
|
+
height: '100%',\r
|
|
1743
|
+
display: 'flex',\r
|
|
1744
|
+
flexDirection: 'column',\r
|
|
1745
|
+
alignItems: 'center',\r
|
|
1746
|
+
justifyContent: 'center',\r
|
|
1747
|
+
}}\r
|
|
1748
|
+
>\r
|
|
1749
|
+
<div style={{ height: '10%' }}></div>\r
|
|
1750
|
+
<div\r
|
|
1751
|
+
style={{\r
|
|
1752
|
+
width: '70%',\r
|
|
1753
|
+
height: '80%',\r
|
|
1754
|
+
display: 'flex',\r
|
|
1755
|
+
justifyContent: 'center',\r
|
|
1756
|
+
alignItems: 'center'\r
|
|
1757
|
+
}}>\r
|
|
1758
|
+
<div ref={ghostRef} style={{ width: '100%', height: '100%' }} />\r
|
|
1759
|
+
</div>\r
|
|
1760
|
+
<div\r
|
|
1761
|
+
style={{\r
|
|
1762
|
+
display: 'flex',\r
|
|
1763
|
+
flexDirection: 'row',\r
|
|
1764
|
+
justifyContent: 'center',\r
|
|
1765
|
+
alignItems: 'center',\r
|
|
1766
|
+
height: '10%',\r
|
|
1767
|
+
color: '#E6E6E6',\r
|
|
1768
|
+
letterSpacing: '-0.6px',\r
|
|
1769
|
+
lineHeight: '16px',\r
|
|
1770
|
+
opacity: isOpen ? 1 : 0,\r
|
|
1771
|
+
transition: \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`,\r
|
|
1772
|
+
}}\r
|
|
1773
|
+
>\r
|
|
1774
|
+
<p>{index + 1}</p>\r
|
|
1775
|
+
<p>/</p>\r
|
|
1776
|
+
<p>{images.length}</p>\r
|
|
1777
|
+
</div>\r
|
|
1778
|
+
</div>\r
|
|
1779
|
+
\r
|
|
1780
|
+
{animatedRect && (\r
|
|
1781
|
+
<img\r
|
|
1782
|
+
ref={imgRef}\r
|
|
1783
|
+
src={images[index]}\r
|
|
1784
|
+
onLoad={computeFinalRect}\r
|
|
1785
|
+
style={{\r
|
|
1786
|
+
position: 'fixed',\r
|
|
1787
|
+
top: animatedRect.top,\r
|
|
1788
|
+
left: animatedRect.left,\r
|
|
1789
|
+
width: animatedRect.width,\r
|
|
1790
|
+
height: animatedRect.height,\r
|
|
1791
|
+
objectFit: imageDisplay === 'Cover' ? 'cover' : 'contain',\r
|
|
1792
|
+
opacity: isClosing ? 0 : 1,\r
|
|
1793
|
+
transition: isClosing\r
|
|
1794
|
+
? \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`\r
|
|
1795
|
+
: transitionsEnabled\r
|
|
1796
|
+
? \`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}\`\r
|
|
1797
|
+
: 'none',\r
|
|
1798
|
+
pointerEvents: 'none',\r
|
|
1799
|
+
zIndex: 9998,\r
|
|
1800
|
+
}}\r
|
|
1801
|
+
/>\r
|
|
1802
|
+
)}\r
|
|
1803
|
+
\r
|
|
1804
|
+
{isOpen && finalRect && (\r
|
|
1805
|
+
<>\r
|
|
1806
|
+
<div\r
|
|
1807
|
+
style={{\r
|
|
1808
|
+
position: 'fixed',\r
|
|
1809
|
+
top: finalRect.top,\r
|
|
1810
|
+
left: finalRect.left,\r
|
|
1811
|
+
width: finalRect.width / 2,\r
|
|
1812
|
+
height: finalRect.height,\r
|
|
1813
|
+
cursor: 'w-resize',\r
|
|
1814
|
+
zIndex: 9999,\r
|
|
1815
|
+
}}\r
|
|
1816
|
+
onClick={(e) => {\r
|
|
1817
|
+
e.stopPropagation();\r
|
|
1818
|
+
onPrev();\r
|
|
1819
|
+
}}\r
|
|
1820
|
+
/>\r
|
|
1821
|
+
<div\r
|
|
1822
|
+
style={{\r
|
|
1823
|
+
position: 'fixed',\r
|
|
1824
|
+
top: finalRect.top,\r
|
|
1825
|
+
left: finalRect.left + finalRect.width / 2,\r
|
|
1826
|
+
width: finalRect.width / 2,\r
|
|
1827
|
+
height: finalRect.height,\r
|
|
1828
|
+
cursor: 'e-resize',\r
|
|
1829
|
+
zIndex: 9999,\r
|
|
1830
|
+
}}\r
|
|
1831
|
+
onClick={(e) => {\r
|
|
1832
|
+
e.stopPropagation();\r
|
|
1833
|
+
onNext();\r
|
|
1834
|
+
}}\r
|
|
1835
|
+
/>\r
|
|
1836
|
+
</>\r
|
|
1837
|
+
)}\r
|
|
1838
|
+
</div>\r
|
|
1839
|
+
);\r
|
|
1840
|
+
}\r
|
|
1841
|
+
\r
|
|
1842
|
+
export function Grid({ settings, content, isEditor, metadata, activeEvent }: GridProps) {\r
|
|
1843
|
+
const { prefix: P } = useScopedStyles();\r
|
|
1844
|
+
const {\r
|
|
1845
|
+
type = 'A',\r
|
|
1846
|
+
fieldsToShow = 2,\r
|
|
1847
|
+
textBoxWidth,\r
|
|
1848
|
+
verticalGap,\r
|
|
1849
|
+
entriesCount,\r
|
|
1850
|
+
lightbox,\r
|
|
1851
|
+
imageSize,\r
|
|
1852
|
+
imageDisplay,\r
|
|
1853
|
+
slider,\r
|
|
1854
|
+
sliderTiming,\r
|
|
1855
|
+
direction,\r
|
|
1856
|
+
transition,\r
|
|
1857
|
+
titleColor,\r
|
|
1858
|
+
subtitleColor,\r
|
|
1859
|
+
titleFontFamily,\r
|
|
1860
|
+
titleFontSettings,\r
|
|
1861
|
+
titleFontSize,\r
|
|
1862
|
+
titleLineHeight,\r
|
|
1863
|
+
titleLetterSpacing,\r
|
|
1864
|
+
titleWordSpacing,\r
|
|
1865
|
+
titleTextAppearance,\r
|
|
1866
|
+
subtitleFontFamily,\r
|
|
1867
|
+
subtitleFontSettings,\r
|
|
1868
|
+
subtitleFontSize,\r
|
|
1869
|
+
subtitleLineHeight,\r
|
|
1870
|
+
subtitleLetterSpacing,\r
|
|
1871
|
+
subtitleWordSpacing,\r
|
|
1872
|
+
subtitleTextAppearance,\r
|
|
1873
|
+
} = settings;\r
|
|
1874
|
+
\r
|
|
1875
|
+
const resolvedTitleTextStyle: TextStyles = {\r
|
|
1876
|
+
fontSettings: {\r
|
|
1877
|
+
fontFamily: titleFontFamily,\r
|
|
1878
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,\r
|
|
1879
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',\r
|
|
1880
|
+
},\r
|
|
1881
|
+
fontSize: titleFontSize ?? 0.01,\r
|
|
1882
|
+
lineHeight: titleLineHeight,\r
|
|
1883
|
+
letterSpacing: titleLetterSpacing ?? 0,\r
|
|
1884
|
+
wordSpacing: titleWordSpacing ?? 0,\r
|
|
1885
|
+
textAppearance: titleTextAppearance,\r
|
|
1886
|
+
color: titleColor,\r
|
|
1887
|
+
};\r
|
|
1888
|
+
const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));\r
|
|
1889
|
+
const titleFieldCss = {\r
|
|
1890
|
+
...titleTypographyCss,\r
|
|
1891
|
+
} as React.CSSProperties;\r
|
|
1892
|
+
\r
|
|
1893
|
+
const resolvedSubtitleTextStyle: TextStyles = {\r
|
|
1894
|
+
fontSettings: {\r
|
|
1895
|
+
fontFamily: subtitleFontFamily,\r
|
|
1896
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,\r
|
|
1897
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',\r
|
|
1898
|
+
},\r
|
|
1899
|
+
fontSize: subtitleFontSize ?? 0.01,\r
|
|
1900
|
+
lineHeight: subtitleLineHeight,\r
|
|
1901
|
+
letterSpacing: subtitleLetterSpacing ?? 0,\r
|
|
1902
|
+
wordSpacing: subtitleWordSpacing ?? 0,\r
|
|
1903
|
+
textAppearance: subtitleTextAppearance,\r
|
|
1904
|
+
color: subtitleColor,\r
|
|
1905
|
+
};\r
|
|
1906
|
+
const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));\r
|
|
1907
|
+
const subtitleFieldCss = {\r
|
|
1908
|
+
...subtitleTypographyCss,\r
|
|
1909
|
+
} as React.CSSProperties;\r
|
|
1910
|
+
\r
|
|
1911
|
+
const colorVars = buildColorVars(P, {\r
|
|
1912
|
+
titleColor,\r
|
|
1913
|
+
subtitleColor,\r
|
|
1914
|
+
}, COLOR_VAR_MAP, STATE_KEYS);\r
|
|
1915
|
+
\r
|
|
1916
|
+
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';\r
|
|
1917
|
+
const wrapperStateClasses = \`\${stateClass}\`.trim();\r
|
|
1918
|
+
\r
|
|
1919
|
+
const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;\r
|
|
1920
|
+
\r
|
|
1921
|
+
const cropContent = (content ?? []).slice(0, resEntriesCount);\r
|
|
1922
|
+
\r
|
|
1923
|
+
const imageSizeMap = {\r
|
|
1924
|
+
Small: 0.1,\r
|
|
1925
|
+
Medium: 0.2,\r
|
|
1926
|
+
Big: 0.3,\r
|
|
1927
|
+
} as const;\r
|
|
1928
|
+
\r
|
|
1929
|
+
const size = imageSizeMap[imageSize] ?? 0.2;\r
|
|
1930
|
+
\r
|
|
1931
|
+
const [dir, setDir] = useState('ltr');\r
|
|
1932
|
+
\r
|
|
1933
|
+
const [lightboxOpen, setLightboxOpen] = useState(false);\r
|
|
1934
|
+
const [lightboxImages, setLightboxImages] = useState<string[]>([]);\r
|
|
1935
|
+
const [lightboxIndex, setLightboxIndex] = useState(0);\r
|
|
1936
|
+
const [lightboxOriginRect, setLightboxOriginRect] = useState<AnimRect | null>(null);\r
|
|
1937
|
+
\r
|
|
1938
|
+
const openLightbox = (e: React.MouseEvent<HTMLImageElement>, urls: string[], idx: number) => {\r
|
|
1939
|
+
if (lightbox === 'Off') return;\r
|
|
1940
|
+
const r = e.currentTarget.getBoundingClientRect();\r
|
|
1941
|
+
setLightboxOriginRect({ top: r.top, left: r.left, width: r.width, height: r.height });\r
|
|
1942
|
+
setLightboxImages(urls);\r
|
|
1943
|
+
setLightboxIndex(idx);\r
|
|
1944
|
+
setLightboxOpen(true);\r
|
|
1945
|
+
};\r
|
|
1946
|
+
\r
|
|
1947
|
+
return (\r
|
|
1948
|
+
<>\r
|
|
1949
|
+
<style dangerouslySetInnerHTML={{ __html: getCSS(P) }} />\r
|
|
1950
|
+
<div style={colorVars}>\r
|
|
1951
|
+
<div\r
|
|
1952
|
+
className={\`\${P}-wrapper \${P}-type-\${type} \${wrapperStateClasses}\`.trim()}\r
|
|
1953
|
+
style={{\r
|
|
1954
|
+
gridTemplateColumns: \`repeat(\${fieldsToShow}, 1fr)\`,\r
|
|
1955
|
+
rowGap: scalingValue(verticalGap ?? 0, isEditor),\r
|
|
1956
|
+
}}>\r
|
|
1957
|
+
{cropContent.map((item, index) => (\r
|
|
1958
|
+
<div\r
|
|
1959
|
+
key={index}\r
|
|
1960
|
+
className={\`\${P}-item\`.trim()}\r
|
|
1961
|
+
>\r
|
|
1962
|
+
<div className={\`\${P}-item-image-wrapper\`} style={{ width: scalingValue(size ?? 0, isEditor), height: scalingValue(size ?? 0, isEditor) }}>\r
|
|
1963
|
+
{slider === 'Off'\r
|
|
1964
|
+
?\r
|
|
1965
|
+
<img\r
|
|
1966
|
+
src={item.image[0].url}\r
|
|
1967
|
+
alt={item.image[0].name}\r
|
|
1968
|
+
className={\`\${P}-item-image\`.trim()}\r
|
|
1969
|
+
style={{\r
|
|
1970
|
+
objectFit: imageDisplay === 'Cover' ? 'cover' : 'contain'\r
|
|
1971
|
+
}}\r
|
|
1972
|
+
onClick={(e) => openLightbox(e, item.image.map((i: any) => i.url), 0)}\r
|
|
1973
|
+
/>\r
|
|
1974
|
+
:\r
|
|
1975
|
+
<Splide\r
|
|
1976
|
+
key={\`\${transition}-\${imageSize}-\${direction}-\${sliderTiming}\`}\r
|
|
1977
|
+
className={\`\${P}-item-slider\`}\r
|
|
1978
|
+
options={{\r
|
|
1979
|
+
arrows: false,\r
|
|
1980
|
+
pagination: false,\r
|
|
1981
|
+
drag: false,\r
|
|
1982
|
+
perPage: 1,\r
|
|
1983
|
+
autoplay: true,\r
|
|
1984
|
+
interval: sliderTiming * 1000,\r
|
|
1985
|
+
width: '100%',\r
|
|
1986
|
+
height: '100%',\r
|
|
1987
|
+
speed: 500,\r
|
|
1988
|
+
type: transition === 'Fade' ? 'fade' : 'loop',\r
|
|
1989
|
+
rewind: transition === 'Fade',\r
|
|
1990
|
+
pauseOnHover: false,\r
|
|
1991
|
+
pauseOnFocus: false,\r
|
|
1992
|
+
direction: transition === 'Fade' ? 'ltr' : direction !== 'Random'\r
|
|
1993
|
+
? direction === 'Horizontal'\r
|
|
1994
|
+
? 'ltr'\r
|
|
1995
|
+
: 'ttb'\r
|
|
1996
|
+
: dir,\r
|
|
1997
|
+
}}\r
|
|
1998
|
+
onMoved={(splide) => {\r
|
|
1999
|
+
if (direction !== 'Random' || transition === 'Fade') return;\r
|
|
2000
|
+
const next = Math.random() > 0.5 ? Math.random() > 0.5 ? 'rtl' : 'ltr' : Math.random() > 0.5 ? 'btt' : 'ttb';\r
|
|
2001
|
+
setDir(next);\r
|
|
2002
|
+
\r
|
|
2003
|
+
setTimeout(() => {\r
|
|
2004
|
+
splide.refresh();\r
|
|
2005
|
+
}, 0);\r
|
|
2006
|
+
}}\r
|
|
2007
|
+
>\r
|
|
2008
|
+
{item.image.map((img: { url: string; name?: string }, imgIndex: number) => (\r
|
|
2009
|
+
<SplideSlide key={imgIndex}>\r
|
|
2010
|
+
<img\r
|
|
2011
|
+
src={img.url}\r
|
|
2012
|
+
alt={img.name}\r
|
|
2013
|
+
className={\`\${P}-item-image\`.trim()}\r
|
|
2014
|
+
style={{\r
|
|
2015
|
+
objectFit: imageDisplay === 'Cover' ? 'cover' : 'contain'\r
|
|
2016
|
+
}}\r
|
|
2017
|
+
onClick={(e) => openLightbox(e, item.image.map((i: any) => i.url), imgIndex)}\r
|
|
2018
|
+
/>\r
|
|
2019
|
+
</SplideSlide>\r
|
|
2020
|
+
))}\r
|
|
2021
|
+
</Splide>\r
|
|
2022
|
+
}\r
|
|
2023
|
+
</div>\r
|
|
2024
|
+
<p className={\`\${P}-item-title\`.trim()} style={{ width: \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`, ...titleFieldCss }}>\r
|
|
2025
|
+
{item.title}\r
|
|
2026
|
+
</p>\r
|
|
2027
|
+
{type === 'B' && <p className={\`\${P}-item-subtitle\`.trim()} style={{ width: \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`, ...subtitleFieldCss }}>\r
|
|
2028
|
+
{item.subtitle}\r
|
|
2029
|
+
</p>}\r
|
|
2030
|
+
</div>\r
|
|
2031
|
+
))}\r
|
|
2032
|
+
</div>\r
|
|
2033
|
+
</div>\r
|
|
2034
|
+
{lightboxOpen && typeof document && document.getElementById("grid-component-lightbox-portal") && lightbox === 'On' &&\r
|
|
2035
|
+
createPortal(\r
|
|
2036
|
+
<div data-selection="none">\r
|
|
2037
|
+
<Lightbox\r
|
|
2038
|
+
images={lightboxImages}\r
|
|
2039
|
+
index={lightboxIndex}\r
|
|
2040
|
+
imageDisplay={imageDisplay}\r
|
|
2041
|
+
originRect={lightboxOriginRect}\r
|
|
2042
|
+
onClose={() => setLightboxOpen(false)}\r
|
|
2043
|
+
onPrev={() => setLightboxIndex((prev) => (prev - 1 + lightboxImages.length) % lightboxImages.length)}\r
|
|
2044
|
+
onNext={() => setLightboxIndex((prev) => (prev + 1) % lightboxImages.length)}\r
|
|
2045
|
+
/>\r
|
|
2046
|
+
</div>,\r
|
|
2047
|
+
document.body\r
|
|
2048
|
+
)}\r
|
|
2049
|
+
</>\r
|
|
2050
|
+
);\r
|
|
2051
|
+
}\r
|
|
2052
|
+
\r
|
|
2053
|
+
type GridSettings = {\r
|
|
2054
|
+
type: 'A' | 'B';\r
|
|
2055
|
+
fieldsToShow: number;\r
|
|
2056
|
+
textBoxWidth: number;\r
|
|
2057
|
+
verticalGap: number;\r
|
|
2058
|
+
entriesCount: number;\r
|
|
2059
|
+
lightbox: 'On' | 'Off';\r
|
|
2060
|
+
imageSize: 'Small' | 'Medium' | 'Big';\r
|
|
2061
|
+
imageDisplay: 'Fit' | 'Cover';\r
|
|
2062
|
+
slider: 'On' | 'Off';\r
|
|
2063
|
+
sliderTiming: number;\r
|
|
2064
|
+
direction: 'Horizontal' | 'Vertical' | 'Random',\r
|
|
2065
|
+
transition: 'Fade' | 'Slide',\r
|
|
2066
|
+
titleColor: string;\r
|
|
2067
|
+
subtitleColor: string;\r
|
|
2068
|
+
titleFontFamily: string;\r
|
|
2069
|
+
titleFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
2070
|
+
titleFontSize?: number;\r
|
|
2071
|
+
titleLineHeight?: number;\r
|
|
2072
|
+
titleLetterSpacing?: number;\r
|
|
2073
|
+
titleWordSpacing?: number;\r
|
|
2074
|
+
titleTextAppearance?: TextStyles['textAppearance'];\r
|
|
2075
|
+
subtitleFontFamily: string;\r
|
|
2076
|
+
subtitleFontSettings?: { fontWeight: number; fontStyle: string };\r
|
|
2077
|
+
subtitleFontSize?: number;\r
|
|
2078
|
+
subtitleLineHeight?: number;\r
|
|
2079
|
+
subtitleLetterSpacing?: number;\r
|
|
2080
|
+
subtitleWordSpacing?: number;\r
|
|
2081
|
+
subtitleTextAppearance?: TextStyles['textAppearance'];\r
|
|
2082
|
+
};\r
|
|
2083
|
+
\r
|
|
2084
|
+
type ColorKeys =\r
|
|
2085
|
+
| 'titleColor'\r
|
|
2086
|
+
| 'subtitleColor'\r
|
|
2087
|
+
\r
|
|
2088
|
+
const COLOR_VAR_MAP: Record<ColorKeys, string> = {\r
|
|
2089
|
+
titleColor: 'title-color',\r
|
|
2090
|
+
subtitleColor: 'subtitle-color',\r
|
|
2091
|
+
};\r
|
|
2092
|
+
\r
|
|
2093
|
+
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;\r
|
|
2094
|
+
`,Tn={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:"string",scope:"common",title:"Display",display:{type:"toggle-cycle",enum:["Fit","Cover"]}},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"]}},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"}},titleFontFamily:{type:"string",scope:"common",title:"Font family",display:{type:"font-family-select"}},titleFontSettings:{...Tn.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:{...Tn.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:"Fit",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:[]},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:"Grid Default",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;
|