@vacano/ui 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +373 -332
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1577 -1473
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./X-CI1qRJDP.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./X-CI1qRJDP.cjs"),ae=require("@emotion/react"),u=require("react"),t=require("./media-OVL6YjWb.cjs"),A=require("./tooling-Dflq0Y98.cjs"),Oe=require("react-dom");function ro(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const ke=ro(u);function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var i in o)({}).hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},Ct.apply(null,arguments)}const oo=ae.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -141,32 +141,32 @@
|
|
|
141
141
|
:focus:not(:focus-visible) {
|
|
142
142
|
outline: none;
|
|
143
143
|
}
|
|
144
|
-
`,
|
|
144
|
+
`,io=()=>a.jsx(ae.Global,{styles:oo});var no=/^((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)-.*))$/,ao=a.memoize(function(e){return no.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),lo=ao,co=function(r){return r!=="theme"},Nt=function(r){return typeof r=="string"&&r.charCodeAt(0)>96?lo:co},It=function(r,o,i){var n;if(o){var l=o.shouldForwardProp;n=r.__emotion_forwardProp&&l?function(c){return r.__emotion_forwardProp(c)&&l(c)}:l}return typeof n!="function"&&i&&(n=r.__emotion_forwardProp),n},so=function(r){var o=r.cache,i=r.serialized,n=r.isStringTag;return a.registerStyles(o,i,n),a.useInsertionEffectAlwaysWithSyncFallback(function(){return a.insertStyles(o,i,n)}),null},po=function e(r,o){var i=r.__emotion_real===r,n=i&&r.__emotion_base||r,l,c;o!==void 0&&(l=o.label,c=o.target);var d=It(r,o,i),p=d||Nt(n),h=!p("as");return function(){var g=arguments,f=i&&r.__emotion_styles!==void 0?r.__emotion_styles.slice(0):[];if(l!==void 0&&f.push("label:"+l+";"),g[0]==null||g[0].raw===void 0)f.push.apply(f,g);else{var O=g[0];f.push(O[0]);for(var m=g.length,y=1;y<m;y++)f.push(g[y],O[y])}var S=ae.withEmotionCache(function(v,x,$){var b=h&&v.as||n,L="",j=[],N=v;if(v.theme==null){N={};for(var H in v)N[H]=v[H];N.theme=ke.useContext(ae.ThemeContext)}typeof v.className=="string"?L=a.getRegisteredStyles(x.registered,j,v.className):v.className!=null&&(L=v.className+" ");var z=a.serializeStyles(f.concat(j),x.registered,N);L+=x.key+"-"+z.name,c!==void 0&&(L+=" "+c);var _=h&&d===void 0?Nt(b):p,E={};for(var w in v)h&&w==="as"||_(w)&&(E[w]=v[w]);return E.className=L,$&&(E.ref=$),ke.createElement(ke.Fragment,null,ke.createElement(so,{cache:x,serialized:z,isStringTag:typeof b=="string"}),ke.createElement(b,E))});return S.displayName=l!==void 0?l:"Styled("+(typeof n=="string"?n:n.displayName||n.name||"Component")+")",S.defaultProps=r.defaultProps,S.__emotion_real=S,S.__emotion_base=n,S.__emotion_styles=f,S.__emotion_forwardProp=d,Object.defineProperty(S,"toString",{value:function(){return"."+c}}),S.withComponent=function(v,x){var $=e(v,Ct({},o,x,{shouldForwardProp:It(S,x,!0)}));return $.apply(void 0,f)},S}},uo=["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=po.bind(null);uo.forEach(function(e){s[e]=s(e)});const ho=s.span`
|
|
145
145
|
font-size: 12px;
|
|
146
146
|
font-weight: 500;
|
|
147
147
|
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
148
|
-
`,
|
|
148
|
+
`,bo=A.newClassNameGetter("field-label"),de=({children:e,className:r,ref:o,required:i,variant:n="normal",...l})=>e?a.jsxs(ho,{...l,ref:o,className:bo("container",r),$variant:n,children:[e," ",i&&"*"]}):null,it={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},oe={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)}},go=s.div`
|
|
149
149
|
position: relative;
|
|
150
150
|
display: grid;
|
|
151
151
|
gap: 2px;
|
|
152
152
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
153
|
-
`,
|
|
153
|
+
`,fo=s(de)`
|
|
154
154
|
margin-left: 6px;
|
|
155
|
-
`,
|
|
155
|
+
`,xo=s.div`
|
|
156
156
|
position: relative;
|
|
157
157
|
display: flex;
|
|
158
158
|
align-items: center;
|
|
159
|
-
`,
|
|
159
|
+
`,Oo=s.input`
|
|
160
160
|
flex: 1;
|
|
161
161
|
min-width: 0;
|
|
162
162
|
width: 100%;
|
|
163
163
|
outline: none;
|
|
164
164
|
font-size: 14px;
|
|
165
165
|
font-weight: 500;
|
|
166
|
-
height: ${e=>
|
|
167
|
-
padding: ${e=>
|
|
166
|
+
height: ${e=>it[e.$size].height};
|
|
167
|
+
padding: ${e=>it[e.$size].padding};
|
|
168
168
|
padding-right: 40px;
|
|
169
|
-
border-radius: ${e=>
|
|
169
|
+
border-radius: ${e=>it[e.$size].radius};
|
|
170
170
|
|
|
171
171
|
color: ${e=>oe[e.$variant].color.static};
|
|
172
172
|
border: 1px solid ${e=>oe[e.$variant].border.static};
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
&:focus-visible {
|
|
191
191
|
outline: 2px solid ${e=>oe[e.$variant].focus};
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
`,$o=s.div`
|
|
194
194
|
position: absolute;
|
|
195
195
|
right: 12px;
|
|
196
196
|
top: 50%;
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
display: flex;
|
|
199
199
|
align-items: center;
|
|
200
200
|
justify-content: center;
|
|
201
|
-
`,
|
|
201
|
+
`,So=s.div`
|
|
202
202
|
position: absolute;
|
|
203
203
|
top: 100%;
|
|
204
204
|
left: 0;
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
opacity 0.15s ease,
|
|
219
219
|
transform 0.15s ease,
|
|
220
220
|
visibility 0.15s;
|
|
221
|
-
`,
|
|
221
|
+
`,yo=s.div`
|
|
222
222
|
display: flex;
|
|
223
223
|
align-items: center;
|
|
224
224
|
gap: 10px;
|
|
@@ -244,43 +244,43 @@
|
|
|
244
244
|
&:hover {
|
|
245
245
|
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
`,vo=s.img`
|
|
248
248
|
width: 24px;
|
|
249
249
|
height: 24px;
|
|
250
250
|
border-radius: 6px;
|
|
251
251
|
object-fit: cover;
|
|
252
|
-
`,
|
|
252
|
+
`,Co=s.span`
|
|
253
253
|
flex: 1;
|
|
254
254
|
overflow: hidden;
|
|
255
255
|
text-overflow: ellipsis;
|
|
256
256
|
white-space: nowrap;
|
|
257
|
-
`,
|
|
257
|
+
`,mo=s.div`
|
|
258
258
|
padding: 12px 14px;
|
|
259
259
|
font-size: 14px;
|
|
260
260
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
261
261
|
text-align: center;
|
|
262
|
-
`,
|
|
262
|
+
`,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},nt=e=>At[e]??At.md,wo=ae.keyframes`
|
|
263
263
|
0% {
|
|
264
264
|
transform: rotate(0deg);
|
|
265
265
|
}
|
|
266
266
|
100% {
|
|
267
267
|
transform: rotate(360deg);
|
|
268
268
|
}
|
|
269
|
-
`,
|
|
269
|
+
`,Ro=s.div`
|
|
270
270
|
display: inline-block;
|
|
271
|
-
width: ${e=>
|
|
272
|
-
height: ${e=>
|
|
273
|
-
border: ${e=>
|
|
274
|
-
border-top-color: ${
|
|
271
|
+
width: ${e=>nt(e.$size).size};
|
|
272
|
+
height: ${e=>nt(e.$size).size};
|
|
273
|
+
border: ${e=>nt(e.$size).borderWidth} solid ${Dt.track};
|
|
274
|
+
border-top-color: ${Dt.indicator};
|
|
275
275
|
border-radius: 50%;
|
|
276
|
-
animation: ${
|
|
277
|
-
`,
|
|
276
|
+
animation: ${wo} 0.8s linear infinite;
|
|
277
|
+
`,ko=A.newClassNameGetter("spinner"),Lt=({"aria-label":e="Loading",className:r,ref:o,size:i="md",...n})=>a.jsx(Ro,{...n,ref:o,className:ko("container",r),role:"status","aria-label":e,$size:i}),Le=A.newClassNameGetter("autocomplete"),Lo=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",value:p,onChange:h,onSearch:g,debounceMs:f=300,minChars:O=1,noResultsMessage:m="No results found",...y})=>{const[S,v]=u.useState((p==null?void 0:p.value)??""),[x,$]=u.useState([]),[b,L]=u.useState(!1),[j,N]=u.useState(!1),[H,z]=u.useState(!1),_=u.useRef(null),E=u.useRef(null);u.useEffect(()=>{(p==null?void 0:p.value)!==void 0&&v(p.value)},[p==null?void 0:p.value]);const w=u.useCallback(async T=>{if(T.length<O){$([]),z(!1);return}L(!0),z(!0);try{const F=await g(T);$(F),N(!0)}catch{$([])}finally{L(!1)}},[g,O]),M=u.useCallback(T=>{const F=T.target.value;v(F),h==null||h({value:F,image_url:null}),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{w(F)},f)},[h,w,f]),C=u.useCallback(T=>{v(T.value),$([]),N(!1),z(!1),h==null||h({value:T.value,image_url:T.image_url})},[h]),I=u.useCallback(()=>{setTimeout(()=>{N(!1)},150)},[]),k=u.useCallback(()=>{x.length>0&&N(!0)},[x.length]);return u.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]),a.jsxs(go,{ref:_,className:Le("container",e),$fullWidth:!!i,children:[n&&a.jsx(fo,{variant:d,className:Le("label",r==null?void 0:r.label),children:n}),a.jsxs(xo,{children:[a.jsx(Oo,{...y,ref:l,type:"text",value:S,onChange:M,onBlur:I,onFocus:k,disabled:o,$size:c,$variant:d,className:Le("input",r==null?void 0:r.input)}),b&&a.jsx($o,{children:a.jsx(Lt,{size:"xs"})})]}),a.jsx(So,{$open:j&&H,className:Le("dropdown",r==null?void 0:r.dropdown),children:x.length>0?x.map(T=>a.jsxs(yo,{onClick:()=>C(T),className:Le("item",r==null?void 0:r.item),children:[T.image_url&&a.jsx(vo,{src:T.image_url,alt:T.value}),a.jsx(Co,{children:T.value})]},T.id)):!b&&a.jsx(mo,{children:m})})]})},_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},Po=e=>e?"auto":"fit-content",zo=s.button`
|
|
278
278
|
display: flex;
|
|
279
279
|
gap: 6px;
|
|
280
280
|
text-decoration: none;
|
|
281
281
|
align-items: center;
|
|
282
282
|
justify-content: center;
|
|
283
|
-
width: ${e=>e.$iconOnly?re(e.$size).height:
|
|
283
|
+
width: ${e=>e.$iconOnly?re(e.$size).height:Po(!!e.$fullWidth)};
|
|
284
284
|
color: ${e=>J(e.$variant).color.static};
|
|
285
285
|
background-color: ${e=>J(e.$variant).background.static};
|
|
286
286
|
height: ${e=>re(e.$size).height};
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
background-color: ${e=>J(e.$variant).background.disabled};
|
|
311
311
|
border-color: ${e=>J(e.$variant).borderColor.disabled};
|
|
312
312
|
}
|
|
313
|
-
`,
|
|
313
|
+
`,jo=s.div`
|
|
314
314
|
display: grid;
|
|
315
315
|
place-items: center;
|
|
316
316
|
width: ${e=>re(e.$size).iconSize};
|
|
@@ -320,19 +320,19 @@
|
|
|
320
320
|
width: ${e=>re(e.$size).iconSize};
|
|
321
321
|
height: ${e=>re(e.$size).iconSize};
|
|
322
322
|
}
|
|
323
|
-
`,
|
|
323
|
+
`,Eo=s.span`
|
|
324
324
|
font-weight: 600;
|
|
325
325
|
overflow: hidden;
|
|
326
326
|
white-space: nowrap;
|
|
327
327
|
text-overflow: ellipsis;
|
|
328
|
-
`,
|
|
328
|
+
`,To=s(a.LoaderCircle)`
|
|
329
329
|
width: ${e=>re(e.$size).iconSize};
|
|
330
330
|
height: ${e=>re(e.$size).iconSize};
|
|
331
331
|
animation: ${t.KEYFRAMES.rotate} 0.8s linear infinite;
|
|
332
|
-
`,
|
|
332
|
+
`,No=s.div`
|
|
333
333
|
display: flex;
|
|
334
334
|
gap: 3px;
|
|
335
|
-
`,
|
|
335
|
+
`,Io=s.span`
|
|
336
336
|
text-align: center;
|
|
337
337
|
display: flex;
|
|
338
338
|
justify-content: center;
|
|
@@ -345,12 +345,12 @@
|
|
|
345
345
|
border-radius: 4px;
|
|
346
346
|
width: fit-content;
|
|
347
347
|
background-color: ${e=>e.$variant==="light"?t.alpha(t.COLORS.white,25):t.alpha(t.COLORS.black,25)};
|
|
348
|
-
`,
|
|
348
|
+
`,Ao=A.newClassNameGetter("key-symbol"),Sr=({className:e,ref:r,symbol:o,variant:i="light",...n})=>o?a.jsx(Io,{...n,ref:r,className:Ao("container",e),$variant:i,children:o}):null,Ft=A.newClassNameGetter("key-bindings"),yr=({className:e,classnames:r,keys:o,ref:i,variant:n,...l})=>{const c=u.useMemo(()=>t.getKeySymbols(o),[o]);return c.length===0?null:a.jsx(No,{...l,ref:i,className:Ft("container",e),children:c.map(d=>a.jsx(Sr,{symbol:d,className:Ft("item",r==null?void 0:r.item),variant:n},d))})},Bt=A.newClassNameGetter("button"),_e=({children:e,className:r,classnames:o,disabled:i,fullWidth:n,icon:l,loading:c,onClick:d,ref:p=null,keyBindings:h=[],size:g="default",type:f="button",variant:O="normal",...m})=>{const y=u.useRef(null);u.useImperativeHandle(p,()=>y.current,[]),t.useKeyBinding(h,()=>{var v;(v=y.current)==null||v.click()});const S=u.useMemo(()=>{switch(f){case"link":return"button";default:return f}},[f]);return a.jsxs(zo,{...m,onClick:d,ref:y,type:S,disabled:i,className:Bt("container",r),$variant:O,$size:g,$fullWidth:!!n,$iconOnly:!!l&&!(e||(h==null?void 0:h.length)>0),children:[c&&a.jsx(To,{$size:g}),l&&!c&&a.jsx(jo,{$size:g,children:l}),e&&a.jsx(Eo,{className:Bt("label",o==null?void 0:o.label),children:e}),a.jsx(yr,{keys:h,variant:O==="system"?"light":"dark"})]})},Do=s.div`
|
|
349
349
|
background-color: ${t.COLORS.white};
|
|
350
350
|
border-radius: 16px;
|
|
351
351
|
border: ${e=>e.$border?`1px solid ${t.alpha(t.COLORS["iron-grey"],15)}`:"none"};
|
|
352
352
|
box-shadow: ${e=>e.$shadow?`0 2px 8px ${t.alpha(t.COLORS.black,10)}`:"none"};
|
|
353
|
-
`,
|
|
353
|
+
`,_o=A.newClassNameGetter("card"),Mo=({children:e,className:r,ref:o,border:i=!1,shadow:n=!1,...l})=>a.jsx(Do,{...l,ref:o,className:_o("container",r),$border:i,$shadow:n,children:e}),Yt={normal:{box:{border:t.alpha(t.COLORS["iron-grey"],30),borderChecked:t.COLORS["iron-grey"],background:t.COLORS.white,backgroundChecked:t.COLORS.black,focusShadow:t.alpha(t.COLORS["iron-grey"],30)},label:t.COLORS.black,icon:t.COLORS.white},error:{box:{border:t.COLORS.red,borderChecked:t.COLORS.red,background:t.COLORS.white,backgroundChecked:t.COLORS.red,focusShadow:t.alpha(t.COLORS.red,30)},label:t.COLORS.red,icon:t.COLORS.white}},ge=e=>Yt[e]??Yt.normal,Fo=s.label`
|
|
354
354
|
display: inline-flex;
|
|
355
355
|
align-items: flex-start;
|
|
356
356
|
gap: 8px;
|
|
@@ -358,15 +358,15 @@
|
|
|
358
358
|
opacity: ${e=>e.$disabled?.5:1};
|
|
359
359
|
|
|
360
360
|
&:has(input:focus-visible) > span:first-of-type {
|
|
361
|
-
box-shadow: 0 0 0 2px ${e=>
|
|
361
|
+
box-shadow: 0 0 0 2px ${e=>ge(e.$variant).box.focusShadow};
|
|
362
362
|
}
|
|
363
|
-
`,
|
|
363
|
+
`,Bo=s.input`
|
|
364
364
|
position: absolute;
|
|
365
365
|
opacity: 0;
|
|
366
366
|
width: 0;
|
|
367
367
|
height: 0;
|
|
368
368
|
pointer-events: none;
|
|
369
|
-
`,
|
|
369
|
+
`,Yo=s.span`
|
|
370
370
|
display: inline-flex;
|
|
371
371
|
align-items: center;
|
|
372
372
|
justify-content: center;
|
|
@@ -375,17 +375,17 @@
|
|
|
375
375
|
height: 18px;
|
|
376
376
|
border-radius: 6px;
|
|
377
377
|
border: 1.5px solid
|
|
378
|
-
${e=>e.$checked||e.$indeterminate?
|
|
379
|
-
background-color: ${e=>e.$checked||e.$indeterminate?
|
|
378
|
+
${e=>e.$checked||e.$indeterminate?ge(e.$variant).box.borderChecked:ge(e.$variant).box.border};
|
|
379
|
+
background-color: ${e=>e.$checked||e.$indeterminate?ge(e.$variant).box.backgroundChecked:ge(e.$variant).box.background};
|
|
380
380
|
transition:
|
|
381
381
|
border-color 0.15s ease,
|
|
382
382
|
background-color 0.15s ease,
|
|
383
383
|
box-shadow 0.15s ease;
|
|
384
|
-
`,
|
|
384
|
+
`,Ho=s.span`
|
|
385
385
|
display: inline-flex;
|
|
386
386
|
align-items: center;
|
|
387
387
|
justify-content: center;
|
|
388
|
-
color: ${e=>
|
|
388
|
+
color: ${e=>ge(e.$variant).icon};
|
|
389
389
|
opacity: ${e=>e.$visible?1:0};
|
|
390
390
|
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
391
391
|
transition:
|
|
@@ -396,11 +396,11 @@
|
|
|
396
396
|
width: 12px;
|
|
397
397
|
height: 12px;
|
|
398
398
|
}
|
|
399
|
-
`,
|
|
399
|
+
`,Vo=s.span`
|
|
400
400
|
font-size: 14px;
|
|
401
401
|
font-weight: 500;
|
|
402
402
|
line-height: 1.4;
|
|
403
|
-
color: ${e=>
|
|
403
|
+
color: ${e=>ge(e.$variant).label};
|
|
404
404
|
user-select: none;
|
|
405
405
|
|
|
406
406
|
a {
|
|
@@ -412,15 +412,15 @@
|
|
|
412
412
|
text-decoration: none;
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
`,
|
|
415
|
+
`,Pe=A.newClassNameGetter("checkbox"),tt=({checked:e,className:r,classnames:o,disabled:i,indeterminate:n=!1,label:l,onChange:c,ref:d,variant:p="normal",...h})=>a.jsxs(Fo,{className:Pe("container",r),$disabled:!!i,$variant:p,children:[a.jsx(Bo,{...h,ref:d,type:"checkbox",className:Pe("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:c}),a.jsx(Yo,{className:Pe("box",o==null?void 0:o.box),$checked:e,$indeterminate:n,$variant:p,children:a.jsx(Ho,{className:Pe("icon",o==null?void 0:o.icon),$visible:n||e,$variant:p,children:n?a.jsx(a.Minus,{}):a.jsx(a.Check,{})})}),l&&a.jsx(Vo,{className:Pe("label",o==null?void 0:o.label),$variant:p,children:l})]}),Ht={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=>Ht[e]??Ht.normal,Go=s.label`
|
|
416
416
|
display: grid;
|
|
417
417
|
grid-template-columns: auto 1fr;
|
|
418
418
|
align-items: start;
|
|
419
419
|
gap: 8px;
|
|
420
420
|
padding: 12px;
|
|
421
|
-
background-color: ${e=>{const r=
|
|
421
|
+
background-color: ${e=>{const r=ue(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
422
422
|
border: 1px solid
|
|
423
|
-
${e=>{const r=
|
|
423
|
+
${e=>{const r=ue(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
424
424
|
border-radius: 12px;
|
|
425
425
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
426
426
|
transition:
|
|
@@ -430,18 +430,18 @@
|
|
|
430
430
|
min-width: 0;
|
|
431
431
|
|
|
432
432
|
&:hover:not([data-disabled='true']) {
|
|
433
|
-
border-color: ${e=>{const r=
|
|
433
|
+
border-color: ${e=>{const r=ue(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
&:has(:focus-visible) {
|
|
437
437
|
outline: none;
|
|
438
|
-
box-shadow: 0 0 0 3px ${e=>
|
|
438
|
+
box-shadow: 0 0 0 3px ${e=>ue(e.$variant).focusRing};
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
.vacano_checkbox_container {
|
|
442
442
|
pointer-events: none;
|
|
443
443
|
}
|
|
444
|
-
`,
|
|
444
|
+
`,Wo=s.input`
|
|
445
445
|
position: absolute;
|
|
446
446
|
width: 1px;
|
|
447
447
|
height: 1px;
|
|
@@ -451,44 +451,44 @@
|
|
|
451
451
|
clip: rect(0, 0, 0, 0);
|
|
452
452
|
white-space: nowrap;
|
|
453
453
|
border: 0;
|
|
454
|
-
`,
|
|
454
|
+
`,Xo=s.div`
|
|
455
455
|
display: flex;
|
|
456
456
|
flex-direction: column;
|
|
457
457
|
gap: 2px;
|
|
458
458
|
min-width: 0;
|
|
459
|
-
`,
|
|
459
|
+
`,Uo=s.span`
|
|
460
460
|
font-size: 14px;
|
|
461
461
|
font-weight: 500;
|
|
462
462
|
line-height: 1.4;
|
|
463
|
-
color: ${e=>
|
|
463
|
+
color: ${e=>ue(e.$variant).label.static};
|
|
464
464
|
|
|
465
465
|
label[data-disabled='true'] & {
|
|
466
|
-
color: ${e=>
|
|
466
|
+
color: ${e=>ue(e.$variant).label.disabled};
|
|
467
467
|
}
|
|
468
|
-
`,
|
|
468
|
+
`,qo=s.span`
|
|
469
469
|
font-size: 12px;
|
|
470
470
|
font-weight: 400;
|
|
471
471
|
line-height: 1.4;
|
|
472
|
-
color: ${e=>
|
|
472
|
+
color: ${e=>ue(e.$variant).description.static};
|
|
473
473
|
|
|
474
474
|
label[data-disabled='true'] & {
|
|
475
|
-
color: ${e=>
|
|
475
|
+
color: ${e=>ue(e.$variant).description.disabled};
|
|
476
476
|
}
|
|
477
|
-
`,
|
|
477
|
+
`,He=A.newClassNameGetter("checkbox-card"),Ko=({checked:e,className:r,classnames:o,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...g})=>a.jsxs(Go,{className:He("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(Wo,{...g,ref:p,type:"checkbox",checked:e,disabled:n,onChange:d}),a.jsx(tt,{className:o==null?void 0:o.checkbox,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(Xo,{className:He("content",o==null?void 0:o.content),children:[a.jsx(Uo,{className:He("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(qo,{className:He("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),Vt={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},Zo=s.div`
|
|
478
478
|
display: flex;
|
|
479
479
|
flex-direction: column;
|
|
480
480
|
gap: 8px;
|
|
481
|
-
`,
|
|
481
|
+
`,Jo=s.span`
|
|
482
482
|
font-size: 13px;
|
|
483
483
|
font-weight: 500;
|
|
484
484
|
line-height: 1.5;
|
|
485
|
-
color: ${e=>e.$disabled?
|
|
485
|
+
color: ${e=>e.$disabled?Vt.label.disabledColor:Vt.label.color};
|
|
486
486
|
margin-bottom: 4px;
|
|
487
|
-
`,
|
|
487
|
+
`,Qo=s.div`
|
|
488
488
|
display: flex;
|
|
489
489
|
flex-direction: column;
|
|
490
490
|
gap: 12px;
|
|
491
|
-
`,
|
|
491
|
+
`,at=A.newClassNameGetter("checkbox-group"),ei=({className:e,classnames:r,disabled:o,label:i,onChange:n,options:l,ref:c,value:d,...p})=>{const h=(g,f)=>{n(f?[...d,g]:d.filter(O=>O!==g))};return a.jsxs(Zo,{...p,ref:c,className:at("container",e),children:[i&&a.jsx(Jo,{className:at("label",r==null?void 0:r.label),$disabled:o,children:i}),a.jsx(Qo,{className:at("options",r==null?void 0:r.options),children:l.map(g=>a.jsx(tt,{className:r==null?void 0:r.checkbox,checked:d.includes(g.value),label:g.label,disabled:o,onChange:f=>h(g.value,f.target.checked)},g.value))})]})},Gt={gray:{background:t.alpha(t.COLORS["iron-grey"],10),color:t.COLORS["iron-grey"],deleteHover:t.alpha(t.COLORS["iron-grey"],20)},red:{background:t.alpha(t.COLORS.red,10),color:t.COLORS.red,deleteHover:t.alpha(t.COLORS.red,20)},blue:{background:t.alpha(t.COLORS["steel-blue"],10),color:t.COLORS["steel-blue"],deleteHover:t.alpha(t.COLORS["steel-blue"],20)},black:{background:t.COLORS.black,color:t.COLORS.white,deleteHover:t.alpha(t.COLORS.white,20)}},mt=e=>Gt[e]??Gt.gray,ti=s.span`
|
|
492
492
|
display: inline-flex;
|
|
493
493
|
align-items: center;
|
|
494
494
|
gap: 4px;
|
|
@@ -498,9 +498,9 @@
|
|
|
498
498
|
font-size: 12px;
|
|
499
499
|
font-weight: 500;
|
|
500
500
|
line-height: 1.5;
|
|
501
|
-
background-color: ${e=>
|
|
502
|
-
color: ${e=>
|
|
503
|
-
`,
|
|
501
|
+
background-color: ${e=>mt(e.$variant).background};
|
|
502
|
+
color: ${e=>mt(e.$variant).color};
|
|
503
|
+
`,ri=s.button`
|
|
504
504
|
display: inline-flex;
|
|
505
505
|
align-items: center;
|
|
506
506
|
justify-content: center;
|
|
@@ -515,17 +515,17 @@
|
|
|
515
515
|
transition: background-color 0.15s ease;
|
|
516
516
|
|
|
517
517
|
&:hover {
|
|
518
|
-
background-color: ${e=>
|
|
518
|
+
background-color: ${e=>mt(e.$variant).deleteHover};
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
& svg {
|
|
522
522
|
width: 14px;
|
|
523
523
|
height: 14px;
|
|
524
524
|
}
|
|
525
|
-
`,
|
|
525
|
+
`,oi=s.span`
|
|
526
526
|
flex: 1 0 auto;
|
|
527
527
|
text-align: center;
|
|
528
|
-
`,
|
|
528
|
+
`,lt=A.newClassNameGetter("chip"),Qe=({children:e,className:r,classnames:o,deletable:i,onDelete:n,ref:l,variant:c="gray",...d})=>a.jsxs(ti,{...d,ref:l,className:lt("container",r),$variant:c,$deletable:!!i,children:[a.jsx(oi,{className:lt("label",o==null?void 0:o.label),children:e}),i&&a.jsx(ri,{type:"button",className:lt("delete",o==null?void 0:o.delete),$variant:c,onClick:n,children:a.jsx(a.X,{})})]}),ii="Confirm",ni="Cancel",ai=ae.keyframes`
|
|
529
529
|
from {
|
|
530
530
|
opacity: 0;
|
|
531
531
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -534,7 +534,7 @@
|
|
|
534
534
|
opacity: 1;
|
|
535
535
|
transform: translateX(-50%) translateY(0);
|
|
536
536
|
}
|
|
537
|
-
`,
|
|
537
|
+
`,li=ae.keyframes`
|
|
538
538
|
from {
|
|
539
539
|
opacity: 1;
|
|
540
540
|
transform: translateX(-50%) translateY(0);
|
|
@@ -543,7 +543,7 @@
|
|
|
543
543
|
opacity: 0;
|
|
544
544
|
transform: translateX(-50%) translateY(100%);
|
|
545
545
|
}
|
|
546
|
-
`,
|
|
546
|
+
`,di=s.div`
|
|
547
547
|
position: fixed;
|
|
548
548
|
bottom: 24px;
|
|
549
549
|
left: 50%;
|
|
@@ -558,49 +558,49 @@
|
|
|
558
558
|
box-shadow:
|
|
559
559
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
560
560
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
561
|
-
animation: ${({$open:e})=>e?
|
|
561
|
+
animation: ${({$open:e})=>e?ai:li} 0.2s ease-out forwards;
|
|
562
562
|
z-index: 1000;
|
|
563
|
-
`,
|
|
563
|
+
`,ci=s.p`
|
|
564
564
|
margin: 0;
|
|
565
565
|
font-size: 14px;
|
|
566
566
|
color: ${t.COLORS.black};
|
|
567
567
|
white-space: nowrap;
|
|
568
|
-
`,
|
|
568
|
+
`,si=s.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
align-items: center;
|
|
571
571
|
gap: 8px;
|
|
572
|
-
`,
|
|
572
|
+
`,ze=A.newClassNameGetter("confirmation"),pi=({cancelBindings:e,cancelLabel:r=ni,className:o,classnames:i,confirmLabel:n=ii,loading:l=!1,message:c,onCancel:d,onConfirm:p,open:h=!0,ref:g,submitBindings:f,...O})=>h?a.jsxs(di,{...O,ref:g,className:ze("container",o),$open:h,children:[a.jsx(ci,{className:ze("message",i==null?void 0:i.message),children:c}),a.jsxs(si,{className:ze("actions",i==null?void 0:i.actions),children:[a.jsx(_e,{variant:"system",size:"compact",onClick:d,keyBindings:e,className:ze("cancel-button",i==null?void 0:i.cancelButton),children:r}),a.jsx(_e,{variant:"danger",size:"compact",onClick:p,loading:l,keyBindings:f,className:ze("confirm-button",i==null?void 0:i.confirmButton),children:n})]})]}):null,je={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`},ui=s.div`
|
|
573
573
|
width: 100%;
|
|
574
574
|
|
|
575
575
|
${t.mediaUp("sm")} {
|
|
576
|
-
max-width: ${
|
|
576
|
+
max-width: ${je.sm};
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
${t.mediaUp("md")} {
|
|
580
|
-
max-width: ${
|
|
580
|
+
max-width: ${je.md};
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
${t.mediaUp("lg")} {
|
|
584
|
-
max-width: ${
|
|
584
|
+
max-width: ${je.lg};
|
|
585
585
|
}
|
|
586
586
|
|
|
587
587
|
${t.mediaUp("xl")} {
|
|
588
|
-
max-width: ${
|
|
588
|
+
max-width: ${je.xl};
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
${t.mediaUp("2xl")} {
|
|
592
|
-
max-width: ${
|
|
592
|
+
max-width: ${je["2xl"]};
|
|
593
593
|
}
|
|
594
|
-
`,
|
|
594
|
+
`,hi=A.newClassNameGetter("container"),bi=({children:e,className:r,ref:o,...i})=>a.jsx(ui,{...i,ref:o,className:hi("container",r),children:e}),Je={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},ye={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=36,rt=2,gi=12,vr=(e,r,o="en")=>{const i=e.getFullYear(),n=e.getMonth(),l=e.getDate(),c=e.getHours(),d=e.getMinutes(),p=e.getSeconds(),h=c%12||12,g=c>=12,f=new Intl.DateTimeFormat(o,{month:"long"}).format(e),O=new Intl.DateTimeFormat(o,{month:"short"}).format(e),m=new Intl.DateTimeFormat(o,{weekday:"long"}).format(e),y=new Intl.DateTimeFormat(o,{weekday:"short"}).format(e),S=L=>L.toString().padStart(2,"0"),v=L=>L.toString().padStart(2," "),x=L=>`\0${L}\0`,$=[["2006","YEARFOUR",i.toString()],["January","MONTHLONG",f],["Monday","WEEKDAYLONG",m],["Jan","MONTHSHORT",O],["Mon","WEEKDAYSHORT",y],["06","YEARTWO",i.toString().slice(-2)],["01","MONTHPAD",S(n+1)],["_2","DAYSPACE",v(l)],["02","DAYPAD",S(l)],["15","HOURTWENTYFOUR",S(c)],["03","HOURTWELVEPAD",S(h)],["04","MINUTE",S(d)],["05","SECOND",S(p)],["PM","AMPMUP",g?"PM":"AM"],["pm","AMPMLOW",g?"pm":"am"],["1","MONTH",(n+1).toString()],["2","DAY",l.toString()],["3","HOURTWELVE",h.toString()]];let b=r;for(const[L,j]of $)b=b.split(L).join(x(j));for(const[,L,j]of $)b=b.split(x(L)).join(j);return b},fi=(e,r)=>new Date(e,r+1,0).getDate(),xi=(e,r)=>new Date(e,r,1).getDay(),Oi=(e,r,o=1)=>{const i=fi(e,r);let l=xi(e,r)-o;l<0&&(l+=7);const c=[];for(let d=0;d<l;d++)c.push(null);for(let d=1;d<=i;d++)c.push(d);for(;c.length<42;)c.push(null);return c},$i=(e,r=1)=>{const o=[];for(let i=0;i<7;i++){const n=(r+i)%7,l=new Date(2024,0,7+n);o.push(new Intl.DateTimeFormat(e,{weekday:"short"}).format(l))}return o},Si=e=>{const r=[];for(let o=0;o<12;o++){const i=new Date(2024,o,1);r.push(new Intl.DateTimeFormat(e,{month:"short"}).format(i))}return r},Wt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate(),Xt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth(),yi=(e,r)=>e.getFullYear()===r.getFullYear(),Ut=(e,r,o,i,n)=>{const l=new Date(e,r,o);if(i){const c=new Date(i.getFullYear(),i.getMonth(),i.getDate());if(l<c)return!0}if(n){const c=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(l>c)return!0}return!1},qt=(e,r,o,i)=>{if(o){const n=o.getFullYear(),l=o.getMonth();if(e<n||e===n&&r<l)return!0}if(i){const n=i.getFullYear(),l=i.getMonth();if(e>n||e===n&&r>l)return!0}return!1},Kt=(e,r,o)=>!!(r&&e<r.getFullYear()||o&&e>o.getFullYear()),vi=(e,r=12)=>{const o=e-Math.floor(r/2),i=[];for(let n=0;n<r;n++)i.push(o+n);return i},Ci=e=>{switch(e){case"date":return"02.01.2006";case"month":return"January 2006";case"year":return"2006"}},mi=s.div`
|
|
595
595
|
position: relative;
|
|
596
596
|
display: inline-flex;
|
|
597
597
|
flex-direction: column;
|
|
598
598
|
gap: 2px;
|
|
599
599
|
min-width: 180px;
|
|
600
600
|
width: ${({$fullWidth:e})=>e?"100%":"fit-content"};
|
|
601
|
-
`,
|
|
601
|
+
`,wi=s(de)`
|
|
602
602
|
margin-left: 6px;
|
|
603
|
-
`,
|
|
603
|
+
`,Ri=s.button`
|
|
604
604
|
display: flex;
|
|
605
605
|
align-items: center;
|
|
606
606
|
justify-content: space-between;
|
|
@@ -611,68 +611,68 @@
|
|
|
611
611
|
font-size: 14px;
|
|
612
612
|
font-weight: 500;
|
|
613
613
|
text-align: left;
|
|
614
|
-
height: ${({$size:e})=>
|
|
615
|
-
padding: ${({$size:e})=>
|
|
616
|
-
border-radius: ${({$size:e})=>
|
|
617
|
-
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?
|
|
614
|
+
height: ${({$size:e})=>Je[e].height};
|
|
615
|
+
padding: ${({$size:e})=>Je[e].padding};
|
|
616
|
+
border-radius: ${({$size:e})=>Je[e].radius};
|
|
617
|
+
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?ye[e].color[r?"disabled":"static"]:ye[e].placeholder[r?"disabled":"static"]};
|
|
618
618
|
border: 1px solid
|
|
619
|
-
${({$variant:e,$disabled:r})=>
|
|
620
|
-
background-color: ${({$variant:e,$disabled:r})=>
|
|
619
|
+
${({$variant:e,$disabled:r})=>ye[e].border[r?"disabled":"static"]};
|
|
620
|
+
background-color: ${({$variant:e,$disabled:r})=>ye[e].background[r?"disabled":"static"]};
|
|
621
621
|
|
|
622
622
|
&:focus-visible {
|
|
623
|
-
outline: 2px solid ${({$variant:e})=>
|
|
623
|
+
outline: 2px solid ${({$variant:e})=>ye[e].focus};
|
|
624
624
|
}
|
|
625
625
|
|
|
626
626
|
${({$open:e,$variant:r})=>e&&`
|
|
627
|
-
outline: 2px solid ${
|
|
627
|
+
outline: 2px solid ${ye[r].focus};
|
|
628
628
|
`}
|
|
629
|
-
`,
|
|
629
|
+
`,ki=s.span`
|
|
630
630
|
flex: 1;
|
|
631
631
|
overflow: hidden;
|
|
632
632
|
text-overflow: ellipsis;
|
|
633
633
|
white-space: nowrap;
|
|
634
|
-
`,
|
|
634
|
+
`,Li=s.span`
|
|
635
635
|
display: flex;
|
|
636
636
|
align-items: center;
|
|
637
637
|
justify-content: center;
|
|
638
638
|
flex-shrink: 0;
|
|
639
639
|
transition: transform 0.15s ease;
|
|
640
640
|
transform: ${({$open:e})=>e?"rotate(180deg)":"rotate(0deg)"};
|
|
641
|
-
`,
|
|
641
|
+
`,Cr=`
|
|
642
642
|
z-index: 100;
|
|
643
643
|
background-color: ${t.COLORS.white};
|
|
644
644
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
645
645
|
border-radius: 12px;
|
|
646
646
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
647
|
-
padding: ${
|
|
648
|
-
`,
|
|
647
|
+
padding: ${gi}px;
|
|
648
|
+
`,mr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Pi=s.div`
|
|
649
649
|
position: absolute;
|
|
650
650
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
651
651
|
left: 0;
|
|
652
|
-
${
|
|
652
|
+
${Cr}
|
|
653
653
|
opacity: ${({$open:e})=>e?1:0};
|
|
654
654
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
655
|
-
transform: ${({$open:e,$position:r})=>
|
|
655
|
+
transform: ${({$open:e,$position:r})=>mr(e,r)};
|
|
656
656
|
transition:
|
|
657
657
|
opacity 0.15s ease,
|
|
658
658
|
transform 0.15s ease,
|
|
659
659
|
visibility 0.15s;
|
|
660
|
-
`,
|
|
660
|
+
`,zi=s.div`
|
|
661
661
|
position: fixed;
|
|
662
|
-
${
|
|
662
|
+
${Cr}
|
|
663
663
|
opacity: ${({$open:e})=>e?1:0};
|
|
664
664
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
665
|
-
transform: ${({$open:e,$position:r})=>
|
|
665
|
+
transform: ${({$open:e,$position:r})=>mr(e,r)};
|
|
666
666
|
transition:
|
|
667
667
|
opacity 0.15s ease,
|
|
668
668
|
transform 0.15s ease,
|
|
669
669
|
visibility 0.15s;
|
|
670
|
-
`,
|
|
670
|
+
`,dt=s.div`
|
|
671
671
|
display: flex;
|
|
672
672
|
align-items: center;
|
|
673
673
|
justify-content: space-between;
|
|
674
674
|
margin-bottom: 8px;
|
|
675
|
-
`,
|
|
675
|
+
`,ct=s.button`
|
|
676
676
|
display: flex;
|
|
677
677
|
align-items: center;
|
|
678
678
|
gap: 4px;
|
|
@@ -692,7 +692,7 @@
|
|
|
692
692
|
&:focus-visible {
|
|
693
693
|
outline: 2px solid ${t.alpha(t.COLORS.black,20)};
|
|
694
694
|
}
|
|
695
|
-
`,
|
|
695
|
+
`,ve=s.button`
|
|
696
696
|
display: flex;
|
|
697
697
|
align-items: center;
|
|
698
698
|
justify-content: center;
|
|
@@ -720,33 +720,33 @@
|
|
|
720
720
|
background: transparent;
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
|
-
`,
|
|
723
|
+
`,st=s.div`
|
|
724
724
|
display: flex;
|
|
725
725
|
gap: 4px;
|
|
726
|
-
`,
|
|
726
|
+
`,ji=s.div`
|
|
727
727
|
display: grid;
|
|
728
|
-
grid-template-columns: repeat(7, ${
|
|
729
|
-
gap: ${
|
|
728
|
+
grid-template-columns: repeat(7, ${le}px);
|
|
729
|
+
gap: ${rt}px;
|
|
730
730
|
margin-bottom: 4px;
|
|
731
|
-
`,
|
|
731
|
+
`,Ei=s.div`
|
|
732
732
|
display: flex;
|
|
733
733
|
align-items: center;
|
|
734
734
|
justify-content: center;
|
|
735
|
-
height: ${
|
|
735
|
+
height: ${le}px;
|
|
736
736
|
font-size: 12px;
|
|
737
737
|
font-weight: 500;
|
|
738
738
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
739
739
|
text-transform: uppercase;
|
|
740
|
-
`,
|
|
740
|
+
`,Ti=s.div`
|
|
741
741
|
display: grid;
|
|
742
|
-
grid-template-columns: repeat(7, ${
|
|
743
|
-
gap: ${
|
|
744
|
-
`,
|
|
742
|
+
grid-template-columns: repeat(7, ${le}px);
|
|
743
|
+
gap: ${rt}px;
|
|
744
|
+
`,Ni=s.button`
|
|
745
745
|
display: flex;
|
|
746
746
|
align-items: center;
|
|
747
747
|
justify-content: center;
|
|
748
|
-
width: ${
|
|
749
|
-
height: ${
|
|
748
|
+
width: ${le}px;
|
|
749
|
+
height: ${le}px;
|
|
750
750
|
border: none;
|
|
751
751
|
border-radius: 8px;
|
|
752
752
|
font-size: 13px;
|
|
@@ -771,12 +771,12 @@
|
|
|
771
771
|
&:disabled {
|
|
772
772
|
cursor: not-allowed;
|
|
773
773
|
}
|
|
774
|
-
`,
|
|
774
|
+
`,Ii=s.div`
|
|
775
775
|
display: grid;
|
|
776
776
|
grid-template-columns: repeat(3, 1fr);
|
|
777
777
|
gap: 8px;
|
|
778
|
-
width: ${7*
|
|
779
|
-
`,
|
|
778
|
+
width: ${7*le+6*rt}px;
|
|
779
|
+
`,Ai=s.button`
|
|
780
780
|
display: flex;
|
|
781
781
|
align-items: center;
|
|
782
782
|
justify-content: center;
|
|
@@ -801,12 +801,12 @@
|
|
|
801
801
|
outline: 2px solid ${t.alpha(t.COLORS.black,30)};
|
|
802
802
|
outline-offset: 1px;
|
|
803
803
|
}
|
|
804
|
-
`,
|
|
804
|
+
`,Di=s.div`
|
|
805
805
|
display: grid;
|
|
806
806
|
grid-template-columns: repeat(3, 1fr);
|
|
807
807
|
gap: 8px;
|
|
808
|
-
width: ${7*
|
|
809
|
-
`,
|
|
808
|
+
width: ${7*le+6*rt}px;
|
|
809
|
+
`,_i=s.button`
|
|
810
810
|
display: flex;
|
|
811
811
|
align-items: center;
|
|
812
812
|
justify-content: center;
|
|
@@ -831,10 +831,10 @@
|
|
|
831
831
|
outline: 2px solid ${t.alpha(t.COLORS.black,30)};
|
|
832
832
|
outline-offset: 1px;
|
|
833
833
|
}
|
|
834
|
-
`,
|
|
835
|
-
width: ${
|
|
836
|
-
height: ${
|
|
837
|
-
`,K=A.newClassNameGetter("date-picker"),
|
|
834
|
+
`,Mi=s.div`
|
|
835
|
+
width: ${le}px;
|
|
836
|
+
height: ${le}px;
|
|
837
|
+
`,K=A.newClassNameGetter("date-picker"),Ve=4,Fi=300,Bi=({value:e,onChange:r,mode:o="date",displayFormat:i,placeholder:n,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:p,size:h="default",variant:g="normal",disabled:f=!1,fullWidth:O=!1,label:m,portalRenderNode:y,open:S,onOpen:v,onClose:x,className:$,classnames:b,ref:L,...j})=>{const N=u.useMemo(()=>new Date,[]),[H,z]=u.useState(!1),[_,E]=u.useState({top:0,left:0}),[w,M]=u.useState("bottom"),[C,I]=u.useState(()=>o==="year"?"years":o==="month"?"months":"days"),[k,T]=u.useState(()=>e??N),[F,B]=u.useState(()=>((e==null?void 0:e.getFullYear())??N.getFullYear())-6),V=u.useRef(null),P=u.useRef(null),D=u.useRef(null),U=S!==void 0,q=U?S:H,$e=i??Ci(o),Me=u.useMemo(()=>$i(l,c),[l,c]),ot=u.useMemo(()=>Si(l),[l]),_r=u.useMemo(()=>Oi(k.getFullYear(),k.getMonth(),c),[k,c]),Fe=u.useMemo(()=>vi(F+6,12),[F]),zt=u.useMemo(()=>e?vr(e,$e,l):null,[e,$e,l]),Mr=n??$e.replace(/2006|06|January|Jan|01|02/g,"__"),me=u.useCallback(()=>{var Re;if(!P.current)return;const R=P.current.getBoundingClientRect(),Y=((Re=D.current)==null?void 0:Re.offsetHeight)??Fi,we=window.innerHeight-R.bottom-Ve,Be=R.top-Ve,Se=we<Y&&Be>we?"top":"bottom";if(M(Se),y){const Ye=Se==="bottom"?R.bottom+Ve:R.top-Y-Ve;E({top:Ye,left:R.left})}},[y]),jt=u.useCallback(()=>{if(f)return;U||z(!0),v==null||v(),I(o==="year"?"years":o==="month"?"months":"days");const R=e??N;T(R),B(R.getFullYear()-6)},[f,U,v,o,e,N]),Z=u.useCallback(()=>{U||z(!1),x==null||x()},[U,x]),Fr=u.useCallback(()=>{q?Z():jt()},[q,Z,jt]),Br=u.useCallback(R=>{const Y=new Date(k.getFullYear(),k.getMonth(),R);r==null||r(Y),Z()},[k,r,Z]),Yr=u.useCallback(R=>{if(o==="month"){const Y=new Date(k.getFullYear(),R,1);r==null||r(Y),Z()}else T(new Date(k.getFullYear(),R,1)),I("days")},[o,k,r,Z]),Hr=u.useCallback(R=>{if(o==="year"){const Y=new Date(R,0,1);r==null||r(Y),Z()}else o==="month"?(T(new Date(R,k.getMonth(),1)),I("months")):(T(new Date(R,k.getMonth(),1)),I("months"))},[o,k,r,Z]),Vr=u.useCallback(()=>{T(R=>new Date(R.getFullYear(),R.getMonth()-1,1))},[]),Gr=u.useCallback(()=>{T(R=>new Date(R.getFullYear(),R.getMonth()+1,1))},[]),Wr=u.useCallback(()=>{T(R=>new Date(R.getFullYear()-1,R.getMonth(),1))},[]),Xr=u.useCallback(()=>{T(R=>new Date(R.getFullYear()+1,R.getMonth(),1))},[]),Ur=u.useCallback(()=>{B(R=>R-12)},[]),qr=u.useCallback(()=>{B(R=>R+12)},[]),Et=u.useCallback(()=>{C==="days"?I("months"):C==="months"&&I("years")},[C]);u.useLayoutEffect(()=>{q&&me()},[q,me]),u.useEffect(()=>{const R=Se=>{const Re=Se.target,Ye=V.current&&!V.current.contains(Re),to=D.current&&!D.current.contains(Re);y?Ye&&to&&Z():Ye&&Z()},Y=Se=>{Se.key==="Escape"&&Z()},we=()=>{q&&y&&me()},Be=()=>{q&&y&&me()};return q&&(document.addEventListener("mousedown",R),document.addEventListener("keydown",Y),y&&(window.addEventListener("scroll",we,!0),window.addEventListener("resize",Be))),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",Y),window.removeEventListener("scroll",we,!0),window.removeEventListener("resize",Be)}},[q,Z,y,me]);const Kr=Je[h].iconSize,Zr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(ct,{onClick:Et,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(k)}),a.jsxs(st,{children:[a.jsx(ve,{onClick:Vr,type:"button","aria-label":"Previous month",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(ve,{onClick:Gr,type:"button","aria-label":"Next month",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(ji,{children:Me.map((R,Y)=>a.jsx(Ei,{children:R},Y))}),a.jsx(Ti,{className:K("grid",b==null?void 0:b.grid),children:_r.map((R,Y)=>R===null?a.jsx(Mi,{},Y):a.jsx(Ni,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Wt(e,new Date(k.getFullYear(),k.getMonth(),R)):!1,$today:Wt(N,new Date(k.getFullYear(),k.getMonth(),R)),$disabled:Ut(k.getFullYear(),k.getMonth(),R,d,p),disabled:Ut(k.getFullYear(),k.getMonth(),R,d,p),onClick:()=>Br(R),children:R},Y))})]}),Jr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(ct,{onClick:Et,type:"button",children:k.getFullYear()}),a.jsxs(st,{children:[a.jsx(ve,{onClick:Wr,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(ve,{onClick:Xr,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Ii,{className:K("grid",b==null?void 0:b.grid),children:ot.map((R,Y)=>a.jsx(Ai,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Xt(e,new Date(k.getFullYear(),Y,1)):!1,$current:Xt(N,new Date(k.getFullYear(),Y,1)),$disabled:qt(k.getFullYear(),Y,d,p),disabled:qt(k.getFullYear(),Y,d,p),onClick:()=>Yr(Y),children:R},Y))})]}),Qr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsxs(ct,{type:"button",style:{cursor:"default"},children:[Fe[0]," - ",Fe[Fe.length-1]]}),a.jsxs(st,{children:[a.jsx(ve,{onClick:Ur,type:"button","aria-label":"Previous years",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(ve,{onClick:qr,type:"button","aria-label":"Next years",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Di,{className:K("grid",b==null?void 0:b.grid),children:Fe.map(R=>a.jsx(_i,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?yi(e,new Date(R,0,1)):!1,$current:N.getFullYear()===R,$disabled:Kt(R,d,p),disabled:Kt(R,d,p),onClick:()=>Hr(R),children:R},R))})]}),Tt=()=>{switch(C){case"days":return Zr();case"months":return Jr();case"years":return Qr()}},eo=y?Oe.createPortal(a.jsx(zi,{ref:D,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),style:{top:_.top,left:_.left},children:Tt()}),y):a.jsx(Pi,{ref:D,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),children:Tt()});return a.jsxs(mi,{...j,ref:L??V,$fullWidth:O,className:K("container",$),children:[m&&a.jsx(wi,{children:m}),a.jsxs(Ri,{ref:P,type:"button",onClick:Fr,disabled:f,$size:h,$variant:g,$disabled:f,$open:q,$hasValue:!!zt,className:K("trigger",b==null?void 0:b.trigger),children:[a.jsx(ki,{children:zt??Mr}),a.jsx(Li,{$open:q,children:a.jsx(a.ChevronDown,{size:Kr})})]}),eo]})},Yi={left:t.KEYFRAMES.slideInLeft,right:t.KEYFRAMES.slideInRight,top:t.KEYFRAMES.slideInTop,bottom:t.KEYFRAMES.slideInBottom},Hi=(e,r)=>{switch(e){case"left":return`
|
|
838
838
|
top: 0;
|
|
839
839
|
left: 0;
|
|
840
840
|
height: 100%;
|
|
@@ -854,19 +854,19 @@
|
|
|
854
854
|
left: 0;
|
|
855
855
|
width: 100%;
|
|
856
856
|
height: ${r};
|
|
857
|
-
`}},
|
|
857
|
+
`}},Vi=s.div`
|
|
858
858
|
position: fixed;
|
|
859
859
|
z-index: 1001;
|
|
860
860
|
background-color: ${t.COLORS.white};
|
|
861
861
|
box-shadow: 0 4px 24px ${t.alpha(t.COLORS.black,20)};
|
|
862
|
-
${e=>
|
|
863
|
-
animation: ${e=>
|
|
864
|
-
`,
|
|
862
|
+
${e=>Hi(e.$position,e.$size)}
|
|
863
|
+
animation: ${e=>Yi[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
864
|
+
`,Gi=A.newClassNameGetter("drawer"),Wi=({animated:e,children:r,className:o,open:i,position:n="right",ref:l,size:c="400px",...d})=>i?Oe.createPortal(a.jsx(Vi,{...d,ref:l,className:Gi("container",o),$animated:!!e,$position:n,$size:c,children:r}),document.body):null,Xi=s.div`
|
|
865
865
|
position: relative;
|
|
866
866
|
display: inline-block;
|
|
867
|
-
`,
|
|
867
|
+
`,Ui=s.div`
|
|
868
868
|
cursor: pointer;
|
|
869
|
-
`,
|
|
869
|
+
`,wr=`
|
|
870
870
|
z-index: 100;
|
|
871
871
|
min-width: 160px;
|
|
872
872
|
padding: 8px;
|
|
@@ -874,39 +874,39 @@
|
|
|
874
874
|
border: 1px solid ${t.COLORS.gray};
|
|
875
875
|
border-radius: 8px;
|
|
876
876
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
877
|
-
`,
|
|
877
|
+
`,Rr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",qi=s.div`
|
|
878
878
|
position: absolute;
|
|
879
879
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
880
880
|
${({$align:e})=>e==="left"?"left: 0;":"right: 0;"}
|
|
881
|
-
${
|
|
881
|
+
${wr}
|
|
882
882
|
opacity: ${({$open:e})=>e?1:0};
|
|
883
883
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
884
|
-
transform: ${({$open:e,$position:r})=>
|
|
884
|
+
transform: ${({$open:e,$position:r})=>Rr(e,r)};
|
|
885
885
|
transition:
|
|
886
886
|
opacity 0.15s ease,
|
|
887
887
|
transform 0.15s ease,
|
|
888
888
|
visibility 0.15s;
|
|
889
|
-
`,
|
|
889
|
+
`,Ki=s.div`
|
|
890
890
|
position: fixed;
|
|
891
|
-
${
|
|
891
|
+
${wr}
|
|
892
892
|
opacity: ${({$open:e})=>e?1:0};
|
|
893
893
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
894
|
-
transform: ${({$open:e,$position:r})=>
|
|
894
|
+
transform: ${({$open:e,$position:r})=>Rr(e,r)};
|
|
895
895
|
transition:
|
|
896
896
|
opacity 0.15s ease,
|
|
897
897
|
transform 0.15s ease,
|
|
898
898
|
visibility 0.15s;
|
|
899
|
-
`,Ge=A.newClassNameGetter("dropdown"),
|
|
899
|
+
`,Ge=A.newClassNameGetter("dropdown"),We=4,Zi=100,Ji=({align:e="left",children:r,className:o,classnames:i,onClose:n,onOpen:l,open:c,portalRenderNode:d,ref:p,trigger:h,...g})=>{const[f,O]=u.useState(!1),[m,y]=u.useState({top:0,left:0}),[S,v]=u.useState("bottom"),x=u.useRef(null),$=u.useRef(null),b=u.useRef(null),L=c!==void 0,j=L?c:f,N=u.useCallback(()=>{var T,F;if(!$.current)return;const E=$.current.getBoundingClientRect(),w=((T=b.current)==null?void 0:T.offsetHeight)??Zi,M=((F=b.current)==null?void 0:F.offsetWidth)??160,C=window.innerHeight-E.bottom-We,I=E.top-We,k=C<w&&I>C?"top":"bottom";if(v(k),d){let B;e==="left"?B=E.left:B=E.right-M;const V=k==="bottom"?E.bottom+We:E.top-w-We;y({top:V,left:B})}},[e,d]),H=u.useCallback(()=>{L?j?n==null||n():l==null||l():O(E=>{const w=!E;return w?l==null||l():n==null||n(),w})},[L,j,n,l]),z=u.useCallback(()=>{L||O(!1),n==null||n()},[L,n]);u.useLayoutEffect(()=>{j&&N()},[j,N]),u.useEffect(()=>{const E=I=>{const k=I.target,T=x.current&&!x.current.contains(k),F=b.current&&!b.current.contains(k);d?T&&F&&z():T&&z()},w=I=>{I.key==="Escape"&&z()},M=()=>{j&&d&&N()},C=()=>{j&&d&&N()};return j&&(document.addEventListener("mousedown",E),document.addEventListener("keydown",w),d&&(window.addEventListener("scroll",M,!0),window.addEventListener("resize",C))),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",C)}},[j,z,d,N]);const _=d?Oe.createPortal(a.jsx(Ki,{ref:b,$open:j,$position:S,className:Ge("content",i==null?void 0:i.content),style:{top:m.top,left:m.left},children:r}),d):a.jsx(qi,{ref:b,$align:e,$open:j,$position:S,className:Ge("content",i==null?void 0:i.content),children:r});return a.jsxs(Xi,{...g,ref:p??x,className:Ge("container",o),children:[a.jsx(Ui,{ref:$,onClick:H,className:Ge("trigger",i==null?void 0:i.trigger),children:u.cloneElement(h)}),_]})},Qi={normal:t.COLORS["iron-grey"],error:t.COLORS.red,success:t.COLORS.green,warning:t.COLORS.yellow},en=s.span`
|
|
900
900
|
display: block;
|
|
901
901
|
font-size: 12px;
|
|
902
902
|
font-weight: 500;
|
|
903
903
|
line-height: 1.4;
|
|
904
|
-
color: ${e=>
|
|
905
|
-
`,
|
|
904
|
+
color: ${e=>Qi[e.$variant]};
|
|
905
|
+
`,tn=A.newClassNameGetter("field-message"),rn=({children:e,className:r,ref:o,variant:i="normal",...n})=>e?a.jsx(en,{...n,ref:o,className:tn("container",r),$variant:i,children:e}):null,on=s.div`
|
|
906
906
|
display: flex;
|
|
907
907
|
flex-direction: column;
|
|
908
908
|
gap: 12px;
|
|
909
|
-
`,
|
|
909
|
+
`,nn=s.div`
|
|
910
910
|
width: ${({$size:e})=>e}px;
|
|
911
911
|
height: ${({$size:e})=>e}px;
|
|
912
912
|
border-radius: 8px;
|
|
@@ -922,10 +922,10 @@
|
|
|
922
922
|
height: 100%;
|
|
923
923
|
object-fit: cover;
|
|
924
924
|
}
|
|
925
|
-
`,
|
|
925
|
+
`,an=s.span`
|
|
926
926
|
font-size: 12px;
|
|
927
927
|
color: ${t.COLORS["iron-grey"]};
|
|
928
|
-
`,
|
|
928
|
+
`,ln=e=>`
|
|
929
929
|
.${e} {
|
|
930
930
|
padding: 7px 16px;
|
|
931
931
|
font-size: 14px;
|
|
@@ -943,7 +943,7 @@
|
|
|
943
943
|
.${e}:active {
|
|
944
944
|
transform: translate(0, 1px);
|
|
945
945
|
}
|
|
946
|
-
`,
|
|
946
|
+
`,dn=e=>`
|
|
947
947
|
.${e} {
|
|
948
948
|
display: flex;
|
|
949
949
|
flex: 1 1 auto;
|
|
@@ -967,7 +967,7 @@
|
|
|
967
967
|
max-height: 70vh;
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
`,
|
|
970
|
+
`,cn=e=>`
|
|
971
971
|
.${e} {
|
|
972
972
|
padding: 7px 16px;
|
|
973
973
|
font-size: 14px;
|
|
@@ -985,7 +985,7 @@
|
|
|
985
985
|
.${e}:active {
|
|
986
986
|
transform: translate(0, 1px);
|
|
987
987
|
}
|
|
988
|
-
`,
|
|
988
|
+
`,sn=e=>`
|
|
989
989
|
.${e} {
|
|
990
990
|
display: flex;
|
|
991
991
|
flex-direction: column;
|
|
@@ -1003,7 +1003,7 @@
|
|
|
1003
1003
|
border-radius: 8px;
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
|
-
`,
|
|
1006
|
+
`,pn=e=>`
|
|
1007
1007
|
.${e} {
|
|
1008
1008
|
display: flex;
|
|
1009
1009
|
justify-content: flex-end;
|
|
@@ -1022,7 +1022,7 @@
|
|
|
1022
1022
|
gap: 8px;
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
|
-
`,
|
|
1025
|
+
`,un=e=>`
|
|
1026
1026
|
.${e} {
|
|
1027
1027
|
display: flex;
|
|
1028
1028
|
justify-content: flex-start;
|
|
@@ -1044,7 +1044,7 @@
|
|
|
1044
1044
|
font-size: 14px;
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
|
-
`,
|
|
1047
|
+
`,hn=e=>`
|
|
1048
1048
|
.${e} {
|
|
1049
1049
|
display: block;
|
|
1050
1050
|
z-index: 101;
|
|
@@ -1062,27 +1062,27 @@
|
|
|
1062
1062
|
position: absolute;
|
|
1063
1063
|
touch-action: none;
|
|
1064
1064
|
}
|
|
1065
|
-
`,
|
|
1065
|
+
`,bn=e=>`
|
|
1066
1066
|
.${e} {
|
|
1067
1067
|
position: absolute;
|
|
1068
1068
|
z-index: 2;
|
|
1069
1069
|
background-color: rgba(0, 0, 0, 0.6);
|
|
1070
1070
|
touch-action: none;
|
|
1071
1071
|
}
|
|
1072
|
-
`,
|
|
1072
|
+
`,gn=e=>`
|
|
1073
1073
|
.${e} {
|
|
1074
1074
|
position: absolute;
|
|
1075
1075
|
z-index: 3;
|
|
1076
1076
|
touch-action: none;
|
|
1077
1077
|
}
|
|
1078
|
-
`,
|
|
1078
|
+
`,fn=e=>`
|
|
1079
1079
|
.${e} {
|
|
1080
1080
|
backface-visibility: hidden;
|
|
1081
1081
|
perspective: 1000px;
|
|
1082
1082
|
max-inline-size: unset !important;
|
|
1083
1083
|
max-block-size: unset !important;
|
|
1084
1084
|
}
|
|
1085
|
-
`,
|
|
1085
|
+
`,xn=e=>`
|
|
1086
1086
|
.${e} {
|
|
1087
1087
|
position: absolute;
|
|
1088
1088
|
z-index: 100;
|
|
@@ -1093,7 +1093,7 @@
|
|
|
1093
1093
|
overflow: hidden;
|
|
1094
1094
|
border-radius: 50%;
|
|
1095
1095
|
}
|
|
1096
|
-
`,
|
|
1096
|
+
`,On={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},$n={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},Xe=(e,r)=>{const o=On[r],{h:i,v:n}=$n[r];return`
|
|
1097
1097
|
.${e} {
|
|
1098
1098
|
display: block;
|
|
1099
1099
|
z-index: 102;
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
${n}: -12px;
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
1122
|
-
`},
|
|
1122
|
+
`},Sn=e=>`
|
|
1123
1123
|
.${e} {
|
|
1124
1124
|
display: flex;
|
|
1125
1125
|
align-items: center;
|
|
@@ -1145,7 +1145,7 @@
|
|
|
1145
1145
|
padding-bottom: env(safe-area-inset-bottom, 8px);
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
|
-
`,
|
|
1148
|
+
`,yn=e=>`
|
|
1149
1149
|
.${e} {
|
|
1150
1150
|
backface-visibility: hidden;
|
|
1151
1151
|
user-select: none;
|
|
@@ -1158,25 +1158,25 @@
|
|
|
1158
1158
|
position: absolute;
|
|
1159
1159
|
z-index: 1;
|
|
1160
1160
|
}
|
|
1161
|
-
|
|
1162
|
-
${
|
|
1163
|
-
${
|
|
1164
|
-
${
|
|
1165
|
-
${
|
|
1166
|
-
${
|
|
1167
|
-
${
|
|
1168
|
-
${
|
|
1169
|
-
${
|
|
1170
|
-
${
|
|
1171
|
-
${
|
|
1172
|
-
${
|
|
1173
|
-
${
|
|
1174
|
-
${
|
|
1175
|
-
${
|
|
1176
|
-
${
|
|
1177
|
-
${
|
|
1178
|
-
${
|
|
1179
|
-
`,i=document.createElement("style");return i.innerHTML=o,document.getElementsByTagName("head")[0].prepend(i),r};let yn=0;const vn=e=>{const r=new Map,o=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(r.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...o}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(o[n]=l)}},subscribe:(i,n)=>{const l=String(++yn),c=r.get(i)||[];return r.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of r.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){r.set(n,c);return}}},unsubscribeAll:()=>{r.clear()}}},mt={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},mn=(e={},r={})=>vn({...mt,config:{...mt.config,...e},css:Sn(r)}),Cn=(e,r)=>{var O;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!i)return o.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=r.width/r.height;let p,h,g=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(r.height/r.width),g=(l-h)/2),{width:p,height:h,left:f,top:g}},wn=(e,r,o)=>{const[i,n]=r,l=i+e>o.width?(o.width-e)/2:i,c=n+e>o.height?(o.height-e)/2:n;return[l,c]},Rn=(e,r)=>{const{config:o}=e(),i=Math.min(r.width,r.height)-o.framePadding*2,n=o.portalSize>i?i:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=wn(n,o.portalPosition,r);return{left:l,top:c,size:n}}return o.portalPosition==="center"?{size:n,left:(r.width-n)/2,top:(r.height-n)/2}:{left:0,top:0,size:n}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const kn=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerMove),o.setAttribute("data-action",te.MOVE),o},Ln=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},Pn=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},zn=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},jn=e=>{var i;const r=e(),o=document.createElement("span");return U(o,(i=r.css)==null?void 0:i.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},En=e=>{var i;const r=e(),o=document.createElement("img");return U(o,(i=r.css)==null?void 0:i.previewImage),o},Tn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.preview),o.appendChild(En(e)),o},Nn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.portal),o.appendChild(Tn(e)),o.appendChild(kn(e)),o.appendChild(zn(e)),o.appendChild(jn(e)),o.appendChild(Ln(e)),o.appendChild(Pn(e)),o},In=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.portalArea),o.appendChild(Nn(e)),o},An=e=>{var i;const r=e(),o=document.createElement("img");return U(o,(i=r.css)==null?void 0:i.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Dn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.body),o.appendChild(An(e)),o.appendChild(In(e)),o},_n=(e,r)=>{var n;const o=e(),i=document.createElement("div");return U(i,(n=o.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=o.config.applyButtonLabel,i.addEventListener("click",r),i},Mn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return U(i,(n=o.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=o.config.cancelButtonLabel,i.addEventListener("click",r),i},Fn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.footer),n.appendChild(Mn(e,o)),n.appendChild(_n(e,r)),n},Bn=e=>{var i;const r=e(),o=document.createElement("div");return U(o,(i=r.css)==null?void 0:i.header),o},Yn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.container),n.appendChild(Bn(e)),n.appendChild(Dn(e)),n.appendChild(Fn(e,r,o)),n},Hn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");U(n,(l=i.css)==null?void 0:l.root),n.appendChild(Yn(e,r,o)),document.body.appendChild(n)},Gn=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,Vn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},ge=(e,r)=>{if(Ie.has(e))return Ie.get(e);if(!r)return null;const o=r[Vn[e]],i=document.querySelector(`.${o[0]}`);return Ie.set(e,i),i},Wn=()=>{Ie.clear()},Un=()=>{Ie.clear()},Xn=(e,r)=>{const o=ge("header",r.css);o&&(o.innerText=e)},qn=(e,r)=>{const o=ge("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const i=ge("portalArea",r.css);i&&(i.style.height=`${r.frame.height}px`,i.style.width=`${r.frame.width}px`,i.style.left=`${r.frame.left}px`,i.style.top=`${r.frame.top}px`);const n=ge("portal",r.css);n&&(n.style.width=`${r.portal.size}px`,n.style.height=`${r.portal.size}px`,n.style.left=`${r.portal.left}px`,n.style.top=`${r.portal.top}px`);const l=ge("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`)},Kn=(e,r)=>{const o=ge("portal",r.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const i=ge("previewImage",r.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},st=1,Zn=e=>{var C,y;const r=e(),o=document.createElement("canvas"),i=r.frame.width||st,n=r.frame.height||st,l=r.sourceWidth/i,c=r.sourceHeight/n,d=r.portal.left*l,p=r.portal.top*c,h=Math.max(r.portal.size*Math.min(l,c),st),g=r.config.outputSize>0?r.config.outputSize:h;o.width=g,o.height=g;const f=document.querySelector(`.${(C=r.css)==null?void 0:C.sourceImage[0]}`);f&&((y=o.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,g,g));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((S,v)=>{try{o.toBlob(x=>{if(o.remove(),!x){v(new Error(`Failed to create blob for type: image/${r.config.type}`));return}S([O,x])},`image/${r.config.type}`,r.config.compression)}catch(x){o.remove(),v(x)}})},Jn=(e,r,o)=>{const{emitted:i,portal:n,frame:l,config:c}=r();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,g=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>g&&(d=g),p<f&&(p=f),p>O&&(p=O),o({portal:{...n,left:d,top:p}})},Qn=(e,r,o)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=r(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let g=n.size+Math.max(p,h);return g<d.minPortalSize&&(g=d.minPortalSize),n.top+g>c.height-d.framePadding&&(g=c.height-n.top-d.framePadding),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding),o({portal:{...l,size:g}})}case te.RESIZE_TR:{let g=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return g<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,g=d.minPortalSize),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(g=n.top+n.size,f=d.framePadding),o({portal:{...l,top:f,size:g}})}case te.RESIZE_TL:{const g=Math.min(p,h);let f=n.size-g,O=n.left+g,C=n.top+g;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,C=n.top+y}if(C<d.framePadding){const y=d.framePadding-C;C=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,C=C+y,f=f-y}return o({portal:{...l,top:C,left:O,size:f}})}case te.RESIZE_BL:{let g=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return g<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,g=d.minPortalSize),g+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,g=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,g=n.left+n.size-d.framePadding),o({portal:{...l,left:f,size:g}})}default:return}},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}},ea=(e,r)=>{var O,C,y;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(C=o.css)==null?void 0:C.portalArea[0]}`),l=document.querySelector(`.${(y=o.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:v}=e(),x=qt(S);if(S.target){const $=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:v.left,top:v.top,size:v.size};r({action:$,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&r({action:null})},g=()=>{if(c=null,!d)return;const S=d;d=null;const{action:v}=e();if(v)switch(v){case te.MOVE:Jn(S,e,r);break;default:Qn(S,e,r)}},f=S=>{const{action:v}=e();v&&(S.preventDefault(),d=qt(S),c===null&&(c=requestAnimationFrame(g)))};return l&&(l.addEventListener("mouseup",h),l.addEventListener("touchend",h),l.addEventListener("touchcancel",h)),i&&(i.addEventListener("mousedown",p),i.addEventListener("touchstart",p,{passive:!1})),n&&(n.addEventListener("mousemove",f),n.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",h),l.removeEventListener("touchend",h),l.removeEventListener("touchcancel",h)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},Kt=1024*1024,ta=(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/Kt).toFixed(2);return`File size (${(e.size/Kt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ra=(e,r,o,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=r(),g=ta(p,h);if(g){d(g),e.target.value="";return}const f=new FileReader;let O=null;const C=()=>{var b;const x=r(),$=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);$&&($.remove(),document.removeEventListener("keydown",y),O==null||O(),Un(),l(),o(mt))},y=x=>{x.key==="Escape"&&r().sourceBase64&&S(x)},S=x=>{x.preventDefault(),C()},v=x=>{x.preventDefault();const $=r();Zn(r).then(([b,L])=>{i(b,L,$),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const $=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}$.src=x.target.result,$.onerror=()=>{d("Failed to load image")},$.onload=()=>{var j;Hn(r,v,S),Wn(),n("fileName",Xn),n("sourceBase64",qn),n("portal",Kn);const b=Cn(r,$),L=Rn(r,b);o({frame:b,portal:L,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:$.height,sourceWidth:$.width}),O=ea(r,o),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},oa=(e,r,o,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=mn(r,o),p=Gn(h=>ra(h,n,l,e,c,d,i));return{open:()=>p.click()}},le={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Zt="vacano-image-cropper-styles",ia=`
|
|
1161
|
+
`,vn=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__${vn(e)}`,W=e=>e||[],X=(e,r)=>{if(r)for(const o of r)e.classList.add(o)},Cn=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=`
|
|
1162
|
+
${ln(r.applyButton[0])}
|
|
1163
|
+
${dn(r.body[0])}
|
|
1164
|
+
${cn(r.cancelButton[0])}
|
|
1165
|
+
${sn(r.container[0])}
|
|
1166
|
+
${pn(r.footer[0])}
|
|
1167
|
+
${un(r.header[0])}
|
|
1168
|
+
${hn(r.handlerMove[0])}
|
|
1169
|
+
${bn(r.portalArea[0])}
|
|
1170
|
+
${gn(r.portal[0])}
|
|
1171
|
+
${fn(r.previewImage[0])}
|
|
1172
|
+
${xn(r.preview[0])}
|
|
1173
|
+
${Xe(r.handlerResizeBottomLeft[0],"bl")}
|
|
1174
|
+
${Xe(r.handlerResizeBottomRight[0],"br")}
|
|
1175
|
+
${Xe(r.handlerResizeTopLeft[0],"tl")}
|
|
1176
|
+
${Xe(r.handlerResizeTopRight[0],"tr")}
|
|
1177
|
+
${Sn(r.root[0])}
|
|
1178
|
+
${yn(r.sourceImage[0])}
|
|
1179
|
+
`,i=document.createElement("style");return i.innerHTML=o,document.getElementsByTagName("head")[0].prepend(i),r};let mn=0;const wn=e=>{const r=new Map,o=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(r.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...o}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(o[n]=l)}},subscribe:(i,n)=>{const l=String(++mn),c=r.get(i)||[];return r.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of r.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){r.set(n,c);return}}},unsubscribeAll:()=>{r.clear()}}},wt={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},Rn=(e={},r={})=>wn({...wt,config:{...wt.config,...e},css:Cn(r)}),kn=(e,r)=>{var O;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!i)return o.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=r.width/r.height;let p,h,g=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(r.height/r.width),g=(l-h)/2),{width:p,height:h,left:f,top:g}},Ln=(e,r,o)=>{const[i,n]=r,l=i+e>o.width?(o.width-e)/2:i,c=n+e>o.height?(o.height-e)/2:n;return[l,c]},Pn=(e,r)=>{const{config:o}=e(),i=Math.min(r.width,r.height)-o.framePadding*2,n=o.portalSize>i?i:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=Ln(n,o.portalPosition,r);return{left:l,top:c,size:n}}return o.portalPosition==="center"?{size:n,left:(r.width-n)/2,top:(r.height-n)/2}:{left:0,top:0,size:n}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const zn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerMove),o.setAttribute("data-action",te.MOVE),o},jn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},En=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Tn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Nn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},In=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.previewImage),o},An=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.preview),o.appendChild(In(e)),o},Dn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portal),o.appendChild(An(e)),o.appendChild(zn(e)),o.appendChild(Tn(e)),o.appendChild(Nn(e)),o.appendChild(jn(e)),o.appendChild(En(e)),o},_n=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portalArea),o.appendChild(Dn(e)),o},Mn=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Fn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.body),o.appendChild(Mn(e)),o.appendChild(_n(e)),o},Bn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=o.config.applyButtonLabel,i.addEventListener("click",r),i},Yn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=o.config.cancelButtonLabel,i.addEventListener("click",r),i},Hn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.footer),n.appendChild(Yn(e,o)),n.appendChild(Bn(e,r)),n},Vn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.header),o},Gn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.container),n.appendChild(Vn(e)),n.appendChild(Fn(e)),n.appendChild(Hn(e,r,o)),n},Wn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");X(n,(l=i.css)==null?void 0:l.root),n.appendChild(Gn(e,r,o)),document.body.appendChild(n)},Xn=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ae=new Map,Un={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},fe=(e,r)=>{if(Ae.has(e))return Ae.get(e);if(!r)return null;const o=r[Un[e]],i=document.querySelector(`.${o[0]}`);return Ae.set(e,i),i},qn=()=>{Ae.clear()},Kn=()=>{Ae.clear()},Zn=(e,r)=>{const o=fe("header",r.css);o&&(o.innerText=e)},Jn=(e,r)=>{const o=fe("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const i=fe("portalArea",r.css);i&&(i.style.height=`${r.frame.height}px`,i.style.width=`${r.frame.width}px`,i.style.left=`${r.frame.left}px`,i.style.top=`${r.frame.top}px`);const n=fe("portal",r.css);n&&(n.style.width=`${r.portal.size}px`,n.style.height=`${r.portal.size}px`,n.style.left=`${r.portal.left}px`,n.style.top=`${r.portal.top}px`);const l=fe("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},Qn=(e,r)=>{const o=fe("portal",r.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const i=fe("previewImage",r.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},pt=1,ea=e=>{var m,y;const r=e(),o=document.createElement("canvas"),i=r.frame.width||pt,n=r.frame.height||pt,l=r.sourceWidth/i,c=r.sourceHeight/n,d=r.portal.left*l,p=r.portal.top*c,h=Math.max(r.portal.size*Math.min(l,c),pt),g=r.config.outputSize>0?r.config.outputSize:h;o.width=g,o.height=g;const f=document.querySelector(`.${(m=r.css)==null?void 0:m.sourceImage[0]}`);f&&((y=o.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,g,g));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((S,v)=>{try{o.toBlob(x=>{if(o.remove(),!x){v(new Error(`Failed to create blob for type: image/${r.config.type}`));return}S([O,x])},`image/${r.config.type}`,r.config.compression)}catch(x){o.remove(),v(x)}})},ta=(e,r,o)=>{const{emitted:i,portal:n,frame:l,config:c}=r();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,g=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>g&&(d=g),p<f&&(p=f),p>O&&(p=O),o({portal:{...n,left:d,top:p}})},ra=(e,r,o)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=r(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let g=n.size+Math.max(p,h);return g<d.minPortalSize&&(g=d.minPortalSize),n.top+g>c.height-d.framePadding&&(g=c.height-n.top-d.framePadding),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding),o({portal:{...l,size:g}})}case te.RESIZE_TR:{let g=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return g<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,g=d.minPortalSize),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(g=n.top+n.size,f=d.framePadding),o({portal:{...l,top:f,size:g}})}case te.RESIZE_TL:{const g=Math.min(p,h);let f=n.size-g,O=n.left+g,m=n.top+g;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,m=n.top+y}if(m<d.framePadding){const y=d.framePadding-m;m=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,m=m+y,f=f-y}return o({portal:{...l,top:m,left:O,size:f}})}case te.RESIZE_BL:{let g=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return g<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,g=d.minPortalSize),g+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,g=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,g=n.left+n.size-d.framePadding),o({portal:{...l,left:f,size:g}})}default:return}},Zt=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const r=e;return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}},oa=(e,r)=>{var O,m,y;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(m=o.css)==null?void 0:m.portalArea[0]}`),l=document.querySelector(`.${(y=o.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:v}=e(),x=Zt(S);if(S.target){const $=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:v.left,top:v.top,size:v.size};r({action:$,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&r({action:null})},g=()=>{if(c=null,!d)return;const S=d;d=null;const{action:v}=e();if(v)switch(v){case te.MOVE:ta(S,e,r);break;default:ra(S,e,r)}},f=S=>{const{action:v}=e();v&&(S.preventDefault(),d=Zt(S),c===null&&(c=requestAnimationFrame(g)))};return l&&(l.addEventListener("mouseup",h),l.addEventListener("touchend",h),l.addEventListener("touchcancel",h)),i&&(i.addEventListener("mousedown",p),i.addEventListener("touchstart",p,{passive:!1})),n&&(n.addEventListener("mousemove",f),n.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",h),l.removeEventListener("touchend",h),l.removeEventListener("touchcancel",h)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},Jt=1024*1024,ia=(e,r)=>{if(!r.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${r.allowedTypes.join(", ")}`;if(r.maxFileSize>0&&e.size>r.maxFileSize){const o=(r.maxFileSize/Jt).toFixed(2);return`File size (${(e.size/Jt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},na=(e,r,o,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=r(),g=ia(p,h);if(g){d(g),e.target.value="";return}const f=new FileReader;let O=null;const m=()=>{var b;const x=r(),$=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);$&&($.remove(),document.removeEventListener("keydown",y),O==null||O(),Kn(),l(),o(wt))},y=x=>{x.key==="Escape"&&r().sourceBase64&&S(x)},S=x=>{x.preventDefault(),m()},v=x=>{x.preventDefault();const $=r();ea(r).then(([b,L])=>{i(b,L,$),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const $=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}$.src=x.target.result,$.onerror=()=>{d("Failed to load image")},$.onload=()=>{var j;Wn(r,v,S),qn(),n("fileName",Zn),n("sourceBase64",Jn),n("portal",Qn);const b=kn(r,$),L=Pn(r,b);o({frame:b,portal:L,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:$.height,sourceWidth:$.width}),O=oa(r,o),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},aa=(e,r,o,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=Rn(r,o),p=Xn(h=>na(h,n,l,e,c,d,i));return{open:()=>p.click()}},ce={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Qt="vacano-image-cropper-styles",la=`
|
|
1180
1180
|
.vacano-cropper-root {
|
|
1181
1181
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1182
1182
|
backdrop-filter: blur(4px);
|
|
@@ -1224,22 +1224,22 @@
|
|
|
1224
1224
|
.vacano-cropper-apply-button:hover {
|
|
1225
1225
|
background-color: ${t.COLORS["iron-grey"]};
|
|
1226
1226
|
}
|
|
1227
|
-
`,
|
|
1227
|
+
`,da=()=>{if(typeof document>"u"||document.getElementById(Qt))return;const e=document.createElement("style");e.id=Qt,e.textContent=la,document.head.appendChild(e)},ca={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"]},kr=(e={})=>{const{allowedTypes:r=ce.allowedTypes,applyLabel:o=ce.applyLabel,cancelLabel:i=ce.cancelLabel,compression:n=ce.compression,maxFileSize:l=ce.maxFileSize,onCrop:c,onError:d,outputSize:p=ce.outputSize,portalSize:h=ce.portalSize,type:g=ce.type}=e,f=u.useRef(null);return{open:u.useCallback(()=>{f.current||(da(),f.current=aa((m,y,S)=>{y&&(c==null||c({base64:m,blob:y,state:S}))},{portalSize:h,outputSize:p,compression:n,type:g,maxFileSize:l,allowedTypes:r,applyButtonLabel:o,cancelButtonLabel:i},ca,m=>{d==null||d({code:"CROPPER_ERROR",message:m})})),f.current.open()},[r,o,i,n,l,c,d,p,h,g])}},ut=A.newClassNameGetter("image-cropper"),sa=({allowedTypes:e,applyLabel:r,buttonLabel:o="Select Image",cancelLabel:i,className:n,classnames:l,compression:c,maxFileSize:d,onCrop:p,onError:h,outputSize:g,portalSize:f,previewSize:O=120,ref:m,type:y,value:S,...v})=>{const[x,$]=u.useState(S??null),{open:b}=kr({allowedTypes:e,applyLabel:r,cancelLabel:i,compression:c,maxFileSize:d,onCrop:L=>{$(L.base64),p==null||p(L)},onError:h,outputSize:g,portalSize:f,type:y});return a.jsxs(on,{...v,ref:m,className:ut("container",n),children:[a.jsx(nn,{$size:O,className:ut("preview",l==null?void 0:l.preview),children:x?a.jsx("img",{src:x,alt:"Preview"}):a.jsx(an,{children:"No image"})}),a.jsx(_e,{variant:"system",onClick:b,className:ut("button",l==null?void 0:l.button),style:{width:O},children:o})]})},er={compact:{height:"32px",padding:"0 10px",radius:"14px",prefixSize:"16px"},default:{height:"40px",padding:"0 14px",radius:"16px",prefixSize:"20px"}},tr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},ie=e=>tr[e]??tr.normal,ht=e=>er[e]??er.default,pa=s.div`
|
|
1228
1228
|
display: grid;
|
|
1229
1229
|
flex-direction: column;
|
|
1230
1230
|
gap: 2px;
|
|
1231
1231
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1232
|
-
`,
|
|
1232
|
+
`,ua=s(de)`
|
|
1233
1233
|
margin-left: 6px;
|
|
1234
|
-
`,
|
|
1234
|
+
`,ha=s.input`
|
|
1235
1235
|
flex: 1;
|
|
1236
1236
|
min-width: 0;
|
|
1237
1237
|
outline: none;
|
|
1238
1238
|
font-size: 14px;
|
|
1239
1239
|
font-weight: 500;
|
|
1240
|
-
height: ${e=>
|
|
1241
|
-
padding: ${e=>
|
|
1242
|
-
border-radius: ${e=>
|
|
1240
|
+
height: ${e=>ht(e.$size).height};
|
|
1241
|
+
padding: ${e=>ht(e.$size).padding};
|
|
1242
|
+
border-radius: ${e=>ht(e.$size).radius};
|
|
1243
1243
|
|
|
1244
1244
|
color: ${e=>ie(e.$variant).color.static};
|
|
1245
1245
|
border: 1px solid ${e=>ie(e.$variant).border.static};
|
|
@@ -1263,7 +1263,7 @@
|
|
|
1263
1263
|
&:focus-visible {
|
|
1264
1264
|
outline: 2px solid ${e=>ie(e.$variant).focus};
|
|
1265
1265
|
}
|
|
1266
|
-
`,
|
|
1266
|
+
`,bt=A.newClassNameGetter("input"),Lr=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",...p})=>a.jsxs(pa,{className:bt("container",e),$fullWidth:!!i,children:[a.jsx(ua,{variant:d,className:bt("label",r==null?void 0:r.label),children:n}),a.jsx(ha,{...p,ref:l,disabled:o,$size:c,$variant:d,className:bt("input",r==null?void 0:r.input)})]}),ba=s.div`
|
|
1267
1267
|
position: fixed;
|
|
1268
1268
|
inset: 0;
|
|
1269
1269
|
z-index: 1000;
|
|
@@ -1272,7 +1272,7 @@
|
|
|
1272
1272
|
justify-content: center;
|
|
1273
1273
|
background-color: ${t.alpha(t.COLORS.black,50)};
|
|
1274
1274
|
animation: ${t.KEYFRAMES.fadeIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1275
|
-
`,
|
|
1275
|
+
`,ga=s.div`
|
|
1276
1276
|
position: relative;
|
|
1277
1277
|
z-index: 1001;
|
|
1278
1278
|
width: ${e=>e.$width};
|
|
@@ -1283,21 +1283,21 @@
|
|
|
1283
1283
|
border-radius: 16px;
|
|
1284
1284
|
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1285
1285
|
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1286
|
-
`,
|
|
1286
|
+
`,rr=A.newClassNameGetter("modal"),Pr=({animated:e,children:r,className:o,classnames:i,open:n,ref:l,width:c="500px",...d})=>n?Oe.createPortal(a.jsx(ba,{className:rr("overlay",i==null?void 0:i.overlay),$animated:!!e,children:a.jsx(ga,{...d,ref:l,className:rr("content",o,i==null?void 0:i.content),$animated:!!e,$width:c,children:r})}),document.body):null,zr={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},fa=s.div`
|
|
1287
1287
|
display: flex;
|
|
1288
1288
|
flex-direction: column;
|
|
1289
1289
|
gap: 4px;
|
|
1290
|
-
`,
|
|
1290
|
+
`,xa=s(de)`
|
|
1291
1291
|
margin-left: 6px;
|
|
1292
|
-
color: ${e=>
|
|
1293
|
-
`,
|
|
1292
|
+
color: ${e=>zr[e.$variant].label};
|
|
1293
|
+
`,Oa=s.button`
|
|
1294
1294
|
display: flex;
|
|
1295
1295
|
flex-wrap: wrap;
|
|
1296
1296
|
align-items: center;
|
|
1297
1297
|
gap: 6px;
|
|
1298
1298
|
min-height: 44px;
|
|
1299
1299
|
padding: 8px 12px;
|
|
1300
|
-
border: 1px dashed ${e=>
|
|
1300
|
+
border: 1px dashed ${e=>zr[e.$variant].border};
|
|
1301
1301
|
border-radius: 8px;
|
|
1302
1302
|
background: ${t.COLORS.white};
|
|
1303
1303
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
@@ -1314,31 +1314,31 @@
|
|
|
1314
1314
|
${e=>e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1315
1315
|
outline-offset: 2px;
|
|
1316
1316
|
}
|
|
1317
|
-
|
|
1317
|
+
`,$a=s.span`
|
|
1318
1318
|
color: ${t.COLORS["iron-grey"]};
|
|
1319
1319
|
font-size: 14px;
|
|
1320
|
-
`,
|
|
1320
|
+
`,Sa=s.div`
|
|
1321
1321
|
display: flex;
|
|
1322
1322
|
flex-direction: column;
|
|
1323
1323
|
padding: 20px;
|
|
1324
1324
|
gap: 16px;
|
|
1325
|
-
`,
|
|
1325
|
+
`,ya=s.div`
|
|
1326
1326
|
display: flex;
|
|
1327
1327
|
align-items: center;
|
|
1328
1328
|
justify-content: space-between;
|
|
1329
|
-
|
|
1329
|
+
`,va=s.h3`
|
|
1330
1330
|
margin: 0;
|
|
1331
1331
|
font-size: 18px;
|
|
1332
1332
|
font-weight: 600;
|
|
1333
1333
|
color: ${t.COLORS.black};
|
|
1334
|
-
`,
|
|
1334
|
+
`,Ca=s.div`
|
|
1335
1335
|
display: flex;
|
|
1336
1336
|
flex-direction: column;
|
|
1337
1337
|
gap: 4px;
|
|
1338
1338
|
min-height: 200px;
|
|
1339
1339
|
max-height: 300px;
|
|
1340
1340
|
overflow-y: auto;
|
|
1341
|
-
`,
|
|
1341
|
+
`,ma=s.label`
|
|
1342
1342
|
display: flex;
|
|
1343
1343
|
align-items: center;
|
|
1344
1344
|
gap: 10px;
|
|
@@ -1351,10 +1351,10 @@
|
|
|
1351
1351
|
&:hover {
|
|
1352
1352
|
background-color: ${e=>e.$disabled?"transparent":t.COLORS.gray};
|
|
1353
1353
|
}
|
|
1354
|
-
`,
|
|
1354
|
+
`,wa=s.span`
|
|
1355
1355
|
font-size: 14px;
|
|
1356
1356
|
color: ${t.COLORS.black};
|
|
1357
|
-
`,
|
|
1357
|
+
`,Ra=s.div`
|
|
1358
1358
|
display: flex;
|
|
1359
1359
|
align-items: center;
|
|
1360
1360
|
justify-content: center;
|
|
@@ -1362,82 +1362,82 @@
|
|
|
1362
1362
|
color: ${t.COLORS["iron-grey"]};
|
|
1363
1363
|
font-size: 14px;
|
|
1364
1364
|
text-align: center;
|
|
1365
|
-
`,Q=A.newClassNameGetter("multi-select"),
|
|
1365
|
+
`,Q=A.newClassNameGetter("multi-select"),ka=({className:e,classnames:r,disabled:o=!1,emptyMessage:i="No options found",label:n,maxVisible:l=1/0,modalTitle:c="Select options",onChange:d,options:p,placeholder:h="Select...",ref:g,searchPlaceholder:f="Search...",value:O,variant:m="normal",...y})=>{const[S,v]=u.useState(!1),[x,$]=u.useState(""),b=u.useMemo(()=>p.filter(w=>O.includes(w.value)),[p,O]),L=u.useMemo(()=>{if(!x.trim())return p;const w=x.toLowerCase().trim();return p.filter(M=>M.label.toLowerCase().includes(w))},[p,x]),j=l===1/0?b:b.slice(0,l),N=b.length-j.length,H=()=>{o||(v(!0),$(""))},z=()=>{v(!1),$("")},_=w=>{O.includes(w)?d(O.filter(M=>M!==w)):d([...O,w])},E=w=>{d(O.filter(M=>M!==w))};return a.jsxs(fa,{...y,ref:g,className:Q("container",e),children:[n&&a.jsx(xa,{$variant:m,className:Q("label",r==null?void 0:r.trigger),children:n}),a.jsx(Oa,{type:"button",$variant:m,$disabled:o,disabled:o,onClick:H,className:Q("trigger",r==null?void 0:r.trigger),children:b.length===0?a.jsx($a,{className:Q("placeholder",r==null?void 0:r.placeholder),children:h}):a.jsxs(a.Fragment,{children:[j.map(w=>a.jsx(Qe,{deletable:!0,onDelete:()=>E(w.value),onClick:M=>M.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:w.label},w.value)),N>0&&a.jsxs(Qe,{variant:"gray",onClick:w=>w.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:["+",N]})]})}),a.jsx(Pr,{open:S,width:"400px",animated:!0,className:Q("modal",r==null?void 0:r.modal),children:a.jsxs(Sa,{children:[a.jsxs(ya,{children:[a.jsx(va,{children:c}),a.jsx(_e,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:z})]}),a.jsx(Lr,{type:"text",value:x,onChange:w=>$(w.target.value),placeholder:f,autoFocus:!0,fullWidth:!0,className:Q("search",r==null?void 0:r.search)}),a.jsx(Ca,{className:Q("options",r==null?void 0:r.options),children:L.length===0?a.jsx(Ra,{className:Q("empty",r==null?void 0:r.empty),children:i}):L.map(w=>a.jsxs(ma,{$disabled:!!w.disabled,className:Q("option",r==null?void 0:r.option),children:[a.jsx(tt,{checked:O.includes(w.value),disabled:w.disabled,onChange:()=>_(w.value)}),a.jsx(wa,{children:w.label})]},w.value))})]})})]})},or={compact:{width:"36px",height:"40px",fontSize:"16px",radius:"10px",gap:"8px"},default:{width:"44px",height:"52px",fontSize:"20px",radius:"12px",gap:"10px"}},ir={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},Ie=e=>or[e]??or.default,be=e=>ir[e]??ir.normal,La=s.div`
|
|
1366
1366
|
display: inline-flex;
|
|
1367
1367
|
flex-direction: column;
|
|
1368
1368
|
gap: 2px;
|
|
1369
|
-
`,
|
|
1369
|
+
`,Pa=s(de)`
|
|
1370
1370
|
margin-left: 6px;
|
|
1371
|
-
`,
|
|
1371
|
+
`,za=s.div`
|
|
1372
1372
|
display: flex;
|
|
1373
|
-
gap: ${e=>
|
|
1374
|
-
`,
|
|
1375
|
-
width: ${e=>
|
|
1376
|
-
height: ${e=>
|
|
1377
|
-
border-radius: ${e=>
|
|
1378
|
-
font-size: ${e=>
|
|
1373
|
+
gap: ${e=>Ie(e.$size).gap};
|
|
1374
|
+
`,ja=s.input`
|
|
1375
|
+
width: ${e=>Ie(e.$size).width};
|
|
1376
|
+
height: ${e=>Ie(e.$size).height};
|
|
1377
|
+
border-radius: ${e=>Ie(e.$size).radius};
|
|
1378
|
+
font-size: ${e=>Ie(e.$size).fontSize};
|
|
1379
1379
|
font-weight: 600;
|
|
1380
1380
|
text-align: center;
|
|
1381
1381
|
outline: none;
|
|
1382
|
-
border: 1px solid ${e=>
|
|
1383
|
-
background-color: ${e=>
|
|
1384
|
-
color: ${e=>
|
|
1382
|
+
border: 1px solid ${e=>be(e.$variant).border.static};
|
|
1383
|
+
background-color: ${e=>be(e.$variant).background.static};
|
|
1384
|
+
color: ${e=>be(e.$variant).color.static};
|
|
1385
1385
|
transition:
|
|
1386
1386
|
border-color 0.15s ease,
|
|
1387
1387
|
box-shadow 0.15s ease;
|
|
1388
1388
|
|
|
1389
1389
|
&:disabled {
|
|
1390
1390
|
cursor: not-allowed;
|
|
1391
|
-
color: ${e=>
|
|
1392
|
-
background-color: ${e=>
|
|
1393
|
-
border-color: ${e=>
|
|
1391
|
+
color: ${e=>be(e.$variant).color.disabled};
|
|
1392
|
+
background-color: ${e=>be(e.$variant).background.disabled};
|
|
1393
|
+
border-color: ${e=>be(e.$variant).border.disabled};
|
|
1394
1394
|
}
|
|
1395
1395
|
|
|
1396
1396
|
&:focus-visible {
|
|
1397
|
-
outline: 2px solid ${e=>
|
|
1397
|
+
outline: 2px solid ${e=>be(e.$variant).focus};
|
|
1398
1398
|
}
|
|
1399
1399
|
|
|
1400
1400
|
&::selection {
|
|
1401
1401
|
background-color: transparent;
|
|
1402
1402
|
}
|
|
1403
|
-
`,
|
|
1403
|
+
`,gt=A.newClassNameGetter("otp-code"),Ea=({autoFocus:e,className:r,classnames:o,disabled:i,label:n,length:l=6,onChange:c,ref:d,size:p="default",value:h="",variant:g="normal",...f})=>{const O=u.useRef([]);u.useEffect(()=>{e&&O.current[0]&&O.current[0].focus()},[e]);const m=u.useCallback(x=>{const $=O.current[x];$&&($.focus(),$.select())},[]),y=u.useCallback((x,$)=>{const L=$.target.value.replace(/\D/g,"").slice(-1);if(!L)return;const j=h.padEnd(l," ").split(""),N=j.findIndex(E=>E===" "||E===""),H=N!==-1?N:x;j[H]=L;const z=j.join("").replace(/ /g,"");c==null||c(z);const _=H+1;_<l&&m(_)},[h,l,c,m]),S=u.useCallback((x,$)=>{if($.key==="Backspace"){$.preventDefault();const b=h.split("");b[x]?(b[x]="",c==null||c(b.join(""))):x>0&&(b[x-1]="",c==null||c(b.join("")),m(x-1))}else $.key==="ArrowLeft"&&x>0?($.preventDefault(),m(x-1)):$.key==="ArrowRight"&&x<l-1&&($.preventDefault(),m(x+1))},[h,l,c,m]),v=u.useCallback(x=>{x.preventDefault();const $=x.clipboardData.getData("text").replace(/\D/g,"").slice(0,l);if($){c==null||c($);const b=Math.min($.length,l-1);m(b)}},[l,c,m]);return a.jsxs(La,{ref:d,className:gt("container",r),...f,children:[n&&a.jsx(Pa,{variant:g,className:gt("label",o==null?void 0:o.label),children:n}),a.jsx(za,{$size:p,children:Array.from({length:l}).map((x,$)=>a.jsx(ja,{ref:b=>{O.current[$]=b},type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:2,disabled:i,value:h[$]??"",onChange:b=>y($,b),onKeyDown:b=>S($,b),onPaste:v,onFocus:b=>b.target.select(),$size:p,$variant:g,className:gt("input",o==null?void 0:o.input)},$))})]})},nr={light:{background:t.COLORS.white,border:t.alpha(t.COLORS.black,30),title:t.COLORS.black,description:t.COLORS["iron-grey"]},dark:{background:t.alpha(t.COLORS.white,5),border:t.alpha(t.COLORS.white,30),title:t.COLORS.white,description:"#9ca3af"}},et=e=>nr[e]??nr.light,Ta=s.div`
|
|
1404
1404
|
display: flex;
|
|
1405
1405
|
flex-direction: column;
|
|
1406
1406
|
gap: 16px;
|
|
1407
1407
|
padding: 12px;
|
|
1408
|
-
border: 1px dashed ${({$variant:e})=>
|
|
1408
|
+
border: 1px dashed ${({$variant:e})=>et(e).border};
|
|
1409
1409
|
border-radius: 16px;
|
|
1410
|
-
background-color: ${({$variant:e})=>
|
|
1411
|
-
`,
|
|
1410
|
+
background-color: ${({$variant:e})=>et(e).background};
|
|
1411
|
+
`,Na=s.div`
|
|
1412
1412
|
display: flex;
|
|
1413
1413
|
flex-direction: column;
|
|
1414
1414
|
gap: 4px;
|
|
1415
|
-
`,
|
|
1415
|
+
`,Ia=s.div`
|
|
1416
1416
|
font-size: 18px;
|
|
1417
1417
|
font-weight: 600;
|
|
1418
1418
|
line-height: 1.4;
|
|
1419
|
-
color: ${({$variant:e})=>
|
|
1420
|
-
`,
|
|
1419
|
+
color: ${({$variant:e})=>et(e).title};
|
|
1420
|
+
`,Aa=s.div`
|
|
1421
1421
|
font-size: 14px;
|
|
1422
1422
|
line-height: 1.5;
|
|
1423
|
-
color: ${({$variant:e})=>
|
|
1424
|
-
`,
|
|
1423
|
+
color: ${({$variant:e})=>et(e).description};
|
|
1424
|
+
`,Da=s.div`
|
|
1425
1425
|
display: flex;
|
|
1426
1426
|
flex-wrap: wrap;
|
|
1427
1427
|
gap: 8px;
|
|
1428
|
-
`,Ue=A.newClassNameGetter("panel"),
|
|
1428
|
+
`,Ue=A.newClassNameGetter("panel"),_a=({children:e,className:r,classnames:o,description:i,ref:n,title:l,variant:c="light",...d})=>{const p=l||i;return a.jsxs(Ta,{...d,ref:n,className:Ue("container",r),$variant:c,children:[p&&a.jsxs(Na,{children:[l&&a.jsx(Ia,{className:Ue("title",o==null?void 0:o.title),$variant:c,children:l}),i&&a.jsx(Aa,{className:Ue("description",o==null?void 0:o.description),$variant:c,children:i})]}),a.jsx(Da,{className:Ue("content",o==null?void 0:o.content),children:e})]})},Rt={compact:{height:4,radius:2},default:{height:8,radius:4}},Ma=s.div`
|
|
1429
1429
|
width: 100%;
|
|
1430
|
-
height: ${({$size:e})=>
|
|
1431
|
-
border-radius: ${({$size:e})=>
|
|
1430
|
+
height: ${({$size:e})=>Rt[e].height}px;
|
|
1431
|
+
border-radius: ${({$size:e})=>Rt[e].radius}px;
|
|
1432
1432
|
background-color: ${t.COLORS.gray};
|
|
1433
1433
|
overflow: hidden;
|
|
1434
|
-
`,
|
|
1434
|
+
`,Fa=s.div`
|
|
1435
1435
|
height: 100%;
|
|
1436
1436
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1437
|
-
border-radius: ${({$size:e})=>
|
|
1437
|
+
border-radius: ${({$size:e})=>Rt[e].radius}px;
|
|
1438
1438
|
background-color: ${t.COLORS.black};
|
|
1439
1439
|
transition: width 0.2s ease;
|
|
1440
|
-
`,
|
|
1440
|
+
`,ar=A.newClassNameGetter("progress"),Ba=({value:e,size:r="default",className:o,classnames:i,ref:n,...l})=>a.jsx(Ma,{...l,ref:n,$size:r,className:ar("track",o,i==null?void 0:i.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(Fa,{$size:r,$value:e,className:ar("bar",i==null?void 0:i.bar)})}),lr={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}},xe=e=>lr[e]??lr.normal,Ya=s.label`
|
|
1441
1441
|
display: inline-flex;
|
|
1442
1442
|
align-items: flex-start;
|
|
1443
1443
|
gap: 8px;
|
|
@@ -1445,15 +1445,15 @@
|
|
|
1445
1445
|
opacity: ${e=>e.$disabled?.5:1};
|
|
1446
1446
|
|
|
1447
1447
|
&:has(input:focus-visible) > span:first-of-type {
|
|
1448
|
-
box-shadow: 0 0 0 2px ${e=>
|
|
1448
|
+
box-shadow: 0 0 0 2px ${e=>xe(e.$variant).box.focusShadow};
|
|
1449
1449
|
}
|
|
1450
|
-
`,
|
|
1450
|
+
`,Ha=s.input`
|
|
1451
1451
|
position: absolute;
|
|
1452
1452
|
opacity: 0;
|
|
1453
1453
|
width: 0;
|
|
1454
1454
|
height: 0;
|
|
1455
1455
|
pointer-events: none;
|
|
1456
|
-
`,
|
|
1456
|
+
`,Va=s.span`
|
|
1457
1457
|
display: inline-flex;
|
|
1458
1458
|
align-items: center;
|
|
1459
1459
|
justify-content: center;
|
|
@@ -1462,27 +1462,27 @@
|
|
|
1462
1462
|
height: 18px;
|
|
1463
1463
|
border-radius: 50%;
|
|
1464
1464
|
border: 1.5px solid
|
|
1465
|
-
${e=>e.$checked?
|
|
1466
|
-
background-color: ${e=>e.$checked?
|
|
1465
|
+
${e=>e.$checked?xe(e.$variant).box.borderChecked:xe(e.$variant).box.border};
|
|
1466
|
+
background-color: ${e=>e.$checked?xe(e.$variant).box.backgroundChecked:xe(e.$variant).box.background};
|
|
1467
1467
|
transition:
|
|
1468
1468
|
border-color 0.15s ease,
|
|
1469
1469
|
background-color 0.15s ease,
|
|
1470
1470
|
box-shadow 0.15s ease;
|
|
1471
|
-
`,
|
|
1471
|
+
`,Ga=s.span`
|
|
1472
1472
|
width: 8px;
|
|
1473
1473
|
height: 8px;
|
|
1474
1474
|
border-radius: 50%;
|
|
1475
|
-
background-color: ${e=>
|
|
1475
|
+
background-color: ${e=>xe(e.$variant).dot};
|
|
1476
1476
|
opacity: ${e=>e.$visible?1:0};
|
|
1477
1477
|
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
1478
1478
|
transition:
|
|
1479
1479
|
opacity 0.15s ease,
|
|
1480
1480
|
transform 0.15s ease;
|
|
1481
|
-
`,
|
|
1481
|
+
`,Wa=s.span`
|
|
1482
1482
|
font-size: 14px;
|
|
1483
1483
|
font-weight: 500;
|
|
1484
1484
|
line-height: 1.5;
|
|
1485
|
-
color: ${e=>
|
|
1485
|
+
color: ${e=>xe(e.$variant).label};
|
|
1486
1486
|
user-select: none;
|
|
1487
1487
|
|
|
1488
1488
|
a {
|
|
@@ -1494,15 +1494,15 @@
|
|
|
1494
1494
|
text-decoration: none;
|
|
1495
1495
|
}
|
|
1496
1496
|
}
|
|
1497
|
-
`,
|
|
1497
|
+
`,Ee=A.newClassNameGetter("radio"),Pt=({checked:e,className:r,classnames:o,disabled:i,label:n,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(Ya,{className:Ee("container",r),$disabled:!!i,$variant:d,children:[a.jsx(Ha,{...p,ref:c,type:"radio",className:Ee("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:l}),a.jsx(Va,{className:Ee("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(Ga,{className:Ee("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),n&&a.jsx(Wa,{className:Ee("label",o==null?void 0:o.label),$variant:d,children:n})]}),dr={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=>dr[e]??dr.normal,Xa=s.label`
|
|
1498
1498
|
display: grid;
|
|
1499
1499
|
grid-template-columns: auto 1fr;
|
|
1500
1500
|
align-items: start;
|
|
1501
1501
|
gap: 8px;
|
|
1502
1502
|
padding: 12px;
|
|
1503
|
-
background-color: ${e=>{const r=
|
|
1503
|
+
background-color: ${e=>{const r=he(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
1504
1504
|
border: 1px solid
|
|
1505
|
-
${e=>{const r=
|
|
1505
|
+
${e=>{const r=he(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
1506
1506
|
border-radius: 12px;
|
|
1507
1507
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1508
1508
|
transition:
|
|
@@ -1512,18 +1512,18 @@
|
|
|
1512
1512
|
min-width: 0;
|
|
1513
1513
|
|
|
1514
1514
|
&:hover:not([data-disabled='true']) {
|
|
1515
|
-
border-color: ${e=>{const r=
|
|
1515
|
+
border-color: ${e=>{const r=he(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
1516
1516
|
}
|
|
1517
1517
|
|
|
1518
1518
|
&:has(:focus-visible) {
|
|
1519
1519
|
outline: none;
|
|
1520
|
-
box-shadow: 0 0 0 3px ${e=>
|
|
1520
|
+
box-shadow: 0 0 0 3px ${e=>he(e.$variant).focusRing};
|
|
1521
1521
|
}
|
|
1522
1522
|
|
|
1523
1523
|
.vacano_radio_container {
|
|
1524
1524
|
pointer-events: none;
|
|
1525
1525
|
}
|
|
1526
|
-
`,
|
|
1526
|
+
`,Ua=s.input`
|
|
1527
1527
|
position: absolute;
|
|
1528
1528
|
width: 1px;
|
|
1529
1529
|
height: 1px;
|
|
@@ -1533,44 +1533,44 @@
|
|
|
1533
1533
|
clip: rect(0, 0, 0, 0);
|
|
1534
1534
|
white-space: nowrap;
|
|
1535
1535
|
border: 0;
|
|
1536
|
-
`,
|
|
1536
|
+
`,qa=s.div`
|
|
1537
1537
|
display: flex;
|
|
1538
1538
|
flex-direction: column;
|
|
1539
1539
|
gap: 2px;
|
|
1540
1540
|
min-width: 0;
|
|
1541
|
-
`,
|
|
1541
|
+
`,Ka=s.span`
|
|
1542
1542
|
font-size: 14px;
|
|
1543
1543
|
font-weight: 500;
|
|
1544
1544
|
line-height: 1.4;
|
|
1545
|
-
color: ${e=>
|
|
1545
|
+
color: ${e=>he(e.$variant).label.static};
|
|
1546
1546
|
|
|
1547
1547
|
label[data-disabled='true'] & {
|
|
1548
|
-
color: ${e=>
|
|
1548
|
+
color: ${e=>he(e.$variant).label.disabled};
|
|
1549
1549
|
}
|
|
1550
|
-
`,
|
|
1550
|
+
`,Za=s.span`
|
|
1551
1551
|
font-size: 12px;
|
|
1552
1552
|
font-weight: 400;
|
|
1553
1553
|
line-height: 1.4;
|
|
1554
|
-
color: ${e=>
|
|
1554
|
+
color: ${e=>he(e.$variant).description.static};
|
|
1555
1555
|
|
|
1556
1556
|
label[data-disabled='true'] & {
|
|
1557
|
-
color: ${e=>
|
|
1557
|
+
color: ${e=>he(e.$variant).description.disabled};
|
|
1558
1558
|
}
|
|
1559
|
-
`,
|
|
1559
|
+
`,qe=A.newClassNameGetter("radio-card"),Ja=({checked:e,className:r,classnames:o,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...g})=>a.jsxs(Xa,{className:qe("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(Ua,{...g,ref:p,type:"radio",checked:e,disabled:n,onChange:d}),a.jsx(Pt,{className:o==null?void 0:o.radio,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(qa,{className:qe("content",o==null?void 0:o.content),children:[a.jsx(Ka,{className:qe("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(Za,{className:qe("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),cr={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},Qa=s.div`
|
|
1560
1560
|
display: flex;
|
|
1561
1561
|
flex-direction: column;
|
|
1562
1562
|
gap: 8px;
|
|
1563
|
-
`,
|
|
1563
|
+
`,el=s.span`
|
|
1564
1564
|
font-size: 13px;
|
|
1565
1565
|
font-weight: 500;
|
|
1566
1566
|
line-height: 1.5;
|
|
1567
|
-
color: ${e=>e.$disabled?
|
|
1567
|
+
color: ${e=>e.$disabled?cr.label.disabledColor:cr.label.color};
|
|
1568
1568
|
margin-bottom: 4px;
|
|
1569
|
-
`,
|
|
1569
|
+
`,tl=s.div`
|
|
1570
1570
|
display: flex;
|
|
1571
1571
|
flex-direction: column;
|
|
1572
1572
|
gap: 12px;
|
|
1573
|
-
`,
|
|
1573
|
+
`,ft=A.newClassNameGetter("radio-group"),rl=({className:e,classnames:r,disabled:o,label:i,name:n,onChange:l,options:c,ref:d,value:p,...h})=>a.jsxs(Qa,{...h,ref:d,className:ft("container",e),children:[i&&a.jsx(el,{className:ft("label",r==null?void 0:r.label),$disabled:o,children:i}),a.jsx(tl,{className:ft("options",r==null?void 0:r.options),children:c.map(g=>a.jsx(Pt,{className:r==null?void 0:r.radio,name:n,checked:p===g.value,label:g.label,disabled:o,onChange:()=>l(g.value)},g.value))})]}),jr=u.createContext(null),ol=s.div`
|
|
1574
1574
|
position: fixed;
|
|
1575
1575
|
bottom: 24px;
|
|
1576
1576
|
right: 24px;
|
|
@@ -1585,19 +1585,19 @@
|
|
|
1585
1585
|
animation: ${t.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1586
1586
|
pointer-events: none;
|
|
1587
1587
|
color: ${t.COLORS.black};
|
|
1588
|
-
`,
|
|
1588
|
+
`,il=s.span`
|
|
1589
1589
|
font-size: 14px;
|
|
1590
1590
|
font-weight: 500;
|
|
1591
1591
|
white-space: nowrap;
|
|
1592
|
-
`,
|
|
1592
|
+
`,nl=({children:e,defaultMessage:r="Saving"})=>{const[o,i]=u.useState(!1),[n,l]=u.useState(r),c=u.useCallback(h=>{l(h??r),i(!0)},[r]),d=u.useCallback(()=>{i(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:d}),[o,c,d]);return a.jsxs(jr.Provider,{value:p,children:[e,o&&a.jsxs(ol,{children:[a.jsx(Lt,{size:"sm"}),a.jsx(il,{children:n})]})]})},al=()=>{const e=u.useContext(jr);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},xt=40,Te=4,sr={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},pr={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=>sr[e]??sr.default,se=e=>pr[e]??pr.normal,ll=s.div`
|
|
1593
1593
|
position: relative;
|
|
1594
1594
|
display: grid;
|
|
1595
1595
|
gap: 2px;
|
|
1596
1596
|
min-width: 180px;
|
|
1597
1597
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1598
|
-
`,
|
|
1598
|
+
`,dl=s(de)`
|
|
1599
1599
|
margin-left: 6px;
|
|
1600
|
-
`,
|
|
1600
|
+
`,cl=s.button`
|
|
1601
1601
|
display: flex;
|
|
1602
1602
|
align-items: center;
|
|
1603
1603
|
justify-content: space-between;
|
|
@@ -1608,47 +1608,47 @@
|
|
|
1608
1608
|
font-weight: 500;
|
|
1609
1609
|
text-align: left;
|
|
1610
1610
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1611
|
-
height: ${e=>
|
|
1612
|
-
padding: ${e=>
|
|
1613
|
-
border-radius: ${e=>
|
|
1611
|
+
height: ${e=>Ot(e.$size).height};
|
|
1612
|
+
padding: ${e=>Ot(e.$size).padding};
|
|
1613
|
+
border-radius: ${e=>Ot(e.$size).radius};
|
|
1614
1614
|
|
|
1615
|
-
color: ${e=>e.$hasValue?e.$disabled?
|
|
1615
|
+
color: ${e=>e.$hasValue?e.$disabled?se(e.$variant).color.disabled:se(e.$variant).color.static:se(e.$variant).placeholder};
|
|
1616
1616
|
border: 1px solid
|
|
1617
|
-
${e=>e.$disabled?
|
|
1618
|
-
background-color: ${e=>e.$disabled?
|
|
1617
|
+
${e=>e.$disabled?se(e.$variant).border.disabled:se(e.$variant).border.static};
|
|
1618
|
+
background-color: ${e=>e.$disabled?se(e.$variant).background.disabled:se(e.$variant).background.static};
|
|
1619
1619
|
|
|
1620
1620
|
&:focus-visible {
|
|
1621
|
-
outline: 2px solid ${e=>
|
|
1621
|
+
outline: 2px solid ${e=>se(e.$variant).focus};
|
|
1622
1622
|
}
|
|
1623
|
-
`,
|
|
1623
|
+
`,sl=s.span`
|
|
1624
1624
|
flex: 1;
|
|
1625
1625
|
min-width: 0;
|
|
1626
1626
|
overflow: hidden;
|
|
1627
1627
|
text-overflow: ellipsis;
|
|
1628
1628
|
white-space: nowrap;
|
|
1629
|
-
`,
|
|
1629
|
+
`,pl=s.span`
|
|
1630
1630
|
display: flex;
|
|
1631
1631
|
align-items: center;
|
|
1632
1632
|
justify-content: center;
|
|
1633
1633
|
flex-shrink: 0;
|
|
1634
1634
|
transition: transform 0.2s ease;
|
|
1635
1635
|
transform: rotate(${e=>e.$open?"180deg":"0deg"});
|
|
1636
|
-
`,
|
|
1636
|
+
`,Er=`
|
|
1637
1637
|
padding: 4px;
|
|
1638
1638
|
background: ${t.COLORS.white};
|
|
1639
1639
|
border: 1px solid ${t.alpha(t.COLORS.black,10)};
|
|
1640
1640
|
border-radius: 16px;
|
|
1641
1641
|
box-shadow: 0 4px 20px ${t.alpha(t.COLORS.black,15)};
|
|
1642
1642
|
z-index: 1000;
|
|
1643
|
-
`,
|
|
1643
|
+
`,ul=s.div`
|
|
1644
1644
|
position: absolute;
|
|
1645
1645
|
left: -4px;
|
|
1646
1646
|
width: calc(100% + 8px);
|
|
1647
|
-
${
|
|
1648
|
-
`,
|
|
1647
|
+
${Er}
|
|
1648
|
+
`,hl=s.div`
|
|
1649
1649
|
position: fixed;
|
|
1650
|
-
${
|
|
1651
|
-
`,
|
|
1650
|
+
${Er}
|
|
1651
|
+
`,bl=s.button`
|
|
1652
1652
|
display: flex;
|
|
1653
1653
|
align-items: center;
|
|
1654
1654
|
justify-content: space-between;
|
|
@@ -1674,13 +1674,13 @@
|
|
|
1674
1674
|
outline: none;
|
|
1675
1675
|
background: ${t.alpha(t.COLORS.black,8)};
|
|
1676
1676
|
}
|
|
1677
|
-
`,
|
|
1677
|
+
`,gl=s.span`
|
|
1678
1678
|
display: flex;
|
|
1679
1679
|
align-items: center;
|
|
1680
1680
|
justify-content: center;
|
|
1681
1681
|
flex-shrink: 0;
|
|
1682
1682
|
color: ${t.COLORS.black};
|
|
1683
|
-
`,
|
|
1683
|
+
`,Ce=A.newClassNameGetter("select"),fl=({className:e,classnames:r,disabled:o=!1,fullWidth:i=!1,label:n,onChange:l,options:c,placeholder:d="Select...",portalRenderNode:p,ref:h,size:g="default",value:f,variant:O="normal",...m})=>{const[y,S]=u.useState(!1),[v,x]=u.useState({top:0,left:0,width:0}),$=u.useRef(null),b=u.useRef(null),L=u.useRef(null),j=c.find(C=>C.value===f),N=Math.max(0,c.findIndex(C=>C.value===f)),H=-(N*xt+Te),z=()=>{if(!b.current||!p)return;const C=b.current.getBoundingClientRect(),I=N*xt+Te;let k=C.top-I;const T=c.length*xt+Te*2,F=8,B=window.innerHeight-T-8;k<F&&(k=F),k>B&&(k=B),x({top:k,left:C.left-Te,width:C.width+Te*2})},_=C=>{var I;l==null||l(C),S(!1),(I=b.current)==null||I.focus()},E=C=>{o||(C.key==="Enter"||C.key===" "?(C.preventDefault(),S(I=>!I)):C.key==="Escape"&&y?(C.preventDefault(),S(!1)):C.key==="ArrowDown"&&!y&&(C.preventDefault(),S(!0)))};u.useLayoutEffect(()=>{y&&p&&z()},[y,p,N,c.length]),u.useEffect(()=>{if(!y)return;const C=T=>{const F=T.target,B=$.current&&!$.current.contains(F),V=L.current&&!L.current.contains(F);p?B&&V&&S(!1):B&&S(!1)},I=()=>{p&&z()},k=()=>{p&&z()};return document.addEventListener("mousedown",C),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",k)),()=>{document.removeEventListener("mousedown",C),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",k)}},[y,p]);const w=()=>c.map(C=>a.jsxs(bl,{type:"button",role:"option",$selected:C.value===f,$disabled:C.disabled??!1,disabled:C.disabled,"aria-selected":C.value===f,onClick:()=>_(C.value),className:Ce("option",r==null?void 0:r.option),children:[a.jsx("span",{children:C.label}),C.value===f&&a.jsx(gl,{children:a.jsx(a.Check,{size:16})})]},C.value)),M=p?Oe.createPortal(a.jsx(hl,{ref:L,role:"listbox",style:{top:v.top,left:v.left,width:v.width},className:Ce("dropdown",r==null?void 0:r.dropdown),children:w()}),p):a.jsx(ul,{ref:L,role:"listbox",style:{top:H},className:Ce("dropdown",r==null?void 0:r.dropdown),children:w()});return a.jsxs(ll,{...m,ref:C=>{$.current=C,typeof h=="function"?h(C):h&&(h.current=C)},$fullWidth:i,className:Ce("container",e),children:[n&&a.jsx(dl,{className:Ce("label",r==null?void 0:r.label),children:n}),a.jsxs(cl,{ref:b,type:"button",$size:g,$variant:O,$disabled:o,$hasValue:!!j,disabled:o,onClick:()=>!o&&S(C=>!C),onKeyDown:E,"aria-haspopup":"listbox","aria-expanded":y,className:Ce("trigger",r==null?void 0:r.trigger),children:[a.jsx(sl,{children:(j==null?void 0:j.label)??d}),a.jsx(pl,{$open:y,children:a.jsx(a.ChevronDown,{size:16})})]}),y&&M]})},ur={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},xl=e=>ur[e]??ur.neutral,Ol=s.div`
|
|
1684
1684
|
display: flex;
|
|
1685
1685
|
flex-direction: column;
|
|
1686
1686
|
gap: 4px;
|
|
@@ -1689,16 +1689,16 @@
|
|
|
1689
1689
|
border-radius: 16px;
|
|
1690
1690
|
border: ${({$border:e})=>e?"1px solid #e5e7eb":"none"};
|
|
1691
1691
|
box-shadow: ${({$shadow:e})=>e?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"none"};
|
|
1692
|
-
|
|
1692
|
+
`,$l=s.div`
|
|
1693
1693
|
display: flex;
|
|
1694
1694
|
align-items: center;
|
|
1695
1695
|
justify-content: space-between;
|
|
1696
1696
|
gap: 8px;
|
|
1697
|
-
`,
|
|
1697
|
+
`,Sl=s.p`
|
|
1698
1698
|
margin: 0;
|
|
1699
1699
|
font-size: 13px;
|
|
1700
1700
|
color: ${t.COLORS["iron-grey"]};
|
|
1701
|
-
`,
|
|
1701
|
+
`,yl=s.div`
|
|
1702
1702
|
display: flex;
|
|
1703
1703
|
align-items: center;
|
|
1704
1704
|
justify-content: center;
|
|
@@ -1712,21 +1712,21 @@
|
|
|
1712
1712
|
width: 18px;
|
|
1713
1713
|
height: 18px;
|
|
1714
1714
|
}
|
|
1715
|
-
|
|
1715
|
+
`,vl=s.h3`
|
|
1716
1716
|
margin: 0;
|
|
1717
1717
|
font-size: 28px;
|
|
1718
1718
|
font-weight: 600;
|
|
1719
1719
|
line-height: 1.2;
|
|
1720
1720
|
color: ${t.COLORS.black};
|
|
1721
|
-
`,
|
|
1721
|
+
`,Cl=s.p`
|
|
1722
1722
|
margin: 0;
|
|
1723
1723
|
font-size: 12px;
|
|
1724
|
-
color: ${({$variant:e})=>
|
|
1725
|
-
`,
|
|
1724
|
+
color: ${({$variant:e})=>xl(e)};
|
|
1725
|
+
`,Ke=A.newClassNameGetter("status-card"),ml=({border:e=!1,className:r,classnames:o,icon:i,label:n,ref:l,shadow:c=!1,trend:d,trendVariant:p="neutral",value:h,...g})=>a.jsxs(Ol,{...g,ref:l,className:Ke("container",r),$border:e,$shadow:c,children:[a.jsxs($l,{children:[a.jsx(Sl,{className:Ke("label",o==null?void 0:o.label),children:n}),i&&a.jsx(yl,{children:i})]}),a.jsx(vl,{className:Ke("value",o==null?void 0:o.value),children:h}),d&&a.jsx(Cl,{className:Ke("trend",o==null?void 0:o.trend),$variant:p,children:d})]}),wl=s.div`
|
|
1726
1726
|
display: flex;
|
|
1727
1727
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1728
1728
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1729
|
-
`,
|
|
1729
|
+
`,Rl=s.div`
|
|
1730
1730
|
display: flex;
|
|
1731
1731
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1732
1732
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1735,7 +1735,7 @@
|
|
|
1735
1735
|
&:last-child {
|
|
1736
1736
|
flex: 0;
|
|
1737
1737
|
}
|
|
1738
|
-
`,
|
|
1738
|
+
`,kl=s.button`
|
|
1739
1739
|
display: flex;
|
|
1740
1740
|
align-items: center;
|
|
1741
1741
|
gap: 10px;
|
|
@@ -1753,7 +1753,7 @@
|
|
|
1753
1753
|
outline-offset: 2px;
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
-
`,
|
|
1756
|
+
`,Ll=s.div`
|
|
1757
1757
|
display: flex;
|
|
1758
1758
|
align-items: center;
|
|
1759
1759
|
justify-content: center;
|
|
@@ -1777,13 +1777,13 @@
|
|
|
1777
1777
|
border: 2px solid ${t.COLORS.gray};
|
|
1778
1778
|
color: ${t.COLORS["iron-grey"]};
|
|
1779
1779
|
`}
|
|
1780
|
-
`,
|
|
1780
|
+
`,Pl=s.span`
|
|
1781
1781
|
font-size: 14px;
|
|
1782
1782
|
font-weight: 500;
|
|
1783
1783
|
white-space: nowrap;
|
|
1784
1784
|
color: ${e=>e.$active||e.$completed?t.COLORS.black:t.COLORS["iron-grey"]};
|
|
1785
1785
|
transition: color 0.2s ease;
|
|
1786
|
-
`,
|
|
1786
|
+
`,zl=s.div`
|
|
1787
1787
|
background-color: ${e=>e.$completed?t.COLORS.black:t.COLORS.gray};
|
|
1788
1788
|
transition: background-color 0.2s ease;
|
|
1789
1789
|
|
|
@@ -1797,22 +1797,22 @@
|
|
|
1797
1797
|
min-width: 16px;
|
|
1798
1798
|
margin: 0 12px;
|
|
1799
1799
|
`}
|
|
1800
|
-
`,
|
|
1800
|
+
`,Ne=A.newClassNameGetter("stepper"),jl=({className:e,classnames:r,onChange:o,orientation:i="horizontal",ref:n,steps:l,value:c,...d})=>{const p=u.useMemo(()=>l.findIndex(h=>h.value===c),[l,c]);return a.jsx(wl,{...d,ref:n,$orientation:i,className:Ne("container",e),children:l.map((h,g)=>{const f=h.value===c,O=g<p,m=g===l.length-1;return a.jsxs(Rl,{$orientation:i,children:[a.jsxs(kl,{type:"button",$active:f,$completed:O,$clickable:!!o,onClick:()=>o==null?void 0:o(h.value),className:Ne("step",r==null?void 0:r.step),children:[a.jsx(Ll,{$active:f,$completed:O,className:Ne("circle",r==null?void 0:r.circle),children:g+1}),a.jsx(Pl,{$active:f,$completed:O,className:Ne("label",r==null?void 0:r.label),children:h.label})]}),!m&&a.jsx(zl,{$completed:O,$orientation:i,className:Ne("line",r==null?void 0:r.line)})]},h.value)})})},kt={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},El=s.div`
|
|
1801
1801
|
position: relative;
|
|
1802
1802
|
display: flex;
|
|
1803
1803
|
flex-direction: column;
|
|
1804
1804
|
gap: 4px;
|
|
1805
|
-
`,
|
|
1805
|
+
`,Tl=s(de)`
|
|
1806
1806
|
margin-left: 6px;
|
|
1807
|
-
color: ${e=>
|
|
1808
|
-
`,
|
|
1807
|
+
color: ${e=>kt[e.$variant].label};
|
|
1808
|
+
`,Nl=s.div`
|
|
1809
1809
|
display: flex;
|
|
1810
1810
|
flex-wrap: wrap;
|
|
1811
1811
|
align-items: center;
|
|
1812
1812
|
gap: 6px;
|
|
1813
1813
|
min-height: 44px;
|
|
1814
1814
|
padding: 8px 12px;
|
|
1815
|
-
border: 1px dashed ${e=>
|
|
1815
|
+
border: 1px dashed ${e=>kt[e.$variant].border};
|
|
1816
1816
|
border-radius: 8px;
|
|
1817
1817
|
background: ${t.COLORS.white};
|
|
1818
1818
|
cursor: ${e=>e.$disabled?"not-allowed":"text"};
|
|
@@ -1820,14 +1820,14 @@
|
|
|
1820
1820
|
transition: border-color 0.15s ease;
|
|
1821
1821
|
|
|
1822
1822
|
&:hover {
|
|
1823
|
-
border-color: ${e=>e.$disabled?
|
|
1823
|
+
border-color: ${e=>e.$disabled?kt[e.$variant].border:e.$variant==="error"?t.COLORS.red:t.COLORS.black};
|
|
1824
1824
|
}
|
|
1825
1825
|
|
|
1826
1826
|
${e=>e.$focused&&`
|
|
1827
1827
|
outline: 2px solid ${e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1828
1828
|
outline-offset: 2px;
|
|
1829
1829
|
`}
|
|
1830
|
-
`,
|
|
1830
|
+
`,Il=s.input`
|
|
1831
1831
|
flex: 1;
|
|
1832
1832
|
min-width: 80px;
|
|
1833
1833
|
border: none;
|
|
@@ -1844,7 +1844,7 @@
|
|
|
1844
1844
|
&:disabled {
|
|
1845
1845
|
cursor: not-allowed;
|
|
1846
1846
|
}
|
|
1847
|
-
`,
|
|
1847
|
+
`,Tr=`
|
|
1848
1848
|
z-index: 100;
|
|
1849
1849
|
background-color: ${t.COLORS.white};
|
|
1850
1850
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
@@ -1852,28 +1852,28 @@
|
|
|
1852
1852
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
1853
1853
|
max-height: 200px;
|
|
1854
1854
|
overflow-y: auto;
|
|
1855
|
-
`,
|
|
1855
|
+
`,Nr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Ir=`
|
|
1856
1856
|
opacity 0.15s ease,
|
|
1857
1857
|
transform 0.15s ease,
|
|
1858
1858
|
visibility 0.15s;
|
|
1859
|
-
`,
|
|
1859
|
+
`,Al=s.div`
|
|
1860
1860
|
position: absolute;
|
|
1861
1861
|
left: 0;
|
|
1862
1862
|
right: 0;
|
|
1863
1863
|
${e=>e.$position==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
1864
|
-
${
|
|
1864
|
+
${Tr}
|
|
1865
1865
|
opacity: ${e=>e.$open?1:0};
|
|
1866
1866
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1867
|
-
transform: ${e=>
|
|
1868
|
-
transition: ${
|
|
1869
|
-
`,
|
|
1867
|
+
transform: ${e=>Nr(e.$open,e.$position)};
|
|
1868
|
+
transition: ${Ir};
|
|
1869
|
+
`,Dl=s.div`
|
|
1870
1870
|
position: fixed;
|
|
1871
|
-
${
|
|
1871
|
+
${Tr}
|
|
1872
1872
|
opacity: ${e=>e.$open?1:0};
|
|
1873
1873
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1874
|
-
transform: ${e=>
|
|
1875
|
-
transition: ${
|
|
1876
|
-
`,
|
|
1874
|
+
transform: ${e=>Nr(e.$open,e.$position)};
|
|
1875
|
+
transition: ${Ir};
|
|
1876
|
+
`,hr=s.button`
|
|
1877
1877
|
display: flex;
|
|
1878
1878
|
align-items: center;
|
|
1879
1879
|
width: 100%;
|
|
@@ -1901,7 +1901,7 @@
|
|
|
1901
1901
|
&:only-child {
|
|
1902
1902
|
border-radius: 7px;
|
|
1903
1903
|
}
|
|
1904
|
-
`,
|
|
1904
|
+
`,br=s.div`
|
|
1905
1905
|
display: flex;
|
|
1906
1906
|
align-items: center;
|
|
1907
1907
|
justify-content: center;
|
|
@@ -1909,11 +1909,11 @@
|
|
|
1909
1909
|
color: ${t.COLORS["iron-grey"]};
|
|
1910
1910
|
font-size: 14px;
|
|
1911
1911
|
text-align: center;
|
|
1912
|
-
`,ee=A.newClassNameGetter("tags"),
|
|
1912
|
+
`,ee=A.newClassNameGetter("tags"),Ze=4,_l=({className:e,classnames:r,createKey:o="Tab",disabled:i=!1,emptyMessage:n="No options",freeSolo:l=!0,label:c,onChange:d,options:p=[],placeholder:h="Add tag...",portalRenderNode:g,ref:f,value:O,variant:m="normal",...y})=>{const S=u.useRef(null),v=u.useRef(null),x=u.useRef(null),$=u.useRef(null),[b,L]=u.useState(""),[j,N]=u.useState(!1),[H,z]=u.useState("bottom"),[_,E]=u.useState({top:0,left:0,width:0}),w=u.useMemo(()=>{const P=p.filter(U=>!O.includes(U.value));if(!b.trim())return P;const D=b.toLowerCase().trim();return P.filter(U=>U.label.toLowerCase().includes(D))},[p,O,b]),M=j&&p.length>0,C=u.useCallback(()=>{var Me;if(!v.current)return;const P=v.current.getBoundingClientRect(),D=((Me=x.current)==null?void 0:Me.offsetHeight)??200,U=window.innerHeight-P.bottom-Ze,q=P.top-Ze,$e=U<D&&q>U?"top":"bottom";if(z($e),g){const ot=$e==="bottom"?P.bottom+Ze:P.top-D-Ze;E({top:ot,left:P.left,width:P.width})}},[g]);u.useEffect(()=>{if(j)return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[j,C]);const I=u.useCallback(P=>{const D=P.trim();return!D||O.includes(D)?!1:(d([...O,D]),L(""),!0)},[O,d]),k=P=>{if(P.key===o&&b.trim())if(P.preventDefault(),l)I(b);else{const D=w.find(U=>U.label.toLowerCase()===b.toLowerCase().trim());D&&I(D.value)}else P.key==="Backspace"&&!b&&O.length>0&&d(O.slice(0,-1))},T=P=>{var D;I(P),(D=$.current)==null||D.focus()},F=P=>{d(O.filter(D=>D!==P))},B=()=>{var P;i||(P=$.current)==null||P.focus()},V=P=>{const D=p.find(U=>U.value===P);return(D==null?void 0:D.label)??P};return a.jsxs(El,{...y,ref:f,className:ee("container",e),children:[c&&a.jsx(Tl,{$variant:m,className:ee("label"),children:c}),a.jsxs("div",{ref:S,style:{position:"relative"},children:[a.jsxs(Nl,{ref:v,$variant:m,$disabled:i,$focused:j,onClick:B,className:ee("trigger",r==null?void 0:r.trigger),children:[O.map(P=>a.jsx(Qe,{deletable:!i,onDelete:()=>F(P),className:ee("chip",r==null?void 0:r.chip),children:V(P)},P)),a.jsx(Il,{ref:$,type:"text",value:b,onChange:P=>L(P.target.value),onFocus:()=>N(!0),onBlur:()=>setTimeout(()=>N(!1),150),onKeyDown:k,placeholder:O.length===0?h:"",disabled:i,$disabled:i,className:ee("input",r==null?void 0:r.input)})]}),p.length>0&&(g?Oe.createPortal(a.jsx(Dl,{ref:x,$open:M,$position:H,style:{top:_.top,left:_.left,width:_.width},className:ee("dropdown",r==null?void 0:r.dropdown),children:w.length===0?a.jsx(br,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(hr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>T(P.value),className:ee("option",r==null?void 0:r.option),children:P.label},P.value))}),g):a.jsx(Al,{ref:x,$open:M,$position:H,className:ee("dropdown",r==null?void 0:r.dropdown),children:w.length===0?a.jsx(br,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(hr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>T(P.value),className:ee("option",r==null?void 0:r.option),children:P.label},P.value))}))]})]})},Ml=s.div`
|
|
1913
1913
|
display: flex;
|
|
1914
1914
|
align-items: center;
|
|
1915
1915
|
gap: 6px;
|
|
1916
|
-
`,
|
|
1916
|
+
`,Fl=s.button`
|
|
1917
1917
|
padding: 6px 16px;
|
|
1918
1918
|
border: none;
|
|
1919
1919
|
border-radius: 12px;
|
|
@@ -1936,7 +1936,48 @@
|
|
|
1936
1936
|
outline: 2px solid ${t.COLORS["steel-blue"]};
|
|
1937
1937
|
outline-offset: 2px;
|
|
1938
1938
|
}
|
|
1939
|
-
`,
|
|
1939
|
+
`,gr=A.newClassNameGetter("tabs"),Bl=({className:e,classnames:r,onChange:o,ref:i,tabs:n,value:l,...c})=>a.jsx(Ml,{...c,ref:i,className:gr("container",e),role:"tablist",children:n.map(d=>a.jsx(Fl,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>o(d.value),className:gr("tab",r==null?void 0:r.tab),children:d.label},d.value))}),fr={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)}},ne=e=>fr[e]??fr.normal,Yl=s.div`
|
|
1940
|
+
display: grid;
|
|
1941
|
+
flex-direction: column;
|
|
1942
|
+
gap: 2px;
|
|
1943
|
+
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1944
|
+
`,Hl=s(de)`
|
|
1945
|
+
margin-left: 6px;
|
|
1946
|
+
`,Vl=s.textarea`
|
|
1947
|
+
flex: 1;
|
|
1948
|
+
min-width: 0;
|
|
1949
|
+
outline: none;
|
|
1950
|
+
font-size: 14px;
|
|
1951
|
+
font-weight: 500;
|
|
1952
|
+
font-family: inherit;
|
|
1953
|
+
padding: 10px 14px;
|
|
1954
|
+
border-radius: 16px;
|
|
1955
|
+
resize: vertical;
|
|
1956
|
+
|
|
1957
|
+
color: ${e=>ne(e.$variant).color.static};
|
|
1958
|
+
border: 1px solid ${e=>ne(e.$variant).border.static};
|
|
1959
|
+
background-color: ${e=>ne(e.$variant).background.static};
|
|
1960
|
+
|
|
1961
|
+
&::placeholder {
|
|
1962
|
+
color: ${e=>ne(e.$variant).placeholder.static};
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
&:disabled {
|
|
1966
|
+
cursor: not-allowed;
|
|
1967
|
+
resize: none;
|
|
1968
|
+
color: ${e=>ne(e.$variant).color.disabled};
|
|
1969
|
+
background-color: ${e=>ne(e.$variant).background.disabled};
|
|
1970
|
+
border-color: ${e=>ne(e.$variant).border.disabled};
|
|
1971
|
+
|
|
1972
|
+
&::placeholder {
|
|
1973
|
+
color: ${e=>ne(e.$variant).placeholder.disabled};
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
&:focus-visible {
|
|
1978
|
+
outline: 2px solid ${e=>ne(e.$variant).focus};
|
|
1979
|
+
}
|
|
1980
|
+
`,$t=A.newClassNameGetter("textarea"),Gl=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,variant:c="normal",rows:d=4,...p})=>a.jsxs(Yl,{className:$t("container",e),$fullWidth:!!i,children:[n&&a.jsx(Hl,{variant:c,className:$t("label",r==null?void 0:r.label),children:n}),a.jsx(Vl,{...p,ref:l,rows:d,disabled:o,$variant:c,className:$t("textarea",r==null?void 0:r.textarea)})]}),Ar=u.createContext(null),St=3,xr={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}},Wl=(e,r)=>{switch(r.type){case"ADD_TOAST":{const o=r.payload;return e.toasts.length<St?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=r.payload,i=e.toasts.filter(l=>l.id!==o),n=e.queue[0];return n&&i.length<St?{toasts:[...i,n],queue:e.queue.slice(1)}:{...e,toasts:i}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=St?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},Xl={toasts:[],queue:[]},yt=e=>xr[e]??xr.default,Ul=ae.keyframes`
|
|
1940
1981
|
from {
|
|
1941
1982
|
transform: translateY(100%);
|
|
1942
1983
|
opacity: 0;
|
|
@@ -1945,7 +1986,7 @@
|
|
|
1945
1986
|
transform: translateY(0);
|
|
1946
1987
|
opacity: 1;
|
|
1947
1988
|
}
|
|
1948
|
-
`,
|
|
1989
|
+
`,ql=ae.keyframes`
|
|
1949
1990
|
from {
|
|
1950
1991
|
transform: translateY(0);
|
|
1951
1992
|
opacity: 1;
|
|
@@ -1954,7 +1995,7 @@
|
|
|
1954
1995
|
transform: translateY(100%);
|
|
1955
1996
|
opacity: 0;
|
|
1956
1997
|
}
|
|
1957
|
-
`,
|
|
1998
|
+
`,Kl=s.div`
|
|
1958
1999
|
position: fixed;
|
|
1959
2000
|
bottom: 24px;
|
|
1960
2001
|
left: 24px;
|
|
@@ -1965,29 +2006,29 @@
|
|
|
1965
2006
|
pointer-events: none;
|
|
1966
2007
|
width: auto;
|
|
1967
2008
|
max-width: 90vw;
|
|
1968
|
-
`,
|
|
2009
|
+
`,Zl=s.div`
|
|
1969
2010
|
display: flex;
|
|
1970
2011
|
align-items: center;
|
|
1971
2012
|
justify-content: space-between;
|
|
1972
2013
|
gap: 12px;
|
|
1973
2014
|
min-height: 32px;
|
|
1974
2015
|
padding: 8px 8px 8px 16px;
|
|
1975
|
-
background-color: ${({$variant:e})
|
|
1976
|
-
color: ${({$variant:e})
|
|
1977
|
-
border: 1px solid ${({$variant:e})
|
|
2016
|
+
background-color: ${({$variant:e})=>yt(e).background};
|
|
2017
|
+
color: ${({$variant:e})=>yt(e).text};
|
|
2018
|
+
border: 1px solid ${({$variant:e})=>yt(e).border};
|
|
1978
2019
|
border-radius: 96px;
|
|
1979
2020
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
1980
|
-
animation: ${({$isExiting:e})=>e?
|
|
2021
|
+
animation: ${({$isExiting:e})=>e?ql:Ul} 0.3s ease-out;
|
|
1981
2022
|
pointer-events: auto;
|
|
1982
2023
|
max-width: 500px;
|
|
1983
|
-
`,
|
|
2024
|
+
`,Jl=s.span`
|
|
1984
2025
|
font-size: 14px;
|
|
1985
2026
|
font-weight: 500;
|
|
1986
2027
|
line-height: 1.4;
|
|
1987
2028
|
white-space: nowrap;
|
|
1988
2029
|
overflow: hidden;
|
|
1989
2030
|
text-overflow: ellipsis;
|
|
1990
|
-
`,
|
|
2031
|
+
`,Ql=s.button`
|
|
1991
2032
|
display: flex;
|
|
1992
2033
|
align-items: center;
|
|
1993
2034
|
justify-content: center;
|
|
@@ -2005,13 +2046,13 @@
|
|
|
2005
2046
|
&:hover {
|
|
2006
2047
|
opacity: 1;
|
|
2007
2048
|
}
|
|
2008
|
-
`,
|
|
2049
|
+
`,ed=s.div`
|
|
2009
2050
|
display: flex;
|
|
2010
2051
|
align-items: center;
|
|
2011
2052
|
justify-content: space-between;
|
|
2012
2053
|
gap: 12px;
|
|
2013
2054
|
width: 100%;
|
|
2014
|
-
`,
|
|
2055
|
+
`,td=s.div`
|
|
2015
2056
|
display: flex;
|
|
2016
2057
|
align-items: center;
|
|
2017
2058
|
justify-content: center;
|
|
@@ -2026,7 +2067,7 @@
|
|
|
2026
2067
|
font-weight: 500;
|
|
2027
2068
|
white-space: nowrap;
|
|
2028
2069
|
margin-left: auto;
|
|
2029
|
-
`,
|
|
2070
|
+
`,Or=({toast:e,onRemove:r})=>{const[o,i]=u.useState(!1),n=()=>{i(!0),setTimeout(()=>{r(e.id)},300)};return u.useEffect(()=>{if(e.duration){const l=setTimeout(()=>{n()},e.duration);return()=>clearTimeout(l)}},[e.duration,e.id]),a.jsxs(Zl,{$variant:e.variant,$isExiting:o,children:[a.jsx(Jl,{children:e.message}),a.jsx(Ql,{onClick:n,children:a.jsx(a.X,{style:{width:16,height:16}})})]})},rd=({toasts:e,queueCount:r,removeToast:o})=>{if(e.length===0)return null;const i=e.length-1;return a.jsx(Kl,{children:e.map((n,l)=>l===i&&r>0?a.jsxs(ed,{children:[a.jsx(Or,{toast:n,onRemove:o}),a.jsxs(td,{children:["+",r]})]},n.id):a.jsx(Or,{toast:n,onRemove:o},n.id))})},od=({children:e})=>{const[r,o]=u.useReducer(Wl,Xl),i=u.useCallback((l,c="default",d)=>{const p=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_TOAST",payload:{id:p,message:l,variant:c,duration:d}})},[]),n=u.useCallback(l=>{o({type:"REMOVE_TOAST",payload:l})},[]);return a.jsxs(Ar.Provider,{value:{addToast:i,removeToast:n},children:[e,a.jsx(rd,{toasts:r.toasts,queueCount:r.queue.length,removeToast:n})]})},id=()=>{const e=u.useContext(Ar);if(!e)throw new Error("useToast must be used within ToastProvider");return e},$r={dark:{background:t.COLORS.black,text:t.COLORS.white},light:{background:t.COLORS.white,text:t.COLORS.black,border:t.COLORS.gray},success:{background:t.COLORS.green,text:t.COLORS.white},warning:{background:t.COLORS.yellow,text:t.COLORS.white},danger:{background:t.COLORS.red,text:t.COLORS.white}},De=e=>$r[e]??$r.dark,nd=(e,r)=>{const o=De(r).background;switch(e){case"top":return`
|
|
2030
2071
|
bottom: -12px;
|
|
2031
2072
|
left: 50%;
|
|
2032
2073
|
margin-left: -6px;
|
|
@@ -2046,7 +2087,7 @@
|
|
|
2046
2087
|
top: 50%;
|
|
2047
2088
|
margin-top: -6px;
|
|
2048
2089
|
border-right-color: ${o};
|
|
2049
|
-
`;default:return""}},
|
|
2090
|
+
`;default:return""}},ad=(e,r)=>{if(r!=="light")return"";const o=De(r).border;switch(e){case"top":return`
|
|
2050
2091
|
&::after {
|
|
2051
2092
|
bottom: -14px;
|
|
2052
2093
|
left: 50%;
|
|
@@ -2074,11 +2115,11 @@
|
|
|
2074
2115
|
margin-top: -7px;
|
|
2075
2116
|
border-right-color: ${o};
|
|
2076
2117
|
}
|
|
2077
|
-
`;default:return""}},
|
|
2118
|
+
`;default:return""}},Dr=e=>`
|
|
2078
2119
|
z-index: 1000;
|
|
2079
2120
|
padding: 6px 12px;
|
|
2080
|
-
background-color: ${
|
|
2081
|
-
color: ${
|
|
2121
|
+
background-color: ${De(e.$variant).background};
|
|
2122
|
+
color: ${De(e.$variant).text};
|
|
2082
2123
|
font-size: 13px;
|
|
2083
2124
|
line-height: 1.4;
|
|
2084
2125
|
border-radius: 6px;
|
|
@@ -2092,7 +2133,7 @@
|
|
|
2092
2133
|
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
|
|
2093
2134
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
2094
2135
|
|
|
2095
|
-
${e.$variant==="light"?`border: 1px solid ${
|
|
2136
|
+
${e.$variant==="light"?`border: 1px solid ${De(e.$variant).border};`:""}
|
|
2096
2137
|
|
|
2097
2138
|
&::before {
|
|
2098
2139
|
content: '';
|
|
@@ -2100,7 +2141,7 @@
|
|
|
2100
2141
|
width: 0;
|
|
2101
2142
|
height: 0;
|
|
2102
2143
|
border: 6px solid transparent;
|
|
2103
|
-
${
|
|
2144
|
+
${nd(e.$placement,e.$variant)}
|
|
2104
2145
|
}
|
|
2105
2146
|
|
|
2106
2147
|
${e.$variant==="light"?`
|
|
@@ -2113,11 +2154,11 @@
|
|
|
2113
2154
|
}
|
|
2114
2155
|
`:""}
|
|
2115
2156
|
|
|
2116
|
-
${
|
|
2117
|
-
`,
|
|
2157
|
+
${ad(e.$placement,e.$variant)}
|
|
2158
|
+
`,ld=s.div`
|
|
2118
2159
|
position: relative;
|
|
2119
2160
|
display: inline-block;
|
|
2120
|
-
`,
|
|
2161
|
+
`,dd=e=>{switch(e){case"top":return`
|
|
2121
2162
|
bottom: calc(100% + 8px);
|
|
2122
2163
|
left: 50%;
|
|
2123
2164
|
transform: translateX(-50%);
|
|
@@ -2133,12 +2174,12 @@
|
|
|
2133
2174
|
left: calc(100% + 8px);
|
|
2134
2175
|
top: 50%;
|
|
2135
2176
|
transform: translateY(-50%);
|
|
2136
|
-
`;default:return""}},
|
|
2177
|
+
`;default:return""}},cd=s.div`
|
|
2137
2178
|
position: absolute;
|
|
2138
|
-
${e=>
|
|
2139
|
-
${({$placement:e})=>
|
|
2140
|
-
`,
|
|
2179
|
+
${e=>Dr(e)}
|
|
2180
|
+
${({$placement:e})=>dd(e)}
|
|
2181
|
+
`,sd=s.div`
|
|
2141
2182
|
position: fixed;
|
|
2142
|
-
${e=>
|
|
2143
|
-
`,
|
|
2183
|
+
${e=>Dr(e)}
|
|
2184
|
+
`,vt=A.newClassNameGetter("tooltip"),pe=8,pd=({children:e,className:r,classnames:o,content:i,delay:n=200,placement:l="top",portalRenderNode:c,ref:d,variant:p="dark",...h})=>{const[g,f]=u.useState(!1),[O,m]=u.useState(null),[y,S]=u.useState(l),[v,x]=u.useState({top:0,left:0}),$=u.useRef(null),b=u.useRef(null),L=u.useCallback(()=>{var T,F;if(!$.current)return;const z=$.current.getBoundingClientRect(),_=((T=b.current)==null?void 0:T.offsetWidth)??100,E=((F=b.current)==null?void 0:F.offsetHeight)??30,w=z.top-pe,M=window.innerHeight-z.bottom-pe,C=z.left-pe,I=window.innerWidth-z.right-pe;let k=l;if(l==="top"&&w<E&&M>w?k="bottom":l==="bottom"&&M<E&&w>M?k="top":l==="left"&&C<_&&I>C?k="right":l==="right"&&I<_&&C>I&&(k="left"),S(k),c){let B,V;switch(k){case"top":B=z.top-E-pe,V=z.left+z.width/2-_/2;break;case"bottom":B=z.bottom+pe,V=z.left+z.width/2-_/2;break;case"left":B=z.top+z.height/2-E/2,V=z.left-_-pe;break;case"right":B=z.top+z.height/2-E/2,V=z.right+pe;break;default:B=0,V=0}const P=8;V=Math.max(P,Math.min(V,window.innerWidth-_-P)),B=Math.max(P,Math.min(B,window.innerHeight-E-P)),x({top:B,left:V})}},[l,c]);u.useLayoutEffect(()=>{g&&L()},[g,L]);const j=()=>{const z=setTimeout(()=>{f(!0)},n);m(z)},N=()=>{O&&(clearTimeout(O),m(null)),f(!1)},H=c?Oe.createPortal(a.jsx(sd,{ref:b,className:vt("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,style:{top:v.top,left:v.left},children:i}),c):a.jsx(cd,{ref:b,className:vt("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,children:i});return a.jsxs(ld,{...h,ref:z=>{$.current=z,typeof d=="function"?d(z):d&&(d.current=z)},className:vt("wrapper",r),onMouseEnter:j,onMouseLeave:N,children:[e,H]})};exports.Autocomplete=Lo;exports.Button=_e;exports.Card=Mo;exports.Checkbox=tt;exports.CheckboxCard=Ko;exports.CheckboxGroup=ei;exports.Chip=Qe;exports.Confirmation=pi;exports.Container=bi;exports.DatePicker=Bi;exports.Drawer=Wi;exports.Dropdown=Ji;exports.FieldLabel=de;exports.FieldMessage=rn;exports.GlobalStyle=io;exports.ImageCropper=sa;exports.Input=Lr;exports.KeySymbol=Sr;exports.KeysBindings=yr;exports.Modal=Pr;exports.MultiSelect=ka;exports.OtpCode=Ea;exports.Panel=_a;exports.Progress=Ba;exports.Radio=Pt;exports.RadioCard=Ja;exports.RadioGroup=rl;exports.SaveProgressProvider=nl;exports.Select=fl;exports.Spinner=Lt;exports.StatusCard=ml;exports.Stepper=jl;exports.Tabs=Bl;exports.Tags=_l;exports.Textarea=Gl;exports.ToastProvider=od;exports.Tooltip=pd;exports.formatDateGo=vr;exports.useImageCropper=kr;exports.useSaveProgress=al;exports.useToast=id;
|
|
2144
2185
|
//# sourceMappingURL=index.cjs.map
|