@cntrl-site/components 1.0.118-alpha.9 → 1.0.119

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.
@@ -1,243 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),bo=require("react"),uo=require("./SvgImage-DFlmxAoL.js"),t=require("./scalingValue-CSHYgTZl.js"),po=require("./buildColorVars-CE2D5cQV.js"),xo=require("./useScopedStyles-Bf6yohVQ.js"),Y=require("./textStylesToCss-CNN3zZTV.js"),go={backgroundColor:"background-color",textColor:"text-color",borderColor:"border-color",iconColor:"icon-color",boxShadowColor:"box-shadow-color",innerBoxShadowColor:"inner-box-shadow-color"},mo=["hover","active"],N={left:"flex-start",center:"center",right:"flex-end"};function wo(o,e){const a=o.currentTarget,l=a.getBoundingClientRect(),c=o.clientY-l.top>l.height/2;a.classList.toggle(`${e}-reveal-from-bottom`,c)}function yo(o,e){const a=o.currentTarget,l=a.getBoundingClientRect(),c=o.clientY<l.top+l.height/2;a.classList.toggle(`${e}-reveal-from-bottom`,c)}function ko(o){const e=`var(--${o}-box-shadow-x, 0) var(--${o}-box-shadow-y, 0) var(--${o}-box-shadow-blur, 0) var(--${o}-box-shadow-spread, 0) var(--${o}-box-shadow-color, transparent)`,a=`inset var(--${o}-inner-box-shadow-x, 0) var(--${o}-inner-box-shadow-y, 0) var(--${o}-inner-box-shadow-blur, 0) var(--${o}-inner-box-shadow-spread, 0) var(--${o}-inner-box-shadow-color, transparent)`,l=`${e}, ${a}`,c=`var(--${o}-box-shadow-x, 0) var(--${o}-box-shadow-y, 0) var(--${o}-box-shadow-blur, 0) var(--${o}-box-shadow-spread, 0) var(--${o}-hover-box-shadow-color, var(--${o}-box-shadow-color, transparent))`,r=`inset var(--${o}-inner-box-shadow-x, 0) var(--${o}-inner-box-shadow-y, 0) var(--${o}-inner-box-shadow-blur, 0) var(--${o}-inner-box-shadow-spread, 0) var(--${o}-hover-inner-box-shadow-color, var(--${o}-inner-box-shadow-color, transparent))`,$=`${c}, ${r}`,s=`var(--${o}-box-shadow-x, 0) var(--${o}-box-shadow-y, 0) var(--${o}-box-shadow-blur, 0) var(--${o}-box-shadow-spread, 0) var(--${o}-active-box-shadow-color, var(--${o}-box-shadow-color, transparent))`,h=`inset var(--${o}-inner-box-shadow-x, 0) var(--${o}-inner-box-shadow-y, 0) var(--${o}-inner-box-shadow-blur, 0) var(--${o}-inner-box-shadow-spread, 0) var(--${o}-active-inner-box-shadow-color, var(--${o}-inner-box-shadow-color, transparent))`,p=`${s}, ${h}`,g=`0 4px 12px rgba(0, 0, 0, 0.15), ${a}`,C=`.${o}-button:focus-visible, a:focus-visible .${o}-button`,V=`.${o}-button:hover, ${C}`,v=f=>`.${o}-hover-effect-${f}:hover, .${o}-hover-effect-${f}:focus-visible, a:focus-visible .${o}-hover-effect-${f}`;return`
2
- .${o}-root {
3
- line-height: 0;
4
- }
5
- .${o}-wrapper {
6
- display: inline-flex;
7
- vertical-align: top;
8
- pointer-events: none;
9
- }
10
- .${o}-button {
11
- display: inline-flex;
12
- align-items: center;
13
- box-sizing: border-box;
14
- border-style: solid;
15
- border-color: var(--${o}-border-color);
16
- background-color: var(--${o}-background-color);
17
- color: var(--${o}-text-color);
18
- -webkit-backdrop-filter: var(--${o}-backdrop-blur, none);
19
- backdrop-filter: var(--${o}-backdrop-blur, none);
20
- cursor: pointer;
21
- font: inherit;
22
- white-space: pre-wrap;
23
- overflow-wrap: anywhere;
24
- word-break: break-word;
25
- user-select: none;
26
- pointer-events: auto;
27
- transition: color 250ms, background-color 250ms, border-color 250ms, transform 250ms, box-shadow 250ms, backdrop-filter 250ms;
28
- box-shadow: ${l};
29
- }
30
- .${o}-wrapper.${o}-editing .${o}-button {
31
- transition: color 250ms, background-color 250ms, border-color 250ms, transform 250ms;
32
- }
33
- ${v("scale-up")},
34
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-scale-up {
35
- transform: scale(1.05);
36
- }
37
- ${v("lift")},
38
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-lift {
39
- transform: translateY(-2px);
40
- box-shadow: ${g};
41
- }
42
- .${o}-hover-effect-reveal,
43
- .${o}-hover-effect-swipe {
44
- position: relative;
45
- overflow: hidden;
46
- }
47
- .${o}-hover-effect-reveal .${o}-button-inner,
48
- .${o}-hover-effect-reveal .${o}-text,
49
- .${o}-hover-effect-reveal .${o}-icon,
50
- .${o}-hover-effect-swipe .${o}-button-inner,
51
- .${o}-hover-effect-swipe .${o}-text,
52
- .${o}-hover-effect-swipe .${o}-icon {
53
- position: relative;
54
- z-index: 1;
55
- }
56
- .${o}-hover-effect-reveal::before {
57
- content: '';
58
- position: absolute;
59
- inset: 0;
60
- background-color: var(--${o}-hover-background-color, var(--${o}-background-color));
61
- pointer-events: none;
62
- z-index: 0;
63
- transform: scaleY(0);
64
- transform-origin: bottom center;
65
- transition: transform 120ms;
66
- }
67
- .${o}-hover-effect-reveal:hover::before,
68
- .${o}-hover-effect-reveal:focus-visible::before,
69
- a:focus-visible .${o}-hover-effect-reveal::before,
70
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-reveal::before {
71
- transform: scaleY(1);
72
- transform-origin: top center;
73
- }
74
- .${o}-hover-effect-reveal.${o}-reveal-from-bottom::before {
75
- transform-origin: top center;
76
- }
77
- .${o}-hover-effect-reveal.${o}-reveal-from-bottom:hover::before,
78
- .${o}-hover-effect-reveal.${o}-reveal-from-bottom:focus-visible::before,
79
- a:focus-visible .${o}-hover-effect-reveal.${o}-reveal-from-bottom::before,
80
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-reveal.${o}-reveal-from-bottom::before {
81
- transform-origin: bottom center;
82
- }
83
- .${o}-hover-effect-swipe::before {
84
- content: '';
85
- position: absolute;
86
- inset: 0;
87
- background-color: var(--${o}-hover-background-color, var(--${o}-background-color));
88
- pointer-events: none;
89
- z-index: 0;
90
- transform: translateX(-100%);
91
- transition: transform 250ms;
92
- }
93
- .${o}-hover-effect-swipe:hover::before,
94
- .${o}-hover-effect-swipe:focus-visible::before,
95
- a:focus-visible .${o}-hover-effect-swipe::before,
96
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-swipe::before {
97
- transform: translateX(0);
98
- }
99
- ${v("reveal")},
100
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-reveal,
101
- ${v("swipe")},
102
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-swipe {
103
- background-color: var(--${o}-background-color);
104
- }
105
- .${o}-hover-effect-content-roll {
106
- position: relative;
107
- overflow: hidden;
108
- align-items: stretch;
109
- }
110
- .${o}-content-roll-wrap {
111
- position: relative;
112
- align-self: stretch;
113
- min-width: 0;
114
- }
115
- .${o}-content-roll-wrap.${o}-icon-text-roll {
116
- flex: 1;
117
- width: 100%;
118
- }
119
- .${o}-content-roll-wrap.${o}-icon-roll,
120
- .${o}-content-roll-wrap.${o}-label-roll {
121
- display: inline-block;
122
- flex: 1;
123
- }
124
- .${o}-content-roll-spacer {
125
- visibility: hidden;
126
- pointer-events: none;
127
- }
128
- .${o}-content-roll-viewport {
129
- position: absolute;
130
- inset: 0;
131
- pointer-events: none;
132
- }
133
- .${o}-content-roll-layer {
134
- position: absolute;
135
- left: 0;
136
- right: 0;
137
- top: 50%;
138
- transform: translateY(-50%);
139
- transition: transform 250ms ease, opacity 250ms ease, top 250ms ease;
140
- opacity: 1;
141
- pointer-events: none;
142
- }
143
- .${o}-content-roll-layer-hover {
144
- top: 0;
145
- transform: translateY(-100%);
146
- opacity: 0;
147
- }
148
- .${o}-hover-effect-content-roll:hover .${o}-content-roll-layer:not(.${o}-content-roll-layer-hover),
149
- .${o}-hover-effect-content-roll:focus-visible .${o}-content-roll-layer:not(.${o}-content-roll-layer-hover),
150
- a:focus-visible .${o}-hover-effect-content-roll .${o}-content-roll-layer:not(.${o}-content-roll-layer-hover),
151
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-content-roll .${o}-content-roll-layer:not(.${o}-content-roll-layer-hover) {
152
- top: 100%;
153
- transform: translateY(0);
154
- opacity: 0;
155
- }
156
- .${o}-hover-effect-content-roll:hover .${o}-content-roll-layer-hover,
157
- .${o}-hover-effect-content-roll:focus-visible .${o}-content-roll-layer-hover,
158
- a:focus-visible .${o}-hover-effect-content-roll .${o}-content-roll-layer-hover,
159
- .${o}-wrapper.${o}-state-hover .${o}-hover-effect-content-roll .${o}-content-roll-layer-hover {
160
- top: 50%;
161
- transform: translateY(-50%);
162
- opacity: 1;
163
- }
164
- ${V} {
165
- background-color: var(--${o}-hover-background-color, var(--${o}-background-color));
166
- color: var(--${o}-hover-text-color, var(--${o}-text-color));
167
- border-color: var(--${o}-hover-border-color, var(--${o}-border-color));
168
- box-shadow: ${$};
169
- }
170
- .${o}-wrapper.${o}-state-hover .${o}-button {
171
- background-color: var(--${o}-hover-background-color, var(--${o}-background-color));
172
- color: var(--${o}-hover-text-color, var(--${o}-text-color));
173
- border-color: var(--${o}-hover-border-color, var(--${o}-border-color));
174
- box-shadow: ${$};
175
- }
176
- .${o}-button:focus,
177
- .${o}-button:focus-visible,
178
- a:focus:has(.${o}-button),
179
- a:focus-visible:has(.${o}-button) {
180
- outline: none;
181
- }
182
- .${o}-button:active,
183
- a:active .${o}-button {
184
- background-color: var(--${o}-active-background-color, var(--${o}-background-color));
185
- color: var(--${o}-active-text-color, var(--${o}-text-color));
186
- border-color: var(--${o}-active-border-color, var(--${o}-border-color));
187
- box-shadow: ${p};
188
- }
189
- .${o}-wrapper.${o}-state-active .${o}-button {
190
- background-color: var(--${o}-active-background-color, var(--${o}-background-color));
191
- color: var(--${o}-active-text-color, var(--${o}-text-color));
192
- border-color: var(--${o}-active-border-color, var(--${o}-border-color));
193
- box-shadow: ${p};
194
- }
195
- .${o}-text {
196
- display: block;
197
- flex: 1;
198
- min-width: 0;
199
- }
200
- .${o}-icon {
201
- display: block;
202
- flex-shrink: 0;
203
- position: relative;
204
- }
205
- .${o}-icon-image {
206
- transition: background-color 250ms;
207
- }
208
- .${o}-button:hover .${o}-icon-image,
209
- .${o}-button:focus-visible .${o}-icon-image,
210
- a:focus-visible .${o}-button .${o}-icon-image,
211
- .${o}-wrapper.${o}-state-hover .${o}-icon-image {
212
- --fill: var(--${o}-hover-icon-color, var(--${o}-icon-color)) !important;
213
- --hover-fill: var(--${o}-hover-icon-color, var(--${o}-icon-color)) !important;
214
- }
215
- .${o}-button:active .${o}-icon-image,
216
- a:active .${o}-button .${o}-icon-image,
217
- .${o}-wrapper.${o}-state-active .${o}-icon-image {
218
- --fill: var(--${o}-active-icon-color, var(--${o}-icon-color)) !important;
219
- --hover-fill: var(--${o}-active-icon-color, var(--${o}-icon-color)) !important;
220
- }
221
- .${o}-icon .${o}-icon-image {
222
- width: 100%;
223
- height: 100%;
224
- }
225
- .${o}-icon-fill {
226
- max-width: 100%;
227
- width: 100%;
228
- height: auto;
229
- }
230
- .${o}-icon-fill .${o}-icon-image {
231
- position: relative;
232
- top: auto;
233
- left: auto;
234
- transform: none;
235
- width: 100%;
236
- height: auto;
237
- }
238
- .${o}-icon-inline {
239
- display: inline-block;
240
- height: calc(1em * var(--${o}-icon-scale, 1));
241
- width: calc(1em * var(--${o}-icon-scale, 1));
242
- }
243
- `}function T(o,e,a="",l,c){const r=e();return n.jsxs("span",{className:`${o}-content-roll-wrap ${a}`.trim(),style:l,children:[n.jsx("span",{className:`${o}-content-roll-spacer`,"aria-hidden":"true",style:c,children:r}),n.jsxs("span",{className:`${o}-content-roll-viewport`,children:[n.jsx("span",{className:`${o}-content-roll-layer`,style:c,children:e()}),n.jsx("span",{className:`${o}-content-roll-layer ${o}-content-roll-layer-hover`,"aria-hidden":"true",style:c,children:e()})]})]})}function M(o,e,a="fill",l=100,c=0,r){if(!e)return null;const $=n.jsx(uo.SvgImage,{url:e,fill:`var(--${o}-icon-color)`,hoverFill:`var(--${o}-icon-color)`,className:`${o}-icon-image`});if(a==="inline")return n.jsx("span",{className:`${o}-icon ${o}-icon-inline`,style:{[`--${o}-icon-scale`]:l/100},"aria-hidden":"true",children:$});if(a==="fixed"&&c>0){const s=t.scalingValue(c,r);return n.jsx("span",{className:`${o}-icon`,style:{width:s,height:s},"aria-hidden":"true",children:$})}return n.jsx("span",{className:`${o}-icon ${o}-icon-fill`,"aria-hidden":"true",children:$})}function So({settings:o,isEditor:e,isPreviewMode:a,activeEvent:l,hasLink:c}){const{prefix:r}=xo.useScopedStyles(),$=bo.useMemo(()=>ko(r),[r]),{type:s="a",label:h="Button",icon:p,alignment:g="center",alignA:C,order:V="text-icon",gap:v=0,iconSize:f=0,iconWidthC:R=0,dimensions:O=!1,padding:m={top:0,right:0,bottom:0,left:0},cornerRadius:q=0,boxShadow:w={top:0,left:0,right:0,bottom:0},boxShadowColor:z="rgba(0, 0, 0, 0)",innerBoxShadow:y={top:0,left:0,right:0,bottom:0},innerBoxShadowColor:H="rgba(0, 0, 0, 0)",stroke:W=0,blur:A=0,backgroundColor:_="#000000",textColor:B="#ffffff",borderColor:D="#ffffff",iconColor:X="#ffffff",hoverEffect:b="none",fontFamily:G,fontSettings:d,fontSize:K,lineHeight:J,letterSpacing:Q=0,wordSpacing:U=0,textAppearance:Z,stateOverrides:E,minWidth:P=0,minHeight:oo=0,width:eo=0,height:ro=0}=o,to=po.buildColorVars(r,{backgroundColor:_,textColor:B,borderColor:D,iconColor:X,boxShadowColor:z,innerBoxShadowColor:H},go,mo,E),no=l&&l!=="default"?`${r}-state-${l}`:"",ao=e&&!a?`${r}-editing`:"",lo=b!=="none"&&(!e||a||l==="hover")?`${r}-hover-effect-${b}`:"",co=b==="reveal"||b==="swipe",k=b==="content-roll",I=b==="reveal"&&(!e||a),so=O===!0,u=s==="a"?C??g:g,x=s==="c",io=s!=="b",$o={fontSettings:{fontFamily:G,fontWeight:(d==null?void 0:d.fontWeight)??400,fontStyle:(d==null?void 0:d.fontStyle)??"normal"},fontSize:K??.01,lineHeight:J,letterSpacing:Q,wordSpacing:U,textAppearance:Z,color:B},vo={...io?Y.omitTextColors(Y.textStylesToCss($o,e)):{},[`--${r}-box-shadow-x`]:t.scalingValue(w.left,e),[`--${r}-box-shadow-y`]:t.scalingValue(w.top,e),[`--${r}-box-shadow-blur`]:t.scalingValue(w.right,e),[`--${r}-box-shadow-spread`]:t.scalingValue(w.bottom,e),[`--${r}-inner-box-shadow-x`]:t.scalingValue(y.left,e),[`--${r}-inner-box-shadow-y`]:t.scalingValue(y.top,e),[`--${r}-inner-box-shadow-blur`]:t.scalingValue(y.right,e),[`--${r}-inner-box-shadow-spread`]:t.scalingValue(y.bottom,e),[`--${r}-backdrop-blur`]:A>0?`blur(${t.scalingValue(A,e)})`:void 0,paddingTop:t.scalingValue(m.top,e),paddingRight:t.scalingValue(m.right,e),paddingBottom:t.scalingValue(m.bottom,e),paddingLeft:t.scalingValue(m.left,e),borderRadius:t.scalingValue(q,e),borderWidth:t.scalingValue(W,e),...x?{}:{justifyContent:N[u],textAlign:u},...x&&!k?{gap:t.scalingValue(v,e)}:{},...so?{width:t.scalingValue(eo,e),height:t.scalingValue(ro,e)}:{minWidth:t.scalingValue(P,e),minHeight:t.scalingValue(oo,e),...x?{width:"100%"}:{}}};let S;const j={display:"inline-flex",alignItems:"center",justifyContent:x?N[u]:N[s==="a"?u:"center"],gap:x?t.scalingValue(v,e):void 0,width:"100%",height:"100%",...s==="a"?{textAlign:u}:{}};if(s==="b"){const i=()=>M(r,p,f>0?"fixed":"fill",100,f,e);S=k?T(r,i,`${r}-icon-roll`,void 0,j):i()}else if(s==="c"){const i=()=>{const L=n.jsx("span",{className:`${r}-text`,style:{textAlign:u},children:h}),F=M(r,p,R>0?"fixed":"fill",100,R,e);return V==="icon-text"?n.jsxs(n.Fragment,{children:[F,L]}):n.jsxs(n.Fragment,{children:[L,F]})};S=k?T(r,i,`${r}-icon-text-roll`,void 0,j):i()}else S=k?T(r,()=>h,`${r}-label-roll`,void 0,j):co?n.jsx("span",{className:`${r}-button-inner`,children:h}):h;const ho=I?i=>wo(i,r):void 0,fo=I?i=>yo(i,r):void 0;return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:$}}),n.jsx("div",{className:`${r}-root`,style:to,children:n.jsx("div",{className:`${r}-wrapper ${no} ${ao}`.trim(),children:n.jsx("div",{className:`${r}-button ${lo}`.trim(),style:vo,onMouseEnter:ho,onMouseLeave:fo,role:"button",tabIndex:c||e&&!a?void 0:0,children:S})})})]})}exports.SimpleButton=So;