@vacano/ui 1.5.0 → 1.6.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/dist/index.cjs +342 -312
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -0
- package/dist/index.js +1329 -1178
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +24 -0
- package/dist/lib.js +1 -1
- package/dist/media-BuwIclXE.cjs +51 -0
- package/dist/media-BuwIclXE.cjs.map +1 -0
- package/dist/{media-BR6nutcO.js → media-CWK1OED-.js} +54 -38
- package/dist/media-CWK1OED-.js.map +1 -0
- package/package.json +1 -1
- package/dist/media-BR6nutcO.js.map +0 -1
- package/dist/media-OVL6YjWb.cjs +0 -39
- package/dist/media-OVL6YjWb.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./X-CI1qRJDP.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./X-CI1qRJDP.cjs"),be=require("@emotion/react"),u=require("react"),t=require("./media-BuwIclXE.cjs"),A=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 i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const Re=no(u);function vt(){return vt=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var i in o)({}).hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},vt.apply(null,arguments)}const ao=be.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -141,22 +141,22 @@
|
|
|
141
141
|
:focus:not(:focus-visible) {
|
|
142
142
|
outline: none;
|
|
143
143
|
}
|
|
144
|
-
`,
|
|
144
|
+
`,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"},Tt=function(r){return typeof r=="string"&&r.charCodeAt(0)>96?po:uo},It=function(r,o,i){var n;if(o){var l=o.shouldForwardProp;n=r.__emotion_forwardProp&&l?function(c){return r.__emotion_forwardProp(c)&&l(c)}:l}return typeof n!="function"&&i&&(n=r.__emotion_forwardProp),n},ho=function(r){var o=r.cache,i=r.serialized,n=r.isStringTag;return a.registerStyles(o,i,n),a.useInsertionEffectAlwaysWithSyncFallback(function(){return a.insertStyles(o,i,n)}),null},bo=function e(r,o){var i=r.__emotion_real===r,n=i&&r.__emotion_base||r,l,c;o!==void 0&&(l=o.label,c=o.target);var d=It(r,o,i),p=d||Tt(n),h=!p("as");return function(){var g=arguments,f=i&&r.__emotion_styles!==void 0?r.__emotion_styles.slice(0):[];if(l!==void 0&&f.push("label:"+l+";"),g[0]==null||g[0].raw===void 0)f.push.apply(f,g);else{var O=g[0];f.push(O[0]);for(var m=g.length,y=1;y<m;y++)f.push(g[y],O[y])}var S=be.withEmotionCache(function(C,x,$){var b=h&&C.as||n,L="",E=[],T=C;if(C.theme==null){T={};for(var V in C)T[V]=C[V];T.theme=Re.useContext(be.ThemeContext)}typeof C.className=="string"?L=a.getRegisteredStyles(x.registered,E,C.className):C.className!=null&&(L=C.className+" ");var z=a.serializeStyles(f.concat(E),x.registered,T);L+=x.key+"-"+z.name,c!==void 0&&(L+=" "+c);var D=h&&d===void 0?Tt(b):p,j={};for(var w in C)h&&w==="as"||D(w)&&(j[w]=C[w]);return j.className=L,$&&(j.ref=$),Re.createElement(Re.Fragment,null,Re.createElement(ho,{cache:x,serialized:z,isStringTag:typeof b=="string"}),Re.createElement(b,j))});return S.displayName=l!==void 0?l:"Styled("+(typeof n=="string"?n:n.displayName||n.name||"Component")+")",S.defaultProps=r.defaultProps,S.__emotion_real=S,S.__emotion_base=n,S.__emotion_styles=f,S.__emotion_forwardProp=d,Object.defineProperty(S,"toString",{value:function(){return"."+c}}),S.withComponent=function(C,x){var $=e(C,vt({},o,x,{shouldForwardProp:It(S,x,!0)}));return $.apply(void 0,f)},S}},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`
|
|
145
145
|
font-size: 12px;
|
|
146
146
|
font-weight: 500;
|
|
147
147
|
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
148
|
-
`,
|
|
148
|
+
`,xo=A.newClassNameGetter("field-label"),ie=({children:e,className:r,ref:o,required:i,variant:n="normal",...l})=>e?a.jsxs(fo,{...l,ref:o,className:xo("container",r),$variant:n,children:[e," ",i&&"*"]}):null,it={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`
|
|
149
149
|
position: relative;
|
|
150
150
|
display: grid;
|
|
151
151
|
gap: 2px;
|
|
152
152
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
153
|
-
|
|
153
|
+
`,$o=s(ie)`
|
|
154
154
|
margin-left: 6px;
|
|
155
|
-
`,
|
|
155
|
+
`,So=s.div`
|
|
156
156
|
position: relative;
|
|
157
157
|
display: flex;
|
|
158
158
|
align-items: center;
|
|
159
|
-
`,
|
|
159
|
+
`,yo=s.input`
|
|
160
160
|
flex: 1;
|
|
161
161
|
min-width: 0;
|
|
162
162
|
width: 100%;
|
|
@@ -168,25 +168,25 @@
|
|
|
168
168
|
padding-right: 40px;
|
|
169
169
|
border-radius: ${e=>it[e.$size].radius};
|
|
170
170
|
|
|
171
|
-
color: ${e=>
|
|
172
|
-
border: 1px solid ${e=>
|
|
173
|
-
background-color: ${e=>
|
|
171
|
+
color: ${e=>ne[e.$variant].color.static};
|
|
172
|
+
border: 1px solid ${e=>ne[e.$variant].border.static};
|
|
173
|
+
background-color: ${e=>ne[e.$variant].background.static};
|
|
174
174
|
|
|
175
175
|
&::placeholder {
|
|
176
|
-
color: ${e=>
|
|
176
|
+
color: ${e=>ne[e.$variant].placeholder.static};
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
&:disabled {
|
|
180
180
|
cursor: not-allowed;
|
|
181
|
-
color: ${e=>
|
|
182
|
-
background-color: ${e=>
|
|
183
|
-
border-color: ${e=>
|
|
181
|
+
color: ${e=>ne[e.$variant].color.disabled};
|
|
182
|
+
background-color: ${e=>ne[e.$variant].background.disabled};
|
|
183
|
+
border-color: ${e=>ne[e.$variant].border.disabled};
|
|
184
184
|
|
|
185
185
|
&::placeholder {
|
|
186
|
-
color: ${e=>
|
|
186
|
+
color: ${e=>ne[e.$variant].placeholder.disabled};
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
`,Co=s.div`
|
|
190
190
|
position: absolute;
|
|
191
191
|
right: 12px;
|
|
192
192
|
top: 50%;
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
display: flex;
|
|
195
195
|
align-items: center;
|
|
196
196
|
justify-content: center;
|
|
197
|
-
`,
|
|
197
|
+
`,vo=s.div`
|
|
198
198
|
position: absolute;
|
|
199
199
|
top: 100%;
|
|
200
200
|
left: 0;
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
opacity 0.15s ease,
|
|
215
215
|
transform 0.15s ease,
|
|
216
216
|
visibility 0.15s;
|
|
217
|
-
`,
|
|
217
|
+
`,mo=s.div`
|
|
218
218
|
display: flex;
|
|
219
219
|
align-items: center;
|
|
220
220
|
gap: 10px;
|
|
@@ -240,43 +240,43 @@
|
|
|
240
240
|
&:hover {
|
|
241
241
|
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
242
242
|
}
|
|
243
|
-
`,
|
|
243
|
+
`,wo=s.img`
|
|
244
244
|
width: 24px;
|
|
245
245
|
height: 24px;
|
|
246
246
|
border-radius: 6px;
|
|
247
247
|
object-fit: cover;
|
|
248
|
-
`,
|
|
248
|
+
`,Ro=s.span`
|
|
249
249
|
flex: 1;
|
|
250
250
|
overflow: hidden;
|
|
251
251
|
text-overflow: ellipsis;
|
|
252
252
|
white-space: nowrap;
|
|
253
|
-
`,
|
|
253
|
+
`,ko=s.div`
|
|
254
254
|
padding: 12px 14px;
|
|
255
255
|
font-size: 14px;
|
|
256
256
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
257
257
|
text-align: center;
|
|
258
|
-
`,At={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},
|
|
258
|
+
`,At={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},_t={track:t.alpha(t.COLORS.black,15),indicator:t.COLORS.black},nt=e=>At[e]??At.md,Lo=be.keyframes`
|
|
259
259
|
0% {
|
|
260
260
|
transform: rotate(0deg);
|
|
261
261
|
}
|
|
262
262
|
100% {
|
|
263
263
|
transform: rotate(360deg);
|
|
264
264
|
}
|
|
265
|
-
`,
|
|
265
|
+
`,Po=s.div`
|
|
266
266
|
display: inline-block;
|
|
267
267
|
width: ${e=>nt(e.$size).size};
|
|
268
268
|
height: ${e=>nt(e.$size).size};
|
|
269
|
-
border: ${e=>nt(e.$size).borderWidth} solid ${
|
|
270
|
-
border-top-color: ${
|
|
269
|
+
border: ${e=>nt(e.$size).borderWidth} solid ${_t.track};
|
|
270
|
+
border-top-color: ${_t.indicator};
|
|
271
271
|
border-radius: 50%;
|
|
272
|
-
animation: ${
|
|
273
|
-
`,
|
|
272
|
+
animation: ${Lo} 0.8s linear infinite;
|
|
273
|
+
`,zo=A.newClassNameGetter("spinner"),Lt=({"aria-label":e="Loading",className:r,ref:o,size:i="md",...n})=>a.jsx(Po,{...n,ref:o,className:zo("container",r),role:"status","aria-label":e,$size:i}),ke=A.newClassNameGetter("autocomplete"),Eo=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",value:p,onChange:h,onSearch:g,debounceMs:f=300,minChars:O=1,noResultsMessage:m="No results found",...y})=>{const[S,C]=u.useState((p==null?void 0:p.value)??""),[x,$]=u.useState([]),[b,L]=u.useState(!1),[E,T]=u.useState(!1),[V,z]=u.useState(!1),D=u.useRef(null),j=u.useRef(null);u.useEffect(()=>{(p==null?void 0:p.value)!==void 0&&C(p.value)},[p==null?void 0:p.value]);const w=u.useCallback(async N=>{if(N.length<O){$([]),z(!1);return}L(!0),z(!0);try{const F=await g(N);$(F),T(!0)}catch{$([])}finally{L(!1)}},[g,O]),M=u.useCallback(N=>{const F=N.target.value;C(F),h==null||h({value:F,image_url:null}),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{w(F)},f)},[h,w,f]),v=u.useCallback(N=>{C(N.value),$([]),T(!1),z(!1),h==null||h({value:N.value,image_url:N.image_url})},[h]),I=u.useCallback(()=>{setTimeout(()=>{T(!1)},150)},[]),k=u.useCallback(()=>{x.length>0&&T(!0)},[x.length]);return u.useEffect(()=>()=>{j.current&&clearTimeout(j.current)},[]),a.jsxs(Oo,{ref:D,className:ke("container",e),$fullWidth:!!i,children:[n&&a.jsx($o,{variant:d,className:ke("label",r==null?void 0:r.label),children:n}),a.jsxs(So,{children:[a.jsx(yo,{...y,ref:l,type:"text",value:S,onChange:M,onBlur:I,onFocus:k,disabled:o,$size:c,$variant:d,className:ke("input",r==null?void 0:r.input)}),b&&a.jsx(Co,{children:a.jsx(Lt,{size:"xs"})})]}),a.jsx(vo,{$open:E&&V,className:ke("dropdown",r==null?void 0:r.dropdown),children:x.length>0?x.map(N=>a.jsxs(mo,{onClick:()=>v(N),className:ke("item",r==null?void 0:r.item),children:[N.image_url&&a.jsx(wo,{src:N.image_url,alt:N.value}),a.jsx(Ro,{children:N.value})]},N.id)):!b&&a.jsx(ko,{children:m})})]})},Dt={compact:{height:"32px",padding:"0 8px",radius:"12px",iconSize:"16px"},default:{height:"40px",padding:"0 12px",radius:"16px",iconSize:"20px"}},Mt={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=Mt[e];return r||Mt.normal},re=e=>{const r=Dt[e];return r||Dt.default},jo=e=>e?"auto":"fit-content",No=s.button`
|
|
274
274
|
display: flex;
|
|
275
275
|
gap: 6px;
|
|
276
276
|
text-decoration: none;
|
|
277
277
|
align-items: center;
|
|
278
278
|
justify-content: center;
|
|
279
|
-
width: ${e=>e.$iconOnly?re(e.$size).height:
|
|
279
|
+
width: ${e=>e.$iconOnly?re(e.$size).height:jo(!!e.$fullWidth)};
|
|
280
280
|
color: ${e=>J(e.$variant).color.static};
|
|
281
281
|
background-color: ${e=>J(e.$variant).background.static};
|
|
282
282
|
height: ${e=>re(e.$size).height};
|
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
background-color: ${e=>J(e.$variant).background.disabled};
|
|
303
303
|
border-color: ${e=>J(e.$variant).borderColor.disabled};
|
|
304
304
|
}
|
|
305
|
-
`,
|
|
305
|
+
`,To=s.div`
|
|
306
306
|
display: grid;
|
|
307
307
|
place-items: center;
|
|
308
308
|
width: ${e=>re(e.$size).iconSize};
|
|
@@ -312,19 +312,19 @@
|
|
|
312
312
|
width: ${e=>re(e.$size).iconSize};
|
|
313
313
|
height: ${e=>re(e.$size).iconSize};
|
|
314
314
|
}
|
|
315
|
-
`,
|
|
315
|
+
`,Io=s.span`
|
|
316
316
|
font-weight: 600;
|
|
317
317
|
overflow: hidden;
|
|
318
318
|
white-space: nowrap;
|
|
319
319
|
text-overflow: ellipsis;
|
|
320
|
-
`,
|
|
320
|
+
`,Ao=s(a.LoaderCircle)`
|
|
321
321
|
width: ${e=>re(e.$size).iconSize};
|
|
322
322
|
height: ${e=>re(e.$size).iconSize};
|
|
323
323
|
animation: ${t.KEYFRAMES.rotate} 0.8s linear infinite;
|
|
324
|
-
`,
|
|
324
|
+
`,_o=s.div`
|
|
325
325
|
display: flex;
|
|
326
326
|
gap: 3px;
|
|
327
|
-
`,
|
|
327
|
+
`,Do=s.span`
|
|
328
328
|
text-align: center;
|
|
329
329
|
display: flex;
|
|
330
330
|
justify-content: center;
|
|
@@ -337,24 +337,24 @@
|
|
|
337
337
|
border-radius: 4px;
|
|
338
338
|
width: fit-content;
|
|
339
339
|
background-color: ${e=>e.$variant==="light"?t.alpha(t.COLORS.white,25):t.alpha(t.COLORS.black,25)};
|
|
340
|
-
`,
|
|
340
|
+
`,Mo=A.newClassNameGetter("key-symbol"),Cr=({className:e,ref:r,symbol:o,variant:i="light",...n})=>o?a.jsx(Do,{...n,ref:r,className:Mo("container",e),$variant:i,children:o}):null,Ft=A.newClassNameGetter("key-bindings"),vr=({className:e,classnames:r,keys:o,ref:i,variant:n,...l})=>{const c=u.useMemo(()=>t.getKeySymbols(o),[o]);return c.length===0?null:a.jsx(_o,{...l,ref:i,className:Ft("container",e),children:c.map(d=>a.jsx(Cr,{symbol:d,className:Ft("item",r==null?void 0:r.item),variant:n},d))})},Bt=A.newClassNameGetter("button"),De=({children:e,className:r,classnames:o,disabled:i,fullWidth:n,icon:l,loading:c,onClick:d,ref:p=null,keyBindings:h=[],size:g="default",type:f="button",variant:O="normal",...m})=>{const y=u.useRef(null);u.useImperativeHandle(p,()=>y.current,[]),t.useKeyBinding(h,()=>{var C;(C=y.current)==null||C.click()});const S=u.useMemo(()=>{switch(f){case"link":return"button";default:return f}},[f]);return a.jsxs(No,{...m,onClick:d,ref:y,type:S,disabled:i,className:Bt("container",r),$variant:O,$size:g,$fullWidth:!!n,$iconOnly:!!l&&!(e||(h==null?void 0:h.length)>0),children:[c&&a.jsx(Ao,{$size:g}),l&&!c&&a.jsx(To,{$size:g,children:l}),e&&a.jsx(Io,{className:Bt("label",o==null?void 0:o.label),children:e}),a.jsx(vr,{keys:h,variant:O==="system"?"light":"dark"})]})},Fo=s.div`
|
|
341
341
|
background-color: ${t.COLORS.white};
|
|
342
342
|
border-radius: 16px;
|
|
343
343
|
border: ${e=>e.$border?`1px solid ${t.alpha(t.COLORS["iron-grey"],15)}`:"none"};
|
|
344
344
|
box-shadow: ${e=>e.$shadow?`0 2px 8px ${t.alpha(t.COLORS.black,10)}`:"none"};
|
|
345
|
-
`,
|
|
345
|
+
`,Bo=A.newClassNameGetter("card"),Yo=({children:e,className:r,ref:o,border:i=!1,shadow:n=!1,...l})=>a.jsx(Fo,{...l,ref:o,className:Bo("container",r),$border:i,$shadow:n,children:e}),Yt={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=>Yt[e]??Yt.normal,Vo=s.label`
|
|
346
346
|
display: inline-flex;
|
|
347
347
|
align-items: flex-start;
|
|
348
348
|
gap: 8px;
|
|
349
349
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
350
350
|
opacity: ${e=>e.$disabled?.5:1};
|
|
351
|
-
`,
|
|
351
|
+
`,Ho=s.input`
|
|
352
352
|
position: absolute;
|
|
353
353
|
opacity: 0;
|
|
354
354
|
width: 0;
|
|
355
355
|
height: 0;
|
|
356
356
|
pointer-events: none;
|
|
357
|
-
`,
|
|
357
|
+
`,Go=s.span`
|
|
358
358
|
display: inline-flex;
|
|
359
359
|
align-items: center;
|
|
360
360
|
justify-content: center;
|
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
border-color 0.15s ease,
|
|
370
370
|
background-color 0.15s ease,
|
|
371
371
|
box-shadow 0.15s ease;
|
|
372
|
-
`,
|
|
372
|
+
`,Wo=s.span`
|
|
373
373
|
display: inline-flex;
|
|
374
374
|
align-items: center;
|
|
375
375
|
justify-content: center;
|
|
@@ -384,7 +384,7 @@
|
|
|
384
384
|
width: 12px;
|
|
385
385
|
height: 12px;
|
|
386
386
|
}
|
|
387
|
-
`,
|
|
387
|
+
`,Uo=s.span`
|
|
388
388
|
font-size: 14px;
|
|
389
389
|
font-weight: 500;
|
|
390
390
|
line-height: 1.4;
|
|
@@ -400,15 +400,15 @@
|
|
|
400
400
|
text-decoration: none;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
`,Le=A.newClassNameGetter("checkbox"),tt=({checked:e,className:r,classnames:o,disabled:i,indeterminate:n=!1,label:l,onChange:c,ref:d,variant:p="normal",...h})=>a.jsxs(
|
|
403
|
+
`,Le=A.newClassNameGetter("checkbox"),tt=({checked:e,className:r,classnames:o,disabled:i,indeterminate:n=!1,label:l,onChange:c,ref:d,variant:p="normal",...h})=>a.jsxs(Vo,{className:Le("container",r),$disabled:!!i,$variant:p,children:[a.jsx(Ho,{...h,ref:d,type:"checkbox",className:Le("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:c}),a.jsx(Go,{className:Le("box",o==null?void 0:o.box),$checked:e,$indeterminate:n,$variant:p,children:a.jsx(Wo,{className:Le("icon",o==null?void 0:o.icon),$visible:n||e,$variant:p,children:n?a.jsx(a.Minus,{}):a.jsx(a.Check,{})})}),l&&a.jsx(Uo,{className:Le("label",o==null?void 0:o.label),$variant:p,children:l})]}),Vt={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=>Vt[e]??Vt.normal,Xo=s.label`
|
|
404
404
|
display: grid;
|
|
405
405
|
grid-template-columns: auto 1fr;
|
|
406
406
|
align-items: start;
|
|
407
407
|
gap: 8px;
|
|
408
408
|
padding: 12px;
|
|
409
|
-
background-color: ${e=>{const r=
|
|
409
|
+
background-color: ${e=>{const r=ue(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
410
410
|
border: 1px solid
|
|
411
|
-
${e=>{const r=
|
|
411
|
+
${e=>{const r=ue(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
412
412
|
border-radius: 12px;
|
|
413
413
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
414
414
|
transition:
|
|
@@ -418,13 +418,13 @@
|
|
|
418
418
|
min-width: 0;
|
|
419
419
|
|
|
420
420
|
&:hover:not([data-disabled='true']) {
|
|
421
|
-
border-color: ${e=>{const r=
|
|
421
|
+
border-color: ${e=>{const r=ue(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
.vacano_checkbox_container {
|
|
425
425
|
pointer-events: none;
|
|
426
426
|
}
|
|
427
|
-
`,
|
|
427
|
+
`,qo=s.input`
|
|
428
428
|
position: absolute;
|
|
429
429
|
width: 1px;
|
|
430
430
|
height: 1px;
|
|
@@ -434,44 +434,44 @@
|
|
|
434
434
|
clip: rect(0, 0, 0, 0);
|
|
435
435
|
white-space: nowrap;
|
|
436
436
|
border: 0;
|
|
437
|
-
`,
|
|
437
|
+
`,Ko=s.div`
|
|
438
438
|
display: flex;
|
|
439
439
|
flex-direction: column;
|
|
440
440
|
gap: 2px;
|
|
441
441
|
min-width: 0;
|
|
442
|
-
`,
|
|
442
|
+
`,Zo=s.span`
|
|
443
443
|
font-size: 14px;
|
|
444
444
|
font-weight: 500;
|
|
445
445
|
line-height: 1.4;
|
|
446
|
-
color: ${e=>
|
|
446
|
+
color: ${e=>ue(e.$variant).label.static};
|
|
447
447
|
|
|
448
448
|
label[data-disabled='true'] & {
|
|
449
|
-
color: ${e=>
|
|
449
|
+
color: ${e=>ue(e.$variant).label.disabled};
|
|
450
450
|
}
|
|
451
|
-
`,
|
|
451
|
+
`,Jo=s.span`
|
|
452
452
|
font-size: 12px;
|
|
453
453
|
font-weight: 400;
|
|
454
454
|
line-height: 1.4;
|
|
455
|
-
color: ${e=>
|
|
455
|
+
color: ${e=>ue(e.$variant).description.static};
|
|
456
456
|
|
|
457
457
|
label[data-disabled='true'] & {
|
|
458
|
-
color: ${e=>
|
|
458
|
+
color: ${e=>ue(e.$variant).description.disabled};
|
|
459
459
|
}
|
|
460
|
-
`,
|
|
460
|
+
`,Ve=A.newClassNameGetter("checkbox-card"),Qo=({checked:e,className:r,classnames:o,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...g})=>a.jsxs(Xo,{className:Ve("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(qo,{...g,ref:p,type:"checkbox",checked:e,disabled:n,onChange:d}),a.jsx(tt,{className:o==null?void 0:o.checkbox,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(Ko,{className:Ve("content",o==null?void 0:o.content),children:[a.jsx(Zo,{className:Ve("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(Jo,{className:Ve("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),Ht={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},ei=s.div`
|
|
461
461
|
display: flex;
|
|
462
462
|
flex-direction: column;
|
|
463
463
|
gap: 8px;
|
|
464
|
-
`,
|
|
464
|
+
`,ti=s.span`
|
|
465
465
|
font-size: 13px;
|
|
466
466
|
font-weight: 500;
|
|
467
467
|
line-height: 1.5;
|
|
468
|
-
color: ${e=>e.$disabled?
|
|
468
|
+
color: ${e=>e.$disabled?Ht.label.disabledColor:Ht.label.color};
|
|
469
469
|
margin-bottom: 4px;
|
|
470
|
-
`,
|
|
470
|
+
`,ri=s.div`
|
|
471
471
|
display: flex;
|
|
472
472
|
flex-direction: column;
|
|
473
473
|
gap: 12px;
|
|
474
|
-
`,at=A.newClassNameGetter("checkbox-group"),
|
|
474
|
+
`,at=A.newClassNameGetter("checkbox-group"),oi=({className:e,classnames:r,disabled:o,label:i,onChange:n,options:l,ref:c,value:d,...p})=>{const h=(g,f)=>{n(f?[...d,g]:d.filter(O=>O!==g))};return a.jsxs(ei,{...p,ref:c,className:at("container",e),children:[i&&a.jsx(ti,{className:at("label",r==null?void 0:r.label),$disabled:o,children:i}),a.jsx(ri,{className:at("options",r==null?void 0:r.options),children:l.map(g=>a.jsx(tt,{className:r==null?void 0:r.checkbox,checked:d.includes(g.value),label:g.label,disabled:o,onChange:f=>h(g.value,f.target.checked)},g.value))})]})},Gt={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=>Gt[e]??Gt.gray,ii=s.span`
|
|
475
475
|
display: inline-flex;
|
|
476
476
|
align-items: center;
|
|
477
477
|
gap: 4px;
|
|
@@ -483,7 +483,7 @@
|
|
|
483
483
|
line-height: 1.5;
|
|
484
484
|
background-color: ${e=>mt(e.$variant).background};
|
|
485
485
|
color: ${e=>mt(e.$variant).color};
|
|
486
|
-
`,
|
|
486
|
+
`,ni=s.button`
|
|
487
487
|
display: inline-flex;
|
|
488
488
|
align-items: center;
|
|
489
489
|
justify-content: center;
|
|
@@ -505,10 +505,10 @@
|
|
|
505
505
|
width: 14px;
|
|
506
506
|
height: 14px;
|
|
507
507
|
}
|
|
508
|
-
`,
|
|
508
|
+
`,ai=s.span`
|
|
509
509
|
flex: 1 0 auto;
|
|
510
510
|
text-align: center;
|
|
511
|
-
`,lt=A.newClassNameGetter("chip"),Qe=({children:e,className:r,classnames:o,deletable:i,onDelete:n,ref:l,variant:c="gray",...d})=>a.jsxs(
|
|
511
|
+
`,lt=A.newClassNameGetter("chip"),Qe=({children:e,className:r,classnames:o,deletable:i,onDelete:n,ref:l,variant:c="gray",...d})=>a.jsxs(ii,{...d,ref:l,className:lt("container",r),$variant:c,$deletable:!!i,children:[a.jsx(ai,{className:lt("label",o==null?void 0:o.label),children:e}),i&&a.jsx(ni,{type:"button",className:lt("delete",o==null?void 0:o.delete),$variant:c,onClick:n,children:a.jsx(a.X,{})})]}),li="Confirm",di="Cancel",ci=be.keyframes`
|
|
512
512
|
from {
|
|
513
513
|
opacity: 0;
|
|
514
514
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -517,7 +517,7 @@
|
|
|
517
517
|
opacity: 1;
|
|
518
518
|
transform: translateX(-50%) translateY(0);
|
|
519
519
|
}
|
|
520
|
-
`,
|
|
520
|
+
`,si=be.keyframes`
|
|
521
521
|
from {
|
|
522
522
|
opacity: 1;
|
|
523
523
|
transform: translateX(-50%) translateY(0);
|
|
@@ -526,7 +526,7 @@
|
|
|
526
526
|
opacity: 0;
|
|
527
527
|
transform: translateX(-50%) translateY(100%);
|
|
528
528
|
}
|
|
529
|
-
`,
|
|
529
|
+
`,pi=s.div`
|
|
530
530
|
position: fixed;
|
|
531
531
|
bottom: 24px;
|
|
532
532
|
left: 50%;
|
|
@@ -541,18 +541,18 @@
|
|
|
541
541
|
box-shadow:
|
|
542
542
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
543
543
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
544
|
-
animation: ${({$open:e})=>e?
|
|
544
|
+
animation: ${({$open:e})=>e?ci:si} 0.2s ease-out forwards;
|
|
545
545
|
z-index: 1000;
|
|
546
|
-
`,
|
|
546
|
+
`,ui=s.p`
|
|
547
547
|
margin: 0;
|
|
548
548
|
font-size: 14px;
|
|
549
549
|
color: ${t.COLORS.black};
|
|
550
550
|
white-space: nowrap;
|
|
551
|
-
`,
|
|
551
|
+
`,hi=s.div`
|
|
552
552
|
display: flex;
|
|
553
553
|
align-items: center;
|
|
554
554
|
gap: 8px;
|
|
555
|
-
`,Pe=A.newClassNameGetter("confirmation"),
|
|
555
|
+
`,Pe=A.newClassNameGetter("confirmation"),bi=({cancelBindings:e,cancelLabel:r=di,className:o,classnames:i,confirmLabel:n=li,loading:l=!1,message:c,onCancel:d,onConfirm:p,open:h=!0,ref:g,submitBindings:f,...O})=>h?a.jsxs(pi,{...O,ref:g,className:Pe("container",o),$open:h,children:[a.jsx(ui,{className:Pe("message",i==null?void 0:i.message),children:c}),a.jsxs(hi,{className:Pe("actions",i==null?void 0:i.actions),children:[a.jsx(De,{variant:"system",size:"compact",onClick:d,keyBindings:e,className:Pe("cancel-button",i==null?void 0:i.cancelButton),children:r}),a.jsx(De,{variant:"danger",size:"compact",onClick:p,loading:l,keyBindings:f,className:Pe("confirm-button",i==null?void 0:i.confirmButton),children:n})]})]}):null,ze={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`},gi=s.div`
|
|
556
556
|
width: 100%;
|
|
557
557
|
|
|
558
558
|
${t.mediaUp("sm")} {
|
|
@@ -574,16 +574,16 @@
|
|
|
574
574
|
${t.mediaUp("2xl")} {
|
|
575
575
|
max-width: ${ze["2xl"]};
|
|
576
576
|
}
|
|
577
|
-
`,
|
|
577
|
+
`,fi=A.newClassNameGetter("container"),xi=({children:e,className:r,ref:o,...i})=>a.jsx(gi,{...i,ref:o,className:fi("container",r),children:e}),Je={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},Ee={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,rt=2,Oi=12,mr=(e,r,o="en")=>{const i=e.getFullYear(),n=e.getMonth(),l=e.getDate(),c=e.getHours(),d=e.getMinutes(),p=e.getSeconds(),h=c%12||12,g=c>=12,f=new Intl.DateTimeFormat(o,{month:"long"}).format(e),O=new Intl.DateTimeFormat(o,{month:"short"}).format(e),m=new Intl.DateTimeFormat(o,{weekday:"long"}).format(e),y=new Intl.DateTimeFormat(o,{weekday:"short"}).format(e),S=L=>L.toString().padStart(2,"0"),C=L=>L.toString().padStart(2," "),x=L=>`\0${L}\0`,$=[["2006","YEARFOUR",i.toString()],["January","MONTHLONG",f],["Monday","WEEKDAYLONG",m],["Jan","MONTHSHORT",O],["Mon","WEEKDAYSHORT",y],["06","YEARTWO",i.toString().slice(-2)],["01","MONTHPAD",S(n+1)],["_2","DAYSPACE",C(l)],["02","DAYPAD",S(l)],["15","HOURTWENTYFOUR",S(c)],["03","HOURTWELVEPAD",S(h)],["04","MINUTE",S(d)],["05","SECOND",S(p)],["PM","AMPMUP",g?"PM":"AM"],["pm","AMPMLOW",g?"pm":"am"],["1","MONTH",(n+1).toString()],["2","DAY",l.toString()],["3","HOURTWELVE",h.toString()]];let b=r;for(const[L,E]of $)b=b.split(L).join(x(E));for(const[,L,E]of $)b=b.split(x(L)).join(E);return b},$i=(e,r)=>new Date(e,r+1,0).getDate(),Si=(e,r)=>new Date(e,r,1).getDay(),yi=(e,r,o=1)=>{const i=$i(e,r);let l=Si(e,r)-o;l<0&&(l+=7);const c=[];for(let d=0;d<l;d++)c.push(null);for(let d=1;d<=i;d++)c.push(d);for(;c.length<42;)c.push(null);return c},Ci=(e,r=1)=>{const o=[];for(let i=0;i<7;i++){const n=(r+i)%7,l=new Date(2024,0,7+n);o.push(new Intl.DateTimeFormat(e,{weekday:"short"}).format(l))}return o},vi=e=>{const r=[];for(let o=0;o<12;o++){const i=new Date(2024,o,1);r.push(new Intl.DateTimeFormat(e,{month:"short"}).format(i))}return r},Wt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate(),Ut=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth(),mi=(e,r)=>e.getFullYear()===r.getFullYear(),Xt=(e,r,o,i,n)=>{const l=new Date(e,r,o);if(i){const c=new Date(i.getFullYear(),i.getMonth(),i.getDate());if(l<c)return!0}if(n){const c=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(l>c)return!0}return!1},qt=(e,r,o,i)=>{if(o){const n=o.getFullYear(),l=o.getMonth();if(e<n||e===n&&r<l)return!0}if(i){const n=i.getFullYear(),l=i.getMonth();if(e>n||e===n&&r>l)return!0}return!1},Kt=(e,r,o)=>!!(r&&e<r.getFullYear()||o&&e>o.getFullYear()),wi=(e,r=12)=>{const o=e-Math.floor(r/2),i=[];for(let n=0;n<r;n++)i.push(o+n);return i},Ri=e=>{switch(e){case"date":return"02.01.2006";case"month":return"January 2006";case"year":return"2006"}},ki=s.div`
|
|
578
578
|
position: relative;
|
|
579
579
|
display: inline-flex;
|
|
580
580
|
flex-direction: column;
|
|
581
581
|
gap: 2px;
|
|
582
582
|
min-width: 180px;
|
|
583
583
|
width: ${({$fullWidth:e})=>e?"100%":"fit-content"};
|
|
584
|
-
`,
|
|
584
|
+
`,Li=s(ie)`
|
|
585
585
|
margin-left: 6px;
|
|
586
|
-
`,
|
|
586
|
+
`,Pi=s.button`
|
|
587
587
|
display: flex;
|
|
588
588
|
align-items: center;
|
|
589
589
|
justify-content: space-between;
|
|
@@ -597,51 +597,51 @@
|
|
|
597
597
|
height: ${({$size:e})=>Je[e].height};
|
|
598
598
|
padding: ${({$size:e})=>Je[e].padding};
|
|
599
599
|
border-radius: ${({$size:e})=>Je[e].radius};
|
|
600
|
-
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?
|
|
600
|
+
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?Ee[e].color[r?"disabled":"static"]:Ee[e].placeholder[r?"disabled":"static"]};
|
|
601
601
|
border: 1px solid
|
|
602
|
-
${({$variant:e,$disabled:r})=>
|
|
603
|
-
background-color: ${({$variant:e,$disabled:r})=>
|
|
602
|
+
${({$variant:e,$disabled:r})=>Ee[e].border[r?"disabled":"static"]};
|
|
603
|
+
background-color: ${({$variant:e,$disabled:r})=>Ee[e].background[r?"disabled":"static"]};
|
|
604
604
|
|
|
605
605
|
${({$open:e,$variant:r})=>e&&`
|
|
606
|
-
outline: 2px solid ${
|
|
606
|
+
outline: 2px solid ${Ee[r].focus};
|
|
607
607
|
`}
|
|
608
|
-
`,
|
|
608
|
+
`,zi=s.span`
|
|
609
609
|
flex: 1;
|
|
610
610
|
overflow: hidden;
|
|
611
611
|
text-overflow: ellipsis;
|
|
612
612
|
white-space: nowrap;
|
|
613
|
-
`,
|
|
613
|
+
`,Ei=s.span`
|
|
614
614
|
display: flex;
|
|
615
615
|
align-items: center;
|
|
616
616
|
justify-content: center;
|
|
617
617
|
flex-shrink: 0;
|
|
618
618
|
transition: transform 0.15s ease;
|
|
619
619
|
transform: ${({$open:e})=>e?"rotate(180deg)":"rotate(0deg)"};
|
|
620
|
-
`,
|
|
620
|
+
`,wr=`
|
|
621
621
|
z-index: 100;
|
|
622
622
|
background-color: ${t.COLORS.white};
|
|
623
623
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
624
624
|
border-radius: 12px;
|
|
625
625
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
626
|
-
padding: ${
|
|
627
|
-
`,
|
|
626
|
+
padding: ${Oi}px;
|
|
627
|
+
`,Rr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",ji=s.div`
|
|
628
628
|
position: absolute;
|
|
629
629
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
630
630
|
left: 0;
|
|
631
|
-
${
|
|
631
|
+
${wr}
|
|
632
632
|
opacity: ${({$open:e})=>e?1:0};
|
|
633
633
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
634
|
-
transform: ${({$open:e,$position:r})=>
|
|
634
|
+
transform: ${({$open:e,$position:r})=>Rr(e,r)};
|
|
635
635
|
transition:
|
|
636
636
|
opacity 0.15s ease,
|
|
637
637
|
transform 0.15s ease,
|
|
638
638
|
visibility 0.15s;
|
|
639
|
-
`,
|
|
639
|
+
`,Ni=s.div`
|
|
640
640
|
position: fixed;
|
|
641
|
-
${
|
|
641
|
+
${wr}
|
|
642
642
|
opacity: ${({$open:e})=>e?1:0};
|
|
643
643
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
644
|
-
transform: ${({$open:e,$position:r})=>
|
|
644
|
+
transform: ${({$open:e,$position:r})=>Rr(e,r)};
|
|
645
645
|
transition:
|
|
646
646
|
opacity 0.15s ease,
|
|
647
647
|
transform 0.15s ease,
|
|
@@ -694,30 +694,30 @@
|
|
|
694
694
|
`,st=s.div`
|
|
695
695
|
display: flex;
|
|
696
696
|
gap: 4px;
|
|
697
|
-
`,
|
|
697
|
+
`,Ti=s.div`
|
|
698
698
|
display: grid;
|
|
699
|
-
grid-template-columns: repeat(7, ${
|
|
699
|
+
grid-template-columns: repeat(7, ${oe}px);
|
|
700
700
|
gap: ${rt}px;
|
|
701
701
|
margin-bottom: 4px;
|
|
702
|
-
`,
|
|
702
|
+
`,Ii=s.div`
|
|
703
703
|
display: flex;
|
|
704
704
|
align-items: center;
|
|
705
705
|
justify-content: center;
|
|
706
|
-
height: ${
|
|
706
|
+
height: ${oe}px;
|
|
707
707
|
font-size: 12px;
|
|
708
708
|
font-weight: 500;
|
|
709
709
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
710
710
|
text-transform: uppercase;
|
|
711
|
-
`,
|
|
711
|
+
`,Ai=s.div`
|
|
712
712
|
display: grid;
|
|
713
|
-
grid-template-columns: repeat(7, ${
|
|
713
|
+
grid-template-columns: repeat(7, ${oe}px);
|
|
714
714
|
gap: ${rt}px;
|
|
715
|
-
`,
|
|
715
|
+
`,_i=s.button`
|
|
716
716
|
display: flex;
|
|
717
717
|
align-items: center;
|
|
718
718
|
justify-content: center;
|
|
719
|
-
width: ${
|
|
720
|
-
height: ${
|
|
719
|
+
width: ${oe}px;
|
|
720
|
+
height: ${oe}px;
|
|
721
721
|
border: none;
|
|
722
722
|
border-radius: 8px;
|
|
723
723
|
font-size: 13px;
|
|
@@ -737,12 +737,12 @@
|
|
|
737
737
|
&:disabled {
|
|
738
738
|
cursor: not-allowed;
|
|
739
739
|
}
|
|
740
|
-
`,
|
|
740
|
+
`,Di=s.div`
|
|
741
741
|
display: grid;
|
|
742
742
|
grid-template-columns: repeat(3, 1fr);
|
|
743
743
|
gap: 8px;
|
|
744
|
-
width: ${7*
|
|
745
|
-
`,
|
|
744
|
+
width: ${7*oe+6*rt}px;
|
|
745
|
+
`,Mi=s.button`
|
|
746
746
|
display: flex;
|
|
747
747
|
align-items: center;
|
|
748
748
|
justify-content: center;
|
|
@@ -762,12 +762,12 @@
|
|
|
762
762
|
&:hover:not(:disabled) {
|
|
763
763
|
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
764
764
|
}
|
|
765
|
-
`,
|
|
765
|
+
`,Fi=s.div`
|
|
766
766
|
display: grid;
|
|
767
767
|
grid-template-columns: repeat(3, 1fr);
|
|
768
768
|
gap: 8px;
|
|
769
|
-
width: ${7*
|
|
770
|
-
`,
|
|
769
|
+
width: ${7*oe+6*rt}px;
|
|
770
|
+
`,Bi=s.button`
|
|
771
771
|
display: flex;
|
|
772
772
|
align-items: center;
|
|
773
773
|
justify-content: center;
|
|
@@ -787,10 +787,10 @@
|
|
|
787
787
|
&:hover:not(:disabled) {
|
|
788
788
|
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
789
789
|
}
|
|
790
|
-
`,
|
|
791
|
-
width: ${
|
|
792
|
-
height: ${
|
|
793
|
-
`,K=A.newClassNameGetter("date-picker"),
|
|
790
|
+
`,Yi=s.div`
|
|
791
|
+
width: ${oe}px;
|
|
792
|
+
height: ${oe}px;
|
|
793
|
+
`,K=A.newClassNameGetter("date-picker"),He=4,Vi=300,Hi=({value:e,onChange:r,mode:o="date",displayFormat:i,placeholder:n,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:p,size:h="default",variant:g="normal",disabled:f=!1,fullWidth:O=!1,label:m,portalRenderNode:y,open:S,onOpen:C,onClose:x,className:$,classnames:b,ref:L,...E})=>{const T=u.useMemo(()=>new Date,[]),[V,z]=u.useState(!1),[D,j]=u.useState({top:0,left:0}),[w,M]=u.useState("bottom"),[v,I]=u.useState(()=>o==="year"?"years":o==="month"?"months":"days"),[k,N]=u.useState(()=>e??T),[F,B]=u.useState(()=>((e==null?void 0:e.getFullYear())??T.getFullYear())-6),H=u.useRef(null),P=u.useRef(null),_=u.useRef(null),X=S!==void 0,q=X?S:V,fe=i??Ri(o),Me=u.useMemo(()=>Ci(l,c),[l,c]),ot=u.useMemo(()=>vi(l),[l]),Br=u.useMemo(()=>yi(k.getFullYear(),k.getMonth(),c),[k,c]),Fe=u.useMemo(()=>wi(F+6,12),[F]),zt=u.useMemo(()=>e?mr(e,fe,l):null,[e,fe,l]),Yr=n??fe.replace(/2006|06|January|Jan|01|02/g,"__"),ve=u.useCallback(()=>{var we;if(!P.current)return;const R=P.current.getBoundingClientRect(),Y=((we=_.current)==null?void 0:we.offsetHeight)??Vi,me=window.innerHeight-R.bottom-He,Be=R.top-He,xe=me<Y&&Be>me?"top":"bottom";if(M(xe),y){const Ye=xe==="bottom"?R.bottom+He:R.top-Y-He;j({top:Ye,left:R.left})}},[y]),Et=u.useCallback(()=>{if(f)return;X||z(!0),C==null||C(),I(o==="year"?"years":o==="month"?"months":"days");const R=e??T;N(R),B(R.getFullYear()-6)},[f,X,C,o,e,T]),Z=u.useCallback(()=>{X||z(!1),x==null||x()},[X,x]),Vr=u.useCallback(()=>{q?Z():Et()},[q,Z,Et]),Hr=u.useCallback(R=>{const Y=new Date(k.getFullYear(),k.getMonth(),R);r==null||r(Y),Z()},[k,r,Z]),Gr=u.useCallback(R=>{if(o==="month"){const Y=new Date(k.getFullYear(),R,1);r==null||r(Y),Z()}else N(new Date(k.getFullYear(),R,1)),I("days")},[o,k,r,Z]),Wr=u.useCallback(R=>{if(o==="year"){const Y=new Date(R,0,1);r==null||r(Y),Z()}else o==="month"?(N(new Date(R,k.getMonth(),1)),I("months")):(N(new Date(R,k.getMonth(),1)),I("months"))},[o,k,r,Z]),Ur=u.useCallback(()=>{N(R=>new Date(R.getFullYear(),R.getMonth()-1,1))},[]),Xr=u.useCallback(()=>{N(R=>new Date(R.getFullYear(),R.getMonth()+1,1))},[]),qr=u.useCallback(()=>{N(R=>new Date(R.getFullYear()-1,R.getMonth(),1))},[]),Kr=u.useCallback(()=>{N(R=>new Date(R.getFullYear()+1,R.getMonth(),1))},[]),Zr=u.useCallback(()=>{B(R=>R-12)},[]),Jr=u.useCallback(()=>{B(R=>R+12)},[]),jt=u.useCallback(()=>{v==="days"?I("months"):v==="months"&&I("years")},[v]);u.useLayoutEffect(()=>{q&&ve()},[q,ve]),u.useEffect(()=>{const R=xe=>{const we=xe.target,Ye=H.current&&!H.current.contains(we),io=_.current&&!_.current.contains(we);y?Ye&&io&&Z():Ye&&Z()},Y=xe=>{xe.key==="Escape"&&Z()},me=()=>{q&&y&&ve()},Be=()=>{q&&y&&ve()};return q&&(document.addEventListener("mousedown",R),document.addEventListener("keydown",Y),y&&(window.addEventListener("scroll",me,!0),window.addEventListener("resize",Be))),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",Y),window.removeEventListener("scroll",me,!0),window.removeEventListener("resize",Be)}},[q,Z,y,ve]);const Qr=Je[h].iconSize,eo=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(ct,{onClick:jt,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(k)}),a.jsxs(st,{children:[a.jsx(Oe,{onClick:Ur,type:"button","aria-label":"Previous month",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Xr,type:"button","aria-label":"Next month",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Ti,{children:Me.map((R,Y)=>a.jsx(Ii,{children:R},Y))}),a.jsx(Ai,{className:K("grid",b==null?void 0:b.grid),children:Br.map((R,Y)=>R===null?a.jsx(Yi,{},Y):a.jsx(_i,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Wt(e,new Date(k.getFullYear(),k.getMonth(),R)):!1,$today:Wt(T,new Date(k.getFullYear(),k.getMonth(),R)),$disabled:Xt(k.getFullYear(),k.getMonth(),R,d,p),disabled:Xt(k.getFullYear(),k.getMonth(),R,d,p),onClick:()=>Hr(R),children:R},Y))})]}),to=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(ct,{onClick:jt,type:"button",children:k.getFullYear()}),a.jsxs(st,{children:[a.jsx(Oe,{onClick:qr,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Kr,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Di,{className:K("grid",b==null?void 0:b.grid),children:ot.map((R,Y)=>a.jsx(Mi,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Ut(e,new Date(k.getFullYear(),Y,1)):!1,$current:Ut(T,new Date(k.getFullYear(),Y,1)),$disabled:qt(k.getFullYear(),Y,d,p),disabled:qt(k.getFullYear(),Y,d,p),onClick:()=>Gr(Y),children:R},Y))})]}),ro=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsxs(ct,{type:"button",style:{cursor:"default"},children:[Fe[0]," - ",Fe[Fe.length-1]]}),a.jsxs(st,{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(Fi,{className:K("grid",b==null?void 0:b.grid),children:Fe.map(R=>a.jsx(Bi,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?mi(e,new Date(R,0,1)):!1,$current:T.getFullYear()===R,$disabled:Kt(R,d,p),disabled:Kt(R,d,p),onClick:()=>Wr(R),children:R},R))})]}),Nt=()=>{switch(v){case"days":return eo();case"months":return to();case"years":return ro()}},oo=y?ge.createPortal(a.jsx(Ni,{ref:_,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),style:{top:D.top,left:D.left},children:Nt()}),y):a.jsx(ji,{ref:_,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),children:Nt()});return a.jsxs(ki,{...E,ref:L??H,$fullWidth:O,className:K("container",$),children:[m&&a.jsx(Li,{children:m}),a.jsxs(Pi,{ref:P,type:"button",onClick:Vr,disabled:f,$size:h,$variant:g,$disabled:f,$open:q,$hasValue:!!zt,className:K("trigger",b==null?void 0:b.trigger),children:[a.jsx(zi,{children:zt??Yr}),a.jsx(Ei,{$open:q,children:a.jsx(a.ChevronDown,{size:Qr})})]}),oo]})},Gi={left:t.KEYFRAMES.slideInLeft,right:t.KEYFRAMES.slideInRight,top:t.KEYFRAMES.slideInTop,bottom:t.KEYFRAMES.slideInBottom},Wi=(e,r)=>{switch(e){case"left":return`
|
|
794
794
|
top: 0;
|
|
795
795
|
left: 0;
|
|
796
796
|
height: 100%;
|
|
@@ -810,19 +810,19 @@
|
|
|
810
810
|
left: 0;
|
|
811
811
|
width: 100%;
|
|
812
812
|
height: ${r};
|
|
813
|
-
`}},
|
|
813
|
+
`}},Ui=s.div`
|
|
814
814
|
position: fixed;
|
|
815
815
|
z-index: 1001;
|
|
816
816
|
background-color: ${t.COLORS.white};
|
|
817
817
|
box-shadow: 0 4px 24px ${t.alpha(t.COLORS.black,20)};
|
|
818
|
-
${e=>
|
|
819
|
-
animation: ${e=>
|
|
820
|
-
`,
|
|
818
|
+
${e=>Wi(e.$position,e.$size)}
|
|
819
|
+
animation: ${e=>Gi[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
820
|
+
`,Xi=A.newClassNameGetter("drawer"),qi=({animated:e,children:r,className:o,open:i,position:n="right",ref:l,size:c="400px",...d})=>i?ge.createPortal(a.jsx(Ui,{...d,ref:l,className:Xi("container",o),$animated:!!e,$position:n,$size:c,children:r}),document.body):null,Ki=s.div`
|
|
821
821
|
position: relative;
|
|
822
822
|
display: inline-block;
|
|
823
|
-
`,
|
|
823
|
+
`,Zi=s.div`
|
|
824
824
|
cursor: pointer;
|
|
825
|
-
`,
|
|
825
|
+
`,kr=`
|
|
826
826
|
z-index: 100;
|
|
827
827
|
min-width: 160px;
|
|
828
828
|
padding: 8px;
|
|
@@ -830,39 +830,39 @@
|
|
|
830
830
|
border: 1px solid ${t.COLORS.gray};
|
|
831
831
|
border-radius: 8px;
|
|
832
832
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
833
|
-
`,
|
|
833
|
+
`,Lr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Ji=s.div`
|
|
834
834
|
position: absolute;
|
|
835
835
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
836
836
|
${({$align:e})=>e==="left"?"left: 0;":"right: 0;"}
|
|
837
|
-
${
|
|
837
|
+
${kr}
|
|
838
838
|
opacity: ${({$open:e})=>e?1:0};
|
|
839
839
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
840
|
-
transform: ${({$open:e,$position:r})=>
|
|
840
|
+
transform: ${({$open:e,$position:r})=>Lr(e,r)};
|
|
841
841
|
transition:
|
|
842
842
|
opacity 0.15s ease,
|
|
843
843
|
transform 0.15s ease,
|
|
844
844
|
visibility 0.15s;
|
|
845
|
-
`,
|
|
845
|
+
`,Qi=s.div`
|
|
846
846
|
position: fixed;
|
|
847
|
-
${
|
|
847
|
+
${kr}
|
|
848
848
|
opacity: ${({$open:e})=>e?1:0};
|
|
849
849
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
850
|
-
transform: ${({$open:e,$position:r})=>
|
|
850
|
+
transform: ${({$open:e,$position:r})=>Lr(e,r)};
|
|
851
851
|
transition:
|
|
852
852
|
opacity 0.15s ease,
|
|
853
853
|
transform 0.15s ease,
|
|
854
854
|
visibility 0.15s;
|
|
855
|
-
`,Ge=A.newClassNameGetter("dropdown"),We=4,
|
|
855
|
+
`,Ge=A.newClassNameGetter("dropdown"),We=4,en=100,tn=({align:e="left",children:r,className:o,classnames:i,onClose:n,onOpen:l,open:c,portalRenderNode:d,ref:p,trigger:h,...g})=>{const[f,O]=u.useState(!1),[m,y]=u.useState({top:0,left:0}),[S,C]=u.useState("bottom"),x=u.useRef(null),$=u.useRef(null),b=u.useRef(null),L=c!==void 0,E=L?c:f,T=u.useCallback(()=>{var N,F;if(!$.current)return;const j=$.current.getBoundingClientRect(),w=((N=b.current)==null?void 0:N.offsetHeight)??en,M=((F=b.current)==null?void 0:F.offsetWidth)??160,v=window.innerHeight-j.bottom-We,I=j.top-We,k=v<w&&I>v?"top":"bottom";if(C(k),d){let B;e==="left"?B=j.left:B=j.right-M;const H=k==="bottom"?j.bottom+We:j.top-w-We;y({top:H,left:B})}},[e,d]),V=u.useCallback(()=>{L?E?n==null||n():l==null||l():O(j=>{const w=!j;return w?l==null||l():n==null||n(),w})},[L,E,n,l]),z=u.useCallback(()=>{L||O(!1),n==null||n()},[L,n]);u.useLayoutEffect(()=>{E&&T()},[E,T]),u.useEffect(()=>{const j=I=>{const k=I.target,N=x.current&&!x.current.contains(k),F=b.current&&!b.current.contains(k);d?N&&F&&z():N&&z()},w=I=>{I.key==="Escape"&&z()},M=()=>{E&&d&&T()},v=()=>{E&&d&&T()};return E&&(document.addEventListener("mousedown",j),document.addEventListener("keydown",w),d&&(window.addEventListener("scroll",M,!0),window.addEventListener("resize",v))),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",w),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",v)}},[E,z,d,T]);const D=d?ge.createPortal(a.jsx(Qi,{ref:b,$open:E,$position:S,className:Ge("content",i==null?void 0:i.content),style:{top:m.top,left:m.left},children:r}),d):a.jsx(Ji,{ref:b,$align:e,$open:E,$position:S,className:Ge("content",i==null?void 0:i.content),children:r});return a.jsxs(Ki,{...g,ref:p??x,className:Ge("container",o),children:[a.jsx(Zi,{ref:$,onClick:V,className:Ge("trigger",i==null?void 0:i.trigger),children:u.cloneElement(h)}),D]})},rn={normal:t.COLORS["iron-grey"],error:t.COLORS.red,success:t.COLORS.green,warning:t.COLORS.yellow},on=s.span`
|
|
856
856
|
display: block;
|
|
857
857
|
font-size: 12px;
|
|
858
858
|
font-weight: 500;
|
|
859
859
|
line-height: 1.4;
|
|
860
|
-
color: ${e=>
|
|
861
|
-
`,
|
|
860
|
+
color: ${e=>rn[e.$variant]};
|
|
861
|
+
`,nn=A.newClassNameGetter("field-message"),an=({children:e,className:r,ref:o,variant:i="normal",...n})=>e?a.jsx(on,{...n,ref:o,className:nn("container",r),$variant:i,children:e}):null,ln=s.div`
|
|
862
862
|
display: flex;
|
|
863
863
|
flex-direction: column;
|
|
864
864
|
gap: 12px;
|
|
865
|
-
`,
|
|
865
|
+
`,dn=s.div`
|
|
866
866
|
width: ${({$size:e})=>e}px;
|
|
867
867
|
height: ${({$size:e})=>e}px;
|
|
868
868
|
border-radius: 8px;
|
|
@@ -878,10 +878,10 @@
|
|
|
878
878
|
height: 100%;
|
|
879
879
|
object-fit: cover;
|
|
880
880
|
}
|
|
881
|
-
`,
|
|
881
|
+
`,cn=s.span`
|
|
882
882
|
font-size: 12px;
|
|
883
883
|
color: ${t.COLORS["iron-grey"]};
|
|
884
|
-
`,
|
|
884
|
+
`,sn=e=>`
|
|
885
885
|
.${e} {
|
|
886
886
|
padding: 7px 16px;
|
|
887
887
|
font-size: 14px;
|
|
@@ -899,7 +899,7 @@
|
|
|
899
899
|
.${e}:active {
|
|
900
900
|
transform: translate(0, 1px);
|
|
901
901
|
}
|
|
902
|
-
`,
|
|
902
|
+
`,pn=e=>`
|
|
903
903
|
.${e} {
|
|
904
904
|
display: flex;
|
|
905
905
|
flex: 1 1 auto;
|
|
@@ -923,7 +923,7 @@
|
|
|
923
923
|
max-height: 70vh;
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
|
-
`,
|
|
926
|
+
`,un=e=>`
|
|
927
927
|
.${e} {
|
|
928
928
|
padding: 7px 16px;
|
|
929
929
|
font-size: 14px;
|
|
@@ -941,7 +941,7 @@
|
|
|
941
941
|
.${e}:active {
|
|
942
942
|
transform: translate(0, 1px);
|
|
943
943
|
}
|
|
944
|
-
`,
|
|
944
|
+
`,hn=e=>`
|
|
945
945
|
.${e} {
|
|
946
946
|
display: flex;
|
|
947
947
|
flex-direction: column;
|
|
@@ -959,7 +959,7 @@
|
|
|
959
959
|
border-radius: 8px;
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
|
-
`,
|
|
962
|
+
`,bn=e=>`
|
|
963
963
|
.${e} {
|
|
964
964
|
display: flex;
|
|
965
965
|
justify-content: flex-end;
|
|
@@ -978,7 +978,7 @@
|
|
|
978
978
|
gap: 8px;
|
|
979
979
|
}
|
|
980
980
|
}
|
|
981
|
-
`,
|
|
981
|
+
`,gn=e=>`
|
|
982
982
|
.${e} {
|
|
983
983
|
display: flex;
|
|
984
984
|
justify-content: flex-start;
|
|
@@ -1000,7 +1000,7 @@
|
|
|
1000
1000
|
font-size: 14px;
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
`,
|
|
1003
|
+
`,fn=e=>`
|
|
1004
1004
|
.${e} {
|
|
1005
1005
|
display: block;
|
|
1006
1006
|
z-index: 101;
|
|
@@ -1018,27 +1018,27 @@
|
|
|
1018
1018
|
position: absolute;
|
|
1019
1019
|
touch-action: none;
|
|
1020
1020
|
}
|
|
1021
|
-
`,
|
|
1021
|
+
`,xn=e=>`
|
|
1022
1022
|
.${e} {
|
|
1023
1023
|
position: absolute;
|
|
1024
1024
|
z-index: 2;
|
|
1025
1025
|
background-color: rgba(0, 0, 0, 0.6);
|
|
1026
1026
|
touch-action: none;
|
|
1027
1027
|
}
|
|
1028
|
-
`,
|
|
1028
|
+
`,On=e=>`
|
|
1029
1029
|
.${e} {
|
|
1030
1030
|
position: absolute;
|
|
1031
1031
|
z-index: 3;
|
|
1032
1032
|
touch-action: none;
|
|
1033
1033
|
}
|
|
1034
|
-
|
|
1034
|
+
`,$n=e=>`
|
|
1035
1035
|
.${e} {
|
|
1036
1036
|
backface-visibility: hidden;
|
|
1037
1037
|
perspective: 1000px;
|
|
1038
1038
|
max-inline-size: unset !important;
|
|
1039
1039
|
max-block-size: unset !important;
|
|
1040
1040
|
}
|
|
1041
|
-
`,
|
|
1041
|
+
`,Sn=e=>`
|
|
1042
1042
|
.${e} {
|
|
1043
1043
|
position: absolute;
|
|
1044
1044
|
z-index: 100;
|
|
@@ -1049,7 +1049,7 @@
|
|
|
1049
1049
|
overflow: hidden;
|
|
1050
1050
|
border-radius: 50%;
|
|
1051
1051
|
}
|
|
1052
|
-
`,
|
|
1052
|
+
`,yn={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},Cn={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},Ue=(e,r)=>{const o=yn[r],{h:i,v:n}=Cn[r];return`
|
|
1053
1053
|
.${e} {
|
|
1054
1054
|
display: block;
|
|
1055
1055
|
z-index: 102;
|
|
@@ -1075,7 +1075,7 @@
|
|
|
1075
1075
|
${n}: -12px;
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
`},
|
|
1078
|
+
`},vn=e=>`
|
|
1079
1079
|
.${e} {
|
|
1080
1080
|
display: flex;
|
|
1081
1081
|
align-items: center;
|
|
@@ -1101,7 +1101,7 @@
|
|
|
1101
1101
|
padding-bottom: env(safe-area-inset-bottom, 8px);
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
-
`,
|
|
1104
|
+
`,mn=e=>`
|
|
1105
1105
|
.${e} {
|
|
1106
1106
|
backface-visibility: hidden;
|
|
1107
1107
|
user-select: none;
|
|
@@ -1114,25 +1114,25 @@
|
|
|
1114
1114
|
position: absolute;
|
|
1115
1115
|
z-index: 1;
|
|
1116
1116
|
}
|
|
1117
|
-
`,
|
|
1118
|
-
${
|
|
1119
|
-
${
|
|
1120
|
-
${
|
|
1121
|
-
${
|
|
1122
|
-
${
|
|
1123
|
-
${
|
|
1124
|
-
${
|
|
1125
|
-
${
|
|
1126
|
-
${
|
|
1127
|
-
${
|
|
1128
|
-
${
|
|
1129
|
-
${
|
|
1130
|
-
${
|
|
1131
|
-
${
|
|
1132
|
-
${
|
|
1133
|
-
${
|
|
1134
|
-
${
|
|
1135
|
-
`,i=document.createElement("style");return i.innerHTML=o,document.getElementsByTagName("head")[0].prepend(i),r};let mn=0;const wn=e=>{const r=new Map,o=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(r.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...o}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(o[n]=l)}},subscribe:(i,n)=>{const l=String(++mn),c=r.get(i)||[];return r.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of r.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){r.set(n,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"]}},Rn=(e={},r={})=>wn({...wt,config:{...wt.config,...e},css:Cn(r)}),kn=(e,r)=>{var O;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!i)return o.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=r.width/r.height;let p,h,g=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(r.height/r.width),g=(l-h)/2),{width:p,height:h,left:f,top:g}},Ln=(e,r,o)=>{const[i,n]=r,l=i+e>o.width?(o.width-e)/2:i,c=n+e>o.height?(o.height-e)/2:n;return[l,c]},Pn=(e,r)=>{const{config:o}=e(),i=Math.min(r.width,r.height)-o.framePadding*2,n=o.portalSize>i?i:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=Ln(n,o.portalPosition,r);return{left:l,top:c,size:n}}return o.portalPosition==="center"?{size:n,left:(r.width-n)/2,top:(r.height-n)/2}:{left:0,top:0,size:n}};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 zn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerMove),o.setAttribute("data-action",te.MOVE),o},jn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},En=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Tn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Nn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},In=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.previewImage),o},An=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.preview),o.appendChild(In(e)),o},Dn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portal),o.appendChild(An(e)),o.appendChild(zn(e)),o.appendChild(Tn(e)),o.appendChild(Nn(e)),o.appendChild(jn(e)),o.appendChild(En(e)),o},_n=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portalArea),o.appendChild(Dn(e)),o},Mn=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Fn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.body),o.appendChild(Mn(e)),o.appendChild(_n(e)),o},Bn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=o.config.applyButtonLabel,i.addEventListener("click",r),i},Yn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=o.config.cancelButtonLabel,i.addEventListener("click",r),i},Hn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.footer),n.appendChild(Yn(e,o)),n.appendChild(Bn(e,r)),n},Vn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.header),o},Gn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.container),n.appendChild(Vn(e)),n.appendChild(Fn(e)),n.appendChild(Hn(e,r,o)),n},Wn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");X(n,(l=i.css)==null?void 0:l.root),n.appendChild(Gn(e,r,o)),document.body.appendChild(n)},Xn=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},Ae=new Map,Un={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},ue=(e,r)=>{if(Ae.has(e))return Ae.get(e);if(!r)return null;const o=r[Un[e]],i=document.querySelector(`.${o[0]}`);return Ae.set(e,i),i},qn=()=>{Ae.clear()},Kn=()=>{Ae.clear()},Zn=(e,r)=>{const o=ue("header",r.css);o&&(o.innerText=e)},Jn=(e,r)=>{const o=ue("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 i=ue("portalArea",r.css);i&&(i.style.height=`${r.frame.height}px`,i.style.width=`${r.frame.width}px`,i.style.left=`${r.frame.left}px`,i.style.top=`${r.frame.top}px`);const n=ue("portal",r.css);n&&(n.style.width=`${r.portal.size}px`,n.style.height=`${r.portal.size}px`,n.style.left=`${r.portal.left}px`,n.style.top=`${r.portal.top}px`);const l=ue("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`)},Qn=(e,r)=>{const o=ue("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 i=ue("previewImage",r.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},pt=1,ea=e=>{var m,y;const r=e(),o=document.createElement("canvas"),i=r.frame.width||pt,n=r.frame.height||pt,l=r.sourceWidth/i,c=r.sourceHeight/n,d=r.portal.left*l,p=r.portal.top*c,h=Math.max(r.portal.size*Math.min(l,c),pt),g=r.config.outputSize>0?r.config.outputSize:h;o.width=g,o.height=g;const f=document.querySelector(`.${(m=r.css)==null?void 0:m.sourceImage[0]}`);f&&((y=o.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,g,g));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((S,v)=>{try{o.toBlob(x=>{if(o.remove(),!x){v(new Error(`Failed to create blob for type: image/${r.config.type}`));return}S([O,x])},`image/${r.config.type}`,r.config.compression)}catch(x){o.remove(),v(x)}})},ta=(e,r,o)=>{const{emitted:i,portal:n,frame:l,config:c}=r();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,g=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>g&&(d=g),p<f&&(p=f),p>O&&(p=O),o({portal:{...n,left:d,top:p}})},ra=(e,r,o)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=r(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let g=n.size+Math.max(p,h);return g<d.minPortalSize&&(g=d.minPortalSize),n.top+g>c.height-d.framePadding&&(g=c.height-n.top-d.framePadding),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding),o({portal:{...l,size:g}})}case te.RESIZE_TR:{let g=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return g<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,g=d.minPortalSize),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(g=n.top+n.size,f=d.framePadding),o({portal:{...l,top:f,size:g}})}case te.RESIZE_TL:{const g=Math.min(p,h);let f=n.size-g,O=n.left+g,m=n.top+g;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,m=n.top+y}if(m<d.framePadding){const y=d.framePadding-m;m=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,m=m+y,f=f-y}return o({portal:{...l,top:m,left:O,size:f}})}case te.RESIZE_BL:{let g=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return g<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,g=d.minPortalSize),g+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,g=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,g=n.left+n.size-d.framePadding),o({portal:{...l,left:f,size:g}})}default:return}},Zt=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}},oa=(e,r)=>{var O,m,y;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(m=o.css)==null?void 0:m.portalArea[0]}`),l=document.querySelector(`.${(y=o.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:v}=e(),x=Zt(S);if(S.target){const $=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:v.left,top:v.top,size:v.size};r({action:$,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&r({action:null})},g=()=>{if(c=null,!d)return;const S=d;d=null;const{action:v}=e();if(v)switch(v){case te.MOVE:ta(S,e,r);break;default:ra(S,e,r)}},f=S=>{const{action:v}=e();v&&(S.preventDefault(),d=Zt(S),c===null&&(c=requestAnimationFrame(g)))};return l&&(l.addEventListener("mouseup",h),l.addEventListener("touchend",h),l.addEventListener("touchcancel",h)),i&&(i.addEventListener("mousedown",p),i.addEventListener("touchstart",p,{passive:!1})),n&&(n.addEventListener("mousemove",f),n.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",h),l.removeEventListener("touchend",h),l.removeEventListener("touchcancel",h)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},Jt=1024*1024,ia=(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/Jt).toFixed(2);return`File size (${(e.size/Jt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},na=(e,r,o,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=r(),g=ia(p,h);if(g){d(g),e.target.value="";return}const f=new FileReader;let O=null;const m=()=>{var b;const x=r(),$=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);$&&($.remove(),document.removeEventListener("keydown",y),O==null||O(),Kn(),l(),o(wt))},y=x=>{x.key==="Escape"&&r().sourceBase64&&S(x)},S=x=>{x.preventDefault(),m()},v=x=>{x.preventDefault();const $=r();ea(r).then(([b,L])=>{i(b,L,$),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const $=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}$.src=x.target.result,$.onerror=()=>{d("Failed to load image")},$.onload=()=>{var j;Wn(r,v,S),qn(),n("fileName",Zn),n("sourceBase64",Jn),n("portal",Qn);const b=kn(r,$),L=Pn(r,b);o({frame:b,portal:L,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:$.height,sourceWidth:$.width}),O=oa(r,o),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},aa=(e,r,o,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=Rn(r,o),p=Xn(h=>na(h,n,l,e,c,d,i));return{open:()=>p.click()}},le={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Qt="vacano-image-cropper-styles",la=`
|
|
1117
|
+
`,wn=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__${wn(e)}`,W=e=>e||[],U=(e,r)=>{if(r)for(const o of r)e.classList.add(o)},Rn=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=`
|
|
1118
|
+
${sn(r.applyButton[0])}
|
|
1119
|
+
${pn(r.body[0])}
|
|
1120
|
+
${un(r.cancelButton[0])}
|
|
1121
|
+
${hn(r.container[0])}
|
|
1122
|
+
${bn(r.footer[0])}
|
|
1123
|
+
${gn(r.header[0])}
|
|
1124
|
+
${fn(r.handlerMove[0])}
|
|
1125
|
+
${xn(r.portalArea[0])}
|
|
1126
|
+
${On(r.portal[0])}
|
|
1127
|
+
${$n(r.previewImage[0])}
|
|
1128
|
+
${Sn(r.preview[0])}
|
|
1129
|
+
${Ue(r.handlerResizeBottomLeft[0],"bl")}
|
|
1130
|
+
${Ue(r.handlerResizeBottomRight[0],"br")}
|
|
1131
|
+
${Ue(r.handlerResizeTopLeft[0],"tl")}
|
|
1132
|
+
${Ue(r.handlerResizeTopRight[0],"tr")}
|
|
1133
|
+
${vn(r.root[0])}
|
|
1134
|
+
${mn(r.sourceImage[0])}
|
|
1135
|
+
`,i=document.createElement("style");return i.innerHTML=o,document.getElementsByTagName("head")[0].prepend(i),r};let kn=0;const Ln=e=>{const r=new Map,o=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(r.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...o}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(o[n]=l)}},subscribe:(i,n)=>{const l=String(++kn),c=r.get(i)||[];return r.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of r.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){r.set(n,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"]}},Pn=(e={},r={})=>Ln({...wt,config:{...wt.config,...e},css:Rn(r)}),zn=(e,r)=>{var O;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!i)return o.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=r.width/r.height;let p,h,g=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(r.height/r.width),g=(l-h)/2),{width:p,height:h,left:f,top:g}},En=(e,r,o)=>{const[i,n]=r,l=i+e>o.width?(o.width-e)/2:i,c=n+e>o.height?(o.height-e)/2:n;return[l,c]},jn=(e,r)=>{const{config:o}=e(),i=Math.min(r.width,r.height)-o.framePadding*2,n=o.portalSize>i?i:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=En(n,o.portalPosition,r);return{left:l,top:c,size:n}}return o.portalPosition==="center"?{size:n,left:(r.width-n)/2,top:(r.height-n)/2}:{left:0,top:0,size:n}};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 Nn=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerMove),o.setAttribute("data-action",te.MOVE),o},Tn=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},In=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},An=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},_n=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},Dn=e=>{var i;const r=e(),o=document.createElement("img");return U(o,(i=r.css)==null?void 0:i.previewImage),o},Mn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.preview),o.appendChild(Dn(e)),o},Fn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.portal),o.appendChild(Mn(e)),o.appendChild(Nn(e)),o.appendChild(An(e)),o.appendChild(_n(e)),o.appendChild(Tn(e)),o.appendChild(In(e)),o},Bn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.portalArea),o.appendChild(Fn(e)),o},Yn=e=>{var i;const r=e(),o=document.createElement("img");return U(o,(i=r.css)==null?void 0:i.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Vn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.body),o.appendChild(Yn(e)),o.appendChild(Bn(e)),o},Hn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return U(i,(n=o.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=o.config.applyButtonLabel,i.addEventListener("click",r),i},Gn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return U(i,(n=o.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=o.config.cancelButtonLabel,i.addEventListener("click",r),i},Wn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.footer),n.appendChild(Gn(e,o)),n.appendChild(Hn(e,r)),n},Un=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.header),o},Xn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.container),n.appendChild(Un(e)),n.appendChild(Vn(e)),n.appendChild(Wn(e,r,o)),n},qn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");U(n,(l=i.css)==null?void 0:l.root),n.appendChild(Xn(e,r,o)),document.body.appendChild(n)},Kn=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},Ae=new Map,Zn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},pe=(e,r)=>{if(Ae.has(e))return Ae.get(e);if(!r)return null;const o=r[Zn[e]],i=document.querySelector(`.${o[0]}`);return Ae.set(e,i),i},Jn=()=>{Ae.clear()},Qn=()=>{Ae.clear()},ea=(e,r)=>{const o=pe("header",r.css);o&&(o.innerText=e)},ta=(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 i=pe("portalArea",r.css);i&&(i.style.height=`${r.frame.height}px`,i.style.width=`${r.frame.width}px`,i.style.left=`${r.frame.left}px`,i.style.top=`${r.frame.top}px`);const n=pe("portal",r.css);n&&(n.style.width=`${r.portal.size}px`,n.style.height=`${r.portal.size}px`,n.style.left=`${r.portal.left}px`,n.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`)},ra=(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 i=pe("previewImage",r.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},pt=1,oa=e=>{var m,y;const r=e(),o=document.createElement("canvas"),i=r.frame.width||pt,n=r.frame.height||pt,l=r.sourceWidth/i,c=r.sourceHeight/n,d=r.portal.left*l,p=r.portal.top*c,h=Math.max(r.portal.size*Math.min(l,c),pt),g=r.config.outputSize>0?r.config.outputSize:h;o.width=g,o.height=g;const f=document.querySelector(`.${(m=r.css)==null?void 0:m.sourceImage[0]}`);f&&((y=o.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,g,g));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((S,C)=>{try{o.toBlob(x=>{if(o.remove(),!x){C(new Error(`Failed to create blob for type: image/${r.config.type}`));return}S([O,x])},`image/${r.config.type}`,r.config.compression)}catch(x){o.remove(),C(x)}})},ia=(e,r,o)=>{const{emitted:i,portal:n,frame:l,config:c}=r();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,g=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>g&&(d=g),p<f&&(p=f),p>O&&(p=O),o({portal:{...n,left:d,top:p}})},na=(e,r,o)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=r(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let g=n.size+Math.max(p,h);return g<d.minPortalSize&&(g=d.minPortalSize),n.top+g>c.height-d.framePadding&&(g=c.height-n.top-d.framePadding),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding),o({portal:{...l,size:g}})}case te.RESIZE_TR:{let g=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return g<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,g=d.minPortalSize),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(g=n.top+n.size,f=d.framePadding),o({portal:{...l,top:f,size:g}})}case te.RESIZE_TL:{const g=Math.min(p,h);let f=n.size-g,O=n.left+g,m=n.top+g;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,m=n.top+y}if(m<d.framePadding){const y=d.framePadding-m;m=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,m=m+y,f=f-y}return o({portal:{...l,top:m,left:O,size:f}})}case te.RESIZE_BL:{let g=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return g<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,g=d.minPortalSize),g+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,g=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,g=n.left+n.size-d.framePadding),o({portal:{...l,left:f,size:g}})}default:return}},Zt=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}},aa=(e,r)=>{var O,m,y;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(m=o.css)==null?void 0:m.portalArea[0]}`),l=document.querySelector(`.${(y=o.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:C}=e(),x=Zt(S);if(S.target){const $=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:C.left,top:C.top,size:C.size};r({action:$,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&r({action:null})},g=()=>{if(c=null,!d)return;const S=d;d=null;const{action:C}=e();if(C)switch(C){case te.MOVE:ia(S,e,r);break;default:na(S,e,r)}},f=S=>{const{action:C}=e();C&&(S.preventDefault(),d=Zt(S),c===null&&(c=requestAnimationFrame(g)))};return l&&(l.addEventListener("mouseup",h),l.addEventListener("touchend",h),l.addEventListener("touchcancel",h)),i&&(i.addEventListener("mousedown",p),i.addEventListener("touchstart",p,{passive:!1})),n&&(n.addEventListener("mousemove",f),n.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",h),l.removeEventListener("touchend",h),l.removeEventListener("touchcancel",h)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},Jt=1024*1024,la=(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/Jt).toFixed(2);return`File size (${(e.size/Jt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},da=(e,r,o,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=r(),g=la(p,h);if(g){d(g),e.target.value="";return}const f=new FileReader;let O=null;const m=()=>{var b;const x=r(),$=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);$&&($.remove(),document.removeEventListener("keydown",y),O==null||O(),Qn(),l(),o(wt))},y=x=>{x.key==="Escape"&&r().sourceBase64&&S(x)},S=x=>{x.preventDefault(),m()},C=x=>{x.preventDefault();const $=r();oa(r).then(([b,L])=>{i(b,L,$),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const $=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}$.src=x.target.result,$.onerror=()=>{d("Failed to load image")},$.onload=()=>{var E;qn(r,C,S),Jn(),n("fileName",ea),n("sourceBase64",ta),n("portal",ra);const b=zn(r,$),L=jn(r,b);o({frame:b,portal:L,fileName:p.name,sourceBase64:(E=x.target)==null?void 0:E.result,sourceHeight:$.height,sourceWidth:$.width}),O=aa(r,o),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},ca=(e,r,o,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=Pn(r,o),p=Kn(h=>da(h,n,l,e,c,d,i));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"},Qt="vacano-image-cropper-styles",sa=`
|
|
1136
1136
|
.vacano-cropper-root {
|
|
1137
1137
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1138
1138
|
backdrop-filter: blur(4px);
|
|
@@ -1180,14 +1180,14 @@
|
|
|
1180
1180
|
.vacano-cropper-apply-button:hover {
|
|
1181
1181
|
background-color: ${t.COLORS["iron-grey"]};
|
|
1182
1182
|
}
|
|
1183
|
-
`,
|
|
1183
|
+
`,pa=()=>{if(typeof document>"u"||document.getElementById(Qt))return;const e=document.createElement("style");e.id=Qt,e.textContent=sa,document.head.appendChild(e)},ua={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"]},Pr=(e={})=>{const{allowedTypes:r=ae.allowedTypes,applyLabel:o=ae.applyLabel,cancelLabel:i=ae.cancelLabel,compression:n=ae.compression,maxFileSize:l=ae.maxFileSize,onCrop:c,onError:d,outputSize:p=ae.outputSize,portalSize:h=ae.portalSize,type:g=ae.type}=e,f=u.useRef(null);return{open:u.useCallback(()=>{f.current||(pa(),f.current=ca((m,y,S)=>{y&&(c==null||c({base64:m,blob:y,state:S}))},{portalSize:h,outputSize:p,compression:n,type:g,maxFileSize:l,allowedTypes:r,applyButtonLabel:o,cancelButtonLabel:i},ua,m=>{d==null||d({code:"CROPPER_ERROR",message:m})})),f.current.open()},[r,o,i,n,l,c,d,p,h,g])}},ut=A.newClassNameGetter("image-cropper"),ha=({allowedTypes:e,applyLabel:r,buttonLabel:o="Select Image",cancelLabel:i,className:n,classnames:l,compression:c,maxFileSize:d,onCrop:p,onError:h,outputSize:g,portalSize:f,previewSize:O=120,ref:m,type:y,value:S,...C})=>{const[x,$]=u.useState(S??null),{open:b}=Pr({allowedTypes:e,applyLabel:r,cancelLabel:i,compression:c,maxFileSize:d,onCrop:L=>{$(L.base64),p==null||p(L)},onError:h,outputSize:g,portalSize:f,type:y});return a.jsxs(ln,{...C,ref:m,className:ut("container",n),children:[a.jsx(dn,{$size:O,className:ut("preview",l==null?void 0:l.preview),children:x?a.jsx("img",{src:x,alt:"Preview"}):a.jsx(cn,{children:"No image"})}),a.jsx(De,{variant:"system",onClick:b,className:ut("button",l==null?void 0:l.button),style:{width:O},children:o})]})},er={compact:{height:"32px",padding:"0 10px",radius:"14px",prefixSize:"16px"},default:{height:"40px",padding:"0 14px",radius:"16px",prefixSize:"20px"}},tr={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=>tr[e]??tr.normal,ht=e=>er[e]??er.default,ba=s.div`
|
|
1184
1184
|
display: grid;
|
|
1185
1185
|
flex-direction: column;
|
|
1186
1186
|
gap: 2px;
|
|
1187
1187
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1188
|
-
`,
|
|
1188
|
+
`,ga=s(ie)`
|
|
1189
1189
|
margin-left: 6px;
|
|
1190
|
-
`,
|
|
1190
|
+
`,fa=s.input`
|
|
1191
1191
|
flex: 1;
|
|
1192
1192
|
min-width: 0;
|
|
1193
1193
|
outline: none;
|
|
@@ -1197,25 +1197,25 @@
|
|
|
1197
1197
|
padding: ${e=>ht(e.$size).padding};
|
|
1198
1198
|
border-radius: ${e=>ht(e.$size).radius};
|
|
1199
1199
|
|
|
1200
|
-
color: ${e=>
|
|
1201
|
-
border: 1px solid ${e=>
|
|
1202
|
-
background-color: ${e=>
|
|
1200
|
+
color: ${e=>le(e.$variant).color.static};
|
|
1201
|
+
border: 1px solid ${e=>le(e.$variant).border.static};
|
|
1202
|
+
background-color: ${e=>le(e.$variant).background.static};
|
|
1203
1203
|
|
|
1204
1204
|
&::placeholder {
|
|
1205
|
-
color: ${e=>
|
|
1205
|
+
color: ${e=>le(e.$variant).placeholder.static};
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
1208
|
&:disabled {
|
|
1209
1209
|
cursor: not-allowed;
|
|
1210
|
-
color: ${e=>
|
|
1211
|
-
background-color: ${e=>
|
|
1212
|
-
border-color: ${e=>
|
|
1210
|
+
color: ${e=>le(e.$variant).color.disabled};
|
|
1211
|
+
background-color: ${e=>le(e.$variant).background.disabled};
|
|
1212
|
+
border-color: ${e=>le(e.$variant).border.disabled};
|
|
1213
1213
|
|
|
1214
1214
|
&::placeholder {
|
|
1215
|
-
color: ${e=>
|
|
1215
|
+
color: ${e=>le(e.$variant).placeholder.disabled};
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
|
-
`,bt=A.newClassNameGetter("input"),
|
|
1218
|
+
`,bt=A.newClassNameGetter("input"),zr=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",...p})=>a.jsxs(ba,{className:bt("container",e),$fullWidth:!!i,children:[a.jsx(ga,{variant:d,className:bt("label",r==null?void 0:r.label),children:n}),a.jsx(fa,{...p,ref:l,disabled:o,$size:c,$variant:d,className:bt("input",r==null?void 0:r.input)})]}),xa=s.div`
|
|
1219
1219
|
position: fixed;
|
|
1220
1220
|
inset: 0;
|
|
1221
1221
|
z-index: 1000;
|
|
@@ -1224,7 +1224,7 @@
|
|
|
1224
1224
|
justify-content: center;
|
|
1225
1225
|
background-color: ${t.alpha(t.COLORS.black,50)};
|
|
1226
1226
|
animation: ${t.KEYFRAMES.fadeIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1227
|
-
`,
|
|
1227
|
+
`,Oa=s.div`
|
|
1228
1228
|
position: relative;
|
|
1229
1229
|
z-index: 1001;
|
|
1230
1230
|
width: ${e=>e.$width};
|
|
@@ -1235,21 +1235,21 @@
|
|
|
1235
1235
|
border-radius: 16px;
|
|
1236
1236
|
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1237
1237
|
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1238
|
-
`,rr=A.newClassNameGetter("modal"),
|
|
1238
|
+
`,rr=A.newClassNameGetter("modal"),Er=({animated:e,children:r,className:o,classnames:i,open:n,ref:l,width:c="500px",...d})=>n?ge.createPortal(a.jsx(xa,{className:rr("overlay",i==null?void 0:i.overlay),$animated:!!e,children:a.jsx(Oa,{...d,ref:l,className:rr("content",o,i==null?void 0:i.content),$animated:!!e,$width:c,children:r})}),document.body):null,jr={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},$a=s.div`
|
|
1239
1239
|
display: flex;
|
|
1240
1240
|
flex-direction: column;
|
|
1241
1241
|
gap: 4px;
|
|
1242
|
-
`,
|
|
1242
|
+
`,Sa=s(ie)`
|
|
1243
1243
|
margin-left: 6px;
|
|
1244
|
-
color: ${e=>
|
|
1245
|
-
`,
|
|
1244
|
+
color: ${e=>jr[e.$variant].label};
|
|
1245
|
+
`,ya=s.button`
|
|
1246
1246
|
display: flex;
|
|
1247
1247
|
flex-wrap: wrap;
|
|
1248
1248
|
align-items: center;
|
|
1249
1249
|
gap: 6px;
|
|
1250
1250
|
min-height: 44px;
|
|
1251
1251
|
padding: 8px 12px;
|
|
1252
|
-
border: 1px dashed ${e=>
|
|
1252
|
+
border: 1px dashed ${e=>jr[e.$variant].border};
|
|
1253
1253
|
border-radius: 8px;
|
|
1254
1254
|
background: ${t.COLORS.white};
|
|
1255
1255
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
@@ -1260,31 +1260,31 @@
|
|
|
1260
1260
|
&:hover:not(:disabled) {
|
|
1261
1261
|
border-color: ${e=>e.$variant==="error"?t.COLORS.red:t.COLORS.black};
|
|
1262
1262
|
}
|
|
1263
|
-
|
|
1263
|
+
`,Ca=s.span`
|
|
1264
1264
|
color: ${t.COLORS["iron-grey"]};
|
|
1265
1265
|
font-size: 14px;
|
|
1266
|
-
`,
|
|
1266
|
+
`,va=s.div`
|
|
1267
1267
|
display: flex;
|
|
1268
1268
|
flex-direction: column;
|
|
1269
1269
|
padding: 20px;
|
|
1270
1270
|
gap: 16px;
|
|
1271
|
-
`,
|
|
1271
|
+
`,ma=s.div`
|
|
1272
1272
|
display: flex;
|
|
1273
1273
|
align-items: center;
|
|
1274
1274
|
justify-content: space-between;
|
|
1275
|
-
`,
|
|
1275
|
+
`,wa=s.h3`
|
|
1276
1276
|
margin: 0;
|
|
1277
1277
|
font-size: 18px;
|
|
1278
1278
|
font-weight: 600;
|
|
1279
1279
|
color: ${t.COLORS.black};
|
|
1280
|
-
`,
|
|
1280
|
+
`,Ra=s.div`
|
|
1281
1281
|
display: flex;
|
|
1282
1282
|
flex-direction: column;
|
|
1283
1283
|
gap: 4px;
|
|
1284
1284
|
min-height: 200px;
|
|
1285
1285
|
max-height: 300px;
|
|
1286
1286
|
overflow-y: auto;
|
|
1287
|
-
`,
|
|
1287
|
+
`,ka=s.label`
|
|
1288
1288
|
display: flex;
|
|
1289
1289
|
align-items: center;
|
|
1290
1290
|
gap: 10px;
|
|
@@ -1297,10 +1297,10 @@
|
|
|
1297
1297
|
&:hover {
|
|
1298
1298
|
background-color: ${e=>e.$disabled?"transparent":t.COLORS.gray};
|
|
1299
1299
|
}
|
|
1300
|
-
`,
|
|
1300
|
+
`,La=s.span`
|
|
1301
1301
|
font-size: 14px;
|
|
1302
1302
|
color: ${t.COLORS.black};
|
|
1303
|
-
`,
|
|
1303
|
+
`,Pa=s.div`
|
|
1304
1304
|
display: flex;
|
|
1305
1305
|
align-items: center;
|
|
1306
1306
|
justify-content: center;
|
|
@@ -1308,16 +1308,63 @@
|
|
|
1308
1308
|
color: ${t.COLORS["iron-grey"]};
|
|
1309
1309
|
font-size: 14px;
|
|
1310
1310
|
text-align: center;
|
|
1311
|
-
`,Q=A.newClassNameGetter("multi-select"),
|
|
1311
|
+
`,Q=A.newClassNameGetter("multi-select"),za=({className:e,classnames:r,disabled:o=!1,emptyMessage:i="No options found",label:n,maxVisible:l=1/0,modalTitle:c="Select options",onChange:d,options:p,placeholder:h="Select...",ref:g,searchPlaceholder:f="Search...",value:O,variant:m="normal",...y})=>{const[S,C]=u.useState(!1),[x,$]=u.useState(""),b=u.useMemo(()=>p.filter(w=>O.includes(w.value)),[p,O]),L=u.useMemo(()=>{if(!x.trim())return p;const w=x.toLowerCase().trim();return p.filter(M=>M.label.toLowerCase().includes(w))},[p,x]),E=l===1/0?b:b.slice(0,l),T=b.length-E.length,V=()=>{o||(C(!0),$(""))},z=()=>{C(!1),$("")},D=w=>{O.includes(w)?d(O.filter(M=>M!==w)):d([...O,w])},j=w=>{d(O.filter(M=>M!==w))};return a.jsxs($a,{...y,ref:g,className:Q("container",e),children:[n&&a.jsx(Sa,{$variant:m,className:Q("label",r==null?void 0:r.trigger),children:n}),a.jsx(ya,{type:"button",$variant:m,$disabled:o,disabled:o,onClick:V,className:Q("trigger",r==null?void 0:r.trigger),children:b.length===0?a.jsx(Ca,{className:Q("placeholder",r==null?void 0:r.placeholder),children:h}):a.jsxs(a.Fragment,{children:[E.map(w=>a.jsx(Qe,{deletable:!0,onDelete:()=>j(w.value),onClick:M=>M.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:w.label},w.value)),T>0&&a.jsxs(Qe,{variant:"gray",onClick:w=>w.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:["+",T]})]})}),a.jsx(Er,{open:S,width:"400px",animated:!0,className:Q("modal",r==null?void 0:r.modal),children:a.jsxs(va,{children:[a.jsxs(ma,{children:[a.jsx(wa,{children:c}),a.jsx(De,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:z})]}),a.jsx(zr,{type:"text",value:x,onChange:w=>$(w.target.value),placeholder:f,autoFocus:!0,fullWidth:!0,className:Q("search",r==null?void 0:r.search)}),a.jsx(Ra,{className:Q("options",r==null?void 0:r.options),children:L.length===0?a.jsx(Pa,{className:Q("empty",r==null?void 0:r.empty),children:i}):L.map(w=>a.jsxs(ka,{$disabled:!!w.disabled,className:Q("option",r==null?void 0:r.option),children:[a.jsx(tt,{checked:O.includes(w.value),disabled:w.disabled,onChange:()=>D(w.value)}),a.jsx(La,{children:w.label})]},w.value))})]})})]})},Ea=5e3,or={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),ir=e=>or[e]??or.default,ja=s.div`
|
|
1312
|
+
position: fixed;
|
|
1313
|
+
top: 0;
|
|
1314
|
+
left: 0;
|
|
1315
|
+
right: 0;
|
|
1316
|
+
z-index: 9999;
|
|
1317
|
+
pointer-events: none;
|
|
1318
|
+
`,Na=s.div`
|
|
1319
|
+
display: flex;
|
|
1320
|
+
align-items: center;
|
|
1321
|
+
justify-content: center;
|
|
1322
|
+
gap: 12px;
|
|
1323
|
+
min-height: 44px;
|
|
1324
|
+
padding: 12px 48px;
|
|
1325
|
+
background-color: ${({$variant:e})=>ir(e).background};
|
|
1326
|
+
color: ${({$variant:e})=>ir(e).text};
|
|
1327
|
+
animation: ${({$isExiting:e})=>e?t.KEYFRAMES.slideOutTopFade:t.KEYFRAMES.slideInTopFade}
|
|
1328
|
+
0.3s ease-out forwards;
|
|
1329
|
+
pointer-events: auto;
|
|
1330
|
+
`,Ta=s.span`
|
|
1331
|
+
font-size: 14px;
|
|
1332
|
+
font-weight: 500;
|
|
1333
|
+
line-height: 1.4;
|
|
1334
|
+
text-align: center;
|
|
1335
|
+
`,Ia=s.button`
|
|
1336
|
+
position: absolute;
|
|
1337
|
+
right: 16px;
|
|
1338
|
+
top: 50%;
|
|
1339
|
+
transform: translateY(-50%);
|
|
1340
|
+
display: flex;
|
|
1341
|
+
align-items: center;
|
|
1342
|
+
justify-content: center;
|
|
1343
|
+
width: 24px;
|
|
1344
|
+
height: 24px;
|
|
1345
|
+
padding: 0;
|
|
1346
|
+
background: transparent;
|
|
1347
|
+
border: none;
|
|
1348
|
+
color: inherit;
|
|
1349
|
+
cursor: pointer;
|
|
1350
|
+
opacity: 0.7;
|
|
1351
|
+
transition: opacity 0.2s ease-in-out;
|
|
1352
|
+
|
|
1353
|
+
&:hover {
|
|
1354
|
+
opacity: 1;
|
|
1355
|
+
}
|
|
1356
|
+
`,Aa=s.div`
|
|
1357
|
+
position: relative;
|
|
1358
|
+
`,_a=({notification:e,onRemove:r,onAnimationEnd:o})=>{const[i,n]=u.useState(!1),l=()=>{n(!0)},c=()=>{i&&(r(),o())};return u.useEffect(()=>{const d=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(d)},[e.duration,e.id]),a.jsx(Aa,{children:a.jsxs(Na,{$variant:e.variant,$isExiting:i,onAnimationEnd:c,children:[a.jsx(Ta,{children:e.message}),a.jsx(Ia,{onClick:l,children:a.jsx(a.X,{style:{width:18,height:18}})})]})})},Da=(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}},Ma={current:null,queue:[]},Fa=({children:e})=>{const[r,o]=u.useReducer(Da,Ma),i=u.useCallback((d,p="default",h=Ea)=>{const g=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_NOTIFICATION",payload:{id:g,message:d,variant:p,duration:h}})},[]),n=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:i,hide:n},children:[e,a.jsx(ja,{children:r.current&&a.jsx(_a,{notification:r.current,onRemove:l,onAnimationEnd:c},r.current.id)})]})},Ba=()=>{const e=u.useContext(Nr);if(!e)throw new Error("useNotification must be used within NotificationProvider");return e},nr={compact:{width:"36px",height:"40px",fontSize:"16px",radius:"10px",gap:"8px"},default:{width:"44px",height:"52px",fontSize:"20px",radius:"12px",gap:"10px"}},ar={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)}},Ie=e=>nr[e]??nr.default,$e=e=>ar[e]??ar.normal,Ya=s.div`
|
|
1312
1359
|
display: inline-flex;
|
|
1313
1360
|
flex-direction: column;
|
|
1314
1361
|
gap: 2px;
|
|
1315
|
-
`,
|
|
1362
|
+
`,Va=s(ie)`
|
|
1316
1363
|
margin-left: 6px;
|
|
1317
|
-
`,
|
|
1364
|
+
`,Ha=s.div`
|
|
1318
1365
|
display: flex;
|
|
1319
1366
|
gap: ${e=>Ie(e.$size).gap};
|
|
1320
|
-
`,
|
|
1367
|
+
`,Ga=s.input`
|
|
1321
1368
|
width: ${e=>Ie(e.$size).width};
|
|
1322
1369
|
height: ${e=>Ie(e.$size).height};
|
|
1323
1370
|
border-radius: ${e=>Ie(e.$size).radius};
|
|
@@ -1342,7 +1389,7 @@
|
|
|
1342
1389
|
&::selection {
|
|
1343
1390
|
background-color: transparent;
|
|
1344
1391
|
}
|
|
1345
|
-
`,gt=A.newClassNameGetter("otp-code"),
|
|
1392
|
+
`,gt=A.newClassNameGetter("otp-code"),Wa=({autoFocus:e,className:r,classnames:o,disabled:i,label:n,length:l=6,onChange:c,ref:d,size:p="default",value:h="",variant:g="normal",...f})=>{const O=u.useRef([]);u.useEffect(()=>{e&&O.current[0]&&O.current[0].focus()},[e]);const m=u.useCallback(x=>{const $=O.current[x];$&&($.focus(),$.select())},[]),y=u.useCallback((x,$)=>{const L=$.target.value.replace(/\D/g,"").slice(-1);if(!L)return;const E=h.padEnd(l," ").split(""),T=E.findIndex(j=>j===" "||j===""),V=T!==-1?T:x;E[V]=L;const z=E.join("").replace(/ /g,"");c==null||c(z);const D=V+1;D<l&&m(D)},[h,l,c,m]),S=u.useCallback((x,$)=>{if($.key==="Backspace"){$.preventDefault();const b=h.split("");b[x]?(b[x]="",c==null||c(b.join(""))):x>0&&(b[x-1]="",c==null||c(b.join("")),m(x-1))}else $.key==="ArrowLeft"&&x>0?($.preventDefault(),m(x-1)):$.key==="ArrowRight"&&x<l-1&&($.preventDefault(),m(x+1))},[h,l,c,m]),C=u.useCallback(x=>{x.preventDefault();const $=x.clipboardData.getData("text").replace(/\D/g,"").slice(0,l);if($){c==null||c($);const b=Math.min($.length,l-1);m(b)}},[l,c,m]);return a.jsxs(Ya,{ref:d,className:gt("container",r),...f,children:[n&&a.jsx(Va,{variant:g,className:gt("label",o==null?void 0:o.label),children:n}),a.jsx(Ha,{$size:p,children:Array.from({length:l}).map((x,$)=>a.jsx(Ga,{ref:b=>{O.current[$]=b},type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:2,disabled:i,value:h[$]??"",onChange:b=>y($,b),onKeyDown:b=>S($,b),onPaste:C,onFocus:b=>b.target.select(),$size:p,$variant:g,className:gt("input",o==null?void 0:o.input)},$))})]})},lr={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"}},et=e=>lr[e]??lr.light,Ua=s.div`
|
|
1346
1393
|
display: flex;
|
|
1347
1394
|
flex-direction: column;
|
|
1348
1395
|
gap: 16px;
|
|
@@ -1350,48 +1397,48 @@
|
|
|
1350
1397
|
border: 1px dashed ${({$variant:e})=>et(e).border};
|
|
1351
1398
|
border-radius: 16px;
|
|
1352
1399
|
background-color: ${({$variant:e})=>et(e).background};
|
|
1353
|
-
`,
|
|
1400
|
+
`,Xa=s.div`
|
|
1354
1401
|
display: flex;
|
|
1355
1402
|
flex-direction: column;
|
|
1356
1403
|
gap: 4px;
|
|
1357
|
-
`,
|
|
1404
|
+
`,qa=s.div`
|
|
1358
1405
|
font-size: 18px;
|
|
1359
1406
|
font-weight: 600;
|
|
1360
1407
|
line-height: 1.4;
|
|
1361
1408
|
color: ${({$variant:e})=>et(e).title};
|
|
1362
|
-
`,
|
|
1409
|
+
`,Ka=s.div`
|
|
1363
1410
|
font-size: 14px;
|
|
1364
1411
|
line-height: 1.5;
|
|
1365
1412
|
color: ${({$variant:e})=>et(e).description};
|
|
1366
|
-
`,
|
|
1413
|
+
`,Za=s.div`
|
|
1367
1414
|
display: flex;
|
|
1368
1415
|
flex-wrap: wrap;
|
|
1369
1416
|
gap: 8px;
|
|
1370
|
-
`,
|
|
1417
|
+
`,Xe=A.newClassNameGetter("panel"),Ja=({children:e,className:r,classnames:o,description:i,ref:n,title:l,variant:c="light",...d})=>{const p=l||i;return a.jsxs(Ua,{...d,ref:n,className:Xe("container",r),$variant:c,children:[p&&a.jsxs(Xa,{children:[l&&a.jsx(qa,{className:Xe("title",o==null?void 0:o.title),$variant:c,children:l}),i&&a.jsx(Ka,{className:Xe("description",o==null?void 0:o.description),$variant:c,children:i})]}),a.jsx(Za,{className:Xe("content",o==null?void 0:o.content),children:e})]})},Rt={compact:{height:4,radius:2},default:{height:8,radius:4}},Qa=s.div`
|
|
1371
1418
|
width: 100%;
|
|
1372
1419
|
height: ${({$size:e})=>Rt[e].height}px;
|
|
1373
1420
|
border-radius: ${({$size:e})=>Rt[e].radius}px;
|
|
1374
1421
|
background-color: ${t.COLORS.gray};
|
|
1375
1422
|
overflow: hidden;
|
|
1376
|
-
`,
|
|
1423
|
+
`,el=s.div`
|
|
1377
1424
|
height: 100%;
|
|
1378
1425
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1379
1426
|
border-radius: ${({$size:e})=>Rt[e].radius}px;
|
|
1380
1427
|
background-color: ${t.COLORS.black};
|
|
1381
1428
|
transition: width 0.2s ease;
|
|
1382
|
-
`,
|
|
1429
|
+
`,dr=A.newClassNameGetter("progress"),tl=({value:e,size:r="default",className:o,classnames:i,ref:n,...l})=>a.jsx(Qa,{...l,ref:n,$size:r,className:dr("track",o,i==null?void 0:i.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(el,{$size:r,$value:e,className:dr("bar",i==null?void 0:i.bar)})}),cr={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=>cr[e]??cr.normal,rl=s.label`
|
|
1383
1430
|
display: inline-flex;
|
|
1384
1431
|
align-items: flex-start;
|
|
1385
1432
|
gap: 8px;
|
|
1386
1433
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1387
1434
|
opacity: ${e=>e.$disabled?.5:1};
|
|
1388
|
-
`,
|
|
1435
|
+
`,ol=s.input`
|
|
1389
1436
|
position: absolute;
|
|
1390
1437
|
opacity: 0;
|
|
1391
1438
|
width: 0;
|
|
1392
1439
|
height: 0;
|
|
1393
1440
|
pointer-events: none;
|
|
1394
|
-
`,
|
|
1441
|
+
`,il=s.span`
|
|
1395
1442
|
display: inline-flex;
|
|
1396
1443
|
align-items: center;
|
|
1397
1444
|
justify-content: center;
|
|
@@ -1400,27 +1447,27 @@
|
|
|
1400
1447
|
height: 18px;
|
|
1401
1448
|
border-radius: 50%;
|
|
1402
1449
|
border: 1.5px solid
|
|
1403
|
-
${e=>e.$checked?
|
|
1404
|
-
background-color: ${e=>e.$checked?
|
|
1450
|
+
${e=>e.$checked?Ce(e.$variant).box.borderChecked:Ce(e.$variant).box.border};
|
|
1451
|
+
background-color: ${e=>e.$checked?Ce(e.$variant).box.backgroundChecked:Ce(e.$variant).box.background};
|
|
1405
1452
|
transition:
|
|
1406
1453
|
border-color 0.15s ease,
|
|
1407
1454
|
background-color 0.15s ease,
|
|
1408
1455
|
box-shadow 0.15s ease;
|
|
1409
|
-
`,
|
|
1456
|
+
`,nl=s.span`
|
|
1410
1457
|
width: 8px;
|
|
1411
1458
|
height: 8px;
|
|
1412
1459
|
border-radius: 50%;
|
|
1413
|
-
background-color: ${e=>
|
|
1460
|
+
background-color: ${e=>Ce(e.$variant).dot};
|
|
1414
1461
|
opacity: ${e=>e.$visible?1:0};
|
|
1415
1462
|
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
1416
1463
|
transition:
|
|
1417
1464
|
opacity 0.15s ease,
|
|
1418
1465
|
transform 0.15s ease;
|
|
1419
|
-
`,
|
|
1466
|
+
`,al=s.span`
|
|
1420
1467
|
font-size: 14px;
|
|
1421
1468
|
font-weight: 500;
|
|
1422
1469
|
line-height: 1.5;
|
|
1423
|
-
color: ${e=>
|
|
1470
|
+
color: ${e=>Ce(e.$variant).label};
|
|
1424
1471
|
user-select: none;
|
|
1425
1472
|
|
|
1426
1473
|
a {
|
|
@@ -1432,15 +1479,15 @@
|
|
|
1432
1479
|
text-decoration: none;
|
|
1433
1480
|
}
|
|
1434
1481
|
}
|
|
1435
|
-
`,
|
|
1482
|
+
`,je=A.newClassNameGetter("radio"),Pt=({checked:e,className:r,classnames:o,disabled:i,label:n,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(rl,{className:je("container",r),$disabled:!!i,$variant:d,children:[a.jsx(ol,{...p,ref:c,type:"radio",className:je("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:l}),a.jsx(il,{className:je("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(nl,{className:je("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),n&&a.jsx(al,{className:je("label",o==null?void 0:o.label),$variant:d,children:n})]}),sr={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=>sr[e]??sr.normal,ll=s.label`
|
|
1436
1483
|
display: grid;
|
|
1437
1484
|
grid-template-columns: auto 1fr;
|
|
1438
1485
|
align-items: start;
|
|
1439
1486
|
gap: 8px;
|
|
1440
1487
|
padding: 12px;
|
|
1441
|
-
background-color: ${e=>{const r=
|
|
1488
|
+
background-color: ${e=>{const r=he(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
1442
1489
|
border: 1px solid
|
|
1443
|
-
${e=>{const r=
|
|
1490
|
+
${e=>{const r=he(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
1444
1491
|
border-radius: 12px;
|
|
1445
1492
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1446
1493
|
transition:
|
|
@@ -1450,13 +1497,13 @@
|
|
|
1450
1497
|
min-width: 0;
|
|
1451
1498
|
|
|
1452
1499
|
&:hover:not([data-disabled='true']) {
|
|
1453
|
-
border-color: ${e=>{const r=
|
|
1500
|
+
border-color: ${e=>{const r=he(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
1454
1501
|
}
|
|
1455
1502
|
|
|
1456
1503
|
.vacano_radio_container {
|
|
1457
1504
|
pointer-events: none;
|
|
1458
1505
|
}
|
|
1459
|
-
`,
|
|
1506
|
+
`,dl=s.input`
|
|
1460
1507
|
position: absolute;
|
|
1461
1508
|
width: 1px;
|
|
1462
1509
|
height: 1px;
|
|
@@ -1466,44 +1513,44 @@
|
|
|
1466
1513
|
clip: rect(0, 0, 0, 0);
|
|
1467
1514
|
white-space: nowrap;
|
|
1468
1515
|
border: 0;
|
|
1469
|
-
`,
|
|
1516
|
+
`,cl=s.div`
|
|
1470
1517
|
display: flex;
|
|
1471
1518
|
flex-direction: column;
|
|
1472
1519
|
gap: 2px;
|
|
1473
1520
|
min-width: 0;
|
|
1474
|
-
`,
|
|
1521
|
+
`,sl=s.span`
|
|
1475
1522
|
font-size: 14px;
|
|
1476
1523
|
font-weight: 500;
|
|
1477
1524
|
line-height: 1.4;
|
|
1478
|
-
color: ${e=>
|
|
1525
|
+
color: ${e=>he(e.$variant).label.static};
|
|
1479
1526
|
|
|
1480
1527
|
label[data-disabled='true'] & {
|
|
1481
|
-
color: ${e=>
|
|
1528
|
+
color: ${e=>he(e.$variant).label.disabled};
|
|
1482
1529
|
}
|
|
1483
|
-
`,
|
|
1530
|
+
`,pl=s.span`
|
|
1484
1531
|
font-size: 12px;
|
|
1485
1532
|
font-weight: 400;
|
|
1486
1533
|
line-height: 1.4;
|
|
1487
|
-
color: ${e=>
|
|
1534
|
+
color: ${e=>he(e.$variant).description.static};
|
|
1488
1535
|
|
|
1489
1536
|
label[data-disabled='true'] & {
|
|
1490
|
-
color: ${e=>
|
|
1537
|
+
color: ${e=>he(e.$variant).description.disabled};
|
|
1491
1538
|
}
|
|
1492
|
-
`,qe=A.newClassNameGetter("radio-card"),
|
|
1539
|
+
`,qe=A.newClassNameGetter("radio-card"),ul=({checked:e,className:r,classnames:o,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...g})=>a.jsxs(ll,{className:qe("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(dl,{...g,ref:p,type:"radio",checked:e,disabled:n,onChange:d}),a.jsx(Pt,{className:o==null?void 0:o.radio,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(cl,{className:qe("content",o==null?void 0:o.content),children:[a.jsx(sl,{className:qe("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(pl,{className:qe("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),pr={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},hl=s.div`
|
|
1493
1540
|
display: flex;
|
|
1494
1541
|
flex-direction: column;
|
|
1495
1542
|
gap: 8px;
|
|
1496
|
-
`,
|
|
1543
|
+
`,bl=s.span`
|
|
1497
1544
|
font-size: 13px;
|
|
1498
1545
|
font-weight: 500;
|
|
1499
1546
|
line-height: 1.5;
|
|
1500
|
-
color: ${e=>e.$disabled?
|
|
1547
|
+
color: ${e=>e.$disabled?pr.label.disabledColor:pr.label.color};
|
|
1501
1548
|
margin-bottom: 4px;
|
|
1502
|
-
`,
|
|
1549
|
+
`,gl=s.div`
|
|
1503
1550
|
display: flex;
|
|
1504
1551
|
flex-direction: column;
|
|
1505
1552
|
gap: 12px;
|
|
1506
|
-
`,ft=A.newClassNameGetter("radio-group"),
|
|
1553
|
+
`,ft=A.newClassNameGetter("radio-group"),fl=({className:e,classnames:r,disabled:o,label:i,name:n,onChange:l,options:c,ref:d,value:p,...h})=>a.jsxs(hl,{...h,ref:d,className:ft("container",e),children:[i&&a.jsx(bl,{className:ft("label",r==null?void 0:r.label),$disabled:o,children:i}),a.jsx(gl,{className:ft("options",r==null?void 0:r.options),children:c.map(g=>a.jsx(Pt,{className:r==null?void 0:r.radio,name:n,checked:p===g.value,label:g.label,disabled:o,onChange:()=>l(g.value)},g.value))})]}),Tr=u.createContext(null),xl=s.div`
|
|
1507
1554
|
position: fixed;
|
|
1508
1555
|
bottom: 24px;
|
|
1509
1556
|
right: 24px;
|
|
@@ -1518,19 +1565,19 @@
|
|
|
1518
1565
|
animation: ${t.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1519
1566
|
pointer-events: none;
|
|
1520
1567
|
color: ${t.COLORS.black};
|
|
1521
|
-
`,
|
|
1568
|
+
`,Ol=s.span`
|
|
1522
1569
|
font-size: 14px;
|
|
1523
1570
|
font-weight: 500;
|
|
1524
1571
|
white-space: nowrap;
|
|
1525
|
-
|
|
1572
|
+
`,$l=({children:e,defaultMessage:r="Saving"})=>{const[o,i]=u.useState(!1),[n,l]=u.useState(r),c=u.useCallback(h=>{l(h??r),i(!0)},[r]),d=u.useCallback(()=>{i(!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(xl,{children:[a.jsx(Lt,{size:"sm"}),a.jsx(Ol,{children:n})]})]})},Sl=()=>{const e=u.useContext(Tr);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},xt=40,Ne=4,ur={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},hr={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)}},Ot=e=>ur[e]??ur.default,se=e=>hr[e]??hr.normal,yl=s.div`
|
|
1526
1573
|
position: relative;
|
|
1527
1574
|
display: grid;
|
|
1528
1575
|
gap: 2px;
|
|
1529
1576
|
min-width: 180px;
|
|
1530
1577
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1531
|
-
`,
|
|
1578
|
+
`,Cl=s(ie)`
|
|
1532
1579
|
margin-left: 6px;
|
|
1533
|
-
`,
|
|
1580
|
+
`,vl=s.button`
|
|
1534
1581
|
display: flex;
|
|
1535
1582
|
align-items: center;
|
|
1536
1583
|
justify-content: space-between;
|
|
@@ -1545,39 +1592,39 @@
|
|
|
1545
1592
|
padding: ${e=>Ot(e.$size).padding};
|
|
1546
1593
|
border-radius: ${e=>Ot(e.$size).radius};
|
|
1547
1594
|
|
|
1548
|
-
color: ${e=>e.$hasValue?e.$disabled?
|
|
1595
|
+
color: ${e=>e.$hasValue?e.$disabled?se(e.$variant).color.disabled:se(e.$variant).color.static:se(e.$variant).placeholder};
|
|
1549
1596
|
border: 1px solid
|
|
1550
|
-
${e=>e.$disabled?
|
|
1551
|
-
background-color: ${e=>e.$disabled?
|
|
1552
|
-
`,
|
|
1597
|
+
${e=>e.$disabled?se(e.$variant).border.disabled:se(e.$variant).border.static};
|
|
1598
|
+
background-color: ${e=>e.$disabled?se(e.$variant).background.disabled:se(e.$variant).background.static};
|
|
1599
|
+
`,ml=s.span`
|
|
1553
1600
|
flex: 1;
|
|
1554
1601
|
min-width: 0;
|
|
1555
1602
|
overflow: hidden;
|
|
1556
1603
|
text-overflow: ellipsis;
|
|
1557
1604
|
white-space: nowrap;
|
|
1558
|
-
`,
|
|
1605
|
+
`,wl=s.span`
|
|
1559
1606
|
display: flex;
|
|
1560
1607
|
align-items: center;
|
|
1561
1608
|
justify-content: center;
|
|
1562
1609
|
flex-shrink: 0;
|
|
1563
1610
|
transition: transform 0.2s ease;
|
|
1564
1611
|
transform: rotate(${e=>e.$open?"180deg":"0deg"});
|
|
1565
|
-
`,
|
|
1612
|
+
`,Ir=`
|
|
1566
1613
|
padding: 4px;
|
|
1567
1614
|
background: ${t.COLORS.white};
|
|
1568
1615
|
border: 1px solid ${t.alpha(t.COLORS.black,10)};
|
|
1569
1616
|
border-radius: 16px;
|
|
1570
1617
|
box-shadow: 0 4px 20px ${t.alpha(t.COLORS.black,15)};
|
|
1571
1618
|
z-index: 1000;
|
|
1572
|
-
`,
|
|
1619
|
+
`,Rl=s.div`
|
|
1573
1620
|
position: absolute;
|
|
1574
1621
|
left: -4px;
|
|
1575
1622
|
width: calc(100% + 8px);
|
|
1576
|
-
${
|
|
1577
|
-
`,
|
|
1623
|
+
${Ir}
|
|
1624
|
+
`,kl=s.div`
|
|
1578
1625
|
position: fixed;
|
|
1579
|
-
${
|
|
1580
|
-
`,
|
|
1626
|
+
${Ir}
|
|
1627
|
+
`,Ll=s.button`
|
|
1581
1628
|
display: flex;
|
|
1582
1629
|
align-items: center;
|
|
1583
1630
|
justify-content: space-between;
|
|
@@ -1598,13 +1645,13 @@
|
|
|
1598
1645
|
&:hover:not(:disabled) {
|
|
1599
1646
|
background: ${t.alpha(t.COLORS.black,8)};
|
|
1600
1647
|
}
|
|
1601
|
-
`,
|
|
1648
|
+
`,Pl=s.span`
|
|
1602
1649
|
display: flex;
|
|
1603
1650
|
align-items: center;
|
|
1604
1651
|
justify-content: center;
|
|
1605
1652
|
flex-shrink: 0;
|
|
1606
1653
|
color: ${t.COLORS.black};
|
|
1607
|
-
`,Se=A.newClassNameGetter("select"),
|
|
1654
|
+
`,Se=A.newClassNameGetter("select"),zl=({className:e,classnames:r,disabled:o=!1,fullWidth:i=!1,label:n,onChange:l,options:c,placeholder:d="Select...",portalRenderNode:p,ref:h,size:g="default",value:f,variant:O="normal",...m})=>{const[y,S]=u.useState(!1),[C,x]=u.useState({top:0,left:0,width:0}),$=u.useRef(null),b=u.useRef(null),L=u.useRef(null),E=c.find(v=>v.value===f),T=Math.max(0,c.findIndex(v=>v.value===f)),V=-(T*xt+Ne),z=()=>{if(!b.current||!p)return;const v=b.current.getBoundingClientRect(),I=T*xt+Ne;let k=v.top-I;const N=c.length*xt+Ne*2,F=8,B=window.innerHeight-N-8;k<F&&(k=F),k>B&&(k=B),x({top:k,left:v.left-Ne,width:v.width+Ne*2})},D=v=>{var I;l==null||l(v),S(!1),(I=b.current)==null||I.focus()},j=v=>{o||(v.key==="Enter"||v.key===" "?(v.preventDefault(),S(I=>!I)):v.key==="Escape"&&y?(v.preventDefault(),S(!1)):v.key==="ArrowDown"&&!y&&(v.preventDefault(),S(!0)))};u.useLayoutEffect(()=>{y&&p&&z()},[y,p,T,c.length]),u.useEffect(()=>{if(!y)return;const v=N=>{const F=N.target,B=$.current&&!$.current.contains(F),H=L.current&&!L.current.contains(F);p?B&&H&&S(!1):B&&S(!1)},I=()=>{p&&z()},k=()=>{p&&z()};return document.addEventListener("mousedown",v),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",k)),()=>{document.removeEventListener("mousedown",v),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",k)}},[y,p]);const w=()=>c.map(v=>a.jsxs(Ll,{type:"button",role:"option",$selected:v.value===f,$disabled:v.disabled??!1,disabled:v.disabled,"aria-selected":v.value===f,onClick:()=>D(v.value),className:Se("option",r==null?void 0:r.option),children:[a.jsx("span",{children:v.label}),v.value===f&&a.jsx(Pl,{children:a.jsx(a.Check,{size:16})})]},v.value)),M=p?ge.createPortal(a.jsx(kl,{ref:L,role:"listbox",style:{top:C.top,left:C.left,width:C.width},className:Se("dropdown",r==null?void 0:r.dropdown),children:w()}),p):a.jsx(Rl,{ref:L,role:"listbox",style:{top:V},className:Se("dropdown",r==null?void 0:r.dropdown),children:w()});return a.jsxs(yl,{...m,ref:v=>{$.current=v,typeof h=="function"?h(v):h&&(h.current=v)},$fullWidth:i,className:Se("container",e),children:[n&&a.jsx(Cl,{className:Se("label",r==null?void 0:r.label),children:n}),a.jsxs(vl,{ref:b,type:"button",$size:g,$variant:O,$disabled:o,$hasValue:!!E,disabled:o,onClick:()=>!o&&S(v=>!v),onKeyDown:j,"aria-haspopup":"listbox","aria-expanded":y,className:Se("trigger",r==null?void 0:r.trigger),children:[a.jsx(ml,{children:(E==null?void 0:E.label)??d}),a.jsx(wl,{$open:y,children:a.jsx(a.ChevronDown,{size:16})})]}),y&&M]})},br={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},El=e=>br[e]??br.neutral,jl=s.div`
|
|
1608
1655
|
display: flex;
|
|
1609
1656
|
flex-direction: column;
|
|
1610
1657
|
gap: 4px;
|
|
@@ -1613,16 +1660,16 @@
|
|
|
1613
1660
|
border-radius: 16px;
|
|
1614
1661
|
border: ${({$border:e})=>e?"1px solid #e5e7eb":"none"};
|
|
1615
1662
|
box-shadow: ${({$shadow:e})=>e?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"none"};
|
|
1616
|
-
|
|
1663
|
+
`,Nl=s.div`
|
|
1617
1664
|
display: flex;
|
|
1618
1665
|
align-items: center;
|
|
1619
1666
|
justify-content: space-between;
|
|
1620
1667
|
gap: 8px;
|
|
1621
|
-
`,
|
|
1668
|
+
`,Tl=s.p`
|
|
1622
1669
|
margin: 0;
|
|
1623
1670
|
font-size: 13px;
|
|
1624
1671
|
color: ${t.COLORS["iron-grey"]};
|
|
1625
|
-
`,
|
|
1672
|
+
`,Il=s.div`
|
|
1626
1673
|
display: flex;
|
|
1627
1674
|
align-items: center;
|
|
1628
1675
|
justify-content: center;
|
|
@@ -1636,21 +1683,21 @@
|
|
|
1636
1683
|
width: 18px;
|
|
1637
1684
|
height: 18px;
|
|
1638
1685
|
}
|
|
1639
|
-
`,
|
|
1686
|
+
`,Al=s.h3`
|
|
1640
1687
|
margin: 0;
|
|
1641
1688
|
font-size: 28px;
|
|
1642
1689
|
font-weight: 600;
|
|
1643
1690
|
line-height: 1.2;
|
|
1644
1691
|
color: ${t.COLORS.black};
|
|
1645
|
-
`,
|
|
1692
|
+
`,_l=s.p`
|
|
1646
1693
|
margin: 0;
|
|
1647
1694
|
font-size: 12px;
|
|
1648
|
-
color: ${({$variant:e})=>
|
|
1649
|
-
`,Ke=A.newClassNameGetter("status-card"),
|
|
1695
|
+
color: ${({$variant:e})=>El(e)};
|
|
1696
|
+
`,Ke=A.newClassNameGetter("status-card"),Dl=({border:e=!1,className:r,classnames:o,icon:i,label:n,ref:l,shadow:c=!1,trend:d,trendVariant:p="neutral",value:h,...g})=>a.jsxs(jl,{...g,ref:l,className:Ke("container",r),$border:e,$shadow:c,children:[a.jsxs(Nl,{children:[a.jsx(Tl,{className:Ke("label",o==null?void 0:o.label),children:n}),i&&a.jsx(Il,{children:i})]}),a.jsx(Al,{className:Ke("value",o==null?void 0:o.value),children:h}),d&&a.jsx(_l,{className:Ke("trend",o==null?void 0:o.trend),$variant:p,children:d})]}),Ml=s.div`
|
|
1650
1697
|
display: flex;
|
|
1651
1698
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1652
1699
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1653
|
-
`,
|
|
1700
|
+
`,Fl=s.div`
|
|
1654
1701
|
display: flex;
|
|
1655
1702
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1656
1703
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1659,7 +1706,7 @@
|
|
|
1659
1706
|
&:last-child {
|
|
1660
1707
|
flex: 0;
|
|
1661
1708
|
}
|
|
1662
|
-
`,
|
|
1709
|
+
`,Bl=s.button`
|
|
1663
1710
|
display: flex;
|
|
1664
1711
|
align-items: center;
|
|
1665
1712
|
gap: 10px;
|
|
@@ -1668,7 +1715,7 @@
|
|
|
1668
1715
|
background: transparent;
|
|
1669
1716
|
cursor: ${e=>e.$clickable?"pointer":"default"};
|
|
1670
1717
|
flex-shrink: 0;
|
|
1671
|
-
`,
|
|
1718
|
+
`,Yl=s.div`
|
|
1672
1719
|
display: flex;
|
|
1673
1720
|
align-items: center;
|
|
1674
1721
|
justify-content: center;
|
|
@@ -1692,13 +1739,13 @@
|
|
|
1692
1739
|
border: 2px solid ${t.COLORS.gray};
|
|
1693
1740
|
color: ${t.COLORS["iron-grey"]};
|
|
1694
1741
|
`}
|
|
1695
|
-
`,
|
|
1742
|
+
`,Vl=s.span`
|
|
1696
1743
|
font-size: 14px;
|
|
1697
1744
|
font-weight: 500;
|
|
1698
1745
|
white-space: nowrap;
|
|
1699
1746
|
color: ${e=>e.$active||e.$completed?t.COLORS.black:t.COLORS["iron-grey"]};
|
|
1700
1747
|
transition: color 0.2s ease;
|
|
1701
|
-
`,
|
|
1748
|
+
`,Hl=s.div`
|
|
1702
1749
|
background-color: ${e=>e.$completed?t.COLORS.black:t.COLORS.gray};
|
|
1703
1750
|
transition: background-color 0.2s ease;
|
|
1704
1751
|
|
|
@@ -1712,15 +1759,15 @@
|
|
|
1712
1759
|
min-width: 16px;
|
|
1713
1760
|
margin: 0 12px;
|
|
1714
1761
|
`}
|
|
1715
|
-
`,
|
|
1762
|
+
`,Te=A.newClassNameGetter("stepper"),Gl=({className:e,classnames:r,onChange:o,orientation:i="horizontal",ref:n,steps:l,value:c,...d})=>{const p=u.useMemo(()=>l.findIndex(h=>h.value===c),[l,c]);return a.jsx(Ml,{...d,ref:n,$orientation:i,className:Te("container",e),children:l.map((h,g)=>{const f=h.value===c,O=g<p,m=g===l.length-1;return a.jsxs(Fl,{$orientation:i,children:[a.jsxs(Bl,{type:"button",$active:f,$completed:O,$clickable:!!o,onClick:()=>o==null?void 0:o(h.value),className:Te("step",r==null?void 0:r.step),children:[a.jsx(Yl,{$active:f,$completed:O,className:Te("circle",r==null?void 0:r.circle),children:g+1}),a.jsx(Vl,{$active:f,$completed:O,className:Te("label",r==null?void 0:r.label),children:h.label})]}),!m&&a.jsx(Hl,{$completed:O,$orientation:i,className:Te("line",r==null?void 0:r.line)})]},h.value)})})},kt={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},Wl=s.div`
|
|
1716
1763
|
position: relative;
|
|
1717
1764
|
display: flex;
|
|
1718
1765
|
flex-direction: column;
|
|
1719
1766
|
gap: 4px;
|
|
1720
|
-
`,
|
|
1767
|
+
`,Ul=s(ie)`
|
|
1721
1768
|
margin-left: 6px;
|
|
1722
1769
|
color: ${e=>kt[e.$variant].label};
|
|
1723
|
-
`,
|
|
1770
|
+
`,Xl=s.div`
|
|
1724
1771
|
display: flex;
|
|
1725
1772
|
flex-wrap: wrap;
|
|
1726
1773
|
align-items: center;
|
|
@@ -1742,7 +1789,7 @@
|
|
|
1742
1789
|
outline: 2px solid ${e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1743
1790
|
outline-offset: 2px;
|
|
1744
1791
|
`}
|
|
1745
|
-
`,
|
|
1792
|
+
`,ql=s.input`
|
|
1746
1793
|
flex: 1;
|
|
1747
1794
|
min-width: 80px;
|
|
1748
1795
|
border: none;
|
|
@@ -1759,7 +1806,7 @@
|
|
|
1759
1806
|
&:disabled {
|
|
1760
1807
|
cursor: not-allowed;
|
|
1761
1808
|
}
|
|
1762
|
-
`,
|
|
1809
|
+
`,Ar=`
|
|
1763
1810
|
z-index: 100;
|
|
1764
1811
|
background-color: ${t.COLORS.white};
|
|
1765
1812
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
@@ -1767,28 +1814,28 @@
|
|
|
1767
1814
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
1768
1815
|
max-height: 200px;
|
|
1769
1816
|
overflow-y: auto;
|
|
1770
|
-
`,
|
|
1817
|
+
`,_r=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Dr=`
|
|
1771
1818
|
opacity 0.15s ease,
|
|
1772
1819
|
transform 0.15s ease,
|
|
1773
1820
|
visibility 0.15s;
|
|
1774
|
-
`,
|
|
1821
|
+
`,Kl=s.div`
|
|
1775
1822
|
position: absolute;
|
|
1776
1823
|
left: 0;
|
|
1777
1824
|
right: 0;
|
|
1778
1825
|
${e=>e.$position==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
1779
|
-
${
|
|
1826
|
+
${Ar}
|
|
1780
1827
|
opacity: ${e=>e.$open?1:0};
|
|
1781
1828
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1782
|
-
transform: ${e=>
|
|
1783
|
-
transition: ${
|
|
1784
|
-
`,
|
|
1829
|
+
transform: ${e=>_r(e.$open,e.$position)};
|
|
1830
|
+
transition: ${Dr};
|
|
1831
|
+
`,Zl=s.div`
|
|
1785
1832
|
position: fixed;
|
|
1786
|
-
${
|
|
1833
|
+
${Ar}
|
|
1787
1834
|
opacity: ${e=>e.$open?1:0};
|
|
1788
1835
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1789
|
-
transform: ${e=>
|
|
1790
|
-
transition: ${
|
|
1791
|
-
`,
|
|
1836
|
+
transform: ${e=>_r(e.$open,e.$position)};
|
|
1837
|
+
transition: ${Dr};
|
|
1838
|
+
`,gr=s.button`
|
|
1792
1839
|
display: flex;
|
|
1793
1840
|
align-items: center;
|
|
1794
1841
|
width: 100%;
|
|
@@ -1816,7 +1863,7 @@
|
|
|
1816
1863
|
&:only-child {
|
|
1817
1864
|
border-radius: 7px;
|
|
1818
1865
|
}
|
|
1819
|
-
`,
|
|
1866
|
+
`,fr=s.div`
|
|
1820
1867
|
display: flex;
|
|
1821
1868
|
align-items: center;
|
|
1822
1869
|
justify-content: center;
|
|
@@ -1824,11 +1871,11 @@
|
|
|
1824
1871
|
color: ${t.COLORS["iron-grey"]};
|
|
1825
1872
|
font-size: 14px;
|
|
1826
1873
|
text-align: center;
|
|
1827
|
-
`,ee=A.newClassNameGetter("tags"),Ze=4,
|
|
1874
|
+
`,ee=A.newClassNameGetter("tags"),Ze=4,Jl=({className:e,classnames:r,createKey:o="Tab",disabled:i=!1,emptyMessage:n="No options",freeSolo:l=!0,label:c,onChange:d,options:p=[],placeholder:h="Add tag...",portalRenderNode:g,ref:f,value:O,variant:m="normal",...y})=>{const S=u.useRef(null),C=u.useRef(null),x=u.useRef(null),$=u.useRef(null),[b,L]=u.useState(""),[E,T]=u.useState(!1),[V,z]=u.useState("bottom"),[D,j]=u.useState({top:0,left:0,width:0}),w=u.useMemo(()=>{const P=p.filter(X=>!O.includes(X.value));if(!b.trim())return P;const _=b.toLowerCase().trim();return P.filter(X=>X.label.toLowerCase().includes(_))},[p,O,b]),M=E&&p.length>0,v=u.useCallback(()=>{var Me;if(!C.current)return;const P=C.current.getBoundingClientRect(),_=((Me=x.current)==null?void 0:Me.offsetHeight)??200,X=window.innerHeight-P.bottom-Ze,q=P.top-Ze,fe=X<_&&q>X?"top":"bottom";if(z(fe),g){const ot=fe==="bottom"?P.bottom+Ze:P.top-_-Ze;j({top:ot,left:P.left,width:P.width})}},[g]);u.useEffect(()=>{if(E)return v(),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[E,v]);const I=u.useCallback(P=>{const _=P.trim();return!_||O.includes(_)?!1:(d([...O,_]),L(""),!0)},[O,d]),k=P=>{if(P.key===o&&b.trim())if(P.preventDefault(),l)I(b);else{const _=w.find(X=>X.label.toLowerCase()===b.toLowerCase().trim());_&&I(_.value)}else P.key==="Backspace"&&!b&&O.length>0&&d(O.slice(0,-1))},N=P=>{var _;I(P),(_=$.current)==null||_.focus()},F=P=>{d(O.filter(_=>_!==P))},B=()=>{var P;i||(P=$.current)==null||P.focus()},H=P=>{const _=p.find(X=>X.value===P);return(_==null?void 0:_.label)??P};return a.jsxs(Wl,{...y,ref:f,className:ee("container",e),children:[c&&a.jsx(Ul,{$variant:m,className:ee("label"),children:c}),a.jsxs("div",{ref:S,style:{position:"relative"},children:[a.jsxs(Xl,{ref:C,$variant:m,$disabled:i,$focused:E,onClick:B,className:ee("trigger",r==null?void 0:r.trigger),children:[O.map(P=>a.jsx(Qe,{deletable:!i,onDelete:()=>F(P),className:ee("chip",r==null?void 0:r.chip),children:H(P)},P)),a.jsx(ql,{ref:$,type:"text",value:b,onChange:P=>L(P.target.value),onFocus:()=>T(!0),onBlur:()=>setTimeout(()=>T(!1),150),onKeyDown:k,placeholder:O.length===0?h:"",disabled:i,$disabled:i,className:ee("input",r==null?void 0:r.input)})]}),p.length>0&&(g?ge.createPortal(a.jsx(Zl,{ref:x,$open:M,$position:V,style:{top:D.top,left:D.left,width:D.width},className:ee("dropdown",r==null?void 0:r.dropdown),children:w.length===0?a.jsx(fr,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(gr,{type:"button",onMouseDown:_=>_.preventDefault(),onClick:()=>N(P.value),className:ee("option",r==null?void 0:r.option),children:P.label},P.value))}),g):a.jsx(Kl,{ref:x,$open:M,$position:V,className:ee("dropdown",r==null?void 0:r.dropdown),children:w.length===0?a.jsx(fr,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(gr,{type:"button",onMouseDown:_=>_.preventDefault(),onClick:()=>N(P.value),className:ee("option",r==null?void 0:r.option),children:P.label},P.value))}))]})]})},Ql=s.div`
|
|
1828
1875
|
display: flex;
|
|
1829
1876
|
align-items: center;
|
|
1830
1877
|
gap: 6px;
|
|
1831
|
-
`,
|
|
1878
|
+
`,ed=s.button`
|
|
1832
1879
|
padding: 6px 16px;
|
|
1833
1880
|
border: none;
|
|
1834
1881
|
border-radius: 12px;
|
|
@@ -1846,14 +1893,14 @@
|
|
|
1846
1893
|
&:hover:not(:disabled) {
|
|
1847
1894
|
background-color: ${e=>e.$active?t.COLORS.gray:"rgba(0, 0, 0, 0.05)"};
|
|
1848
1895
|
}
|
|
1849
|
-
`,
|
|
1896
|
+
`,xr=A.newClassNameGetter("tabs"),td=({className:e,classnames:r,onChange:o,ref:i,tabs:n,value:l,...c})=>a.jsx(Ql,{...c,ref:i,className:xr("container",e),role:"tablist",children:n.map(d=>a.jsx(ed,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>o(d.value),className:xr("tab",r==null?void 0:r.tab),children:d.label},d.value))}),Or={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=>Or[e]??Or.normal,rd=s.div`
|
|
1850
1897
|
display: grid;
|
|
1851
1898
|
flex-direction: column;
|
|
1852
1899
|
gap: 2px;
|
|
1853
1900
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1854
|
-
`,
|
|
1901
|
+
`,od=s(ie)`
|
|
1855
1902
|
margin-left: 6px;
|
|
1856
|
-
`,
|
|
1903
|
+
`,id=s.textarea`
|
|
1857
1904
|
flex: 1;
|
|
1858
1905
|
min-width: 0;
|
|
1859
1906
|
outline: none;
|
|
@@ -1864,44 +1911,26 @@
|
|
|
1864
1911
|
border-radius: 16px;
|
|
1865
1912
|
resize: vertical;
|
|
1866
1913
|
|
|
1867
|
-
color: ${e=>
|
|
1868
|
-
border: 1px solid ${e=>
|
|
1869
|
-
background-color: ${e=>
|
|
1914
|
+
color: ${e=>de(e.$variant).color.static};
|
|
1915
|
+
border: 1px solid ${e=>de(e.$variant).border.static};
|
|
1916
|
+
background-color: ${e=>de(e.$variant).background.static};
|
|
1870
1917
|
|
|
1871
1918
|
&::placeholder {
|
|
1872
|
-
color: ${e=>
|
|
1919
|
+
color: ${e=>de(e.$variant).placeholder.static};
|
|
1873
1920
|
}
|
|
1874
1921
|
|
|
1875
1922
|
&:disabled {
|
|
1876
1923
|
cursor: not-allowed;
|
|
1877
1924
|
resize: none;
|
|
1878
|
-
color: ${e=>
|
|
1879
|
-
background-color: ${e=>
|
|
1880
|
-
border-color: ${e=>
|
|
1925
|
+
color: ${e=>de(e.$variant).color.disabled};
|
|
1926
|
+
background-color: ${e=>de(e.$variant).background.disabled};
|
|
1927
|
+
border-color: ${e=>de(e.$variant).border.disabled};
|
|
1881
1928
|
|
|
1882
1929
|
&::placeholder {
|
|
1883
|
-
color: ${e=>
|
|
1930
|
+
color: ${e=>de(e.$variant).placeholder.disabled};
|
|
1884
1931
|
}
|
|
1885
1932
|
}
|
|
1886
|
-
`,$t=A.newClassNameGetter("textarea"),
|
|
1887
|
-
from {
|
|
1888
|
-
transform: translateY(100%);
|
|
1889
|
-
opacity: 0;
|
|
1890
|
-
}
|
|
1891
|
-
to {
|
|
1892
|
-
transform: translateY(0);
|
|
1893
|
-
opacity: 1;
|
|
1894
|
-
}
|
|
1895
|
-
`,ql=oe.keyframes`
|
|
1896
|
-
from {
|
|
1897
|
-
transform: translateY(0);
|
|
1898
|
-
opacity: 1;
|
|
1899
|
-
}
|
|
1900
|
-
to {
|
|
1901
|
-
transform: translateY(100%);
|
|
1902
|
-
opacity: 0;
|
|
1903
|
-
}
|
|
1904
|
-
`,Kl=s.div`
|
|
1933
|
+
`,$t=A.newClassNameGetter("textarea"),nd=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,variant:c="normal",rows:d=4,...p})=>a.jsxs(rd,{className:$t("container",e),$fullWidth:!!i,children:[n&&a.jsx(od,{variant:c,className:$t("label",r==null?void 0:r.label),children:n}),a.jsx(id,{...p,ref:l,rows:d,disabled:o,$variant:c,className:$t("textarea",r==null?void 0:r.textarea)})]}),Mr=u.createContext(null),St=3,$r={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}},ad=(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,i=e.toasts.filter(l=>l.id!==o),n=e.queue[0];return n&&i.length<St?{toasts:[...i,n],queue:e.queue.slice(1)}:{...e,toasts:i}}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}},ld={toasts:[],queue:[]},yt=e=>$r[e]??$r.default,dd=s.div`
|
|
1905
1934
|
position: fixed;
|
|
1906
1935
|
bottom: 24px;
|
|
1907
1936
|
left: 24px;
|
|
@@ -1912,7 +1941,7 @@
|
|
|
1912
1941
|
pointer-events: none;
|
|
1913
1942
|
width: auto;
|
|
1914
1943
|
max-width: 90vw;
|
|
1915
|
-
`,
|
|
1944
|
+
`,cd=s.div`
|
|
1916
1945
|
display: flex;
|
|
1917
1946
|
align-items: center;
|
|
1918
1947
|
justify-content: space-between;
|
|
@@ -1924,17 +1953,18 @@
|
|
|
1924
1953
|
border: 1px solid ${({$variant:e})=>yt(e).border};
|
|
1925
1954
|
border-radius: 96px;
|
|
1926
1955
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
1927
|
-
animation: ${({$isExiting:e})=>e?
|
|
1956
|
+
animation: ${({$isExiting:e})=>e?t.KEYFRAMES.slideOutBottomFade:t.KEYFRAMES.slideInBottomFade}
|
|
1957
|
+
0.3s ease-out;
|
|
1928
1958
|
pointer-events: auto;
|
|
1929
1959
|
max-width: 500px;
|
|
1930
|
-
`,
|
|
1960
|
+
`,sd=s.span`
|
|
1931
1961
|
font-size: 14px;
|
|
1932
1962
|
font-weight: 500;
|
|
1933
1963
|
line-height: 1.4;
|
|
1934
1964
|
white-space: nowrap;
|
|
1935
1965
|
overflow: hidden;
|
|
1936
1966
|
text-overflow: ellipsis;
|
|
1937
|
-
`,
|
|
1967
|
+
`,pd=s.button`
|
|
1938
1968
|
display: flex;
|
|
1939
1969
|
align-items: center;
|
|
1940
1970
|
justify-content: center;
|
|
@@ -1952,13 +1982,13 @@
|
|
|
1952
1982
|
&:hover {
|
|
1953
1983
|
opacity: 1;
|
|
1954
1984
|
}
|
|
1955
|
-
`,
|
|
1985
|
+
`,ud=s.div`
|
|
1956
1986
|
display: flex;
|
|
1957
1987
|
align-items: center;
|
|
1958
1988
|
justify-content: space-between;
|
|
1959
1989
|
gap: 12px;
|
|
1960
1990
|
width: 100%;
|
|
1961
|
-
`,
|
|
1991
|
+
`,hd=s.div`
|
|
1962
1992
|
display: flex;
|
|
1963
1993
|
align-items: center;
|
|
1964
1994
|
justify-content: center;
|
|
@@ -1973,7 +2003,7 @@
|
|
|
1973
2003
|
font-weight: 500;
|
|
1974
2004
|
white-space: nowrap;
|
|
1975
2005
|
margin-left: auto;
|
|
1976
|
-
`,
|
|
2006
|
+
`,Sr=({toast:e,onRemove:r})=>{const[o,i]=u.useState(!1),n=()=>{i(!0),setTimeout(()=>{r(e.id)},300)};return u.useEffect(()=>{if(e.duration){const l=setTimeout(()=>{n()},e.duration);return()=>clearTimeout(l)}},[e.duration,e.id]),a.jsxs(cd,{$variant:e.variant,$isExiting:o,children:[a.jsx(sd,{children:e.message}),a.jsx(pd,{onClick:n,children:a.jsx(a.X,{style:{width:16,height:16}})})]})},bd=({toasts:e,queueCount:r,removeToast:o})=>{if(e.length===0)return null;const i=e.length-1;return a.jsx(dd,{children:e.map((n,l)=>l===i&&r>0?a.jsxs(ud,{children:[a.jsx(Sr,{toast:n,onRemove:o}),a.jsxs(hd,{children:["+",r]})]},n.id):a.jsx(Sr,{toast:n,onRemove:o},n.id))})},gd=({children:e})=>{const[r,o]=u.useReducer(ad,ld),i=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}})},[]),n=u.useCallback(l=>{o({type:"REMOVE_TOAST",payload:l})},[]);return a.jsxs(Mr.Provider,{value:{addToast:i,removeToast:n},children:[e,a.jsx(bd,{toasts:r.toasts,queueCount:r.queue.length,removeToast:n})]})},fd=()=>{const e=u.useContext(Mr);if(!e)throw new Error("useToast must be used within ToastProvider");return e},yr={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}},_e=e=>yr[e]??yr.dark,xd=(e,r)=>{const o=_e(r).background;switch(e){case"top":return`
|
|
1977
2007
|
bottom: -12px;
|
|
1978
2008
|
left: 50%;
|
|
1979
2009
|
margin-left: -6px;
|
|
@@ -1993,7 +2023,7 @@
|
|
|
1993
2023
|
top: 50%;
|
|
1994
2024
|
margin-top: -6px;
|
|
1995
2025
|
border-right-color: ${o};
|
|
1996
|
-
`;default:return""}},
|
|
2026
|
+
`;default:return""}},Od=(e,r)=>{if(r!=="light")return"";const o=_e(r).border;switch(e){case"top":return`
|
|
1997
2027
|
&::after {
|
|
1998
2028
|
bottom: -14px;
|
|
1999
2029
|
left: 50%;
|
|
@@ -2021,11 +2051,11 @@
|
|
|
2021
2051
|
margin-top: -7px;
|
|
2022
2052
|
border-right-color: ${o};
|
|
2023
2053
|
}
|
|
2024
|
-
`;default:return""}},
|
|
2054
|
+
`;default:return""}},Fr=e=>`
|
|
2025
2055
|
z-index: 1000;
|
|
2026
2056
|
padding: 6px 12px;
|
|
2027
|
-
background-color: ${
|
|
2028
|
-
color: ${
|
|
2057
|
+
background-color: ${_e(e.$variant).background};
|
|
2058
|
+
color: ${_e(e.$variant).text};
|
|
2029
2059
|
font-size: 13px;
|
|
2030
2060
|
line-height: 1.4;
|
|
2031
2061
|
border-radius: 6px;
|
|
@@ -2039,7 +2069,7 @@
|
|
|
2039
2069
|
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
|
|
2040
2070
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
2041
2071
|
|
|
2042
|
-
${e.$variant==="light"?`border: 1px solid ${
|
|
2072
|
+
${e.$variant==="light"?`border: 1px solid ${_e(e.$variant).border};`:""}
|
|
2043
2073
|
|
|
2044
2074
|
&::before {
|
|
2045
2075
|
content: '';
|
|
@@ -2047,7 +2077,7 @@
|
|
|
2047
2077
|
width: 0;
|
|
2048
2078
|
height: 0;
|
|
2049
2079
|
border: 6px solid transparent;
|
|
2050
|
-
${
|
|
2080
|
+
${xd(e.$placement,e.$variant)}
|
|
2051
2081
|
}
|
|
2052
2082
|
|
|
2053
2083
|
${e.$variant==="light"?`
|
|
@@ -2060,11 +2090,11 @@
|
|
|
2060
2090
|
}
|
|
2061
2091
|
`:""}
|
|
2062
2092
|
|
|
2063
|
-
${
|
|
2064
|
-
|
|
2093
|
+
${Od(e.$placement,e.$variant)}
|
|
2094
|
+
`,$d=s.div`
|
|
2065
2095
|
position: relative;
|
|
2066
2096
|
display: inline-block;
|
|
2067
|
-
`,
|
|
2097
|
+
`,Sd=e=>{switch(e){case"top":return`
|
|
2068
2098
|
bottom: calc(100% + 8px);
|
|
2069
2099
|
left: 50%;
|
|
2070
2100
|
transform: translateX(-50%);
|
|
@@ -2080,12 +2110,12 @@
|
|
|
2080
2110
|
left: calc(100% + 8px);
|
|
2081
2111
|
top: 50%;
|
|
2082
2112
|
transform: translateY(-50%);
|
|
2083
|
-
`;default:return""}},
|
|
2113
|
+
`;default:return""}},yd=s.div`
|
|
2084
2114
|
position: absolute;
|
|
2085
|
-
${e=>
|
|
2086
|
-
${({$placement:e})=>
|
|
2087
|
-
`,
|
|
2115
|
+
${e=>Fr(e)}
|
|
2116
|
+
${({$placement:e})=>Sd(e)}
|
|
2117
|
+
`,Cd=s.div`
|
|
2088
2118
|
position: fixed;
|
|
2089
|
-
${e=>
|
|
2090
|
-
`,
|
|
2119
|
+
${e=>Fr(e)}
|
|
2120
|
+
`,Ct=A.newClassNameGetter("tooltip"),ce=8,vd=({children:e,className:r,classnames:o,content:i,delay:n=200,placement:l="top",portalRenderNode:c,ref:d,variant:p="dark",...h})=>{const[g,f]=u.useState(!1),[O,m]=u.useState(null),[y,S]=u.useState(l),[C,x]=u.useState({top:0,left:0}),$=u.useRef(null),b=u.useRef(null),L=u.useCallback(()=>{var N,F;if(!$.current)return;const z=$.current.getBoundingClientRect(),D=((N=b.current)==null?void 0:N.offsetWidth)??100,j=((F=b.current)==null?void 0:F.offsetHeight)??30,w=z.top-ce,M=window.innerHeight-z.bottom-ce,v=z.left-ce,I=window.innerWidth-z.right-ce;let k=l;if(l==="top"&&w<j&&M>w?k="bottom":l==="bottom"&&M<j&&w>M?k="top":l==="left"&&v<D&&I>v?k="right":l==="right"&&I<D&&v>I&&(k="left"),S(k),c){let B,H;switch(k){case"top":B=z.top-j-ce,H=z.left+z.width/2-D/2;break;case"bottom":B=z.bottom+ce,H=z.left+z.width/2-D/2;break;case"left":B=z.top+z.height/2-j/2,H=z.left-D-ce;break;case"right":B=z.top+z.height/2-j/2,H=z.right+ce;break;default:B=0,H=0}const P=8;H=Math.max(P,Math.min(H,window.innerWidth-D-P)),B=Math.max(P,Math.min(B,window.innerHeight-j-P)),x({top:B,left:H})}},[l,c]);u.useLayoutEffect(()=>{g&&L()},[g,L]);const E=()=>{const z=setTimeout(()=>{f(!0)},n);m(z)},T=()=>{O&&(clearTimeout(O),m(null)),f(!1)},V=c?ge.createPortal(a.jsx(Cd,{ref:b,className:Ct("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,style:{top:C.top,left:C.left},children:i}),c):a.jsx(yd,{ref:b,className:Ct("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,children:i});return a.jsxs($d,{...h,ref:z=>{$.current=z,typeof d=="function"?d(z):d&&(d.current=z)},className:Ct("wrapper",r),onMouseEnter:E,onMouseLeave:T,children:[e,V]})};exports.Autocomplete=Eo;exports.Button=De;exports.Card=Yo;exports.Checkbox=tt;exports.CheckboxCard=Qo;exports.CheckboxGroup=oi;exports.Chip=Qe;exports.Confirmation=bi;exports.Container=xi;exports.DatePicker=Hi;exports.Drawer=qi;exports.Dropdown=tn;exports.FieldLabel=ie;exports.FieldMessage=an;exports.GlobalStyle=lo;exports.ImageCropper=ha;exports.Input=zr;exports.KeySymbol=Cr;exports.KeysBindings=vr;exports.Modal=Er;exports.MultiSelect=za;exports.NotificationProvider=Fa;exports.OtpCode=Wa;exports.Panel=Ja;exports.Progress=tl;exports.Radio=Pt;exports.RadioCard=ul;exports.RadioGroup=fl;exports.SaveProgressProvider=$l;exports.Select=zl;exports.Spinner=Lt;exports.StatusCard=Dl;exports.Stepper=Gl;exports.Tabs=td;exports.Tags=Jl;exports.Textarea=nd;exports.ToastProvider=gd;exports.Tooltip=vd;exports.formatDateGo=mr;exports.useImageCropper=Pr;exports.useNotification=Ba;exports.useSaveProgress=Sl;exports.useToast=fd;
|
|
2091
2121
|
//# sourceMappingURL=index.cjs.map
|