@vacano/ui 1.15.2 → 1.15.4
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 +1302 -0
- package/dist/ToggleGroup-C3ReF8j7.cjs.map +1 -0
- package/dist/{ToggleGroup-C44x4Sx1.js → ToggleGroup-TWO3UOqH.js} +1229 -1174
- package/dist/ToggleGroup-TWO3UOqH.js.map +1 -0
- package/dist/form.cjs +1 -1
- package/dist/form.d.ts +1 -0
- package/dist/form.js +1 -1
- package/dist/index.cjs +89 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +538 -523
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/ToggleGroup-C44x4Sx1.js.map +0 -1
- package/dist/ToggleGroup-COFNoVg9.cjs +0 -1294
- package/dist/ToggleGroup-COFNoVg9.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-D8zOi0jU.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./keyboard-D8zOi0jU.cjs"),X=require("./index-GSZAZ6Cz.cjs"),i=require("./X-CI1qRJDP.cjs"),B=require("@emotion/react"),u=require("react"),d=require("./ToggleGroup-C3ReF8j7.cjs"),C=require("./tooling-Dflq0Y98.cjs"),De=require("react-dom"),Le=require("./CircleX-BzaN6v37.cjs"),jt=B.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
:focus:not(:focus-visible) {
|
|
101
101
|
outline: none;
|
|
102
102
|
}
|
|
103
|
-
`,Et=()=>
|
|
103
|
+
`,Et=()=>i.jsx(B.Global,{styles:jt}),zt=d.styled.div`
|
|
104
104
|
display: flex;
|
|
105
105
|
flex-direction: column;
|
|
106
106
|
gap: ${({$variant:e})=>e==="splitted"?"8px":"0"};
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
font-size: 14px;
|
|
155
155
|
line-height: 1.5;
|
|
156
156
|
color: ${n.COLORS["iron-grey"]};
|
|
157
|
-
`,ne=C.newClassNameGetter("accordion"),Mt=()=>
|
|
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"})}),Ft=({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(Tt,{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(It,{$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)})})},_t={none:"0",sm:"8px",md:"12px",lg:"16px",full:"9999px"},Dt={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;
|
|
@@ -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:
|
|
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(Yt,{$variant:s,className:xe("icon",t==null?void 0:t.icon),children:i.jsx("span",{children:r})}),i.jsxs(Ht,{children:[c&&i.jsx(Xt,{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},Kt={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}},Vt=d.styled.div`
|
|
212
212
|
position: relative;
|
|
213
213
|
display: inline-flex;
|
|
214
214
|
align-items: center;
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
}
|
|
243
243
|
`,Jt=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:
|
|
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(Vt,{...h,ref:p,className:ie("container",t),$size:x,$radius:s,$color:r,$bordered:e,$disabled:l,children:S?i.jsx(Zt,{className:ie("image",o==null?void 0:o.image),src:g,alt:c||"",onError:()=>f(!0)}):a?i.jsx(Ye,{className:ie("fallback",o==null?void 0:o.fallback),$size:x,children:a}):c?i.jsx(Jt,{className:ie("initials",o==null?void 0:o.initials),children:qt(c)}):i.jsx(Ye,{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"})})})})},Qt=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
|
-
`,He=C.newClassNameGetter("avatar-group"),to=({children:e,className:t,classnames:o,max:r=5,ref:
|
|
265
|
+
`,He=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(Qt,{...c,ref:l,className:He("container",t),$size:a,children:[p.map(g=>u.isValidElement(g)?u.cloneElement(g,{size:a}):g),x>0&&i.jsxs(eo,{className:He("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
|
-
`,Xe=C.newClassNameGetter("badge"),ao=({children:e,className:t,classnames:o,color:r="default",content:
|
|
306
|
+
`,Xe=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:Xe("container",t),children:[e,i.jsx(lo,{className:Xe("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=()=>
|
|
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,v,k)=>{const{current:z,disabled:j,href:L,startContent:R,endContent:E}=O.props,w=z||k,T=r||j&&!w;return i.jsxs(Ue,{$size:x,$current:w,$disabled:!!T,children:[i.jsxs(uo,{as:L&&!w?"a":"span",href:L&&!w?L:void 0,$current:w,$disabled:!!T,children:[R,O.props.children,E]}),!k&&b(`sep-${v}`)]},v)},m=()=>{if(S){const O=y.slice(0,a),v=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")]}),v.map((k,z)=>{const j=f-l+z;return $(k,j,j===f-1)})]})}return y.map((O,v)=>$(O,v,v===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;
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
-webkit-backdrop-filter: blur(10px);
|
|
441
441
|
border-top: 1px solid ${n.alpha(n.COLORS["iron-grey"],15)};
|
|
442
442
|
`}
|
|
443
|
-
`,Oo=C.newClassNameGetter("card"),vo=({blurred:e=!1,border:t=!1,children:o,className:r,disabled:
|
|
443
|
+
`,Oo=C.newClassNameGetter("card"),vo=({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})},wo=C.newClassNameGetter("card"),Co=({children:e,className:t,ref:o,...r})=>i.jsx(So,{...r,ref:o,className:wo("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=B.keyframes`
|
|
444
444
|
from {
|
|
445
445
|
opacity: 0;
|
|
446
446
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -483,38 +483,38 @@
|
|
|
483
483
|
display: flex;
|
|
484
484
|
align-items: center;
|
|
485
485
|
gap: 8px;
|
|
486
|
-
`,Bo=({confirmation:e,onDone:t})=>{const[o,r]=u.useState(!1),[
|
|
486
|
+
`,Bo=({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(Io,{$isExiting:o,children:[i.jsx(Ao,{children:c}),i.jsxs(Po,{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),Mo=()=>{},Fo=({children:e})=>{const[t,o]=u.useState(null),r=u.useCallback((a,c,s,p)=>{o({open:!0,message:a,onConfirm:c,onCancel:s||Mo,options:p||{}})},[]),l=u.useCallback(()=>{o(null)},[]);return i.jsxs(ht.Provider,{value:{show:r,hide:l},children:[e,t&&i.jsx(Bo,{confirmation:t,onDone:l})]})},_o=()=>{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`},Do=d.styled.div`
|
|
487
487
|
width: 100%;
|
|
488
488
|
|
|
489
|
-
${
|
|
489
|
+
${X.mediaUp("sm")} {
|
|
490
490
|
max-width: ${le.sm};
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
${
|
|
493
|
+
${X.mediaUp("md")} {
|
|
494
494
|
max-width: ${le.md};
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
${
|
|
497
|
+
${X.mediaUp("lg")} {
|
|
498
498
|
max-width: ${le.lg};
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
-
${
|
|
501
|
+
${X.mediaUp("xl")} {
|
|
502
502
|
max-width: ${le.xl};
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
-
${
|
|
505
|
+
${X.mediaUp("2xl")} {
|
|
506
506
|
max-width: ${le["2xl"]};
|
|
507
507
|
}
|
|
508
|
-
`,Go=C.newClassNameGetter("container"),Yo=({children:e,className:t,ref:o,...r})=>
|
|
508
|
+
`,Go=C.newClassNameGetter("container"),Yo=({children:e,className:t,ref:o,...r})=>i.jsx(Do,{...r,ref:o,className:Go("container",t),children:e}),Ho=["January","February","March","April","May","June","July","August","September","October","November","December"],qe=e=>{const t=e.getFullYear(),o=Ho[e.getMonth()];return`${t}, ${o}`},Xo=d.styled.span`
|
|
509
509
|
display: inline-flex;
|
|
510
510
|
align-items: baseline;
|
|
511
|
-
gap:
|
|
512
|
-
font-size:
|
|
513
|
-
font-weight:
|
|
514
|
-
color:
|
|
511
|
+
gap: 5px;
|
|
512
|
+
font-size: 13px;
|
|
513
|
+
font-weight: 500;
|
|
514
|
+
color: ${n.COLORS["iron-grey"]};
|
|
515
515
|
`,Uo=d.styled.span`
|
|
516
516
|
font-weight: 500;
|
|
517
|
-
`,Wo=d.styled.span``,ae=C.newClassNameGetter("date-range"),qo=({className:e,classnames:t,from:o,presentLabel:r="Present Time",ref:
|
|
517
|
+
`,Wo=d.styled.span``,ae=C.newClassNameGetter("date-range"),qo=({className:e,classnames:t,from:o,presentLabel:r="Present Time",ref:l,to:a,...c})=>i.jsxs(Xo,{...c,ref:l,className:ae("container",e),children:[i.jsx(Uo,{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)}),i.jsx(Wo,{className:ae("separator",t==null?void 0:t.separator),children:"—"}),i.jsx("span",{className:ae("to",t==null?void 0:t.to),children:a?qe(a):r})]}),Ko=d.styled.div`
|
|
518
518
|
display: flex;
|
|
519
519
|
flex-direction: row;
|
|
520
520
|
align-items: center;
|
|
@@ -529,7 +529,7 @@
|
|
|
529
529
|
font-size: 12px;
|
|
530
530
|
color: ${n.COLORS["iron-grey"]};
|
|
531
531
|
white-space: nowrap;
|
|
532
|
-
`,fe=C.newClassNameGetter("divider"),Zo=({children:e,className:t,classnames:o,ref:r,spacing:
|
|
532
|
+
`,fe=C.newClassNameGetter("divider"),Zo=({children:e,className:t,classnames:o,ref:r,spacing:l=8,...a})=>i.jsxs(Ko,{...a,ref:r,className:fe("container",t),$spacing:l,children:[i.jsx(Ke,{className:fe("line",o==null?void 0:o.line)}),e&&i.jsxs(i.Fragment,{children:[i.jsx(Vo,{className:fe("label",o==null?void 0:o.label),children:e}),i.jsx(Ke,{className:fe("line",o==null?void 0:o.line)})]})]}),Jo={left:n.KEYFRAMES.slideInLeft,right:n.KEYFRAMES.slideInRight,top:n.KEYFRAMES.slideInTop,bottom:n.KEYFRAMES.slideInBottom},Qo=(e,t)=>{switch(e){case"left":return`
|
|
533
533
|
top: 0;
|
|
534
534
|
left: 0;
|
|
535
535
|
height: 100%;
|
|
@@ -556,7 +556,7 @@
|
|
|
556
556
|
box-shadow: 0 4px 24px ${n.alpha(n.COLORS.black,20)};
|
|
557
557
|
${e=>Qo(e.$position,e.$size)}
|
|
558
558
|
animation: ${e=>Jo[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
559
|
-
`,tr=C.newClassNameGetter("drawer"),or=({animated:e,children:t,className:o,open:r,position:
|
|
559
|
+
`,tr=C.newClassNameGetter("drawer"),or=({animated:e,children:t,className:o,open:r,position:l="right",ref:a,size:c="400px",...s})=>r?De.createPortal(i.jsx(er,{...s,ref:a,className:tr("container",o),$animated:!!e,$position:l,$size:c,children:t}),document.body):null,rr=d.styled.div`
|
|
560
560
|
position: relative;
|
|
561
561
|
display: inline-block;
|
|
562
562
|
`,nr=d.styled.div`
|
|
@@ -591,7 +591,7 @@
|
|
|
591
591
|
opacity 0.15s ease,
|
|
592
592
|
transform 0.15s ease,
|
|
593
593
|
visibility 0.15s;
|
|
594
|
-
`,ye=C.newClassNameGetter("dropdown"),be=4,ar=100,dr=({align:e="left",autoClose:t=!0,children:o,className:r,classnames:
|
|
594
|
+
`,ye=C.newClassNameGetter("dropdown"),be=4,ar=100,dr=({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),v=u.useRef(null),k=u.useRef(null),z=s!==void 0,j=z?s:y,L=u.useCallback(()=>{var _,D;if(!v.current)return;const N=v.current.getBoundingClientRect(),M=((_=k.current)==null?void 0:_.offsetHeight)??ar,Y=((D=k.current)==null?void 0:D.offsetWidth)??160,F=window.innerHeight-N.bottom-be,U=N.top-be,W=F<M&&U>F?"top":"bottom";if(m(W),p){let q;e==="left"?q=N.left:q=N.right-Y;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]),w=u.useCallback(()=>{t&&E()},[t,E]);u.useLayoutEffect(()=>{j&&L()},[j,L]),u.useEffect(()=>{const N=U=>{const W=U.target,_=O.current&&!O.current.contains(W),D=k.current&&!k.current.contains(W);p?_&&D&&E():_&&E()},M=U=>{U.key==="Escape"&&E()},Y=()=>{j&&p&&L()},F=()=>{j&&p&&L()};return j&&(document.addEventListener("mousedown",N),document.addEventListener("keydown",M),p&&(window.addEventListener("scroll",Y,!0),window.addEventListener("resize",F))),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",M),window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",F)}},[j,E,p,L]);const T=p?De.createPortal(i.jsx(lr,{ref:k,$open:j,$position:$,className:ye("content",l==null?void 0:l.content),style:{top:S.top,left:S.left},onClick:w,children:o}),p):i.jsx(ir,{ref:k,$align:e,$open:j,$position:$,className:ye("content",l==null?void 0:l.content),onClick:w,children:o});return i.jsxs(rr,{...h,ref:x??O,className:ye("container",r),children:[i.jsx(nr,{ref:v,onClick:R,className:ye("trigger",l==null?void 0:l.trigger),children:u.cloneElement(g)}),T]})},sr=d.styled.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
align-items: center;
|
|
@@ -678,7 +678,7 @@
|
|
|
678
678
|
align-items: center;
|
|
679
679
|
gap: 12px;
|
|
680
680
|
margin-top: 20px;
|
|
681
|
-
`,de=C.newClassNameGetter("empty-state"),yr=({actions:e,className:t,classnames:o,description:r,icon:
|
|
681
|
+
`,de=C.newClassNameGetter("empty-state"),yr=({actions:e,className:t,classnames:o,description:r,icon:l,ref:a,title:c,...s})=>i.jsxs(sr,{...s,ref:a,className:de("container",t),children:[l&&i.jsxs(cr,{className:de("icon",o==null?void 0:o.icon),children:[i.jsx(ur,{}),i.jsx(pr,{}),i.jsx(gr,{children:l})]}),i.jsx(xr,{className:de("title",o==null?void 0:o.title),children:c}),r&&i.jsx(hr,{className:de("description",o==null?void 0:o.description),children:r}),e&&i.jsx(fr,{className:de("actions",o==null?void 0:o.actions),children:e})]}),br=d.styled.div`
|
|
682
682
|
display: grid;
|
|
683
683
|
grid-template-rows: auto 1fr auto;
|
|
684
684
|
grid-auto-flow: column;
|
|
@@ -703,7 +703,7 @@
|
|
|
703
703
|
> * > :not([class*='field-label']):not([class*='field-message']) {
|
|
704
704
|
grid-row: 2;
|
|
705
705
|
}
|
|
706
|
-
`,$r=C.newClassNameGetter("field-row"),Sr=({className:e,gap:t=16,ref:o,...r})=>
|
|
706
|
+
`,$r=C.newClassNameGetter("field-row"),Sr=({className:e,gap:t=16,ref:o,...r})=>i.jsx(br,{...r,ref:o,$gap:t,className:$r("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]}`},Ve=(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),mr=d.styled.div`
|
|
707
707
|
flex-shrink: 0;
|
|
708
708
|
display: flex;
|
|
709
709
|
flex-direction: column;
|
|
@@ -888,10 +888,11 @@
|
|
|
888
888
|
width: 16px;
|
|
889
889
|
height: 16px;
|
|
890
890
|
}
|
|
891
|
-
`,$e=C.newClassNameGetter("file-upload"),Yr=()=>
|
|
891
|
+
`,$e=C.newClassNameGetter("file-upload"),Yr=()=>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"})]}),Hr=({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(w=>!Ve(w,e));if(E.length>0){h==null||h(E,"type");const w=R.filter(T=>Ve(T,e));if(w.length===0)return;g==null||g(w);return}}if(p){const E=R.filter(w=>w.size>p);if(E.length>0){h==null||h(E,"size");const w=R.filter(T=>T.size<=p);if(w.length===0)return;g==null||g(w);return}}g==null||g(R)},[e,p,g,h]),O=()=>{var L;a||(L=S.current)==null||L.click()},v=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(mr,{ref:y,className:o,...f,children:[i.jsxs(Or,{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(vr,{className:$e("icon",r==null?void 0:r.icon),children:s||i.jsx(Yr,{})}),i.jsx(wr,{className:$e("text",r==null?void 0:r.text),children:l||i.jsxs("span",{children:[i.jsx(Cr,{children:"Click to upload"})," or drag and drop"]})}),c&&i.jsx(Rr,{className:$e("hint",r==null?void 0:r.hint),children:c})]}),i.jsx(Lr,{ref:S,type:"file",accept:e,multiple:x,onChange:v,tabIndex:-1}),t]})},J=C.newClassNameGetter("file-upload-item"),Xr=()=>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"})]}),Ur=()=>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"})]}),Wr=()=>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"})}),qr=({name:e,size:t,status:o="uploading",progress:r=0,icon:l,onRemove:a,onRetry:c,className:s,classnames:p,ref:x})=>i.jsxs(jr,{ref:x,className:J("item",s),$status:o,children:[i.jsx(Er,{className:J("icon",p==null?void 0:p.icon),$status:o,children:l||i.jsx(Xr,{})}),i.jsxs(zr,{children:[i.jsxs(Nr,{children:[i.jsxs(Tr,{className:J("info",p==null?void 0:p.info),children:[i.jsx(Ir,{className:J("name",p==null?void 0:p.name),children:e}),i.jsx(Ar,{className:J("size",p==null?void 0:p.size),children:bt(t)})]}),a&&i.jsx(_r,{className:J("action",p==null?void 0:p.action),onClick:a,"aria-label":"Remove file",type:"button",children:i.jsx(Ur,{})})]}),o==="uploading"&&i.jsxs(Pr,{className:J("progress",p==null?void 0:p.progress),children:[i.jsx(Br,{children:i.jsx(Mr,{$value:r,$status:o})}),i.jsxs(Fr,{children:[r,"%"]})]}),o==="complete"&&i.jsxs(Ze,{children:[i.jsx(Gr,{children:i.jsx(Wr,{})}),"Complete"]}),o==="failed"&&i.jsxs(Ze,{children:["Upload failed."," ",c&&i.jsx(Dr,{onClick:c,type:"button",children:"Try again"})]})]})]}),$t=`
|
|
892
892
|
display: inline-flex;
|
|
893
893
|
font-size: 14px;
|
|
894
|
-
|
|
894
|
+
gap: 3px;
|
|
895
|
+
color: ${n.COLORS["iron-grey"]};
|
|
895
896
|
transition: color 0.15s ease;
|
|
896
897
|
text-decoration: none;
|
|
897
898
|
`,St=`
|
|
@@ -906,13 +907,13 @@
|
|
|
906
907
|
`,Vr=d.styled.a`
|
|
907
908
|
${$t}
|
|
908
909
|
${St}
|
|
909
|
-
`,Zr=d.styled.span``,Jr=d.styled.span``,Se=C.newClassNameGetter("hashtag"),Qr=({children:e,className:t,classnames:o,href:r,onClick:
|
|
910
|
+
`,Zr=d.styled.span``,Jr=d.styled.span``,Se=C.newClassNameGetter("hashtag"),Qr=({children:e,className:t,classnames:o,href:r,onClick:l,ref:a,...c})=>{const s=i.jsxs(i.Fragment,{children:[i.jsx(Zr,{className:Se("hash",o==null?void 0:o.hash),children:"#"}),i.jsx(Jr,{className:Se("label",o==null?void 0:o.label),children:e})]});if(r)return i.jsx(Vr,{ref:a,href:r,className:Se("container",t),onClick:l,children:s});const p=!!l;return i.jsx(Kr,{...c,ref:a,className:Se("container",t),$clickable:p,onClick:l,role:p?"button":void 0,tabIndex:p?0:void 0,children:s})},Je={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}},en=d.styled.h1`
|
|
910
911
|
margin: 0;
|
|
911
912
|
font-weight: 700;
|
|
912
913
|
color: ${n.COLORS.black};
|
|
913
914
|
font-size: ${({$level:e})=>Je[e].fontSize}px;
|
|
914
915
|
line-height: ${({$level:e})=>Je[e].lineHeight};
|
|
915
|
-
`,tn=C.newClassNameGetter("heading"),on=({as:e,children:t,className:o,level:r=3,ref:
|
|
916
|
+
`,tn=C.newClassNameGetter("heading"),on=({as:e,children:t,className:o,level:r=3,ref:l,...a})=>i.jsx(en,{...a,as:`h${e??r}`,ref:l,className:tn("container",o),$level:r,children:t}),rn=d.styled.div`
|
|
916
917
|
display: flex;
|
|
917
918
|
flex-direction: column;
|
|
918
919
|
gap: 12px;
|
|
@@ -1103,7 +1104,7 @@
|
|
|
1103
1104
|
overflow: hidden;
|
|
1104
1105
|
border-radius: 50%;
|
|
1105
1106
|
}
|
|
1106
|
-
`,bn={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},$n={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},me=(e,t)=>{const o=bn[t],{h:r,v:
|
|
1107
|
+
`,bn={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},$n={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},me=(e,t)=>{const o=bn[t],{h:r,v:l}=$n[t];return`
|
|
1107
1108
|
.${e} {
|
|
1108
1109
|
display: block;
|
|
1109
1110
|
z-index: 102;
|
|
@@ -1114,7 +1115,7 @@
|
|
|
1114
1115
|
-ms-user-select: none;
|
|
1115
1116
|
user-select: none;
|
|
1116
1117
|
${r}: -3px;
|
|
1117
|
-
${
|
|
1118
|
+
${l}: -3px;
|
|
1118
1119
|
position: absolute;
|
|
1119
1120
|
width: 5px;
|
|
1120
1121
|
height: 5px;
|
|
@@ -1126,7 +1127,7 @@
|
|
|
1126
1127
|
width: 24px;
|
|
1127
1128
|
height: 24px;
|
|
1128
1129
|
${r}: -12px;
|
|
1129
|
-
${
|
|
1130
|
+
${l}: -12px;
|
|
1130
1131
|
}
|
|
1131
1132
|
}
|
|
1132
1133
|
`},Sn=e=>`
|
|
@@ -1186,7 +1187,7 @@
|
|
|
1186
1187
|
${me(t.handlerResizeTopRight[0],"tr")}
|
|
1187
1188
|
${Sn(t.root[0])}
|
|
1188
1189
|
${mn(t.sourceImage[0])}
|
|
1189
|
-
`,r=document.createElement("style");return r.innerHTML=o,document.getElementsByTagName("head")[0].prepend(r),t};let wn=0;const Cn=e=>{const t=new Map,o=new Proxy({...e},{set(r,i,a){return Reflect.set(r,i,a),(t.get(i)||[]).forEach(c=>c.action(a,r,i)),!0}});return{getState:()=>({...o}),setState:r=>{for(const i of Object.keys(r)){const a=r[i];a!==void 0&&(o[i]=a)}},subscribe:(r,i)=>{const a=String(++wn),c=t.get(r)||[];return t.set(r,[...c,{action:i,id:a}]),a},unsubscribe:r=>{for(const[i,a]of t.entries()){const c=a.filter(s=>s.id!==r);if(c.length!==a.length){t.set(i,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"]}},Rn=(e={},t={})=>Cn({...Fe,config:{...Fe.config,...e},css:vn(t)}),Ln=(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:i,height:a}=r.getBoundingClientRect(),c=i/a,s=t.width/t.height;let p,x,g=0,h=0;return c>s?(p=a*s,x=a,h=(i-p)/2):(p=i,x=i*(t.height/t.width),g=(a-x)/2),{width:p,height:x,left:h,top:g}},kn=(e,t,o)=>{const[r,i]=t,a=r+e>o.width?(o.width-e)/2:r,c=i+e>o.height?(o.height-e)/2:i;return[a,c]},jn=(e,t)=>{const{config:o}=e(),r=Math.min(t.width,t.height)-o.framePadding*2,i=o.portalSize>r?r:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[a,c]=kn(i,o.portalPosition,t);return{left:a,top:c,size:i}}return o.portalPosition==="center"?{size:i,left:(t.width-i)/2,top:(t.height-i)/2}:{left:0,top:0,size:i}};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 En=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerMove),o.setAttribute("data-action",G.MOVE),o},zn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeBottomLeft),o.setAttribute("data-action",G.RESIZE_BL),o},Nn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeBottomRight),o.setAttribute("data-action",G.RESIZE_BR),o},Tn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeTopLeft),o.setAttribute("data-action",G.RESIZE_TL),o},In=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeTopRight),o.setAttribute("data-action",G.RESIZE_TR),o},An=e=>{var r;const t=e(),o=document.createElement("img");return P(o,(r=t.css)==null?void 0:r.previewImage),o},Pn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.preview),o.appendChild(An(e)),o},Bn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.portal),o.appendChild(Pn(e)),o.appendChild(En(e)),o.appendChild(Tn(e)),o.appendChild(In(e)),o.appendChild(zn(e)),o.appendChild(Nn(e)),o},Mn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.portalArea),o.appendChild(Bn(e)),o},Fn=e=>{var r;const t=e(),o=document.createElement("img");return P(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},_n=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.body),o.appendChild(Fn(e)),o.appendChild(Mn(e)),o},Dn=(e,t)=>{var i;const o=e(),r=document.createElement("div");return P(r,(i=o.css)==null?void 0:i.applyButton),r.setAttribute("role","button"),r.innerText=o.config.applyButtonLabel,r.addEventListener("click",t),r},Gn=(e,t)=>{var i;const o=e(),r=document.createElement("div");return P(r,(i=o.css)==null?void 0:i.cancelButton),r.setAttribute("role","button"),r.innerText=o.config.cancelButtonLabel,r.addEventListener("click",t),r},Yn=(e,t,o)=>{var a;const r=e(),i=document.createElement("div");return P(i,(a=r.css)==null?void 0:a.footer),i.appendChild(Gn(e,o)),i.appendChild(Dn(e,t)),i},Hn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.header),o},Xn=(e,t,o)=>{var a;const r=e(),i=document.createElement("div");return P(i,(a=r.css)==null?void 0:a.container),i.appendChild(Hn(e)),i.appendChild(_n(e)),i.appendChild(Yn(e,t,o)),i},Un=(e,t,o)=>{var a;const r=e(),i=document.createElement("div");P(i,(a=r.css)==null?void 0:a.root),i.appendChild(Xn(e,t,o)),document.body.appendChild(i)},Wn=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,qn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},Q=(e,t)=>{if(pe.has(e))return pe.get(e);if(!t)return null;const o=t[qn[e]],r=document.querySelector(`.${o[0]}`);return pe.set(e,r),r},Kn=()=>{pe.clear()},Vn=()=>{pe.clear()},Zn=(e,t)=>{const o=Q("header",t.css);o&&(o.innerText=e)},Jn=(e,t)=>{const o=Q("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=Q("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 i=Q("portal",t.css);i&&(i.style.width=`${t.portal.size}px`,i.style.height=`${t.portal.size}px`,i.style.left=`${t.portal.left}px`,i.style.top=`${t.portal.top}px`);const a=Q("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`)},Qn=(e,t)=>{const o=Q("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=Q("previewImage",t.css);r&&(r.style.marginLeft=`-${e.left}px`,r.style.marginTop=`-${e.top}px`)},je=1,ei=e=>{var f,S;const t=e(),o=document.createElement("canvas"),r=t.frame.width||je,i=t.frame.height||je,a=t.sourceWidth/r,c=t.sourceHeight/i,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)}})},ti=(e,t,o)=>{const{emitted:r,portal:i,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-i.size,h=c.framePadding,y=a.height-c.framePadding-i.size;s<x&&(s=x),s>g&&(s=g),p<h&&(p=h),p>y&&(p=y),o({portal:{...i,left:s,top:p}})},oi=(e,t,o)=>{const{action:r,emitted:i,portal:a,frame:c,config:s}=t(),p=e.pageX-i.X,x=e.pageY-i.Y;switch(r){case G.RESIZE_BR:{let g=i.size+Math.max(p,x);return g<s.minPortalSize&&(g=s.minPortalSize),i.top+g>c.height-s.framePadding&&(g=c.height-i.top-s.framePadding),i.left+g>c.width-s.framePadding&&(g=c.width-i.left-s.framePadding),o({portal:{...a,size:g}})}case G.RESIZE_TR:{let g=p+x>0?i.size+p:i.size-x,h=p+x>0?i.top-p:i.top+x;return g<s.minPortalSize&&(h=i.top+i.size-s.minPortalSize,g=s.minPortalSize),i.left+g>c.width-s.framePadding&&(g=c.width-i.left-s.framePadding,h=i.top-c.width+i.left+i.size),h<s.framePadding&&(g=i.top+i.size,h=s.framePadding),o({portal:{...a,top:h,size:g}})}case G.RESIZE_TL:{const g=Math.min(p,x);let h=i.size-g,y=i.left+g,f=i.top+g;if(h<s.minPortalSize){const S=i.size-s.minPortalSize;h=s.minPortalSize,y=i.left+S,f=i.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?i.size+x:i.size-p,h=p+x>0?i.left-x:i.left+p;return g<s.minPortalSize&&(h=i.left+i.size-s.minPortalSize,g=s.minPortalSize),g+i.top>c.height-s.framePadding&&(h=i.left-c.height+i.top+i.size,g=c.height-i.top-s.framePadding),h<s.framePadding&&(h=s.framePadding,g=i.left+i.size-s.framePadding),o({portal:{...a,left:h,size:g}})}default:return}},Qe=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}},ri=(e,t)=>{var y,f,S;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.portal[0]}`),i=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=Qe(b);if(b.target){const O=b.target.getAttribute("data-action"),v={X:m.pageX,Y:m.pageY,left:$.left,top:$.top,size:$.size};t({action:O,emitted:v})}},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:ti(b,e,t);break;default:oi(b,e,t)}},h=b=>{const{action:$}=e();$&&(b.preventDefault(),s=Qe(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})),i&&(i.addEventListener("mousemove",h),i.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)),i&&(i.removeEventListener("mousemove",h),i.removeEventListener("touchmove",h))}},et=1024*1024,ni=(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},ii=(e,t,o,r,i,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=ni(p,x);if(g){s(g),e.target.value="";return}const h=new FileReader;let y=null;const f=()=>{var v;const m=t(),O=document.querySelector(`.${(v=m.css)==null?void 0:v.root[0]}`);O&&(O.remove(),document.removeEventListener("keydown",S),y==null||y(),Vn(),a(),o(Fe))},S=m=>{m.key==="Escape"&&t().sourceBase64&&b(m)},b=m=>{m.preventDefault(),f()},$=m=>{m.preventDefault();const O=t();ei(t).then(([v,k])=>{r(v,k,O),b(m)}).catch(v=>{s(v instanceof Error?v.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;Un(t,$,b),Kn(),i("fileName",Zn),i("sourceBase64",Jn),i("portal",Qn);const v=Ln(t,O),k=jn(t,v);o({frame:v,portal:k,fileName:p.name,sourceBase64:(z=m.target)==null?void 0:z.result,sourceHeight:O.height,sourceWidth:O.width}),y=ri(t,o),document.addEventListener("keydown",S)}},h.onerror=()=>{s("Failed to read file")},h.readAsDataURL(p),e.target.value=""},li=(e,t,o,r)=>{const{getState:i,setState:a,subscribe:c,unsubscribeAll:s}=Rn(t,o),p=Wn(x=>ii(x,i,a,e,c,s,r));return{open:()=>p.click()}},q={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",ai=`
|
|
1190
|
+
`,r=document.createElement("style");return r.innerHTML=o,document.getElementsByTagName("head")[0].prepend(r),t};let wn=0;const Cn=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(++wn),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"]}},Rn=(e={},t={})=>Cn({...Fe,config:{...Fe.config,...e},css:vn(t)}),Ln=(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}},kn=(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]},jn=(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]=kn(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 En=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerMove),o.setAttribute("data-action",G.MOVE),o},zn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeBottomLeft),o.setAttribute("data-action",G.RESIZE_BL),o},Nn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeBottomRight),o.setAttribute("data-action",G.RESIZE_BR),o},Tn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeTopLeft),o.setAttribute("data-action",G.RESIZE_TL),o},In=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeTopRight),o.setAttribute("data-action",G.RESIZE_TR),o},An=e=>{var r;const t=e(),o=document.createElement("img");return P(o,(r=t.css)==null?void 0:r.previewImage),o},Pn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.preview),o.appendChild(An(e)),o},Bn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.portal),o.appendChild(Pn(e)),o.appendChild(En(e)),o.appendChild(Tn(e)),o.appendChild(In(e)),o.appendChild(zn(e)),o.appendChild(Nn(e)),o},Mn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.portalArea),o.appendChild(Bn(e)),o},Fn=e=>{var r;const t=e(),o=document.createElement("img");return P(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},_n=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.body),o.appendChild(Fn(e)),o.appendChild(Mn(e)),o},Dn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return P(r,(l=o.css)==null?void 0:l.applyButton),r.setAttribute("role","button"),r.innerText=o.config.applyButtonLabel,r.addEventListener("click",t),r},Gn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return P(r,(l=o.css)==null?void 0:l.cancelButton),r.setAttribute("role","button"),r.innerText=o.config.cancelButtonLabel,r.addEventListener("click",t),r},Yn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return P(l,(a=r.css)==null?void 0:a.footer),l.appendChild(Gn(e,o)),l.appendChild(Dn(e,t)),l},Hn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.header),o},Xn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return P(l,(a=r.css)==null?void 0:a.container),l.appendChild(Hn(e)),l.appendChild(_n(e)),l.appendChild(Yn(e,t,o)),l},Un=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");P(l,(a=r.css)==null?void 0:a.root),l.appendChild(Xn(e,t,o)),document.body.appendChild(l)},Wn=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,qn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},Q=(e,t)=>{if(pe.has(e))return pe.get(e);if(!t)return null;const o=t[qn[e]],r=document.querySelector(`.${o[0]}`);return pe.set(e,r),r},Kn=()=>{pe.clear()},Vn=()=>{pe.clear()},Zn=(e,t)=>{const o=Q("header",t.css);o&&(o.innerText=e)},Jn=(e,t)=>{const o=Q("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=Q("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=Q("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=Q("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`)},Qn=(e,t)=>{const o=Q("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=Q("previewImage",t.css);r&&(r.style.marginLeft=`-${e.left}px`,r.style.marginTop=`-${e.top}px`)},je=1,ei=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)}})},ti=(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}})},oi=(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}},Qe=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}},ri=(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=Qe(b);if(b.target){const O=b.target.getAttribute("data-action"),v={X:m.pageX,Y:m.pageY,left:$.left,top:$.top,size:$.size};t({action:O,emitted:v})}},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:ti(b,e,t);break;default:oi(b,e,t)}},h=b=>{const{action:$}=e();$&&(b.preventDefault(),s=Qe(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,ni=(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},ii=(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=ni(p,x);if(g){s(g),e.target.value="";return}const h=new FileReader;let y=null;const f=()=>{var v;const m=t(),O=document.querySelector(`.${(v=m.css)==null?void 0:v.root[0]}`);O&&(O.remove(),document.removeEventListener("keydown",S),y==null||y(),Vn(),a(),o(Fe))},S=m=>{m.key==="Escape"&&t().sourceBase64&&b(m)},b=m=>{m.preventDefault(),f()},$=m=>{m.preventDefault();const O=t();ei(t).then(([v,k])=>{r(v,k,O),b(m)}).catch(v=>{s(v instanceof Error?v.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;Un(t,$,b),Kn(),l("fileName",Zn),l("sourceBase64",Jn),l("portal",Qn);const v=Ln(t,O),k=jn(t,v);o({frame:v,portal:k,fileName:p.name,sourceBase64:(z=m.target)==null?void 0:z.result,sourceHeight:O.height,sourceWidth:O.width}),y=ri(t,o),document.addEventListener("keydown",S)}},h.onerror=()=>{s("Failed to read file")},h.readAsDataURL(p),e.target.value=""},li=(e,t,o,r)=>{const{getState:l,setState:a,subscribe:c,unsubscribeAll:s}=Rn(t,o),p=Wn(x=>ii(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",ai=`
|
|
1190
1191
|
.vacano-cropper-root {
|
|
1191
1192
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1192
1193
|
backdrop-filter: blur(4px);
|
|
@@ -1234,7 +1235,7 @@
|
|
|
1234
1235
|
.vacano-cropper-apply-button:hover {
|
|
1235
1236
|
background-color: ${n.COLORS["iron-grey"]};
|
|
1236
1237
|
}
|
|
1237
|
-
`,di=()=>{if(typeof document>"u"||document.getElementById(tt))return;const e=document.createElement("style");e.id=tt,e.textContent=ai,document.head.appendChild(e)},si={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=
|
|
1238
|
+
`,di=()=>{if(typeof document>"u"||document.getElementById(tt))return;const e=document.createElement("style");e.id=tt,e.textContent=ai,document.head.appendChild(e)},si={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=K.allowedTypes,applyLabel:o=K.applyLabel,cancelLabel:r=K.cancelLabel,compression:l=K.compression,maxFileSize:a=K.maxFileSize,onCrop:c,onError:s,outputSize:p=K.outputSize,portalSize:x=K.portalSize,type:g=K.type}=e,h=u.useRef(null);return{open:u.useCallback(()=>{h.current||(di(),h.current=li((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},si,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"),ci=({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:v}=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(rn,{...$,ref:f,className:Ee("container",l),children:[i.jsx(nn,{$size:y,className:Ee("preview",a==null?void 0:a.preview),children:m?i.jsx("img",{src:m,alt:"Preview"}):i.jsx(ln,{children:"No image"})}),i.jsx(d.Button,{variant:"system",onClick:v,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}},pi=d.styled.button`
|
|
1238
1239
|
position: relative;
|
|
1239
1240
|
display: flex;
|
|
1240
1241
|
align-items: center;
|
|
@@ -1273,8 +1274,8 @@
|
|
|
1273
1274
|
opacity 0.2s ease;
|
|
1274
1275
|
transform-origin: center;
|
|
1275
1276
|
|
|
1276
|
-
${({$position:e,$size:t,$open:o})=>{const{gap:r,weight:
|
|
1277
|
-
`,Oe=C.newClassNameGetter("menu-button"),gi=({className:e,classnames:t,defaultOpen:o=!1,disabled:r=!1,onOpenChange:
|
|
1277
|
+
${({$position:e,$size:t,$open:o})=>{const{gap:r,weight:l}=re[t],a=r+l;if(e==="top")return o?`transform: translateY(${a}px) rotate(45deg);`:"";if(e==="middle")return o?"opacity: 0;":"";if(e==="bottom")return o?`transform: translateY(-${a}px) rotate(-45deg);`:""}}
|
|
1278
|
+
`,Oe=C.newClassNameGetter("menu-button"),gi=({className:e,classnames:t,defaultOpen:o=!1,disabled:r=!1,onOpenChange:l,open:a,ref:c,size:s="default",...p})=>{const[x,g]=u.useState(o),h=a!==void 0,y=h?a:x,f=u.useCallback(()=>{if(r)return;const S=!y;h||g(S),l==null||l(S)},[r,y,h,l]);return i.jsx(pi,{...p,ref:c,type:"button",disabled:r,"aria-label":y?"Close menu":"Open menu","aria-expanded":y,className:Oe("container",e),$size:s,$disabled:r,onClick:f,children:i.jsxs(ui,{$size:s,$open:y,children:[i.jsx(ze,{$size:s,$position:"top",$open:y,className:Oe("line",t==null?void 0:t.line)}),i.jsx(ze,{$size:s,$position:"middle",$open:y,className:Oe("line",t==null?void 0:t.line)}),i.jsx(ze,{$size:s,$position:"bottom",$open:y,className:Oe("line",t==null?void 0:t.line)})]})})},xi=5e3,ot={default:{background:"#374151",text:n.COLORS.white},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},info:{background:n.COLORS["steel-blue"],text:n.COLORS.white}},Ot=u.createContext(null),rt=e=>ot[e]??ot.default,hi=d.styled.div`
|
|
1278
1279
|
position: fixed;
|
|
1279
1280
|
top: 0;
|
|
1280
1281
|
left: 0;
|
|
@@ -1321,7 +1322,7 @@
|
|
|
1321
1322
|
}
|
|
1322
1323
|
`,$i=d.styled.div`
|
|
1323
1324
|
position: relative;
|
|
1324
|
-
`,Si=({notification:e,onRemove:t,onAnimationEnd:o})=>{const[r,
|
|
1325
|
+
`,Si=({notification:e,onRemove:t,onAnimationEnd:o})=>{const[r,l]=u.useState(!1),a=()=>{l(!0)},c=()=>{r&&(t(),o())};return u.useEffect(()=>{const s=setTimeout(()=>{a()},e.duration);return()=>clearTimeout(s)},[e.duration,e.id]),i.jsx($i,{children:i.jsxs(fi,{$variant:e.variant,$isExiting:r,onAnimationEnd:c,children:[i.jsx(yi,{children:e.message}),i.jsx(bi,{onClick:a,children:i.jsx(i.X,{style:{width:18,height:18}})})]})})},mi=(e,t)=>{switch(t.type){case"ADD_NOTIFICATION":{const o=t.payload;return e.current?{...e,queue:[...e.queue,o]}:{...e,current:o}}case"REMOVE_CURRENT":return{...e,current:null};case"SHOW_NEXT":{const o=e.queue[0];return o?{current:o,queue:e.queue.slice(1)}:e}default:return e}},Oi={current:null,queue:[]},vi=({children:e})=>{const[t,o]=u.useReducer(mi,Oi),r=u.useCallback((s,p="default",x=xi)=>{const g=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_NOTIFICATION",payload:{id:g,message:s,variant:p,duration:x}})},[]),l=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),a=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),c=u.useCallback(()=>{setTimeout(()=>{o({type:"SHOW_NEXT"})},100)},[]);return i.jsxs(Ot.Provider,{value:{show:r,hide:l},children:[e,i.jsx(hi,{children:t.current&&i.jsx(Si,{notification:t.current,onRemove:a,onAnimationEnd:c},t.current.id)})]})},wi=()=>{const e=u.useContext(Ot);if(!e)throw new Error("useNotification must be used within NotificationProvider");return e},vt=u.createContext(null),Ci="Agree",Ri="Discard",Li=B.keyframes`
|
|
1325
1326
|
from {
|
|
1326
1327
|
opacity: 0;
|
|
1327
1328
|
transform: translateY(100%);
|
|
@@ -1376,20 +1377,20 @@
|
|
|
1376
1377
|
padding: 12px 16px;
|
|
1377
1378
|
border-top: 1px solid ${n.COLORS.gray};
|
|
1378
1379
|
background-color: rgba(0, 0, 0, 0.01);
|
|
1379
|
-
`,Ti=({confirmation:e,onDone:t})=>{const[o,r]=u.useState(!1),[
|
|
1380
|
+
`,Ti=({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||Ci,y=g.discardLabel||Ri,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(ji,{$isExiting:o,children:[i.jsx(Ei,{children:c}),i.jsx(zi,{children:s}),i.jsxs(Ni,{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})]})]})},Ii=()=>{},Ai=({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||Ii,options:x||{}})},[]),l=u.useCallback(()=>{o(null)},[]);return i.jsxs(vt.Provider,{value:{show:r,hide:l},children:[e,t&&i.jsx(Ti,{confirmation:t,onDone:l})]})},Pi=()=>{const e=u.useContext(vt);if(!e)throw new Error("useNotifyConfirmation must be used within NotifyConfirmationProvider");return e},Bi=d.styled.div`
|
|
1380
1381
|
display: flex;
|
|
1381
1382
|
flex-direction: column;
|
|
1382
1383
|
gap: 2px;
|
|
1383
1384
|
`,Mi=d.styled.span`
|
|
1384
|
-
font-size:
|
|
1385
|
+
font-size: 12px;
|
|
1385
1386
|
font-weight: 700;
|
|
1386
1387
|
text-transform: uppercase;
|
|
1387
1388
|
letter-spacing: 0.5px;
|
|
1388
|
-
color:
|
|
1389
|
+
color: ${n.COLORS["iron-grey"]};
|
|
1389
1390
|
`,Fi=d.styled.span`
|
|
1390
|
-
font-size:
|
|
1391
|
-
color:
|
|
1392
|
-
`,Ne=C.newClassNameGetter("overline"),_i=({children:e,className:t,classnames:o,description:r,ref:
|
|
1391
|
+
font-size: 14px;
|
|
1392
|
+
color: ${n.COLORS["iron-grey"]};
|
|
1393
|
+
`,Ne=C.newClassNameGetter("overline"),_i=({children:e,className:t,classnames:o,description:r,ref:l,...a})=>i.jsxs(Bi,{...a,ref:l,className:Ne("container",t),children:[i.jsx(Mi,{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})]}),Di=d.styled.div`
|
|
1393
1394
|
position: relative;
|
|
1394
1395
|
display: flex;
|
|
1395
1396
|
flex-direction: column;
|
|
@@ -1459,7 +1460,7 @@
|
|
|
1459
1460
|
text-align: center;
|
|
1460
1461
|
font-size: 14px;
|
|
1461
1462
|
color: ${n.COLORS["iron-grey"]};
|
|
1462
|
-
`,
|
|
1463
|
+
`,V=C.newClassNameGetter("shell-screen"),Zi=({children:e,className:t,classnames:o,description:r,footer:l,gridSize:a=64,icon:c,logo:s,ref:p,title:x,...g})=>i.jsxs(Di,{...g,ref:p,className:V("container",t),children:[i.jsx(Gi,{$size:a,className:V("grid",o==null?void 0:o.grid)}),i.jsxs(Yi,{children:[s&&i.jsx(Hi,{children:s}),c&&i.jsx(Xi,{className:V("icon"),children:c}),(x||r)&&i.jsxs(Ui,{className:V("header",o==null?void 0:o.header),children:[x&&i.jsx(Wi,{className:V("title",o==null?void 0:o.title),children:x}),r&&i.jsx(qi,{className:V("description",o==null?void 0:o.description),children:r})]}),e&&i.jsx(Ki,{className:V("content",o==null?void 0:o.content),children:e}),l&&i.jsx(Vi,{className:V("footer",o==null?void 0:o.footer),children:l})]})]}),Ji=(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]},Qi=d.styled.nav`
|
|
1463
1464
|
display: inline-flex;
|
|
1464
1465
|
align-items: center;
|
|
1465
1466
|
gap: 2px;
|
|
@@ -1546,7 +1547,7 @@
|
|
|
1546
1547
|
pointer-events: none;
|
|
1547
1548
|
cursor: default;
|
|
1548
1549
|
`}
|
|
1549
|
-
`,oe=C.newClassNameGetter("pagination"),nl=({boundaries:e=1,className:t,classnames:o,disabled:r=!1,initialPage:
|
|
1550
|
+
`,oe=C.newClassNameGetter("pagination"),nl=({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),v=u.useRef(null),k=u.useRef(null),z=Ji(h,m,g,e),j=u.useCallback(w=>{S||$(w),c==null||c(w)},[S,c]),L=u.useCallback(w=>{w<1||w>h||w===m||j(w)},[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 w=k.current,T=v.current,N=O.current.get(m);if(!w||!T||!N)return;const M=T.getBoundingClientRect(),F=N.getBoundingClientRect().left-M.left;w.style.transform=`translateX(${F}px)`},[m,z]),i.jsxs(Qi,{...f,ref:p||v,className:oe("container",t),children:[i.jsx(ol,{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((w,T)=>w==="dots"?i.jsx(rl,{className:oe("ellipsis",o==null?void 0:o.ellipsis),children:"..."},`dots-${T}`):i.jsx(tl,{ref:N=>{N?O.current.set(w,N):O.current.delete(w)},className:oe("item",o==null?void 0:o.item),$active:w===m,$variant:y,$disabled:r,onClick:()=>L(w),"aria-label":`Page ${w}`,"aria-current":w===m?"page":void 0,children:w},w)),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,il=d.styled.div`
|
|
1550
1551
|
position: relative;
|
|
1551
1552
|
display: flex;
|
|
1552
1553
|
flex-direction: column;
|
|
@@ -1588,7 +1589,7 @@
|
|
|
1588
1589
|
display: flex;
|
|
1589
1590
|
flex-wrap: wrap;
|
|
1590
1591
|
gap: 8px;
|
|
1591
|
-
`,se=C.newClassNameGetter("panel"),pl=({children:e,className:t,classnames:o,description:r,label:
|
|
1592
|
+
`,se=C.newClassNameGetter("panel"),pl=({children:e,className:t,classnames:o,description:r,label:l,ref:a,title:c,variant:s="light",...p})=>{const x=c||r;return i.jsxs(il,{...p,ref:a,className:se("container",t),$variant:s,children:[l&&i.jsx(ll,{className:se("label",o==null?void 0:o.label),children:l}),x&&i.jsxs(al,{children:[c&&i.jsx(dl,{className:se("title",o==null?void 0:o.title),$variant:s,children:c}),r&&i.jsx(sl,{className:se("description",o==null?void 0:o.description),$variant:s,children:r})]}),i.jsx(cl,{className:se("content",o==null?void 0:o.content),children:e})]})},ul=["Готовим стартовый стол к запуску","Прогреваем фотонные двигатели","Запрашиваем разрешение у ЦУПа","Проверяем герметичность шлюзов","Выводим реактор на рабочую мощность","Ожидаем окно для маневра","Проверяем целостность теплозащиты","Разворачиваем солнечные паруса","Активируем систему навигации","Инициализируем бортовой компьютер","Рассчитываем вектор ускорения","Продуваем топливные магистрали","Тестируем аварийную систему спасения","Стабилизируем гироскопы на платформе","Загружаем полетное задание в память","Синхронизируем орбитальные часы","Рассчитываем траекторию кометы","Настраиваем антенну дальней связи","Считываем телеметрию со спутника","Корректируем азимут наведения","Фиксируем координаты черной дыры","Загружаем карту звездного неба","Калибруем инерциальную платформу","Принимаем эфемериды от станции","Уточняем параметры орбиты","Привязываемся к опорным звездам","Строим модель гравитационного поля","Анализируем метрики далеких звезд","Ждем прохождения первого нейтрино","Декодируем сигналы из туманности","Замеряем гравитационные волны","Отправляем зонд в пояс астероидов","Перехватываем межзвездные частицы","Обрабатываем данные телескопа","Анализируем спектр далекой звезды","Собираем пробы лунного грунта","Сканируем поверхность экзопланеты","Измеряем реликтовое излучение","Картографируем магнитные аномалии","Исследуем состав колец Сатурна","Регистрируем вспышку сверхновой","Фиксируем рентгеновский пульсар","Моделируем столкновение галактик","Наблюдаем транзит далекой планеты","Калибруем квантовый компилятор","Переводим данные в гиперпространство","Синтезируем топливо из вакуума","Компилируем нейронную матрицу","Оптимизируем квантовые вентили","Разматываем кубиты суперпозиции","Интерполируем пространство решений","Нормализуем тензорное поле","Индексируем базу знаний вселенной","Дефрагментируем пространство-время","Хешируем координаты червоточины","Верифицируем квантовую запутанность","Устанавливаем связь с Вояджером","Расшифровываем послание с Проксимы","Ретранслируем сигнал через Юпитер","Пингуем ближайший ретранслятор","Буферизуем поток тахионных данных","Шифруем канал субпространственной связи","Декомпрессируем архив звездных карт","Проверяем давление в отсеках","Балансируем нагрузку на генераторы","Охлаждаем сверхпроводящие магниты","Калибруем датчики внешней среды","Перезагружаем модуль жизнеобеспечения","Тестируем маневровые двигатели","Обновляем прошивку скафандров","Юстируем зеркала главного телескопа","Переключаем контур охлаждения","Диагностируем плазменный щит","Затягиваем болты на обшивке"],gl=3500,xl=e=>e&&e.length>0?e:ul,hl=e=>e&&e>0?e:gl,fl=e=>Math.max(...e.map(t=>t.length)),yl=(e,t)=>{const o=Math.floor((t-e.length)/2);return e.padStart(e.length+o).padEnd(t)},lt=(e,t)=>{const o=Array.from({length:e},(r,l)=>l);for(let r=o.length-1;r>0;r--){const l=Math.floor(Math.random()*(r+1));[o[r],o[l]]=[o[l],o[r]]}if(t!==void 0&&o[0]===t){const r=1+Math.floor(Math.random()*(o.length-1));[o[0],o[r]]=[o[r],o[0]]}return o},bl=B.keyframes`
|
|
1592
1593
|
from { transform: rotate(0deg) translateX(20px) rotate(0deg); }
|
|
1593
1594
|
to { transform: rotate(360deg) translateX(20px) rotate(-360deg); }
|
|
1594
1595
|
`,$l=B.keyframes`
|
|
@@ -1651,7 +1652,7 @@
|
|
|
1651
1652
|
display: inline-block;
|
|
1652
1653
|
width: 0.65em;
|
|
1653
1654
|
text-align: center;
|
|
1654
|
-
`,Tl=C.newClassNameGetter("split-flap-text"),wt=({className:e,ref:t,text:o,...r})=>{const[
|
|
1655
|
+
`,Tl=C.newClassNameGetter("split-flap-text"),wt=({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[$]:kl()))},El()),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]))},jl(b)))},[h]);return u.useEffect(()=>{o!==c.current&&(c.current=o,y(o.split("")))},[o,y]),u.useEffect(()=>h,[h]),i.jsx(zl,{...r,ref:t,className:Tl("container",e),"aria-hidden":"true",children:l.map((f,S)=>i.jsx(Nl,{children:f===" "?" ":f},S))})},ve=C.newClassNameGetter("pending-screen"),Il=({className:e,classnames:t,description:o,interval:r,phrases:l,ref:a,...c})=>{const s=u.useMemo(()=>xl(l),[l]),p=u.useMemo(()=>hl(r),[r]),x=u.useMemo(()=>fl(s),[s]),g=u.useRef([]),h=u.useRef(0),y=u.useCallback(v=>(h.current>=g.current.length&&(g.current=lt(s.length,v),h.current=0),g.current[h.current++]),[s.length]),[f,S]=u.useState(()=>{g.current=lt(s.length);const v=g.current[0];return h.current=1,v}),b=u.useRef(null),$=u.useCallback(()=>{S(v=>y(v))},[y]);u.useEffect(()=>(b.current=setInterval($,p),()=>{b.current&&clearInterval(b.current)}),[$,p]);const m=s[f],O=yl(m,x);return i.jsxs(ml,{...c,ref:a,className:ve("container",e),role:"status",children:[i.jsxs(Ol,{className:ve("indicator",t==null?void 0:t.indicator),children:[i.jsx(Te,{$index:0}),i.jsx(Te,{$index:1}),i.jsx(Te,{$index:2})]}),i.jsx(wt,{text:O,className:ve("board",t==null?void 0:t.board)}),i.jsx(vl,{children:m}),o&&i.jsx(wl,{className:ve("description",t==null?void 0:t.description),children:o})]})},_e={compact:{height:4,radius:2},default:{height:8,radius:4}},Al=d.styled.div`
|
|
1655
1656
|
width: 100%;
|
|
1656
1657
|
height: ${({$size:e})=>_e[e].height}px;
|
|
1657
1658
|
border-radius: ${({$size:e})=>_e[e].radius}px;
|
|
@@ -1663,7 +1664,7 @@
|
|
|
1663
1664
|
border-radius: ${({$size:e})=>_e[e].radius}px;
|
|
1664
1665
|
background-color: ${n.COLORS.black};
|
|
1665
1666
|
transition: width 0.2s ease;
|
|
1666
|
-
`,dt=C.newClassNameGetter("progress"),Bl=({value:e,size:t="default",className:o,classnames:r,ref:
|
|
1667
|
+
`,dt=C.newClassNameGetter("progress"),Bl=({value:e,size:t="default",className:o,classnames:r,ref:l,...a})=>i.jsx(Al,{...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(Pl,{$size:t,$value:e,className:dt("bar",r==null?void 0:r.bar)})}),Ct=u.createContext(null),Ml=d.styled.div`
|
|
1667
1668
|
position: fixed;
|
|
1668
1669
|
bottom: 24px;
|
|
1669
1670
|
right: 24px;
|
|
@@ -1682,7 +1683,7 @@
|
|
|
1682
1683
|
font-size: 14px;
|
|
1683
1684
|
font-weight: 500;
|
|
1684
1685
|
white-space: nowrap;
|
|
1685
|
-
`,_l=({children:e,defaultMessage:t="Saving"})=>{const[o,r]=u.useState(!1),[
|
|
1686
|
+
`,_l=({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(Ml,{children:[i.jsx(d.Spinner,{size:"sm"}),i.jsx(Fl,{children:l})]})]})},Dl=()=>{const e=u.useContext(Ct);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},Gl=B.keyframes`
|
|
1686
1687
|
0% { opacity: 1; }
|
|
1687
1688
|
50% { opacity: 0.4; }
|
|
1688
1689
|
100% { opacity: 1; }
|
|
@@ -1708,7 +1709,7 @@
|
|
|
1708
1709
|
height: ${({$height:e})=>Ie(e)};
|
|
1709
1710
|
border-radius: ${({$circle:e,$radius:t})=>e?"50%":Wl[t]};
|
|
1710
1711
|
${({$animation:e})=>Ul[e]}
|
|
1711
|
-
`,Kl=C.newClassNameGetter("skeleton"),Vl=({animation:e="pulse",circle:t=!1,className:o,height:r=16,radius:
|
|
1712
|
+
`,Kl=C.newClassNameGetter("skeleton"),Vl=({animation:e="pulse",circle:t=!1,className:o,height:r=16,radius:l="md",ref:a,width:c="100%",...s})=>i.jsx(ql,{...s,ref:a,className:Kl("container",o),$animation:e,$circle:t,$height:r,$radius:l,$width:c}),Zl=d.styled.span`
|
|
1712
1713
|
display: inline-flex;
|
|
1713
1714
|
align-items: baseline;
|
|
1714
1715
|
gap: 4px;
|
|
@@ -1717,7 +1718,7 @@
|
|
|
1717
1718
|
`,Jl=d.styled.strong`
|
|
1718
1719
|
font-weight: 700;
|
|
1719
1720
|
color: ${n.COLORS.black};
|
|
1720
|
-
`,Ql=d.styled.span``,Ae=C.newClassNameGetter("stat"),ea=({className:e,classnames:t,label:o,ref:r,value:
|
|
1721
|
+
`,Ql=d.styled.span``,Ae=C.newClassNameGetter("stat"),ea=({className:e,classnames:t,label:o,ref:r,value:l,...a})=>i.jsxs(Zl,{...a,ref:r,className:Ae("container",e),children:[i.jsx(Jl,{className:Ae("value",t==null?void 0:t.value),children:l}),i.jsx(Ql,{className:Ae("label",t==null?void 0:t.label),children:o})]}),ta=d.styled.div`
|
|
1721
1722
|
display: flex;
|
|
1722
1723
|
flex-direction: column;
|
|
1723
1724
|
border: 1px solid ${n.COLORS.gray};
|
|
@@ -1817,7 +1818,7 @@
|
|
|
1817
1818
|
min-width: 0;
|
|
1818
1819
|
white-space: pre;
|
|
1819
1820
|
color: ${n.COLORS.black};
|
|
1820
|
-
`,we=C.newClassNameGetter("step-log"),ba={success:Le.CircleCheck,error:Le.CircleX,running:
|
|
1821
|
+
`,we=C.newClassNameGetter("step-log"),ba={success:Le.CircleCheck,error:Le.CircleX,running:i.LoaderCircle,pending:Le.Circle},$a=({className:e,classnames:t,defaultValue:o=[],onChange:r,ref:l,steps:a,value:c,...s})=>{const[p,x]=u.useState(o),g=c!==void 0,h=g?c:p,y=u.useCallback(f=>{const b=h.includes(f)?h.filter($=>$!==f):[...h,f];g||x(b),r==null||r(b)},[h,g,r]);return i.jsx(ta,{...s,ref:l,className:we("container",e),children:a.map(f=>{const S=h.includes(f.value),b=f.status??"pending",$=b!=="pending",m=f.lines&&f.lines.length>0,O=ba[b];return i.jsxs(oa,{className:we("step",t==null?void 0:t.step),children:[i.jsxs(ra,{type:"button",$expanded:S,$interactive:$,onClick:$?()=>y(f.value):void 0,className:we("header",t==null?void 0:t.header),children:[$?i.jsx(na,{$expanded:S,children:i.jsx(i.ChevronRight,{size:14})}):i.jsx(ia,{}),i.jsx(sa,{$status:b,children:i.jsx(O,{size:16})}),i.jsx(ca,{$muted:b==="pending",children:f.title}),f.duration&&i.jsx(pa,{children:f.duration})]}),$&&m&&i.jsx(ua,{$expanded:S,children:i.jsx(ga,{children:i.jsx(xa,{className:we("log",t==null?void 0:t.log),children:f.lines.map(v=>i.jsxs(ha,{children:[i.jsx(fa,{children:v.line}),i.jsx(ya,{children:v.text})]},v.line))})})})]},f.value)})})},Sa=d.styled.div`
|
|
1821
1822
|
display: flex;
|
|
1822
1823
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1823
1824
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1883,7 +1884,7 @@
|
|
|
1883
1884
|
min-width: 16px;
|
|
1884
1885
|
margin: 0 12px;
|
|
1885
1886
|
`}
|
|
1886
|
-
`,ce=C.newClassNameGetter("stepper"),Ra=({className:e,classnames:t,onChange:o,orientation:r="horizontal",ref:
|
|
1887
|
+
`,ce=C.newClassNameGetter("stepper"),Ra=({className:e,classnames:t,onChange:o,orientation:r="horizontal",ref:l,steps:a,value:c,...s})=>{const p=u.useMemo(()=>a.findIndex(x=>x.value===c),[a,c]);return i.jsx(Sa,{...s,ref:l,$orientation:r,className:ce("container",e),children:a.map((x,g)=>{const h=x.value===c,y=g<p,f=g===a.length-1;return i.jsxs(ma,{$orientation:r,children:[i.jsxs(Oa,{type:"button",$active:h,$completed:y,$clickable:!!o,onClick:()=>o==null?void 0:o(x.value),className:ce("step",t==null?void 0:t.step),children:[i.jsx(va,{$active:h,$completed:y,className:ce("circle",t==null?void 0:t.circle),children:g+1}),i.jsx(wa,{$active:h,$completed:y,className:ce("label",t==null?void 0:t.label),children:x.label})]}),!f&&i.jsx(Ca,{$completed:y,$orientation:r,className:ce("line",t==null?void 0:t.line)})]},x.value)})})},La=d.styled.div`
|
|
1887
1888
|
display: flex;
|
|
1888
1889
|
align-items: center;
|
|
1889
1890
|
gap: 6px;
|
|
@@ -1905,7 +1906,7 @@
|
|
|
1905
1906
|
&:hover:not(:disabled) {
|
|
1906
1907
|
background-color: ${e=>e.$active?n.COLORS.gray:"rgba(0, 0, 0, 0.05)"};
|
|
1907
1908
|
}
|
|
1908
|
-
`,st=C.newClassNameGetter("tabs"),ja=({className:e,classnames:t,onChange:o,ref:r,tabs:
|
|
1909
|
+
`,st=C.newClassNameGetter("tabs"),ja=({className:e,classnames:t,onChange:o,ref:r,tabs:l,value:a,...c})=>i.jsx(La,{...c,ref:r,className:st("container",e),role:"tablist",children:l.map(s=>i.jsx(ka,{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))}),Ea=d.styled.div`
|
|
1909
1910
|
display: flex;
|
|
1910
1911
|
flex-direction: column;
|
|
1911
1912
|
`,za=d.styled.div`
|
|
@@ -1933,21 +1934,32 @@
|
|
|
1933
1934
|
padding-bottom: ${e=>e.$last?"0":"24px"};
|
|
1934
1935
|
min-width: 0;
|
|
1935
1936
|
`,Pa=d.styled.div`
|
|
1937
|
+
display: flex;
|
|
1938
|
+
align-items: flex-start;
|
|
1939
|
+
justify-content: space-between;
|
|
1940
|
+
gap: 8px;
|
|
1941
|
+
`,Ba=d.styled.div`
|
|
1936
1942
|
font-size: 15px;
|
|
1937
1943
|
font-weight: 600;
|
|
1938
1944
|
color: ${n.COLORS.black};
|
|
1939
1945
|
line-height: 20px;
|
|
1940
|
-
|
|
1946
|
+
min-width: 0;
|
|
1947
|
+
`,Ma=d.styled.div`
|
|
1948
|
+
display: flex;
|
|
1949
|
+
align-items: center;
|
|
1950
|
+
gap: 4px;
|
|
1951
|
+
flex-shrink: 0;
|
|
1952
|
+
`,Fa=d.styled.div`
|
|
1941
1953
|
font-size: 13px;
|
|
1942
1954
|
color: ${n.COLORS["iron-grey"]};
|
|
1943
1955
|
margin-top: 2px;
|
|
1944
1956
|
line-height: 1.4;
|
|
1945
|
-
`,
|
|
1957
|
+
`,_a=d.styled.div`
|
|
1946
1958
|
font-size: 14px;
|
|
1947
1959
|
color: ${n.COLORS["iron-grey"]};
|
|
1948
1960
|
margin-top: 8px;
|
|
1949
1961
|
line-height: 1.5;
|
|
1950
|
-
`,
|
|
1962
|
+
`,H=C.newClassNameGetter("timeline"),Da=({className:e,classnames:t,items:o,ref:r,...l})=>i.jsx(Ea,{...l,ref:r,className:H("container",e),children:o.map((a,c)=>{const s=c===o.length-1;return i.jsxs(za,{className:H("item",t==null?void 0:t.item),children:[i.jsxs(Na,{$last:s,children:[i.jsx(Ta,{className:H("dot",t==null?void 0:t.dot)}),i.jsx(Ia,{className:H("line",t==null?void 0:t.line),$last:s})]}),i.jsxs(Aa,{className:H("content",t==null?void 0:t.content),$last:s,children:[i.jsxs(Pa,{children:[i.jsx(Ba,{className:H("title",t==null?void 0:t.title),children:a.title}),a.actions&&i.jsx(Ma,{className:H("actions",t==null?void 0:t.actions),children:a.actions})]}),a.description&&i.jsx(Fa,{className:H("description",t==null?void 0:t.description),children:a.description}),a.content&&i.jsx(_a,{className:H("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}},Ga=(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}},Ya={toasts:[],queue:[]},Be=e=>ct[e]??ct.default,Ha=d.styled.div`
|
|
1951
1963
|
position: fixed;
|
|
1952
1964
|
bottom: 24px;
|
|
1953
1965
|
left: 24px;
|
|
@@ -1958,7 +1970,7 @@
|
|
|
1958
1970
|
pointer-events: none;
|
|
1959
1971
|
width: auto;
|
|
1960
1972
|
max-width: 90vw;
|
|
1961
|
-
`,
|
|
1973
|
+
`,Xa=d.styled.div`
|
|
1962
1974
|
display: flex;
|
|
1963
1975
|
align-items: center;
|
|
1964
1976
|
justify-content: space-between;
|
|
@@ -1974,14 +1986,14 @@
|
|
|
1974
1986
|
0.3s ease-out;
|
|
1975
1987
|
pointer-events: auto;
|
|
1976
1988
|
max-width: 500px;
|
|
1977
|
-
`,
|
|
1989
|
+
`,Ua=d.styled.span`
|
|
1978
1990
|
font-size: 14px;
|
|
1979
1991
|
font-weight: 500;
|
|
1980
1992
|
line-height: 1.4;
|
|
1981
1993
|
white-space: nowrap;
|
|
1982
1994
|
overflow: hidden;
|
|
1983
1995
|
text-overflow: ellipsis;
|
|
1984
|
-
`,
|
|
1996
|
+
`,Wa=d.styled.button`
|
|
1985
1997
|
display: flex;
|
|
1986
1998
|
align-items: center;
|
|
1987
1999
|
justify-content: center;
|
|
@@ -1999,13 +2011,13 @@
|
|
|
1999
2011
|
&:hover {
|
|
2000
2012
|
opacity: 1;
|
|
2001
2013
|
}
|
|
2002
|
-
`,
|
|
2014
|
+
`,qa=d.styled.div`
|
|
2003
2015
|
display: flex;
|
|
2004
2016
|
align-items: center;
|
|
2005
2017
|
justify-content: space-between;
|
|
2006
2018
|
gap: 12px;
|
|
2007
2019
|
width: 100%;
|
|
2008
|
-
`,
|
|
2020
|
+
`,Ka=d.styled.div`
|
|
2009
2021
|
display: flex;
|
|
2010
2022
|
align-items: center;
|
|
2011
2023
|
justify-content: center;
|
|
@@ -2020,7 +2032,7 @@
|
|
|
2020
2032
|
font-weight: 500;
|
|
2021
2033
|
white-space: nowrap;
|
|
2022
2034
|
margin-left: auto;
|
|
2023
|
-
`,pt=({toast:e,onHide:t})=>{const[o,r]=u.useState(!1),
|
|
2035
|
+
`,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(Xa,{$variant:e.variant,$isExiting:o,children:[i.jsx(Ua,{children:e.message}),i.jsx(Wa,{onClick:l,children:i.jsx(i.X,{style:{width:16,height:16}})})]})},Va=({toasts:e,queueCount:t,onHide:o})=>{if(e.length===0)return null;const r=e.length-1;return i.jsx(Ha,{children:e.map((l,a)=>a===r&&t>0?i.jsxs(qa,{children:[i.jsx(pt,{toast:l,onHide:o}),i.jsxs(Ka,{children:["+",t]})]},l.id):i.jsx(pt,{toast:l,onHide:o},l.id))})},Za=({children:e})=>{const[t,o]=u.useReducer(Ga,Ya),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(Va,{toasts:t.toasts,queueCount:t.queue.length,onHide:l})]})},Ja=()=>{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,Qa=(e,t)=>{const o=ue(t).background;switch(e){case"top":return`
|
|
2024
2036
|
bottom: -12px;
|
|
2025
2037
|
left: 50%;
|
|
2026
2038
|
margin-left: -6px;
|
|
@@ -2040,7 +2052,7 @@
|
|
|
2040
2052
|
top: 50%;
|
|
2041
2053
|
margin-top: -6px;
|
|
2042
2054
|
border-right-color: ${o};
|
|
2043
|
-
`;default:return""}},
|
|
2055
|
+
`;default:return""}},ed=(e,t)=>{if(t!=="light")return"";const o=ue(t).border;switch(e){case"top":return`
|
|
2044
2056
|
&::after {
|
|
2045
2057
|
bottom: -14px;
|
|
2046
2058
|
left: 50%;
|
|
@@ -2094,7 +2106,7 @@
|
|
|
2094
2106
|
width: 0;
|
|
2095
2107
|
height: 0;
|
|
2096
2108
|
border: 6px solid transparent;
|
|
2097
|
-
${
|
|
2109
|
+
${Qa(e.$placement,e.$variant)}
|
|
2098
2110
|
}
|
|
2099
2111
|
|
|
2100
2112
|
${e.$variant==="light"?`
|
|
@@ -2107,12 +2119,12 @@
|
|
|
2107
2119
|
}
|
|
2108
2120
|
`:""}
|
|
2109
2121
|
|
|
2110
|
-
${
|
|
2111
|
-
`,
|
|
2122
|
+
${ed(e.$placement,e.$variant)}
|
|
2123
|
+
`,td=d.styled.div`
|
|
2112
2124
|
position: relative;
|
|
2113
2125
|
display: inline-block;
|
|
2114
2126
|
width: fit-content;
|
|
2115
|
-
`,
|
|
2127
|
+
`,od=e=>{switch(e){case"top":return`
|
|
2116
2128
|
bottom: calc(100% + 8px);
|
|
2117
2129
|
left: 50%;
|
|
2118
2130
|
transform: translateX(-50%);
|
|
@@ -2128,29 +2140,29 @@
|
|
|
2128
2140
|
left: calc(100% + 8px);
|
|
2129
2141
|
top: 50%;
|
|
2130
2142
|
transform: translateY(-50%);
|
|
2131
|
-
`;default:return""}},
|
|
2143
|
+
`;default:return""}},rd=d.styled.div`
|
|
2132
2144
|
position: absolute;
|
|
2133
2145
|
${e=>Lt(e)}
|
|
2134
|
-
${({$placement:e})=>
|
|
2135
|
-
`,
|
|
2146
|
+
${({$placement:e})=>od(e)}
|
|
2147
|
+
`,nd=d.styled.div`
|
|
2136
2148
|
position: fixed;
|
|
2137
2149
|
${e=>Lt(e)}
|
|
2138
|
-
`,Me=C.newClassNameGetter("tooltip"),Z=8,
|
|
2150
|
+
`,Me=C.newClassNameGetter("tooltip"),Z=8,id=({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),v=u.useRef(null),k=u.useCallback(()=>{var U,W;if(!O.current)return;const R=O.current.getBoundingClientRect(),E=((U=v.current)==null?void 0:U.offsetWidth)??100,w=((W=v.current)==null?void 0:W.offsetHeight)??30,T=R.top-Z,N=window.innerHeight-R.bottom-Z,M=R.left-Z,Y=window.innerWidth-R.right-Z;let F=a;if(a==="top"&&T<w&&N>T?F="bottom":a==="bottom"&&N<w&&T>N?F="top":a==="left"&&M<E&&Y>M?F="right":a==="right"&&Y<E&&M>Y&&(F="left"),b(F),c){let _,D;switch(F){case"top":_=R.top-w-Z,D=R.left+R.width/2-E/2;break;case"bottom":_=R.bottom+Z,D=R.left+R.width/2-E/2;break;case"left":_=R.top+R.height/2-w/2,D=R.left-E-Z;break;case"right":_=R.top+R.height/2-w/2,D=R.right+Z;break;default:_=0,D=0}const q=8;D=Math.max(q,Math.min(D,window.innerWidth-E-q)),_=Math.max(q,Math.min(_,window.innerHeight-w-q)),m({top:_,left:D})}},[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?De.createPortal(i.jsx(nd,{ref:v,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(rd,{ref:v,className:Me("content",o==null?void 0:o.content),$placement:S,$variant:p,$visible:g,children:r});return i.jsxs(td,{...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]})},ld=d.styled.div`
|
|
2139
2151
|
display: inline-flex;
|
|
2140
2152
|
align-items: center;
|
|
2141
2153
|
gap: 12px;
|
|
2142
2154
|
flex-direction: ${({$reverse:e})=>e?"row-reverse":"row"};
|
|
2143
|
-
`,
|
|
2155
|
+
`,ad=d.styled.div`
|
|
2144
2156
|
display: flex;
|
|
2145
2157
|
flex-direction: column;
|
|
2146
2158
|
text-align: ${({$align:e})=>e};
|
|
2147
|
-
`,
|
|
2159
|
+
`,dd=d.styled.span`
|
|
2148
2160
|
font-size: 14px;
|
|
2149
2161
|
font-weight: 600;
|
|
2150
2162
|
line-height: 1.4;
|
|
2151
|
-
`,
|
|
2163
|
+
`,sd=d.styled.span`
|
|
2152
2164
|
font-size: 12px;
|
|
2153
2165
|
color: #666;
|
|
2154
2166
|
line-height: 1.4;
|
|
2155
|
-
`,Ce=C.newClassNameGetter("user"),
|
|
2167
|
+
`,Ce=C.newClassNameGetter("user"),cd=({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(ld,{...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(ad,{$align:x?"right":"left",children:[i.jsx(dd,{className:Ce("name",r==null?void 0:r.name),children:a}),l&&i.jsx(sd,{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=X.mediaBetween;exports.mediaDown=X.mediaDown;exports.mediaUp=X.mediaUp;exports.validation=X.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=Ft;exports.Alert=Wt;exports.Avatar=xt;exports.AvatarGroup=to;exports.Badge=ao;exports.BreadcrumbItem=so;exports.Breadcrumbs=fo;exports.Card=vo;exports.CardBody=Co;exports.CardFooter=Lo;exports.CardHeader=jo;exports.ConfirmationProvider=Fo;exports.Container=Yo;exports.DateRange=qo;exports.Divider=Zo;exports.Drawer=or;exports.Dropdown=dr;exports.EmptyState=yr;exports.FieldRow=Sr;exports.FileUpload=Hr;exports.FileUploadItem=qr;exports.GlobalStyle=Et;exports.Hashtag=Qr;exports.Heading=on;exports.ImageCropper=ci;exports.MenuButton=gi;exports.NotificationProvider=vi;exports.NotifyConfirmationProvider=Ai;exports.Overline=_i;exports.Pagination=nl;exports.Panel=pl;exports.PendingScreen=Il;exports.Progress=Bl;exports.SaveProgressProvider=_l;exports.ShellScreen=Zi;exports.Skeleton=Vl;exports.SplitFlapText=wt;exports.Stat=ea;exports.StepLog=$a;exports.Stepper=Ra;exports.Tabs=ja;exports.Timeline=Da;exports.ToastProvider=Za;exports.Tooltip=id;exports.User=cd;exports.formatFileSize=bt;exports.useConfirmation=_o;exports.useImageCropper=mt;exports.useNotification=wi;exports.useNotifyConfirmation=Pi;exports.useSaveProgress=Dl;exports.useToastr=Ja;
|
|
2156
2168
|
//# sourceMappingURL=index.cjs.map
|