@vacano/ui 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +103 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +169 -4
- package/dist/index.js +393 -377
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./X-BIgkmQPR.cjs"),be=require("@emotion/react"),u=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./media-BuwIclXE.cjs"),a=require("./X-BIgkmQPR.cjs"),be=require("@emotion/react"),u=require("react"),T=require("./tooling-Dflq0Y98.cjs"),ge=require("react-dom");function no(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const Re=no(u);function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},Ct.apply(null,arguments)}const ao=be.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -100,18 +100,18 @@
|
|
|
100
100
|
:focus:not(:focus-visible) {
|
|
101
101
|
outline: none;
|
|
102
102
|
}
|
|
103
|
-
`,lo=()=>a.jsx(be.Global,{styles:ao});var co=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,so=a.memoize(function(e){return co.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),po=so,uo=function(r){return r!=="theme"},
|
|
103
|
+
`,lo=()=>a.jsx(be.Global,{styles:ao});var co=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,so=a.memoize(function(e){return co.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),po=so,uo=function(r){return r!=="theme"},Nt=function(r){return typeof r=="string"&&r.charCodeAt(0)>96?po:uo},Tt=function(r,o,n){var i;if(o){var l=o.shouldForwardProp;i=r.__emotion_forwardProp&&l?function(c){return r.__emotion_forwardProp(c)&&l(c)}:l}return typeof i!="function"&&n&&(i=r.__emotion_forwardProp),i},ho=function(r){var o=r.cache,n=r.serialized,i=r.isStringTag;return a.registerStyles(o,n,i),a.useInsertionEffectAlwaysWithSyncFallback(function(){return a.insertStyles(o,n,i)}),null},bo=function e(r,o){var n=r.__emotion_real===r,i=n&&r.__emotion_base||r,l,c;o!==void 0&&(l=o.label,c=o.target);var d=Tt(r,o,n),p=d||Nt(i),b=!p("as");return function(){var h=arguments,f=n&&r.__emotion_styles!==void 0?r.__emotion_styles.slice(0):[];if(l!==void 0&&f.push("label:"+l+";"),h[0]==null||h[0].raw===void 0)f.push.apply(f,h);else{var S=h[0];f.push(S[0]);for(var w=h.length,O=1;O<w;O++)f.push(h[O],S[O])}var x=be.withEmotionCache(function(C,$,y){var g=b&&C.as||i,L="",N=[],j=C;if(C.theme==null){j={};for(var Y in C)j[Y]=C[Y];j.theme=Re.useContext(be.ThemeContext)}typeof C.className=="string"?L=a.getRegisteredStyles($.registered,N,C.className):C.className!=null&&(L=C.className+" ");var P=a.serializeStyles(f.concat(N),$.registered,j);L+=$.key+"-"+P.name,c!==void 0&&(L+=" "+c);var _=b&&d===void 0?Nt(g):p,M={};for(var E in C)b&&E==="as"||_(E)&&(M[E]=C[E]);return M.className=L,y&&(M.ref=y),Re.createElement(Re.Fragment,null,Re.createElement(ho,{cache:$,serialized:P,isStringTag:typeof g=="string"}),Re.createElement(g,M))});return x.displayName=l!==void 0?l:"Styled("+(typeof i=="string"?i:i.displayName||i.name||"Component")+")",x.defaultProps=r.defaultProps,x.__emotion_real=x,x.__emotion_base=i,x.__emotion_styles=f,x.__emotion_forwardProp=d,Object.defineProperty(x,"toString",{value:function(){return"."+c}}),x.withComponent=function(C,$){var y=e(C,Ct({},o,$,{shouldForwardProp:Tt(x,$,!0)}));return y.apply(void 0,f)},x}},go=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],s=bo.bind(null);go.forEach(function(e){s[e]=s(e)});const fo=s.span`
|
|
104
104
|
font-size: 12px;
|
|
105
105
|
font-weight: 500;
|
|
106
106
|
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
107
|
-
`,xo=
|
|
107
|
+
`,xo=T.newClassNameGetter("field-label"),ie=({children:e,className:r,ref:o,required:n,variant:i="normal",...l})=>e?a.jsxs(fo,{...l,ref:o,className:xo("container",r),$variant:i,children:[e," ",n&&"*"]}):null,ot={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},ne={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},Oo=s.div`
|
|
108
108
|
position: relative;
|
|
109
109
|
display: grid;
|
|
110
110
|
gap: 2px;
|
|
111
111
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
112
|
-
|
|
112
|
+
`,So=s(ie)`
|
|
113
113
|
margin-left: 6px;
|
|
114
|
-
|
|
114
|
+
`,$o=s.div`
|
|
115
115
|
position: relative;
|
|
116
116
|
display: flex;
|
|
117
117
|
align-items: center;
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
display: flex;
|
|
154
154
|
align-items: center;
|
|
155
155
|
justify-content: center;
|
|
156
|
-
`,
|
|
156
|
+
`,mo=s.div`
|
|
157
157
|
position: absolute;
|
|
158
158
|
top: 100%;
|
|
159
159
|
left: 0;
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
opacity 0.15s ease,
|
|
174
174
|
transform 0.15s ease,
|
|
175
175
|
visibility 0.15s;
|
|
176
|
-
`,
|
|
176
|
+
`,wo=s.div`
|
|
177
177
|
display: flex;
|
|
178
178
|
align-items: center;
|
|
179
179
|
gap: 10px;
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
&:hover {
|
|
200
200
|
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
201
201
|
}
|
|
202
|
-
`,
|
|
202
|
+
`,vo=s.img`
|
|
203
203
|
width: 24px;
|
|
204
204
|
height: 24px;
|
|
205
205
|
border-radius: 6px;
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
border-top-color: ${At.indicator};
|
|
230
230
|
border-radius: 50%;
|
|
231
231
|
animation: ${Lo} 0.8s linear infinite;
|
|
232
|
-
`,Po=
|
|
232
|
+
`,Po=T.newClassNameGetter("spinner"),kt=({"aria-label":e="Loading",className:r,ref:o,size:n="md",...i})=>a.jsx(Eo,{...i,ref:o,className:Po("container",r),role:"status","aria-label":e,$size:n}),ke=T.newClassNameGetter("autocomplete"),jo=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,size:c="default",variant:d="normal",value:p,onChange:b,onSearch:h,debounceMs:f=300,minChars:S=1,noResultsMessage:w="No results found",...O})=>{const[x,C]=u.useState((p==null?void 0:p.value)??""),[$,y]=u.useState([]),[g,L]=u.useState(!1),[N,j]=u.useState(!1),[Y,P]=u.useState(!1),_=u.useRef(null),M=u.useRef(null);u.useEffect(()=>{(p==null?void 0:p.value)!==void 0&&C(p.value)},[p==null?void 0:p.value]);const E=u.useCallback(async z=>{if(z.length<S){y([]),P(!1);return}L(!0),P(!0);try{const B=await h(z);y(B),j(!0)}catch{y([])}finally{L(!1)}},[h,S]),A=u.useCallback(z=>{const B=z.target.value;C(B),b==null||b({value:B,image_url:null}),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{E(B)},f)},[b,E,f]),m=u.useCallback(z=>{C(z.value),y([]),j(!1),P(!1),b==null||b({value:z.value,image_url:z.image_url})},[b]),I=u.useCallback(()=>{setTimeout(()=>{j(!1)},150)},[]),R=u.useCallback(()=>{$.length>0&&j(!0)},[$.length]);return u.useEffect(()=>()=>{M.current&&clearTimeout(M.current)},[]),a.jsxs(Oo,{ref:_,className:ke("container",e),$fullWidth:!!n,children:[i&&a.jsx(So,{variant:d,className:ke("label",r==null?void 0:r.label),children:i}),a.jsxs($o,{children:[a.jsx(yo,{...O,ref:l,type:"text",value:x,onChange:A,onBlur:I,onFocus:R,disabled:o,$size:c,$variant:d,className:ke("input",r==null?void 0:r.input)}),g&&a.jsx(Co,{children:a.jsx(kt,{size:"xs"})})]}),a.jsx(mo,{$open:N&&Y,className:ke("dropdown",r==null?void 0:r.dropdown),children:$.length>0?$.map(z=>a.jsxs(wo,{onClick:()=>m(z),className:ke("item",r==null?void 0:r.item),children:[z.image_url&&a.jsx(vo,{src:z.image_url,alt:z.value}),a.jsx(Ro,{children:z.value})]},z.id)):!g&&a.jsx(ko,{children:w})})]})},Dt={compact:{height:"32px",padding:"0 8px",radius:"12px",iconSize:"16px"},default:{height:"40px",padding:"0 12px",radius:"16px",iconSize:"20px"}},_t={normal:{background:{static:t.COLORS["steel-blue"],hover:t.alpha(t.COLORS["steel-blue"],90),active:t.alpha(t.COLORS["steel-blue"],80),disabled:t.alpha(t.COLORS["steel-blue"],50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},system:{background:{static:t.COLORS.black,hover:t.alpha(t.COLORS.black,90),active:t.alpha(t.COLORS.black,80),disabled:t.alpha(t.COLORS.black,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},success:{background:{static:t.COLORS.green,hover:t.alpha(t.COLORS.green,90),active:t.alpha(t.COLORS.green,80),disabled:t.alpha(t.COLORS.green,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},warning:{background:{static:t.COLORS.yellow,hover:t.alpha(t.COLORS.yellow,90),active:t.alpha(t.COLORS.yellow,80),disabled:t.alpha(t.COLORS.yellow,50)},color:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.COLORS.black},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},danger:{background:{static:t.COLORS.red,hover:t.alpha(t.COLORS.red,90),active:t.alpha(t.COLORS.red,80),disabled:t.alpha(t.COLORS.red,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},transparent:{background:{static:t.alpha(t.COLORS["iron-grey"],1),hover:t.alpha(t.COLORS["iron-grey"],5),active:t.alpha(t.COLORS["iron-grey"],10),disabled:t.alpha(t.COLORS["iron-grey"],5)},color:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,30)},borderColor:{static:t.alpha(t.COLORS["iron-grey"],20),hover:t.alpha(t.COLORS["iron-grey"],20),active:t.alpha(t.COLORS["iron-grey"],20),disabled:t.alpha(t.COLORS["iron-grey"],10)}}},J=e=>{const r=_t[e];return r||_t.normal},re=e=>{const r=Dt[e];return r||Dt.default},zo=e=>e?"auto":"fit-content",No=s.button`
|
|
233
233
|
display: flex;
|
|
234
234
|
gap: 6px;
|
|
235
235
|
text-decoration: none;
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
background-color: ${e=>J(e.$variant).background.disabled};
|
|
262
262
|
border-color: ${e=>J(e.$variant).borderColor.disabled};
|
|
263
263
|
}
|
|
264
|
-
`,
|
|
264
|
+
`,To=s.div`
|
|
265
265
|
display: grid;
|
|
266
266
|
place-items: center;
|
|
267
267
|
width: ${e=>re(e.$size).iconSize};
|
|
@@ -296,12 +296,12 @@
|
|
|
296
296
|
border-radius: 4px;
|
|
297
297
|
width: fit-content;
|
|
298
298
|
background-color: ${e=>e.$variant==="light"?t.alpha(t.COLORS.white,25):t.alpha(t.COLORS.black,25)};
|
|
299
|
-
`,Mo=
|
|
299
|
+
`,Mo=T.newClassNameGetter("key-symbol"),yr=({className:e,ref:r,symbol:o,variant:n="light",...i})=>o?a.jsx(_o,{...i,ref:r,className:Mo("container",e),$variant:n,children:o}):null,Mt=T.newClassNameGetter("key-bindings"),Cr=({className:e,classnames:r,keys:o,ref:n,variant:i,...l})=>{const c=u.useMemo(()=>t.getKeySymbols(o),[o]);return c.length===0?null:a.jsx(Do,{...l,ref:n,className:Mt("container",e),children:c.map(d=>a.jsx(yr,{symbol:d,className:Mt("item",r==null?void 0:r.item),variant:i},d))})},Ft=T.newClassNameGetter("button"),De=({children:e,className:r,classnames:o,disabled:n,fullWidth:i,icon:l,loading:c,onClick:d,ref:p=null,keyBindings:b=[],size:h="default",type:f="button",variant:S="normal",...w})=>{const O=u.useRef(null);u.useImperativeHandle(p,()=>O.current,[]),t.useKeyBinding(b,()=>{var C;(C=O.current)==null||C.click()});const x=u.useMemo(()=>{switch(f){case"link":return"button";default:return f}},[f]);return a.jsxs(No,{...w,onClick:d,ref:O,type:x,disabled:n,className:Ft("container",r),$variant:S,$size:h,$fullWidth:!!i,$iconOnly:!!l&&!(e||(b==null?void 0:b.length)>0),children:[c&&a.jsx(Ao,{$size:h}),l&&!c&&a.jsx(To,{$size:h,children:l}),e&&a.jsx(Io,{className:Ft("label",o==null?void 0:o.label),children:e}),a.jsx(Cr,{keys:b,variant:S==="system"?"light":"dark"})]})},Fo=s.div`
|
|
300
300
|
background-color: ${t.COLORS.white};
|
|
301
301
|
border-radius: 16px;
|
|
302
302
|
border: ${e=>e.$border?`1px solid ${t.alpha(t.COLORS["iron-grey"],15)}`:"none"};
|
|
303
303
|
box-shadow: ${e=>e.$shadow?`0 2px 8px ${t.alpha(t.COLORS.black,10)}`:"none"};
|
|
304
|
-
`,Bo=
|
|
304
|
+
`,Bo=T.newClassNameGetter("card"),Yo=({children:e,className:r,ref:o,border:n=!1,shadow:i=!1,...l})=>a.jsx(Fo,{...l,ref:o,className:Bo("container",r),$border:n,$shadow:i,children:e}),Bt={normal:{box:{border:t.alpha(t.COLORS["iron-grey"],30),borderChecked:t.COLORS["iron-grey"],background:t.COLORS.white,backgroundChecked:t.COLORS.black,focusShadow:t.alpha(t.COLORS["iron-grey"],30)},label:t.COLORS.black,icon:t.COLORS.white},error:{box:{border:t.COLORS.red,borderChecked:t.COLORS.red,background:t.COLORS.white,backgroundChecked:t.COLORS.red,focusShadow:t.alpha(t.COLORS.red,30)},label:t.COLORS.red,icon:t.COLORS.white}},ye=e=>Bt[e]??Bt.normal,Vo=s.label`
|
|
305
305
|
display: inline-flex;
|
|
306
306
|
align-items: flex-start;
|
|
307
307
|
gap: 8px;
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
width: 12px;
|
|
344
344
|
height: 12px;
|
|
345
345
|
}
|
|
346
|
-
`,
|
|
346
|
+
`,Ko=s.span`
|
|
347
347
|
font-size: 14px;
|
|
348
348
|
font-weight: 500;
|
|
349
349
|
line-height: 1.4;
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
text-decoration: none;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
`,Le=
|
|
362
|
+
`,Le=T.newClassNameGetter("checkbox"),et=({checked:e,className:r,classnames:o,disabled:n,indeterminate:i=!1,label:l,onChange:c,ref:d,variant:p="normal",...b})=>a.jsxs(Vo,{className:Le("container",r),$disabled:!!n,$variant:p,children:[a.jsx(Ho,{...b,ref:d,type:"checkbox",className:Le("input",o==null?void 0:o.input),checked:e,disabled:n,onChange:c}),a.jsx(Go,{className:Le("box",o==null?void 0:o.box),$checked:e,$indeterminate:i,$variant:p,children:a.jsx(Wo,{className:Le("icon",o==null?void 0:o.icon),$visible:i||e,$variant:p,children:i?a.jsx(a.Minus,{}):a.jsx(a.Check,{})})}),l&&a.jsx(Ko,{className:Le("label",o==null?void 0:o.label),$variant:p,children:l})]}),Yt={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},ue=e=>Yt[e]??Yt.normal,Uo=s.label`
|
|
363
363
|
display: grid;
|
|
364
364
|
grid-template-columns: auto 1fr;
|
|
365
365
|
align-items: start;
|
|
@@ -383,7 +383,7 @@
|
|
|
383
383
|
.vacano_checkbox_container {
|
|
384
384
|
pointer-events: none;
|
|
385
385
|
}
|
|
386
|
-
`,
|
|
386
|
+
`,Xo=s.input`
|
|
387
387
|
position: absolute;
|
|
388
388
|
width: 1px;
|
|
389
389
|
height: 1px;
|
|
@@ -393,7 +393,7 @@
|
|
|
393
393
|
clip: rect(0, 0, 0, 0);
|
|
394
394
|
white-space: nowrap;
|
|
395
395
|
border: 0;
|
|
396
|
-
`,
|
|
396
|
+
`,qo=s.div`
|
|
397
397
|
display: flex;
|
|
398
398
|
flex-direction: column;
|
|
399
399
|
gap: 2px;
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
label[data-disabled='true'] & {
|
|
417
417
|
color: ${e=>ue(e.$variant).description.disabled};
|
|
418
418
|
}
|
|
419
|
-
`,Ye=
|
|
419
|
+
`,Ye=T.newClassNameGetter("checkbox-card"),Qo=({checked:e,className:r,classnames:o,description:n,disabled:i,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:b="normal",...h})=>a.jsxs(Uo,{className:Ye("container",r),$checked:e,$disabled:!!i,$fullWidth:l,$variant:b,"data-disabled":i,children:[a.jsx(Xo,{...h,ref:p,type:"checkbox",checked:e,disabled:i,onChange:d}),a.jsx(et,{className:o==null?void 0:o.checkbox,checked:e,disabled:i,variant:b,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(qo,{className:Ye("content",o==null?void 0:o.content),children:[a.jsx(Zo,{className:Ye("label",o==null?void 0:o.label),$variant:b,children:c}),n&&a.jsx(Jo,{className:Ye("description",o==null?void 0:o.description),$variant:b,children:n})]})]}),Vt={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},ei=s.div`
|
|
420
420
|
display: flex;
|
|
421
421
|
flex-direction: column;
|
|
422
422
|
gap: 8px;
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
display: flex;
|
|
431
431
|
flex-direction: column;
|
|
432
432
|
gap: 12px;
|
|
433
|
-
`,nt=
|
|
433
|
+
`,nt=T.newClassNameGetter("checkbox-group"),oi=({className:e,classnames:r,disabled:o,label:n,onChange:i,options:l,ref:c,value:d,...p})=>{const b=(h,f)=>{i(f?[...d,h]:d.filter(S=>S!==h))};return a.jsxs(ei,{...p,ref:c,className:nt("container",e),children:[n&&a.jsx(ti,{className:nt("label",r==null?void 0:r.label),$disabled:o,children:n}),a.jsx(ri,{className:nt("options",r==null?void 0:r.options),children:l.map(h=>a.jsx(et,{className:r==null?void 0:r.checkbox,checked:d.includes(h.value),label:h.label,disabled:o,onChange:f=>b(h.value,f.target.checked)},h.value))})]})},Ht={gray:{background:t.alpha(t.COLORS["iron-grey"],10),color:t.COLORS["iron-grey"],deleteHover:t.alpha(t.COLORS["iron-grey"],20)},red:{background:t.alpha(t.COLORS.red,10),color:t.COLORS.red,deleteHover:t.alpha(t.COLORS.red,20)},blue:{background:t.alpha(t.COLORS["steel-blue"],10),color:t.COLORS["steel-blue"],deleteHover:t.alpha(t.COLORS["steel-blue"],20)},black:{background:t.COLORS.black,color:t.COLORS.white,deleteHover:t.alpha(t.COLORS.white,20)}},mt=e=>Ht[e]??Ht.gray,ii=s.span`
|
|
434
434
|
display: inline-flex;
|
|
435
435
|
align-items: center;
|
|
436
436
|
gap: 4px;
|
|
@@ -440,8 +440,8 @@
|
|
|
440
440
|
font-size: 12px;
|
|
441
441
|
font-weight: 500;
|
|
442
442
|
line-height: 1.5;
|
|
443
|
-
background-color: ${e=>
|
|
444
|
-
color: ${e=>
|
|
443
|
+
background-color: ${e=>mt(e.$variant).background};
|
|
444
|
+
color: ${e=>mt(e.$variant).color};
|
|
445
445
|
`,ni=s.button`
|
|
446
446
|
display: inline-flex;
|
|
447
447
|
align-items: center;
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
transition: background-color 0.15s ease;
|
|
458
458
|
|
|
459
459
|
&:hover {
|
|
460
|
-
background-color: ${e=>
|
|
460
|
+
background-color: ${e=>mt(e.$variant).deleteHover};
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
& svg {
|
|
@@ -467,7 +467,7 @@
|
|
|
467
467
|
`,ai=s.span`
|
|
468
468
|
flex: 1 0 auto;
|
|
469
469
|
text-align: center;
|
|
470
|
-
`,at=
|
|
470
|
+
`,at=T.newClassNameGetter("chip"),Je=({children:e,className:r,classnames:o,deletable:n,onDelete:i,ref:l,variant:c="gray",...d})=>a.jsxs(ii,{...d,ref:l,className:at("container",r),$variant:c,$deletable:!!n,children:[a.jsx(ai,{className:at("label",o==null?void 0:o.label),children:e}),n&&a.jsx(ni,{type:"button",className:at("delete",o==null?void 0:o.delete),$variant:c,onClick:i,children:a.jsx(a.X,{})})]}),li="Confirm",di="Cancel",ci=be.keyframes`
|
|
471
471
|
from {
|
|
472
472
|
opacity: 0;
|
|
473
473
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -510,7 +510,7 @@
|
|
|
510
510
|
display: flex;
|
|
511
511
|
align-items: center;
|
|
512
512
|
gap: 8px;
|
|
513
|
-
`,bi=({confirmation:e,onDone:r})=>{const[o,n]=u.useState(!1),[i,l]=u.useState(!1),{message:c,onConfirm:d,onCancel:p,options:b}=e,h=b.confirmLabel||li,f=b.cancelLabel||di
|
|
513
|
+
`,bi=({confirmation:e,onDone:r})=>{const[o,n]=u.useState(!1),[i,l]=u.useState(!1),{message:c,onConfirm:d,onCancel:p,options:b}=e,h=b.confirmLabel||li,f=b.cancelLabel||di,S=u.useCallback(x=>{n(!0),setTimeout(()=>{x==null||x(),r()},200)},[r]),w=u.useCallback(async()=>{const x=d();if(x instanceof Promise){l(!0);try{await x}finally{l(!1)}}S()},[S,d]),O=u.useCallback(()=>{i||S(p)},[S,i,p]);return u.useEffect(()=>{const x=C=>{C.key==="Escape"&&!i&&O()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[O,i]),a.jsxs(pi,{$isExiting:o,children:[a.jsx(ui,{children:c}),a.jsxs(hi,{children:[a.jsx(De,{variant:"system",size:"compact",onClick:O,disabled:i,children:f}),a.jsx(De,{variant:"danger",size:"compact",onClick:w,loading:i,children:h})]})]})},mr=u.createContext(null),gi=()=>{},fi=({children:e})=>{const[r,o]=u.useState(null),n=u.useCallback((l,c,d,p)=>{o({open:!0,message:l,onConfirm:c,onCancel:d||gi,options:p||{}})},[]),i=u.useCallback(()=>{o(null)},[]);return a.jsxs(mr.Provider,{value:{show:n,hide:i},children:[e,r&&a.jsx(bi,{confirmation:r,onDone:i})]})},xi=()=>{const e=u.useContext(mr);if(!e)throw new Error("useConfirmation must be used within ConfirmationProvider");return e},Ee={sm:`${t.BREAKPOINTS.sm}px`,md:`${t.BREAKPOINTS.md}px`,lg:`${t.BREAKPOINTS.lg}px`,xl:`${t.BREAKPOINTS.xl}px`,"2xl":`${t.BREAKPOINTS["2xl"]}px`},Oi=s.div`
|
|
514
514
|
width: 100%;
|
|
515
515
|
|
|
516
516
|
${t.mediaUp("sm")} {
|
|
@@ -532,7 +532,7 @@
|
|
|
532
532
|
${t.mediaUp("2xl")} {
|
|
533
533
|
max-width: ${Ee["2xl"]};
|
|
534
534
|
}
|
|
535
|
-
|
|
535
|
+
`,Si=T.newClassNameGetter("container"),$i=({children:e,className:r,ref:o,...n})=>a.jsx(Oi,{...n,ref:o,className:Si("container",r),children:e}),Ze={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},Pe={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},oe=36,tt=2,yi=12,wr=(e,r,o="en")=>{const n=e.getFullYear(),i=e.getMonth(),l=e.getDate(),c=e.getHours(),d=e.getMinutes(),p=e.getSeconds(),b=c%12||12,h=c>=12,f=new Intl.DateTimeFormat(o,{month:"long"}).format(e),S=new Intl.DateTimeFormat(o,{month:"short"}).format(e),w=new Intl.DateTimeFormat(o,{weekday:"long"}).format(e),O=new Intl.DateTimeFormat(o,{weekday:"short"}).format(e),x=L=>L.toString().padStart(2,"0"),C=L=>L.toString().padStart(2," "),$=L=>`\0${L}\0`,y=[["2006","YEARFOUR",n.toString()],["January","MONTHLONG",f],["Monday","WEEKDAYLONG",w],["Jan","MONTHSHORT",S],["Mon","WEEKDAYSHORT",O],["06","YEARTWO",n.toString().slice(-2)],["01","MONTHPAD",x(i+1)],["_2","DAYSPACE",C(l)],["02","DAYPAD",x(l)],["15","HOURTWENTYFOUR",x(c)],["03","HOURTWELVEPAD",x(b)],["04","MINUTE",x(d)],["05","SECOND",x(p)],["PM","AMPMUP",h?"PM":"AM"],["pm","AMPMLOW",h?"pm":"am"],["1","MONTH",(i+1).toString()],["2","DAY",l.toString()],["3","HOURTWELVE",b.toString()]];let g=r;for(const[L,N]of y)g=g.split(L).join($(N));for(const[,L,N]of y)g=g.split($(L)).join(N);return g},Ci=(e,r)=>new Date(e,r+1,0).getDate(),mi=(e,r)=>new Date(e,r,1).getDay(),wi=(e,r,o=1)=>{const n=Ci(e,r);let l=mi(e,r)-o;l<0&&(l+=7);const c=[];for(let d=0;d<l;d++)c.push(null);for(let d=1;d<=n;d++)c.push(d);for(;c.length<42;)c.push(null);return c},vi=(e,r=1)=>{const o=[];for(let n=0;n<7;n++){const i=(r+n)%7,l=new Date(2024,0,7+i);o.push(new Intl.DateTimeFormat(e,{weekday:"short"}).format(l))}return o},Ri=e=>{const r=[];for(let o=0;o<12;o++){const n=new Date(2024,o,1);r.push(new Intl.DateTimeFormat(e,{month:"short"}).format(n))}return r},Gt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate(),Wt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth(),ki=(e,r)=>e.getFullYear()===r.getFullYear(),Kt=(e,r,o,n,i)=>{const l=new Date(e,r,o);if(n){const c=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(l<c)return!0}if(i){const c=new Date(i.getFullYear(),i.getMonth(),i.getDate());if(l>c)return!0}return!1},Ut=(e,r,o,n)=>{if(o){const i=o.getFullYear(),l=o.getMonth();if(e<i||e===i&&r<l)return!0}if(n){const i=n.getFullYear(),l=n.getMonth();if(e>i||e===i&&r>l)return!0}return!1},Xt=(e,r,o)=>!!(r&&e<r.getFullYear()||o&&e>o.getFullYear()),Li=(e,r=12)=>{const o=e-Math.floor(r/2),n=[];for(let i=0;i<r;i++)n.push(o+i);return n},Ei=e=>{switch(e){case"date":return"02.01.2006";case"month":return"January 2006";case"year":return"2006"}},Pi=s.div`
|
|
536
536
|
position: relative;
|
|
537
537
|
display: inline-flex;
|
|
538
538
|
flex-direction: column;
|
|
@@ -563,19 +563,19 @@
|
|
|
563
563
|
${({$open:e,$variant:r})=>e&&`
|
|
564
564
|
outline: 2px solid ${Pe[r].focus};
|
|
565
565
|
`}
|
|
566
|
-
`,
|
|
566
|
+
`,Ni=s.span`
|
|
567
567
|
flex: 1;
|
|
568
568
|
overflow: hidden;
|
|
569
569
|
text-overflow: ellipsis;
|
|
570
570
|
white-space: nowrap;
|
|
571
|
-
`,
|
|
571
|
+
`,Ti=s.span`
|
|
572
572
|
display: flex;
|
|
573
573
|
align-items: center;
|
|
574
574
|
justify-content: center;
|
|
575
575
|
flex-shrink: 0;
|
|
576
576
|
transition: transform 0.15s ease;
|
|
577
577
|
transform: ${({$open:e})=>e?"rotate(180deg)":"rotate(0deg)"};
|
|
578
|
-
`,
|
|
578
|
+
`,vr=`
|
|
579
579
|
z-index: 100;
|
|
580
580
|
background-color: ${t.COLORS.white};
|
|
581
581
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
@@ -586,7 +586,7 @@
|
|
|
586
586
|
position: absolute;
|
|
587
587
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
588
588
|
left: 0;
|
|
589
|
-
${
|
|
589
|
+
${vr}
|
|
590
590
|
opacity: ${({$open:e})=>e?1:0};
|
|
591
591
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
592
592
|
transform: ${({$open:e,$position:r})=>Rr(e,r)};
|
|
@@ -596,7 +596,7 @@
|
|
|
596
596
|
visibility 0.15s;
|
|
597
597
|
`,Ai=s.div`
|
|
598
598
|
position: fixed;
|
|
599
|
-
${
|
|
599
|
+
${vr}
|
|
600
600
|
opacity: ${({$open:e})=>e?1:0};
|
|
601
601
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
602
602
|
transform: ${({$open:e,$position:r})=>Rr(e,r)};
|
|
@@ -748,7 +748,7 @@
|
|
|
748
748
|
`,Gi=s.div`
|
|
749
749
|
width: ${oe}px;
|
|
750
750
|
height: ${oe}px;
|
|
751
|
-
`,
|
|
751
|
+
`,q=T.newClassNameGetter("date-picker"),Ve=4,Wi=300,Ki=({value:e,onChange:r,mode:o="date",displayFormat:n,placeholder:i,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:p,size:b="default",variant:h="normal",disabled:f=!1,fullWidth:S=!1,label:w,portalRenderNode:O,open:x,onOpen:C,onClose:$,className:y,classnames:g,ref:L,...N})=>{const j=u.useMemo(()=>new Date,[]),[Y,P]=u.useState(!1),[_,M]=u.useState({top:0,left:0}),[E,A]=u.useState("bottom"),[m,I]=u.useState(()=>o==="year"?"years":o==="month"?"months":"days"),[R,z]=u.useState(()=>e??j),[B,F]=u.useState(()=>((e==null?void 0:e.getFullYear())??j.getFullYear())-6),H=u.useRef(null),k=u.useRef(null),D=u.useRef(null),U=x!==void 0,X=U?x:Y,fe=n??Ei(o),_e=u.useMemo(()=>vi(l,c),[l,c]),rt=u.useMemo(()=>Ri(l),[l]),Br=u.useMemo(()=>wi(R.getFullYear(),R.getMonth(),c),[R,c]),Me=u.useMemo(()=>Li(B+6,12),[B]),Et=u.useMemo(()=>e?wr(e,fe,l):null,[e,fe,l]),Yr=i??fe.replace(/2006|06|January|Jan|01|02/g,"__"),me=u.useCallback(()=>{var ve;if(!k.current)return;const v=k.current.getBoundingClientRect(),V=((ve=D.current)==null?void 0:ve.offsetHeight)??Wi,we=window.innerHeight-v.bottom-Ve,Fe=v.top-Ve,xe=we<V&&Fe>we?"top":"bottom";if(A(xe),O){const Be=xe==="bottom"?v.bottom+Ve:v.top-V-Ve;M({top:Be,left:v.left})}},[O]),Pt=u.useCallback(()=>{if(f)return;U||P(!0),C==null||C(),I(o==="year"?"years":o==="month"?"months":"days");const v=e??j;z(v),F(v.getFullYear()-6)},[f,U,C,o,e,j]),Z=u.useCallback(()=>{U||P(!1),$==null||$()},[U,$]),Vr=u.useCallback(()=>{X?Z():Pt()},[X,Z,Pt]),Hr=u.useCallback(v=>{const V=new Date(R.getFullYear(),R.getMonth(),v);r==null||r(V),Z()},[R,r,Z]),Gr=u.useCallback(v=>{if(o==="month"){const V=new Date(R.getFullYear(),v,1);r==null||r(V),Z()}else z(new Date(R.getFullYear(),v,1)),I("days")},[o,R,r,Z]),Wr=u.useCallback(v=>{if(o==="year"){const V=new Date(v,0,1);r==null||r(V),Z()}else o==="month"?(z(new Date(v,R.getMonth(),1)),I("months")):(z(new Date(v,R.getMonth(),1)),I("months"))},[o,R,r,Z]),Kr=u.useCallback(()=>{z(v=>new Date(v.getFullYear(),v.getMonth()-1,1))},[]),Ur=u.useCallback(()=>{z(v=>new Date(v.getFullYear(),v.getMonth()+1,1))},[]),Xr=u.useCallback(()=>{z(v=>new Date(v.getFullYear()-1,v.getMonth(),1))},[]),qr=u.useCallback(()=>{z(v=>new Date(v.getFullYear()+1,v.getMonth(),1))},[]),Zr=u.useCallback(()=>{F(v=>v-12)},[]),Jr=u.useCallback(()=>{F(v=>v+12)},[]),jt=u.useCallback(()=>{m==="days"?I("months"):m==="months"&&I("years")},[m]);u.useLayoutEffect(()=>{X&&me()},[X,me]),u.useEffect(()=>{const v=xe=>{const ve=xe.target,Be=H.current&&!H.current.contains(ve),io=D.current&&!D.current.contains(ve);O?Be&&io&&Z():Be&&Z()},V=xe=>{xe.key==="Escape"&&Z()},we=()=>{X&&O&&me()},Fe=()=>{X&&O&&me()};return X&&(document.addEventListener("mousedown",v),document.addEventListener("keydown",V),O&&(window.addEventListener("scroll",we,!0),window.addEventListener("resize",Fe))),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",V),window.removeEventListener("scroll",we,!0),window.removeEventListener("resize",Fe)}},[X,Z,O,me]);const Qr=Ze[b].iconSize,eo=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:q("header",g==null?void 0:g.header),children:[a.jsx(dt,{onClick:jt,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(R)}),a.jsxs(ct,{children:[a.jsx(Oe,{onClick:Kr,type:"button","aria-label":"Previous month",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Ur,type:"button","aria-label":"Next month",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Di,{children:_e.map((v,V)=>a.jsx(_i,{children:v},V))}),a.jsx(Mi,{className:q("grid",g==null?void 0:g.grid),children:Br.map((v,V)=>v===null?a.jsx(Gi,{},V):a.jsx(Fi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Gt(e,new Date(R.getFullYear(),R.getMonth(),v)):!1,$today:Gt(j,new Date(R.getFullYear(),R.getMonth(),v)),$disabled:Kt(R.getFullYear(),R.getMonth(),v,d,p),disabled:Kt(R.getFullYear(),R.getMonth(),v,d,p),onClick:()=>Hr(v),children:v},V))})]}),to=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:q("header",g==null?void 0:g.header),children:[a.jsx(dt,{onClick:jt,type:"button",children:R.getFullYear()}),a.jsxs(ct,{children:[a.jsx(Oe,{onClick:Xr,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:qr,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Bi,{className:q("grid",g==null?void 0:g.grid),children:rt.map((v,V)=>a.jsx(Yi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Wt(e,new Date(R.getFullYear(),V,1)):!1,$current:Wt(j,new Date(R.getFullYear(),V,1)),$disabled:Ut(R.getFullYear(),V,d,p),disabled:Ut(R.getFullYear(),V,d,p),onClick:()=>Gr(V),children:v},V))})]}),ro=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:q("header",g==null?void 0:g.header),children:[a.jsxs(dt,{type:"button",style:{cursor:"default"},children:[Me[0]," - ",Me[Me.length-1]]}),a.jsxs(ct,{children:[a.jsx(Oe,{onClick:Zr,type:"button","aria-label":"Previous years",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Jr,type:"button","aria-label":"Next years",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Vi,{className:q("grid",g==null?void 0:g.grid),children:Me.map(v=>a.jsx(Hi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?ki(e,new Date(v,0,1)):!1,$current:j.getFullYear()===v,$disabled:Xt(v,d,p),disabled:Xt(v,d,p),onClick:()=>Wr(v),children:v},v))})]}),zt=()=>{switch(m){case"days":return eo();case"months":return to();case"years":return ro()}},oo=O?ge.createPortal(a.jsx(Ai,{ref:D,$open:X,$position:E,className:q("calendar",g==null?void 0:g.calendar),style:{top:_.top,left:_.left},children:zt()}),O):a.jsx(Ii,{ref:D,$open:X,$position:E,className:q("calendar",g==null?void 0:g.calendar),children:zt()});return a.jsxs(Pi,{...N,ref:L??H,$fullWidth:S,className:q("container",y),children:[w&&a.jsx(ji,{children:w}),a.jsxs(zi,{ref:k,type:"button",onClick:Vr,disabled:f,$size:b,$variant:h,$disabled:f,$open:X,$hasValue:!!Et,className:q("trigger",g==null?void 0:g.trigger),children:[a.jsx(Ni,{children:Et??Yr}),a.jsx(Ti,{$open:X,children:a.jsx(a.ChevronDown,{size:Qr})})]}),oo]})},Ui={left:t.KEYFRAMES.slideInLeft,right:t.KEYFRAMES.slideInRight,top:t.KEYFRAMES.slideInTop,bottom:t.KEYFRAMES.slideInBottom},Xi=(e,r)=>{switch(e){case"left":return`
|
|
752
752
|
top: 0;
|
|
753
753
|
left: 0;
|
|
754
754
|
height: 100%;
|
|
@@ -768,14 +768,14 @@
|
|
|
768
768
|
left: 0;
|
|
769
769
|
width: 100%;
|
|
770
770
|
height: ${r};
|
|
771
|
-
`}},
|
|
771
|
+
`}},qi=s.div`
|
|
772
772
|
position: fixed;
|
|
773
773
|
z-index: 1001;
|
|
774
774
|
background-color: ${t.COLORS.white};
|
|
775
775
|
box-shadow: 0 4px 24px ${t.alpha(t.COLORS.black,20)};
|
|
776
|
-
${e=>
|
|
777
|
-
animation: ${e=>
|
|
778
|
-
`,Zi=
|
|
776
|
+
${e=>Xi(e.$position,e.$size)}
|
|
777
|
+
animation: ${e=>Ui[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
778
|
+
`,Zi=T.newClassNameGetter("drawer"),Ji=({animated:e,children:r,className:o,open:n,position:i="right",ref:l,size:c="400px",...d})=>n?ge.createPortal(a.jsx(qi,{...d,ref:l,className:Zi("container",o),$animated:!!e,$position:i,$size:c,children:r}),document.body):null,Qi=s.div`
|
|
779
779
|
position: relative;
|
|
780
780
|
display: inline-block;
|
|
781
781
|
`,en=s.div`
|
|
@@ -810,7 +810,7 @@
|
|
|
810
810
|
opacity 0.15s ease,
|
|
811
811
|
transform 0.15s ease,
|
|
812
812
|
visibility 0.15s;
|
|
813
|
-
`,He=
|
|
813
|
+
`,He=T.newClassNameGetter("dropdown"),Ge=4,on=100,nn=({align:e="left",autoClose:r=!0,children:o,className:n,classnames:i,onClose:l,onOpen:c,open:d,portalRenderNode:p,ref:b,trigger:h,...f})=>{const[S,w]=u.useState(!1),[O,x]=u.useState({top:0,left:0}),[C,$]=u.useState("bottom"),y=u.useRef(null),g=u.useRef(null),L=u.useRef(null),N=d!==void 0,j=N?d:S,Y=u.useCallback(()=>{var F,H;if(!g.current)return;const A=g.current.getBoundingClientRect(),m=((F=L.current)==null?void 0:F.offsetHeight)??on,I=((H=L.current)==null?void 0:H.offsetWidth)??160,R=window.innerHeight-A.bottom-Ge,z=A.top-Ge,B=R<m&&z>R?"top":"bottom";if($(B),p){let k;e==="left"?k=A.left:k=A.right-I;const D=B==="bottom"?A.bottom+Ge:A.top-m-Ge;x({top:D,left:k})}},[e,p]),P=u.useCallback(()=>{N?j?l==null||l():c==null||c():w(A=>{const m=!A;return m?c==null||c():l==null||l(),m})},[N,j,l,c]),_=u.useCallback(()=>{N||w(!1),l==null||l()},[N,l]),M=u.useCallback(()=>{r&&_()},[r,_]);u.useLayoutEffect(()=>{j&&Y()},[j,Y]),u.useEffect(()=>{const A=z=>{const B=z.target,F=y.current&&!y.current.contains(B),H=L.current&&!L.current.contains(B);p?F&&H&&_():F&&_()},m=z=>{z.key==="Escape"&&_()},I=()=>{j&&p&&Y()},R=()=>{j&&p&&Y()};return j&&(document.addEventListener("mousedown",A),document.addEventListener("keydown",m),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",R))),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",m),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",R)}},[j,_,p,Y]);const E=p?ge.createPortal(a.jsx(rn,{ref:L,$open:j,$position:C,className:He("content",i==null?void 0:i.content),style:{top:O.top,left:O.left},onClick:M,children:o}),p):a.jsx(tn,{ref:L,$align:e,$open:j,$position:C,className:He("content",i==null?void 0:i.content),onClick:M,children:o});return a.jsxs(Qi,{...f,ref:b??y,className:He("container",n),children:[a.jsx(en,{ref:g,onClick:P,className:He("trigger",i==null?void 0:i.trigger),children:u.cloneElement(h)}),E]})},an=s.div`
|
|
814
814
|
display: inline-flex;
|
|
815
815
|
align-items: center;
|
|
816
816
|
gap: 8px;
|
|
@@ -841,13 +841,13 @@
|
|
|
841
841
|
&:hover {
|
|
842
842
|
opacity: ${({$disabled:e})=>e?.5:1};
|
|
843
843
|
}
|
|
844
|
-
`,cn=({value:e,onChange:r,disabled:o=!1,placeholder:n,className:i,classnames:l,"data-test-id":c})=>{const[d,p]=u.useState(!1),b=u.useRef(null),h=u.useRef(null),f=u.useCallback(()=>{var x;p(!1);const O=((x=h.current)==null?void 0:x.textContent)||"";O!==e&&r(O)},[r,e]);u.useEffect(()=>{if(d&&h.current){h.current.focus();const O=document.createRange(),x=window.getSelection();O.selectNodeContents(h.current),O.collapse(!1),x==null||x.removeAllRanges(),x==null||x.addRange(O)}},[d]),u.useEffect(()=>{if(!d)return;const O=x=>{b.current&&!b.current.contains(x.target)&&f()};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[d,f]);const
|
|
844
|
+
`,cn=({value:e,onChange:r,disabled:o=!1,placeholder:n,className:i,classnames:l,"data-test-id":c})=>{const[d,p]=u.useState(!1),b=u.useRef(null),h=u.useRef(null),f=u.useCallback(()=>{var x;p(!1);const O=((x=h.current)==null?void 0:x.textContent)||"";O!==e&&r(O)},[r,e]);u.useEffect(()=>{if(d&&h.current){h.current.focus();const O=document.createRange(),x=window.getSelection();O.selectNodeContents(h.current),O.collapse(!1),x==null||x.removeAllRanges(),x==null||x.addRange(O)}},[d]),u.useEffect(()=>{if(!d)return;const O=x=>{b.current&&!b.current.contains(x.target)&&f()};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[d,f]);const S=()=>{o||p(!0)},w=O=>{O.key==="Enter"&&O.metaKey?(O.preventDefault(),f()):O.key==="Escape"&&(h.current&&(h.current.textContent=e),p(!1))};return a.jsxs(an,{ref:b,className:i,"data-test-id":c,children:[a.jsx(ln,{ref:h,className:l==null?void 0:l.text,contentEditable:d,suppressContentEditableWarning:!0,onKeyDown:w,$isEmpty:!e,children:e||n}),a.jsx(dn,{type:"button",className:l==null?void 0:l.button,$disabled:o&&!d,onClick:d?f:S,disabled:o&&!d,"aria-label":d?"Save":"Edit",children:d?a.jsx(a.Check,{size:16}):a.jsx(a.Pencil,{size:14})})]})},sn={normal:t.COLORS["iron-grey"],error:t.COLORS.red,success:t.COLORS.green,warning:t.COLORS.yellow},pn=s.span`
|
|
845
845
|
display: block;
|
|
846
846
|
font-size: 12px;
|
|
847
847
|
font-weight: 500;
|
|
848
848
|
line-height: 1.4;
|
|
849
849
|
color: ${e=>sn[e.$variant]};
|
|
850
|
-
`,un=
|
|
850
|
+
`,un=T.newClassNameGetter("field-message"),hn=({children:e,className:r,ref:o,variant:n="normal",...i})=>e?a.jsx(pn,{...i,ref:o,className:un("container",r),$variant:n,children:e}):null,bn=s.div`
|
|
851
851
|
display: flex;
|
|
852
852
|
flex-direction: column;
|
|
853
853
|
gap: 12px;
|
|
@@ -912,7 +912,7 @@
|
|
|
912
912
|
max-height: 70vh;
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
|
|
915
|
+
`,Sn=e=>`
|
|
916
916
|
.${e} {
|
|
917
917
|
padding: 7px 16px;
|
|
918
918
|
font-size: 14px;
|
|
@@ -930,7 +930,7 @@
|
|
|
930
930
|
.${e}:active {
|
|
931
931
|
transform: translate(0, 1px);
|
|
932
932
|
}
|
|
933
|
-
|
|
933
|
+
`,$n=e=>`
|
|
934
934
|
.${e} {
|
|
935
935
|
display: flex;
|
|
936
936
|
flex-direction: column;
|
|
@@ -989,7 +989,7 @@
|
|
|
989
989
|
font-size: 14px;
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
|
-
`,
|
|
992
|
+
`,mn=e=>`
|
|
993
993
|
.${e} {
|
|
994
994
|
display: block;
|
|
995
995
|
z-index: 101;
|
|
@@ -1007,14 +1007,14 @@
|
|
|
1007
1007
|
position: absolute;
|
|
1008
1008
|
touch-action: none;
|
|
1009
1009
|
}
|
|
1010
|
-
`,
|
|
1010
|
+
`,wn=e=>`
|
|
1011
1011
|
.${e} {
|
|
1012
1012
|
position: absolute;
|
|
1013
1013
|
z-index: 2;
|
|
1014
1014
|
background-color: rgba(0, 0, 0, 0.6);
|
|
1015
1015
|
touch-action: none;
|
|
1016
1016
|
}
|
|
1017
|
-
`,
|
|
1017
|
+
`,vn=e=>`
|
|
1018
1018
|
.${e} {
|
|
1019
1019
|
position: absolute;
|
|
1020
1020
|
z-index: 3;
|
|
@@ -1103,16 +1103,16 @@
|
|
|
1103
1103
|
position: absolute;
|
|
1104
1104
|
z-index: 1;
|
|
1105
1105
|
}
|
|
1106
|
-
`,zn=e=>{let r=5381;for(let o=0;o<e.length;o++)r=(r<<5)+r^e.charCodeAt(o);return Math.abs(r).toString(36)},G=e=>`hq-cropper__${zn(e)}`,W=e=>e||[],
|
|
1106
|
+
`,zn=e=>{let r=5381;for(let o=0;o<e.length;o++)r=(r<<5)+r^e.charCodeAt(o);return Math.abs(r).toString(36)},G=e=>`hq-cropper__${zn(e)}`,W=e=>e||[],K=(e,r)=>{if(r)for(const o of r)e.classList.add(o)},Nn=e=>{const r={applyButton:[G("applyButton"),...W(e.applyButton)],cancelButton:[G("cancelButton"),...W(e.cancelButton)],container:[G("container"),...W(e.container)],handlerMove:[G("handlerMove"),...W(e.handlerMove)],handlerResizeTopLeft:[G("handlerResizeTopLeft"),...W(e.handlerResizeTopLeft)],handlerResizeTopRight:[G("handlerResizeTopRight"),...W(e.handlerResizeTopRight)],handlerResizeBottomLeft:[G("handlerResizeBottomLeft"),...W(e.handlerResizeBottomLeft)],handlerResizeBottomRight:[G("handlerResizeBottomRight"),...W(e.handlerResizeBottomRight)],sourceImage:[G("sourceImage"),...W(e.sourceImage)],portalArea:[G("portalArea"),...W(e.portalArea)],previewImage:[G("previewImage"),...W(e.previewImage)],body:[G("body"),...W(e.body)],header:[G("header"),...W(e.header)],footer:[G("footer"),...W(e.footer)],portal:[G("portal"),...W(e.portal)],preview:[G("preview"),...W(e.preview)],root:[G("root"),...W(e.root)]},o=`
|
|
1107
1107
|
${xn(r.applyButton[0])}
|
|
1108
1108
|
${On(r.body[0])}
|
|
1109
|
-
${
|
|
1110
|
-
${
|
|
1109
|
+
${Sn(r.cancelButton[0])}
|
|
1110
|
+
${$n(r.container[0])}
|
|
1111
1111
|
${yn(r.footer[0])}
|
|
1112
1112
|
${Cn(r.header[0])}
|
|
1113
|
-
${
|
|
1114
|
-
${
|
|
1115
|
-
${
|
|
1113
|
+
${mn(r.handlerMove[0])}
|
|
1114
|
+
${wn(r.portalArea[0])}
|
|
1115
|
+
${vn(r.portal[0])}
|
|
1116
1116
|
${Rn(r.previewImage[0])}
|
|
1117
1117
|
${kn(r.preview[0])}
|
|
1118
1118
|
${We(r.handlerResizeBottomLeft[0],"bl")}
|
|
@@ -1121,7 +1121,7 @@
|
|
|
1121
1121
|
${We(r.handlerResizeTopRight[0],"tr")}
|
|
1122
1122
|
${Pn(r.root[0])}
|
|
1123
1123
|
${jn(r.sourceImage[0])}
|
|
1124
|
-
`,n=document.createElement("style");return n.innerHTML=o,document.getElementsByTagName("head")[0].prepend(n),r};let Nn=0;const In=e=>{const r=new Map,o=new Proxy({...e},{set(n,i,l){return Reflect.set(n,i,l),(r.get(i)||[]).forEach(c=>c.action(l,n,i)),!0}});return{getState:()=>({...o}),setState:n=>{for(const i of Object.keys(n)){const l=n[i];l!==void 0&&(o[i]=l)}},subscribe:(n,i)=>{const l=String(++Nn),c=r.get(n)||[];return r.set(n,[...c,{action:i,id:l}]),l},unsubscribe:n=>{for(const[i,l]of r.entries()){const c=l.filter(d=>d.id!==n);if(c.length!==l.length){r.set(i,c);return}}},unsubscribeAll:()=>{r.clear()}}},mt={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"]}},An=(e={},r={})=>In({...mt,config:{...mt.config,...e},css:Tn(r)}),Dn=(e,r)=>{var $;const o=e(),n=document.querySelector(`.${($=o.css)==null?void 0:$.body[0]}`);if(!n)return o.frame;const{width:i,height:l}=n.getBoundingClientRect(),c=i/l,d=r.width/r.height;let p,b,h=0,f=0;return c>d?(p=l*d,b=l,f=(i-p)/2):(p=i,b=i*(r.height/r.width),h=(l-b)/2),{width:p,height:b,left:f,top:h}},_n=(e,r,o)=>{const[n,i]=r,l=n+e>o.width?(o.width-e)/2:n,c=i+e>o.height?(o.height-e)/2:i;return[l,c]},Mn=(e,r)=>{const{config:o}=e(),n=Math.min(r.width,r.height)-o.framePadding*2,i=o.portalSize>n?n:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=_n(i,o.portalPosition,r);return{left:l,top:c,size:i}}return o.portalPosition==="center"?{size:i,left:(r.width-i)/2,top:(r.height-i)/2}:{left:0,top:0,size:i}};var te=(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))(te||{});const Fn=e=>{var n;const r=e(),o=document.createElement("span");return U(o,(n=r.css)==null?void 0:n.handlerMove),o.setAttribute("data-action",te.MOVE),o},Bn=e=>{var n;const r=e(),o=document.createElement("span");return U(o,(n=r.css)==null?void 0:n.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},Yn=e=>{var n;const r=e(),o=document.createElement("span");return U(o,(n=r.css)==null?void 0:n.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Vn=e=>{var n;const r=e(),o=document.createElement("span");return U(o,(n=r.css)==null?void 0:n.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Hn=e=>{var n;const r=e(),o=document.createElement("span");return U(o,(n=r.css)==null?void 0:n.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},Gn=e=>{var n;const r=e(),o=document.createElement("img");return U(o,(n=r.css)==null?void 0:n.previewImage),o},Wn=e=>{var n;const r=e(),o=document.createElement("div");return U(o,(n=r.css)==null?void 0:n.preview),o.appendChild(Gn(e)),o},Un=e=>{var n;const r=e(),o=document.createElement("div");return U(o,(n=r.css)==null?void 0:n.portal),o.appendChild(Wn(e)),o.appendChild(Fn(e)),o.appendChild(Vn(e)),o.appendChild(Hn(e)),o.appendChild(Bn(e)),o.appendChild(Yn(e)),o},Xn=e=>{var n;const r=e(),o=document.createElement("div");return U(o,(n=r.css)==null?void 0:n.portalArea),o.appendChild(Un(e)),o},qn=e=>{var n;const r=e(),o=document.createElement("img");return U(o,(n=r.css)==null?void 0:n.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Kn=e=>{var n;const r=e(),o=document.createElement("div");return U(o,(n=r.css)==null?void 0:n.body),o.appendChild(qn(e)),o.appendChild(Xn(e)),o},Zn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return U(n,(i=o.css)==null?void 0:i.applyButton),n.setAttribute("role","button"),n.innerText=o.config.applyButtonLabel,n.addEventListener("click",r),n},Jn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return U(n,(i=o.css)==null?void 0:i.cancelButton),n.setAttribute("role","button"),n.innerText=o.config.cancelButtonLabel,n.addEventListener("click",r),n},Qn=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return U(i,(l=n.css)==null?void 0:l.footer),i.appendChild(Jn(e,o)),i.appendChild(Zn(e,r)),i},ea=e=>{var n;const r=e(),o=document.createElement("div");return U(o,(n=r.css)==null?void 0:n.header),o},ta=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return U(i,(l=n.css)==null?void 0:l.container),i.appendChild(ea(e)),i.appendChild(Kn(e)),i.appendChild(Qn(e,r,o)),i},ra=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");U(i,(l=n.css)==null?void 0:l.root),i.appendChild(ta(e,r,o)),document.body.appendChild(i)},oa=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ie=new Map,ia={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},pe=(e,r)=>{if(Ie.has(e))return Ie.get(e);if(!r)return null;const o=r[ia[e]],n=document.querySelector(`.${o[0]}`);return Ie.set(e,n),n},na=()=>{Ie.clear()},aa=()=>{Ie.clear()},la=(e,r)=>{const o=pe("header",r.css);o&&(o.innerText=e)},da=(e,r)=>{const o=pe("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const n=pe("portalArea",r.css);n&&(n.style.height=`${r.frame.height}px`,n.style.width=`${r.frame.width}px`,n.style.left=`${r.frame.left}px`,n.style.top=`${r.frame.top}px`);const i=pe("portal",r.css);i&&(i.style.width=`${r.portal.size}px`,i.style.height=`${r.portal.size}px`,i.style.left=`${r.portal.left}px`,i.style.top=`${r.portal.top}px`);const l=pe("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},ca=(e,r)=>{const o=pe("portal",r.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 n=pe("previewImage",r.css);n&&(n.style.marginLeft=`-${e.left}px`,n.style.marginTop=`-${e.top}px`)},st=1,sa=e=>{var m,O;const r=e(),o=document.createElement("canvas"),n=r.frame.width||st,i=r.frame.height||st,l=r.sourceWidth/n,c=r.sourceHeight/i,d=r.portal.left*l,p=r.portal.top*c,b=Math.max(r.portal.size*Math.min(l,c),st),h=r.config.outputSize>0?r.config.outputSize:b;o.width=h,o.height=h;const f=document.querySelector(`.${(m=r.css)==null?void 0:m.sourceImage[0]}`);f&&((O=o.getContext("2d"))==null||O.drawImage(f,d,p,b,b,0,0,h,h));const $=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((x,C)=>{try{o.toBlob(S=>{if(o.remove(),!S){C(new Error(`Failed to create blob for type: image/${r.config.type}`));return}x([$,S])},`image/${r.config.type}`,r.config.compression)}catch(S){o.remove(),C(S)}})},pa=(e,r,o)=>{const{emitted:n,portal:i,frame:l,config:c}=r();let d=n.left-n.X+e.clientX,p=n.top-n.Y+e.clientY;const b=c.framePadding,h=l.width-c.framePadding-i.size,f=c.framePadding,$=l.height-c.framePadding-i.size;d<b&&(d=b),d>h&&(d=h),p<f&&(p=f),p>$&&(p=$),o({portal:{...i,left:d,top:p}})},ua=(e,r,o)=>{const{action:n,emitted:i,portal:l,frame:c,config:d}=r(),p=e.pageX-i.X,b=e.pageY-i.Y;switch(n){case te.RESIZE_BR:{let h=i.size+Math.max(p,b);return h<d.minPortalSize&&(h=d.minPortalSize),i.top+h>c.height-d.framePadding&&(h=c.height-i.top-d.framePadding),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding),o({portal:{...l,size:h}})}case te.RESIZE_TR:{let h=p+b>0?i.size+p:i.size-b,f=p+b>0?i.top-p:i.top+b;return h<d.minPortalSize&&(f=i.top+i.size-d.minPortalSize,h=d.minPortalSize),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding,f=i.top-c.width+i.left+i.size),f<d.framePadding&&(h=i.top+i.size,f=d.framePadding),o({portal:{...l,top:f,size:h}})}case te.RESIZE_TL:{const h=Math.min(p,b);let f=i.size-h,$=i.left+h,m=i.top+h;if(f<d.minPortalSize){const O=i.size-d.minPortalSize;f=d.minPortalSize,$=i.left+O,m=i.top+O}if(m<d.framePadding){const O=d.framePadding-m;m=d.framePadding,$=$+O,f=f-O}if($<d.framePadding){const O=d.framePadding-$;$=d.framePadding,m=m+O,f=f-O}return o({portal:{...l,top:m,left:$,size:f}})}case te.RESIZE_BL:{let h=p+b>0?i.size+b:i.size-p,f=p+b>0?i.left-b:i.left+p;return h<d.minPortalSize&&(f=i.left+i.size-d.minPortalSize,h=d.minPortalSize),h+i.top>c.height-d.framePadding&&(f=i.left-c.height+i.top+i.size,h=c.height-i.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,h=i.left+i.size-d.framePadding),o({portal:{...l,left:f,size:h}})}default:return}},Kt=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 r=e;return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}},ha=(e,r)=>{var $,m,O;const o=e(),n=document.querySelector(`.${($=o.css)==null?void 0:$.portal[0]}`),i=document.querySelector(`.${(m=o.css)==null?void 0:m.portalArea[0]}`),l=document.querySelector(`.${(O=o.css)==null?void 0:O.root[0]}`);let c=null,d=null;const p=x=>{x.preventDefault();const{portal:C}=e(),S=Kt(x);if(x.target){const y=x.target.getAttribute("data-action"),g={X:S.pageX,Y:S.pageY,left:C.left,top:C.top,size:C.size};r({action:y,emitted:g})}},b=()=>{const{action:x}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,x&&r({action:null})},h=()=>{if(c=null,!d)return;const x=d;d=null;const{action:C}=e();if(C)switch(C){case te.MOVE:pa(x,e,r);break;default:ua(x,e,r)}},f=x=>{const{action:C}=e();C&&(x.preventDefault(),d=Kt(x),c===null&&(c=requestAnimationFrame(h)))};return l&&(l.addEventListener("mouseup",b),l.addEventListener("touchend",b),l.addEventListener("touchcancel",b)),n&&(n.addEventListener("mousedown",p),n.addEventListener("touchstart",p,{passive:!1})),i&&(i.addEventListener("mousemove",f),i.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",b),l.removeEventListener("touchend",b),l.removeEventListener("touchcancel",b)),n&&(n.removeEventListener("mousedown",p),n.removeEventListener("touchstart",p)),i&&(i.removeEventListener("mousemove",f),i.removeEventListener("touchmove",f))}},Zt=1024*1024,ba=(e,r)=>{if(!r.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${r.allowedTypes.join(", ")}`;if(r.maxFileSize>0&&e.size>r.maxFileSize){const o=(r.maxFileSize/Zt).toFixed(2);return`File size (${(e.size/Zt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ga=(e,r,o,n,i,l,c)=>{const d=S=>{c?c(S):console.error(`HqCropper: ${S}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:b}=r(),h=ba(p,b);if(h){d(h),e.target.value="";return}const f=new FileReader;let $=null;const m=()=>{var g;const S=r(),y=document.querySelector(`.${(g=S.css)==null?void 0:g.root[0]}`);y&&(y.remove(),document.removeEventListener("keydown",O),$==null||$(),aa(),l(),o(mt))},O=S=>{S.key==="Escape"&&r().sourceBase64&&x(S)},x=S=>{S.preventDefault(),m()},C=S=>{S.preventDefault();const y=r();sa(r).then(([g,L])=>{n(g,L,y),x(S)}).catch(g=>{d(g instanceof Error?g.message:"Failed to crop image")})};f.onload=S=>{const y=new Image;if(!S.target||typeof S.target.result!="string"){d("Can't load result image");return}y.src=S.target.result,y.onerror=()=>{d("Failed to load image")},y.onload=()=>{var T;ra(r,C,x),na(),i("fileName",la),i("sourceBase64",da),i("portal",ca);const g=Dn(r,y),L=Mn(r,g);o({frame:g,portal:L,fileName:p.name,sourceBase64:(T=S.target)==null?void 0:T.result,sourceHeight:y.height,sourceWidth:y.width}),$=ha(r,o),document.addEventListener("keydown",O)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},fa=(e,r,o,n)=>{const{getState:i,setState:l,subscribe:c,unsubscribeAll:d}=An(r,o),p=oa(b=>ga(b,i,l,e,c,d,n));return{open:()=>p.click()}},ae={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Jt="vacano-image-cropper-styles",xa=`
|
|
1124
|
+
`,n=document.createElement("style");return n.innerHTML=o,document.getElementsByTagName("head")[0].prepend(n),r};let Tn=0;const In=e=>{const r=new Map,o=new Proxy({...e},{set(n,i,l){return Reflect.set(n,i,l),(r.get(i)||[]).forEach(c=>c.action(l,n,i)),!0}});return{getState:()=>({...o}),setState:n=>{for(const i of Object.keys(n)){const l=n[i];l!==void 0&&(o[i]=l)}},subscribe:(n,i)=>{const l=String(++Tn),c=r.get(n)||[];return r.set(n,[...c,{action:i,id:l}]),l},unsubscribe:n=>{for(const[i,l]of r.entries()){const c=l.filter(d=>d.id!==n);if(c.length!==l.length){r.set(i,c);return}}},unsubscribeAll:()=>{r.clear()}}},wt={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"]}},An=(e={},r={})=>In({...wt,config:{...wt.config,...e},css:Nn(r)}),Dn=(e,r)=>{var S;const o=e(),n=document.querySelector(`.${(S=o.css)==null?void 0:S.body[0]}`);if(!n)return o.frame;const{width:i,height:l}=n.getBoundingClientRect(),c=i/l,d=r.width/r.height;let p,b,h=0,f=0;return c>d?(p=l*d,b=l,f=(i-p)/2):(p=i,b=i*(r.height/r.width),h=(l-b)/2),{width:p,height:b,left:f,top:h}},_n=(e,r,o)=>{const[n,i]=r,l=n+e>o.width?(o.width-e)/2:n,c=i+e>o.height?(o.height-e)/2:i;return[l,c]},Mn=(e,r)=>{const{config:o}=e(),n=Math.min(r.width,r.height)-o.framePadding*2,i=o.portalSize>n?n:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=_n(i,o.portalPosition,r);return{left:l,top:c,size:i}}return o.portalPosition==="center"?{size:i,left:(r.width-i)/2,top:(r.height-i)/2}:{left:0,top:0,size:i}};var te=(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))(te||{});const Fn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerMove),o.setAttribute("data-action",te.MOVE),o},Bn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},Yn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Vn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Hn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},Gn=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.previewImage),o},Wn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.preview),o.appendChild(Gn(e)),o},Kn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portal),o.appendChild(Wn(e)),o.appendChild(Fn(e)),o.appendChild(Vn(e)),o.appendChild(Hn(e)),o.appendChild(Bn(e)),o.appendChild(Yn(e)),o},Un=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portalArea),o.appendChild(Kn(e)),o},Xn=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},qn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.body),o.appendChild(Xn(e)),o.appendChild(Un(e)),o},Zn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.applyButton),n.setAttribute("role","button"),n.innerText=o.config.applyButtonLabel,n.addEventListener("click",r),n},Jn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.cancelButton),n.setAttribute("role","button"),n.innerText=o.config.cancelButtonLabel,n.addEventListener("click",r),n},Qn=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.footer),i.appendChild(Jn(e,o)),i.appendChild(Zn(e,r)),i},ea=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.header),o},ta=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.container),i.appendChild(ea(e)),i.appendChild(qn(e)),i.appendChild(Qn(e,r,o)),i},ra=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");K(i,(l=n.css)==null?void 0:l.root),i.appendChild(ta(e,r,o)),document.body.appendChild(i)},oa=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ie=new Map,ia={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},pe=(e,r)=>{if(Ie.has(e))return Ie.get(e);if(!r)return null;const o=r[ia[e]],n=document.querySelector(`.${o[0]}`);return Ie.set(e,n),n},na=()=>{Ie.clear()},aa=()=>{Ie.clear()},la=(e,r)=>{const o=pe("header",r.css);o&&(o.innerText=e)},da=(e,r)=>{const o=pe("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const n=pe("portalArea",r.css);n&&(n.style.height=`${r.frame.height}px`,n.style.width=`${r.frame.width}px`,n.style.left=`${r.frame.left}px`,n.style.top=`${r.frame.top}px`);const i=pe("portal",r.css);i&&(i.style.width=`${r.portal.size}px`,i.style.height=`${r.portal.size}px`,i.style.left=`${r.portal.left}px`,i.style.top=`${r.portal.top}px`);const l=pe("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},ca=(e,r)=>{const o=pe("portal",r.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 n=pe("previewImage",r.css);n&&(n.style.marginLeft=`-${e.left}px`,n.style.marginTop=`-${e.top}px`)},st=1,sa=e=>{var w,O;const r=e(),o=document.createElement("canvas"),n=r.frame.width||st,i=r.frame.height||st,l=r.sourceWidth/n,c=r.sourceHeight/i,d=r.portal.left*l,p=r.portal.top*c,b=Math.max(r.portal.size*Math.min(l,c),st),h=r.config.outputSize>0?r.config.outputSize:b;o.width=h,o.height=h;const f=document.querySelector(`.${(w=r.css)==null?void 0:w.sourceImage[0]}`);f&&((O=o.getContext("2d"))==null||O.drawImage(f,d,p,b,b,0,0,h,h));const S=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((x,C)=>{try{o.toBlob($=>{if(o.remove(),!$){C(new Error(`Failed to create blob for type: image/${r.config.type}`));return}x([S,$])},`image/${r.config.type}`,r.config.compression)}catch($){o.remove(),C($)}})},pa=(e,r,o)=>{const{emitted:n,portal:i,frame:l,config:c}=r();let d=n.left-n.X+e.clientX,p=n.top-n.Y+e.clientY;const b=c.framePadding,h=l.width-c.framePadding-i.size,f=c.framePadding,S=l.height-c.framePadding-i.size;d<b&&(d=b),d>h&&(d=h),p<f&&(p=f),p>S&&(p=S),o({portal:{...i,left:d,top:p}})},ua=(e,r,o)=>{const{action:n,emitted:i,portal:l,frame:c,config:d}=r(),p=e.pageX-i.X,b=e.pageY-i.Y;switch(n){case te.RESIZE_BR:{let h=i.size+Math.max(p,b);return h<d.minPortalSize&&(h=d.minPortalSize),i.top+h>c.height-d.framePadding&&(h=c.height-i.top-d.framePadding),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding),o({portal:{...l,size:h}})}case te.RESIZE_TR:{let h=p+b>0?i.size+p:i.size-b,f=p+b>0?i.top-p:i.top+b;return h<d.minPortalSize&&(f=i.top+i.size-d.minPortalSize,h=d.minPortalSize),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding,f=i.top-c.width+i.left+i.size),f<d.framePadding&&(h=i.top+i.size,f=d.framePadding),o({portal:{...l,top:f,size:h}})}case te.RESIZE_TL:{const h=Math.min(p,b);let f=i.size-h,S=i.left+h,w=i.top+h;if(f<d.minPortalSize){const O=i.size-d.minPortalSize;f=d.minPortalSize,S=i.left+O,w=i.top+O}if(w<d.framePadding){const O=d.framePadding-w;w=d.framePadding,S=S+O,f=f-O}if(S<d.framePadding){const O=d.framePadding-S;S=d.framePadding,w=w+O,f=f-O}return o({portal:{...l,top:w,left:S,size:f}})}case te.RESIZE_BL:{let h=p+b>0?i.size+b:i.size-p,f=p+b>0?i.left-b:i.left+p;return h<d.minPortalSize&&(f=i.left+i.size-d.minPortalSize,h=d.minPortalSize),h+i.top>c.height-d.framePadding&&(f=i.left-c.height+i.top+i.size,h=c.height-i.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,h=i.left+i.size-d.framePadding),o({portal:{...l,left:f,size:h}})}default:return}},qt=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 r=e;return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}},ha=(e,r)=>{var S,w,O;const o=e(),n=document.querySelector(`.${(S=o.css)==null?void 0:S.portal[0]}`),i=document.querySelector(`.${(w=o.css)==null?void 0:w.portalArea[0]}`),l=document.querySelector(`.${(O=o.css)==null?void 0:O.root[0]}`);let c=null,d=null;const p=x=>{x.preventDefault();const{portal:C}=e(),$=qt(x);if(x.target){const y=x.target.getAttribute("data-action"),g={X:$.pageX,Y:$.pageY,left:C.left,top:C.top,size:C.size};r({action:y,emitted:g})}},b=()=>{const{action:x}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,x&&r({action:null})},h=()=>{if(c=null,!d)return;const x=d;d=null;const{action:C}=e();if(C)switch(C){case te.MOVE:pa(x,e,r);break;default:ua(x,e,r)}},f=x=>{const{action:C}=e();C&&(x.preventDefault(),d=qt(x),c===null&&(c=requestAnimationFrame(h)))};return l&&(l.addEventListener("mouseup",b),l.addEventListener("touchend",b),l.addEventListener("touchcancel",b)),n&&(n.addEventListener("mousedown",p),n.addEventListener("touchstart",p,{passive:!1})),i&&(i.addEventListener("mousemove",f),i.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",b),l.removeEventListener("touchend",b),l.removeEventListener("touchcancel",b)),n&&(n.removeEventListener("mousedown",p),n.removeEventListener("touchstart",p)),i&&(i.removeEventListener("mousemove",f),i.removeEventListener("touchmove",f))}},Zt=1024*1024,ba=(e,r)=>{if(!r.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${r.allowedTypes.join(", ")}`;if(r.maxFileSize>0&&e.size>r.maxFileSize){const o=(r.maxFileSize/Zt).toFixed(2);return`File size (${(e.size/Zt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ga=(e,r,o,n,i,l,c)=>{const d=$=>{c?c($):console.error(`HqCropper: ${$}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:b}=r(),h=ba(p,b);if(h){d(h),e.target.value="";return}const f=new FileReader;let S=null;const w=()=>{var g;const $=r(),y=document.querySelector(`.${(g=$.css)==null?void 0:g.root[0]}`);y&&(y.remove(),document.removeEventListener("keydown",O),S==null||S(),aa(),l(),o(wt))},O=$=>{$.key==="Escape"&&r().sourceBase64&&x($)},x=$=>{$.preventDefault(),w()},C=$=>{$.preventDefault();const y=r();sa(r).then(([g,L])=>{n(g,L,y),x($)}).catch(g=>{d(g instanceof Error?g.message:"Failed to crop image")})};f.onload=$=>{const y=new Image;if(!$.target||typeof $.target.result!="string"){d("Can't load result image");return}y.src=$.target.result,y.onerror=()=>{d("Failed to load image")},y.onload=()=>{var N;ra(r,C,x),na(),i("fileName",la),i("sourceBase64",da),i("portal",ca);const g=Dn(r,y),L=Mn(r,g);o({frame:g,portal:L,fileName:p.name,sourceBase64:(N=$.target)==null?void 0:N.result,sourceHeight:y.height,sourceWidth:y.width}),S=ha(r,o),document.addEventListener("keydown",O)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},fa=(e,r,o,n)=>{const{getState:i,setState:l,subscribe:c,unsubscribeAll:d}=An(r,o),p=oa(b=>ga(b,i,l,e,c,d,n));return{open:()=>p.click()}},ae={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Jt="vacano-image-cropper-styles",xa=`
|
|
1125
1125
|
.vacano-cropper-root {
|
|
1126
1126
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1127
1127
|
backdrop-filter: blur(4px);
|
|
@@ -1169,14 +1169,14 @@
|
|
|
1169
1169
|
.vacano-cropper-apply-button:hover {
|
|
1170
1170
|
background-color: ${t.COLORS["iron-grey"]};
|
|
1171
1171
|
}
|
|
1172
|
-
`,Oa=()=>{if(typeof document>"u"||document.getElementById(Jt))return;const e=document.createElement("style");e.id=Jt,e.textContent=xa,document.head.appendChild(e)}
|
|
1172
|
+
`,Oa=()=>{if(typeof document>"u"||document.getElementById(Jt))return;const e=document.createElement("style");e.id=Jt,e.textContent=xa,document.head.appendChild(e)},Sa={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"]},Er=(e={})=>{const{allowedTypes:r=ae.allowedTypes,applyLabel:o=ae.applyLabel,cancelLabel:n=ae.cancelLabel,compression:i=ae.compression,maxFileSize:l=ae.maxFileSize,onCrop:c,onError:d,outputSize:p=ae.outputSize,portalSize:b=ae.portalSize,type:h=ae.type}=e,f=u.useRef(null);return{open:u.useCallback(()=>{f.current||(Oa(),f.current=fa((w,O,x)=>{O&&(c==null||c({base64:w,blob:O,state:x}))},{portalSize:b,outputSize:p,compression:i,type:h,maxFileSize:l,allowedTypes:r,applyButtonLabel:o,cancelButtonLabel:n},Sa,w=>{d==null||d({code:"CROPPER_ERROR",message:w})})),f.current.open()},[r,o,n,i,l,c,d,p,b,h])}},pt=T.newClassNameGetter("image-cropper"),$a=({allowedTypes:e,applyLabel:r,buttonLabel:o="Select Image",cancelLabel:n,className:i,classnames:l,compression:c,maxFileSize:d,onCrop:p,onError:b,outputSize:h,portalSize:f,previewSize:S=120,ref:w,type:O,value:x,...C})=>{const[$,y]=u.useState(x??null),{open:g}=Er({allowedTypes:e,applyLabel:r,cancelLabel:n,compression:c,maxFileSize:d,onCrop:L=>{y(L.base64),p==null||p(L)},onError:b,outputSize:h,portalSize:f,type:O});return a.jsxs(bn,{...C,ref:w,className:pt("container",i),children:[a.jsx(gn,{$size:S,className:pt("preview",l==null?void 0:l.preview),children:$?a.jsx("img",{src:$,alt:"Preview"}):a.jsx(fn,{children:"No image"})}),a.jsx(De,{variant:"system",onClick:g,className:pt("button",l==null?void 0:l.button),style:{width:S},children:o})]})},Qt={compact:{height:"32px",padding:"0 10px",radius:"14px",prefixSize:"16px"},default:{height:"40px",padding:"0 14px",radius:"16px",prefixSize:"20px"}},er={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},le=e=>er[e]??er.normal,ut=e=>Qt[e]??Qt.default,ya=s.div`
|
|
1173
1173
|
display: grid;
|
|
1174
1174
|
flex-direction: column;
|
|
1175
1175
|
gap: 2px;
|
|
1176
1176
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1177
1177
|
`,Ca=s(ie)`
|
|
1178
1178
|
margin-left: 6px;
|
|
1179
|
-
`,
|
|
1179
|
+
`,ma=s.input`
|
|
1180
1180
|
flex: 1;
|
|
1181
1181
|
min-width: 0;
|
|
1182
1182
|
outline: none;
|
|
@@ -1204,7 +1204,7 @@
|
|
|
1204
1204
|
color: ${e=>le(e.$variant).placeholder.disabled};
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
|
-
`,ht=
|
|
1207
|
+
`,ht=T.newClassNameGetter("input"),Pr=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,size:c="default",variant:d="normal",...p})=>a.jsxs(ya,{className:ht("container",e),$fullWidth:!!n,children:[a.jsx(Ca,{variant:d,className:ht("label",r==null?void 0:r.label),children:i}),a.jsx(ma,{...p,ref:l,disabled:o,$size:c,$variant:d,className:ht("input",r==null?void 0:r.input)})]}),wa=s.div`
|
|
1208
1208
|
position: fixed;
|
|
1209
1209
|
inset: 0;
|
|
1210
1210
|
z-index: 1000;
|
|
@@ -1213,7 +1213,7 @@
|
|
|
1213
1213
|
justify-content: center;
|
|
1214
1214
|
background-color: ${t.alpha(t.COLORS.black,50)};
|
|
1215
1215
|
animation: ${t.KEYFRAMES.fadeIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1216
|
-
`,
|
|
1216
|
+
`,va=s.div`
|
|
1217
1217
|
position: relative;
|
|
1218
1218
|
z-index: 1001;
|
|
1219
1219
|
width: ${e=>e.$width};
|
|
@@ -1224,7 +1224,7 @@
|
|
|
1224
1224
|
border-radius: 16px;
|
|
1225
1225
|
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1226
1226
|
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1227
|
-
`,tr=
|
|
1227
|
+
`,tr=T.newClassNameGetter("modal"),jr=({animated:e,children:r,className:o,classnames:n,open:i,ref:l,width:c="500px",...d})=>i?ge.createPortal(a.jsx(wa,{className:tr("overlay",n==null?void 0:n.overlay),$animated:!!e,children:a.jsx(va,{...d,ref:l,className:tr("content",o,n==null?void 0:n.content),$animated:!!e,$width:c,children:r})}),document.body):null,zr={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},Ra=s.div`
|
|
1228
1228
|
display: flex;
|
|
1229
1229
|
flex-direction: column;
|
|
1230
1230
|
gap: 4px;
|
|
@@ -1266,14 +1266,14 @@
|
|
|
1266
1266
|
font-size: 18px;
|
|
1267
1267
|
font-weight: 600;
|
|
1268
1268
|
color: ${t.COLORS.black};
|
|
1269
|
-
`,
|
|
1269
|
+
`,Na=s.div`
|
|
1270
1270
|
display: flex;
|
|
1271
1271
|
flex-direction: column;
|
|
1272
1272
|
gap: 4px;
|
|
1273
1273
|
min-height: 200px;
|
|
1274
1274
|
max-height: 300px;
|
|
1275
1275
|
overflow-y: auto;
|
|
1276
|
-
`,
|
|
1276
|
+
`,Ta=s.label`
|
|
1277
1277
|
display: flex;
|
|
1278
1278
|
align-items: center;
|
|
1279
1279
|
gap: 10px;
|
|
@@ -1297,7 +1297,7 @@
|
|
|
1297
1297
|
color: ${t.COLORS["iron-grey"]};
|
|
1298
1298
|
font-size: 14px;
|
|
1299
1299
|
text-align: center;
|
|
1300
|
-
`,Q=
|
|
1300
|
+
`,Q=T.newClassNameGetter("multi-select"),Da=({className:e,classnames:r,disabled:o=!1,emptyMessage:n="No options found",label:i,maxVisible:l=1/0,modalTitle:c="Select options",onChange:d,options:p,placeholder:b="Select...",ref:h,searchPlaceholder:f="Search...",value:S,variant:w="normal",...O})=>{const[x,C]=u.useState(!1),[$,y]=u.useState(""),g=u.useMemo(()=>p.filter(E=>S.includes(E.value)),[p,S]),L=u.useMemo(()=>{if(!$.trim())return p;const E=$.toLowerCase().trim();return p.filter(A=>A.label.toLowerCase().includes(E))},[p,$]),N=l===1/0?g:g.slice(0,l),j=g.length-N.length,Y=()=>{o||(C(!0),y(""))},P=()=>{C(!1),y("")},_=E=>{S.includes(E)?d(S.filter(A=>A!==E)):d([...S,E])},M=E=>{d(S.filter(A=>A!==E))};return a.jsxs(Ra,{...O,ref:h,className:Q("container",e),children:[i&&a.jsx(ka,{$variant:w,className:Q("label",r==null?void 0:r.trigger),children:i}),a.jsx(La,{type:"button",$variant:w,$disabled:o,disabled:o,onClick:Y,className:Q("trigger",r==null?void 0:r.trigger),children:g.length===0?a.jsx(Ea,{className:Q("placeholder",r==null?void 0:r.placeholder),children:b}):a.jsxs(a.Fragment,{children:[N.map(E=>a.jsx(Je,{deletable:!0,onDelete:()=>M(E.value),onClick:A=>A.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:E.label},E.value)),j>0&&a.jsxs(Je,{variant:"gray",onClick:E=>E.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:["+",j]})]})}),a.jsx(jr,{open:x,width:"400px",animated:!0,className:Q("modal",r==null?void 0:r.modal),children:a.jsxs(Pa,{children:[a.jsxs(ja,{children:[a.jsx(za,{children:c}),a.jsx(De,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:P})]}),a.jsx(Pr,{type:"text",value:$,onChange:E=>y(E.target.value),placeholder:f,autoFocus:!0,fullWidth:!0,className:Q("search",r==null?void 0:r.search)}),a.jsx(Na,{className:Q("options",r==null?void 0:r.options),children:L.length===0?a.jsx(Aa,{className:Q("empty",r==null?void 0:r.empty),children:n}):L.map(E=>a.jsxs(Ta,{$disabled:!!E.disabled,className:Q("option",r==null?void 0:r.option),children:[a.jsx(et,{checked:S.includes(E.value),disabled:E.disabled,onChange:()=>_(E.value)}),a.jsx(Ia,{children:E.label})]},E.value))})]})})]})},_a=5e3,rr={default:{background:"#374151",text:t.COLORS.white},success:{background:t.COLORS.green,text:t.COLORS.white},warning:{background:t.COLORS.yellow,text:t.COLORS.white},danger:{background:t.COLORS.red,text:t.COLORS.white},info:{background:t.COLORS["steel-blue"],text:t.COLORS.white}},Nr=u.createContext(null),or=e=>rr[e]??rr.default,Ma=s.div`
|
|
1301
1301
|
position: fixed;
|
|
1302
1302
|
top: 0;
|
|
1303
1303
|
left: 0;
|
|
@@ -1344,41 +1344,41 @@
|
|
|
1344
1344
|
}
|
|
1345
1345
|
`,Va=s.div`
|
|
1346
1346
|
position: relative;
|
|
1347
|
-
`,Ha=({notification:e,onRemove:r,onAnimationEnd:o})=>{const[n,i]=u.useState(!1),l=()=>{i(!0)},c=()=>{n&&(r(),o())};return u.useEffect(()=>{const d=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(d)},[e.duration,e.id]),a.jsx(Va,{children:a.jsxs(Fa,{$variant:e.variant,$isExiting:n,onAnimationEnd:c,children:[a.jsx(Ba,{children:e.message}),a.jsx(Ya,{onClick:l,children:a.jsx(a.X,{style:{width:18,height:18}})})]})})},Ga=(e,r)=>{switch(r.type){case"ADD_NOTIFICATION":{const o=r.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}},Wa={current:null,queue:[]},
|
|
1347
|
+
`,Ha=({notification:e,onRemove:r,onAnimationEnd:o})=>{const[n,i]=u.useState(!1),l=()=>{i(!0)},c=()=>{n&&(r(),o())};return u.useEffect(()=>{const d=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(d)},[e.duration,e.id]),a.jsx(Va,{children:a.jsxs(Fa,{$variant:e.variant,$isExiting:n,onAnimationEnd:c,children:[a.jsx(Ba,{children:e.message}),a.jsx(Ya,{onClick:l,children:a.jsx(a.X,{style:{width:18,height:18}})})]})})},Ga=(e,r)=>{switch(r.type){case"ADD_NOTIFICATION":{const o=r.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}},Wa={current:null,queue:[]},Ka=({children:e})=>{const[r,o]=u.useReducer(Ga,Wa),n=u.useCallback((d,p="default",b=_a)=>{const h=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_NOTIFICATION",payload:{id:h,message:d,variant:p,duration:b}})},[]),i=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),l=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),c=u.useCallback(()=>{setTimeout(()=>{o({type:"SHOW_NEXT"})},100)},[]);return a.jsxs(Nr.Provider,{value:{show:n,hide:i},children:[e,a.jsx(Ma,{children:r.current&&a.jsx(Ha,{notification:r.current,onRemove:l,onAnimationEnd:c},r.current.id)})]})},Ua=()=>{const e=u.useContext(Nr);if(!e)throw new Error("useNotification must be used within NotificationProvider");return e},ir={compact:{width:"36px",height:"40px",fontSize:"16px",radius:"10px",gap:"8px"},default:{width:"44px",height:"52px",fontSize:"20px",radius:"12px",gap:"10px"}},nr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},Te=e=>ir[e]??ir.default,Se=e=>nr[e]??nr.normal,Xa=s.div`
|
|
1348
1348
|
display: inline-flex;
|
|
1349
1349
|
flex-direction: column;
|
|
1350
1350
|
gap: 2px;
|
|
1351
|
-
`,
|
|
1351
|
+
`,qa=s(ie)`
|
|
1352
1352
|
margin-left: 6px;
|
|
1353
1353
|
`,Za=s.div`
|
|
1354
1354
|
display: flex;
|
|
1355
|
-
gap: ${e=>
|
|
1355
|
+
gap: ${e=>Te(e.$size).gap};
|
|
1356
1356
|
`,Ja=s.input`
|
|
1357
|
-
width: ${e=>
|
|
1358
|
-
height: ${e=>
|
|
1359
|
-
border-radius: ${e=>
|
|
1360
|
-
font-size: ${e=>
|
|
1357
|
+
width: ${e=>Te(e.$size).width};
|
|
1358
|
+
height: ${e=>Te(e.$size).height};
|
|
1359
|
+
border-radius: ${e=>Te(e.$size).radius};
|
|
1360
|
+
font-size: ${e=>Te(e.$size).fontSize};
|
|
1361
1361
|
font-weight: 600;
|
|
1362
1362
|
text-align: center;
|
|
1363
1363
|
outline: none;
|
|
1364
|
-
border: 1px solid ${e
|
|
1365
|
-
background-color: ${e
|
|
1366
|
-
color: ${e
|
|
1364
|
+
border: 1px solid ${e=>Se(e.$variant).border.static};
|
|
1365
|
+
background-color: ${e=>Se(e.$variant).background.static};
|
|
1366
|
+
color: ${e=>Se(e.$variant).color.static};
|
|
1367
1367
|
transition:
|
|
1368
1368
|
border-color 0.15s ease,
|
|
1369
1369
|
box-shadow 0.15s ease;
|
|
1370
1370
|
|
|
1371
1371
|
&:disabled {
|
|
1372
1372
|
cursor: not-allowed;
|
|
1373
|
-
color: ${e
|
|
1374
|
-
background-color: ${e
|
|
1375
|
-
border-color: ${e
|
|
1373
|
+
color: ${e=>Se(e.$variant).color.disabled};
|
|
1374
|
+
background-color: ${e=>Se(e.$variant).background.disabled};
|
|
1375
|
+
border-color: ${e=>Se(e.$variant).border.disabled};
|
|
1376
1376
|
}
|
|
1377
1377
|
|
|
1378
1378
|
&::selection {
|
|
1379
1379
|
background-color: transparent;
|
|
1380
1380
|
}
|
|
1381
|
-
`,bt=
|
|
1381
|
+
`,bt=T.newClassNameGetter("otp-code"),Qa=({autoFocus:e,className:r,classnames:o,disabled:n,label:i,length:l=6,onChange:c,ref:d,size:p="default",value:b="",variant:h="normal",...f})=>{const S=u.useRef([]);u.useEffect(()=>{e&&S.current[0]&&S.current[0].focus()},[e]);const w=u.useCallback($=>{const y=S.current[$];y&&(y.focus(),y.select())},[]),O=u.useCallback(($,y)=>{const L=y.target.value.replace(/\D/g,"").slice(-1);if(!L)return;const N=b.padEnd(l," ").split(""),j=N.findIndex(M=>M===" "||M===""),Y=j!==-1?j:$;N[Y]=L;const P=N.join("").replace(/ /g,"");c==null||c(P);const _=Y+1;_<l&&w(_)},[b,l,c,w]),x=u.useCallback(($,y)=>{if(y.key==="Backspace"){y.preventDefault();const g=b.split("");g[$]?(g[$]="",c==null||c(g.join(""))):$>0&&(g[$-1]="",c==null||c(g.join("")),w($-1))}else y.key==="ArrowLeft"&&$>0?(y.preventDefault(),w($-1)):y.key==="ArrowRight"&&$<l-1&&(y.preventDefault(),w($+1))},[b,l,c,w]),C=u.useCallback($=>{$.preventDefault();const y=$.clipboardData.getData("text").replace(/\D/g,"").slice(0,l);if(y){c==null||c(y);const g=Math.min(y.length,l-1);w(g)}},[l,c,w]);return a.jsxs(Xa,{ref:d,className:bt("container",r),...f,children:[i&&a.jsx(qa,{variant:h,className:bt("label",o==null?void 0:o.label),children:i}),a.jsx(Za,{$size:p,children:Array.from({length:l}).map(($,y)=>a.jsx(Ja,{ref:g=>{S.current[y]=g},type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:2,disabled:n,value:b[y]??"",onChange:g=>O(y,g),onKeyDown:g=>x(y,g),onPaste:C,onFocus:g=>g.target.select(),$size:p,$variant:h,className:bt("input",o==null?void 0:o.input)},y))})]})},ar={light:{background:t.COLORS.white,border:t.alpha(t.COLORS.black,30),title:t.COLORS.black,description:t.COLORS["iron-grey"]},dark:{background:t.alpha(t.COLORS.white,5),border:t.alpha(t.COLORS.white,30),title:t.COLORS.white,description:"#9ca3af"}},Qe=e=>ar[e]??ar.light,el=s.div`
|
|
1382
1382
|
display: flex;
|
|
1383
1383
|
flex-direction: column;
|
|
1384
1384
|
gap: 16px;
|
|
@@ -1403,19 +1403,19 @@
|
|
|
1403
1403
|
display: flex;
|
|
1404
1404
|
flex-wrap: wrap;
|
|
1405
1405
|
gap: 8px;
|
|
1406
|
-
`,
|
|
1406
|
+
`,Ke=T.newClassNameGetter("panel"),nl=({children:e,className:r,classnames:o,description:n,ref:i,title:l,variant:c="light",...d})=>{const p=l||n;return a.jsxs(el,{...d,ref:i,className:Ke("container",r),$variant:c,children:[p&&a.jsxs(tl,{children:[l&&a.jsx(rl,{className:Ke("title",o==null?void 0:o.title),$variant:c,children:l}),n&&a.jsx(ol,{className:Ke("description",o==null?void 0:o.description),$variant:c,children:n})]}),a.jsx(il,{className:Ke("content",o==null?void 0:o.content),children:e})]})},vt={compact:{height:4,radius:2},default:{height:8,radius:4}},al=s.div`
|
|
1407
1407
|
width: 100%;
|
|
1408
|
-
height: ${({$size:e})=>
|
|
1409
|
-
border-radius: ${({$size:e})=>
|
|
1408
|
+
height: ${({$size:e})=>vt[e].height}px;
|
|
1409
|
+
border-radius: ${({$size:e})=>vt[e].radius}px;
|
|
1410
1410
|
background-color: ${t.COLORS.gray};
|
|
1411
1411
|
overflow: hidden;
|
|
1412
1412
|
`,ll=s.div`
|
|
1413
1413
|
height: 100%;
|
|
1414
1414
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1415
|
-
border-radius: ${({$size:e})=>
|
|
1415
|
+
border-radius: ${({$size:e})=>vt[e].radius}px;
|
|
1416
1416
|
background-color: ${t.COLORS.black};
|
|
1417
1417
|
transition: width 0.2s ease;
|
|
1418
|
-
`,lr=
|
|
1418
|
+
`,lr=T.newClassNameGetter("progress"),dl=({value:e,size:r="default",className:o,classnames:n,ref:i,...l})=>a.jsx(al,{...l,ref:i,$size:r,className:lr("track",o,n==null?void 0:n.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(ll,{$size:r,$value:e,className:lr("bar",n==null?void 0:n.bar)})}),dr={normal:{box:{border:t.alpha(t.COLORS["iron-grey"],30),borderChecked:t.COLORS["iron-grey"],background:t.COLORS.white,backgroundChecked:t.COLORS.white,focusShadow:t.alpha(t.COLORS["iron-grey"],30)},dot:t.COLORS.black,label:t.COLORS.black},error:{box:{border:t.COLORS.red,borderChecked:t.COLORS.red,background:t.COLORS.white,backgroundChecked:t.COLORS.white,focusShadow:t.alpha(t.COLORS.red,30)},dot:t.COLORS.red,label:t.COLORS.red}},Ce=e=>dr[e]??dr.normal,cl=s.label`
|
|
1419
1419
|
display: inline-flex;
|
|
1420
1420
|
align-items: flex-start;
|
|
1421
1421
|
gap: 8px;
|
|
@@ -1468,7 +1468,7 @@
|
|
|
1468
1468
|
text-decoration: none;
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
|
-
`,je=
|
|
1471
|
+
`,je=T.newClassNameGetter("radio"),Lt=({checked:e,className:r,classnames:o,disabled:n,label:i,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(cl,{className:je("container",r),$disabled:!!n,$variant:d,children:[a.jsx(sl,{...p,ref:c,type:"radio",className:je("input",o==null?void 0:o.input),checked:e,disabled:n,onChange:l}),a.jsx(pl,{className:je("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(ul,{className:je("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),i&&a.jsx(hl,{className:je("label",o==null?void 0:o.label),$variant:d,children:i})]}),cr={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},he=e=>cr[e]??cr.normal,bl=s.label`
|
|
1472
1472
|
display: grid;
|
|
1473
1473
|
grid-template-columns: auto 1fr;
|
|
1474
1474
|
align-items: start;
|
|
@@ -1525,7 +1525,7 @@
|
|
|
1525
1525
|
label[data-disabled='true'] & {
|
|
1526
1526
|
color: ${e=>he(e.$variant).description.disabled};
|
|
1527
1527
|
}
|
|
1528
|
-
`,
|
|
1528
|
+
`,Ue=T.newClassNameGetter("radio-card"),Sl=({checked:e,className:r,classnames:o,description:n,disabled:i,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:b="normal",...h})=>a.jsxs(bl,{className:Ue("container",r),$checked:e,$disabled:!!i,$fullWidth:l,$variant:b,"data-disabled":i,children:[a.jsx(gl,{...h,ref:p,type:"radio",checked:e,disabled:i,onChange:d}),a.jsx(Lt,{className:o==null?void 0:o.radio,checked:e,disabled:i,variant:b,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(fl,{className:Ue("content",o==null?void 0:o.content),children:[a.jsx(xl,{className:Ue("label",o==null?void 0:o.label),$variant:b,children:c}),n&&a.jsx(Ol,{className:Ue("description",o==null?void 0:o.description),$variant:b,children:n})]})]}),sr={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},$l=s.div`
|
|
1529
1529
|
display: flex;
|
|
1530
1530
|
flex-direction: column;
|
|
1531
1531
|
gap: 8px;
|
|
@@ -1539,7 +1539,7 @@
|
|
|
1539
1539
|
display: flex;
|
|
1540
1540
|
flex-direction: column;
|
|
1541
1541
|
gap: 12px;
|
|
1542
|
-
`,gt=
|
|
1542
|
+
`,gt=T.newClassNameGetter("radio-group"),ml=({className:e,classnames:r,disabled:o,label:n,name:i,onChange:l,options:c,ref:d,value:p,...b})=>a.jsxs($l,{...b,ref:d,className:gt("container",e),children:[n&&a.jsx(yl,{className:gt("label",r==null?void 0:r.label),$disabled:o,children:n}),a.jsx(Cl,{className:gt("options",r==null?void 0:r.options),children:c.map(h=>a.jsx(Lt,{className:r==null?void 0:r.radio,name:i,checked:p===h.value,label:h.label,disabled:o,onChange:()=>l(h.value)},h.value))})]}),Tr=u.createContext(null),wl=s.div`
|
|
1543
1543
|
position: fixed;
|
|
1544
1544
|
bottom: 24px;
|
|
1545
1545
|
right: 24px;
|
|
@@ -1554,11 +1554,11 @@
|
|
|
1554
1554
|
animation: ${t.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1555
1555
|
pointer-events: none;
|
|
1556
1556
|
color: ${t.COLORS.black};
|
|
1557
|
-
`,
|
|
1557
|
+
`,vl=s.span`
|
|
1558
1558
|
font-size: 14px;
|
|
1559
1559
|
font-weight: 500;
|
|
1560
1560
|
white-space: nowrap;
|
|
1561
|
-
`,Rl=({children:e,defaultMessage:r="Saving"})=>{const[o,n]=u.useState(!1),[i,l]=u.useState(r),c=u.useCallback(b=>{l(b??r),n(!0)},[r]),d=u.useCallback(()=>{n(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:d}),[o,c,d]);return a.jsxs(
|
|
1561
|
+
`,Rl=({children:e,defaultMessage:r="Saving"})=>{const[o,n]=u.useState(!1),[i,l]=u.useState(r),c=u.useCallback(b=>{l(b??r),n(!0)},[r]),d=u.useCallback(()=>{n(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:d}),[o,c,d]);return a.jsxs(Tr.Provider,{value:p,children:[e,o&&a.jsxs(wl,{children:[a.jsx(kt,{size:"sm"}),a.jsx(vl,{children:i})]})]})},kl=()=>{const e=u.useContext(Tr);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},ft=40,ze=4,pr={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},ur={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:t.alpha(t.COLORS.black,40),focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:t.alpha(t.COLORS.red,40),focus:t.alpha(t.COLORS.red,30)}},xt=e=>pr[e]??pr.default,se=e=>ur[e]??ur.normal,Ll=s.div`
|
|
1562
1562
|
position: relative;
|
|
1563
1563
|
display: grid;
|
|
1564
1564
|
gap: 2px;
|
|
@@ -1605,12 +1605,12 @@
|
|
|
1605
1605
|
border-radius: 16px;
|
|
1606
1606
|
box-shadow: 0 4px 20px ${t.alpha(t.COLORS.black,15)};
|
|
1607
1607
|
z-index: 1000;
|
|
1608
|
-
`,
|
|
1608
|
+
`,Nl=s.div`
|
|
1609
1609
|
position: absolute;
|
|
1610
1610
|
left: -4px;
|
|
1611
1611
|
width: calc(100% + 8px);
|
|
1612
1612
|
${Ir}
|
|
1613
|
-
`,
|
|
1613
|
+
`,Tl=s.div`
|
|
1614
1614
|
position: fixed;
|
|
1615
1615
|
${Ir}
|
|
1616
1616
|
`,Il=s.button`
|
|
@@ -1640,7 +1640,7 @@
|
|
|
1640
1640
|
justify-content: center;
|
|
1641
1641
|
flex-shrink: 0;
|
|
1642
1642
|
color: ${t.COLORS.black};
|
|
1643
|
-
|
|
1643
|
+
`,$e=T.newClassNameGetter("select"),Dl=({className:e,classnames:r,disabled:o=!1,fullWidth:n=!1,label:i,onChange:l,options:c,placeholder:d="Select...",portalRenderNode:p,ref:b,size:h="default",value:f,variant:S="normal",...w})=>{const[O,x]=u.useState(!1),[C,$]=u.useState({top:0,left:0,width:0}),y=u.useRef(null),g=u.useRef(null),L=u.useRef(null),N=c.find(m=>m.value===f),j=Math.max(0,c.findIndex(m=>m.value===f)),Y=-(j*ft+ze),P=()=>{if(!g.current||!p)return;const m=g.current.getBoundingClientRect(),I=j*ft+ze;let R=m.top-I;const z=c.length*ft+ze*2,B=8,F=window.innerHeight-z-8;R<B&&(R=B),R>F&&(R=F),$({top:R,left:m.left-ze,width:m.width+ze*2})},_=m=>{var I;l==null||l(m),x(!1),(I=g.current)==null||I.focus()},M=m=>{o||(m.key==="Enter"||m.key===" "?(m.preventDefault(),x(I=>!I)):m.key==="Escape"&&O?(m.preventDefault(),x(!1)):m.key==="ArrowDown"&&!O&&(m.preventDefault(),x(!0)))};u.useLayoutEffect(()=>{O&&p&&P()},[O,p,j,c.length]),u.useEffect(()=>{if(!O)return;const m=z=>{const B=z.target,F=y.current&&!y.current.contains(B),H=L.current&&!L.current.contains(B);p?F&&H&&x(!1):F&&x(!1)},I=()=>{p&&P()},R=()=>{p&&P()};return document.addEventListener("mousedown",m),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",R)),()=>{document.removeEventListener("mousedown",m),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",R)}},[O,p]);const E=()=>c.map(m=>a.jsxs(Il,{type:"button",role:"option",$selected:m.value===f,$disabled:m.disabled??!1,disabled:m.disabled,"aria-selected":m.value===f,onClick:()=>_(m.value),className:$e("option",r==null?void 0:r.option),children:[a.jsx("span",{children:m.label}),m.value===f&&a.jsx(Al,{children:a.jsx(a.Check,{size:16})})]},m.value)),A=p?ge.createPortal(a.jsx(Tl,{ref:L,role:"listbox",style:{top:C.top,left:C.left,width:C.width},className:$e("dropdown",r==null?void 0:r.dropdown),children:E()}),p):a.jsx(Nl,{ref:L,role:"listbox",style:{top:Y},className:$e("dropdown",r==null?void 0:r.dropdown),children:E()});return a.jsxs(Ll,{...w,ref:m=>{y.current=m,typeof b=="function"?b(m):b&&(b.current=m)},$fullWidth:n,className:$e("container",e),children:[i&&a.jsx(El,{className:$e("label",r==null?void 0:r.label),children:i}),a.jsxs(Pl,{ref:g,type:"button",$size:h,$variant:S,$disabled:o,$hasValue:!!N,disabled:o,onClick:()=>!o&&x(m=>!m),onKeyDown:M,"aria-haspopup":"listbox","aria-expanded":O,className:$e("trigger",r==null?void 0:r.trigger),children:[a.jsx(jl,{children:(N==null?void 0:N.label)??d}),a.jsx(zl,{$open:O,children:a.jsx(a.ChevronDown,{size:16})})]}),O&&A]})},hr={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},_l=e=>hr[e]??hr.neutral,Ml=s.div`
|
|
1644
1644
|
display: flex;
|
|
1645
1645
|
flex-direction: column;
|
|
1646
1646
|
gap: 4px;
|
|
@@ -1682,11 +1682,11 @@
|
|
|
1682
1682
|
margin: 0;
|
|
1683
1683
|
font-size: 12px;
|
|
1684
1684
|
color: ${({$variant:e})=>_l(e)};
|
|
1685
|
-
`,
|
|
1685
|
+
`,Xe=T.newClassNameGetter("status-card"),Gl=({border:e=!1,className:r,classnames:o,icon:n,label:i,ref:l,shadow:c=!1,trend:d,trendVariant:p="neutral",value:b,...h})=>a.jsxs(Ml,{...h,ref:l,className:Xe("container",r),$border:e,$shadow:c,children:[a.jsxs(Fl,{children:[a.jsx(Bl,{className:Xe("label",o==null?void 0:o.label),children:i}),n&&a.jsx(Yl,{children:n})]}),a.jsx(Vl,{className:Xe("value",o==null?void 0:o.value),children:b}),d&&a.jsx(Hl,{className:Xe("trend",o==null?void 0:o.trend),$variant:p,children:d})]}),Wl=s.div`
|
|
1686
1686
|
display: flex;
|
|
1687
1687
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1688
1688
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1689
|
-
`,
|
|
1689
|
+
`,Kl=s.div`
|
|
1690
1690
|
display: flex;
|
|
1691
1691
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1692
1692
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1695,7 +1695,7 @@
|
|
|
1695
1695
|
&:last-child {
|
|
1696
1696
|
flex: 0;
|
|
1697
1697
|
}
|
|
1698
|
-
`,
|
|
1698
|
+
`,Ul=s.button`
|
|
1699
1699
|
display: flex;
|
|
1700
1700
|
align-items: center;
|
|
1701
1701
|
gap: 10px;
|
|
@@ -1704,7 +1704,7 @@
|
|
|
1704
1704
|
background: transparent;
|
|
1705
1705
|
cursor: ${e=>e.$clickable?"pointer":"default"};
|
|
1706
1706
|
flex-shrink: 0;
|
|
1707
|
-
`,
|
|
1707
|
+
`,Xl=s.div`
|
|
1708
1708
|
display: flex;
|
|
1709
1709
|
align-items: center;
|
|
1710
1710
|
justify-content: center;
|
|
@@ -1728,7 +1728,7 @@
|
|
|
1728
1728
|
border: 2px solid ${t.COLORS.gray};
|
|
1729
1729
|
color: ${t.COLORS["iron-grey"]};
|
|
1730
1730
|
`}
|
|
1731
|
-
`,
|
|
1731
|
+
`,ql=s.span`
|
|
1732
1732
|
font-size: 14px;
|
|
1733
1733
|
font-weight: 500;
|
|
1734
1734
|
white-space: nowrap;
|
|
@@ -1748,7 +1748,7 @@
|
|
|
1748
1748
|
min-width: 16px;
|
|
1749
1749
|
margin: 0 12px;
|
|
1750
1750
|
`}
|
|
1751
|
-
`,
|
|
1751
|
+
`,Ne=T.newClassNameGetter("stepper"),Jl=({className:e,classnames:r,onChange:o,orientation:n="horizontal",ref:i,steps:l,value:c,...d})=>{const p=u.useMemo(()=>l.findIndex(b=>b.value===c),[l,c]);return a.jsx(Wl,{...d,ref:i,$orientation:n,className:Ne("container",e),children:l.map((b,h)=>{const f=b.value===c,S=h<p,w=h===l.length-1;return a.jsxs(Kl,{$orientation:n,children:[a.jsxs(Ul,{type:"button",$active:f,$completed:S,$clickable:!!o,onClick:()=>o==null?void 0:o(b.value),className:Ne("step",r==null?void 0:r.step),children:[a.jsx(Xl,{$active:f,$completed:S,className:Ne("circle",r==null?void 0:r.circle),children:h+1}),a.jsx(ql,{$active:f,$completed:S,className:Ne("label",r==null?void 0:r.label),children:b.label})]}),!w&&a.jsx(Zl,{$completed:S,$orientation:n,className:Ne("line",r==null?void 0:r.line)})]},b.value)})})},Rt={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},Ql=s.div`
|
|
1752
1752
|
position: relative;
|
|
1753
1753
|
display: flex;
|
|
1754
1754
|
flex-direction: column;
|
|
@@ -1860,7 +1860,7 @@
|
|
|
1860
1860
|
color: ${t.COLORS["iron-grey"]};
|
|
1861
1861
|
font-size: 14px;
|
|
1862
1862
|
text-align: center;
|
|
1863
|
-
`,ee=
|
|
1863
|
+
`,ee=T.newClassNameGetter("tags"),qe=4,nd=({className:e,classnames:r,createKey:o="Tab",disabled:n=!1,emptyMessage:i="No options",freeSolo:l=!0,label:c,onChange:d,options:p=[],placeholder:b="Add tag...",portalRenderNode:h,ref:f,value:S,variant:w="normal",...O})=>{const x=u.useRef(null),C=u.useRef(null),$=u.useRef(null),y=u.useRef(null),[g,L]=u.useState(""),[N,j]=u.useState(!1),[Y,P]=u.useState("bottom"),[_,M]=u.useState({top:0,left:0,width:0}),E=u.useMemo(()=>{const k=p.filter(U=>!S.includes(U.value));if(!g.trim())return k;const D=g.toLowerCase().trim();return k.filter(U=>U.label.toLowerCase().includes(D))},[p,S,g]),A=N&&p.length>0,m=u.useCallback(()=>{var _e;if(!C.current)return;const k=C.current.getBoundingClientRect(),D=((_e=$.current)==null?void 0:_e.offsetHeight)??200,U=window.innerHeight-k.bottom-qe,X=k.top-qe,fe=U<D&&X>U?"top":"bottom";if(P(fe),h){const rt=fe==="bottom"?k.bottom+qe:k.top-D-qe;M({top:rt,left:k.left,width:k.width})}},[h]);u.useEffect(()=>{if(N)return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[N,m]);const I=u.useCallback(k=>{const D=k.trim();return!D||S.includes(D)?!1:(d([...S,D]),L(""),!0)},[S,d]),R=k=>{if(k.key===o&&g.trim())if(k.preventDefault(),l)I(g);else{const D=E.find(U=>U.label.toLowerCase()===g.toLowerCase().trim());D&&I(D.value)}else k.key==="Backspace"&&!g&&S.length>0&&d(S.slice(0,-1))},z=k=>{var D;I(k),(D=y.current)==null||D.focus()},B=k=>{d(S.filter(D=>D!==k))},F=()=>{var k;n||(k=y.current)==null||k.focus()},H=k=>{const D=p.find(U=>U.value===k);return(D==null?void 0:D.label)??k};return a.jsxs(Ql,{...O,ref:f,className:ee("container",e),children:[c&&a.jsx(ed,{$variant:w,className:ee("label"),children:c}),a.jsxs("div",{ref:x,style:{position:"relative"},children:[a.jsxs(td,{ref:C,$variant:w,$disabled:n,$focused:N,onClick:F,className:ee("trigger",r==null?void 0:r.trigger),children:[S.map(k=>a.jsx(Je,{deletable:!n,onDelete:()=>B(k),className:ee("chip",r==null?void 0:r.chip),children:H(k)},k)),a.jsx(rd,{ref:y,type:"text",value:g,onChange:k=>L(k.target.value),onFocus:()=>j(!0),onBlur:()=>setTimeout(()=>j(!1),150),onKeyDown:R,placeholder:S.length===0?b:"",disabled:n,$disabled:n,className:ee("input",r==null?void 0:r.input)})]}),p.length>0&&(h?ge.createPortal(a.jsx(id,{ref:$,$open:A,$position:Y,style:{top:_.top,left:_.left,width:_.width},className:ee("dropdown",r==null?void 0:r.dropdown),children:E.length===0?a.jsx(gr,{className:ee("empty",r==null?void 0:r.empty),children:i}):E.map(k=>a.jsx(br,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>z(k.value),className:ee("option",r==null?void 0:r.option),children:k.label},k.value))}),h):a.jsx(od,{ref:$,$open:A,$position:Y,className:ee("dropdown",r==null?void 0:r.dropdown),children:E.length===0?a.jsx(gr,{className:ee("empty",r==null?void 0:r.empty),children:i}):E.map(k=>a.jsx(br,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>z(k.value),className:ee("option",r==null?void 0:r.option),children:k.label},k.value))}))]})]})},ad=s.div`
|
|
1864
1864
|
display: flex;
|
|
1865
1865
|
align-items: center;
|
|
1866
1866
|
gap: 6px;
|
|
@@ -1882,7 +1882,7 @@
|
|
|
1882
1882
|
&:hover:not(:disabled) {
|
|
1883
1883
|
background-color: ${e=>e.$active?t.COLORS.gray:"rgba(0, 0, 0, 0.05)"};
|
|
1884
1884
|
}
|
|
1885
|
-
`,fr=
|
|
1885
|
+
`,fr=T.newClassNameGetter("tabs"),dd=({className:e,classnames:r,onChange:o,ref:n,tabs:i,value:l,...c})=>a.jsx(ad,{...c,ref:n,className:fr("container",e),role:"tablist",children:i.map(d=>a.jsx(ld,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>o(d.value),className:fr("tab",r==null?void 0:r.tab),children:d.label},d.value))}),xr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},de=e=>xr[e]??xr.normal,cd=s.div`
|
|
1886
1886
|
display: grid;
|
|
1887
1887
|
flex-direction: column;
|
|
1888
1888
|
gap: 2px;
|
|
@@ -1919,7 +1919,7 @@
|
|
|
1919
1919
|
color: ${e=>de(e.$variant).placeholder.disabled};
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
|
-
`,Ot=
|
|
1922
|
+
`,Ot=T.newClassNameGetter("textarea"),ud=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,variant:c="normal",rows:d=4,...p})=>a.jsxs(cd,{className:Ot("container",e),$fullWidth:!!n,children:[i&&a.jsx(sd,{variant:c,className:Ot("label",r==null?void 0:r.label),children:i}),a.jsx(pd,{...p,ref:l,rows:d,disabled:o,$variant:c,className:Ot("textarea",r==null?void 0:r.textarea)})]}),Mr=u.createContext(null),St=3,Or={default:{background:"#374151",text:t.COLORS.white,border:"#374151"},success:{background:t.COLORS.green,text:t.COLORS.white,border:t.COLORS.green},warning:{background:t.COLORS.yellow,text:t.COLORS.white,border:t.COLORS.yellow},danger:{background:t.COLORS.red,text:t.COLORS.white,border:t.COLORS.red}},hd=(e,r)=>{switch(r.type){case"ADD_TOAST":{const o=r.payload;return e.toasts.length<St?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=r.payload,n=e.toasts.filter(l=>l.id!==o),i=e.queue[0];return i&&n.length<St?{toasts:[...n,i],queue:e.queue.slice(1)}:{...e,toasts:n}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=St?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},bd={toasts:[],queue:[]},$t=e=>Or[e]??Or.default,gd=s.div`
|
|
1923
1923
|
position: fixed;
|
|
1924
1924
|
bottom: 24px;
|
|
1925
1925
|
left: 24px;
|
|
@@ -1937,9 +1937,9 @@
|
|
|
1937
1937
|
gap: 12px;
|
|
1938
1938
|
min-height: 32px;
|
|
1939
1939
|
padding: 8px 8px 8px 16px;
|
|
1940
|
-
background-color: ${({$variant:e})
|
|
1941
|
-
color: ${({$variant:e})
|
|
1942
|
-
border: 1px solid ${({$variant:e})
|
|
1940
|
+
background-color: ${({$variant:e})=>$t(e).background};
|
|
1941
|
+
color: ${({$variant:e})=>$t(e).text};
|
|
1942
|
+
border: 1px solid ${({$variant:e})=>$t(e).border};
|
|
1943
1943
|
border-radius: 96px;
|
|
1944
1944
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
1945
1945
|
animation: ${({$isExiting:e})=>e?t.KEYFRAMES.slideOutBottomFade:t.KEYFRAMES.slideInBottomFade}
|
|
@@ -1971,13 +1971,13 @@
|
|
|
1971
1971
|
&:hover {
|
|
1972
1972
|
opacity: 1;
|
|
1973
1973
|
}
|
|
1974
|
-
|
|
1974
|
+
`,Sd=s.div`
|
|
1975
1975
|
display: flex;
|
|
1976
1976
|
align-items: center;
|
|
1977
1977
|
justify-content: space-between;
|
|
1978
1978
|
gap: 12px;
|
|
1979
1979
|
width: 100%;
|
|
1980
|
-
|
|
1980
|
+
`,$d=s.div`
|
|
1981
1981
|
display: flex;
|
|
1982
1982
|
align-items: center;
|
|
1983
1983
|
justify-content: center;
|
|
@@ -1992,7 +1992,7 @@
|
|
|
1992
1992
|
font-weight: 500;
|
|
1993
1993
|
white-space: nowrap;
|
|
1994
1994
|
margin-left: auto;
|
|
1995
|
-
|
|
1995
|
+
`,Sr=({toast:e,onRemove:r})=>{const[o,n]=u.useState(!1),i=()=>{n(!0),setTimeout(()=>{r(e.id)},300)};return u.useEffect(()=>{if(e.duration){const l=setTimeout(()=>{i()},e.duration);return()=>clearTimeout(l)}},[e.duration,e.id]),a.jsxs(fd,{$variant:e.variant,$isExiting:o,children:[a.jsx(xd,{children:e.message}),a.jsx(Od,{onClick:i,children:a.jsx(a.X,{style:{width:16,height:16}})})]})},yd=({toasts:e,queueCount:r,removeToast:o})=>{if(e.length===0)return null;const n=e.length-1;return a.jsx(gd,{children:e.map((i,l)=>l===n&&r>0?a.jsxs(Sd,{children:[a.jsx(Sr,{toast:i,onRemove:o}),a.jsxs($d,{children:["+",r]})]},i.id):a.jsx(Sr,{toast:i,onRemove:o},i.id))})},Cd=({children:e})=>{const[r,o]=u.useReducer(hd,bd),n=u.useCallback((l,c="default",d)=>{const p=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_TOAST",payload:{id:p,message:l,variant:c,duration:d}})},[]),i=u.useCallback(l=>{o({type:"REMOVE_TOAST",payload:l})},[]);return a.jsxs(Mr.Provider,{value:{addToast:n,removeToast:i},children:[e,a.jsx(yd,{toasts:r.toasts,queueCount:r.queue.length,removeToast:i})]})},md=()=>{const e=u.useContext(Mr);if(!e)throw new Error("useToast must be used within ToastProvider");return e},$r={dark:{background:t.COLORS.black,text:t.COLORS.white},light:{background:t.COLORS.white,text:t.COLORS.black,border:t.COLORS.gray},success:{background:t.COLORS.green,text:t.COLORS.white},warning:{background:t.COLORS.yellow,text:t.COLORS.white},danger:{background:t.COLORS.red,text:t.COLORS.white}},Ae=e=>$r[e]??$r.dark,wd=(e,r)=>{const o=Ae(r).background;switch(e){case"top":return`
|
|
1996
1996
|
bottom: -12px;
|
|
1997
1997
|
left: 50%;
|
|
1998
1998
|
margin-left: -6px;
|
|
@@ -2012,7 +2012,7 @@
|
|
|
2012
2012
|
top: 50%;
|
|
2013
2013
|
margin-top: -6px;
|
|
2014
2014
|
border-right-color: ${o};
|
|
2015
|
-
`;default:return""}},
|
|
2015
|
+
`;default:return""}},vd=(e,r)=>{if(r!=="light")return"";const o=Ae(r).border;switch(e){case"top":return`
|
|
2016
2016
|
&::after {
|
|
2017
2017
|
bottom: -14px;
|
|
2018
2018
|
left: 50%;
|
|
@@ -2066,7 +2066,7 @@
|
|
|
2066
2066
|
width: 0;
|
|
2067
2067
|
height: 0;
|
|
2068
2068
|
border: 6px solid transparent;
|
|
2069
|
-
${
|
|
2069
|
+
${wd(e.$placement,e.$variant)}
|
|
2070
2070
|
}
|
|
2071
2071
|
|
|
2072
2072
|
${e.$variant==="light"?`
|
|
@@ -2079,7 +2079,7 @@
|
|
|
2079
2079
|
}
|
|
2080
2080
|
`:""}
|
|
2081
2081
|
|
|
2082
|
-
${
|
|
2082
|
+
${vd(e.$placement,e.$variant)}
|
|
2083
2083
|
`,Rd=s.div`
|
|
2084
2084
|
position: relative;
|
|
2085
2085
|
display: inline-block;
|
|
@@ -2106,5 +2106,5 @@
|
|
|
2106
2106
|
`,Ed=s.div`
|
|
2107
2107
|
position: fixed;
|
|
2108
2108
|
${e=>Fr(e)}
|
|
2109
|
-
`,yt=
|
|
2109
|
+
`,yt=T.newClassNameGetter("tooltip"),ce=8,Pd=({children:e,className:r,classnames:o,content:n,delay:i=200,placement:l="top",portalRenderNode:c,ref:d,variant:p="dark",...b})=>{const[h,f]=u.useState(!1),[S,w]=u.useState(null),[O,x]=u.useState(l),[C,$]=u.useState({top:0,left:0}),y=u.useRef(null),g=u.useRef(null),L=u.useCallback(()=>{var z,B;if(!y.current)return;const P=y.current.getBoundingClientRect(),_=((z=g.current)==null?void 0:z.offsetWidth)??100,M=((B=g.current)==null?void 0:B.offsetHeight)??30,E=P.top-ce,A=window.innerHeight-P.bottom-ce,m=P.left-ce,I=window.innerWidth-P.right-ce;let R=l;if(l==="top"&&E<M&&A>E?R="bottom":l==="bottom"&&A<M&&E>A?R="top":l==="left"&&m<_&&I>m?R="right":l==="right"&&I<_&&m>I&&(R="left"),x(R),c){let F,H;switch(R){case"top":F=P.top-M-ce,H=P.left+P.width/2-_/2;break;case"bottom":F=P.bottom+ce,H=P.left+P.width/2-_/2;break;case"left":F=P.top+P.height/2-M/2,H=P.left-_-ce;break;case"right":F=P.top+P.height/2-M/2,H=P.right+ce;break;default:F=0,H=0}const k=8;H=Math.max(k,Math.min(H,window.innerWidth-_-k)),F=Math.max(k,Math.min(F,window.innerHeight-M-k)),$({top:F,left:H})}},[l,c]);u.useLayoutEffect(()=>{h&&L()},[h,L]);const N=()=>{const P=setTimeout(()=>{f(!0)},i);w(P)},j=()=>{S&&(clearTimeout(S),w(null)),f(!1)},Y=c?ge.createPortal(a.jsx(Ed,{ref:g,className:yt("content",o==null?void 0:o.content),$placement:O,$variant:p,$visible:h,style:{top:C.top,left:C.left},children:n}),c):a.jsx(Ld,{ref:g,className:yt("content",o==null?void 0:o.content),$placement:O,$variant:p,$visible:h,children:n});return a.jsxs(Rd,{...b,ref:P=>{y.current=P,typeof d=="function"?d(P):d&&(d.current=P)},className:yt("wrapper",r),onMouseEnter:N,onMouseLeave:j,children:[e,Y]})};exports.BREAKPOINTS=t.BREAKPOINTS;exports.COLORS=t.COLORS;exports.KEYFRAMES=t.KEYFRAMES;exports.KEY_SYMBOLS=t.KEY_SYMBOLS;exports.alpha=t.alpha;exports.getBrowser=t.getBrowser;exports.getKeySymbols=t.getKeySymbols;exports.getOperatingSystem=t.getOperatingSystem;exports.isValid=t.isValid;exports.mediaBetween=t.mediaBetween;exports.mediaDown=t.mediaDown;exports.mediaUp=t.mediaUp;exports.toHEX=t.toHEX;exports.useKeyBinding=t.useKeyBinding;exports.newClassNameGetter=T.newClassNameGetter;exports.Autocomplete=jo;exports.Button=De;exports.Card=Yo;exports.Checkbox=et;exports.CheckboxCard=Qo;exports.CheckboxGroup=oi;exports.Chip=Je;exports.ConfirmationProvider=fi;exports.Container=$i;exports.DatePicker=Ki;exports.Drawer=Ji;exports.Dropdown=nn;exports.EditableText=cn;exports.FieldLabel=ie;exports.FieldMessage=hn;exports.GlobalStyle=lo;exports.ImageCropper=$a;exports.Input=Pr;exports.KeySymbol=yr;exports.KeysBindings=Cr;exports.Modal=jr;exports.MultiSelect=Da;exports.NotificationProvider=Ka;exports.OtpCode=Qa;exports.Panel=nl;exports.Progress=dl;exports.Radio=Lt;exports.RadioCard=Sl;exports.RadioGroup=ml;exports.SaveProgressProvider=Rl;exports.Select=Dl;exports.Spinner=kt;exports.StatusCard=Gl;exports.Stepper=Jl;exports.Tabs=dd;exports.Tags=nd;exports.Textarea=ud;exports.ToastProvider=Cd;exports.Tooltip=Pd;exports.formatDateGo=wr;exports.useConfirmation=xi;exports.useImageCropper=Er;exports.useNotification=Ua;exports.useSaveProgress=kl;exports.useToast=md;
|
|
2110
2110
|
//# sourceMappingURL=index.cjs.map
|