@vacano/ui 1.15.6 → 1.15.8
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/README.md +1 -1
- package/dist/{ToggleGroup-C3ReF8j7.cjs → ToggleGroup-DXq3FgdQ.cjs} +67 -63
- package/dist/ToggleGroup-DXq3FgdQ.cjs.map +1 -0
- package/dist/{ToggleGroup-TWO3UOqH.js → ToggleGroup-Do3q0qhi.js} +837 -833
- package/dist/ToggleGroup-Do3q0qhi.js.map +1 -0
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/{index-GSZAZ6Cz.cjs → index-BUoqL3Q7.cjs} +2 -2
- package/dist/{index-GSZAZ6Cz.cjs.map → index-BUoqL3Q7.cjs.map} +1 -1
- package/dist/{index-Abn5L42P.js → index-B_4jp70c.js} +2 -2
- package/dist/{index-Abn5L42P.js.map → index-B_4jp70c.js.map} +1 -1
- package/dist/index.cjs +99 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +986 -981
- package/dist/index.js.map +1 -1
- package/dist/{keyboard-D8zOi0jU.cjs → keyboard-Cexig8lu.cjs} +3 -3
- package/dist/keyboard-Cexig8lu.cjs.map +1 -0
- package/dist/{keyboard-D00e_brg.js → keyboard-D5qN_1XD.js} +24 -16
- package/dist/keyboard-D5qN_1XD.js.map +1 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +9 -0
- package/dist/lib.js +14 -13
- package/package.json +1 -1
- package/dist/ToggleGroup-C3ReF8j7.cjs.map +0 -1
- package/dist/ToggleGroup-TWO3UOqH.js.map +0 -1
- package/dist/keyboard-D00e_brg.js.map +0 -1
- package/dist/keyboard-D8zOi0jU.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./keyboard-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./keyboard-Cexig8lu.cjs"),H=require("./index-BUoqL3Q7.cjs"),i=require("./X-CI1qRJDP.cjs"),P=require("@emotion/react"),u=require("react"),d=require("./ToggleGroup-DXq3FgdQ.cjs"),C=require("./tooling-Dflq0Y98.cjs"),Fe=require("react-dom"),Le=require("./CircleX-BzaN6v37.cjs"),jt=P.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
&:first-of-type {
|
|
115
115
|
border-top: ${({$variant:e})=>e==="outlined"?`1px solid ${n.COLORS.gray}`:"none"};
|
|
116
116
|
}
|
|
117
|
-
`,
|
|
117
|
+
`,It=d.styled.button`
|
|
118
118
|
display: flex;
|
|
119
119
|
align-items: center;
|
|
120
120
|
justify-content: space-between;
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
&:hover {
|
|
134
134
|
color: ${n.COLORS.black};
|
|
135
135
|
}
|
|
136
|
-
`,
|
|
136
|
+
`,Tt=d.styled.span`
|
|
137
137
|
display: flex;
|
|
138
138
|
align-items: center;
|
|
139
139
|
justify-content: center;
|
|
@@ -154,14 +154,14 @@
|
|
|
154
154
|
font-size: 14px;
|
|
155
155
|
line-height: 1.5;
|
|
156
156
|
color: ${n.COLORS["iron-grey"]};
|
|
157
|
-
`,ne=C.newClassNameGetter("accordion"),Mt=()=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})}),
|
|
157
|
+
`,ne=C.newClassNameGetter("accordion"),Mt=()=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})}),_t=({className:e,classnames:t,defaultValue:o=[],items:r,multiple:l=!1,onChange:a,ref:c,value:s,variant:p="outlined",...x})=>{const[g,h]=u.useState(o),y=s!==void 0,f=y?s:g,S=u.useCallback(b=>{const $=f.includes(b);let m;l?m=$?f.filter(O=>O!==b):[...f,b]:m=$?[]:[b],y||h(m),a==null||a(m)},[f,y,l,a]);return i.jsx(zt,{...x,ref:c,$variant:p,className:ne("container",e),role:"region",children:r.map(b=>{const $=f.includes(b.value);return i.jsxs(Nt,{$variant:p,$disabled:!!b.disabled,className:ne("item",t==null?void 0:t.item),children:[i.jsxs(It,{type:"button","aria-expanded":$,$disabled:!!b.disabled,$expanded:$,disabled:b.disabled,onClick:()=>S(b.value),className:ne("trigger",t==null?void 0:t.trigger),children:[b.title,i.jsx(Tt,{$expanded:$,className:ne("icon",t==null?void 0:t.icon),children:i.jsx(Mt,{})})]}),i.jsx(At,{$expanded:$,children:i.jsx(Pt,{children:i.jsx(Bt,{className:ne("content",t==null?void 0:t.content),children:b.content})})})]},b.value)})})},Dt={none:"0",sm:"8px",md:"12px",lg:"16px",full:"9999px"},Ft={normal:n.COLORS.black,success:n.COLORS.green,warning:n.COLORS.yellow,danger:n.COLORS.red},Gt=d.styled.div`
|
|
158
158
|
display: flex;
|
|
159
159
|
align-items: ${({$center:e})=>e?"center":"flex-start"};
|
|
160
160
|
gap: 12px;
|
|
161
161
|
padding: 16px;
|
|
162
|
-
border-radius: ${({$radius:e})=>
|
|
162
|
+
border-radius: ${({$radius:e})=>Dt[e]};
|
|
163
163
|
background-color: ${n.COLORS.gray};
|
|
164
|
-
`,
|
|
164
|
+
`,Xt=d.styled.div`
|
|
165
165
|
flex-shrink: 0;
|
|
166
166
|
display: flex;
|
|
167
167
|
align-items: center;
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
width: 28px;
|
|
186
186
|
height: 28px;
|
|
187
187
|
border-radius: 50%;
|
|
188
|
-
background-color: ${({$variant:e})=>
|
|
188
|
+
background-color: ${({$variant:e})=>Ft[e]};
|
|
189
189
|
color: ${n.COLORS.white};
|
|
190
190
|
}
|
|
191
191
|
|
|
@@ -193,13 +193,13 @@
|
|
|
193
193
|
width: 16px;
|
|
194
194
|
height: 16px;
|
|
195
195
|
}
|
|
196
|
-
`,
|
|
196
|
+
`,Yt=d.styled.div`
|
|
197
197
|
display: flex;
|
|
198
198
|
flex-direction: column;
|
|
199
199
|
gap: 2px;
|
|
200
200
|
flex: 1;
|
|
201
201
|
min-width: 0;
|
|
202
|
-
`,
|
|
202
|
+
`,Ht=d.styled.div`
|
|
203
203
|
font-size: 14px;
|
|
204
204
|
font-weight: 600;
|
|
205
205
|
color: ${n.COLORS.black};
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
font-size: 14px;
|
|
209
209
|
color: ${n.COLORS["iron-grey"]};
|
|
210
210
|
line-height: 1.5;
|
|
211
|
-
`,xe=C.newClassNameGetter("alert"),Wt=({className:e,classnames:t,description:o,icon:r,radius:l="lg",ref:a,title:c,variant:s="normal",...p})=>i.jsxs(Gt,{...p,ref:a,role:"alert",className:xe("container",e),$radius:l,$center:!o,children:[r&&i.jsx(
|
|
211
|
+
`,xe=C.newClassNameGetter("alert"),Wt=({className:e,classnames:t,description:o,icon:r,radius:l="lg",ref:a,title:c,variant:s="normal",...p})=>i.jsxs(Gt,{...p,ref:a,role:"alert",className:xe("container",e),$radius:l,$center:!o,children:[r&&i.jsx(Xt,{$variant:s,className:xe("icon",t==null?void 0:t.icon),children:i.jsx("span",{children:r})}),i.jsxs(Yt,{children:[c&&i.jsx(Ht,{className:xe("title",t==null?void 0:t.title),children:c}),o&&i.jsx(Ut,{className:xe("description",t==null?void 0:t.description),children:o})]})]}),qt=e=>{var o,r;const t=e.trim().split(/\s+/);if(t.length>=2){const l=((o=t[0])==null?void 0:o[0])??"",a=((r=t[t.length-1])==null?void 0:r[0])??"";return(l+a).toUpperCase()}return e.slice(0,2).toUpperCase()},ge={sm:32,md:40,lg:56},gt={sm:12,md:14,lg:20},Ge={sm:18,md:22,lg:30},Zt={sm:"6px",md:"10px",lg:"14px",full:"50%"},ke={default:{background:n.COLORS.gray,color:n.COLORS.black,border:n.COLORS.gray},primary:{background:n.COLORS["baltic-blue"],color:n.COLORS.white,border:n.COLORS["baltic-blue"]},success:{background:n.COLORS.green,color:n.COLORS.white,border:n.COLORS.green},warning:{background:n.COLORS.yellow,color:n.COLORS.black,border:n.COLORS.yellow},danger:{background:n.COLORS.red,color:n.COLORS.white,border:n.COLORS.red}},Kt=d.styled.div`
|
|
212
212
|
position: relative;
|
|
213
213
|
display: inline-flex;
|
|
214
214
|
align-items: center;
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
overflow: hidden;
|
|
217
217
|
width: ${({$size:e})=>ge[e]}px;
|
|
218
218
|
height: ${({$size:e})=>ge[e]}px;
|
|
219
|
-
border-radius: ${({$radius:e})=>
|
|
219
|
+
border-radius: ${({$radius:e})=>Zt[e]};
|
|
220
220
|
background-color: ${({$color:e})=>ke[e].background};
|
|
221
221
|
color: ${({$color:e})=>ke[e].color};
|
|
222
222
|
font-size: ${({$size:e})=>gt[e]}px;
|
|
@@ -227,11 +227,11 @@
|
|
|
227
227
|
box-sizing: border-box;
|
|
228
228
|
${({$bordered:e,$color:t})=>e&&`box-shadow: 0 0 0 2px #fff, 0 0 0 4px ${ke[t].border};`}
|
|
229
229
|
${({$disabled:e})=>e&&"opacity: 0.5; pointer-events: none;"}
|
|
230
|
-
`,
|
|
230
|
+
`,Vt=d.styled.img`
|
|
231
231
|
width: 100%;
|
|
232
232
|
height: 100%;
|
|
233
233
|
object-fit: cover;
|
|
234
|
-
`,
|
|
234
|
+
`,Xe=d.styled.span`
|
|
235
235
|
display: inline-flex;
|
|
236
236
|
align-items: center;
|
|
237
237
|
justify-content: center;
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
}
|
|
243
243
|
`,Qt=d.styled.span`
|
|
244
244
|
letter-spacing: 0.5px;
|
|
245
|
-
`,ie=C.newClassNameGetter("avatar"),xt=({bordered:e=!1,className:t,classnames:o,color:r="default",disabled:l=!1,icon:a,name:c,radius:s="full",ref:p,size:x="md",src:g,...h})=>{const[y,f]=u.useState(!1),S=g&&!y;return i.jsx(
|
|
245
|
+
`,ie=C.newClassNameGetter("avatar"),xt=({bordered:e=!1,className:t,classnames:o,color:r="default",disabled:l=!1,icon:a,name:c,radius:s="full",ref:p,size:x="md",src:g,...h})=>{const[y,f]=u.useState(!1),S=g&&!y;return i.jsx(Kt,{...h,ref:p,className:ie("container",t),$size:x,$radius:s,$color:r,$bordered:e,$disabled:l,children:S?i.jsx(Vt,{className:ie("image",o==null?void 0:o.image),src:g,alt:c||"",onError:()=>f(!0)}):a?i.jsx(Xe,{className:ie("fallback",o==null?void 0:o.fallback),$size:x,children:a}):c?i.jsx(Qt,{className:ie("initials",o==null?void 0:o.initials),children:qt(c)}):i.jsx(Xe,{className:ie("fallback",o==null?void 0:o.fallback),$size:x,children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})})})})},Jt=d.styled.div`
|
|
246
246
|
display: inline-flex;
|
|
247
247
|
align-items: center;
|
|
248
248
|
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
font-weight: 600;
|
|
263
263
|
line-height: 1;
|
|
264
264
|
flex-shrink: 0;
|
|
265
|
-
`,
|
|
265
|
+
`,Ye=C.newClassNameGetter("avatar-group"),to=({children:e,className:t,classnames:o,max:r=5,ref:l,size:a="md",...c})=>{const s=u.Children.toArray(e).filter(u.isValidElement),p=s.slice(0,r),x=s.length-r;return i.jsxs(Jt,{...c,ref:l,className:Ye("container",t),$size:a,children:[p.map(g=>u.isValidElement(g)?u.cloneElement(g,{size:a}):g),x>0&&i.jsxs(eo,{className:Ye("count",o==null?void 0:o.count),$size:a,children:["+",x]})]})},oo={default:{bg:n.COLORS.black,text:n.COLORS.white,border:n.COLORS.black,flatBg:n.COLORS.gray},success:{bg:n.COLORS.green,text:n.COLORS.white,border:n.COLORS.green,flatBg:"#dcfce7"},warning:{bg:n.COLORS.yellow,text:n.COLORS.black,border:n.COLORS.yellow,flatBg:"#fef9c3"},danger:{bg:n.COLORS.red,text:n.COLORS.white,border:n.COLORS.red,flatBg:"#fee2e2"}},te={sm:{minWidth:16,height:16,fontSize:10,padding:"0 4px",dotSize:8},md:{minWidth:20,height:20,fontSize:11,padding:"0 5px",dotSize:10},lg:{minWidth:24,height:24,fontSize:12,padding:"0 6px",dotSize:12}},ro=(e,t)=>{const o=t==="circle"?"10%":"0%";switch(e){case"top-right":return`top: 0; right: 0; transform: translate(50%, -50%) translate(-${o}, ${o});`;case"top-left":return`top: 0; left: 0; transform: translate(-50%, -50%) translate(${o}, ${o});`;case"bottom-right":return`bottom: 0; right: 0; transform: translate(50%, 50%) translate(-${o}, -${o});`;case"bottom-left":return`bottom: 0; left: 0; transform: translate(-50%, 50%) translate(${o}, -${o});`}},no=(e,t)=>{const o=oo[t];switch(e){case"solid":return`background-color: ${o.bg}; color: ${o.text};`;case"flat":return`background-color: ${o.flatBg}; color: ${t==="default"?n.COLORS.black:o.bg};`;case"bordered":return`background-color: transparent; color: ${o.border}; border: 1.5px solid ${o.border};`}},io=d.styled.div`
|
|
266
266
|
position: relative;
|
|
267
267
|
display: inline-flex;
|
|
268
268
|
`,lo=d.styled.span`
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
opacity: 0;
|
|
304
304
|
transform: scale(0);
|
|
305
305
|
`}
|
|
306
|
-
`,
|
|
306
|
+
`,He=C.newClassNameGetter("badge"),ao=({children:e,className:t,classnames:o,color:r="default",content:l,dot:a=!1,invisible:c=!1,placement:s="top-right",ref:p,shape:x="rectangle",showOutline:g=!0,size:h="md",variant:y="solid",...f})=>i.jsxs(io,{...f,ref:p,className:He("container",t),children:[e,i.jsx(lo,{className:He("badge",o==null?void 0:o.badge),$color:r,$dot:a,$invisible:c,$placement:s,$shape:x,$showOutline:g,$size:h,$variant:y,children:!a&&l})]}),so=({children:e,...t})=>i.jsx("li",{...t,children:e}),ee={sm:{fontSize:12,gap:4,padding:"4px 8px"},md:{fontSize:14,gap:6,padding:"6px 12px"},lg:{fontSize:16,gap:8,padding:"8px 16px"}},co=d.styled.nav`
|
|
307
307
|
display: inline-flex;
|
|
308
308
|
align-items: center;
|
|
309
309
|
${({$variant:e,$size:t})=>{const{padding:o}=ee[t];switch(e){case"solid":return`
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
background-color: ${n.COLORS.gray};
|
|
380
380
|
color: ${n.COLORS.black};
|
|
381
381
|
}
|
|
382
|
-
`,he=C.newClassNameGetter("breadcrumbs"),ho=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 18 6-6-6-6"})}),fo=({children:e,className:t,classnames:o,disabled:r=!1,itemsAfterCollapse:l=1,itemsBeforeCollapse:a=1,maxItems:c,ref:s,separator:p,size:x="md",variant:g="light",...h})=>{const y=u.Children.toArray(e).filter(O=>u.isValidElement(O)),f=y.length,S=c!==void 0&&f>c,b=O=>i.jsx(go,{className:he("separator",o==null?void 0:o.separator),$size:x,children:p||i.jsx(ho,{})},O),$=(O,w,k)=>{const{current:z,disabled:j,href:L,startContent:R,endContent:E}=O.props,v=z||k,
|
|
382
|
+
`,he=C.newClassNameGetter("breadcrumbs"),ho=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 18 6-6-6-6"})}),fo=({children:e,className:t,classnames:o,disabled:r=!1,itemsAfterCollapse:l=1,itemsBeforeCollapse:a=1,maxItems:c,ref:s,separator:p,size:x="md",variant:g="light",...h})=>{const y=u.Children.toArray(e).filter(O=>u.isValidElement(O)),f=y.length,S=c!==void 0&&f>c,b=O=>i.jsx(go,{className:he("separator",o==null?void 0:o.separator),$size:x,children:p||i.jsx(ho,{})},O),$=(O,w,k)=>{const{current:z,disabled:j,href:L,startContent:R,endContent:E}=O.props,v=z||k,I=r||j&&!v;return i.jsxs(Ue,{$size:x,$current:v,$disabled:!!I,children:[i.jsxs(uo,{as:L&&!v?"a":"span",href:L&&!v?L:void 0,$current:v,$disabled:!!I,children:[R,O.props.children,E]}),!k&&b(`sep-${w}`)]},w)},m=()=>{if(S){const O=y.slice(0,a),w=y.slice(f-l);return i.jsxs(i.Fragment,{children:[O.map((k,z)=>$(k,z,!1)),i.jsxs(Ue,{$size:x,$current:!1,$disabled:!1,children:[i.jsx(xo,{className:he("ellipsis",o==null?void 0:o.ellipsis),"aria-label":"Show more",children:"..."}),b("sep-ellipsis")]}),w.map((k,z)=>{const j=f-l+z;return $(k,j,j===f-1)})]})}return y.map((O,w)=>$(O,w,w===f-1))};return i.jsx(co,{...h,ref:s,className:he("container",t),$variant:g,$size:x,"aria-label":"Breadcrumbs",children:i.jsx(po,{className:he("list",o==null?void 0:o.list),$size:x,children:m()})})},We={none:"none",sm:`0 1px 2px ${n.alpha(n.COLORS.black,5)}`,md:`0 4px 14px ${n.alpha(n.COLORS.black,10)}`,lg:`0 10px 30px ${n.alpha(n.COLORS.black,15)}`},yo={none:"0",sm:"8px",md:"12px",lg:"16px"},bo=d.styled.div`
|
|
383
383
|
position: relative;
|
|
384
384
|
display: flex;
|
|
385
385
|
flex-direction: column;
|
|
@@ -443,10 +443,10 @@
|
|
|
443
443
|
`,Oo=C.newClassNameGetter("card"),wo=({blurred:e=!1,border:t=!1,children:o,className:r,disabled:l=!1,footerBlurred:a=!1,fullWidth:c=!1,hoverable:s=!1,pressable:p=!1,radius:x="lg",ref:g,shadow:h="md",...y})=>{const f=typeof h=="boolean"?h?"md":"none":h;return i.jsx(bo,{...y,ref:g,className:Oo("container",r),$blurred:e,$border:t,$disabled:l,$footerBlurred:a,$fullWidth:c,$hoverable:s,$pressable:p,$radius:x,$shadow:f,tabIndex:p&&!l?0:void 0,role:p?"button":void 0,children:o})},vo=C.newClassNameGetter("card"),Co=({children:e,className:t,ref:o,...r})=>i.jsx(So,{...r,ref:o,className:vo("body",t),children:e}),Ro=C.newClassNameGetter("card"),Lo=({blurred:e=!1,children:t,className:o,ref:r,...l})=>i.jsx(mo,{...l,ref:r,className:Ro("footer",o),$blurred:e,children:t}),ko=C.newClassNameGetter("card"),jo=({children:e,className:t,ref:o,...r})=>i.jsx($o,{...r,ref:o,className:ko("header",t),children:e}),Eo="Confirm",zo="Cancel",No=P.keyframes`
|
|
444
444
|
from { opacity: 0; }
|
|
445
445
|
to { opacity: 1; }
|
|
446
|
-
`,
|
|
446
|
+
`,Io=P.keyframes`
|
|
447
447
|
from { opacity: 1; }
|
|
448
448
|
to { opacity: 0; }
|
|
449
|
-
`,
|
|
449
|
+
`,To=P.keyframes`
|
|
450
450
|
from {
|
|
451
451
|
opacity: 0;
|
|
452
452
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -467,10 +467,10 @@
|
|
|
467
467
|
`,Po=d.styled.div`
|
|
468
468
|
position: fixed;
|
|
469
469
|
inset: 0;
|
|
470
|
-
z-index:
|
|
470
|
+
z-index: ${n.Z_INDEX.confirmation};
|
|
471
471
|
background-color: rgba(0, 0, 0, 0.15);
|
|
472
472
|
backdrop-filter: blur(2px);
|
|
473
|
-
animation: ${({$isExiting:e})=>e?
|
|
473
|
+
animation: ${({$isExiting:e})=>e?Io:No} 0.2s ease-out forwards;
|
|
474
474
|
`,Bo=d.styled.div`
|
|
475
475
|
position: fixed;
|
|
476
476
|
bottom: 24px;
|
|
@@ -485,40 +485,40 @@
|
|
|
485
485
|
box-shadow:
|
|
486
486
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
487
487
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
488
|
-
animation: ${({$isExiting:e})=>e?Ao:
|
|
489
|
-
z-index:
|
|
488
|
+
animation: ${({$isExiting:e})=>e?Ao:To} 0.2s ease-out forwards;
|
|
489
|
+
z-index: ${n.Z_INDEX.confirmationBar};
|
|
490
490
|
`,Mo=d.styled.p`
|
|
491
491
|
margin: 0;
|
|
492
492
|
font-size: 14px;
|
|
493
493
|
color: ${n.COLORS.black};
|
|
494
494
|
white-space: nowrap;
|
|
495
|
-
`,
|
|
495
|
+
`,_o=d.styled.div`
|
|
496
496
|
display: flex;
|
|
497
497
|
align-items: center;
|
|
498
498
|
gap: 8px;
|
|
499
|
-
`,
|
|
499
|
+
`,Do=({confirmation:e,onDone:t})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(!1),{message:c,onConfirm:s,onCancel:p,options:x}=e,g=x.confirmLabel||Eo,h=x.cancelLabel||zo,y=u.useCallback(b=>{r(!0),setTimeout(()=>{b==null||b(),t()},200)},[t]),f=u.useCallback(async()=>{const b=s();if(b instanceof Promise){a(!0);try{await b}finally{a(!1)}}y()},[y,s]),S=u.useCallback(()=>{l||y(p)},[y,l,p]);return u.useEffect(()=>{const b=$=>{$.key==="Escape"&&!l&&S()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[S,l]),i.jsxs(i.Fragment,{children:[i.jsx(Po,{$isExiting:o,onClick:S}),i.jsxs(Bo,{$isExiting:o,children:[i.jsx(Mo,{children:c}),i.jsxs(_o,{children:[i.jsx(d.Button,{variant:"system",size:"compact",onClick:S,disabled:l,children:h}),i.jsx(d.Button,{variant:"danger",size:"compact",onClick:f,loading:l,children:g})]})]})]})},ht=u.createContext(null),Fo=()=>{},Go=({children:e})=>{const[t,o]=u.useState(null),r=u.useCallback((a,c,s,p)=>{o({open:!0,message:a,onConfirm:c,onCancel:s||Fo,options:p||{}})},[]),l=u.useCallback(()=>{o(null)},[]);return i.jsxs(ht.Provider,{value:{show:r,hide:l},children:[e,t&&i.jsx(Do,{confirmation:t,onDone:l})]})},Xo=()=>{const e=u.useContext(ht);if(!e)throw new Error("useConfirmation must be used within ConfirmationProvider");return e},le={sm:`${n.BREAKPOINTS.sm}px`,md:`${n.BREAKPOINTS.md}px`,lg:`${n.BREAKPOINTS.lg}px`,xl:`${n.BREAKPOINTS.xl}px`,"2xl":`${n.BREAKPOINTS["2xl"]}px`},Yo=d.styled.div`
|
|
500
500
|
width: 100%;
|
|
501
501
|
|
|
502
|
-
${
|
|
502
|
+
${H.mediaUp("sm")} {
|
|
503
503
|
max-width: ${le.sm};
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
${
|
|
506
|
+
${H.mediaUp("md")} {
|
|
507
507
|
max-width: ${le.md};
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
${
|
|
510
|
+
${H.mediaUp("lg")} {
|
|
511
511
|
max-width: ${le.lg};
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
-
${
|
|
514
|
+
${H.mediaUp("xl")} {
|
|
515
515
|
max-width: ${le.xl};
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
${
|
|
518
|
+
${H.mediaUp("2xl")} {
|
|
519
519
|
max-width: ${le["2xl"]};
|
|
520
520
|
}
|
|
521
|
-
`,
|
|
521
|
+
`,Ho=C.newClassNameGetter("container"),Uo=({children:e,className:t,ref:o,...r})=>i.jsx(Yo,{...r,ref:o,className:Ho("container",t),children:e}),qe=(e,t)=>new Intl.DateTimeFormat(t,{year:"numeric",month:"long"}).format(e),Wo=d.styled.span`
|
|
522
522
|
display: inline-flex;
|
|
523
523
|
align-items: baseline;
|
|
524
524
|
gap: 5px;
|
|
@@ -527,14 +527,14 @@
|
|
|
527
527
|
color: ${n.COLORS["iron-grey"]};
|
|
528
528
|
`,qo=d.styled.span`
|
|
529
529
|
font-weight: 500;
|
|
530
|
-
`,
|
|
530
|
+
`,Zo=d.styled.span``,ae=C.newClassNameGetter("date-range"),Ko=({className:e,classnames:t,from:o,locale:r="en",presentLabel:l="Present Time",ref:a,to:c,...s})=>i.jsxs(Wo,{...s,ref:a,className:ae("container",e),children:[i.jsx(qo,{className:ae("hash",t==null?void 0:t.hash),children:"#"}),i.jsx("span",{className:ae("from",t==null?void 0:t.from),children:qe(o,r)}),i.jsx(Zo,{className:ae("separator",t==null?void 0:t.separator),children:"—"}),i.jsx("span",{className:ae("to",t==null?void 0:t.to),children:c?qe(c,r):l})]}),Vo=d.styled.div`
|
|
531
531
|
display: flex;
|
|
532
532
|
flex-direction: row;
|
|
533
533
|
align-items: center;
|
|
534
534
|
gap: 8px;
|
|
535
535
|
margin-top: ${e=>e.$spacing}px;
|
|
536
536
|
margin-bottom: ${e=>e.$spacing}px;
|
|
537
|
-
`,
|
|
537
|
+
`,Ze=d.styled.div`
|
|
538
538
|
flex: 1;
|
|
539
539
|
height: 1px;
|
|
540
540
|
background-color: ${n.COLORS.gray};
|
|
@@ -542,7 +542,7 @@
|
|
|
542
542
|
font-size: 12px;
|
|
543
543
|
color: ${n.COLORS["iron-grey"]};
|
|
544
544
|
white-space: nowrap;
|
|
545
|
-
`,fe=C.newClassNameGetter("divider"),Jo=({children:e,className:t,classnames:o,ref:r,spacing:l=8,...a})=>i.jsxs(
|
|
545
|
+
`,fe=C.newClassNameGetter("divider"),Jo=({children:e,className:t,classnames:o,ref:r,spacing:l=8,...a})=>i.jsxs(Vo,{...a,ref:r,className:fe("container",t),$spacing:l,children:[i.jsx(Ze,{className:fe("line",o==null?void 0:o.line)}),e&&i.jsxs(i.Fragment,{children:[i.jsx(Qo,{className:fe("label",o==null?void 0:o.label),children:e}),i.jsx(Ze,{className:fe("line",o==null?void 0:o.line)})]})]}),er={left:n.KEYFRAMES.slideInLeft,right:n.KEYFRAMES.slideInRight,top:n.KEYFRAMES.slideInTop,bottom:n.KEYFRAMES.slideInBottom},tr=(e,t)=>{switch(e){case"left":return`
|
|
546
546
|
top: 0;
|
|
547
547
|
left: 0;
|
|
548
548
|
height: 100%;
|
|
@@ -564,18 +564,17 @@
|
|
|
564
564
|
height: ${t};
|
|
565
565
|
`}},or=d.styled.div`
|
|
566
566
|
position: fixed;
|
|
567
|
-
z-index:
|
|
567
|
+
z-index: ${n.Z_INDEX.modal};
|
|
568
568
|
background-color: ${n.COLORS.white};
|
|
569
569
|
box-shadow: 0 4px 24px ${n.alpha(n.COLORS.black,20)};
|
|
570
570
|
${e=>tr(e.$position,e.$size)}
|
|
571
571
|
animation: ${e=>er[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
572
|
-
`,rr=C.newClassNameGetter("drawer"),nr=({animated:e,children:t,className:o,open:r,position:l="right",ref:a,size:c="400px",...s})=>r?
|
|
572
|
+
`,rr=C.newClassNameGetter("drawer"),nr=({animated:e,children:t,className:o,open:r,position:l="right",ref:a,size:c="400px",...s})=>r?Fe.createPortal(i.jsx(or,{...s,ref:a,className:rr("container",o),$animated:!!e,$position:l,$size:c,children:t}),document.body):null,ir=d.styled.div`
|
|
573
573
|
position: relative;
|
|
574
574
|
display: inline-block;
|
|
575
575
|
`,lr=d.styled.div`
|
|
576
576
|
cursor: pointer;
|
|
577
577
|
`,ft=`
|
|
578
|
-
z-index: 100;
|
|
579
578
|
min-width: 160px;
|
|
580
579
|
padding: 8px;
|
|
581
580
|
background-color: ${n.COLORS.white};
|
|
@@ -586,6 +585,7 @@
|
|
|
586
585
|
position: absolute;
|
|
587
586
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
588
587
|
${({$align:e})=>e==="left"?"left: 0;":"right: 0;"}
|
|
588
|
+
z-index: ${n.Z_INDEX.dropdown};
|
|
589
589
|
${ft}
|
|
590
590
|
opacity: ${({$open:e})=>e?1:0};
|
|
591
591
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
@@ -596,6 +596,7 @@
|
|
|
596
596
|
visibility 0.15s;
|
|
597
597
|
`,dr=d.styled.div`
|
|
598
598
|
position: fixed;
|
|
599
|
+
z-index: ${n.Z_INDEX.portalDropdown};
|
|
599
600
|
${ft}
|
|
600
601
|
opacity: ${({$open:e})=>e?1:0};
|
|
601
602
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
@@ -604,7 +605,7 @@
|
|
|
604
605
|
opacity 0.15s ease,
|
|
605
606
|
transform 0.15s ease,
|
|
606
607
|
visibility 0.15s;
|
|
607
|
-
`,ye=C.newClassNameGetter("dropdown"),be=4,sr=100,cr=({align:e="left",autoClose:t=!0,children:o,className:r,classnames:l,onClose:a,onOpen:c,open:s,portalRenderNode:p,ref:x,trigger:g,...h})=>{const[y,f]=u.useState(!1),[S,b]=u.useState({top:0,left:0}),[$,m]=u.useState("bottom"),O=u.useRef(null),w=u.useRef(null),k=u.useRef(null),z=s!==void 0,j=z?s:y,L=u.useCallback(()=>{var
|
|
608
|
+
`,ye=C.newClassNameGetter("dropdown"),be=4,sr=100,cr=({align:e="left",autoClose:t=!0,children:o,className:r,classnames:l,onClose:a,onOpen:c,open:s,portalRenderNode:p,ref:x,trigger:g,...h})=>{const[y,f]=u.useState(!1),[S,b]=u.useState({top:0,left:0}),[$,m]=u.useState("bottom"),O=u.useRef(null),w=u.useRef(null),k=u.useRef(null),z=s!==void 0,j=z?s:y,L=u.useCallback(()=>{var D,F;if(!w.current)return;const N=w.current.getBoundingClientRect(),M=((D=k.current)==null?void 0:D.offsetHeight)??sr,X=((F=k.current)==null?void 0:F.offsetWidth)??160,_=window.innerHeight-N.bottom-be,U=N.top-be,W=_<M&&U>_?"top":"bottom";if(m(W),p){let q;e==="left"?q=N.left:q=N.right-X;const kt=W==="bottom"?N.bottom+be:N.top-M-be;b({top:kt,left:q})}},[e,p]),R=u.useCallback(()=>{z?j?a==null||a():c==null||c():f(N=>{const M=!N;return M?c==null||c():a==null||a(),M})},[z,j,a,c]),E=u.useCallback(()=>{z||f(!1),a==null||a()},[z,a]),v=u.useCallback(()=>{t&&E()},[t,E]);u.useLayoutEffect(()=>{j&&L()},[j,L]),u.useEffect(()=>{const N=U=>{const W=U.target,D=O.current&&!O.current.contains(W),F=k.current&&!k.current.contains(W);p?D&&F&&E():D&&E()},M=U=>{U.key==="Escape"&&E()},X=()=>{j&&p&&L()},_=()=>{j&&p&&L()};return j&&(document.addEventListener("mousedown",N),document.addEventListener("keydown",M),p&&(window.addEventListener("scroll",X,!0),window.addEventListener("resize",_))),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",M),window.removeEventListener("scroll",X,!0),window.removeEventListener("resize",_)}},[j,E,p,L]);const I=p?Fe.createPortal(i.jsx(dr,{ref:k,$open:j,$position:$,className:ye("content",l==null?void 0:l.content),style:{top:S.top,left:S.left},onClick:v,children:o}),p):i.jsx(ar,{ref:k,$align:e,$open:j,$position:$,className:ye("content",l==null?void 0:l.content),onClick:v,children:o});return i.jsxs(ir,{...h,ref:x??O,className:ye("container",r),children:[i.jsx(lr,{ref:w,onClick:R,className:ye("trigger",l==null?void 0:l.trigger),children:u.cloneElement(g)}),I]})},pr=d.styled.div`
|
|
608
609
|
display: flex;
|
|
609
610
|
flex-direction: column;
|
|
610
611
|
align-items: center;
|
|
@@ -716,7 +717,7 @@
|
|
|
716
717
|
> * > :not([class*='field-label']):not([class*='field-message']) {
|
|
717
718
|
grid-row: 2;
|
|
718
719
|
}
|
|
719
|
-
`,mr=C.newClassNameGetter("field-row"),Or=({className:e,gap:t=16,ref:o,...r})=>i.jsx(Sr,{...r,ref:o,$gap:t,className:mr("container",e)}),bt=e=>{if(e===0)return"0 B";const t=["B","KB","MB","GB"],o=Math.floor(Math.log(e)/Math.log(1024)),r=e/Math.pow(1024,o);return`${r%1===0?r:r.toFixed(1)} ${t[o]}`},
|
|
720
|
+
`,mr=C.newClassNameGetter("field-row"),Or=({className:e,gap:t=16,ref:o,...r})=>i.jsx(Sr,{...r,ref:o,$gap:t,className:mr("container",e)}),bt=e=>{if(e===0)return"0 B";const t=["B","KB","MB","GB"],o=Math.floor(Math.log(e)/Math.log(1024)),r=e/Math.pow(1024,o);return`${r%1===0?r:r.toFixed(1)} ${t[o]}`},Ke=(e,t)=>t.split(",").map(r=>r.trim()).some(r=>r.startsWith(".")?e.name.toLowerCase().endsWith(r.toLowerCase()):r.endsWith("/*")?e.type.startsWith(r.replace("/*","/")):e.type===r),wr=d.styled.div`
|
|
720
721
|
flex-shrink: 0;
|
|
721
722
|
display: flex;
|
|
722
723
|
flex-direction: column;
|
|
@@ -803,13 +804,13 @@
|
|
|
803
804
|
width: 20px;
|
|
804
805
|
height: 20px;
|
|
805
806
|
}
|
|
806
|
-
`,
|
|
807
|
+
`,Ir=d.styled.div`
|
|
807
808
|
flex: 1;
|
|
808
809
|
min-width: 0;
|
|
809
810
|
display: flex;
|
|
810
811
|
flex-direction: column;
|
|
811
812
|
gap: 4px;
|
|
812
|
-
`,
|
|
813
|
+
`,Tr=d.styled.div`
|
|
813
814
|
display: flex;
|
|
814
815
|
align-items: flex-start;
|
|
815
816
|
justify-content: space-between;
|
|
@@ -831,19 +832,19 @@
|
|
|
831
832
|
align-items: center;
|
|
832
833
|
gap: 12px;
|
|
833
834
|
margin-top: 2px;
|
|
834
|
-
`,
|
|
835
|
+
`,_r=d.styled.div`
|
|
835
836
|
flex: 1;
|
|
836
837
|
height: 8px;
|
|
837
838
|
border-radius: 4px;
|
|
838
839
|
background-color: ${n.COLORS.gray};
|
|
839
840
|
overflow: hidden;
|
|
840
|
-
`,
|
|
841
|
+
`,Dr=d.styled.div`
|
|
841
842
|
height: 100%;
|
|
842
843
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
843
844
|
border-radius: 4px;
|
|
844
845
|
background-color: ${({$status:e})=>e==="failed"?n.COLORS.red:n.COLORS.black};
|
|
845
846
|
transition: width 0.2s ease;
|
|
846
|
-
`,
|
|
847
|
+
`,Fr=d.styled.span`
|
|
847
848
|
flex-shrink: 0;
|
|
848
849
|
font-size: 14px;
|
|
849
850
|
color: ${n.COLORS.black};
|
|
@@ -873,7 +874,7 @@
|
|
|
873
874
|
&:hover {
|
|
874
875
|
color: ${n.COLORS.black};
|
|
875
876
|
}
|
|
876
|
-
`,
|
|
877
|
+
`,Xr=d.styled.button`
|
|
877
878
|
display: inline;
|
|
878
879
|
padding: 0;
|
|
879
880
|
border: none;
|
|
@@ -887,13 +888,13 @@
|
|
|
887
888
|
&:hover {
|
|
888
889
|
text-decoration: underline;
|
|
889
890
|
}
|
|
890
|
-
`,
|
|
891
|
+
`,Ve=d.styled.div`
|
|
891
892
|
display: flex;
|
|
892
893
|
align-items: center;
|
|
893
894
|
gap: 4px;
|
|
894
895
|
font-size: 14px;
|
|
895
896
|
color: ${n.COLORS["iron-grey"]};
|
|
896
|
-
`,
|
|
897
|
+
`,Yr=d.styled.span`
|
|
897
898
|
display: inline-flex;
|
|
898
899
|
color: ${n.COLORS.green};
|
|
899
900
|
|
|
@@ -901,7 +902,7 @@
|
|
|
901
902
|
width: 16px;
|
|
902
903
|
height: 16px;
|
|
903
904
|
}
|
|
904
|
-
`,$e=C.newClassNameGetter("file-upload"),
|
|
905
|
+
`,$e=C.newClassNameGetter("file-upload"),Hr=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"17 8 12 3 7 8"}),i.jsx("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]}),Ur=({accept:e,children:t,className:o,classnames:r,description:l,disabled:a=!1,hint:c,icon:s,maxSize:p,multiple:x=!1,onChange:g,onReject:h,ref:y,...f})=>{const S=u.useRef(null),[b,$]=u.useState(!1),m=u.useCallback(L=>{if(!L||L.length===0)return;const R=Array.from(L);if(e){const E=R.filter(v=>!Ke(v,e));if(E.length>0){h==null||h(E,"type");const v=R.filter(I=>Ke(I,e));if(v.length===0)return;g==null||g(v);return}}if(p){const E=R.filter(v=>v.size>p);if(E.length>0){h==null||h(E,"size");const v=R.filter(I=>I.size<=p);if(v.length===0)return;g==null||g(v);return}}g==null||g(R)},[e,p,g,h]),O=()=>{var L;a||(L=S.current)==null||L.click()},w=L=>{m(L.target.files),S.current&&(S.current.value="")},k=L=>{L.preventDefault(),L.stopPropagation(),a||$(!0)},z=L=>{L.preventDefault(),L.stopPropagation(),$(!1)},j=L=>{L.preventDefault(),L.stopPropagation(),$(!1),a||m(L.dataTransfer.files)};return i.jsxs(wr,{ref:y,className:o,...f,children:[i.jsxs(vr,{className:$e("dropzone",r==null?void 0:r.dropzone),$disabled:a,$dragOver:b,onClick:O,onDragOver:k,onDragLeave:z,onDrop:j,role:"button",tabIndex:a?-1:0,"aria-disabled":a,children:[i.jsx(Cr,{className:$e("icon",r==null?void 0:r.icon),children:s||i.jsx(Hr,{})}),i.jsx(Rr,{className:$e("text",r==null?void 0:r.text),children:l||i.jsxs("span",{children:[i.jsx(Lr,{children:"Click to upload"})," or drag and drop"]})}),c&&i.jsx(kr,{className:$e("hint",r==null?void 0:r.hint),children:c})]}),i.jsx(jr,{ref:S,type:"file",accept:e,multiple:x,onChange:w,tabIndex:-1}),t]})},Q=C.newClassNameGetter("file-upload-item"),Wr=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),i.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})]}),qr=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M18 6 6 18"}),i.jsx("path",{d:"m6 6 12 12"})]}),Zr=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M20 6 9 17l-5-5"})}),Kr=({name:e,size:t,status:o="uploading",progress:r=0,icon:l,onRemove:a,onRetry:c,className:s,classnames:p,ref:x})=>i.jsxs(zr,{ref:x,className:Q("item",s),$status:o,children:[i.jsx(Nr,{className:Q("icon",p==null?void 0:p.icon),$status:o,children:l||i.jsx(Wr,{})}),i.jsxs(Ir,{children:[i.jsxs(Tr,{children:[i.jsxs(Ar,{className:Q("info",p==null?void 0:p.info),children:[i.jsx(Pr,{className:Q("name",p==null?void 0:p.name),children:e}),i.jsx(Br,{className:Q("size",p==null?void 0:p.size),children:bt(t)})]}),a&&i.jsx(Gr,{className:Q("action",p==null?void 0:p.action),onClick:a,"aria-label":"Remove file",type:"button",children:i.jsx(qr,{})})]}),o==="uploading"&&i.jsxs(Mr,{className:Q("progress",p==null?void 0:p.progress),children:[i.jsx(_r,{children:i.jsx(Dr,{$value:r,$status:o})}),i.jsxs(Fr,{children:[r,"%"]})]}),o==="complete"&&i.jsxs(Ve,{children:[i.jsx(Yr,{children:i.jsx(Zr,{})}),"Complete"]}),o==="failed"&&i.jsxs(Ve,{children:["Upload failed."," ",c&&i.jsx(Xr,{onClick:c,type:"button",children:"Try again"})]})]})]}),$t=`
|
|
905
906
|
display: inline-flex;
|
|
906
907
|
font-size: 14px;
|
|
907
908
|
gap: 3px;
|
|
@@ -913,14 +914,14 @@
|
|
|
913
914
|
&:hover {
|
|
914
915
|
color: ${n.COLORS["steel-blue"]};
|
|
915
916
|
}
|
|
916
|
-
`,
|
|
917
|
+
`,Vr=d.styled.span`
|
|
917
918
|
${$t}
|
|
918
919
|
cursor: ${({$clickable:e})=>e?"pointer":"default"};
|
|
919
920
|
${({$clickable:e})=>e&&St}
|
|
920
921
|
`,Qr=d.styled.a`
|
|
921
922
|
${$t}
|
|
922
923
|
${St}
|
|
923
|
-
`,Jr=d.styled.span``,en=d.styled.span``,Se=C.newClassNameGetter("hashtag"),tn=({children:e,className:t,classnames:o,href:r,onClick:l,ref:a,...c})=>{const s=i.jsxs(i.Fragment,{children:[i.jsx(Jr,{className:Se("hash",o==null?void 0:o.hash),children:"#"}),i.jsx(en,{className:Se("label",o==null?void 0:o.label),children:e})]});if(r)return i.jsx(Qr,{ref:a,href:r,className:Se("container",t),onClick:l,children:s});const p=!!l;return i.jsx(
|
|
924
|
+
`,Jr=d.styled.span``,en=d.styled.span``,Se=C.newClassNameGetter("hashtag"),tn=({children:e,className:t,classnames:o,href:r,onClick:l,ref:a,...c})=>{const s=i.jsxs(i.Fragment,{children:[i.jsx(Jr,{className:Se("hash",o==null?void 0:o.hash),children:"#"}),i.jsx(en,{className:Se("label",o==null?void 0:o.label),children:e})]});if(r)return i.jsx(Qr,{ref:a,href:r,className:Se("container",t),onClick:l,children:s});const p=!!l;return i.jsx(Vr,{...c,ref:a,className:Se("container",t),$clickable:p,onClick:l,role:p?"button":void 0,tabIndex:p?0:void 0,children:s})},Qe={1:{fontSize:32,lineHeight:1.2},2:{fontSize:24,lineHeight:1.25},3:{fontSize:18,lineHeight:1.3},4:{fontSize:16,lineHeight:1.4},5:{fontSize:14,lineHeight:1.4},6:{fontSize:12,lineHeight:1.5}},on=d.styled.h1`
|
|
924
925
|
margin: 0;
|
|
925
926
|
font-weight: 700;
|
|
926
927
|
color: ${n.COLORS.black};
|
|
@@ -1182,7 +1183,7 @@
|
|
|
1182
1183
|
position: absolute;
|
|
1183
1184
|
z-index: 1;
|
|
1184
1185
|
}
|
|
1185
|
-
`,vn=e=>{let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t^e.charCodeAt(o);return Math.abs(t).toString(36)},
|
|
1186
|
+
`,vn=e=>{let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t^e.charCodeAt(o);return Math.abs(t).toString(36)},T=e=>`hq-cropper__${vn(e)}`,A=e=>e||[],B=(e,t)=>{if(t)for(const o of t)e.classList.add(o)},Cn=e=>{const t={applyButton:[T("applyButton"),...A(e.applyButton)],cancelButton:[T("cancelButton"),...A(e.cancelButton)],container:[T("container"),...A(e.container)],handlerMove:[T("handlerMove"),...A(e.handlerMove)],handlerResizeTopLeft:[T("handlerResizeTopLeft"),...A(e.handlerResizeTopLeft)],handlerResizeTopRight:[T("handlerResizeTopRight"),...A(e.handlerResizeTopRight)],handlerResizeBottomLeft:[T("handlerResizeBottomLeft"),...A(e.handlerResizeBottomLeft)],handlerResizeBottomRight:[T("handlerResizeBottomRight"),...A(e.handlerResizeBottomRight)],sourceImage:[T("sourceImage"),...A(e.sourceImage)],portalArea:[T("portalArea"),...A(e.portalArea)],previewImage:[T("previewImage"),...A(e.previewImage)],body:[T("body"),...A(e.body)],header:[T("header"),...A(e.header)],footer:[T("footer"),...A(e.footer)],portal:[T("portal"),...A(e.portal)],preview:[T("preview"),...A(e.preview)],root:[T("root"),...A(e.root)]},o=`
|
|
1186
1187
|
${sn(t.applyButton[0])}
|
|
1187
1188
|
${cn(t.body[0])}
|
|
1188
1189
|
${pn(t.cancelButton[0])}
|
|
@@ -1200,7 +1201,7 @@
|
|
|
1200
1201
|
${me(t.handlerResizeTopRight[0],"tr")}
|
|
1201
1202
|
${On(t.root[0])}
|
|
1202
1203
|
${wn(t.sourceImage[0])}
|
|
1203
|
-
`,r=document.createElement("style");return r.innerHTML=o,document.getElementsByTagName("head")[0].prepend(r),t};let Rn=0;const Ln=e=>{const t=new Map,o=new Proxy({...e},{set(r,l,a){return Reflect.set(r,l,a),(t.get(l)||[]).forEach(c=>c.action(a,r,l)),!0}});return{getState:()=>({...o}),setState:r=>{for(const l of Object.keys(r)){const a=r[l];a!==void 0&&(o[l]=a)}},subscribe:(r,l)=>{const a=String(++Rn),c=t.get(r)||[];return t.set(r,[...c,{action:l,id:a}]),a},unsubscribe:r=>{for(const[l,a]of t.entries()){const c=a.filter(s=>s.id!==r);if(c.length!==a.length){t.set(l,c);return}}},unsubscribeAll:()=>{t.clear()}}},Fe={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},kn=(e={},t={})=>Ln({...Fe,config:{...Fe.config,...e},css:Cn(t)}),jn=(e,t)=>{var y;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.body[0]}`);if(!r)return o.frame;const{width:l,height:a}=r.getBoundingClientRect(),c=l/a,s=t.width/t.height;let p,x,g=0,h=0;return c>s?(p=a*s,x=a,h=(l-p)/2):(p=l,x=l*(t.height/t.width),g=(a-x)/2),{width:p,height:x,left:h,top:g}},En=(e,t,o)=>{const[r,l]=t,a=r+e>o.width?(o.width-e)/2:r,c=l+e>o.height?(o.height-e)/2:l;return[a,c]},zn=(e,t)=>{const{config:o}=e(),r=Math.min(t.width,t.height)-o.framePadding*2,l=o.portalSize>r?r:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[a,c]=En(l,o.portalPosition,t);return{left:a,top:c,size:l}}return o.portalPosition==="center"?{size:l,left:(t.width-l)/2,top:(t.height-l)/2}:{left:0,top:0,size:l}};var G=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(G||{});const Nn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerMove),o.setAttribute("data-action",G.MOVE),o},Tn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeBottomLeft),o.setAttribute("data-action",G.RESIZE_BL),o},In=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeBottomRight),o.setAttribute("data-action",G.RESIZE_BR),o},An=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeTopLeft),o.setAttribute("data-action",G.RESIZE_TL),o},Pn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeTopRight),o.setAttribute("data-action",G.RESIZE_TR),o},Bn=e=>{var r;const t=e(),o=document.createElement("img");return B(o,(r=t.css)==null?void 0:r.previewImage),o},Mn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.preview),o.appendChild(Bn(e)),o},Fn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.portal),o.appendChild(Mn(e)),o.appendChild(Nn(e)),o.appendChild(An(e)),o.appendChild(Pn(e)),o.appendChild(Tn(e)),o.appendChild(In(e)),o},_n=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.portalArea),o.appendChild(Fn(e)),o},Dn=e=>{var r;const t=e(),o=document.createElement("img");return B(o,(r=t.css)==null?void 0:r.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",t.sourceBase64),o},Gn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.body),o.appendChild(Dn(e)),o.appendChild(_n(e)),o},Yn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return B(r,(l=o.css)==null?void 0:l.applyButton),r.setAttribute("role","button"),r.innerText=o.config.applyButtonLabel,r.addEventListener("click",t),r},Hn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return B(r,(l=o.css)==null?void 0:l.cancelButton),r.setAttribute("role","button"),r.innerText=o.config.cancelButtonLabel,r.addEventListener("click",t),r},Xn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return B(l,(a=r.css)==null?void 0:a.footer),l.appendChild(Hn(e,o)),l.appendChild(Yn(e,t)),l},Un=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.header),o},Wn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return B(l,(a=r.css)==null?void 0:a.container),l.appendChild(Un(e)),l.appendChild(Gn(e)),l.appendChild(Xn(e,t,o)),l},qn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");B(l,(a=r.css)==null?void 0:a.root),l.appendChild(Wn(e,t,o)),document.body.appendChild(l)},Kn=e=>{const t=document.createElement("input");return t.style.display="none",t.setAttribute("type","file"),t.setAttribute("accept","image/x-png,image/jpeg"),t.addEventListener("change",e,!1),document.body.appendChild(t),t},pe=new Map,Vn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},J=(e,t)=>{if(pe.has(e))return pe.get(e);if(!t)return null;const o=t[Vn[e]],r=document.querySelector(`.${o[0]}`);return pe.set(e,r),r},Zn=()=>{pe.clear()},Qn=()=>{pe.clear()},Jn=(e,t)=>{const o=J("header",t.css);o&&(o.innerText=e)},ei=(e,t)=>{const o=J("sourceImage",t.css);o&&(o.setAttribute("src",e),o.style.height=`${t.frame.height}px`,o.style.width=`${t.frame.width}px`,o.style.left=`${t.frame.left}px`,o.style.top=`${t.frame.top}px`);const r=J("portalArea",t.css);r&&(r.style.height=`${t.frame.height}px`,r.style.width=`${t.frame.width}px`,r.style.left=`${t.frame.left}px`,r.style.top=`${t.frame.top}px`);const l=J("portal",t.css);l&&(l.style.width=`${t.portal.size}px`,l.style.height=`${t.portal.size}px`,l.style.left=`${t.portal.left}px`,l.style.top=`${t.portal.top}px`);const a=J("previewImage",t.css);a&&(a.setAttribute("src",e),a.style.height=`${t.frame.height}px`,a.style.width=`${t.frame.width}px`,a.style.marginLeft=`-${t.portal.left}px`,a.style.marginTop=`-${t.portal.top}px`)},ti=(e,t)=>{const o=J("portal",t.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const r=J("previewImage",t.css);r&&(r.style.marginLeft=`-${e.left}px`,r.style.marginTop=`-${e.top}px`)},je=1,oi=e=>{var f,S;const t=e(),o=document.createElement("canvas"),r=t.frame.width||je,l=t.frame.height||je,a=t.sourceWidth/r,c=t.sourceHeight/l,s=t.portal.left*a,p=t.portal.top*c,x=Math.max(t.portal.size*Math.min(a,c),je),g=t.config.outputSize>0?t.config.outputSize:x;o.width=g,o.height=g;const h=document.querySelector(`.${(f=t.css)==null?void 0:f.sourceImage[0]}`);h&&((S=o.getContext("2d"))==null||S.drawImage(h,s,p,x,x,0,0,g,g));const y=o.toDataURL(`image/${t.config.type}`,t.config.compression);return new Promise((b,$)=>{try{o.toBlob(m=>{if(o.remove(),!m){$(new Error(`Failed to create blob for type: image/${t.config.type}`));return}b([y,m])},`image/${t.config.type}`,t.config.compression)}catch(m){o.remove(),$(m)}})},ri=(e,t,o)=>{const{emitted:r,portal:l,frame:a,config:c}=t();let s=r.left-r.X+e.clientX,p=r.top-r.Y+e.clientY;const x=c.framePadding,g=a.width-c.framePadding-l.size,h=c.framePadding,y=a.height-c.framePadding-l.size;s<x&&(s=x),s>g&&(s=g),p<h&&(p=h),p>y&&(p=y),o({portal:{...l,left:s,top:p}})},ni=(e,t,o)=>{const{action:r,emitted:l,portal:a,frame:c,config:s}=t(),p=e.pageX-l.X,x=e.pageY-l.Y;switch(r){case G.RESIZE_BR:{let g=l.size+Math.max(p,x);return g<s.minPortalSize&&(g=s.minPortalSize),l.top+g>c.height-s.framePadding&&(g=c.height-l.top-s.framePadding),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding),o({portal:{...a,size:g}})}case G.RESIZE_TR:{let g=p+x>0?l.size+p:l.size-x,h=p+x>0?l.top-p:l.top+x;return g<s.minPortalSize&&(h=l.top+l.size-s.minPortalSize,g=s.minPortalSize),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding,h=l.top-c.width+l.left+l.size),h<s.framePadding&&(g=l.top+l.size,h=s.framePadding),o({portal:{...a,top:h,size:g}})}case G.RESIZE_TL:{const g=Math.min(p,x);let h=l.size-g,y=l.left+g,f=l.top+g;if(h<s.minPortalSize){const S=l.size-s.minPortalSize;h=s.minPortalSize,y=l.left+S,f=l.top+S}if(f<s.framePadding){const S=s.framePadding-f;f=s.framePadding,y=y+S,h=h-S}if(y<s.framePadding){const S=s.framePadding-y;y=s.framePadding,f=f+S,h=h-S}return o({portal:{...a,top:f,left:y,size:h}})}case G.RESIZE_BL:{let g=p+x>0?l.size+x:l.size-p,h=p+x>0?l.left-x:l.left+p;return g<s.minPortalSize&&(h=l.left+l.size-s.minPortalSize,g=s.minPortalSize),g+l.top>c.height-s.framePadding&&(h=l.left-c.height+l.top+l.size,g=c.height-l.top-s.framePadding),h<s.framePadding&&(h=s.framePadding,g=l.left+l.size-s.framePadding),o({portal:{...a,left:h,size:g}})}default:return}},Je=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const t=e;return{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY}},ii=(e,t)=>{var y,f,S;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.portal[0]}`),l=document.querySelector(`.${(f=o.css)==null?void 0:f.portalArea[0]}`),a=document.querySelector(`.${(S=o.css)==null?void 0:S.root[0]}`);let c=null,s=null;const p=b=>{b.preventDefault();const{portal:$}=e(),m=Je(b);if(b.target){const O=b.target.getAttribute("data-action"),w={X:m.pageX,Y:m.pageY,left:$.left,top:$.top,size:$.size};t({action:O,emitted:w})}},x=()=>{const{action:b}=e();c!==null&&(cancelAnimationFrame(c),c=null),s=null,b&&t({action:null})},g=()=>{if(c=null,!s)return;const b=s;s=null;const{action:$}=e();if($)switch($){case G.MOVE:ri(b,e,t);break;default:ni(b,e,t)}},h=b=>{const{action:$}=e();$&&(b.preventDefault(),s=Je(b),c===null&&(c=requestAnimationFrame(g)))};return a&&(a.addEventListener("mouseup",x),a.addEventListener("touchend",x),a.addEventListener("touchcancel",x)),r&&(r.addEventListener("mousedown",p),r.addEventListener("touchstart",p,{passive:!1})),l&&(l.addEventListener("mousemove",h),l.addEventListener("touchmove",h,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),a&&(a.removeEventListener("mouseup",x),a.removeEventListener("touchend",x),a.removeEventListener("touchcancel",x)),r&&(r.removeEventListener("mousedown",p),r.removeEventListener("touchstart",p)),l&&(l.removeEventListener("mousemove",h),l.removeEventListener("touchmove",h))}},et=1024*1024,li=(e,t)=>{if(!t.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${t.allowedTypes.join(", ")}`;if(t.maxFileSize>0&&e.size>t.maxFileSize){const o=(t.maxFileSize/et).toFixed(2);return`File size (${(e.size/et).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ai=(e,t,o,r,l,a,c)=>{const s=m=>{c?c(m):console.error(`HqCropper: ${m}`)};if(!e.target.files||e.target.files.length===0){s("Can't read file input");return}const p=e.target.files[0],{config:x}=t(),g=li(p,x);if(g){s(g),e.target.value="";return}const h=new FileReader;let y=null;const f=()=>{var w;const m=t(),O=document.querySelector(`.${(w=m.css)==null?void 0:w.root[0]}`);O&&(O.remove(),document.removeEventListener("keydown",S),y==null||y(),Qn(),a(),o(Fe))},S=m=>{m.key==="Escape"&&t().sourceBase64&&b(m)},b=m=>{m.preventDefault(),f()},$=m=>{m.preventDefault();const O=t();oi(t).then(([w,k])=>{r(w,k,O),b(m)}).catch(w=>{s(w instanceof Error?w.message:"Failed to crop image")})};h.onload=m=>{const O=new Image;if(!m.target||typeof m.target.result!="string"){s("Can't load result image");return}O.src=m.target.result,O.onerror=()=>{s("Failed to load image")},O.onload=()=>{var z;qn(t,$,b),Zn(),l("fileName",Jn),l("sourceBase64",ei),l("portal",ti);const w=jn(t,O),k=zn(t,w);o({frame:w,portal:k,fileName:p.name,sourceBase64:(z=m.target)==null?void 0:z.result,sourceHeight:O.height,sourceWidth:O.width}),y=ii(t,o),document.addEventListener("keydown",S)}},h.onerror=()=>{s("Failed to read file")},h.readAsDataURL(p),e.target.value=""},di=(e,t,o,r)=>{const{getState:l,setState:a,subscribe:c,unsubscribeAll:s}=kn(t,o),p=Kn(x=>ai(x,l,a,e,c,s,r));return{open:()=>p.click()}},K={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},tt="vacano-image-cropper-styles",si=`
|
|
1204
|
+
`,r=document.createElement("style");return r.innerHTML=o,document.getElementsByTagName("head")[0].prepend(r),t};let Rn=0;const Ln=e=>{const t=new Map,o=new Proxy({...e},{set(r,l,a){return Reflect.set(r,l,a),(t.get(l)||[]).forEach(c=>c.action(a,r,l)),!0}});return{getState:()=>({...o}),setState:r=>{for(const l of Object.keys(r)){const a=r[l];a!==void 0&&(o[l]=a)}},subscribe:(r,l)=>{const a=String(++Rn),c=t.get(r)||[];return t.set(r,[...c,{action:l,id:a}]),a},unsubscribe:r=>{for(const[l,a]of t.entries()){const c=a.filter(s=>s.id!==r);if(c.length!==a.length){t.set(l,c);return}}},unsubscribeAll:()=>{t.clear()}}},_e={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},kn=(e={},t={})=>Ln({..._e,config:{..._e.config,...e},css:Cn(t)}),jn=(e,t)=>{var y;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.body[0]}`);if(!r)return o.frame;const{width:l,height:a}=r.getBoundingClientRect(),c=l/a,s=t.width/t.height;let p,x,g=0,h=0;return c>s?(p=a*s,x=a,h=(l-p)/2):(p=l,x=l*(t.height/t.width),g=(a-x)/2),{width:p,height:x,left:h,top:g}},En=(e,t,o)=>{const[r,l]=t,a=r+e>o.width?(o.width-e)/2:r,c=l+e>o.height?(o.height-e)/2:l;return[a,c]},zn=(e,t)=>{const{config:o}=e(),r=Math.min(t.width,t.height)-o.framePadding*2,l=o.portalSize>r?r:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[a,c]=En(l,o.portalPosition,t);return{left:a,top:c,size:l}}return o.portalPosition==="center"?{size:l,left:(t.width-l)/2,top:(t.height-l)/2}:{left:0,top:0,size:l}};var G=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(G||{});const Nn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerMove),o.setAttribute("data-action",G.MOVE),o},In=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeBottomLeft),o.setAttribute("data-action",G.RESIZE_BL),o},Tn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeBottomRight),o.setAttribute("data-action",G.RESIZE_BR),o},An=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeTopLeft),o.setAttribute("data-action",G.RESIZE_TL),o},Pn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeTopRight),o.setAttribute("data-action",G.RESIZE_TR),o},Bn=e=>{var r;const t=e(),o=document.createElement("img");return B(o,(r=t.css)==null?void 0:r.previewImage),o},Mn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.preview),o.appendChild(Bn(e)),o},_n=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.portal),o.appendChild(Mn(e)),o.appendChild(Nn(e)),o.appendChild(An(e)),o.appendChild(Pn(e)),o.appendChild(In(e)),o.appendChild(Tn(e)),o},Dn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.portalArea),o.appendChild(_n(e)),o},Fn=e=>{var r;const t=e(),o=document.createElement("img");return B(o,(r=t.css)==null?void 0:r.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",t.sourceBase64),o},Gn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.body),o.appendChild(Fn(e)),o.appendChild(Dn(e)),o},Xn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return B(r,(l=o.css)==null?void 0:l.applyButton),r.setAttribute("role","button"),r.innerText=o.config.applyButtonLabel,r.addEventListener("click",t),r},Yn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return B(r,(l=o.css)==null?void 0:l.cancelButton),r.setAttribute("role","button"),r.innerText=o.config.cancelButtonLabel,r.addEventListener("click",t),r},Hn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return B(l,(a=r.css)==null?void 0:a.footer),l.appendChild(Yn(e,o)),l.appendChild(Xn(e,t)),l},Un=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.header),o},Wn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return B(l,(a=r.css)==null?void 0:a.container),l.appendChild(Un(e)),l.appendChild(Gn(e)),l.appendChild(Hn(e,t,o)),l},qn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");B(l,(a=r.css)==null?void 0:a.root),l.appendChild(Wn(e,t,o)),document.body.appendChild(l)},Zn=e=>{const t=document.createElement("input");return t.style.display="none",t.setAttribute("type","file"),t.setAttribute("accept","image/x-png,image/jpeg"),t.addEventListener("change",e,!1),document.body.appendChild(t),t},pe=new Map,Kn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},J=(e,t)=>{if(pe.has(e))return pe.get(e);if(!t)return null;const o=t[Kn[e]],r=document.querySelector(`.${o[0]}`);return pe.set(e,r),r},Vn=()=>{pe.clear()},Qn=()=>{pe.clear()},Jn=(e,t)=>{const o=J("header",t.css);o&&(o.innerText=e)},ei=(e,t)=>{const o=J("sourceImage",t.css);o&&(o.setAttribute("src",e),o.style.height=`${t.frame.height}px`,o.style.width=`${t.frame.width}px`,o.style.left=`${t.frame.left}px`,o.style.top=`${t.frame.top}px`);const r=J("portalArea",t.css);r&&(r.style.height=`${t.frame.height}px`,r.style.width=`${t.frame.width}px`,r.style.left=`${t.frame.left}px`,r.style.top=`${t.frame.top}px`);const l=J("portal",t.css);l&&(l.style.width=`${t.portal.size}px`,l.style.height=`${t.portal.size}px`,l.style.left=`${t.portal.left}px`,l.style.top=`${t.portal.top}px`);const a=J("previewImage",t.css);a&&(a.setAttribute("src",e),a.style.height=`${t.frame.height}px`,a.style.width=`${t.frame.width}px`,a.style.marginLeft=`-${t.portal.left}px`,a.style.marginTop=`-${t.portal.top}px`)},ti=(e,t)=>{const o=J("portal",t.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const r=J("previewImage",t.css);r&&(r.style.marginLeft=`-${e.left}px`,r.style.marginTop=`-${e.top}px`)},je=1,oi=e=>{var f,S;const t=e(),o=document.createElement("canvas"),r=t.frame.width||je,l=t.frame.height||je,a=t.sourceWidth/r,c=t.sourceHeight/l,s=t.portal.left*a,p=t.portal.top*c,x=Math.max(t.portal.size*Math.min(a,c),je),g=t.config.outputSize>0?t.config.outputSize:x;o.width=g,o.height=g;const h=document.querySelector(`.${(f=t.css)==null?void 0:f.sourceImage[0]}`);h&&((S=o.getContext("2d"))==null||S.drawImage(h,s,p,x,x,0,0,g,g));const y=o.toDataURL(`image/${t.config.type}`,t.config.compression);return new Promise((b,$)=>{try{o.toBlob(m=>{if(o.remove(),!m){$(new Error(`Failed to create blob for type: image/${t.config.type}`));return}b([y,m])},`image/${t.config.type}`,t.config.compression)}catch(m){o.remove(),$(m)}})},ri=(e,t,o)=>{const{emitted:r,portal:l,frame:a,config:c}=t();let s=r.left-r.X+e.clientX,p=r.top-r.Y+e.clientY;const x=c.framePadding,g=a.width-c.framePadding-l.size,h=c.framePadding,y=a.height-c.framePadding-l.size;s<x&&(s=x),s>g&&(s=g),p<h&&(p=h),p>y&&(p=y),o({portal:{...l,left:s,top:p}})},ni=(e,t,o)=>{const{action:r,emitted:l,portal:a,frame:c,config:s}=t(),p=e.pageX-l.X,x=e.pageY-l.Y;switch(r){case G.RESIZE_BR:{let g=l.size+Math.max(p,x);return g<s.minPortalSize&&(g=s.minPortalSize),l.top+g>c.height-s.framePadding&&(g=c.height-l.top-s.framePadding),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding),o({portal:{...a,size:g}})}case G.RESIZE_TR:{let g=p+x>0?l.size+p:l.size-x,h=p+x>0?l.top-p:l.top+x;return g<s.minPortalSize&&(h=l.top+l.size-s.minPortalSize,g=s.minPortalSize),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding,h=l.top-c.width+l.left+l.size),h<s.framePadding&&(g=l.top+l.size,h=s.framePadding),o({portal:{...a,top:h,size:g}})}case G.RESIZE_TL:{const g=Math.min(p,x);let h=l.size-g,y=l.left+g,f=l.top+g;if(h<s.minPortalSize){const S=l.size-s.minPortalSize;h=s.minPortalSize,y=l.left+S,f=l.top+S}if(f<s.framePadding){const S=s.framePadding-f;f=s.framePadding,y=y+S,h=h-S}if(y<s.framePadding){const S=s.framePadding-y;y=s.framePadding,f=f+S,h=h-S}return o({portal:{...a,top:f,left:y,size:h}})}case G.RESIZE_BL:{let g=p+x>0?l.size+x:l.size-p,h=p+x>0?l.left-x:l.left+p;return g<s.minPortalSize&&(h=l.left+l.size-s.minPortalSize,g=s.minPortalSize),g+l.top>c.height-s.framePadding&&(h=l.left-c.height+l.top+l.size,g=c.height-l.top-s.framePadding),h<s.framePadding&&(h=s.framePadding,g=l.left+l.size-s.framePadding),o({portal:{...a,left:h,size:g}})}default:return}},Je=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const t=e;return{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY}},ii=(e,t)=>{var y,f,S;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.portal[0]}`),l=document.querySelector(`.${(f=o.css)==null?void 0:f.portalArea[0]}`),a=document.querySelector(`.${(S=o.css)==null?void 0:S.root[0]}`);let c=null,s=null;const p=b=>{b.preventDefault();const{portal:$}=e(),m=Je(b);if(b.target){const O=b.target.getAttribute("data-action"),w={X:m.pageX,Y:m.pageY,left:$.left,top:$.top,size:$.size};t({action:O,emitted:w})}},x=()=>{const{action:b}=e();c!==null&&(cancelAnimationFrame(c),c=null),s=null,b&&t({action:null})},g=()=>{if(c=null,!s)return;const b=s;s=null;const{action:$}=e();if($)switch($){case G.MOVE:ri(b,e,t);break;default:ni(b,e,t)}},h=b=>{const{action:$}=e();$&&(b.preventDefault(),s=Je(b),c===null&&(c=requestAnimationFrame(g)))};return a&&(a.addEventListener("mouseup",x),a.addEventListener("touchend",x),a.addEventListener("touchcancel",x)),r&&(r.addEventListener("mousedown",p),r.addEventListener("touchstart",p,{passive:!1})),l&&(l.addEventListener("mousemove",h),l.addEventListener("touchmove",h,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),a&&(a.removeEventListener("mouseup",x),a.removeEventListener("touchend",x),a.removeEventListener("touchcancel",x)),r&&(r.removeEventListener("mousedown",p),r.removeEventListener("touchstart",p)),l&&(l.removeEventListener("mousemove",h),l.removeEventListener("touchmove",h))}},et=1024*1024,li=(e,t)=>{if(!t.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${t.allowedTypes.join(", ")}`;if(t.maxFileSize>0&&e.size>t.maxFileSize){const o=(t.maxFileSize/et).toFixed(2);return`File size (${(e.size/et).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ai=(e,t,o,r,l,a,c)=>{const s=m=>{c?c(m):console.error(`HqCropper: ${m}`)};if(!e.target.files||e.target.files.length===0){s("Can't read file input");return}const p=e.target.files[0],{config:x}=t(),g=li(p,x);if(g){s(g),e.target.value="";return}const h=new FileReader;let y=null;const f=()=>{var w;const m=t(),O=document.querySelector(`.${(w=m.css)==null?void 0:w.root[0]}`);O&&(O.remove(),document.removeEventListener("keydown",S),y==null||y(),Qn(),a(),o(_e))},S=m=>{m.key==="Escape"&&t().sourceBase64&&b(m)},b=m=>{m.preventDefault(),f()},$=m=>{m.preventDefault();const O=t();oi(t).then(([w,k])=>{r(w,k,O),b(m)}).catch(w=>{s(w instanceof Error?w.message:"Failed to crop image")})};h.onload=m=>{const O=new Image;if(!m.target||typeof m.target.result!="string"){s("Can't load result image");return}O.src=m.target.result,O.onerror=()=>{s("Failed to load image")},O.onload=()=>{var z;qn(t,$,b),Vn(),l("fileName",Jn),l("sourceBase64",ei),l("portal",ti);const w=jn(t,O),k=zn(t,w);o({frame:w,portal:k,fileName:p.name,sourceBase64:(z=m.target)==null?void 0:z.result,sourceHeight:O.height,sourceWidth:O.width}),y=ii(t,o),document.addEventListener("keydown",S)}},h.onerror=()=>{s("Failed to read file")},h.readAsDataURL(p),e.target.value=""},di=(e,t,o,r)=>{const{getState:l,setState:a,subscribe:c,unsubscribeAll:s}=kn(t,o),p=Zn(x=>ai(x,l,a,e,c,s,r));return{open:()=>p.click()}},Z={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},tt="vacano-image-cropper-styles",si=`
|
|
1204
1205
|
.vacano-cropper-root {
|
|
1205
1206
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1206
1207
|
backdrop-filter: blur(4px);
|
|
@@ -1248,7 +1249,7 @@
|
|
|
1248
1249
|
.vacano-cropper-apply-button:hover {
|
|
1249
1250
|
background-color: ${n.COLORS["iron-grey"]};
|
|
1250
1251
|
}
|
|
1251
|
-
`,ci=()=>{if(typeof document>"u"||document.getElementById(tt))return;const e=document.createElement("style");e.id=tt,e.textContent=si,document.head.appendChild(e)},pi={root:["vacano-cropper-root"],container:["vacano-cropper-container"],header:["vacano-cropper-header"],body:["vacano-cropper-body"],footer:["vacano-cropper-footer"],cancelButton:["vacano-cropper-cancel-button"],applyButton:["vacano-cropper-apply-button"],portal:["vacano-cropper-portal"]},mt=(e={})=>{const{allowedTypes:t=
|
|
1252
|
+
`,ci=()=>{if(typeof document>"u"||document.getElementById(tt))return;const e=document.createElement("style");e.id=tt,e.textContent=si,document.head.appendChild(e)},pi={root:["vacano-cropper-root"],container:["vacano-cropper-container"],header:["vacano-cropper-header"],body:["vacano-cropper-body"],footer:["vacano-cropper-footer"],cancelButton:["vacano-cropper-cancel-button"],applyButton:["vacano-cropper-apply-button"],portal:["vacano-cropper-portal"]},mt=(e={})=>{const{allowedTypes:t=Z.allowedTypes,applyLabel:o=Z.applyLabel,cancelLabel:r=Z.cancelLabel,compression:l=Z.compression,maxFileSize:a=Z.maxFileSize,onCrop:c,onError:s,outputSize:p=Z.outputSize,portalSize:x=Z.portalSize,type:g=Z.type}=e,h=u.useRef(null);return{open:u.useCallback(()=>{h.current||(ci(),h.current=di((f,S,b)=>{S&&(c==null||c({base64:f,blob:S,state:b}))},{portalSize:x,outputSize:p,compression:l,type:g,maxFileSize:a,allowedTypes:t,applyButtonLabel:o,cancelButtonLabel:r},pi,f=>{s==null||s({code:"CROPPER_ERROR",message:f})})),h.current.open()},[t,o,r,l,a,c,s,p,x,g])}},Ee=C.newClassNameGetter("image-cropper"),ui=({allowedTypes:e,applyLabel:t,buttonLabel:o="Select Image",cancelLabel:r,className:l,classnames:a,compression:c,maxFileSize:s,onCrop:p,onError:x,outputSize:g,portalSize:h,previewSize:y=120,ref:f,type:S,value:b,...$})=>{const[m,O]=u.useState(b??null),{open:w}=mt({allowedTypes:e,applyLabel:t,cancelLabel:r,compression:c,maxFileSize:s,onCrop:k=>{O(k.base64),p==null||p(k)},onError:x,outputSize:g,portalSize:h,type:S});return i.jsxs(ln,{...$,ref:f,className:Ee("container",l),children:[i.jsx(an,{$size:y,className:Ee("preview",a==null?void 0:a.preview),children:m?i.jsx("img",{src:m,alt:"Preview"}):i.jsx(dn,{children:"No image"})}),i.jsx(d.Button,{variant:"system",onClick:w,className:Ee("button",a==null?void 0:a.button),style:{width:y},children:o})]})},re={default:{box:40,line:22,weight:2.5,gap:6},compact:{box:32,line:18,weight:2,gap:5}},gi=d.styled.button`
|
|
1252
1253
|
position: relative;
|
|
1253
1254
|
display: flex;
|
|
1254
1255
|
align-items: center;
|
|
@@ -1376,12 +1377,12 @@
|
|
|
1376
1377
|
font-size: 14px;
|
|
1377
1378
|
color: ${n.COLORS.black};
|
|
1378
1379
|
text-align: left;
|
|
1379
|
-
`,
|
|
1380
|
+
`,Ii=d.styled.p`
|
|
1380
1381
|
margin: 4px 0 0;
|
|
1381
1382
|
font-size: 13px;
|
|
1382
1383
|
color: ${n.COLORS["iron-grey"]};
|
|
1383
1384
|
text-align: left;
|
|
1384
|
-
`,
|
|
1385
|
+
`,Ti=d.styled.div`
|
|
1385
1386
|
display: flex;
|
|
1386
1387
|
align-items: center;
|
|
1387
1388
|
justify-content: flex-start;
|
|
@@ -1390,20 +1391,20 @@
|
|
|
1390
1391
|
padding: 12px 16px;
|
|
1391
1392
|
border-top: 1px solid ${n.COLORS.gray};
|
|
1392
1393
|
background-color: rgba(0, 0, 0, 0.01);
|
|
1393
|
-
`,Ai=({confirmation:e,onDone:t})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(!1),{label:c,description:s,onConfirm:p,onDiscard:x,options:g}=e,h=g.confirmLabel||Li,y=g.discardLabel||ki,f=u.useCallback($=>{r(!0),setTimeout(()=>{$==null||$(),t()},200)},[t]),S=u.useCallback(async()=>{const $=p();if($ instanceof Promise){a(!0);try{await $}finally{a(!1)}}f()},[f,p]),b=u.useCallback(()=>{l||f(x)},[f,l,x]);return u.useEffect(()=>{const $=m=>{m.key==="Escape"&&!l&&b()};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[b,l]),i.jsxs(zi,{$isExiting:o,children:[i.jsx(Ni,{children:c}),i.jsx(
|
|
1394
|
+
`,Ai=({confirmation:e,onDone:t})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(!1),{label:c,description:s,onConfirm:p,onDiscard:x,options:g}=e,h=g.confirmLabel||Li,y=g.discardLabel||ki,f=u.useCallback($=>{r(!0),setTimeout(()=>{$==null||$(),t()},200)},[t]),S=u.useCallback(async()=>{const $=p();if($ instanceof Promise){a(!0);try{await $}finally{a(!1)}}f()},[f,p]),b=u.useCallback(()=>{l||f(x)},[f,l,x]);return u.useEffect(()=>{const $=m=>{m.key==="Escape"&&!l&&b()};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[b,l]),i.jsxs(zi,{$isExiting:o,children:[i.jsx(Ni,{children:c}),i.jsx(Ii,{children:s}),i.jsxs(Ti,{children:[i.jsx(d.Button,{variant:"transparent",size:"compact",onClick:b,disabled:l,children:y}),i.jsx(d.Button,{variant:"system",size:"compact",onClick:S,loading:l,children:h})]})]})},Pi=()=>{},Bi=({children:e})=>{const[t,o]=u.useState(null),r=u.useCallback((a,c,s,p,x)=>{o({open:!0,label:a,description:c,onConfirm:s,onDiscard:p||Pi,options:x||{}})},[]),l=u.useCallback(()=>{o(null)},[]);return i.jsxs(wt.Provider,{value:{show:r,hide:l},children:[e,t&&i.jsx(Ai,{confirmation:t,onDone:l})]})},Mi=()=>{const e=u.useContext(wt);if(!e)throw new Error("useNotifyConfirmation must be used within NotifyConfirmationProvider");return e},_i=d.styled.div`
|
|
1394
1395
|
display: flex;
|
|
1395
1396
|
flex-direction: column;
|
|
1396
1397
|
gap: 2px;
|
|
1397
|
-
`,
|
|
1398
|
+
`,Di=d.styled.span`
|
|
1398
1399
|
font-size: 12px;
|
|
1399
1400
|
font-weight: 700;
|
|
1400
1401
|
text-transform: uppercase;
|
|
1401
1402
|
letter-spacing: 0.5px;
|
|
1402
1403
|
color: ${n.COLORS["iron-grey"]};
|
|
1403
|
-
`,
|
|
1404
|
+
`,Fi=d.styled.span`
|
|
1404
1405
|
font-size: 14px;
|
|
1405
1406
|
color: ${n.COLORS["iron-grey"]};
|
|
1406
|
-
`,Ne=C.newClassNameGetter("overline"),Gi=({children:e,className:t,classnames:o,description:r,ref:l,...a})=>i.jsxs(
|
|
1407
|
+
`,Ne=C.newClassNameGetter("overline"),Gi=({children:e,className:t,classnames:o,description:r,ref:l,...a})=>i.jsxs(_i,{...a,ref:l,className:Ne("container",t),children:[i.jsx(Di,{className:Ne("label",o==null?void 0:o.label),children:e}),r&&i.jsx(Fi,{className:Ne("description",o==null?void 0:o.description),children:r})]}),Xi=d.styled.div`
|
|
1407
1408
|
position: relative;
|
|
1408
1409
|
display: flex;
|
|
1409
1410
|
flex-direction: column;
|
|
@@ -1413,7 +1414,7 @@
|
|
|
1413
1414
|
min-height: 100dvh;
|
|
1414
1415
|
padding: 40px 24px;
|
|
1415
1416
|
overflow: hidden;
|
|
1416
|
-
`,
|
|
1417
|
+
`,Yi=d.styled.div`
|
|
1417
1418
|
position: absolute;
|
|
1418
1419
|
inset: 0;
|
|
1419
1420
|
background-image:
|
|
@@ -1423,7 +1424,7 @@
|
|
|
1423
1424
|
mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, black 20%, transparent 100%);
|
|
1424
1425
|
-webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, black 20%, transparent 100%);
|
|
1425
1426
|
pointer-events: none;
|
|
1426
|
-
`,
|
|
1427
|
+
`,Hi=d.styled.div`
|
|
1427
1428
|
position: relative;
|
|
1428
1429
|
z-index: 1;
|
|
1429
1430
|
display: flex;
|
|
@@ -1454,26 +1455,26 @@
|
|
|
1454
1455
|
text-align: center;
|
|
1455
1456
|
gap: 8px;
|
|
1456
1457
|
margin-bottom: 32px;
|
|
1457
|
-
`,
|
|
1458
|
+
`,Zi=d.styled.h1`
|
|
1458
1459
|
margin: 0;
|
|
1459
1460
|
font-size: 24px;
|
|
1460
1461
|
font-weight: 600;
|
|
1461
1462
|
color: ${n.COLORS.black};
|
|
1462
1463
|
line-height: 1.3;
|
|
1463
|
-
`,
|
|
1464
|
+
`,Ki=d.styled.p`
|
|
1464
1465
|
margin: 0;
|
|
1465
1466
|
font-size: 14px;
|
|
1466
1467
|
color: ${n.COLORS["iron-grey"]};
|
|
1467
1468
|
line-height: 1.5;
|
|
1468
1469
|
max-width: 360px;
|
|
1469
|
-
`,
|
|
1470
|
+
`,Vi=d.styled.div`
|
|
1470
1471
|
width: 100%;
|
|
1471
1472
|
`,Qi=d.styled.div`
|
|
1472
1473
|
margin-top: 32px;
|
|
1473
1474
|
text-align: center;
|
|
1474
1475
|
font-size: 14px;
|
|
1475
1476
|
color: ${n.COLORS["iron-grey"]};
|
|
1476
|
-
`,
|
|
1477
|
+
`,K=C.newClassNameGetter("shell-screen"),Ji=({children:e,className:t,classnames:o,description:r,footer:l,gridSize:a=64,icon:c,logo:s,ref:p,title:x,...g})=>i.jsxs(Xi,{...g,ref:p,className:K("container",t),children:[i.jsx(Yi,{$size:a,className:K("grid",o==null?void 0:o.grid)}),i.jsxs(Hi,{children:[s&&i.jsx(Ui,{children:s}),c&&i.jsx(Wi,{className:K("icon"),children:c}),(x||r)&&i.jsxs(qi,{className:K("header",o==null?void 0:o.header),children:[x&&i.jsx(Zi,{className:K("title",o==null?void 0:o.title),children:x}),r&&i.jsx(Ki,{className:K("description",o==null?void 0:o.description),children:r})]}),e&&i.jsx(Vi,{className:K("content",o==null?void 0:o.content),children:e}),l&&i.jsx(Qi,{className:K("footer",o==null?void 0:o.footer),children:l})]})]}),el=(e,t,o,r)=>{if(o*2+3+r*2>=e)return Array.from({length:e},(y,f)=>f+1);const a=Math.max(t-o,r+1),c=Math.min(t+o,e-r),s=a>r+2,p=c<e-r-1;if(!s&&p){const y=o*2+r+2,f=Array.from({length:y},(b,$)=>$+1),S=Array.from({length:r},(b,$)=>e-r+$+1);return[...f,"dots",...S]}if(s&&!p){const y=o*2+r+2,f=Array.from({length:r},(b,$)=>$+1),S=Array.from({length:y},(b,$)=>e-y+$+1);return[...f,"dots",...S]}const x=Array.from({length:r},(y,f)=>f+1),g=Array.from({length:c-a+1},(y,f)=>a+f),h=Array.from({length:r},(y,f)=>e-r+f+1);return[...x,"dots",...g,"dots",...h]},tl=d.styled.nav`
|
|
1477
1478
|
display: inline-flex;
|
|
1478
1479
|
align-items: center;
|
|
1479
1480
|
gap: 2px;
|
|
@@ -1560,7 +1561,7 @@
|
|
|
1560
1561
|
pointer-events: none;
|
|
1561
1562
|
cursor: default;
|
|
1562
1563
|
`}
|
|
1563
|
-
`,oe=C.newClassNameGetter("pagination"),ll=({boundaries:e=1,className:t,classnames:o,disabled:r=!1,initialPage:l=1,loop:a=!1,onChange:c,page:s,ref:p,showControls:x=!1,siblings:g=1,total:h,variant:y="flat",...f})=>{const S=s!==void 0,[b,$]=u.useState(l),m=S?s:b,O=u.useRef(new Map),w=u.useRef(null),k=u.useRef(null),z=el(h,m,g,e),j=u.useCallback(v=>{S||$(v),c==null||c(v)},[S,c]),L=u.useCallback(v=>{v<1||v>h||v===m||j(v)},[m,j,h]),R=u.useCallback(()=>{if(m<=1){a&&j(h);return}j(m-1)},[m,a,j,h]),E=u.useCallback(()=>{if(m>=h){a&&j(1);return}j(m+1)},[m,a,j,h]);return u.useEffect(()=>{const v=k.current,
|
|
1564
|
+
`,oe=C.newClassNameGetter("pagination"),ll=({boundaries:e=1,className:t,classnames:o,disabled:r=!1,initialPage:l=1,loop:a=!1,onChange:c,page:s,ref:p,showControls:x=!1,siblings:g=1,total:h,variant:y="flat",...f})=>{const S=s!==void 0,[b,$]=u.useState(l),m=S?s:b,O=u.useRef(new Map),w=u.useRef(null),k=u.useRef(null),z=el(h,m,g,e),j=u.useCallback(v=>{S||$(v),c==null||c(v)},[S,c]),L=u.useCallback(v=>{v<1||v>h||v===m||j(v)},[m,j,h]),R=u.useCallback(()=>{if(m<=1){a&&j(h);return}j(m-1)},[m,a,j,h]),E=u.useCallback(()=>{if(m>=h){a&&j(1);return}j(m+1)},[m,a,j,h]);return u.useEffect(()=>{const v=k.current,I=w.current,N=O.current.get(m);if(!v||!I||!N)return;const M=I.getBoundingClientRect(),_=N.getBoundingClientRect().left-M.left;v.style.transform=`translateX(${_}px)`},[m,z]),i.jsxs(tl,{...f,ref:p||w,className:oe("container",t),children:[i.jsx(nl,{ref:k,className:oe("cursor",o==null?void 0:o.cursor)}),x&&i.jsx(nt,{className:oe("controls",o==null?void 0:o.controls),$disabled:r||!a&&m<=1,onClick:R,"aria-label":"Previous page",children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m15 18-6-6 6-6"})})}),z.map((v,I)=>v==="dots"?i.jsx(il,{className:oe("ellipsis",o==null?void 0:o.ellipsis),children:"..."},`dots-${I}`):i.jsx(rl,{ref:N=>{N?O.current.set(v,N):O.current.delete(v)},className:oe("item",o==null?void 0:o.item),$active:v===m,$variant:y,$disabled:r,onClick:()=>L(v),"aria-label":`Page ${v}`,"aria-current":v===m?"page":void 0,children:v},v)),x&&i.jsx(nt,{className:oe("controls",o==null?void 0:o.controls),$disabled:r||!a&&m>=h,onClick:E,"aria-label":"Next page",children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 18 6-6-6-6"})})})]})},it={light:{background:n.COLORS.white,border:n.alpha(n.COLORS.black,30),title:n.COLORS.black,description:n.COLORS["iron-grey"]},dark:{background:n.alpha(n.COLORS.white,5),border:n.alpha(n.COLORS.white,30),title:n.COLORS.white,description:"#9ca3af"}},Re=e=>it[e]??it.light,al=d.styled.div`
|
|
1564
1565
|
position: relative;
|
|
1565
1566
|
display: flex;
|
|
1566
1567
|
flex-direction: column;
|
|
@@ -1625,7 +1626,7 @@
|
|
|
1625
1626
|
display: flex;
|
|
1626
1627
|
align-items: center;
|
|
1627
1628
|
justify-content: center;
|
|
1628
|
-
`,
|
|
1629
|
+
`,Ie=d.styled.div`
|
|
1629
1630
|
position: absolute;
|
|
1630
1631
|
width: ${e=>e.$index===0?6:e.$index===1?4:3}px;
|
|
1631
1632
|
height: ${e=>e.$index===0?6:e.$index===1?4:3}px;
|
|
@@ -1651,7 +1652,7 @@
|
|
|
1651
1652
|
line-height: 1.5;
|
|
1652
1653
|
text-align: center;
|
|
1653
1654
|
max-width: 360px;
|
|
1654
|
-
`,Ll=40,kl=200,jl=30,at="АБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЭЮЯабвгдежзиклмнопрстуфхцчшщэюяABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",El=()=>at[Math.floor(Math.random()*at.length)],zl=e=>kl+e*jl,Nl=()=>Ll,
|
|
1655
|
+
`,Ll=40,kl=200,jl=30,at="АБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЭЮЯабвгдежзиклмнопрстуфхцчшщэюяABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",El=()=>at[Math.floor(Math.random()*at.length)],zl=e=>kl+e*jl,Nl=()=>Ll,Il=d.styled.div`
|
|
1655
1656
|
display: flex;
|
|
1656
1657
|
justify-content: center;
|
|
1657
1658
|
white-space: pre;
|
|
@@ -1661,23 +1662,23 @@
|
|
|
1661
1662
|
line-height: 1.6;
|
|
1662
1663
|
color: ${n.COLORS.black};
|
|
1663
1664
|
min-height: 1.6em;
|
|
1664
|
-
`,
|
|
1665
|
+
`,Tl=d.styled.span`
|
|
1665
1666
|
display: inline-block;
|
|
1666
1667
|
width: 0.65em;
|
|
1667
1668
|
text-align: center;
|
|
1668
|
-
`,Al=C.newClassNameGetter("split-flap-text"),vt=({className:e,ref:t,text:o,...r})=>{const[l,a]=u.useState(()=>o.split("")),c=u.useRef(o),s=u.useRef([]),p=u.useRef(null),x=u.useRef([]),g=u.useRef(o.split("")),h=u.useCallback(()=>{p.current&&(clearInterval(p.current),p.current=null);for(const f of x.current)clearTimeout(f);x.current=[]},[]),y=u.useCallback(f=>{h(),g.current=f,s.current=f.map(S=>S===" "),p.current=setInterval(()=>{a(S=>S.map((b,$)=>s.current[$]?g.current[$]:El()))},Nl()),x.current=f.map((S,b)=>setTimeout(()=>{s.current[b]=!0,s.current.every(Boolean)&&(p.current&&(clearInterval(p.current),p.current=null),a([...g.current]))},zl(b)))},[h]);return u.useEffect(()=>{o!==c.current&&(c.current=o,y(o.split("")))},[o,y]),u.useEffect(()=>h,[h]),i.jsx(
|
|
1669
|
+
`,Al=C.newClassNameGetter("split-flap-text"),vt=({className:e,ref:t,text:o,...r})=>{const[l,a]=u.useState(()=>o.split("")),c=u.useRef(o),s=u.useRef([]),p=u.useRef(null),x=u.useRef([]),g=u.useRef(o.split("")),h=u.useCallback(()=>{p.current&&(clearInterval(p.current),p.current=null);for(const f of x.current)clearTimeout(f);x.current=[]},[]),y=u.useCallback(f=>{h(),g.current=f,s.current=f.map(S=>S===" "),p.current=setInterval(()=>{a(S=>S.map((b,$)=>s.current[$]?g.current[$]:El()))},Nl()),x.current=f.map((S,b)=>setTimeout(()=>{s.current[b]=!0,s.current.every(Boolean)&&(p.current&&(clearInterval(p.current),p.current=null),a([...g.current]))},zl(b)))},[h]);return u.useEffect(()=>{o!==c.current&&(c.current=o,y(o.split("")))},[o,y]),u.useEffect(()=>h,[h]),i.jsx(Il,{...r,ref:t,className:Al("container",e),"aria-hidden":"true",children:l.map((f,S)=>i.jsx(Tl,{children:f===" "?" ":f},S))})},we=C.newClassNameGetter("pending-screen"),Pl=({className:e,classnames:t,description:o,interval:r,phrases:l,ref:a,...c})=>{const s=u.useMemo(()=>fl(l),[l]),p=u.useMemo(()=>yl(r),[r]),x=u.useMemo(()=>bl(s),[s]),g=u.useRef([]),h=u.useRef(0),y=u.useCallback(w=>(h.current>=g.current.length&&(g.current=lt(s.length,w),h.current=0),g.current[h.current++]),[s.length]),[f,S]=u.useState(()=>{g.current=lt(s.length);const w=g.current[0];return h.current=1,w}),b=u.useRef(null),$=u.useCallback(()=>{S(w=>y(w))},[y]);u.useEffect(()=>(b.current=setInterval($,p),()=>{b.current&&clearInterval(b.current)}),[$,p]);const m=s[f],O=$l(m,x);return i.jsxs(wl,{...c,ref:a,className:we("container",e),role:"status",children:[i.jsxs(vl,{className:we("indicator",t==null?void 0:t.indicator),children:[i.jsx(Ie,{$index:0}),i.jsx(Ie,{$index:1}),i.jsx(Ie,{$index:2})]}),i.jsx(vt,{text:O,className:we("board",t==null?void 0:t.board)}),i.jsx(Cl,{children:m}),o&&i.jsx(Rl,{className:we("description",t==null?void 0:t.description),children:o})]})},De={compact:{height:4,radius:2},default:{height:8,radius:4}},Bl=d.styled.div`
|
|
1669
1670
|
width: 100%;
|
|
1670
|
-
height: ${({$size:e})=>
|
|
1671
|
-
border-radius: ${({$size:e})=>
|
|
1671
|
+
height: ${({$size:e})=>De[e].height}px;
|
|
1672
|
+
border-radius: ${({$size:e})=>De[e].radius}px;
|
|
1672
1673
|
background-color: ${n.COLORS.gray};
|
|
1673
1674
|
overflow: hidden;
|
|
1674
1675
|
`,Ml=d.styled.div`
|
|
1675
1676
|
height: 100%;
|
|
1676
1677
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1677
|
-
border-radius: ${({$size:e})=>
|
|
1678
|
+
border-radius: ${({$size:e})=>De[e].radius}px;
|
|
1678
1679
|
background-color: ${n.COLORS.black};
|
|
1679
1680
|
transition: width 0.2s ease;
|
|
1680
|
-
`,dt=C.newClassNameGetter("progress"),
|
|
1681
|
+
`,dt=C.newClassNameGetter("progress"),_l=({value:e,size:t="default",className:o,classnames:r,ref:l,...a})=>i.jsx(Bl,{...a,ref:l,$size:t,className:dt("track",o,r==null?void 0:r.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:i.jsx(Ml,{$size:t,$value:e,className:dt("bar",r==null?void 0:r.bar)})}),Ct=u.createContext(null),Dl=d.styled.div`
|
|
1681
1682
|
position: fixed;
|
|
1682
1683
|
bottom: 24px;
|
|
1683
1684
|
right: 24px;
|
|
@@ -1692,37 +1693,37 @@
|
|
|
1692
1693
|
animation: ${n.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1693
1694
|
pointer-events: none;
|
|
1694
1695
|
color: ${n.COLORS.black};
|
|
1695
|
-
`,
|
|
1696
|
+
`,Fl=d.styled.span`
|
|
1696
1697
|
font-size: 14px;
|
|
1697
1698
|
font-weight: 500;
|
|
1698
1699
|
white-space: nowrap;
|
|
1699
|
-
`,Gl=({children:e,defaultMessage:t="Saving"})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(t),c=u.useCallback(x=>{a(x??t),r(!0)},[t]),s=u.useCallback(()=>{r(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:s}),[o,c,s]);return i.jsxs(Ct.Provider,{value:p,children:[e,o&&i.jsxs(
|
|
1700
|
+
`,Gl=({children:e,defaultMessage:t="Saving"})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(t),c=u.useCallback(x=>{a(x??t),r(!0)},[t]),s=u.useCallback(()=>{r(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:s}),[o,c,s]);return i.jsxs(Ct.Provider,{value:p,children:[e,o&&i.jsxs(Dl,{children:[i.jsx(d.Spinner,{size:"sm"}),i.jsx(Fl,{children:l})]})]})},Xl=()=>{const e=u.useContext(Ct);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},Yl=P.keyframes`
|
|
1700
1701
|
0% { opacity: 1; }
|
|
1701
1702
|
50% { opacity: 0.4; }
|
|
1702
1703
|
100% { opacity: 1; }
|
|
1703
|
-
`,
|
|
1704
|
+
`,Hl=P.keyframes`
|
|
1704
1705
|
0% { transform: translateX(-100%); }
|
|
1705
1706
|
60% { transform: translateX(100%); }
|
|
1706
1707
|
100% { transform: translateX(100%); }
|
|
1707
1708
|
`,Ul=P.css`
|
|
1708
|
-
animation: ${
|
|
1709
|
+
animation: ${Yl} 1.5s ease-in-out infinite;
|
|
1709
1710
|
`,Wl=P.css`
|
|
1710
1711
|
&::after {
|
|
1711
1712
|
content: '';
|
|
1712
1713
|
position: absolute;
|
|
1713
1714
|
inset: 0;
|
|
1714
1715
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
|
|
1715
|
-
animation: ${
|
|
1716
|
+
animation: ${Hl} 1.6s linear infinite;
|
|
1716
1717
|
}
|
|
1717
|
-
`,ql={pulse:Ul,wave:Wl,none:null},
|
|
1718
|
+
`,ql={pulse:Ul,wave:Wl,none:null},Zl={none:"0",sm:"4px",md:"8px",lg:"12px",full:"9999px"},Te=e=>typeof e=="number"?`${e}px`:e,Kl=d.styled.div`
|
|
1718
1719
|
position: relative;
|
|
1719
1720
|
overflow: hidden;
|
|
1720
1721
|
background-color: #e5e7eb;
|
|
1721
|
-
width: ${({$width:e,$circle:t,$height:o})=>
|
|
1722
|
-
height: ${({$height:e})=>
|
|
1723
|
-
border-radius: ${({$circle:e,$radius:t})=>e?"50%":
|
|
1722
|
+
width: ${({$width:e,$circle:t,$height:o})=>Te(t?o:e)};
|
|
1723
|
+
height: ${({$height:e})=>Te(e)};
|
|
1724
|
+
border-radius: ${({$circle:e,$radius:t})=>e?"50%":Zl[t]};
|
|
1724
1725
|
${({$animation:e})=>ql[e]}
|
|
1725
|
-
`,
|
|
1726
|
+
`,Vl=C.newClassNameGetter("skeleton"),Ql=({animation:e="pulse",circle:t=!1,className:o,height:r=16,radius:l="md",ref:a,width:c="100%",...s})=>i.jsx(Kl,{...s,ref:a,className:Vl("container",o),$animation:e,$circle:t,$height:r,$radius:l,$width:c}),Jl=d.styled.span`
|
|
1726
1727
|
display: inline-flex;
|
|
1727
1728
|
align-items: baseline;
|
|
1728
1729
|
gap: 4px;
|
|
@@ -1922,11 +1923,11 @@
|
|
|
1922
1923
|
`,st=C.newClassNameGetter("tabs"),za=({className:e,classnames:t,onChange:o,ref:r,tabs:l,value:a,...c})=>i.jsx(ja,{...c,ref:r,className:st("container",e),role:"tablist",children:l.map(s=>i.jsx(Ea,{type:"button",role:"tab","aria-selected":a===s.value,$active:a===s.value,$disabled:!!s.disabled,disabled:s.disabled,onClick:()=>o(s.value),className:st("tab",t==null?void 0:t.tab),children:s.label},s.value))}),Na=d.styled.div`
|
|
1923
1924
|
display: flex;
|
|
1924
1925
|
flex-direction: column;
|
|
1925
|
-
`,
|
|
1926
|
+
`,Ia=d.styled.div`
|
|
1926
1927
|
display: grid;
|
|
1927
1928
|
grid-template-columns: 20px 1fr;
|
|
1928
1929
|
gap: 0 12px;
|
|
1929
|
-
`,
|
|
1930
|
+
`,Ta=d.styled.div`
|
|
1930
1931
|
display: flex;
|
|
1931
1932
|
flex-direction: column;
|
|
1932
1933
|
align-items: center;
|
|
@@ -1951,18 +1952,18 @@
|
|
|
1951
1952
|
align-items: flex-start;
|
|
1952
1953
|
justify-content: space-between;
|
|
1953
1954
|
gap: 8px;
|
|
1954
|
-
`,
|
|
1955
|
+
`,_a=d.styled.div`
|
|
1955
1956
|
font-size: 15px;
|
|
1956
1957
|
font-weight: 600;
|
|
1957
1958
|
color: ${n.COLORS.black};
|
|
1958
1959
|
line-height: 20px;
|
|
1959
1960
|
min-width: 0;
|
|
1960
|
-
`,
|
|
1961
|
+
`,Da=d.styled.div`
|
|
1961
1962
|
display: flex;
|
|
1962
1963
|
align-items: center;
|
|
1963
1964
|
gap: 4px;
|
|
1964
1965
|
flex-shrink: 0;
|
|
1965
|
-
`,
|
|
1966
|
+
`,Fa=d.styled.div`
|
|
1966
1967
|
font-size: 13px;
|
|
1967
1968
|
color: ${n.COLORS["iron-grey"]};
|
|
1968
1969
|
margin-top: 2px;
|
|
@@ -1972,7 +1973,7 @@
|
|
|
1972
1973
|
color: ${n.COLORS["iron-grey"]};
|
|
1973
1974
|
margin-top: 8px;
|
|
1974
1975
|
line-height: 1.5;
|
|
1975
|
-
`,
|
|
1976
|
+
`,Y=C.newClassNameGetter("timeline"),Xa=({className:e,classnames:t,items:o,ref:r,...l})=>i.jsx(Na,{...l,ref:r,className:Y("container",e),children:o.map((a,c)=>{const s=c===o.length-1;return i.jsxs(Ia,{className:Y("item",t==null?void 0:t.item),children:[i.jsxs(Ta,{$last:s,children:[i.jsx(Aa,{className:Y("dot",t==null?void 0:t.dot)}),i.jsx(Pa,{className:Y("line",t==null?void 0:t.line),$last:s})]}),i.jsxs(Ba,{className:Y("content",t==null?void 0:t.content),$last:s,children:[i.jsxs(Ma,{children:[i.jsxs("div",{children:[i.jsx(_a,{className:Y("title",t==null?void 0:t.title),children:a.title}),a.description&&i.jsx(Fa,{className:Y("description",t==null?void 0:t.description),children:a.description})]}),a.actions&&i.jsx(Da,{className:Y("actions",t==null?void 0:t.actions),children:a.actions})]}),a.content&&i.jsx(Ga,{className:Y("body",t==null?void 0:t.body),children:a.content})]})]},c)})}),Rt=u.createContext(null),Pe=3,ct={default:{background:"#374151",text:n.COLORS.white,border:"#374151"},success:{background:n.COLORS.green,text:n.COLORS.white,border:n.COLORS.green},warning:{background:n.COLORS.yellow,text:n.COLORS.white,border:n.COLORS.yellow},danger:{background:n.COLORS.red,text:n.COLORS.white,border:n.COLORS.red}},Ya=(e,t)=>{switch(t.type){case"ADD_TOAST":{const o=t.payload;return e.toasts.length<Pe?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=t.payload,r=e.toasts.filter(a=>a.id!==o),l=e.queue[0];return l&&r.length<Pe?{toasts:[...r,l],queue:e.queue.slice(1)}:{...e,toasts:r}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=Pe?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},Ha={toasts:[],queue:[]},Be=e=>ct[e]??ct.default,Ua=d.styled.div`
|
|
1976
1977
|
position: fixed;
|
|
1977
1978
|
bottom: 24px;
|
|
1978
1979
|
left: 24px;
|
|
@@ -2006,7 +2007,7 @@
|
|
|
2006
2007
|
white-space: nowrap;
|
|
2007
2008
|
overflow: hidden;
|
|
2008
2009
|
text-overflow: ellipsis;
|
|
2009
|
-
`,
|
|
2010
|
+
`,Za=d.styled.button`
|
|
2010
2011
|
display: flex;
|
|
2011
2012
|
align-items: center;
|
|
2012
2013
|
justify-content: center;
|
|
@@ -2024,13 +2025,13 @@
|
|
|
2024
2025
|
&:hover {
|
|
2025
2026
|
opacity: 1;
|
|
2026
2027
|
}
|
|
2027
|
-
`,
|
|
2028
|
+
`,Ka=d.styled.div`
|
|
2028
2029
|
display: flex;
|
|
2029
2030
|
align-items: center;
|
|
2030
2031
|
justify-content: space-between;
|
|
2031
2032
|
gap: 12px;
|
|
2032
2033
|
width: 100%;
|
|
2033
|
-
`,
|
|
2034
|
+
`,Va=d.styled.div`
|
|
2034
2035
|
display: flex;
|
|
2035
2036
|
align-items: center;
|
|
2036
2037
|
justify-content: center;
|
|
@@ -2045,7 +2046,7 @@
|
|
|
2045
2046
|
font-weight: 500;
|
|
2046
2047
|
white-space: nowrap;
|
|
2047
2048
|
margin-left: auto;
|
|
2048
|
-
`,pt=({toast:e,onHide:t})=>{const[o,r]=u.useState(!1),l=()=>{r(!0),setTimeout(()=>{t(e.id)},300)};return u.useEffect(()=>{if(e.duration){const a=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(a)}},[e.duration,e.id]),i.jsxs(Wa,{$variant:e.variant,$isExiting:o,children:[i.jsx(qa,{children:e.message}),i.jsx(
|
|
2049
|
+
`,pt=({toast:e,onHide:t})=>{const[o,r]=u.useState(!1),l=()=>{r(!0),setTimeout(()=>{t(e.id)},300)};return u.useEffect(()=>{if(e.duration){const a=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(a)}},[e.duration,e.id]),i.jsxs(Wa,{$variant:e.variant,$isExiting:o,children:[i.jsx(qa,{children:e.message}),i.jsx(Za,{onClick:l,children:i.jsx(i.X,{style:{width:16,height:16}})})]})},Qa=({toasts:e,queueCount:t,onHide:o})=>{if(e.length===0)return null;const r=e.length-1;return i.jsx(Ua,{children:e.map((l,a)=>a===r&&t>0?i.jsxs(Ka,{children:[i.jsx(pt,{toast:l,onHide:o}),i.jsxs(Va,{children:["+",t]})]},l.id):i.jsx(pt,{toast:l,onHide:o},l.id))})},Ja=({children:e})=>{const[t,o]=u.useReducer(Ya,Ha),r=u.useCallback((a,c="default",s)=>{const p=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_TOAST",payload:{id:p,message:a,variant:c,duration:s}})},[]),l=u.useCallback(a=>{o({type:"REMOVE_TOAST",payload:a})},[]);return i.jsxs(Rt.Provider,{value:{show:r,hide:l},children:[e,i.jsx(Qa,{toasts:t.toasts,queueCount:t.queue.length,onHide:l})]})},ed=()=>{const e=u.useContext(Rt);if(!e)throw new Error("useToastr must be used within ToastProvider");return e},ut={dark:{background:n.COLORS.black,text:n.COLORS.white},light:{background:n.COLORS.white,text:n.COLORS.black,border:n.COLORS.gray},success:{background:n.COLORS.green,text:n.COLORS.white},warning:{background:n.COLORS.yellow,text:n.COLORS.white},danger:{background:n.COLORS.red,text:n.COLORS.white}},ue=e=>ut[e]??ut.dark,td=(e,t)=>{const o=ue(t).background;switch(e){case"top":return`
|
|
2049
2050
|
bottom: -12px;
|
|
2050
2051
|
left: 50%;
|
|
2051
2052
|
margin-left: -6px;
|
|
@@ -2094,7 +2095,6 @@
|
|
|
2094
2095
|
border-right-color: ${o};
|
|
2095
2096
|
}
|
|
2096
2097
|
`;default:return""}},Lt=e=>`
|
|
2097
|
-
z-index: 1000;
|
|
2098
2098
|
padding: 6px 12px;
|
|
2099
2099
|
background-color: ${ue(e.$variant).background};
|
|
2100
2100
|
color: ${ue(e.$variant).text};
|
|
@@ -2155,12 +2155,14 @@
|
|
|
2155
2155
|
transform: translateY(-50%);
|
|
2156
2156
|
`;default:return""}},id=d.styled.div`
|
|
2157
2157
|
position: absolute;
|
|
2158
|
+
z-index: ${n.Z_INDEX.dropdown};
|
|
2158
2159
|
${e=>Lt(e)}
|
|
2159
2160
|
${({$placement:e})=>nd(e)}
|
|
2160
2161
|
`,ld=d.styled.div`
|
|
2161
2162
|
position: fixed;
|
|
2163
|
+
z-index: ${n.Z_INDEX.portalDropdown};
|
|
2162
2164
|
${e=>Lt(e)}
|
|
2163
|
-
`,Me=C.newClassNameGetter("tooltip"),
|
|
2165
|
+
`,Me=C.newClassNameGetter("tooltip"),V=8,ad=({children:e,className:t,classnames:o,content:r,delay:l=200,placement:a="top",portalRenderNode:c,ref:s,variant:p="dark",...x})=>{const[g,h]=u.useState(!1),[y,f]=u.useState(null),[S,b]=u.useState(a),[$,m]=u.useState({top:0,left:0}),O=u.useRef(null),w=u.useRef(null),k=u.useCallback(()=>{var U,W;if(!O.current)return;const R=O.current.getBoundingClientRect(),E=((U=w.current)==null?void 0:U.offsetWidth)??100,v=((W=w.current)==null?void 0:W.offsetHeight)??30,I=R.top-V,N=window.innerHeight-R.bottom-V,M=R.left-V,X=window.innerWidth-R.right-V;let _=a;if(a==="top"&&I<v&&N>I?_="bottom":a==="bottom"&&N<v&&I>N?_="top":a==="left"&&M<E&&X>M?_="right":a==="right"&&X<E&&M>X&&(_="left"),b(_),c){let D,F;switch(_){case"top":D=R.top-v-V,F=R.left+R.width/2-E/2;break;case"bottom":D=R.bottom+V,F=R.left+R.width/2-E/2;break;case"left":D=R.top+R.height/2-v/2,F=R.left-E-V;break;case"right":D=R.top+R.height/2-v/2,F=R.right+V;break;default:D=0,F=0}const q=8;F=Math.max(q,Math.min(F,window.innerWidth-E-q)),D=Math.max(q,Math.min(D,window.innerHeight-v-q)),m({top:D,left:F})}},[a,c]);u.useLayoutEffect(()=>{g&&k()},[g,k]);const z=()=>{const R=setTimeout(()=>{h(!0)},l);f(R)},j=()=>{y&&(clearTimeout(y),f(null)),h(!1)},L=c?Fe.createPortal(i.jsx(ld,{ref:w,className:Me("content",o==null?void 0:o.content),$placement:S,$variant:p,$visible:g,style:{top:$.top,left:$.left},children:r}),c):i.jsx(id,{ref:w,className:Me("content",o==null?void 0:o.content),$placement:S,$variant:p,$visible:g,children:r});return i.jsxs(rd,{...x,ref:R=>{O.current=R,typeof s=="function"?s(R):s&&(s.current=R)},className:Me("wrapper",t),onMouseEnter:z,onMouseLeave:j,children:[e,L]})},dd=d.styled.div`
|
|
2164
2166
|
display: inline-flex;
|
|
2165
2167
|
align-items: center;
|
|
2166
2168
|
gap: 12px;
|
|
@@ -2177,5 +2179,5 @@
|
|
|
2177
2179
|
font-size: 12px;
|
|
2178
2180
|
color: #666;
|
|
2179
2181
|
line-height: 1.4;
|
|
2180
|
-
`,Ce=C.newClassNameGetter("user"),ud=({avatarPosition:e="left",avatarProps:t,className:o,classnames:r,description:l,name:a,ref:c,src:s,...p})=>{const x=e==="right";return i.jsxs(dd,{...p,ref:c,className:Ce("container",o),$reverse:x,children:[i.jsx(xt,{size:"sm",...t,name:typeof a=="string"?a:void 0,src:s??(t==null?void 0:t.src),className:Ce("avatar",r==null?void 0:r.avatar)}),i.jsxs(sd,{$align:x?"right":"left",children:[i.jsx(cd,{className:Ce("name",r==null?void 0:r.name),children:a}),l&&i.jsx(pd,{className:Ce("description",r==null?void 0:r.description),children:l})]})]})};exports.BREAKPOINTS=n.BREAKPOINTS;exports.COLORS=n.COLORS;exports.KEYFRAMES=n.KEYFRAMES;exports.KEY_SYMBOLS=n.KEY_SYMBOLS;exports.alpha=n.alpha;exports.getBrowser=n.getBrowser;exports.getKeySymbols=n.getKeySymbols;exports.getOperatingSystem=n.getOperatingSystem;exports.isValid=n.isValid;exports.toHEX=n.toHEX;exports.useKeyBinding=n.useKeyBinding;exports.mediaBetween=
|
|
2182
|
+
`,Ce=C.newClassNameGetter("user"),ud=({avatarPosition:e="left",avatarProps:t,className:o,classnames:r,description:l,name:a,ref:c,src:s,...p})=>{const x=e==="right";return i.jsxs(dd,{...p,ref:c,className:Ce("container",o),$reverse:x,children:[i.jsx(xt,{size:"sm",...t,name:typeof a=="string"?a:void 0,src:s??(t==null?void 0:t.src),className:Ce("avatar",r==null?void 0:r.avatar)}),i.jsxs(sd,{$align:x?"right":"left",children:[i.jsx(cd,{className:Ce("name",r==null?void 0:r.name),children:a}),l&&i.jsx(pd,{className:Ce("description",r==null?void 0:r.description),children:l})]})]})};exports.BREAKPOINTS=n.BREAKPOINTS;exports.COLORS=n.COLORS;exports.KEYFRAMES=n.KEYFRAMES;exports.KEY_SYMBOLS=n.KEY_SYMBOLS;exports.Z_INDEX=n.Z_INDEX;exports.alpha=n.alpha;exports.getBrowser=n.getBrowser;exports.getKeySymbols=n.getKeySymbols;exports.getOperatingSystem=n.getOperatingSystem;exports.isValid=n.isValid;exports.toHEX=n.toHEX;exports.useKeyBinding=n.useKeyBinding;exports.mediaBetween=H.mediaBetween;exports.mediaDown=H.mediaDown;exports.mediaUp=H.mediaUp;exports.validation=H.index;exports.Autocomplete=d.Autocomplete;exports.Button=d.Button;exports.Checkbox=d.Checkbox;exports.CheckboxCard=d.CheckboxCard;exports.CheckboxGroup=d.CheckboxGroup;exports.Chip=d.Chip;exports.DatePicker=d.DatePicker;exports.FieldLabel=d.FieldLabel;exports.FieldMessage=d.FieldMessage;exports.Input=d.Input;exports.KeySymbol=d.KeySymbol;exports.KeysBindings=d.KeysBindings;exports.Modal=d.Modal;exports.MultiSelect=d.MultiSelect;exports.OtpCode=d.OtpCode;exports.Radio=d.Radio;exports.RadioCard=d.RadioCard;exports.RadioGroup=d.RadioGroup;exports.Select=d.Select;exports.Spinner=d.Spinner;exports.Tags=d.Tags;exports.Textarea=d.Textarea;exports.Toggle=d.Toggle;exports.ToggleCard=d.ToggleCard;exports.ToggleGroup=d.ToggleGroup;exports.formatDateGo=d.formatDateGo;exports.newClassNameGetter=C.newClassNameGetter;exports.Accordion=_t;exports.Alert=Wt;exports.Avatar=xt;exports.AvatarGroup=to;exports.Badge=ao;exports.BreadcrumbItem=so;exports.Breadcrumbs=fo;exports.Card=wo;exports.CardBody=Co;exports.CardFooter=Lo;exports.CardHeader=jo;exports.ConfirmationProvider=Go;exports.Container=Uo;exports.DateRange=Ko;exports.Divider=Jo;exports.Drawer=nr;exports.Dropdown=cr;exports.EmptyState=$r;exports.FieldRow=Or;exports.FileUpload=Ur;exports.FileUploadItem=Kr;exports.GlobalStyle=Et;exports.Hashtag=tn;exports.Heading=nn;exports.ImageCropper=ui;exports.MenuButton=hi;exports.NotificationProvider=Ci;exports.NotifyConfirmationProvider=Bi;exports.Overline=Gi;exports.Pagination=ll;exports.Panel=gl;exports.PendingScreen=Pl;exports.Progress=_l;exports.SaveProgressProvider=Gl;exports.ShellScreen=Ji;exports.Skeleton=Ql;exports.SplitFlapText=vt;exports.Stat=oa;exports.StepLog=ma;exports.Stepper=ka;exports.Tabs=za;exports.Timeline=Xa;exports.ToastProvider=Ja;exports.Tooltip=ad;exports.User=ud;exports.formatFileSize=bt;exports.useConfirmation=Xo;exports.useImageCropper=mt;exports.useNotification=Ri;exports.useNotifyConfirmation=Mi;exports.useSaveProgress=Xl;exports.useToastr=ed;
|
|
2181
2183
|
//# sourceMappingURL=index.cjs.map
|