@vacano/ui 1.10.1 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +262 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +954 -945
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./media-BuwIclXE.cjs"),a=require("./X-BIgkmQPR.cjs"),be=require("@emotion/react"),u=require("react"),T=require("./tooling-Dflq0Y98.cjs"),ge=require("react-dom");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./media-BuwIclXE.cjs"),a=require("./X-BIgkmQPR.cjs"),be=require("@emotion/react"),u=require("react"),T=require("./tooling-Dflq0Y98.cjs"),ge=require("react-dom");function ao(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const Re=ao(u);function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},mt.apply(null,arguments)}const lo=be.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -100,22 +100,22 @@
|
|
|
100
100
|
:focus:not(:focus-visible) {
|
|
101
101
|
outline: none;
|
|
102
102
|
}
|
|
103
|
-
`,
|
|
103
|
+
`,co=()=>a.jsx(be.Global,{styles:lo});var so=/^((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)-.*))$/,po=a.memoize(function(e){return so.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),uo=po,ho=function(r){return r!=="theme"},Tt=function(r){return typeof r=="string"&&r.charCodeAt(0)>96?uo:ho},It=function(r,o,n){var i;if(o){var l=o.shouldForwardProp;i=r.__emotion_forwardProp&&l?function(c){return r.__emotion_forwardProp(c)&&l(c)}:l}return typeof i!="function"&&n&&(i=r.__emotion_forwardProp),i},bo=function(r){var o=r.cache,n=r.serialized,i=r.isStringTag;return a.registerStyles(o,n,i),a.useInsertionEffectAlwaysWithSyncFallback(function(){return a.insertStyles(o,n,i)}),null},go=function e(r,o){var n=r.__emotion_real===r,i=n&&r.__emotion_base||r,l,c;o!==void 0&&(l=o.label,c=o.target);var d=It(r,o,n),p=d||Tt(i),b=!p("as");return function(){var h=arguments,f=n&&r.__emotion_styles!==void 0?r.__emotion_styles.slice(0):[];if(l!==void 0&&f.push("label:"+l+";"),h[0]==null||h[0].raw===void 0)f.push.apply(f,h);else{var O=h[0];f.push(O[0]);for(var w=h.length,S=1;S<w;S++)f.push(h[S],O[S])}var x=be.withEmotionCache(function(C,$,y){var g=b&&C.as||i,L="",N=[],j=C;if(C.theme==null){j={};for(var Y in C)j[Y]=C[Y];j.theme=Re.useContext(be.ThemeContext)}typeof C.className=="string"?L=a.getRegisteredStyles($.registered,N,C.className):C.className!=null&&(L=C.className+" ");var P=a.serializeStyles(f.concat(N),$.registered,j);L+=$.key+"-"+P.name,c!==void 0&&(L+=" "+c);var _=b&&d===void 0?Tt(g):p,M={};for(var E in C)b&&E==="as"||_(E)&&(M[E]=C[E]);return M.className=L,y&&(M.ref=y),Re.createElement(Re.Fragment,null,Re.createElement(bo,{cache:$,serialized:P,isStringTag:typeof g=="string"}),Re.createElement(g,M))});return x.displayName=l!==void 0?l:"Styled("+(typeof i=="string"?i:i.displayName||i.name||"Component")+")",x.defaultProps=r.defaultProps,x.__emotion_real=x,x.__emotion_base=i,x.__emotion_styles=f,x.__emotion_forwardProp=d,Object.defineProperty(x,"toString",{value:function(){return"."+c}}),x.withComponent=function(C,$){var y=e(C,mt({},o,$,{shouldForwardProp:It(x,$,!0)}));return y.apply(void 0,f)},x}},fo=["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=go.bind(null);fo.forEach(function(e){s[e]=s(e)});const xo=s.span`
|
|
104
104
|
font-size: 12px;
|
|
105
105
|
font-weight: 500;
|
|
106
106
|
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
107
|
-
`,
|
|
107
|
+
`,Oo=T.newClassNameGetter("field-label"),ie=({children:e,className:r,ref:o,required:n,variant:i="normal",...l})=>e?a.jsxs(xo,{...l,ref:o,className:Oo("container",r),$variant:i,children:[e," ",n&&"*"]}):null,ot={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},ne={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},So=s.div`
|
|
108
108
|
position: relative;
|
|
109
109
|
display: grid;
|
|
110
110
|
gap: 2px;
|
|
111
111
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
112
|
-
|
|
112
|
+
`,$o=s(ie)`
|
|
113
113
|
margin-left: 6px;
|
|
114
|
-
|
|
114
|
+
`,yo=s.div`
|
|
115
115
|
position: relative;
|
|
116
116
|
display: flex;
|
|
117
117
|
align-items: center;
|
|
118
|
-
`,
|
|
118
|
+
`,Co=s.input`
|
|
119
119
|
flex: 1;
|
|
120
120
|
min-width: 0;
|
|
121
121
|
width: 100%;
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
color: ${e=>ne[e.$variant].placeholder.disabled};
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
`,
|
|
148
|
+
`,mo=s.div`
|
|
149
149
|
position: absolute;
|
|
150
150
|
right: 12px;
|
|
151
151
|
top: 50%;
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
display: flex;
|
|
154
154
|
align-items: center;
|
|
155
155
|
justify-content: center;
|
|
156
|
-
`,
|
|
156
|
+
`,wo=s.div`
|
|
157
157
|
position: absolute;
|
|
158
158
|
top: 100%;
|
|
159
159
|
left: 0;
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
opacity 0.15s ease,
|
|
174
174
|
transform 0.15s ease,
|
|
175
175
|
visibility 0.15s;
|
|
176
|
-
`,
|
|
176
|
+
`,vo=s.div`
|
|
177
177
|
display: flex;
|
|
178
178
|
align-items: center;
|
|
179
179
|
gap: 10px;
|
|
@@ -199,43 +199,43 @@
|
|
|
199
199
|
&:hover {
|
|
200
200
|
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
201
201
|
}
|
|
202
|
-
`,
|
|
202
|
+
`,Ro=s.img`
|
|
203
203
|
width: 24px;
|
|
204
204
|
height: 24px;
|
|
205
205
|
border-radius: 6px;
|
|
206
206
|
object-fit: cover;
|
|
207
|
-
`,
|
|
207
|
+
`,ko=s.span`
|
|
208
208
|
flex: 1;
|
|
209
209
|
overflow: hidden;
|
|
210
210
|
text-overflow: ellipsis;
|
|
211
211
|
white-space: nowrap;
|
|
212
|
-
`,
|
|
212
|
+
`,Lo=s.div`
|
|
213
213
|
padding: 12px 14px;
|
|
214
214
|
font-size: 14px;
|
|
215
215
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
216
216
|
text-align: center;
|
|
217
|
-
`,
|
|
217
|
+
`,At={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},Dt={track:t.alpha(t.COLORS.black,15),indicator:t.COLORS.black},it=e=>At[e]??At.md,Eo=be.keyframes`
|
|
218
218
|
0% {
|
|
219
219
|
transform: rotate(0deg);
|
|
220
220
|
}
|
|
221
221
|
100% {
|
|
222
222
|
transform: rotate(360deg);
|
|
223
223
|
}
|
|
224
|
-
`,
|
|
224
|
+
`,Po=s.div`
|
|
225
225
|
display: inline-block;
|
|
226
226
|
width: ${e=>it(e.$size).size};
|
|
227
227
|
height: ${e=>it(e.$size).size};
|
|
228
|
-
border: ${e=>it(e.$size).borderWidth} solid ${
|
|
229
|
-
border-top-color: ${
|
|
228
|
+
border: ${e=>it(e.$size).borderWidth} solid ${Dt.track};
|
|
229
|
+
border-top-color: ${Dt.indicator};
|
|
230
230
|
border-radius: 50%;
|
|
231
|
-
animation: ${
|
|
232
|
-
`,
|
|
231
|
+
animation: ${Eo} 0.8s linear infinite;
|
|
232
|
+
`,jo=T.newClassNameGetter("spinner"),Lt=({"aria-label":e="Loading",className:r,ref:o,size:n="md",...i})=>a.jsx(Po,{...i,ref:o,className:jo("container",r),role:"status","aria-label":e,$size:n}),ke=T.newClassNameGetter("autocomplete"),zo=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,size:c="default",variant:d="normal",value:p,onChange:b,onSearch:h,debounceMs:f=300,minChars:O=1,noResultsMessage:w="No results found",...S})=>{const[x,C]=u.useState((p==null?void 0:p.value)??""),[$,y]=u.useState([]),[g,L]=u.useState(!1),[N,j]=u.useState(!1),[Y,P]=u.useState(!1),_=u.useRef(null),M=u.useRef(null);u.useEffect(()=>{(p==null?void 0:p.value)!==void 0&&C(p.value)},[p==null?void 0:p.value]);const E=u.useCallback(async z=>{if(z.length<O){y([]),P(!1);return}L(!0),P(!0);try{const B=await h(z);y(B),j(!0)}catch{y([])}finally{L(!1)}},[h,O]),A=u.useCallback(z=>{const B=z.target.value;C(B),b==null||b({value:B,image_url:null}),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{E(B)},f)},[b,E,f]),m=u.useCallback(z=>{C(z.value),y([]),j(!1),P(!1),b==null||b({value:z.value,image_url:z.image_url})},[b]),I=u.useCallback(()=>{setTimeout(()=>{j(!1)},150)},[]),R=u.useCallback(()=>{$.length>0&&j(!0)},[$.length]);return u.useEffect(()=>()=>{M.current&&clearTimeout(M.current)},[]),a.jsxs(So,{ref:_,className:ke("container",e),$fullWidth:!!n,children:[i&&a.jsx($o,{variant:d,className:ke("label",r==null?void 0:r.label),children:i}),a.jsxs(yo,{children:[a.jsx(Co,{...S,ref:l,type:"text",value:x,onChange:A,onBlur:I,onFocus:R,disabled:o,$size:c,$variant:d,className:ke("input",r==null?void 0:r.input)}),g&&a.jsx(mo,{children:a.jsx(Lt,{size:"xs"})})]}),a.jsx(wo,{$open:N&&Y,className:ke("dropdown",r==null?void 0:r.dropdown),children:$.length>0?$.map(z=>a.jsxs(vo,{onClick:()=>m(z),className:ke("item",r==null?void 0:r.item),children:[z.image_url&&a.jsx(Ro,{src:z.image_url,alt:z.value}),a.jsx(ko,{children:z.value})]},z.id)):!g&&a.jsx(Lo,{children:w})})]})},_t={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=_t[e];return r||_t.default},No=e=>e?"auto":"fit-content",To=s.button`
|
|
233
233
|
display: flex;
|
|
234
234
|
gap: 6px;
|
|
235
235
|
text-decoration: none;
|
|
236
236
|
align-items: center;
|
|
237
237
|
justify-content: center;
|
|
238
|
-
width: ${e=>e.$iconOnly?re(e.$size).height:
|
|
238
|
+
width: ${e=>e.$iconOnly?re(e.$size).height:No(!!e.$fullWidth)};
|
|
239
239
|
color: ${e=>J(e.$variant).color.static};
|
|
240
240
|
background-color: ${e=>J(e.$variant).background.static};
|
|
241
241
|
height: ${e=>re(e.$size).height};
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
background-color: ${e=>J(e.$variant).background.disabled};
|
|
262
262
|
border-color: ${e=>J(e.$variant).borderColor.disabled};
|
|
263
263
|
}
|
|
264
|
-
`,
|
|
264
|
+
`,Io=s.div`
|
|
265
265
|
display: grid;
|
|
266
266
|
place-items: center;
|
|
267
267
|
width: ${e=>re(e.$size).iconSize};
|
|
@@ -271,19 +271,19 @@
|
|
|
271
271
|
width: ${e=>re(e.$size).iconSize};
|
|
272
272
|
height: ${e=>re(e.$size).iconSize};
|
|
273
273
|
}
|
|
274
|
-
`,
|
|
274
|
+
`,Ao=s.span`
|
|
275
275
|
font-weight: 600;
|
|
276
276
|
overflow: hidden;
|
|
277
277
|
white-space: nowrap;
|
|
278
278
|
text-overflow: ellipsis;
|
|
279
|
-
`,
|
|
279
|
+
`,Do=s(a.LoaderCircle)`
|
|
280
280
|
width: ${e=>re(e.$size).iconSize};
|
|
281
281
|
height: ${e=>re(e.$size).iconSize};
|
|
282
282
|
animation: ${t.KEYFRAMES.rotate} 0.8s linear infinite;
|
|
283
|
-
`,
|
|
283
|
+
`,_o=s.div`
|
|
284
284
|
display: flex;
|
|
285
285
|
gap: 3px;
|
|
286
|
-
`,
|
|
286
|
+
`,Mo=s.span`
|
|
287
287
|
text-align: center;
|
|
288
288
|
display: flex;
|
|
289
289
|
justify-content: center;
|
|
@@ -296,24 +296,24 @@
|
|
|
296
296
|
border-radius: 4px;
|
|
297
297
|
width: fit-content;
|
|
298
298
|
background-color: ${e=>e.$variant==="light"?t.alpha(t.COLORS.white,25):t.alpha(t.COLORS.black,25)};
|
|
299
|
-
`,
|
|
299
|
+
`,Fo=T.newClassNameGetter("key-symbol"),Cr=({className:e,ref:r,symbol:o,variant:n="light",...i})=>o?a.jsx(Mo,{...i,ref:r,className:Fo("container",e),$variant:n,children:o}):null,Ft=T.newClassNameGetter("key-bindings"),mr=({className:e,classnames:r,keys:o,ref:n,variant:i,...l})=>{const c=u.useMemo(()=>t.getKeySymbols(o),[o]);return c.length===0?null:a.jsx(_o,{...l,ref:n,className:Ft("container",e),children:c.map(d=>a.jsx(Cr,{symbol:d,className:Ft("item",r==null?void 0:r.item),variant:i},d))})},Bt=T.newClassNameGetter("button"),De=({children:e,className:r,classnames:o,disabled:n,fullWidth:i,icon:l,loading:c,onClick:d,ref:p=null,keyBindings:b=[],size:h="default",type:f="button",variant:O="normal",...w})=>{const S=u.useRef(null);u.useImperativeHandle(p,()=>S.current,[]),t.useKeyBinding(b,()=>{var C;(C=S.current)==null||C.click()});const x=u.useMemo(()=>{switch(f){case"link":return"button";default:return f}},[f]);return a.jsxs(To,{...w,onClick:d,ref:S,type:x,disabled:n,className:Bt("container",r),$variant:O,$size:h,$fullWidth:!!i,$iconOnly:!!l&&!(e||(b==null?void 0:b.length)>0),children:[c&&a.jsx(Do,{$size:h}),l&&!c&&a.jsx(Io,{$size:h,children:l}),e&&a.jsx(Ao,{className:Bt("label",o==null?void 0:o.label),children:e}),a.jsx(mr,{keys:b,variant:O==="system"?"light":"dark"})]})},Bo=s.div`
|
|
300
300
|
background-color: ${t.COLORS.white};
|
|
301
301
|
border-radius: 16px;
|
|
302
302
|
border: ${e=>e.$border?`1px solid ${t.alpha(t.COLORS["iron-grey"],15)}`:"none"};
|
|
303
303
|
box-shadow: ${e=>e.$shadow?`0 2px 8px ${t.alpha(t.COLORS.black,10)}`:"none"};
|
|
304
|
-
`,
|
|
304
|
+
`,Yo=T.newClassNameGetter("card"),Vo=({children:e,className:r,ref:o,border:n=!1,shadow:i=!1,...l})=>a.jsx(Bo,{...l,ref:o,className:Yo("container",r),$border:n,$shadow:i,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,Ho=s.label`
|
|
305
305
|
display: inline-flex;
|
|
306
306
|
align-items: flex-start;
|
|
307
307
|
gap: 8px;
|
|
308
308
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
309
309
|
opacity: ${e=>e.$disabled?.5:1};
|
|
310
|
-
`,
|
|
310
|
+
`,Go=s.input`
|
|
311
311
|
position: absolute;
|
|
312
312
|
opacity: 0;
|
|
313
313
|
width: 0;
|
|
314
314
|
height: 0;
|
|
315
315
|
pointer-events: none;
|
|
316
|
-
`,
|
|
316
|
+
`,Wo=s.span`
|
|
317
317
|
display: inline-flex;
|
|
318
318
|
align-items: center;
|
|
319
319
|
justify-content: center;
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
border-color 0.15s ease,
|
|
329
329
|
background-color 0.15s ease,
|
|
330
330
|
box-shadow 0.15s ease;
|
|
331
|
-
`,
|
|
331
|
+
`,Ko=s.span`
|
|
332
332
|
display: inline-flex;
|
|
333
333
|
align-items: center;
|
|
334
334
|
justify-content: center;
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
width: 12px;
|
|
344
344
|
height: 12px;
|
|
345
345
|
}
|
|
346
|
-
`,
|
|
346
|
+
`,Uo=s.span`
|
|
347
347
|
font-size: 14px;
|
|
348
348
|
font-weight: 500;
|
|
349
349
|
line-height: 1.4;
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
text-decoration: none;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
`,Le=T.newClassNameGetter("checkbox"),et=({checked:e,className:r,classnames:o,disabled:n,indeterminate:i=!1,label:l,onChange:c,ref:d,variant:p="normal",...b})=>a.jsxs(
|
|
362
|
+
`,Le=T.newClassNameGetter("checkbox"),et=({checked:e,className:r,classnames:o,disabled:n,indeterminate:i=!1,label:l,onChange:c,ref:d,variant:p="normal",...b})=>a.jsxs(Ho,{className:Le("container",r),$disabled:!!n,$variant:p,children:[a.jsx(Go,{...b,ref:d,type:"checkbox",className:Le("input",o==null?void 0:o.input),checked:e,disabled:n,onChange:c}),a.jsx(Wo,{className:Le("box",o==null?void 0:o.box),$checked:e,$indeterminate:i,$variant:p,children:a.jsx(Ko,{className:Le("icon",o==null?void 0:o.icon),$visible:i||e,$variant:p,children:i?a.jsx(a.Minus,{}):a.jsx(a.Check,{})})}),l&&a.jsx(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`
|
|
363
363
|
display: grid;
|
|
364
364
|
grid-template-columns: auto 1fr;
|
|
365
365
|
align-items: start;
|
|
@@ -383,7 +383,7 @@
|
|
|
383
383
|
.vacano_checkbox_container {
|
|
384
384
|
pointer-events: none;
|
|
385
385
|
}
|
|
386
|
-
`,
|
|
386
|
+
`,qo=s.input`
|
|
387
387
|
position: absolute;
|
|
388
388
|
width: 1px;
|
|
389
389
|
height: 1px;
|
|
@@ -393,12 +393,12 @@
|
|
|
393
393
|
clip: rect(0, 0, 0, 0);
|
|
394
394
|
white-space: nowrap;
|
|
395
395
|
border: 0;
|
|
396
|
-
`,
|
|
396
|
+
`,Zo=s.div`
|
|
397
397
|
display: flex;
|
|
398
398
|
flex-direction: column;
|
|
399
399
|
gap: 2px;
|
|
400
400
|
min-width: 0;
|
|
401
|
-
`,
|
|
401
|
+
`,Jo=s.span`
|
|
402
402
|
font-size: 14px;
|
|
403
403
|
font-weight: 500;
|
|
404
404
|
line-height: 1.4;
|
|
@@ -407,7 +407,7 @@
|
|
|
407
407
|
label[data-disabled='true'] & {
|
|
408
408
|
color: ${e=>ue(e.$variant).label.disabled};
|
|
409
409
|
}
|
|
410
|
-
`,
|
|
410
|
+
`,Qo=s.span`
|
|
411
411
|
font-size: 12px;
|
|
412
412
|
font-weight: 400;
|
|
413
413
|
line-height: 1.4;
|
|
@@ -416,21 +416,21 @@
|
|
|
416
416
|
label[data-disabled='true'] & {
|
|
417
417
|
color: ${e=>ue(e.$variant).description.disabled};
|
|
418
418
|
}
|
|
419
|
-
`,Ye=T.newClassNameGetter("checkbox-card"),
|
|
419
|
+
`,Ye=T.newClassNameGetter("checkbox-card"),ei=({checked:e,className:r,classnames:o,description:n,disabled:i,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:b="normal",...h})=>a.jsxs(Xo,{className:Ye("container",r),$checked:e,$disabled:!!i,$fullWidth:l,$variant:b,"data-disabled":i,children:[a.jsx(qo,{...h,ref:p,type:"checkbox",checked:e,disabled:i,onChange:d}),a.jsx(et,{className:o==null?void 0:o.checkbox,checked:e,disabled:i,variant:b,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(Zo,{className:Ye("content",o==null?void 0:o.content),children:[a.jsx(Jo,{className:Ye("label",o==null?void 0:o.label),$variant:b,children:c}),n&&a.jsx(Qo,{className:Ye("description",o==null?void 0:o.description),$variant:b,children:n})]})]}),Ht={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},ti=s.div`
|
|
420
420
|
display: flex;
|
|
421
421
|
flex-direction: column;
|
|
422
422
|
gap: 8px;
|
|
423
|
-
`,
|
|
423
|
+
`,ri=s.span`
|
|
424
424
|
font-size: 13px;
|
|
425
425
|
font-weight: 500;
|
|
426
426
|
line-height: 1.5;
|
|
427
|
-
color: ${e=>e.$disabled?
|
|
427
|
+
color: ${e=>e.$disabled?Ht.label.disabledColor:Ht.label.color};
|
|
428
428
|
margin-bottom: 4px;
|
|
429
|
-
`,
|
|
429
|
+
`,oi=s.div`
|
|
430
430
|
display: flex;
|
|
431
431
|
flex-direction: column;
|
|
432
432
|
gap: 12px;
|
|
433
|
-
`,nt=T.newClassNameGetter("checkbox-group"),
|
|
433
|
+
`,nt=T.newClassNameGetter("checkbox-group"),ii=({className:e,classnames:r,disabled:o,label:n,onChange:i,options:l,ref:c,value:d,...p})=>{const b=(h,f)=>{i(f?[...d,h]:d.filter(O=>O!==h))};return a.jsxs(ti,{...p,ref:c,className:nt("container",e),children:[n&&a.jsx(ri,{className:nt("label",r==null?void 0:r.label),$disabled:o,children:n}),a.jsx(oi,{className:nt("options",r==null?void 0:r.options),children:l.map(h=>a.jsx(et,{className:r==null?void 0:r.checkbox,checked:d.includes(h.value),label:h.label,disabled:o,onChange:f=>b(h.value,f.target.checked)},h.value))})]})},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)}},wt=e=>Gt[e]??Gt.gray,ni=s.span`
|
|
434
434
|
display: inline-flex;
|
|
435
435
|
align-items: center;
|
|
436
436
|
gap: 4px;
|
|
@@ -440,9 +440,9 @@
|
|
|
440
440
|
font-size: 12px;
|
|
441
441
|
font-weight: 500;
|
|
442
442
|
line-height: 1.5;
|
|
443
|
-
background-color: ${e=>
|
|
444
|
-
color: ${e=>
|
|
445
|
-
`,
|
|
443
|
+
background-color: ${e=>wt(e.$variant).background};
|
|
444
|
+
color: ${e=>wt(e.$variant).color};
|
|
445
|
+
`,ai=s.button`
|
|
446
446
|
display: inline-flex;
|
|
447
447
|
align-items: center;
|
|
448
448
|
justify-content: center;
|
|
@@ -457,17 +457,17 @@
|
|
|
457
457
|
transition: background-color 0.15s ease;
|
|
458
458
|
|
|
459
459
|
&:hover {
|
|
460
|
-
background-color: ${e=>
|
|
460
|
+
background-color: ${e=>wt(e.$variant).deleteHover};
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
& svg {
|
|
464
464
|
width: 14px;
|
|
465
465
|
height: 14px;
|
|
466
466
|
}
|
|
467
|
-
`,
|
|
467
|
+
`,li=s.span`
|
|
468
468
|
flex: 1 0 auto;
|
|
469
469
|
text-align: center;
|
|
470
|
-
`,at=T.newClassNameGetter("chip"),Je=({children:e,className:r,classnames:o,deletable:n,onDelete:i,ref:l,variant:c="gray",...d})=>a.jsxs(
|
|
470
|
+
`,at=T.newClassNameGetter("chip"),Je=({children:e,className:r,classnames:o,deletable:n,onDelete:i,ref:l,variant:c="gray",...d})=>a.jsxs(ni,{...d,ref:l,className:at("container",r),$variant:c,$deletable:!!n,children:[a.jsx(li,{className:at("label",o==null?void 0:o.label),children:e}),n&&a.jsx(ai,{type:"button",className:at("delete",o==null?void 0:o.delete),$variant:c,onClick:i,children:a.jsx(a.X,{})})]}),di="Confirm",ci="Cancel",si=be.keyframes`
|
|
471
471
|
from {
|
|
472
472
|
opacity: 0;
|
|
473
473
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -476,7 +476,7 @@
|
|
|
476
476
|
opacity: 1;
|
|
477
477
|
transform: translateX(-50%) translateY(0);
|
|
478
478
|
}
|
|
479
|
-
`,
|
|
479
|
+
`,pi=be.keyframes`
|
|
480
480
|
from {
|
|
481
481
|
opacity: 1;
|
|
482
482
|
transform: translateX(-50%) translateY(0);
|
|
@@ -485,7 +485,7 @@
|
|
|
485
485
|
opacity: 0;
|
|
486
486
|
transform: translateX(-50%) translateY(100%);
|
|
487
487
|
}
|
|
488
|
-
`,
|
|
488
|
+
`,ui=s.div`
|
|
489
489
|
position: fixed;
|
|
490
490
|
bottom: 24px;
|
|
491
491
|
left: 50%;
|
|
@@ -499,18 +499,18 @@
|
|
|
499
499
|
box-shadow:
|
|
500
500
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
501
501
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
502
|
-
animation: ${({$isExiting:e})=>e?si
|
|
502
|
+
animation: ${({$isExiting:e})=>e?pi:si} 0.2s ease-out forwards;
|
|
503
503
|
z-index: 1000;
|
|
504
|
-
`,
|
|
504
|
+
`,hi=s.p`
|
|
505
505
|
margin: 0;
|
|
506
506
|
font-size: 14px;
|
|
507
507
|
color: ${t.COLORS.black};
|
|
508
508
|
white-space: nowrap;
|
|
509
|
-
`,
|
|
509
|
+
`,bi=s.div`
|
|
510
510
|
display: flex;
|
|
511
511
|
align-items: center;
|
|
512
512
|
gap: 8px;
|
|
513
|
-
`,
|
|
513
|
+
`,gi=({confirmation:e,onDone:r})=>{const[o,n]=u.useState(!1),[i,l]=u.useState(!1),{message:c,onConfirm:d,onCancel:p,options:b}=e,h=b.confirmLabel||di,f=b.cancelLabel||ci,O=u.useCallback(x=>{n(!0),setTimeout(()=>{x==null||x(),r()},200)},[r]),w=u.useCallback(async()=>{const x=d();if(x instanceof Promise){l(!0);try{await x}finally{l(!1)}}O()},[O,d]),S=u.useCallback(()=>{i||O(p)},[O,i,p]);return u.useEffect(()=>{const x=C=>{C.key==="Escape"&&!i&&S()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[S,i]),a.jsxs(ui,{$isExiting:o,children:[a.jsx(hi,{children:c}),a.jsxs(bi,{children:[a.jsx(De,{variant:"system",size:"compact",onClick:S,disabled:i,children:f}),a.jsx(De,{variant:"danger",size:"compact",onClick:w,loading:i,children:h})]})]})},wr=u.createContext(null),fi=()=>{},xi=({children:e})=>{const[r,o]=u.useState(null),n=u.useCallback((l,c,d,p)=>{o({open:!0,message:l,onConfirm:c,onCancel:d||fi,options:p||{}})},[]),i=u.useCallback(()=>{o(null)},[]);return a.jsxs(wr.Provider,{value:{show:n,hide:i},children:[e,r&&a.jsx(gi,{confirmation:r,onDone:i})]})},Oi=()=>{const e=u.useContext(wr);if(!e)throw new Error("useConfirmation must be used within ConfirmationProvider");return e},Ee={sm:`${t.BREAKPOINTS.sm}px`,md:`${t.BREAKPOINTS.md}px`,lg:`${t.BREAKPOINTS.lg}px`,xl:`${t.BREAKPOINTS.xl}px`,"2xl":`${t.BREAKPOINTS["2xl"]}px`},Si=s.div`
|
|
514
514
|
width: 100%;
|
|
515
515
|
|
|
516
516
|
${t.mediaUp("sm")} {
|
|
@@ -532,16 +532,16 @@
|
|
|
532
532
|
${t.mediaUp("2xl")} {
|
|
533
533
|
max-width: ${Ee["2xl"]};
|
|
534
534
|
}
|
|
535
|
-
|
|
535
|
+
`,$i=T.newClassNameGetter("container"),yi=({children:e,className:r,ref:o,...n})=>a.jsx(Si,{...n,ref:o,className:$i("container",r),children:e}),Ze={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},Pe={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},oe=36,tt=2,Ci=12,vr=(e,r,o="en")=>{const n=e.getFullYear(),i=e.getMonth(),l=e.getDate(),c=e.getHours(),d=e.getMinutes(),p=e.getSeconds(),b=c%12||12,h=c>=12,f=new Intl.DateTimeFormat(o,{month:"long"}).format(e),O=new Intl.DateTimeFormat(o,{month:"short"}).format(e),w=new Intl.DateTimeFormat(o,{weekday:"long"}).format(e),S=new Intl.DateTimeFormat(o,{weekday:"short"}).format(e),x=L=>L.toString().padStart(2,"0"),C=L=>L.toString().padStart(2," "),$=L=>`\0${L}\0`,y=[["2006","YEARFOUR",n.toString()],["January","MONTHLONG",f],["Monday","WEEKDAYLONG",w],["Jan","MONTHSHORT",O],["Mon","WEEKDAYSHORT",S],["06","YEARTWO",n.toString().slice(-2)],["01","MONTHPAD",x(i+1)],["_2","DAYSPACE",C(l)],["02","DAYPAD",x(l)],["15","HOURTWENTYFOUR",x(c)],["03","HOURTWELVEPAD",x(b)],["04","MINUTE",x(d)],["05","SECOND",x(p)],["PM","AMPMUP",h?"PM":"AM"],["pm","AMPMLOW",h?"pm":"am"],["1","MONTH",(i+1).toString()],["2","DAY",l.toString()],["3","HOURTWELVE",b.toString()]];let g=r;for(const[L,N]of y)g=g.split(L).join($(N));for(const[,L,N]of y)g=g.split($(L)).join(N);return g},mi=(e,r)=>new Date(e,r+1,0).getDate(),wi=(e,r)=>new Date(e,r,1).getDay(),vi=(e,r,o=1)=>{const n=mi(e,r);let l=wi(e,r)-o;l<0&&(l+=7);const c=[];for(let d=0;d<l;d++)c.push(null);for(let d=1;d<=n;d++)c.push(d);for(;c.length<42;)c.push(null);return c},Ri=(e,r=1)=>{const o=[];for(let n=0;n<7;n++){const i=(r+n)%7,l=new Date(2024,0,7+i);o.push(new Intl.DateTimeFormat(e,{weekday:"short"}).format(l))}return o},ki=e=>{const r=[];for(let o=0;o<12;o++){const n=new Date(2024,o,1);r.push(new Intl.DateTimeFormat(e,{month:"short"}).format(n))}return r},Wt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate(),Kt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth(),Li=(e,r)=>e.getFullYear()===r.getFullYear(),Ut=(e,r,o,n,i)=>{const l=new Date(e,r,o);if(n){const c=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(l<c)return!0}if(i){const c=new Date(i.getFullYear(),i.getMonth(),i.getDate());if(l>c)return!0}return!1},Xt=(e,r,o,n)=>{if(o){const i=o.getFullYear(),l=o.getMonth();if(e<i||e===i&&r<l)return!0}if(n){const i=n.getFullYear(),l=n.getMonth();if(e>i||e===i&&r>l)return!0}return!1},qt=(e,r,o)=>!!(r&&e<r.getFullYear()||o&&e>o.getFullYear()),Ei=(e,r=12)=>{const o=e-Math.floor(r/2),n=[];for(let i=0;i<r;i++)n.push(o+i);return n},Pi=e=>{switch(e){case"date":return"02.01.2006";case"month":return"January 2006";case"year":return"2006"}},ji=s.div`
|
|
536
536
|
position: relative;
|
|
537
537
|
display: inline-flex;
|
|
538
538
|
flex-direction: column;
|
|
539
539
|
gap: 2px;
|
|
540
540
|
min-width: 180px;
|
|
541
541
|
width: ${({$fullWidth:e})=>e?"100%":"fit-content"};
|
|
542
|
-
`,
|
|
542
|
+
`,zi=s(ie)`
|
|
543
543
|
margin-left: 6px;
|
|
544
|
-
`,
|
|
544
|
+
`,Ni=s.button`
|
|
545
545
|
display: flex;
|
|
546
546
|
align-items: center;
|
|
547
547
|
justify-content: space-between;
|
|
@@ -563,43 +563,43 @@
|
|
|
563
563
|
${({$open:e,$variant:r})=>e&&`
|
|
564
564
|
outline: 2px solid ${Pe[r].focus};
|
|
565
565
|
`}
|
|
566
|
-
`,
|
|
566
|
+
`,Ti=s.span`
|
|
567
567
|
flex: 1;
|
|
568
568
|
overflow: hidden;
|
|
569
569
|
text-overflow: ellipsis;
|
|
570
570
|
white-space: nowrap;
|
|
571
|
-
`,
|
|
571
|
+
`,Ii=s.span`
|
|
572
572
|
display: flex;
|
|
573
573
|
align-items: center;
|
|
574
574
|
justify-content: center;
|
|
575
575
|
flex-shrink: 0;
|
|
576
576
|
transition: transform 0.15s ease;
|
|
577
577
|
transform: ${({$open:e})=>e?"rotate(180deg)":"rotate(0deg)"};
|
|
578
|
-
`,
|
|
578
|
+
`,Rr=`
|
|
579
579
|
z-index: 100;
|
|
580
580
|
background-color: ${t.COLORS.white};
|
|
581
581
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
582
582
|
border-radius: 12px;
|
|
583
583
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
584
|
-
padding: ${
|
|
585
|
-
`,
|
|
584
|
+
padding: ${Ci}px;
|
|
585
|
+
`,kr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Ai=s.div`
|
|
586
586
|
position: absolute;
|
|
587
587
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
588
588
|
left: 0;
|
|
589
|
-
${
|
|
589
|
+
${Rr}
|
|
590
590
|
opacity: ${({$open:e})=>e?1:0};
|
|
591
591
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
592
|
-
transform: ${({$open:e,$position:r})=>
|
|
592
|
+
transform: ${({$open:e,$position:r})=>kr(e,r)};
|
|
593
593
|
transition:
|
|
594
594
|
opacity 0.15s ease,
|
|
595
595
|
transform 0.15s ease,
|
|
596
596
|
visibility 0.15s;
|
|
597
|
-
`,
|
|
597
|
+
`,Di=s.div`
|
|
598
598
|
position: fixed;
|
|
599
|
-
${
|
|
599
|
+
${Rr}
|
|
600
600
|
opacity: ${({$open:e})=>e?1:0};
|
|
601
601
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
602
|
-
transform: ${({$open:e,$position:r})=>
|
|
602
|
+
transform: ${({$open:e,$position:r})=>kr(e,r)};
|
|
603
603
|
transition:
|
|
604
604
|
opacity 0.15s ease,
|
|
605
605
|
transform 0.15s ease,
|
|
@@ -652,12 +652,12 @@
|
|
|
652
652
|
`,ct=s.div`
|
|
653
653
|
display: flex;
|
|
654
654
|
gap: 4px;
|
|
655
|
-
`,
|
|
655
|
+
`,_i=s.div`
|
|
656
656
|
display: grid;
|
|
657
657
|
grid-template-columns: repeat(7, ${oe}px);
|
|
658
658
|
gap: ${tt}px;
|
|
659
659
|
margin-bottom: 4px;
|
|
660
|
-
`,
|
|
660
|
+
`,Mi=s.div`
|
|
661
661
|
display: flex;
|
|
662
662
|
align-items: center;
|
|
663
663
|
justify-content: center;
|
|
@@ -666,11 +666,11 @@
|
|
|
666
666
|
font-weight: 500;
|
|
667
667
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
668
668
|
text-transform: uppercase;
|
|
669
|
-
`,
|
|
669
|
+
`,Fi=s.div`
|
|
670
670
|
display: grid;
|
|
671
671
|
grid-template-columns: repeat(7, ${oe}px);
|
|
672
672
|
gap: ${tt}px;
|
|
673
|
-
`,
|
|
673
|
+
`,Bi=s.button`
|
|
674
674
|
display: flex;
|
|
675
675
|
align-items: center;
|
|
676
676
|
justify-content: center;
|
|
@@ -695,12 +695,12 @@
|
|
|
695
695
|
&:disabled {
|
|
696
696
|
cursor: not-allowed;
|
|
697
697
|
}
|
|
698
|
-
`,
|
|
698
|
+
`,Yi=s.div`
|
|
699
699
|
display: grid;
|
|
700
700
|
grid-template-columns: repeat(3, 1fr);
|
|
701
701
|
gap: 8px;
|
|
702
702
|
width: ${7*oe+6*tt}px;
|
|
703
|
-
`,
|
|
703
|
+
`,Vi=s.button`
|
|
704
704
|
display: flex;
|
|
705
705
|
align-items: center;
|
|
706
706
|
justify-content: center;
|
|
@@ -720,12 +720,12 @@
|
|
|
720
720
|
&:hover:not(:disabled) {
|
|
721
721
|
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
722
722
|
}
|
|
723
|
-
`,
|
|
723
|
+
`,Hi=s.div`
|
|
724
724
|
display: grid;
|
|
725
725
|
grid-template-columns: repeat(3, 1fr);
|
|
726
726
|
gap: 8px;
|
|
727
727
|
width: ${7*oe+6*tt}px;
|
|
728
|
-
`,
|
|
728
|
+
`,Gi=s.button`
|
|
729
729
|
display: flex;
|
|
730
730
|
align-items: center;
|
|
731
731
|
justify-content: center;
|
|
@@ -745,10 +745,10 @@
|
|
|
745
745
|
&:hover:not(:disabled) {
|
|
746
746
|
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
747
747
|
}
|
|
748
|
-
`,
|
|
748
|
+
`,Wi=s.div`
|
|
749
749
|
width: ${oe}px;
|
|
750
750
|
height: ${oe}px;
|
|
751
|
-
`,q=T.newClassNameGetter("date-picker"),Ve=4,
|
|
751
|
+
`,q=T.newClassNameGetter("date-picker"),Ve=4,Ki=300,Ui=({value:e,onChange:r,mode:o="date",displayFormat:n,placeholder:i,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:p,size:b="default",variant:h="normal",disabled:f=!1,fullWidth:O=!1,label:w,portalRenderNode:S,open:x,onOpen:C,onClose:$,className:y,classnames:g,ref:L,...N})=>{const j=u.useMemo(()=>new Date,[]),[Y,P]=u.useState(!1),[_,M]=u.useState({top:0,left:0}),[E,A]=u.useState("bottom"),[m,I]=u.useState(()=>o==="year"?"years":o==="month"?"months":"days"),[R,z]=u.useState(()=>e??j),[B,F]=u.useState(()=>((e==null?void 0:e.getFullYear())??j.getFullYear())-6),H=u.useRef(null),k=u.useRef(null),D=u.useRef(null),U=x!==void 0,X=U?x:Y,fe=n??Pi(o),_e=u.useMemo(()=>Ri(l,c),[l,c]),rt=u.useMemo(()=>ki(l),[l]),Yr=u.useMemo(()=>vi(R.getFullYear(),R.getMonth(),c),[R,c]),Me=u.useMemo(()=>Ei(B+6,12),[B]),Pt=u.useMemo(()=>e?vr(e,fe,l):null,[e,fe,l]),Vr=i??fe.replace(/2006|06|January|Jan|01|02/g,"__"),me=u.useCallback(()=>{var ve;if(!k.current)return;const v=k.current.getBoundingClientRect(),V=((ve=D.current)==null?void 0:ve.offsetHeight)??Ki,we=window.innerHeight-v.bottom-Ve,Fe=v.top-Ve,xe=we<V&&Fe>we?"top":"bottom";if(A(xe),S){const Be=xe==="bottom"?v.bottom+Ve:v.top-V-Ve;M({top:Be,left:v.left})}},[S]),jt=u.useCallback(()=>{if(f)return;U||P(!0),C==null||C(),I(o==="year"?"years":o==="month"?"months":"days");const v=e??j;z(v),F(v.getFullYear()-6)},[f,U,C,o,e,j]),Z=u.useCallback(()=>{U||P(!1),$==null||$()},[U,$]),Hr=u.useCallback(()=>{X?Z():jt()},[X,Z,jt]),Gr=u.useCallback(v=>{const V=new Date(R.getFullYear(),R.getMonth(),v);r==null||r(V),Z()},[R,r,Z]),Wr=u.useCallback(v=>{if(o==="month"){const V=new Date(R.getFullYear(),v,1);r==null||r(V),Z()}else z(new Date(R.getFullYear(),v,1)),I("days")},[o,R,r,Z]),Kr=u.useCallback(v=>{if(o==="year"){const V=new Date(v,0,1);r==null||r(V),Z()}else o==="month"?(z(new Date(v,R.getMonth(),1)),I("months")):(z(new Date(v,R.getMonth(),1)),I("months"))},[o,R,r,Z]),Ur=u.useCallback(()=>{z(v=>new Date(v.getFullYear(),v.getMonth()-1,1))},[]),Xr=u.useCallback(()=>{z(v=>new Date(v.getFullYear(),v.getMonth()+1,1))},[]),qr=u.useCallback(()=>{z(v=>new Date(v.getFullYear()-1,v.getMonth(),1))},[]),Zr=u.useCallback(()=>{z(v=>new Date(v.getFullYear()+1,v.getMonth(),1))},[]),Jr=u.useCallback(()=>{F(v=>v-12)},[]),Qr=u.useCallback(()=>{F(v=>v+12)},[]),zt=u.useCallback(()=>{m==="days"?I("months"):m==="months"&&I("years")},[m]);u.useLayoutEffect(()=>{X&&me()},[X,me]),u.useEffect(()=>{const v=xe=>{const ve=xe.target,Be=H.current&&!H.current.contains(ve),no=D.current&&!D.current.contains(ve);S?Be&&no&&Z():Be&&Z()},V=xe=>{xe.key==="Escape"&&Z()},we=()=>{X&&S&&me()},Fe=()=>{X&&S&&me()};return X&&(document.addEventListener("mousedown",v),document.addEventListener("keydown",V),S&&(window.addEventListener("scroll",we,!0),window.addEventListener("resize",Fe))),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",V),window.removeEventListener("scroll",we,!0),window.removeEventListener("resize",Fe)}},[X,Z,S,me]);const eo=Ze[b].iconSize,to=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:q("header",g==null?void 0:g.header),children:[a.jsx(dt,{onClick:zt,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(R)}),a.jsxs(ct,{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(_i,{children:_e.map((v,V)=>a.jsx(Mi,{children:v},V))}),a.jsx(Fi,{className:q("grid",g==null?void 0:g.grid),children:Yr.map((v,V)=>v===null?a.jsx(Wi,{},V):a.jsx(Bi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Wt(e,new Date(R.getFullYear(),R.getMonth(),v)):!1,$today:Wt(j,new Date(R.getFullYear(),R.getMonth(),v)),$disabled:Ut(R.getFullYear(),R.getMonth(),v,d,p),disabled:Ut(R.getFullYear(),R.getMonth(),v,d,p),onClick:()=>Gr(v),children:v},V))})]}),ro=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:q("header",g==null?void 0:g.header),children:[a.jsx(dt,{onClick:zt,type:"button",children:R.getFullYear()}),a.jsxs(ct,{children:[a.jsx(Oe,{onClick:qr,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Zr,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Yi,{className:q("grid",g==null?void 0:g.grid),children:rt.map((v,V)=>a.jsx(Vi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Kt(e,new Date(R.getFullYear(),V,1)):!1,$current:Kt(j,new Date(R.getFullYear(),V,1)),$disabled:Xt(R.getFullYear(),V,d,p),disabled:Xt(R.getFullYear(),V,d,p),onClick:()=>Wr(V),children:v},V))})]}),oo=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:q("header",g==null?void 0:g.header),children:[a.jsxs(dt,{type:"button",style:{cursor:"default"},children:[Me[0]," - ",Me[Me.length-1]]}),a.jsxs(ct,{children:[a.jsx(Oe,{onClick:Jr,type:"button","aria-label":"Previous years",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Qr,type:"button","aria-label":"Next years",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Hi,{className:q("grid",g==null?void 0:g.grid),children:Me.map(v=>a.jsx(Gi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Li(e,new Date(v,0,1)):!1,$current:j.getFullYear()===v,$disabled:qt(v,d,p),disabled:qt(v,d,p),onClick:()=>Kr(v),children:v},v))})]}),Nt=()=>{switch(m){case"days":return to();case"months":return ro();case"years":return oo()}},io=S?ge.createPortal(a.jsx(Di,{ref:D,$open:X,$position:E,className:q("calendar",g==null?void 0:g.calendar),style:{top:_.top,left:_.left},children:Nt()}),S):a.jsx(Ai,{ref:D,$open:X,$position:E,className:q("calendar",g==null?void 0:g.calendar),children:Nt()});return a.jsxs(ji,{...N,ref:L??H,$fullWidth:O,className:q("container",y),children:[w&&a.jsx(zi,{children:w}),a.jsxs(Ni,{ref:k,type:"button",onClick:Hr,disabled:f,$size:b,$variant:h,$disabled:f,$open:X,$hasValue:!!Pt,className:q("trigger",g==null?void 0:g.trigger),children:[a.jsx(Ti,{children:Pt??Vr}),a.jsx(Ii,{$open:X,children:a.jsx(a.ChevronDown,{size:eo})})]}),io]})},Xi={left:t.KEYFRAMES.slideInLeft,right:t.KEYFRAMES.slideInRight,top:t.KEYFRAMES.slideInTop,bottom:t.KEYFRAMES.slideInBottom},qi=(e,r)=>{switch(e){case"left":return`
|
|
752
752
|
top: 0;
|
|
753
753
|
left: 0;
|
|
754
754
|
height: 100%;
|
|
@@ -768,19 +768,19 @@
|
|
|
768
768
|
left: 0;
|
|
769
769
|
width: 100%;
|
|
770
770
|
height: ${r};
|
|
771
|
-
`}},
|
|
771
|
+
`}},Zi=s.div`
|
|
772
772
|
position: fixed;
|
|
773
773
|
z-index: 1001;
|
|
774
774
|
background-color: ${t.COLORS.white};
|
|
775
775
|
box-shadow: 0 4px 24px ${t.alpha(t.COLORS.black,20)};
|
|
776
|
-
${e=>
|
|
777
|
-
animation: ${e=>
|
|
778
|
-
`,
|
|
776
|
+
${e=>qi(e.$position,e.$size)}
|
|
777
|
+
animation: ${e=>Xi[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
778
|
+
`,Ji=T.newClassNameGetter("drawer"),Qi=({animated:e,children:r,className:o,open:n,position:i="right",ref:l,size:c="400px",...d})=>n?ge.createPortal(a.jsx(Zi,{...d,ref:l,className:Ji("container",o),$animated:!!e,$position:i,$size:c,children:r}),document.body):null,en=s.div`
|
|
779
779
|
position: relative;
|
|
780
780
|
display: inline-block;
|
|
781
|
-
`,
|
|
781
|
+
`,tn=s.div`
|
|
782
782
|
cursor: pointer;
|
|
783
|
-
`,
|
|
783
|
+
`,Lr=`
|
|
784
784
|
z-index: 100;
|
|
785
785
|
min-width: 160px;
|
|
786
786
|
padding: 8px;
|
|
@@ -788,33 +788,33 @@
|
|
|
788
788
|
border: 1px solid ${t.COLORS.gray};
|
|
789
789
|
border-radius: 8px;
|
|
790
790
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
791
|
-
`,
|
|
791
|
+
`,Er=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",rn=s.div`
|
|
792
792
|
position: absolute;
|
|
793
793
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
794
794
|
${({$align:e})=>e==="left"?"left: 0;":"right: 0;"}
|
|
795
|
-
${
|
|
795
|
+
${Lr}
|
|
796
796
|
opacity: ${({$open:e})=>e?1:0};
|
|
797
797
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
798
|
-
transform: ${({$open:e,$position:r})=>
|
|
798
|
+
transform: ${({$open:e,$position:r})=>Er(e,r)};
|
|
799
799
|
transition:
|
|
800
800
|
opacity 0.15s ease,
|
|
801
801
|
transform 0.15s ease,
|
|
802
802
|
visibility 0.15s;
|
|
803
|
-
`,
|
|
803
|
+
`,on=s.div`
|
|
804
804
|
position: fixed;
|
|
805
|
-
${
|
|
805
|
+
${Lr}
|
|
806
806
|
opacity: ${({$open:e})=>e?1:0};
|
|
807
807
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
808
|
-
transform: ${({$open:e,$position:r})=>
|
|
808
|
+
transform: ${({$open:e,$position:r})=>Er(e,r)};
|
|
809
809
|
transition:
|
|
810
810
|
opacity 0.15s ease,
|
|
811
811
|
transform 0.15s ease,
|
|
812
812
|
visibility 0.15s;
|
|
813
|
-
`,He=T.newClassNameGetter("dropdown"),Ge=4,
|
|
813
|
+
`,He=T.newClassNameGetter("dropdown"),Ge=4,nn=100,an=({align:e="left",autoClose:r=!0,children:o,className:n,classnames:i,onClose:l,onOpen:c,open:d,portalRenderNode:p,ref:b,trigger:h,...f})=>{const[O,w]=u.useState(!1),[S,x]=u.useState({top:0,left:0}),[C,$]=u.useState("bottom"),y=u.useRef(null),g=u.useRef(null),L=u.useRef(null),N=d!==void 0,j=N?d:O,Y=u.useCallback(()=>{var F,H;if(!g.current)return;const A=g.current.getBoundingClientRect(),m=((F=L.current)==null?void 0:F.offsetHeight)??nn,I=((H=L.current)==null?void 0:H.offsetWidth)??160,R=window.innerHeight-A.bottom-Ge,z=A.top-Ge,B=R<m&&z>R?"top":"bottom";if($(B),p){let k;e==="left"?k=A.left:k=A.right-I;const D=B==="bottom"?A.bottom+Ge:A.top-m-Ge;x({top:D,left:k})}},[e,p]),P=u.useCallback(()=>{N?j?l==null||l():c==null||c():w(A=>{const m=!A;return m?c==null||c():l==null||l(),m})},[N,j,l,c]),_=u.useCallback(()=>{N||w(!1),l==null||l()},[N,l]),M=u.useCallback(()=>{r&&_()},[r,_]);u.useLayoutEffect(()=>{j&&Y()},[j,Y]),u.useEffect(()=>{const A=z=>{const B=z.target,F=y.current&&!y.current.contains(B),H=L.current&&!L.current.contains(B);p?F&&H&&_():F&&_()},m=z=>{z.key==="Escape"&&_()},I=()=>{j&&p&&Y()},R=()=>{j&&p&&Y()};return j&&(document.addEventListener("mousedown",A),document.addEventListener("keydown",m),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",R))),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",m),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",R)}},[j,_,p,Y]);const E=p?ge.createPortal(a.jsx(on,{ref:L,$open:j,$position:C,className:He("content",i==null?void 0:i.content),style:{top:S.top,left:S.left},onClick:M,children:o}),p):a.jsx(rn,{ref:L,$align:e,$open:j,$position:C,className:He("content",i==null?void 0:i.content),onClick:M,children:o});return a.jsxs(en,{...f,ref:b??y,className:He("container",n),children:[a.jsx(tn,{ref:g,onClick:P,className:He("trigger",i==null?void 0:i.trigger),children:u.cloneElement(h)}),E]})},ln=s.div`
|
|
814
814
|
display: inline-flex;
|
|
815
815
|
align-items: center;
|
|
816
816
|
gap: 8px;
|
|
817
|
-
`,
|
|
817
|
+
`,dn=s.span`
|
|
818
818
|
font-size: 14px;
|
|
819
819
|
line-height: 1.4;
|
|
820
820
|
color: ${({$isEmpty:e})=>e?t.COLORS["iron-grey"]:t.COLORS.black};
|
|
@@ -824,7 +824,7 @@
|
|
|
824
824
|
&[contenteditable='true'] {
|
|
825
825
|
cursor: text;
|
|
826
826
|
}
|
|
827
|
-
`,
|
|
827
|
+
`,cn=s.button`
|
|
828
828
|
display: inline-flex;
|
|
829
829
|
align-items: center;
|
|
830
830
|
justify-content: center;
|
|
@@ -841,17 +841,17 @@
|
|
|
841
841
|
&:hover {
|
|
842
842
|
opacity: ${({$disabled:e})=>e?.5:1};
|
|
843
843
|
}
|
|
844
|
-
`,
|
|
844
|
+
`,sn=({value:e,onChange:r,disabled:o=!1,placeholder:n,className:i,classnames:l,"data-test-id":c})=>{const[d,p]=u.useState(!1),b=u.useRef(null),h=u.useRef(null),f=u.useCallback(()=>{var x;p(!1);const S=((x=h.current)==null?void 0:x.textContent)||"";S!==e&&r(S)},[r,e]);u.useEffect(()=>{if(d&&h.current){h.current.focus();const S=document.createRange(),x=window.getSelection();S.selectNodeContents(h.current),S.collapse(!1),x==null||x.removeAllRanges(),x==null||x.addRange(S)}},[d]),u.useEffect(()=>{if(!d)return;const S=x=>{b.current&&!b.current.contains(x.target)&&f()};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[d,f]);const O=()=>{o||p(!0)},w=S=>{S.key==="Enter"&&S.metaKey?(S.preventDefault(),f()):S.key==="Escape"&&(h.current&&(h.current.textContent=e),p(!1))};return a.jsxs(ln,{ref:b,className:i,"data-test-id":c,children:[a.jsx(dn,{ref:h,className:l==null?void 0:l.text,contentEditable:d,suppressContentEditableWarning:!0,onKeyDown:w,$isEmpty:!e,children:e||n}),a.jsx(cn,{type:"button",className:l==null?void 0:l.button,$disabled:o&&!d,onClick:d?f:O,disabled:o&&!d,"aria-label":d?"Save":"Edit",children:d?a.jsx(a.Check,{size:16}):a.jsx(a.Pencil,{size:14})})]})},pn={normal:t.COLORS["iron-grey"],error:t.COLORS.red,success:t.COLORS.green,warning:t.COLORS.yellow},un=s.span`
|
|
845
845
|
display: block;
|
|
846
846
|
font-size: 12px;
|
|
847
847
|
font-weight: 500;
|
|
848
848
|
line-height: 1.4;
|
|
849
|
-
color: ${e=>
|
|
850
|
-
`,
|
|
849
|
+
color: ${e=>pn[e.$variant]};
|
|
850
|
+
`,hn=T.newClassNameGetter("field-message"),bn=({children:e,className:r,ref:o,variant:n="normal",...i})=>e?a.jsx(un,{...i,ref:o,className:hn("container",r),$variant:n,children:e}):null,gn=s.div`
|
|
851
851
|
display: flex;
|
|
852
852
|
flex-direction: column;
|
|
853
853
|
gap: 12px;
|
|
854
|
-
`,
|
|
854
|
+
`,fn=s.div`
|
|
855
855
|
width: ${({$size:e})=>e}px;
|
|
856
856
|
height: ${({$size:e})=>e}px;
|
|
857
857
|
border-radius: 8px;
|
|
@@ -867,10 +867,10 @@
|
|
|
867
867
|
height: 100%;
|
|
868
868
|
object-fit: cover;
|
|
869
869
|
}
|
|
870
|
-
`,
|
|
870
|
+
`,xn=s.span`
|
|
871
871
|
font-size: 12px;
|
|
872
872
|
color: ${t.COLORS["iron-grey"]};
|
|
873
|
-
`,
|
|
873
|
+
`,On=e=>`
|
|
874
874
|
.${e} {
|
|
875
875
|
padding: 7px 16px;
|
|
876
876
|
font-size: 14px;
|
|
@@ -888,7 +888,7 @@
|
|
|
888
888
|
.${e}:active {
|
|
889
889
|
transform: translate(0, 1px);
|
|
890
890
|
}
|
|
891
|
-
`,
|
|
891
|
+
`,Sn=e=>`
|
|
892
892
|
.${e} {
|
|
893
893
|
display: flex;
|
|
894
894
|
flex: 1 1 auto;
|
|
@@ -912,7 +912,7 @@
|
|
|
912
912
|
max-height: 70vh;
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
|
|
915
|
+
`,$n=e=>`
|
|
916
916
|
.${e} {
|
|
917
917
|
padding: 7px 16px;
|
|
918
918
|
font-size: 14px;
|
|
@@ -930,7 +930,7 @@
|
|
|
930
930
|
.${e}:active {
|
|
931
931
|
transform: translate(0, 1px);
|
|
932
932
|
}
|
|
933
|
-
|
|
933
|
+
`,yn=e=>`
|
|
934
934
|
.${e} {
|
|
935
935
|
display: flex;
|
|
936
936
|
flex-direction: column;
|
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
border-radius: 8px;
|
|
949
949
|
}
|
|
950
950
|
}
|
|
951
|
-
`,
|
|
951
|
+
`,Cn=e=>`
|
|
952
952
|
.${e} {
|
|
953
953
|
display: flex;
|
|
954
954
|
justify-content: flex-end;
|
|
@@ -967,7 +967,7 @@
|
|
|
967
967
|
gap: 8px;
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
`,
|
|
970
|
+
`,mn=e=>`
|
|
971
971
|
.${e} {
|
|
972
972
|
display: flex;
|
|
973
973
|
justify-content: flex-start;
|
|
@@ -989,7 +989,7 @@
|
|
|
989
989
|
font-size: 14px;
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
|
-
`,
|
|
992
|
+
`,wn=e=>`
|
|
993
993
|
.${e} {
|
|
994
994
|
display: block;
|
|
995
995
|
z-index: 101;
|
|
@@ -1007,27 +1007,27 @@
|
|
|
1007
1007
|
position: absolute;
|
|
1008
1008
|
touch-action: none;
|
|
1009
1009
|
}
|
|
1010
|
-
`,
|
|
1010
|
+
`,vn=e=>`
|
|
1011
1011
|
.${e} {
|
|
1012
1012
|
position: absolute;
|
|
1013
1013
|
z-index: 2;
|
|
1014
1014
|
background-color: rgba(0, 0, 0, 0.6);
|
|
1015
1015
|
touch-action: none;
|
|
1016
1016
|
}
|
|
1017
|
-
`,
|
|
1017
|
+
`,Rn=e=>`
|
|
1018
1018
|
.${e} {
|
|
1019
1019
|
position: absolute;
|
|
1020
1020
|
z-index: 3;
|
|
1021
1021
|
touch-action: none;
|
|
1022
1022
|
}
|
|
1023
|
-
`,
|
|
1023
|
+
`,kn=e=>`
|
|
1024
1024
|
.${e} {
|
|
1025
1025
|
backface-visibility: hidden;
|
|
1026
1026
|
perspective: 1000px;
|
|
1027
1027
|
max-inline-size: unset !important;
|
|
1028
1028
|
max-block-size: unset !important;
|
|
1029
1029
|
}
|
|
1030
|
-
`,
|
|
1030
|
+
`,Ln=e=>`
|
|
1031
1031
|
.${e} {
|
|
1032
1032
|
position: absolute;
|
|
1033
1033
|
z-index: 100;
|
|
@@ -1038,7 +1038,7 @@
|
|
|
1038
1038
|
overflow: hidden;
|
|
1039
1039
|
border-radius: 50%;
|
|
1040
1040
|
}
|
|
1041
|
-
`,
|
|
1041
|
+
`,En={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},Pn={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},We=(e,r)=>{const o=En[r],{h:n,v:i}=Pn[r];return`
|
|
1042
1042
|
.${e} {
|
|
1043
1043
|
display: block;
|
|
1044
1044
|
z-index: 102;
|
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
${i}: -12px;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
|
-
`},
|
|
1067
|
+
`},jn=e=>`
|
|
1068
1068
|
.${e} {
|
|
1069
1069
|
display: flex;
|
|
1070
1070
|
align-items: center;
|
|
@@ -1090,7 +1090,7 @@
|
|
|
1090
1090
|
padding-bottom: env(safe-area-inset-bottom, 8px);
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
|
-
`,
|
|
1093
|
+
`,zn=e=>`
|
|
1094
1094
|
.${e} {
|
|
1095
1095
|
backface-visibility: hidden;
|
|
1096
1096
|
user-select: none;
|
|
@@ -1103,25 +1103,25 @@
|
|
|
1103
1103
|
position: absolute;
|
|
1104
1104
|
z-index: 1;
|
|
1105
1105
|
}
|
|
1106
|
-
`,
|
|
1107
|
-
${
|
|
1108
|
-
${
|
|
1109
|
-
${
|
|
1110
|
-
${
|
|
1111
|
-
${
|
|
1112
|
-
${
|
|
1113
|
-
${
|
|
1114
|
-
${
|
|
1115
|
-
${
|
|
1116
|
-
${
|
|
1117
|
-
${
|
|
1106
|
+
`,Nn=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__${Nn(e)}`,W=e=>e||[],K=(e,r)=>{if(r)for(const o of r)e.classList.add(o)},Tn=e=>{const r={applyButton:[G("applyButton"),...W(e.applyButton)],cancelButton:[G("cancelButton"),...W(e.cancelButton)],container:[G("container"),...W(e.container)],handlerMove:[G("handlerMove"),...W(e.handlerMove)],handlerResizeTopLeft:[G("handlerResizeTopLeft"),...W(e.handlerResizeTopLeft)],handlerResizeTopRight:[G("handlerResizeTopRight"),...W(e.handlerResizeTopRight)],handlerResizeBottomLeft:[G("handlerResizeBottomLeft"),...W(e.handlerResizeBottomLeft)],handlerResizeBottomRight:[G("handlerResizeBottomRight"),...W(e.handlerResizeBottomRight)],sourceImage:[G("sourceImage"),...W(e.sourceImage)],portalArea:[G("portalArea"),...W(e.portalArea)],previewImage:[G("previewImage"),...W(e.previewImage)],body:[G("body"),...W(e.body)],header:[G("header"),...W(e.header)],footer:[G("footer"),...W(e.footer)],portal:[G("portal"),...W(e.portal)],preview:[G("preview"),...W(e.preview)],root:[G("root"),...W(e.root)]},o=`
|
|
1107
|
+
${On(r.applyButton[0])}
|
|
1108
|
+
${Sn(r.body[0])}
|
|
1109
|
+
${$n(r.cancelButton[0])}
|
|
1110
|
+
${yn(r.container[0])}
|
|
1111
|
+
${Cn(r.footer[0])}
|
|
1112
|
+
${mn(r.header[0])}
|
|
1113
|
+
${wn(r.handlerMove[0])}
|
|
1114
|
+
${vn(r.portalArea[0])}
|
|
1115
|
+
${Rn(r.portal[0])}
|
|
1116
|
+
${kn(r.previewImage[0])}
|
|
1117
|
+
${Ln(r.preview[0])}
|
|
1118
1118
|
${We(r.handlerResizeBottomLeft[0],"bl")}
|
|
1119
1119
|
${We(r.handlerResizeBottomRight[0],"br")}
|
|
1120
1120
|
${We(r.handlerResizeTopLeft[0],"tl")}
|
|
1121
1121
|
${We(r.handlerResizeTopRight[0],"tr")}
|
|
1122
|
-
${
|
|
1123
|
-
${
|
|
1124
|
-
`,n=document.createElement("style");return n.innerHTML=o,document.getElementsByTagName("head")[0].prepend(n),r};let Tn=0;const In=e=>{const r=new Map,o=new Proxy({...e},{set(n,i,l){return Reflect.set(n,i,l),(r.get(i)||[]).forEach(c=>c.action(l,n,i)),!0}});return{getState:()=>({...o}),setState:n=>{for(const i of Object.keys(n)){const l=n[i];l!==void 0&&(o[i]=l)}},subscribe:(n,i)=>{const l=String(++Tn),c=r.get(n)||[];return r.set(n,[...c,{action:i,id:l}]),l},unsubscribe:n=>{for(const[i,l]of r.entries()){const c=l.filter(d=>d.id!==n);if(c.length!==l.length){r.set(i,c);return}}},unsubscribeAll:()=>{r.clear()}}},wt={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},An=(e={},r={})=>In({...wt,config:{...wt.config,...e},css:Nn(r)}),Dn=(e,r)=>{var S;const o=e(),n=document.querySelector(`.${(S=o.css)==null?void 0:S.body[0]}`);if(!n)return o.frame;const{width:i,height:l}=n.getBoundingClientRect(),c=i/l,d=r.width/r.height;let p,b,h=0,f=0;return c>d?(p=l*d,b=l,f=(i-p)/2):(p=i,b=i*(r.height/r.width),h=(l-b)/2),{width:p,height:b,left:f,top:h}},_n=(e,r,o)=>{const[n,i]=r,l=n+e>o.width?(o.width-e)/2:n,c=i+e>o.height?(o.height-e)/2:i;return[l,c]},Mn=(e,r)=>{const{config:o}=e(),n=Math.min(r.width,r.height)-o.framePadding*2,i=o.portalSize>n?n:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=_n(i,o.portalPosition,r);return{left:l,top:c,size:i}}return o.portalPosition==="center"?{size:i,left:(r.width-i)/2,top:(r.height-i)/2}:{left:0,top:0,size:i}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const Fn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerMove),o.setAttribute("data-action",te.MOVE),o},Bn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},Yn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Vn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Hn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},Gn=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.previewImage),o},Wn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.preview),o.appendChild(Gn(e)),o},Kn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portal),o.appendChild(Wn(e)),o.appendChild(Fn(e)),o.appendChild(Vn(e)),o.appendChild(Hn(e)),o.appendChild(Bn(e)),o.appendChild(Yn(e)),o},Un=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portalArea),o.appendChild(Kn(e)),o},Xn=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},qn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.body),o.appendChild(Xn(e)),o.appendChild(Un(e)),o},Zn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.applyButton),n.setAttribute("role","button"),n.innerText=o.config.applyButtonLabel,n.addEventListener("click",r),n},Jn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.cancelButton),n.setAttribute("role","button"),n.innerText=o.config.cancelButtonLabel,n.addEventListener("click",r),n},Qn=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.footer),i.appendChild(Jn(e,o)),i.appendChild(Zn(e,r)),i},ea=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.header),o},ta=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.container),i.appendChild(ea(e)),i.appendChild(qn(e)),i.appendChild(Qn(e,r,o)),i},ra=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");K(i,(l=n.css)==null?void 0:l.root),i.appendChild(ta(e,r,o)),document.body.appendChild(i)},oa=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ie=new Map,ia={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},pe=(e,r)=>{if(Ie.has(e))return Ie.get(e);if(!r)return null;const o=r[ia[e]],n=document.querySelector(`.${o[0]}`);return Ie.set(e,n),n},na=()=>{Ie.clear()},aa=()=>{Ie.clear()},la=(e,r)=>{const o=pe("header",r.css);o&&(o.innerText=e)},da=(e,r)=>{const o=pe("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const n=pe("portalArea",r.css);n&&(n.style.height=`${r.frame.height}px`,n.style.width=`${r.frame.width}px`,n.style.left=`${r.frame.left}px`,n.style.top=`${r.frame.top}px`);const i=pe("portal",r.css);i&&(i.style.width=`${r.portal.size}px`,i.style.height=`${r.portal.size}px`,i.style.left=`${r.portal.left}px`,i.style.top=`${r.portal.top}px`);const l=pe("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},ca=(e,r)=>{const o=pe("portal",r.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const n=pe("previewImage",r.css);n&&(n.style.marginLeft=`-${e.left}px`,n.style.marginTop=`-${e.top}px`)},st=1,sa=e=>{var w,O;const r=e(),o=document.createElement("canvas"),n=r.frame.width||st,i=r.frame.height||st,l=r.sourceWidth/n,c=r.sourceHeight/i,d=r.portal.left*l,p=r.portal.top*c,b=Math.max(r.portal.size*Math.min(l,c),st),h=r.config.outputSize>0?r.config.outputSize:b;o.width=h,o.height=h;const f=document.querySelector(`.${(w=r.css)==null?void 0:w.sourceImage[0]}`);f&&((O=o.getContext("2d"))==null||O.drawImage(f,d,p,b,b,0,0,h,h));const S=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((x,C)=>{try{o.toBlob($=>{if(o.remove(),!$){C(new Error(`Failed to create blob for type: image/${r.config.type}`));return}x([S,$])},`image/${r.config.type}`,r.config.compression)}catch($){o.remove(),C($)}})},pa=(e,r,o)=>{const{emitted:n,portal:i,frame:l,config:c}=r();let d=n.left-n.X+e.clientX,p=n.top-n.Y+e.clientY;const b=c.framePadding,h=l.width-c.framePadding-i.size,f=c.framePadding,S=l.height-c.framePadding-i.size;d<b&&(d=b),d>h&&(d=h),p<f&&(p=f),p>S&&(p=S),o({portal:{...i,left:d,top:p}})},ua=(e,r,o)=>{const{action:n,emitted:i,portal:l,frame:c,config:d}=r(),p=e.pageX-i.X,b=e.pageY-i.Y;switch(n){case te.RESIZE_BR:{let h=i.size+Math.max(p,b);return h<d.minPortalSize&&(h=d.minPortalSize),i.top+h>c.height-d.framePadding&&(h=c.height-i.top-d.framePadding),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding),o({portal:{...l,size:h}})}case te.RESIZE_TR:{let h=p+b>0?i.size+p:i.size-b,f=p+b>0?i.top-p:i.top+b;return h<d.minPortalSize&&(f=i.top+i.size-d.minPortalSize,h=d.minPortalSize),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding,f=i.top-c.width+i.left+i.size),f<d.framePadding&&(h=i.top+i.size,f=d.framePadding),o({portal:{...l,top:f,size:h}})}case te.RESIZE_TL:{const h=Math.min(p,b);let f=i.size-h,S=i.left+h,w=i.top+h;if(f<d.minPortalSize){const O=i.size-d.minPortalSize;f=d.minPortalSize,S=i.left+O,w=i.top+O}if(w<d.framePadding){const O=d.framePadding-w;w=d.framePadding,S=S+O,f=f-O}if(S<d.framePadding){const O=d.framePadding-S;S=d.framePadding,w=w+O,f=f-O}return o({portal:{...l,top:w,left:S,size:f}})}case te.RESIZE_BL:{let h=p+b>0?i.size+b:i.size-p,f=p+b>0?i.left-b:i.left+p;return h<d.minPortalSize&&(f=i.left+i.size-d.minPortalSize,h=d.minPortalSize),h+i.top>c.height-d.framePadding&&(f=i.left-c.height+i.top+i.size,h=c.height-i.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,h=i.left+i.size-d.framePadding),o({portal:{...l,left:f,size:h}})}default:return}},qt=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const r=e;return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}},ha=(e,r)=>{var S,w,O;const o=e(),n=document.querySelector(`.${(S=o.css)==null?void 0:S.portal[0]}`),i=document.querySelector(`.${(w=o.css)==null?void 0:w.portalArea[0]}`),l=document.querySelector(`.${(O=o.css)==null?void 0:O.root[0]}`);let c=null,d=null;const p=x=>{x.preventDefault();const{portal:C}=e(),$=qt(x);if(x.target){const y=x.target.getAttribute("data-action"),g={X:$.pageX,Y:$.pageY,left:C.left,top:C.top,size:C.size};r({action:y,emitted:g})}},b=()=>{const{action:x}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,x&&r({action:null})},h=()=>{if(c=null,!d)return;const x=d;d=null;const{action:C}=e();if(C)switch(C){case te.MOVE:pa(x,e,r);break;default:ua(x,e,r)}},f=x=>{const{action:C}=e();C&&(x.preventDefault(),d=qt(x),c===null&&(c=requestAnimationFrame(h)))};return l&&(l.addEventListener("mouseup",b),l.addEventListener("touchend",b),l.addEventListener("touchcancel",b)),n&&(n.addEventListener("mousedown",p),n.addEventListener("touchstart",p,{passive:!1})),i&&(i.addEventListener("mousemove",f),i.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",b),l.removeEventListener("touchend",b),l.removeEventListener("touchcancel",b)),n&&(n.removeEventListener("mousedown",p),n.removeEventListener("touchstart",p)),i&&(i.removeEventListener("mousemove",f),i.removeEventListener("touchmove",f))}},Zt=1024*1024,ba=(e,r)=>{if(!r.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${r.allowedTypes.join(", ")}`;if(r.maxFileSize>0&&e.size>r.maxFileSize){const o=(r.maxFileSize/Zt).toFixed(2);return`File size (${(e.size/Zt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ga=(e,r,o,n,i,l,c)=>{const d=$=>{c?c($):console.error(`HqCropper: ${$}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:b}=r(),h=ba(p,b);if(h){d(h),e.target.value="";return}const f=new FileReader;let S=null;const w=()=>{var g;const $=r(),y=document.querySelector(`.${(g=$.css)==null?void 0:g.root[0]}`);y&&(y.remove(),document.removeEventListener("keydown",O),S==null||S(),aa(),l(),o(wt))},O=$=>{$.key==="Escape"&&r().sourceBase64&&x($)},x=$=>{$.preventDefault(),w()},C=$=>{$.preventDefault();const y=r();sa(r).then(([g,L])=>{n(g,L,y),x($)}).catch(g=>{d(g instanceof Error?g.message:"Failed to crop image")})};f.onload=$=>{const y=new Image;if(!$.target||typeof $.target.result!="string"){d("Can't load result image");return}y.src=$.target.result,y.onerror=()=>{d("Failed to load image")},y.onload=()=>{var N;ra(r,C,x),na(),i("fileName",la),i("sourceBase64",da),i("portal",ca);const g=Dn(r,y),L=Mn(r,g);o({frame:g,portal:L,fileName:p.name,sourceBase64:(N=$.target)==null?void 0:N.result,sourceHeight:y.height,sourceWidth:y.width}),S=ha(r,o),document.addEventListener("keydown",O)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},fa=(e,r,o,n)=>{const{getState:i,setState:l,subscribe:c,unsubscribeAll:d}=An(r,o),p=oa(b=>ga(b,i,l,e,c,d,n));return{open:()=>p.click()}},ae={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Jt="vacano-image-cropper-styles",xa=`
|
|
1122
|
+
${jn(r.root[0])}
|
|
1123
|
+
${zn(r.sourceImage[0])}
|
|
1124
|
+
`,n=document.createElement("style");return n.innerHTML=o,document.getElementsByTagName("head")[0].prepend(n),r};let In=0;const An=e=>{const r=new Map,o=new Proxy({...e},{set(n,i,l){return Reflect.set(n,i,l),(r.get(i)||[]).forEach(c=>c.action(l,n,i)),!0}});return{getState:()=>({...o}),setState:n=>{for(const i of Object.keys(n)){const l=n[i];l!==void 0&&(o[i]=l)}},subscribe:(n,i)=>{const l=String(++In),c=r.get(n)||[];return r.set(n,[...c,{action:i,id:l}]),l},unsubscribe:n=>{for(const[i,l]of r.entries()){const c=l.filter(d=>d.id!==n);if(c.length!==l.length){r.set(i,c);return}}},unsubscribeAll:()=>{r.clear()}}},vt={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"]}},Dn=(e={},r={})=>An({...vt,config:{...vt.config,...e},css:Tn(r)}),_n=(e,r)=>{var O;const o=e(),n=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!n)return o.frame;const{width:i,height:l}=n.getBoundingClientRect(),c=i/l,d=r.width/r.height;let p,b,h=0,f=0;return c>d?(p=l*d,b=l,f=(i-p)/2):(p=i,b=i*(r.height/r.width),h=(l-b)/2),{width:p,height:b,left:f,top:h}},Mn=(e,r,o)=>{const[n,i]=r,l=n+e>o.width?(o.width-e)/2:n,c=i+e>o.height?(o.height-e)/2:i;return[l,c]},Fn=(e,r)=>{const{config:o}=e(),n=Math.min(r.width,r.height)-o.framePadding*2,i=o.portalSize>n?n:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=Mn(i,o.portalPosition,r);return{left:l,top:c,size:i}}return o.portalPosition==="center"?{size:i,left:(r.width-i)/2,top:(r.height-i)/2}:{left:0,top:0,size:i}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const Bn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerMove),o.setAttribute("data-action",te.MOVE),o},Yn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},Vn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Hn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Gn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},Wn=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.previewImage),o},Kn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.preview),o.appendChild(Wn(e)),o},Un=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portal),o.appendChild(Kn(e)),o.appendChild(Bn(e)),o.appendChild(Hn(e)),o.appendChild(Gn(e)),o.appendChild(Yn(e)),o.appendChild(Vn(e)),o},Xn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portalArea),o.appendChild(Un(e)),o},qn=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Zn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.body),o.appendChild(qn(e)),o.appendChild(Xn(e)),o},Jn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.applyButton),n.setAttribute("role","button"),n.innerText=o.config.applyButtonLabel,n.addEventListener("click",r),n},Qn=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.cancelButton),n.setAttribute("role","button"),n.innerText=o.config.cancelButtonLabel,n.addEventListener("click",r),n},ea=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.footer),i.appendChild(Qn(e,o)),i.appendChild(Jn(e,r)),i},ta=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.header),o},ra=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.container),i.appendChild(ta(e)),i.appendChild(Zn(e)),i.appendChild(ea(e,r,o)),i},oa=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");K(i,(l=n.css)==null?void 0:l.root),i.appendChild(ra(e,r,o)),document.body.appendChild(i)},ia=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ie=new Map,na={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},pe=(e,r)=>{if(Ie.has(e))return Ie.get(e);if(!r)return null;const o=r[na[e]],n=document.querySelector(`.${o[0]}`);return Ie.set(e,n),n},aa=()=>{Ie.clear()},la=()=>{Ie.clear()},da=(e,r)=>{const o=pe("header",r.css);o&&(o.innerText=e)},ca=(e,r)=>{const o=pe("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const n=pe("portalArea",r.css);n&&(n.style.height=`${r.frame.height}px`,n.style.width=`${r.frame.width}px`,n.style.left=`${r.frame.left}px`,n.style.top=`${r.frame.top}px`);const i=pe("portal",r.css);i&&(i.style.width=`${r.portal.size}px`,i.style.height=`${r.portal.size}px`,i.style.left=`${r.portal.left}px`,i.style.top=`${r.portal.top}px`);const l=pe("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},sa=(e,r)=>{const o=pe("portal",r.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const n=pe("previewImage",r.css);n&&(n.style.marginLeft=`-${e.left}px`,n.style.marginTop=`-${e.top}px`)},st=1,pa=e=>{var w,S;const r=e(),o=document.createElement("canvas"),n=r.frame.width||st,i=r.frame.height||st,l=r.sourceWidth/n,c=r.sourceHeight/i,d=r.portal.left*l,p=r.portal.top*c,b=Math.max(r.portal.size*Math.min(l,c),st),h=r.config.outputSize>0?r.config.outputSize:b;o.width=h,o.height=h;const f=document.querySelector(`.${(w=r.css)==null?void 0:w.sourceImage[0]}`);f&&((S=o.getContext("2d"))==null||S.drawImage(f,d,p,b,b,0,0,h,h));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((x,C)=>{try{o.toBlob($=>{if(o.remove(),!$){C(new Error(`Failed to create blob for type: image/${r.config.type}`));return}x([O,$])},`image/${r.config.type}`,r.config.compression)}catch($){o.remove(),C($)}})},ua=(e,r,o)=>{const{emitted:n,portal:i,frame:l,config:c}=r();let d=n.left-n.X+e.clientX,p=n.top-n.Y+e.clientY;const b=c.framePadding,h=l.width-c.framePadding-i.size,f=c.framePadding,O=l.height-c.framePadding-i.size;d<b&&(d=b),d>h&&(d=h),p<f&&(p=f),p>O&&(p=O),o({portal:{...i,left:d,top:p}})},ha=(e,r,o)=>{const{action:n,emitted:i,portal:l,frame:c,config:d}=r(),p=e.pageX-i.X,b=e.pageY-i.Y;switch(n){case te.RESIZE_BR:{let h=i.size+Math.max(p,b);return h<d.minPortalSize&&(h=d.minPortalSize),i.top+h>c.height-d.framePadding&&(h=c.height-i.top-d.framePadding),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding),o({portal:{...l,size:h}})}case te.RESIZE_TR:{let h=p+b>0?i.size+p:i.size-b,f=p+b>0?i.top-p:i.top+b;return h<d.minPortalSize&&(f=i.top+i.size-d.minPortalSize,h=d.minPortalSize),i.left+h>c.width-d.framePadding&&(h=c.width-i.left-d.framePadding,f=i.top-c.width+i.left+i.size),f<d.framePadding&&(h=i.top+i.size,f=d.framePadding),o({portal:{...l,top:f,size:h}})}case te.RESIZE_TL:{const h=Math.min(p,b);let f=i.size-h,O=i.left+h,w=i.top+h;if(f<d.minPortalSize){const S=i.size-d.minPortalSize;f=d.minPortalSize,O=i.left+S,w=i.top+S}if(w<d.framePadding){const S=d.framePadding-w;w=d.framePadding,O=O+S,f=f-S}if(O<d.framePadding){const S=d.framePadding-O;O=d.framePadding,w=w+S,f=f-S}return o({portal:{...l,top:w,left:O,size:f}})}case te.RESIZE_BL:{let h=p+b>0?i.size+b:i.size-p,f=p+b>0?i.left-b:i.left+p;return h<d.minPortalSize&&(f=i.left+i.size-d.minPortalSize,h=d.minPortalSize),h+i.top>c.height-d.framePadding&&(f=i.left-c.height+i.top+i.size,h=c.height-i.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,h=i.left+i.size-d.framePadding),o({portal:{...l,left:f,size:h}})}default:return}},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}},ba=(e,r)=>{var O,w,S;const o=e(),n=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),i=document.querySelector(`.${(w=o.css)==null?void 0:w.portalArea[0]}`),l=document.querySelector(`.${(S=o.css)==null?void 0:S.root[0]}`);let c=null,d=null;const p=x=>{x.preventDefault();const{portal:C}=e(),$=Zt(x);if(x.target){const y=x.target.getAttribute("data-action"),g={X:$.pageX,Y:$.pageY,left:C.left,top:C.top,size:C.size};r({action:y,emitted:g})}},b=()=>{const{action:x}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,x&&r({action:null})},h=()=>{if(c=null,!d)return;const x=d;d=null;const{action:C}=e();if(C)switch(C){case te.MOVE:ua(x,e,r);break;default:ha(x,e,r)}},f=x=>{const{action:C}=e();C&&(x.preventDefault(),d=Zt(x),c===null&&(c=requestAnimationFrame(h)))};return l&&(l.addEventListener("mouseup",b),l.addEventListener("touchend",b),l.addEventListener("touchcancel",b)),n&&(n.addEventListener("mousedown",p),n.addEventListener("touchstart",p,{passive:!1})),i&&(i.addEventListener("mousemove",f),i.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",b),l.removeEventListener("touchend",b),l.removeEventListener("touchcancel",b)),n&&(n.removeEventListener("mousedown",p),n.removeEventListener("touchstart",p)),i&&(i.removeEventListener("mousemove",f),i.removeEventListener("touchmove",f))}},Jt=1024*1024,ga=(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},fa=(e,r,o,n,i,l,c)=>{const d=$=>{c?c($):console.error(`HqCropper: ${$}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:b}=r(),h=ga(p,b);if(h){d(h),e.target.value="";return}const f=new FileReader;let O=null;const w=()=>{var g;const $=r(),y=document.querySelector(`.${(g=$.css)==null?void 0:g.root[0]}`);y&&(y.remove(),document.removeEventListener("keydown",S),O==null||O(),la(),l(),o(vt))},S=$=>{$.key==="Escape"&&r().sourceBase64&&x($)},x=$=>{$.preventDefault(),w()},C=$=>{$.preventDefault();const y=r();pa(r).then(([g,L])=>{n(g,L,y),x($)}).catch(g=>{d(g instanceof Error?g.message:"Failed to crop image")})};f.onload=$=>{const y=new Image;if(!$.target||typeof $.target.result!="string"){d("Can't load result image");return}y.src=$.target.result,y.onerror=()=>{d("Failed to load image")},y.onload=()=>{var N;oa(r,C,x),aa(),i("fileName",da),i("sourceBase64",ca),i("portal",sa);const g=_n(r,y),L=Fn(r,g);o({frame:g,portal:L,fileName:p.name,sourceBase64:(N=$.target)==null?void 0:N.result,sourceHeight:y.height,sourceWidth:y.width}),O=ba(r,o),document.addEventListener("keydown",S)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},xa=(e,r,o,n)=>{const{getState:i,setState:l,subscribe:c,unsubscribeAll:d}=Dn(r,o),p=ia(b=>fa(b,i,l,e,c,d,n));return{open:()=>p.click()}},ae={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Qt="vacano-image-cropper-styles",Oa=`
|
|
1125
1125
|
.vacano-cropper-root {
|
|
1126
1126
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1127
1127
|
backdrop-filter: blur(4px);
|
|
@@ -1169,14 +1169,14 @@
|
|
|
1169
1169
|
.vacano-cropper-apply-button:hover {
|
|
1170
1170
|
background-color: ${t.COLORS["iron-grey"]};
|
|
1171
1171
|
}
|
|
1172
|
-
`,
|
|
1172
|
+
`,Sa=()=>{if(typeof document>"u"||document.getElementById(Qt))return;const e=document.createElement("style");e.id=Qt,e.textContent=Oa,document.head.appendChild(e)},$a={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:n=ae.cancelLabel,compression:i=ae.compression,maxFileSize:l=ae.maxFileSize,onCrop:c,onError:d,outputSize:p=ae.outputSize,portalSize:b=ae.portalSize,type:h=ae.type}=e,f=u.useRef(null);return{open:u.useCallback(()=>{f.current||(Sa(),f.current=xa((w,S,x)=>{S&&(c==null||c({base64:w,blob:S,state:x}))},{portalSize:b,outputSize:p,compression:i,type:h,maxFileSize:l,allowedTypes:r,applyButtonLabel:o,cancelButtonLabel:n},$a,w=>{d==null||d({code:"CROPPER_ERROR",message:w})})),f.current.open()},[r,o,n,i,l,c,d,p,b,h])}},pt=T.newClassNameGetter("image-cropper"),ya=({allowedTypes:e,applyLabel:r,buttonLabel:o="Select Image",cancelLabel:n,className:i,classnames:l,compression:c,maxFileSize:d,onCrop:p,onError:b,outputSize:h,portalSize:f,previewSize:O=120,ref:w,type:S,value:x,...C})=>{const[$,y]=u.useState(x??null),{open:g}=Pr({allowedTypes:e,applyLabel:r,cancelLabel:n,compression:c,maxFileSize:d,onCrop:L=>{y(L.base64),p==null||p(L)},onError:b,outputSize:h,portalSize:f,type:S});return a.jsxs(gn,{...C,ref:w,className:pt("container",i),children:[a.jsx(fn,{$size:O,className:pt("preview",l==null?void 0:l.preview),children:$?a.jsx("img",{src:$,alt:"Preview"}):a.jsx(xn,{children:"No image"})}),a.jsx(De,{variant:"system",onClick:g,className:pt("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,ut=e=>er[e]??er.default,Ca=s.div`
|
|
1173
1173
|
display: grid;
|
|
1174
1174
|
flex-direction: column;
|
|
1175
1175
|
gap: 2px;
|
|
1176
1176
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1177
|
-
`,
|
|
1177
|
+
`,ma=s(ie)`
|
|
1178
1178
|
margin-left: 6px;
|
|
1179
|
-
`,
|
|
1179
|
+
`,wa=s.input`
|
|
1180
1180
|
flex: 1;
|
|
1181
1181
|
min-width: 0;
|
|
1182
1182
|
outline: none;
|
|
@@ -1204,7 +1204,7 @@
|
|
|
1204
1204
|
color: ${e=>le(e.$variant).placeholder.disabled};
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
|
-
`,ht=T.newClassNameGetter("input"),
|
|
1207
|
+
`,ht=T.newClassNameGetter("input"),jr=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,size:c="default",variant:d="normal",...p})=>a.jsxs(Ca,{className:ht("container",e),$fullWidth:!!n,children:[a.jsx(ma,{variant:d,className:ht("label",r==null?void 0:r.label),children:i}),a.jsx(wa,{...p,ref:l,disabled:o,$size:c,$variant:d,className:ht("input",r==null?void 0:r.input)})]}),va=s.div`
|
|
1208
1208
|
position: fixed;
|
|
1209
1209
|
inset: 0;
|
|
1210
1210
|
z-index: 1000;
|
|
@@ -1213,7 +1213,7 @@
|
|
|
1213
1213
|
justify-content: center;
|
|
1214
1214
|
background-color: ${t.alpha(t.COLORS.black,50)};
|
|
1215
1215
|
animation: ${t.KEYFRAMES.fadeIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1216
|
-
`,
|
|
1216
|
+
`,Ra=s.div`
|
|
1217
1217
|
position: relative;
|
|
1218
1218
|
z-index: 1001;
|
|
1219
1219
|
width: ${e=>e.$width};
|
|
@@ -1224,21 +1224,21 @@
|
|
|
1224
1224
|
border-radius: 16px;
|
|
1225
1225
|
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1226
1226
|
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1227
|
-
`,
|
|
1227
|
+
`,rr=T.newClassNameGetter("modal"),zr=({animated:e,children:r,className:o,classnames:n,open:i,ref:l,width:c="500px",...d})=>i?ge.createPortal(a.jsx(va,{className:rr("overlay",n==null?void 0:n.overlay),$animated:!!e,children:a.jsx(Ra,{...d,ref:l,className:rr("content",o,n==null?void 0:n.content),$animated:!!e,$width:c,children:r})}),document.body):null,Nr={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},ka=s.div`
|
|
1228
1228
|
display: flex;
|
|
1229
1229
|
flex-direction: column;
|
|
1230
1230
|
gap: 4px;
|
|
1231
|
-
`,
|
|
1231
|
+
`,La=s(ie)`
|
|
1232
1232
|
margin-left: 6px;
|
|
1233
|
-
color: ${e=>
|
|
1234
|
-
`,
|
|
1233
|
+
color: ${e=>Nr[e.$variant].label};
|
|
1234
|
+
`,Ea=s.button`
|
|
1235
1235
|
display: flex;
|
|
1236
1236
|
flex-wrap: wrap;
|
|
1237
1237
|
align-items: center;
|
|
1238
1238
|
gap: 6px;
|
|
1239
1239
|
min-height: 44px;
|
|
1240
1240
|
padding: 8px 12px;
|
|
1241
|
-
border: 1px dashed ${e=>
|
|
1241
|
+
border: 1px dashed ${e=>Nr[e.$variant].border};
|
|
1242
1242
|
border-radius: 8px;
|
|
1243
1243
|
background: ${t.COLORS.white};
|
|
1244
1244
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
@@ -1249,31 +1249,31 @@
|
|
|
1249
1249
|
&:hover:not(:disabled) {
|
|
1250
1250
|
border-color: ${e=>e.$variant==="error"?t.COLORS.red:t.COLORS.black};
|
|
1251
1251
|
}
|
|
1252
|
-
`,
|
|
1252
|
+
`,Pa=s.span`
|
|
1253
1253
|
color: ${t.COLORS["iron-grey"]};
|
|
1254
1254
|
font-size: 14px;
|
|
1255
|
-
`,
|
|
1255
|
+
`,ja=s.div`
|
|
1256
1256
|
display: flex;
|
|
1257
1257
|
flex-direction: column;
|
|
1258
1258
|
padding: 20px;
|
|
1259
1259
|
gap: 16px;
|
|
1260
|
-
`,
|
|
1260
|
+
`,za=s.div`
|
|
1261
1261
|
display: flex;
|
|
1262
1262
|
align-items: center;
|
|
1263
1263
|
justify-content: space-between;
|
|
1264
|
-
`,
|
|
1264
|
+
`,Na=s.h3`
|
|
1265
1265
|
margin: 0;
|
|
1266
1266
|
font-size: 18px;
|
|
1267
1267
|
font-weight: 600;
|
|
1268
1268
|
color: ${t.COLORS.black};
|
|
1269
|
-
`,
|
|
1269
|
+
`,Ta=s.div`
|
|
1270
1270
|
display: flex;
|
|
1271
1271
|
flex-direction: column;
|
|
1272
1272
|
gap: 4px;
|
|
1273
1273
|
min-height: 200px;
|
|
1274
1274
|
max-height: 300px;
|
|
1275
1275
|
overflow-y: auto;
|
|
1276
|
-
`,
|
|
1276
|
+
`,Ia=s.label`
|
|
1277
1277
|
display: flex;
|
|
1278
1278
|
align-items: center;
|
|
1279
1279
|
gap: 10px;
|
|
@@ -1286,10 +1286,10 @@
|
|
|
1286
1286
|
&:hover {
|
|
1287
1287
|
background-color: ${e=>e.$disabled?"transparent":t.COLORS.gray};
|
|
1288
1288
|
}
|
|
1289
|
-
`,
|
|
1289
|
+
`,Aa=s.span`
|
|
1290
1290
|
font-size: 14px;
|
|
1291
1291
|
color: ${t.COLORS.black};
|
|
1292
|
-
`,
|
|
1292
|
+
`,Da=s.div`
|
|
1293
1293
|
display: flex;
|
|
1294
1294
|
align-items: center;
|
|
1295
1295
|
justify-content: center;
|
|
@@ -1297,31 +1297,31 @@
|
|
|
1297
1297
|
color: ${t.COLORS["iron-grey"]};
|
|
1298
1298
|
font-size: 14px;
|
|
1299
1299
|
text-align: center;
|
|
1300
|
-
`,Q=T.newClassNameGetter("multi-select"),
|
|
1300
|
+
`,Q=T.newClassNameGetter("multi-select"),_a=({className:e,classnames:r,disabled:o=!1,emptyMessage:n="No options found",label:i,maxVisible:l=1/0,modalTitle:c="Select options",onChange:d,options:p,placeholder:b="Select...",ref:h,searchPlaceholder:f="Search...",value:O,variant:w="normal",...S})=>{const[x,C]=u.useState(!1),[$,y]=u.useState(""),g=u.useMemo(()=>p.filter(E=>O.includes(E.value)),[p,O]),L=u.useMemo(()=>{if(!$.trim())return p;const E=$.toLowerCase().trim();return p.filter(A=>A.label.toLowerCase().includes(E))},[p,$]),N=l===1/0?g:g.slice(0,l),j=g.length-N.length,Y=()=>{o||(C(!0),y(""))},P=()=>{C(!1),y("")},_=E=>{O.includes(E)?d(O.filter(A=>A!==E)):d([...O,E])},M=E=>{d(O.filter(A=>A!==E))};return a.jsxs(ka,{...S,ref:h,className:Q("container",e),children:[i&&a.jsx(La,{$variant:w,className:Q("label",r==null?void 0:r.trigger),children:i}),a.jsx(Ea,{type:"button",$variant:w,$disabled:o,disabled:o,onClick:Y,className:Q("trigger",r==null?void 0:r.trigger),children:g.length===0?a.jsx(Pa,{className:Q("placeholder",r==null?void 0:r.placeholder),children:b}):a.jsxs(a.Fragment,{children:[N.map(E=>a.jsx(Je,{deletable:!0,onDelete:()=>M(E.value),onClick:A=>A.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:E.label},E.value)),j>0&&a.jsxs(Je,{variant:"gray",onClick:E=>E.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:["+",j]})]})}),a.jsx(zr,{open:x,width:"400px",animated:!0,className:Q("modal",r==null?void 0:r.modal),children:a.jsxs(ja,{children:[a.jsxs(za,{children:[a.jsx(Na,{children:c}),a.jsx(De,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:P})]}),a.jsx(jr,{type:"text",value:$,onChange:E=>y(E.target.value),placeholder:f,autoFocus:!0,fullWidth:!0,className:Q("search",r==null?void 0:r.search)}),a.jsx(Ta,{className:Q("options",r==null?void 0:r.options),children:L.length===0?a.jsx(Da,{className:Q("empty",r==null?void 0:r.empty),children:n}):L.map(E=>a.jsxs(Ia,{$disabled:!!E.disabled,className:Q("option",r==null?void 0:r.option),children:[a.jsx(et,{checked:O.includes(E.value),disabled:E.disabled,onChange:()=>_(E.value)}),a.jsx(Aa,{children:E.label})]},E.value))})]})})]})},Ma=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}},Tr=u.createContext(null),ir=e=>or[e]??or.default,Fa=s.div`
|
|
1301
1301
|
position: fixed;
|
|
1302
1302
|
top: 0;
|
|
1303
1303
|
left: 0;
|
|
1304
1304
|
right: 0;
|
|
1305
1305
|
z-index: 9999;
|
|
1306
1306
|
pointer-events: none;
|
|
1307
|
-
`,
|
|
1307
|
+
`,Ba=s.div`
|
|
1308
1308
|
display: flex;
|
|
1309
1309
|
align-items: center;
|
|
1310
1310
|
justify-content: center;
|
|
1311
1311
|
gap: 12px;
|
|
1312
1312
|
min-height: 44px;
|
|
1313
1313
|
padding: 12px 48px;
|
|
1314
|
-
background-color: ${({$variant:e})=>
|
|
1315
|
-
color: ${({$variant:e})=>
|
|
1314
|
+
background-color: ${({$variant:e})=>ir(e).background};
|
|
1315
|
+
color: ${({$variant:e})=>ir(e).text};
|
|
1316
1316
|
animation: ${({$isExiting:e})=>e?t.KEYFRAMES.slideOutTopFade:t.KEYFRAMES.slideInTopFade}
|
|
1317
1317
|
0.3s ease-out forwards;
|
|
1318
1318
|
pointer-events: auto;
|
|
1319
|
-
`,
|
|
1319
|
+
`,Ya=s.span`
|
|
1320
1320
|
font-size: 14px;
|
|
1321
1321
|
font-weight: 500;
|
|
1322
1322
|
line-height: 1.4;
|
|
1323
1323
|
text-align: center;
|
|
1324
|
-
`,
|
|
1324
|
+
`,Va=s.button`
|
|
1325
1325
|
position: absolute;
|
|
1326
1326
|
right: 16px;
|
|
1327
1327
|
top: 50%;
|
|
@@ -1342,18 +1342,18 @@
|
|
|
1342
1342
|
&:hover {
|
|
1343
1343
|
opacity: 1;
|
|
1344
1344
|
}
|
|
1345
|
-
`,
|
|
1345
|
+
`,Ha=s.div`
|
|
1346
1346
|
position: relative;
|
|
1347
|
-
`,
|
|
1347
|
+
`,Ga=({notification:e,onRemove:r,onAnimationEnd:o})=>{const[n,i]=u.useState(!1),l=()=>{i(!0)},c=()=>{n&&(r(),o())};return u.useEffect(()=>{const d=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(d)},[e.duration,e.id]),a.jsx(Ha,{children:a.jsxs(Ba,{$variant:e.variant,$isExiting:n,onAnimationEnd:c,children:[a.jsx(Ya,{children:e.message}),a.jsx(Va,{onClick:l,children:a.jsx(a.X,{style:{width:18,height:18}})})]})})},Wa=(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}},Ka={current:null,queue:[]},Ua=({children:e})=>{const[r,o]=u.useReducer(Wa,Ka),n=u.useCallback((d,p="default",b=Ma)=>{const h=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_NOTIFICATION",payload:{id:h,message:d,variant:p,duration:b}})},[]),i=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),l=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),c=u.useCallback(()=>{setTimeout(()=>{o({type:"SHOW_NEXT"})},100)},[]);return a.jsxs(Tr.Provider,{value:{show:n,hide:i},children:[e,a.jsx(Fa,{children:r.current&&a.jsx(Ga,{notification:r.current,onRemove:l,onAnimationEnd:c},r.current.id)})]})},Xa=()=>{const e=u.useContext(Tr);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)}},Te=e=>nr[e]??nr.default,Se=e=>ar[e]??ar.normal,qa=s.div`
|
|
1348
1348
|
display: inline-flex;
|
|
1349
1349
|
flex-direction: column;
|
|
1350
1350
|
gap: 2px;
|
|
1351
|
-
`,
|
|
1351
|
+
`,Za=s(ie)`
|
|
1352
1352
|
margin-left: 6px;
|
|
1353
|
-
`,
|
|
1353
|
+
`,Ja=s.div`
|
|
1354
1354
|
display: flex;
|
|
1355
1355
|
gap: ${e=>Te(e.$size).gap};
|
|
1356
|
-
`,
|
|
1356
|
+
`,Qa=s.input`
|
|
1357
1357
|
width: ${e=>Te(e.$size).width};
|
|
1358
1358
|
height: ${e=>Te(e.$size).height};
|
|
1359
1359
|
border-radius: ${e=>Te(e.$size).radius};
|
|
@@ -1378,7 +1378,7 @@
|
|
|
1378
1378
|
&::selection {
|
|
1379
1379
|
background-color: transparent;
|
|
1380
1380
|
}
|
|
1381
|
-
`,bt=T.newClassNameGetter("otp-code"),
|
|
1381
|
+
`,bt=T.newClassNameGetter("otp-code"),el=({autoFocus:e,className:r,classnames:o,disabled:n,label:i,length:l=6,onChange:c,ref:d,size:p="default",value:b="",variant:h="normal",...f})=>{const O=u.useRef([]);u.useEffect(()=>{e&&O.current[0]&&O.current[0].focus()},[e]);const w=u.useCallback($=>{const y=O.current[$];y&&(y.focus(),y.select())},[]),S=u.useCallback(($,y)=>{const L=y.target.value.replace(/\D/g,"").slice(-1);if(!L)return;const N=b.padEnd(l," ").split(""),j=N.findIndex(M=>M===" "||M===""),Y=j!==-1?j:$;N[Y]=L;const P=N.join("").replace(/ /g,"");c==null||c(P);const _=Y+1;_<l&&w(_)},[b,l,c,w]),x=u.useCallback(($,y)=>{if(y.key==="Backspace"){y.preventDefault();const g=b.split("");g[$]?(g[$]="",c==null||c(g.join(""))):$>0&&(g[$-1]="",c==null||c(g.join("")),w($-1))}else y.key==="ArrowLeft"&&$>0?(y.preventDefault(),w($-1)):y.key==="ArrowRight"&&$<l-1&&(y.preventDefault(),w($+1))},[b,l,c,w]),C=u.useCallback($=>{$.preventDefault();const y=$.clipboardData.getData("text").replace(/\D/g,"").slice(0,l);if(y){c==null||c(y);const g=Math.min(y.length,l-1);w(g)}},[l,c,w]);return a.jsxs(qa,{ref:d,className:bt("container",r),...f,children:[i&&a.jsx(Za,{variant:h,className:bt("label",o==null?void 0:o.label),children:i}),a.jsx(Ja,{$size:p,children:Array.from({length:l}).map(($,y)=>a.jsx(Qa,{ref:g=>{O.current[y]=g},type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:2,disabled:n,value:b[y]??"",onChange:g=>S(y,g),onKeyDown:g=>x(y,g),onPaste:C,onFocus:g=>g.target.select(),$size:p,$variant:h,className:bt("input",o==null?void 0:o.input)},y))})]})},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"}},Qe=e=>lr[e]??lr.light,tl=s.div`
|
|
1382
1382
|
display: flex;
|
|
1383
1383
|
flex-direction: column;
|
|
1384
1384
|
gap: 16px;
|
|
@@ -1386,48 +1386,48 @@
|
|
|
1386
1386
|
border: 1px dashed ${({$variant:e})=>Qe(e).border};
|
|
1387
1387
|
border-radius: 16px;
|
|
1388
1388
|
background-color: ${({$variant:e})=>Qe(e).background};
|
|
1389
|
-
`,
|
|
1389
|
+
`,rl=s.div`
|
|
1390
1390
|
display: flex;
|
|
1391
1391
|
flex-direction: column;
|
|
1392
1392
|
gap: 4px;
|
|
1393
|
-
`,
|
|
1393
|
+
`,ol=s.div`
|
|
1394
1394
|
font-size: 18px;
|
|
1395
1395
|
font-weight: 600;
|
|
1396
1396
|
line-height: 1.4;
|
|
1397
1397
|
color: ${({$variant:e})=>Qe(e).title};
|
|
1398
|
-
`,
|
|
1398
|
+
`,il=s.div`
|
|
1399
1399
|
font-size: 14px;
|
|
1400
1400
|
line-height: 1.5;
|
|
1401
1401
|
color: ${({$variant:e})=>Qe(e).description};
|
|
1402
|
-
`,
|
|
1402
|
+
`,nl=s.div`
|
|
1403
1403
|
display: flex;
|
|
1404
1404
|
flex-wrap: wrap;
|
|
1405
1405
|
gap: 8px;
|
|
1406
|
-
`,Ke=T.newClassNameGetter("panel"),
|
|
1406
|
+
`,Ke=T.newClassNameGetter("panel"),al=({children:e,className:r,classnames:o,description:n,ref:i,title:l,variant:c="light",...d})=>{const p=l||n;return a.jsxs(tl,{...d,ref:i,className:Ke("container",r),$variant:c,children:[p&&a.jsxs(rl,{children:[l&&a.jsx(ol,{className:Ke("title",o==null?void 0:o.title),$variant:c,children:l}),n&&a.jsx(il,{className:Ke("description",o==null?void 0:o.description),$variant:c,children:n})]}),a.jsx(nl,{className:Ke("content",o==null?void 0:o.content),children:e})]})},Rt={compact:{height:4,radius:2},default:{height:8,radius:4}},ll=s.div`
|
|
1407
1407
|
width: 100%;
|
|
1408
|
-
height: ${({$size:e})=>
|
|
1409
|
-
border-radius: ${({$size:e})=>
|
|
1408
|
+
height: ${({$size:e})=>Rt[e].height}px;
|
|
1409
|
+
border-radius: ${({$size:e})=>Rt[e].radius}px;
|
|
1410
1410
|
background-color: ${t.COLORS.gray};
|
|
1411
1411
|
overflow: hidden;
|
|
1412
|
-
`,
|
|
1412
|
+
`,dl=s.div`
|
|
1413
1413
|
height: 100%;
|
|
1414
1414
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1415
|
-
border-radius: ${({$size:e})=>
|
|
1415
|
+
border-radius: ${({$size:e})=>Rt[e].radius}px;
|
|
1416
1416
|
background-color: ${t.COLORS.black};
|
|
1417
1417
|
transition: width 0.2s ease;
|
|
1418
|
-
`,
|
|
1418
|
+
`,dr=T.newClassNameGetter("progress"),cl=({value:e,size:r="default",className:o,classnames:n,ref:i,...l})=>a.jsx(ll,{...l,ref:i,$size:r,className:dr("track",o,n==null?void 0:n.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(dl,{$size:r,$value:e,className:dr("bar",n==null?void 0:n.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,sl=s.label`
|
|
1419
1419
|
display: inline-flex;
|
|
1420
1420
|
align-items: flex-start;
|
|
1421
1421
|
gap: 8px;
|
|
1422
1422
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1423
1423
|
opacity: ${e=>e.$disabled?.5:1};
|
|
1424
|
-
`,
|
|
1424
|
+
`,pl=s.input`
|
|
1425
1425
|
position: absolute;
|
|
1426
1426
|
opacity: 0;
|
|
1427
1427
|
width: 0;
|
|
1428
1428
|
height: 0;
|
|
1429
1429
|
pointer-events: none;
|
|
1430
|
-
`,
|
|
1430
|
+
`,ul=s.span`
|
|
1431
1431
|
display: inline-flex;
|
|
1432
1432
|
align-items: center;
|
|
1433
1433
|
justify-content: center;
|
|
@@ -1442,7 +1442,7 @@
|
|
|
1442
1442
|
border-color 0.15s ease,
|
|
1443
1443
|
background-color 0.15s ease,
|
|
1444
1444
|
box-shadow 0.15s ease;
|
|
1445
|
-
`,
|
|
1445
|
+
`,hl=s.span`
|
|
1446
1446
|
width: 8px;
|
|
1447
1447
|
height: 8px;
|
|
1448
1448
|
border-radius: 50%;
|
|
@@ -1452,7 +1452,7 @@
|
|
|
1452
1452
|
transition:
|
|
1453
1453
|
opacity 0.15s ease,
|
|
1454
1454
|
transform 0.15s ease;
|
|
1455
|
-
`,
|
|
1455
|
+
`,bl=s.span`
|
|
1456
1456
|
font-size: 14px;
|
|
1457
1457
|
font-weight: 500;
|
|
1458
1458
|
line-height: 1.5;
|
|
@@ -1468,7 +1468,7 @@
|
|
|
1468
1468
|
text-decoration: none;
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
|
-
`,je=T.newClassNameGetter("radio"),
|
|
1471
|
+
`,je=T.newClassNameGetter("radio"),Et=({checked:e,className:r,classnames:o,disabled:n,label:i,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(sl,{className:je("container",r),$disabled:!!n,$variant:d,children:[a.jsx(pl,{...p,ref:c,type:"radio",className:je("input",o==null?void 0:o.input),checked:e,disabled:n,onChange:l}),a.jsx(ul,{className:je("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(hl,{className:je("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),i&&a.jsx(bl,{className:je("label",o==null?void 0:o.label),$variant:d,children:i})]}),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,gl=s.label`
|
|
1472
1472
|
display: grid;
|
|
1473
1473
|
grid-template-columns: auto 1fr;
|
|
1474
1474
|
align-items: start;
|
|
@@ -1492,7 +1492,7 @@
|
|
|
1492
1492
|
.vacano_radio_container {
|
|
1493
1493
|
pointer-events: none;
|
|
1494
1494
|
}
|
|
1495
|
-
`,
|
|
1495
|
+
`,fl=s.input`
|
|
1496
1496
|
position: absolute;
|
|
1497
1497
|
width: 1px;
|
|
1498
1498
|
height: 1px;
|
|
@@ -1502,12 +1502,12 @@
|
|
|
1502
1502
|
clip: rect(0, 0, 0, 0);
|
|
1503
1503
|
white-space: nowrap;
|
|
1504
1504
|
border: 0;
|
|
1505
|
-
`,
|
|
1505
|
+
`,xl=s.div`
|
|
1506
1506
|
display: flex;
|
|
1507
1507
|
flex-direction: column;
|
|
1508
1508
|
gap: 2px;
|
|
1509
1509
|
min-width: 0;
|
|
1510
|
-
`,
|
|
1510
|
+
`,Ol=s.span`
|
|
1511
1511
|
font-size: 14px;
|
|
1512
1512
|
font-weight: 500;
|
|
1513
1513
|
line-height: 1.4;
|
|
@@ -1516,7 +1516,7 @@
|
|
|
1516
1516
|
label[data-disabled='true'] & {
|
|
1517
1517
|
color: ${e=>he(e.$variant).label.disabled};
|
|
1518
1518
|
}
|
|
1519
|
-
`,
|
|
1519
|
+
`,Sl=s.span`
|
|
1520
1520
|
font-size: 12px;
|
|
1521
1521
|
font-weight: 400;
|
|
1522
1522
|
line-height: 1.4;
|
|
@@ -1525,21 +1525,21 @@
|
|
|
1525
1525
|
label[data-disabled='true'] & {
|
|
1526
1526
|
color: ${e=>he(e.$variant).description.disabled};
|
|
1527
1527
|
}
|
|
1528
|
-
`,Ue=T.newClassNameGetter("radio-card")
|
|
1528
|
+
`,Ue=T.newClassNameGetter("radio-card"),$l=({checked:e,className:r,classnames:o,description:n,disabled:i,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:b="normal",...h})=>a.jsxs(gl,{className:Ue("container",r),$checked:e,$disabled:!!i,$fullWidth:l,$variant:b,"data-disabled":i,children:[a.jsx(fl,{...h,ref:p,type:"radio",checked:e,disabled:i,onChange:d}),a.jsx(Et,{className:o==null?void 0:o.radio,checked:e,disabled:i,variant:b,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(xl,{className:Ue("content",o==null?void 0:o.content),children:[a.jsx(Ol,{className:Ue("label",o==null?void 0:o.label),$variant:b,children:c}),n&&a.jsx(Sl,{className:Ue("description",o==null?void 0:o.description),$variant:b,children:n})]})]}),pr={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},yl=s.div`
|
|
1529
1529
|
display: flex;
|
|
1530
1530
|
flex-direction: column;
|
|
1531
1531
|
gap: 8px;
|
|
1532
|
-
`,
|
|
1532
|
+
`,Cl=s.span`
|
|
1533
1533
|
font-size: 13px;
|
|
1534
1534
|
font-weight: 500;
|
|
1535
1535
|
line-height: 1.5;
|
|
1536
|
-
color: ${e=>e.$disabled?
|
|
1536
|
+
color: ${e=>e.$disabled?pr.label.disabledColor:pr.label.color};
|
|
1537
1537
|
margin-bottom: 4px;
|
|
1538
|
-
`,
|
|
1538
|
+
`,ml=s.div`
|
|
1539
1539
|
display: flex;
|
|
1540
1540
|
flex-direction: column;
|
|
1541
1541
|
gap: 12px;
|
|
1542
|
-
`,gt=T.newClassNameGetter("radio-group"),
|
|
1542
|
+
`,gt=T.newClassNameGetter("radio-group"),wl=({className:e,classnames:r,disabled:o,label:n,name:i,onChange:l,options:c,ref:d,value:p,...b})=>a.jsxs(yl,{...b,ref:d,className:gt("container",e),children:[n&&a.jsx(Cl,{className:gt("label",r==null?void 0:r.label),$disabled:o,children:n}),a.jsx(ml,{className:gt("options",r==null?void 0:r.options),children:c.map(h=>a.jsx(Et,{className:r==null?void 0:r.radio,name:i,checked:p===h.value,label:h.label,disabled:o,onChange:()=>l(h.value)},h.value))})]}),Ir=u.createContext(null),vl=s.div`
|
|
1543
1543
|
position: fixed;
|
|
1544
1544
|
bottom: 24px;
|
|
1545
1545
|
right: 24px;
|
|
@@ -1554,19 +1554,19 @@
|
|
|
1554
1554
|
animation: ${t.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1555
1555
|
pointer-events: none;
|
|
1556
1556
|
color: ${t.COLORS.black};
|
|
1557
|
-
`,
|
|
1557
|
+
`,Rl=s.span`
|
|
1558
1558
|
font-size: 14px;
|
|
1559
1559
|
font-weight: 500;
|
|
1560
1560
|
white-space: nowrap;
|
|
1561
|
-
`,
|
|
1561
|
+
`,kl=({children:e,defaultMessage:r="Saving"})=>{const[o,n]=u.useState(!1),[i,l]=u.useState(r),c=u.useCallback(b=>{l(b??r),n(!0)},[r]),d=u.useCallback(()=>{n(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:d}),[o,c,d]);return a.jsxs(Ir.Provider,{value:p,children:[e,o&&a.jsxs(vl,{children:[a.jsx(Lt,{size:"sm"}),a.jsx(Rl,{children:i})]})]})},Ll=()=>{const e=u.useContext(Ir);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},ft=40,xt=2,ze=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,El=s.div`
|
|
1562
1562
|
position: relative;
|
|
1563
1563
|
display: grid;
|
|
1564
1564
|
gap: 2px;
|
|
1565
1565
|
min-width: 180px;
|
|
1566
1566
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1567
|
-
`,
|
|
1567
|
+
`,Pl=s(ie)`
|
|
1568
1568
|
margin-left: 6px;
|
|
1569
|
-
`,
|
|
1569
|
+
`,jl=s.button`
|
|
1570
1570
|
display: flex;
|
|
1571
1571
|
align-items: center;
|
|
1572
1572
|
justify-content: space-between;
|
|
@@ -1577,43 +1577,45 @@
|
|
|
1577
1577
|
font-weight: 500;
|
|
1578
1578
|
text-align: left;
|
|
1579
1579
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1580
|
-
height: ${e=>
|
|
1581
|
-
padding: ${e=>
|
|
1582
|
-
border-radius: ${e=>
|
|
1580
|
+
height: ${e=>Ot(e.$size).height};
|
|
1581
|
+
padding: ${e=>Ot(e.$size).padding};
|
|
1582
|
+
border-radius: ${e=>Ot(e.$size).radius};
|
|
1583
1583
|
|
|
1584
1584
|
color: ${e=>e.$hasValue?e.$disabled?se(e.$variant).color.disabled:se(e.$variant).color.static:se(e.$variant).placeholder};
|
|
1585
1585
|
border: 1px solid
|
|
1586
1586
|
${e=>e.$disabled?se(e.$variant).border.disabled:se(e.$variant).border.static};
|
|
1587
1587
|
background-color: ${e=>e.$disabled?se(e.$variant).background.disabled:se(e.$variant).background.static};
|
|
1588
|
-
`,
|
|
1588
|
+
`,zl=s.span`
|
|
1589
1589
|
flex: 1;
|
|
1590
1590
|
min-width: 0;
|
|
1591
1591
|
overflow: hidden;
|
|
1592
1592
|
text-overflow: ellipsis;
|
|
1593
1593
|
white-space: nowrap;
|
|
1594
|
-
`,
|
|
1594
|
+
`,Nl=s.span`
|
|
1595
1595
|
display: flex;
|
|
1596
1596
|
align-items: center;
|
|
1597
1597
|
justify-content: center;
|
|
1598
1598
|
flex-shrink: 0;
|
|
1599
1599
|
transition: transform 0.2s ease;
|
|
1600
1600
|
transform: rotate(${e=>e.$open?"180deg":"0deg"});
|
|
1601
|
-
`,
|
|
1601
|
+
`,Ar=`
|
|
1602
|
+
display: grid;
|
|
1603
|
+
gap: 2px;
|
|
1602
1604
|
padding: 4px;
|
|
1603
1605
|
background: ${t.COLORS.white};
|
|
1604
1606
|
border: 1px solid ${t.alpha(t.COLORS.black,10)};
|
|
1605
1607
|
border-radius: 16px;
|
|
1606
1608
|
box-shadow: 0 4px 20px ${t.alpha(t.COLORS.black,15)};
|
|
1607
1609
|
z-index: 1000;
|
|
1608
|
-
`,
|
|
1610
|
+
`,Tl=s.div`
|
|
1609
1611
|
position: absolute;
|
|
1610
1612
|
left: -4px;
|
|
1611
1613
|
width: calc(100% + 8px);
|
|
1612
|
-
${
|
|
1613
|
-
`,
|
|
1614
|
+
${Ar}
|
|
1615
|
+
`,Il=s.div`
|
|
1614
1616
|
position: fixed;
|
|
1615
|
-
${
|
|
1616
|
-
`,
|
|
1617
|
+
${Ar}
|
|
1618
|
+
`,Al=s.button`
|
|
1617
1619
|
display: flex;
|
|
1618
1620
|
align-items: center;
|
|
1619
1621
|
justify-content: space-between;
|
|
@@ -1634,13 +1636,20 @@
|
|
|
1634
1636
|
&:hover:not(:disabled) {
|
|
1635
1637
|
background: ${t.alpha(t.COLORS.black,8)};
|
|
1636
1638
|
}
|
|
1637
|
-
|
|
1639
|
+
|
|
1640
|
+
& > span {
|
|
1641
|
+
overflow: hidden;
|
|
1642
|
+
text-overflow: ellipsis;
|
|
1643
|
+
white-space: nowrap;
|
|
1644
|
+
min-width: 0;
|
|
1645
|
+
}
|
|
1646
|
+
`,Dl=s.span`
|
|
1638
1647
|
display: flex;
|
|
1639
1648
|
align-items: center;
|
|
1640
1649
|
justify-content: center;
|
|
1641
1650
|
flex-shrink: 0;
|
|
1642
1651
|
color: ${t.COLORS.black};
|
|
1643
|
-
`,$e=T.newClassNameGetter("select"),
|
|
1652
|
+
`,$e=T.newClassNameGetter("select"),_l=({className:e,classnames:r,disabled:o=!1,fullWidth:n=!1,label:i,onChange:l,options:c,placeholder:d="Select...",portalRenderNode:p,ref:b,size:h="default",value:f,variant:O="normal",...w})=>{const[S,x]=u.useState(!1),[C,$]=u.useState({top:0,left:0,width:0}),y=u.useRef(null),g=u.useRef(null),L=u.useRef(null),N=c.find(m=>m.value===f),j=Math.max(0,c.findIndex(m=>m.value===f)),Y=-(j*(ft+xt)+ze),P=()=>{if(!g.current||!p)return;const m=g.current.getBoundingClientRect(),I=j*(ft+xt)+ze;let R=m.top-I;const z=c.length*ft+(c.length-1)*xt+ze*2,B=8,F=window.innerHeight-z-8;R<B&&(R=B),R>F&&(R=F),$({top:R,left:m.left-ze,width:m.width+ze*2})},_=m=>{var I;l==null||l(m),x(!1),(I=g.current)==null||I.focus()},M=m=>{o||c.length===0||(m.key==="Enter"||m.key===" "?(m.preventDefault(),x(I=>!I)):m.key==="Escape"&&S?(m.preventDefault(),x(!1)):m.key==="ArrowDown"&&!S&&(m.preventDefault(),x(!0)))};u.useLayoutEffect(()=>{S&&p&&P()},[S,p,j,c.length]),u.useEffect(()=>{if(!S)return;const m=z=>{const B=z.target,F=y.current&&!y.current.contains(B),H=L.current&&!L.current.contains(B);p?F&&H&&x(!1):F&&x(!1)},I=()=>{p&&P()},R=()=>{p&&P()};return document.addEventListener("mousedown",m),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",R)),()=>{document.removeEventListener("mousedown",m),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",R)}},[S,p]);const E=()=>c.map(m=>a.jsxs(Al,{type:"button",role:"option",$selected:m.value===f,$disabled:m.disabled??!1,disabled:m.disabled,"aria-selected":m.value===f,onClick:()=>_(m.value),className:$e("option",r==null?void 0:r.option),children:[a.jsx("span",{children:m.label}),m.value===f&&a.jsx(Dl,{children:a.jsx(a.Check,{size:16})})]},m.value)),A=p?ge.createPortal(a.jsx(Il,{ref:L,role:"listbox",style:{top:C.top,left:C.left,width:C.width},className:$e("dropdown",r==null?void 0:r.dropdown),children:E()}),p):a.jsx(Tl,{ref:L,role:"listbox",style:{top:Y},className:$e("dropdown",r==null?void 0:r.dropdown),children:E()});return a.jsxs(El,{...w,ref:m=>{y.current=m,typeof b=="function"?b(m):b&&(b.current=m)},$fullWidth:n,className:$e("container",e),children:[i&&a.jsx(Pl,{variant:O==="error"?"error":"normal",className:$e("label",r==null?void 0:r.label),children:i}),a.jsxs(jl,{ref:g,type:"button",$size:h,$variant:O,$disabled:o,$hasValue:!!N,disabled:o,onClick:()=>!o&&c.length>0&&x(m=>!m),onKeyDown:M,"aria-haspopup":"listbox","aria-expanded":S,className:$e("trigger",r==null?void 0:r.trigger),children:[a.jsx(zl,{children:(N==null?void 0:N.label)??d}),a.jsx(Nl,{$open:S,children:a.jsx(a.ChevronDown,{size:16})})]}),S&&A]})},br={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},Ml=e=>br[e]??br.neutral,Fl=s.div`
|
|
1644
1653
|
display: flex;
|
|
1645
1654
|
flex-direction: column;
|
|
1646
1655
|
gap: 4px;
|
|
@@ -1649,16 +1658,16 @@
|
|
|
1649
1658
|
border-radius: 16px;
|
|
1650
1659
|
border: ${({$border:e})=>e?"1px solid #e5e7eb":"none"};
|
|
1651
1660
|
box-shadow: ${({$shadow:e})=>e?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"none"};
|
|
1652
|
-
`,
|
|
1661
|
+
`,Bl=s.div`
|
|
1653
1662
|
display: flex;
|
|
1654
1663
|
align-items: center;
|
|
1655
1664
|
justify-content: space-between;
|
|
1656
1665
|
gap: 8px;
|
|
1657
|
-
`,
|
|
1666
|
+
`,Yl=s.p`
|
|
1658
1667
|
margin: 0;
|
|
1659
1668
|
font-size: 13px;
|
|
1660
1669
|
color: ${t.COLORS["iron-grey"]};
|
|
1661
|
-
`,
|
|
1670
|
+
`,Vl=s.div`
|
|
1662
1671
|
display: flex;
|
|
1663
1672
|
align-items: center;
|
|
1664
1673
|
justify-content: center;
|
|
@@ -1672,21 +1681,21 @@
|
|
|
1672
1681
|
width: 18px;
|
|
1673
1682
|
height: 18px;
|
|
1674
1683
|
}
|
|
1675
|
-
`,
|
|
1684
|
+
`,Hl=s.h3`
|
|
1676
1685
|
margin: 0;
|
|
1677
1686
|
font-size: 28px;
|
|
1678
1687
|
font-weight: 600;
|
|
1679
1688
|
line-height: 1.2;
|
|
1680
1689
|
color: ${t.COLORS.black};
|
|
1681
|
-
`,
|
|
1690
|
+
`,Gl=s.p`
|
|
1682
1691
|
margin: 0;
|
|
1683
1692
|
font-size: 12px;
|
|
1684
|
-
color: ${({$variant:e})=>
|
|
1685
|
-
`,Xe=T.newClassNameGetter("status-card"),
|
|
1693
|
+
color: ${({$variant:e})=>Ml(e)};
|
|
1694
|
+
`,Xe=T.newClassNameGetter("status-card"),Wl=({border:e=!1,className:r,classnames:o,icon:n,label:i,ref:l,shadow:c=!1,trend:d,trendVariant:p="neutral",value:b,...h})=>a.jsxs(Fl,{...h,ref:l,className:Xe("container",r),$border:e,$shadow:c,children:[a.jsxs(Bl,{children:[a.jsx(Yl,{className:Xe("label",o==null?void 0:o.label),children:i}),n&&a.jsx(Vl,{children:n})]}),a.jsx(Hl,{className:Xe("value",o==null?void 0:o.value),children:b}),d&&a.jsx(Gl,{className:Xe("trend",o==null?void 0:o.trend),$variant:p,children:d})]}),Kl=s.div`
|
|
1686
1695
|
display: flex;
|
|
1687
1696
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1688
1697
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1689
|
-
`,
|
|
1698
|
+
`,Ul=s.div`
|
|
1690
1699
|
display: flex;
|
|
1691
1700
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1692
1701
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1695,7 +1704,7 @@
|
|
|
1695
1704
|
&:last-child {
|
|
1696
1705
|
flex: 0;
|
|
1697
1706
|
}
|
|
1698
|
-
`,
|
|
1707
|
+
`,Xl=s.button`
|
|
1699
1708
|
display: flex;
|
|
1700
1709
|
align-items: center;
|
|
1701
1710
|
gap: 10px;
|
|
@@ -1704,7 +1713,7 @@
|
|
|
1704
1713
|
background: transparent;
|
|
1705
1714
|
cursor: ${e=>e.$clickable?"pointer":"default"};
|
|
1706
1715
|
flex-shrink: 0;
|
|
1707
|
-
`,
|
|
1716
|
+
`,ql=s.div`
|
|
1708
1717
|
display: flex;
|
|
1709
1718
|
align-items: center;
|
|
1710
1719
|
justify-content: center;
|
|
@@ -1728,13 +1737,13 @@
|
|
|
1728
1737
|
border: 2px solid ${t.COLORS.gray};
|
|
1729
1738
|
color: ${t.COLORS["iron-grey"]};
|
|
1730
1739
|
`}
|
|
1731
|
-
`,
|
|
1740
|
+
`,Zl=s.span`
|
|
1732
1741
|
font-size: 14px;
|
|
1733
1742
|
font-weight: 500;
|
|
1734
1743
|
white-space: nowrap;
|
|
1735
1744
|
color: ${e=>e.$active||e.$completed?t.COLORS.black:t.COLORS["iron-grey"]};
|
|
1736
1745
|
transition: color 0.2s ease;
|
|
1737
|
-
`,
|
|
1746
|
+
`,Jl=s.div`
|
|
1738
1747
|
background-color: ${e=>e.$completed?t.COLORS.black:t.COLORS.gray};
|
|
1739
1748
|
transition: background-color 0.2s ease;
|
|
1740
1749
|
|
|
@@ -1748,22 +1757,22 @@
|
|
|
1748
1757
|
min-width: 16px;
|
|
1749
1758
|
margin: 0 12px;
|
|
1750
1759
|
`}
|
|
1751
|
-
`,Ne=T.newClassNameGetter("stepper"),
|
|
1760
|
+
`,Ne=T.newClassNameGetter("stepper"),Ql=({className:e,classnames:r,onChange:o,orientation:n="horizontal",ref:i,steps:l,value:c,...d})=>{const p=u.useMemo(()=>l.findIndex(b=>b.value===c),[l,c]);return a.jsx(Kl,{...d,ref:i,$orientation:n,className:Ne("container",e),children:l.map((b,h)=>{const f=b.value===c,O=h<p,w=h===l.length-1;return a.jsxs(Ul,{$orientation:n,children:[a.jsxs(Xl,{type:"button",$active:f,$completed:O,$clickable:!!o,onClick:()=>o==null?void 0:o(b.value),className:Ne("step",r==null?void 0:r.step),children:[a.jsx(ql,{$active:f,$completed:O,className:Ne("circle",r==null?void 0:r.circle),children:h+1}),a.jsx(Zl,{$active:f,$completed:O,className:Ne("label",r==null?void 0:r.label),children:b.label})]}),!w&&a.jsx(Jl,{$completed:O,$orientation:n,className:Ne("line",r==null?void 0:r.line)})]},b.value)})})},kt={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},ed=s.div`
|
|
1752
1761
|
position: relative;
|
|
1753
1762
|
display: flex;
|
|
1754
1763
|
flex-direction: column;
|
|
1755
1764
|
gap: 4px;
|
|
1756
|
-
`,
|
|
1765
|
+
`,td=s(ie)`
|
|
1757
1766
|
margin-left: 6px;
|
|
1758
|
-
color: ${e=>
|
|
1759
|
-
`,
|
|
1767
|
+
color: ${e=>kt[e.$variant].label};
|
|
1768
|
+
`,rd=s.div`
|
|
1760
1769
|
display: flex;
|
|
1761
1770
|
flex-wrap: wrap;
|
|
1762
1771
|
align-items: center;
|
|
1763
1772
|
gap: 6px;
|
|
1764
1773
|
min-height: 44px;
|
|
1765
1774
|
padding: 8px 12px;
|
|
1766
|
-
border: 1px dashed ${e=>
|
|
1775
|
+
border: 1px dashed ${e=>kt[e.$variant].border};
|
|
1767
1776
|
border-radius: 8px;
|
|
1768
1777
|
background: ${t.COLORS.white};
|
|
1769
1778
|
cursor: ${e=>e.$disabled?"not-allowed":"text"};
|
|
@@ -1771,14 +1780,14 @@
|
|
|
1771
1780
|
transition: border-color 0.15s ease;
|
|
1772
1781
|
|
|
1773
1782
|
&:hover {
|
|
1774
|
-
border-color: ${e=>e.$disabled?
|
|
1783
|
+
border-color: ${e=>e.$disabled?kt[e.$variant].border:e.$variant==="error"?t.COLORS.red:t.COLORS.black};
|
|
1775
1784
|
}
|
|
1776
1785
|
|
|
1777
1786
|
${e=>e.$focused&&`
|
|
1778
1787
|
outline: 2px solid ${e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1779
1788
|
outline-offset: 2px;
|
|
1780
1789
|
`}
|
|
1781
|
-
`,
|
|
1790
|
+
`,od=s.input`
|
|
1782
1791
|
flex: 1;
|
|
1783
1792
|
min-width: 80px;
|
|
1784
1793
|
border: none;
|
|
@@ -1795,7 +1804,7 @@
|
|
|
1795
1804
|
&:disabled {
|
|
1796
1805
|
cursor: not-allowed;
|
|
1797
1806
|
}
|
|
1798
|
-
`,
|
|
1807
|
+
`,Dr=`
|
|
1799
1808
|
z-index: 100;
|
|
1800
1809
|
background-color: ${t.COLORS.white};
|
|
1801
1810
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
@@ -1803,28 +1812,28 @@
|
|
|
1803
1812
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
1804
1813
|
max-height: 200px;
|
|
1805
1814
|
overflow-y: auto;
|
|
1806
|
-
`,
|
|
1815
|
+
`,_r=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Mr=`
|
|
1807
1816
|
opacity 0.15s ease,
|
|
1808
1817
|
transform 0.15s ease,
|
|
1809
1818
|
visibility 0.15s;
|
|
1810
|
-
`,
|
|
1819
|
+
`,id=s.div`
|
|
1811
1820
|
position: absolute;
|
|
1812
1821
|
left: 0;
|
|
1813
1822
|
right: 0;
|
|
1814
1823
|
${e=>e.$position==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
1815
|
-
${
|
|
1824
|
+
${Dr}
|
|
1816
1825
|
opacity: ${e=>e.$open?1:0};
|
|
1817
1826
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1818
|
-
transform: ${e=>
|
|
1819
|
-
transition: ${
|
|
1820
|
-
`,
|
|
1827
|
+
transform: ${e=>_r(e.$open,e.$position)};
|
|
1828
|
+
transition: ${Mr};
|
|
1829
|
+
`,nd=s.div`
|
|
1821
1830
|
position: fixed;
|
|
1822
|
-
${
|
|
1831
|
+
${Dr}
|
|
1823
1832
|
opacity: ${e=>e.$open?1:0};
|
|
1824
1833
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1825
|
-
transform: ${e=>
|
|
1826
|
-
transition: ${
|
|
1827
|
-
`,
|
|
1834
|
+
transform: ${e=>_r(e.$open,e.$position)};
|
|
1835
|
+
transition: ${Mr};
|
|
1836
|
+
`,gr=s.button`
|
|
1828
1837
|
display: flex;
|
|
1829
1838
|
align-items: center;
|
|
1830
1839
|
width: 100%;
|
|
@@ -1852,7 +1861,7 @@
|
|
|
1852
1861
|
&:only-child {
|
|
1853
1862
|
border-radius: 7px;
|
|
1854
1863
|
}
|
|
1855
|
-
`,
|
|
1864
|
+
`,fr=s.div`
|
|
1856
1865
|
display: flex;
|
|
1857
1866
|
align-items: center;
|
|
1858
1867
|
justify-content: center;
|
|
@@ -1860,11 +1869,11 @@
|
|
|
1860
1869
|
color: ${t.COLORS["iron-grey"]};
|
|
1861
1870
|
font-size: 14px;
|
|
1862
1871
|
text-align: center;
|
|
1863
|
-
`,ee=T.newClassNameGetter("tags"),qe=4,
|
|
1872
|
+
`,ee=T.newClassNameGetter("tags"),qe=4,ad=({className:e,classnames:r,createKey:o="Tab",disabled:n=!1,emptyMessage:i="No options",freeSolo:l=!0,label:c,onChange:d,options:p=[],placeholder:b="Add tag...",portalRenderNode:h,ref:f,value:O,variant:w="normal",...S})=>{const x=u.useRef(null),C=u.useRef(null),$=u.useRef(null),y=u.useRef(null),[g,L]=u.useState(""),[N,j]=u.useState(!1),[Y,P]=u.useState("bottom"),[_,M]=u.useState({top:0,left:0,width:0}),E=u.useMemo(()=>{const k=p.filter(U=>!O.includes(U.value));if(!g.trim())return k;const D=g.toLowerCase().trim();return k.filter(U=>U.label.toLowerCase().includes(D))},[p,O,g]),A=N&&p.length>0,m=u.useCallback(()=>{var _e;if(!C.current)return;const k=C.current.getBoundingClientRect(),D=((_e=$.current)==null?void 0:_e.offsetHeight)??200,U=window.innerHeight-k.bottom-qe,X=k.top-qe,fe=U<D&&X>U?"top":"bottom";if(P(fe),h){const rt=fe==="bottom"?k.bottom+qe:k.top-D-qe;M({top:rt,left:k.left,width:k.width})}},[h]);u.useEffect(()=>{if(N)return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[N,m]);const I=u.useCallback(k=>{const D=k.trim();return!D||O.includes(D)?!1:(d([...O,D]),L(""),!0)},[O,d]),R=k=>{if(k.key===o&&g.trim())if(k.preventDefault(),l)I(g);else{const D=E.find(U=>U.label.toLowerCase()===g.toLowerCase().trim());D&&I(D.value)}else k.key==="Backspace"&&!g&&O.length>0&&d(O.slice(0,-1))},z=k=>{var D;I(k),(D=y.current)==null||D.focus()},B=k=>{d(O.filter(D=>D!==k))},F=()=>{var k;n||(k=y.current)==null||k.focus()},H=k=>{const D=p.find(U=>U.value===k);return(D==null?void 0:D.label)??k};return a.jsxs(ed,{...S,ref:f,className:ee("container",e),children:[c&&a.jsx(td,{$variant:w,className:ee("label"),children:c}),a.jsxs("div",{ref:x,style:{position:"relative"},children:[a.jsxs(rd,{ref:C,$variant:w,$disabled:n,$focused:N,onClick:F,className:ee("trigger",r==null?void 0:r.trigger),children:[O.map(k=>a.jsx(Je,{deletable:!n,onDelete:()=>B(k),className:ee("chip",r==null?void 0:r.chip),children:H(k)},k)),a.jsx(od,{ref:y,type:"text",value:g,onChange:k=>L(k.target.value),onFocus:()=>j(!0),onBlur:()=>setTimeout(()=>j(!1),150),onKeyDown:R,placeholder:O.length===0?b:"",disabled:n,$disabled:n,className:ee("input",r==null?void 0:r.input)})]}),p.length>0&&(h?ge.createPortal(a.jsx(nd,{ref:$,$open:A,$position:Y,style:{top:_.top,left:_.left,width:_.width},className:ee("dropdown",r==null?void 0:r.dropdown),children:E.length===0?a.jsx(fr,{className:ee("empty",r==null?void 0:r.empty),children:i}):E.map(k=>a.jsx(gr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>z(k.value),className:ee("option",r==null?void 0:r.option),children:k.label},k.value))}),h):a.jsx(id,{ref:$,$open:A,$position:Y,className:ee("dropdown",r==null?void 0:r.dropdown),children:E.length===0?a.jsx(fr,{className:ee("empty",r==null?void 0:r.empty),children:i}):E.map(k=>a.jsx(gr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>z(k.value),className:ee("option",r==null?void 0:r.option),children:k.label},k.value))}))]})]})},ld=s.div`
|
|
1864
1873
|
display: flex;
|
|
1865
1874
|
align-items: center;
|
|
1866
1875
|
gap: 6px;
|
|
1867
|
-
`,
|
|
1876
|
+
`,dd=s.button`
|
|
1868
1877
|
padding: 6px 16px;
|
|
1869
1878
|
border: none;
|
|
1870
1879
|
border-radius: 12px;
|
|
@@ -1882,14 +1891,14 @@
|
|
|
1882
1891
|
&:hover:not(:disabled) {
|
|
1883
1892
|
background-color: ${e=>e.$active?t.COLORS.gray:"rgba(0, 0, 0, 0.05)"};
|
|
1884
1893
|
}
|
|
1885
|
-
`,
|
|
1894
|
+
`,xr=T.newClassNameGetter("tabs"),cd=({className:e,classnames:r,onChange:o,ref:n,tabs:i,value:l,...c})=>a.jsx(ld,{...c,ref:n,className:xr("container",e),role:"tablist",children:i.map(d=>a.jsx(dd,{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,sd=s.div`
|
|
1886
1895
|
display: grid;
|
|
1887
1896
|
flex-direction: column;
|
|
1888
1897
|
gap: 2px;
|
|
1889
1898
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1890
|
-
`,
|
|
1899
|
+
`,pd=s(ie)`
|
|
1891
1900
|
margin-left: 6px;
|
|
1892
|
-
`,
|
|
1901
|
+
`,ud=s.textarea`
|
|
1893
1902
|
flex: 1;
|
|
1894
1903
|
min-width: 0;
|
|
1895
1904
|
outline: none;
|
|
@@ -1919,7 +1928,7 @@
|
|
|
1919
1928
|
color: ${e=>de(e.$variant).placeholder.disabled};
|
|
1920
1929
|
}
|
|
1921
1930
|
}
|
|
1922
|
-
`,
|
|
1931
|
+
`,St=T.newClassNameGetter("textarea"),hd=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,variant:c="normal",rows:d=4,...p})=>a.jsxs(sd,{className:St("container",e),$fullWidth:!!n,children:[i&&a.jsx(pd,{variant:c,className:St("label",r==null?void 0:r.label),children:i}),a.jsx(ud,{...p,ref:l,rows:d,disabled:o,$variant:c,className:St("textarea",r==null?void 0:r.textarea)})]}),Fr=u.createContext(null),$t=3,Sr={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}},bd=(e,r)=>{switch(r.type){case"ADD_TOAST":{const o=r.payload;return e.toasts.length<$t?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=r.payload,n=e.toasts.filter(l=>l.id!==o),i=e.queue[0];return i&&n.length<$t?{toasts:[...n,i],queue:e.queue.slice(1)}:{...e,toasts:n}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=$t?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},gd={toasts:[],queue:[]},yt=e=>Sr[e]??Sr.default,fd=s.div`
|
|
1923
1932
|
position: fixed;
|
|
1924
1933
|
bottom: 24px;
|
|
1925
1934
|
left: 24px;
|
|
@@ -1930,30 +1939,30 @@
|
|
|
1930
1939
|
pointer-events: none;
|
|
1931
1940
|
width: auto;
|
|
1932
1941
|
max-width: 90vw;
|
|
1933
|
-
`,
|
|
1942
|
+
`,xd=s.div`
|
|
1934
1943
|
display: flex;
|
|
1935
1944
|
align-items: center;
|
|
1936
1945
|
justify-content: space-between;
|
|
1937
1946
|
gap: 12px;
|
|
1938
1947
|
min-height: 32px;
|
|
1939
1948
|
padding: 8px 8px 8px 16px;
|
|
1940
|
-
background-color: ${({$variant:e})
|
|
1941
|
-
color: ${({$variant:e})
|
|
1942
|
-
border: 1px solid ${({$variant:e})
|
|
1949
|
+
background-color: ${({$variant:e})=>yt(e).background};
|
|
1950
|
+
color: ${({$variant:e})=>yt(e).text};
|
|
1951
|
+
border: 1px solid ${({$variant:e})=>yt(e).border};
|
|
1943
1952
|
border-radius: 96px;
|
|
1944
1953
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
1945
1954
|
animation: ${({$isExiting:e})=>e?t.KEYFRAMES.slideOutBottomFade:t.KEYFRAMES.slideInBottomFade}
|
|
1946
1955
|
0.3s ease-out;
|
|
1947
1956
|
pointer-events: auto;
|
|
1948
1957
|
max-width: 500px;
|
|
1949
|
-
`,
|
|
1958
|
+
`,Od=s.span`
|
|
1950
1959
|
font-size: 14px;
|
|
1951
1960
|
font-weight: 500;
|
|
1952
1961
|
line-height: 1.4;
|
|
1953
1962
|
white-space: nowrap;
|
|
1954
1963
|
overflow: hidden;
|
|
1955
1964
|
text-overflow: ellipsis;
|
|
1956
|
-
`,
|
|
1965
|
+
`,Sd=s.button`
|
|
1957
1966
|
display: flex;
|
|
1958
1967
|
align-items: center;
|
|
1959
1968
|
justify-content: center;
|
|
@@ -1971,13 +1980,13 @@
|
|
|
1971
1980
|
&:hover {
|
|
1972
1981
|
opacity: 1;
|
|
1973
1982
|
}
|
|
1974
|
-
|
|
1983
|
+
`,$d=s.div`
|
|
1975
1984
|
display: flex;
|
|
1976
1985
|
align-items: center;
|
|
1977
1986
|
justify-content: space-between;
|
|
1978
1987
|
gap: 12px;
|
|
1979
1988
|
width: 100%;
|
|
1980
|
-
|
|
1989
|
+
`,yd=s.div`
|
|
1981
1990
|
display: flex;
|
|
1982
1991
|
align-items: center;
|
|
1983
1992
|
justify-content: center;
|
|
@@ -1992,7 +2001,7 @@
|
|
|
1992
2001
|
font-weight: 500;
|
|
1993
2002
|
white-space: nowrap;
|
|
1994
2003
|
margin-left: auto;
|
|
1995
|
-
|
|
2004
|
+
`,$r=({toast:e,onHide:r})=>{const[o,n]=u.useState(!1),i=()=>{n(!0),setTimeout(()=>{r(e.id)},300)};return u.useEffect(()=>{if(e.duration){const l=setTimeout(()=>{i()},e.duration);return()=>clearTimeout(l)}},[e.duration,e.id]),a.jsxs(xd,{$variant:e.variant,$isExiting:o,children:[a.jsx(Od,{children:e.message}),a.jsx(Sd,{onClick:i,children:a.jsx(a.X,{style:{width:16,height:16}})})]})},Cd=({toasts:e,queueCount:r,onHide:o})=>{if(e.length===0)return null;const n=e.length-1;return a.jsx(fd,{children:e.map((i,l)=>l===n&&r>0?a.jsxs($d,{children:[a.jsx($r,{toast:i,onHide:o}),a.jsxs(yd,{children:["+",r]})]},i.id):a.jsx($r,{toast:i,onHide:o},i.id))})},md=({children:e})=>{const[r,o]=u.useReducer(bd,gd),n=u.useCallback((l,c="default",d)=>{const p=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_TOAST",payload:{id:p,message:l,variant:c,duration:d}})},[]),i=u.useCallback(l=>{o({type:"REMOVE_TOAST",payload:l})},[]);return a.jsxs(Fr.Provider,{value:{show:n,hide:i},children:[e,a.jsx(Cd,{toasts:r.toasts,queueCount:r.queue.length,onHide:i})]})},wd=()=>{const e=u.useContext(Fr);if(!e)throw new Error("useToastr 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}},Ae=e=>yr[e]??yr.dark,vd=(e,r)=>{const o=Ae(r).background;switch(e){case"top":return`
|
|
1996
2005
|
bottom: -12px;
|
|
1997
2006
|
left: 50%;
|
|
1998
2007
|
margin-left: -6px;
|
|
@@ -2012,7 +2021,7 @@
|
|
|
2012
2021
|
top: 50%;
|
|
2013
2022
|
margin-top: -6px;
|
|
2014
2023
|
border-right-color: ${o};
|
|
2015
|
-
`;default:return""}},
|
|
2024
|
+
`;default:return""}},Rd=(e,r)=>{if(r!=="light")return"";const o=Ae(r).border;switch(e){case"top":return`
|
|
2016
2025
|
&::after {
|
|
2017
2026
|
bottom: -14px;
|
|
2018
2027
|
left: 50%;
|
|
@@ -2040,7 +2049,7 @@
|
|
|
2040
2049
|
margin-top: -7px;
|
|
2041
2050
|
border-right-color: ${o};
|
|
2042
2051
|
}
|
|
2043
|
-
`;default:return""}},
|
|
2052
|
+
`;default:return""}},Br=e=>`
|
|
2044
2053
|
z-index: 1000;
|
|
2045
2054
|
padding: 6px 12px;
|
|
2046
2055
|
background-color: ${Ae(e.$variant).background};
|
|
@@ -2066,7 +2075,7 @@
|
|
|
2066
2075
|
width: 0;
|
|
2067
2076
|
height: 0;
|
|
2068
2077
|
border: 6px solid transparent;
|
|
2069
|
-
${
|
|
2078
|
+
${vd(e.$placement,e.$variant)}
|
|
2070
2079
|
}
|
|
2071
2080
|
|
|
2072
2081
|
${e.$variant==="light"?`
|
|
@@ -2079,12 +2088,12 @@
|
|
|
2079
2088
|
}
|
|
2080
2089
|
`:""}
|
|
2081
2090
|
|
|
2082
|
-
${
|
|
2083
|
-
`,
|
|
2091
|
+
${Rd(e.$placement,e.$variant)}
|
|
2092
|
+
`,kd=s.div`
|
|
2084
2093
|
position: relative;
|
|
2085
2094
|
display: inline-block;
|
|
2086
2095
|
width: fit-content;
|
|
2087
|
-
`,
|
|
2096
|
+
`,Ld=e=>{switch(e){case"top":return`
|
|
2088
2097
|
bottom: calc(100% + 8px);
|
|
2089
2098
|
left: 50%;
|
|
2090
2099
|
transform: translateX(-50%);
|
|
@@ -2100,12 +2109,12 @@
|
|
|
2100
2109
|
left: calc(100% + 8px);
|
|
2101
2110
|
top: 50%;
|
|
2102
2111
|
transform: translateY(-50%);
|
|
2103
|
-
`;default:return""}},
|
|
2112
|
+
`;default:return""}},Ed=s.div`
|
|
2104
2113
|
position: absolute;
|
|
2105
|
-
${e=>
|
|
2106
|
-
${({$placement:e})=>
|
|
2107
|
-
`,
|
|
2114
|
+
${e=>Br(e)}
|
|
2115
|
+
${({$placement:e})=>Ld(e)}
|
|
2116
|
+
`,Pd=s.div`
|
|
2108
2117
|
position: fixed;
|
|
2109
|
-
${e=>
|
|
2110
|
-
`,
|
|
2118
|
+
${e=>Br(e)}
|
|
2119
|
+
`,Ct=T.newClassNameGetter("tooltip"),ce=8,jd=({children:e,className:r,classnames:o,content:n,delay:i=200,placement:l="top",portalRenderNode:c,ref:d,variant:p="dark",...b})=>{const[h,f]=u.useState(!1),[O,w]=u.useState(null),[S,x]=u.useState(l),[C,$]=u.useState({top:0,left:0}),y=u.useRef(null),g=u.useRef(null),L=u.useCallback(()=>{var z,B;if(!y.current)return;const P=y.current.getBoundingClientRect(),_=((z=g.current)==null?void 0:z.offsetWidth)??100,M=((B=g.current)==null?void 0:B.offsetHeight)??30,E=P.top-ce,A=window.innerHeight-P.bottom-ce,m=P.left-ce,I=window.innerWidth-P.right-ce;let R=l;if(l==="top"&&E<M&&A>E?R="bottom":l==="bottom"&&A<M&&E>A?R="top":l==="left"&&m<_&&I>m?R="right":l==="right"&&I<_&&m>I&&(R="left"),x(R),c){let F,H;switch(R){case"top":F=P.top-M-ce,H=P.left+P.width/2-_/2;break;case"bottom":F=P.bottom+ce,H=P.left+P.width/2-_/2;break;case"left":F=P.top+P.height/2-M/2,H=P.left-_-ce;break;case"right":F=P.top+P.height/2-M/2,H=P.right+ce;break;default:F=0,H=0}const k=8;H=Math.max(k,Math.min(H,window.innerWidth-_-k)),F=Math.max(k,Math.min(F,window.innerHeight-M-k)),$({top:F,left:H})}},[l,c]);u.useLayoutEffect(()=>{h&&L()},[h,L]);const N=()=>{const P=setTimeout(()=>{f(!0)},i);w(P)},j=()=>{O&&(clearTimeout(O),w(null)),f(!1)},Y=c?ge.createPortal(a.jsx(Pd,{ref:g,className:Ct("content",o==null?void 0:o.content),$placement:S,$variant:p,$visible:h,style:{top:C.top,left:C.left},children:n}),c):a.jsx(Ed,{ref:g,className:Ct("content",o==null?void 0:o.content),$placement:S,$variant:p,$visible:h,children:n});return a.jsxs(kd,{...b,ref:P=>{y.current=P,typeof d=="function"?d(P):d&&(d.current=P)},className:Ct("wrapper",r),onMouseEnter:N,onMouseLeave:j,children:[e,Y]})};exports.BREAKPOINTS=t.BREAKPOINTS;exports.COLORS=t.COLORS;exports.KEYFRAMES=t.KEYFRAMES;exports.KEY_SYMBOLS=t.KEY_SYMBOLS;exports.alpha=t.alpha;exports.getBrowser=t.getBrowser;exports.getKeySymbols=t.getKeySymbols;exports.getOperatingSystem=t.getOperatingSystem;exports.isValid=t.isValid;exports.mediaBetween=t.mediaBetween;exports.mediaDown=t.mediaDown;exports.mediaUp=t.mediaUp;exports.toHEX=t.toHEX;exports.useKeyBinding=t.useKeyBinding;exports.newClassNameGetter=T.newClassNameGetter;exports.Autocomplete=zo;exports.Button=De;exports.Card=Vo;exports.Checkbox=et;exports.CheckboxCard=ei;exports.CheckboxGroup=ii;exports.Chip=Je;exports.ConfirmationProvider=xi;exports.Container=yi;exports.DatePicker=Ui;exports.Drawer=Qi;exports.Dropdown=an;exports.EditableText=sn;exports.FieldLabel=ie;exports.FieldMessage=bn;exports.GlobalStyle=co;exports.ImageCropper=ya;exports.Input=jr;exports.KeySymbol=Cr;exports.KeysBindings=mr;exports.Modal=zr;exports.MultiSelect=_a;exports.NotificationProvider=Ua;exports.OtpCode=el;exports.Panel=al;exports.Progress=cl;exports.Radio=Et;exports.RadioCard=$l;exports.RadioGroup=wl;exports.SaveProgressProvider=kl;exports.Select=_l;exports.Spinner=Lt;exports.StatusCard=Wl;exports.Stepper=Ql;exports.Tabs=cd;exports.Tags=ad;exports.Textarea=hd;exports.ToastProvider=md;exports.Tooltip=jd;exports.formatDateGo=vr;exports.useConfirmation=Oi;exports.useImageCropper=Pr;exports.useNotification=Xa;exports.useSaveProgress=Ll;exports.useToastr=wd;
|
|
2111
2120
|
//# sourceMappingURL=index.cjs.map
|