@cntrl-site/components 1.0.7 → 1.0.8-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -3
- package/dist/index.mjs +4 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2209,7 +2209,7 @@ type TestimonialsSettings = {
|
|
|
2209
2209
|
}
|
|
2210
2210
|
|
|
2211
2211
|
.${e}-wrapper-autoplay-off {
|
|
2212
|
-
overflow
|
|
2212
|
+
overflow: hidden;
|
|
2213
2213
|
}
|
|
2214
2214
|
|
|
2215
2215
|
.${e}-fade-stack {
|
|
@@ -2314,7 +2314,7 @@ type TestimonialsSettings = {
|
|
|
2314
2314
|
width: 100%;
|
|
2315
2315
|
height: 100%;
|
|
2316
2316
|
}
|
|
2317
|
-
`}const Gs=({settings:e,content:t,isEditor:n,isPreviewMode:o})=>{const{prefix:r}=$.useScopedStyles(),a=t||[],{autoplay:i,delay:u,align:c,width:m,imageMarginTop:l,textMarginTop:A,captionMarginTop:S,imageWidth:g,imageHeight:p,controlsWidth:d,controlsColor:x,controlsHoverColor:h}=e,y=i==="on"&&!o,[_,D]=w.useState(0),[W,E]=w.useState(null),[b,C]=w.useState(!1),F=w.useRef(null),j=w.useMemo(()=>{switch(c){case"center":return"center";case"end":return"flex-end";case"start":default:return"flex-start"}},[c]),M=w.useMemo(()=>{switch(c){case"center":return"center";case"end":return"right";case"start":default:return"left"}},[c]);w.useEffect(()=>{D(0),E(null),C(!1)},[a.length]);const H=a[_],V=W===null?null:a[W],B=G=>{var N,v,q,K,Q;return{fontSettings:{fontFamily:(e==null?void 0:e[`${G}FontFamily`])??"Arial",fontWeight:((N=e==null?void 0:e[`${G}FontSettings`])==null?void 0:N.fontWeight)??400,fontStyle:((v=e==null?void 0:e[`${G}FontSettings`])==null?void 0:v.fontStyle)??"normal"},textAppearance:{textTransform:((q=e==null?void 0:e[`${G}TextAppearance`])==null?void 0:q.textTransform)??"none",textDecoration:((K=e==null?void 0:e[`${G}TextAppearance`])==null?void 0:K.textDecoration)??"none",fontVariant:((Q=e==null?void 0:e[`${G}TextAppearance`])==null?void 0:Q.fontVariant)??"normal"},fontSize:(e==null?void 0:e[`${G}FontSize`])??.01,lineHeight:(e==null?void 0:e[`${G}LineHeight`])??.01,letterSpacing:(e==null?void 0:e[`${G}LetterSpacing`])??0,wordSpacing:(e==null?void 0:e[`${G}WordSpacing`])??0,color:(e==null?void 0:e[`${G}Color`])??"#000000"}},U=B("text"),f=B("caption"),I=a.length>1&&a.some(G=>{var me,N;return(((me=G.text)==null?void 0:me.length)??0)>0||(((N=G.caption)==null?void 0:N.length)??0)>0}),L=w.useRef(null),[k,T]=w.useState(0),[R,Z]=w.useState(0),ae=e.controls??{mode:"Off",icon:null},te=a.length>1,ce=w.useCallback((G,me)=>!te||me===G?G:(F.current&&window.clearTimeout(F.current),E(G),C(!0),F.current=window.setTimeout(()=>{E(null),C(!1),F.current=null},300),me),[te]),P=w.useCallback(()=>{te&&D(G=>ce(G,(G-1+a.length)%a.length))},[te,ce,a.length]),ee=w.useCallback(()=>{te&&D(G=>ce(G,(G+1)%a.length))},[te,ce,a.length]);w.useEffect(()=>{if(!y||!te)return;const G=Math.max(300,Number.isFinite(u*1e3)?u*1e3:0),me=window.setInterval(()=>{D(N=>ce(N,(N+1)%a.length))},G);return()=>{window.clearInterval(me)}},[y,te,ce,a.length,u]),w.useEffect(()=>()=>{F.current&&window.clearTimeout(F.current)},[]);const fe=(G,me)=>{var K,Q,ie,re;const N=me==null?void 0:me.textMinHeightPx,v=me==null?void 0:me.captionMinHeightPx,q=me==null?void 0:me.dataMeasureAttrs;return s.jsxs(s.Fragment,{children:[G.text&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:j,width:"100%"},children:[s.jsx("div",{"data-controls":"textMarginTop",className:`${r}-control`,style:{height:$.scalingValue(A??0,n??!1)}}),s.jsx("div",{...q&&{"data-testimonial-measure":"text"},style:{...Re(U,n),...N&&N>0?{minHeight:N}:{},textAlign:M,pointerEvents:"auto"},children:s.jsx(Mt,{content:G.text})})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:j,width:"100%"},children:[s.jsx("div",{"data-controls":"imageMarginTop",className:`${r}-control`,style:{height:$.scalingValue(l??0,n??!1)}}),s.jsx("div",{style:{width:$.scalingValue(g??0,n??!1),height:$.scalingValue(p??0,n??!1)},children:((K=G.image)==null?void 0:K.url)&&s.jsx("img",{src:(Q=G.image)==null?void 0:Q.url,alt:((ie=G.image)==null?void 0:ie.name)??"",className:`${r}-icon`,style:{objectFit:((re=G.image)==null?void 0:re.objectFit)||"contain"}})})]}),G.caption&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:j,width:"100%"},children:[s.jsx("div",{"data-controls":"captionMarginTop",className:`${r}-control`,style:{height:$.scalingValue(S??0,n??!1)}}),s.jsx("div",{...q?{"data-testimonial-measure":"caption"}:{},style:{...Re(f,n),...v&&v>0?{minHeight:v}:{},textAlign:M,pointerEvents:"auto"},children:s.jsx(Mt,{content:G.caption})})]})]})},de=w.useCallback(G=>{T(G.maxTextPx),Z(G.maxCaptionPx)},[]);if(w.useLayoutEffect(()=>{if(!I){de({maxTextPx:0,maxCaptionPx:0});return}const G=L.current;if(!G)return;const me=()=>{$.readTestimonialTextMeasure(G,de)};me();const N=new ResizeObserver(me);return N.observe(G),()=>{N.disconnect()}},[I,de,t]),!H)return s.jsx(s.Fragment,{});const ge=I?{textMinHeightPx:k,captionMinHeightPx:R}:void 0;return s.jsx(s.Fragment,{children:s.jsxs("div",{className:`${r}-container`,children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:Us(r)}}),s.jsxs("div",{className:he(`${r}-wrapper`,i==="off"&&`${r}-wrapper-autoplay-off`),style:{width:$.scalingValue(m??0,n??!1),alignItems:j},children:[I&&s.jsx("div",{ref:L,"aria-hidden":!0,style:{position:"absolute",left:0,top:0,width:"100%",visibility:"hidden",pointerEvents:"none",zIndex:-1},children:a.map((G,me)=>s.jsx("div",{style:{width:"100%"},children:fe(G,{dataMeasureAttrs:!0})},me))}),s.jsxs("div",{className:`${r}-fade-stack`,children:[V&&b&&s.jsx("div",{className:he(`${r}-fade-item-prev`,`${r}-fade-out`),children:fe(V,ge)}),s.jsx("div",{className:he(`${r}-fade-item-current`,b?`${r}-fade-in`:void 0),children:fe(H,ge)})]})]}),ae.mode==="On"&&s.jsxs("div",{className:`${r}-controls`,children:[s.jsx("div",{className:`${r}-arrow`,style:{width:$.scalingValue(d??.02,n??!1),height:$.scalingValue(d??.02,n??!1),"--arrow-hover-color":h},children:s.jsx("button",{type:"button",className:`${r}-arrow-inner`,onClick:P,disabled:!te,"aria-label":"Previous testimonial",children:ae.icon&&s.jsx(Ke,{url:ae.icon,fill:x,hoverFill:h,className:he(`${r}-arrow-img`,`${r}-mirror`)})})}),s.jsx("div",{className:he(`${r}-arrow`,`${r}-next-arrow`),style:{width:$.scalingValue(d??.02,n??!1),height:$.scalingValue(d??.02,n??!1),"--arrow-hover-color":h},children:s.jsx("button",{type:"button",className:`${r}-arrow-inner`,onClick:ee,disabled:!te,"aria-label":"Next testimonial",children:ae.icon&&s.jsx(Ke,{url:ae.icon,fill:x,hoverFill:h,className:`${r}-arrow-img`})})})]})]})})},Ys=`import cn from 'classnames';
|
|
2317
|
+
`}const Gs=({settings:e,content:t,isEditor:n,isPreviewMode:o})=>{const{prefix:r}=$.useScopedStyles(),a=t||[],{autoplay:i,delay:u,align:c,width:m,imageMarginTop:l,textMarginTop:A,captionMarginTop:S,imageWidth:g,imageHeight:p,controlsWidth:d,controlsColor:x,controlsHoverColor:h}=e,y=i==="on"&&!o,[_,D]=w.useState(0),[W,E]=w.useState(null),[b,C]=w.useState(!1),F=w.useRef(null),j=w.useMemo(()=>{switch(c){case"center":return"center";case"end":return"flex-end";case"start":default:return"flex-start"}},[c]),M=w.useMemo(()=>{switch(c){case"center":return"center";case"end":return"right";case"start":default:return"left"}},[c]);w.useEffect(()=>{D(0),E(null),C(!1)},[a.length]);const H=a[_],V=W===null?null:a[W],B=G=>{var N,v,q,K,Q;return{fontSettings:{fontFamily:(e==null?void 0:e[`${G}FontFamily`])??"Arial",fontWeight:((N=e==null?void 0:e[`${G}FontSettings`])==null?void 0:N.fontWeight)??400,fontStyle:((v=e==null?void 0:e[`${G}FontSettings`])==null?void 0:v.fontStyle)??"normal"},textAppearance:{textTransform:((q=e==null?void 0:e[`${G}TextAppearance`])==null?void 0:q.textTransform)??"none",textDecoration:((K=e==null?void 0:e[`${G}TextAppearance`])==null?void 0:K.textDecoration)??"none",fontVariant:((Q=e==null?void 0:e[`${G}TextAppearance`])==null?void 0:Q.fontVariant)??"normal"},fontSize:(e==null?void 0:e[`${G}FontSize`])??.01,lineHeight:(e==null?void 0:e[`${G}LineHeight`])??.01,letterSpacing:(e==null?void 0:e[`${G}LetterSpacing`])??0,wordSpacing:(e==null?void 0:e[`${G}WordSpacing`])??0,color:(e==null?void 0:e[`${G}Color`])??"#000000"}},U=B("text"),f=B("caption"),I=a.length>1&&a.some(G=>{var me,N;return(((me=G.text)==null?void 0:me.length)??0)>0||(((N=G.caption)==null?void 0:N.length)??0)>0}),L=w.useRef(null),[k,T]=w.useState(0),[R,Z]=w.useState(0),ae=e.controls??{mode:"Off",icon:null},te=a.length>1,ce=w.useCallback((G,me)=>!te||me===G?G:(F.current&&window.clearTimeout(F.current),E(G),C(!0),F.current=window.setTimeout(()=>{E(null),C(!1),F.current=null},300),me),[te]),P=w.useCallback(()=>{te&&D(G=>ce(G,(G-1+a.length)%a.length))},[te,ce,a.length]),ee=w.useCallback(()=>{te&&D(G=>ce(G,(G+1)%a.length))},[te,ce,a.length]);w.useEffect(()=>{if(!y||!te)return;const G=Math.max(300,Number.isFinite(u*1e3)?u*1e3:0),me=window.setInterval(()=>{D(N=>ce(N,(N+1)%a.length))},G);return()=>{window.clearInterval(me)}},[y,te,ce,a.length,u]),w.useEffect(()=>()=>{F.current&&window.clearTimeout(F.current)},[]);const fe=(G,me)=>{var K,Q,ie,re;const N=me==null?void 0:me.textMinHeightPx,v=me==null?void 0:me.captionMinHeightPx,q=me==null?void 0:me.dataMeasureAttrs;return s.jsxs(s.Fragment,{children:[G.text&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:j,width:"100%"},children:[s.jsx("div",{"data-controls":"textMarginTop",className:`${r}-control`,style:{height:$.scalingValue(A??0,n??!1)}}),s.jsx("div",{...q&&{"data-testimonial-measure":"text"},style:{...Re(U,n),...N&&N>0?{minHeight:N}:{},textAlign:M,pointerEvents:"auto"},children:s.jsx(Mt,{content:G.text})})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:j,width:"100%"},children:[s.jsx("div",{"data-controls":"imageMarginTop",className:`${r}-control`,style:{height:$.scalingValue(l??0,n??!1)}}),s.jsx("div",{style:{width:$.scalingValue(g??0,n??!1),height:$.scalingValue(p??0,n??!1)},children:((K=G.image)==null?void 0:K.url)&&s.jsx("img",{src:(Q=G.image)==null?void 0:Q.url,alt:((ie=G.image)==null?void 0:ie.name)??"",className:`${r}-icon`,style:{objectFit:((re=G.image)==null?void 0:re.objectFit)||"contain"}})})]}),G.caption&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:j,width:"100%"},children:[s.jsx("div",{"data-controls":"captionMarginTop",className:`${r}-control`,style:{height:$.scalingValue(S??0,n??!1)}}),s.jsx("div",{...q?{"data-testimonial-measure":"caption"}:{},style:{...Re(f,n),...v&&v>0?{minHeight:v}:{},textAlign:M,pointerEvents:"auto"},children:s.jsx(Mt,{content:G.caption})})]})]})},de=w.useCallback(G=>{T(G.maxTextPx),Z(G.maxCaptionPx)},[]);if(w.useLayoutEffect(()=>{if(!I){de({maxTextPx:0,maxCaptionPx:0});return}const G=L.current;if(!G)return;const me=()=>{$.readTestimonialTextMeasure(G,de)};me();const N=new ResizeObserver(me);return N.observe(G),()=>{N.disconnect()}},[I,de,t]),!H)return s.jsx(s.Fragment,{});const ge=I?{textMinHeightPx:k,captionMinHeightPx:R}:void 0;return s.jsx(s.Fragment,{children:s.jsxs("div",{className:`${r}-container`,children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:Us(r)}}),s.jsxs("div",{className:he(`${r}-wrapper`,i==="off"&&`${r}-wrapper-autoplay-off`),style:{width:$.scalingValue(m??0,n??!1),alignItems:j},children:[I&&s.jsx("div",{ref:L,"aria-hidden":!0,style:{position:"absolute",left:0,top:0,width:"100%",height:"100%",visibility:"hidden",pointerEvents:"none",zIndex:-1},children:a.map((G,me)=>s.jsx("div",{style:{width:"100%"},children:fe(G,{dataMeasureAttrs:!0})},me))}),s.jsxs("div",{className:`${r}-fade-stack`,children:[V&&b&&s.jsx("div",{className:he(`${r}-fade-item-prev`,`${r}-fade-out`),children:fe(V,ge)}),s.jsx("div",{className:he(`${r}-fade-item-current`,b?`${r}-fade-in`:void 0),children:fe(H,ge)})]})]}),ae.mode==="On"&&s.jsxs("div",{className:`${r}-controls`,children:[s.jsx("div",{className:`${r}-arrow`,style:{width:$.scalingValue(d??.02,n??!1),height:$.scalingValue(d??.02,n??!1),"--arrow-hover-color":h},children:s.jsx("button",{type:"button",className:`${r}-arrow-inner`,onClick:P,disabled:!te,"aria-label":"Previous testimonial",children:ae.icon&&s.jsx(Ke,{url:ae.icon,fill:x,hoverFill:h,className:he(`${r}-arrow-img`,`${r}-mirror`)})})}),s.jsx("div",{className:he(`${r}-arrow`,`${r}-next-arrow`),style:{width:$.scalingValue(d??.02,n??!1),height:$.scalingValue(d??.02,n??!1),"--arrow-hover-color":h},children:s.jsx("button",{type:"button",className:`${r}-arrow-inner`,onClick:ee,disabled:!te,"aria-label":"Next testimonial",children:ae.icon&&s.jsx(Ke,{url:ae.icon,fill:x,hoverFill:h,className:`${r}-arrow-img`})})})]})]})})},Ys=`import cn from 'classnames';
|
|
2318
2318
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2319
2319
|
import { CommonComponentProps } from '../props';
|
|
2320
2320
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -2348,7 +2348,7 @@ function getCSS(P: string): string {
|
|
|
2348
2348
|
}
|
|
2349
2349
|
|
|
2350
2350
|
.\${P}-wrapper-autoplay-off {
|
|
2351
|
-
overflow
|
|
2351
|
+
overflow: hidden;
|
|
2352
2352
|
}
|
|
2353
2353
|
|
|
2354
2354
|
.\${P}-fade-stack {
|
|
@@ -2698,6 +2698,7 @@ export const TestimonialSingle = ({ settings, content, isEditor, isPreviewMode }
|
|
|
2698
2698
|
left: 0,
|
|
2699
2699
|
top: 0,
|
|
2700
2700
|
width: '100%',
|
|
2701
|
+
height: '100%',
|
|
2701
2702
|
visibility: 'hidden',
|
|
2702
2703
|
pointerEvents: 'none',
|
|
2703
2704
|
zIndex: -1,
|
package/dist/index.mjs
CHANGED
|
@@ -9746,7 +9746,7 @@ function os(e) {
|
|
|
9746
9746
|
}
|
|
9747
9747
|
|
|
9748
9748
|
.${e}-wrapper-autoplay-off {
|
|
9749
|
-
overflow
|
|
9749
|
+
overflow: hidden;
|
|
9750
9750
|
}
|
|
9751
9751
|
|
|
9752
9752
|
.${e}-fade-stack {
|
|
@@ -10026,6 +10026,7 @@ const rs = ({ settings: e, content: t, isEditor: n, isPreviewMode: o }) => {
|
|
|
10026
10026
|
left: 0,
|
|
10027
10027
|
top: 0,
|
|
10028
10028
|
width: "100%",
|
|
10029
|
+
height: "100%",
|
|
10029
10030
|
visibility: "hidden",
|
|
10030
10031
|
pointerEvents: "none",
|
|
10031
10032
|
zIndex: -1
|
|
@@ -10137,7 +10138,7 @@ function getCSS(P: string): string {
|
|
|
10137
10138
|
}
|
|
10138
10139
|
|
|
10139
10140
|
.\${P}-wrapper-autoplay-off {
|
|
10140
|
-
overflow
|
|
10141
|
+
overflow: hidden;
|
|
10141
10142
|
}
|
|
10142
10143
|
|
|
10143
10144
|
.\${P}-fade-stack {
|
|
@@ -10487,6 +10488,7 @@ export const TestimonialSingle = ({ settings, content, isEditor, isPreviewMode }
|
|
|
10487
10488
|
left: 0,
|
|
10488
10489
|
top: 0,
|
|
10489
10490
|
width: '100%',
|
|
10491
|
+
height: '100%',
|
|
10490
10492
|
visibility: 'hidden',
|
|
10491
10493
|
pointerEvents: 'none',
|
|
10492
10494
|
zIndex: -1,
|