@vacano/ui 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +485 -371
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +35 -0
- package/dist/index.js +1698 -1424
- 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"),ne=require("@emotion/react"),u=require("react"),t=require("./media-OVL6YjWb.cjs"),A=require("./tooling-Dflq0Y98.cjs"),xe=require("react-dom");function Qr(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const Re=Qr(u);function yt(){return yt=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},yt.apply(null,arguments)}const eo=ne.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -141,18 +141,151 @@
|
|
|
141
141
|
:focus:not(:focus-visible) {
|
|
142
142
|
outline: none;
|
|
143
143
|
}
|
|
144
|
-
`,
|
|
144
|
+
`,to=()=>a.jsx(ne.Global,{styles:eo});var ro=/^((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)-.*))$/,oo=a.memoize(function(e){return ro.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),io=oo,no=function(r){return r!=="theme"},Et=function(r){return typeof r=="string"&&r.charCodeAt(0)>96?io:no},Tt=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},ao=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},lo=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=Tt(r,o,i),p=d||Et(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 C=g.length,y=1;y<C;y++)f.push(g[y],O[y])}var S=ne.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=Re.useContext(ne.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?Et(b):p,E={};for(var w in v)h&&w==="as"||_(w)&&(E[w]=v[w]);return E.className=L,$&&(E.ref=$),Re.createElement(Re.Fragment,null,Re.createElement(ao,{cache:x,serialized:z,isStringTag:typeof b=="string"}),Re.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,yt({},o,x,{shouldForwardProp:Tt(S,x,!0)}));return $.apply(void 0,f)},S}},co=["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=lo.bind(null);co.forEach(function(e){s[e]=s(e)});const so=s.span`
|
|
145
|
+
font-size: 12px;
|
|
146
|
+
font-weight: 500;
|
|
147
|
+
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
148
|
+
`,po=A.newClassNameGetter("field-label"),ue=({children:e,className:r,ref:o,required:i,variant:n="normal",...l})=>e?a.jsxs(so,{...l,ref:o,className:po("container",r),$variant:n,children:[e," ",i&&"*"]}):null,ot={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)}},uo=s.div`
|
|
149
|
+
position: relative;
|
|
150
|
+
display: grid;
|
|
151
|
+
gap: 2px;
|
|
152
|
+
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
153
|
+
`,ho=s(ue)`
|
|
154
|
+
margin-left: 6px;
|
|
155
|
+
`,bo=s.div`
|
|
156
|
+
position: relative;
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
`,go=s.input`
|
|
160
|
+
flex: 1;
|
|
161
|
+
min-width: 0;
|
|
162
|
+
width: 100%;
|
|
163
|
+
outline: none;
|
|
164
|
+
font-size: 14px;
|
|
165
|
+
font-weight: 500;
|
|
166
|
+
height: ${e=>ot[e.$size].height};
|
|
167
|
+
padding: ${e=>ot[e.$size].padding};
|
|
168
|
+
padding-right: 40px;
|
|
169
|
+
border-radius: ${e=>ot[e.$size].radius};
|
|
170
|
+
|
|
171
|
+
color: ${e=>oe[e.$variant].color.static};
|
|
172
|
+
border: 1px solid ${e=>oe[e.$variant].border.static};
|
|
173
|
+
background-color: ${e=>oe[e.$variant].background.static};
|
|
174
|
+
|
|
175
|
+
&::placeholder {
|
|
176
|
+
color: ${e=>oe[e.$variant].placeholder.static};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:disabled {
|
|
180
|
+
cursor: not-allowed;
|
|
181
|
+
color: ${e=>oe[e.$variant].color.disabled};
|
|
182
|
+
background-color: ${e=>oe[e.$variant].background.disabled};
|
|
183
|
+
border-color: ${e=>oe[e.$variant].border.disabled};
|
|
184
|
+
|
|
185
|
+
&::placeholder {
|
|
186
|
+
color: ${e=>oe[e.$variant].placeholder.disabled};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&:focus-visible {
|
|
191
|
+
outline: 2px solid ${e=>oe[e.$variant].focus};
|
|
192
|
+
}
|
|
193
|
+
`,fo=s.div`
|
|
194
|
+
position: absolute;
|
|
195
|
+
right: 12px;
|
|
196
|
+
top: 50%;
|
|
197
|
+
transform: translateY(-50%);
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
`,xo=s.div`
|
|
202
|
+
position: absolute;
|
|
203
|
+
top: 100%;
|
|
204
|
+
left: 0;
|
|
205
|
+
right: 0;
|
|
206
|
+
z-index: 100;
|
|
207
|
+
margin-top: 4px;
|
|
208
|
+
max-height: 240px;
|
|
209
|
+
overflow-y: auto;
|
|
210
|
+
background-color: ${t.COLORS.white};
|
|
211
|
+
border: 1px solid ${t.COLORS.gray};
|
|
212
|
+
border-radius: 12px;
|
|
213
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
214
|
+
opacity: ${({$open:e})=>e?1:0};
|
|
215
|
+
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
216
|
+
transform: ${({$open:e})=>e?"translateY(0)":"translateY(-8px)"};
|
|
217
|
+
transition:
|
|
218
|
+
opacity 0.15s ease,
|
|
219
|
+
transform 0.15s ease,
|
|
220
|
+
visibility 0.15s;
|
|
221
|
+
`,Oo=s.div`
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
gap: 10px;
|
|
225
|
+
padding: 10px 14px;
|
|
226
|
+
cursor: pointer;
|
|
227
|
+
font-size: 14px;
|
|
228
|
+
font-weight: 500;
|
|
229
|
+
color: ${t.COLORS.black};
|
|
230
|
+
transition: background-color 0.1s ease;
|
|
231
|
+
|
|
232
|
+
&:first-of-type {
|
|
233
|
+
border-radius: 12px 12px 0 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&:last-of-type {
|
|
237
|
+
border-radius: 0 0 12px 12px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&:only-child {
|
|
241
|
+
border-radius: 12px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&:hover {
|
|
245
|
+
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
246
|
+
}
|
|
247
|
+
`,$o=s.img`
|
|
248
|
+
width: 24px;
|
|
249
|
+
height: 24px;
|
|
250
|
+
border-radius: 6px;
|
|
251
|
+
object-fit: cover;
|
|
252
|
+
`,So=s.span`
|
|
253
|
+
flex: 1;
|
|
254
|
+
overflow: hidden;
|
|
255
|
+
text-overflow: ellipsis;
|
|
256
|
+
white-space: nowrap;
|
|
257
|
+
`,yo=s.div`
|
|
258
|
+
padding: 12px 14px;
|
|
259
|
+
font-size: 14px;
|
|
260
|
+
color: ${t.alpha(t.COLORS.black,50)};
|
|
261
|
+
text-align: center;
|
|
262
|
+
`,Nt={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},It={track:t.alpha(t.COLORS.black,15),indicator:t.COLORS.black},it=e=>Nt[e]??Nt.md,vo=ne.keyframes`
|
|
263
|
+
0% {
|
|
264
|
+
transform: rotate(0deg);
|
|
265
|
+
}
|
|
266
|
+
100% {
|
|
267
|
+
transform: rotate(360deg);
|
|
268
|
+
}
|
|
269
|
+
`,mo=s.div`
|
|
270
|
+
display: inline-block;
|
|
271
|
+
width: ${e=>it(e.$size).size};
|
|
272
|
+
height: ${e=>it(e.$size).size};
|
|
273
|
+
border: ${e=>it(e.$size).borderWidth} solid ${It.track};
|
|
274
|
+
border-top-color: ${It.indicator};
|
|
275
|
+
border-radius: 50%;
|
|
276
|
+
animation: ${vo} 0.8s linear infinite;
|
|
277
|
+
`,Co=A.newClassNameGetter("spinner"),Rt=({"aria-label":e="Loading",className:r,ref:o,size:i="md",...n})=>a.jsx(mo,{...n,ref:o,className:Co("container",r),role:"status","aria-label":e,$size:i}),ke=A.newClassNameGetter("autocomplete"),wo=({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:C="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]),m=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(uo,{ref:_,className:ke("container",e),$fullWidth:!!i,children:[n&&a.jsx(ho,{variant:d,className:ke("label",r==null?void 0:r.label),children:n}),a.jsxs(bo,{children:[a.jsx(go,{...y,ref:l,type:"text",value:S,onChange:M,onBlur:I,onFocus:k,disabled:o,$size:c,$variant:d,className:ke("input",r==null?void 0:r.input)}),b&&a.jsx(fo,{children:a.jsx(Rt,{size:"xs"})})]}),a.jsx(xo,{$open:j&&H,className:ke("dropdown",r==null?void 0:r.dropdown),children:x.length>0?x.map(T=>a.jsxs(Oo,{onClick:()=>m(T),className:ke("item",r==null?void 0:r.item),children:[T.image_url&&a.jsx($o,{src:T.image_url,alt:T.value}),a.jsx(So,{children:T.value})]},T.id)):!b&&a.jsx(yo,{children:C})})]})},At={compact:{height:"32px",padding:"0 8px",radius:"12px",iconSize:"16px"},default:{height:"40px",padding:"0 12px",radius:"16px",iconSize:"20px"}},Dt={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=Dt[e];return r||Dt.normal},re=e=>{const r=At[e];return r||At.default},Ro=e=>e?"auto":"fit-content",ko=s.button`
|
|
145
278
|
display: flex;
|
|
146
279
|
gap: 6px;
|
|
147
280
|
text-decoration: none;
|
|
148
281
|
align-items: center;
|
|
149
282
|
justify-content: center;
|
|
150
|
-
width: ${e=>e.$iconOnly?
|
|
283
|
+
width: ${e=>e.$iconOnly?re(e.$size).height:Ro(!!e.$fullWidth)};
|
|
151
284
|
color: ${e=>J(e.$variant).color.static};
|
|
152
285
|
background-color: ${e=>J(e.$variant).background.static};
|
|
153
|
-
height: ${e=>
|
|
154
|
-
padding: ${e=>e.$iconOnly?"0":
|
|
155
|
-
border-radius: ${e=>
|
|
286
|
+
height: ${e=>re(e.$size).height};
|
|
287
|
+
padding: ${e=>e.$iconOnly?"0":re(e.$size).padding};
|
|
288
|
+
border-radius: ${e=>re(e.$size).radius};
|
|
156
289
|
border: 1px solid ${e=>J(e.$variant).borderColor.static};
|
|
157
290
|
|
|
158
291
|
&:hover:not(:disabled) {
|
|
@@ -177,29 +310,29 @@
|
|
|
177
310
|
background-color: ${e=>J(e.$variant).background.disabled};
|
|
178
311
|
border-color: ${e=>J(e.$variant).borderColor.disabled};
|
|
179
312
|
}
|
|
180
|
-
`,
|
|
313
|
+
`,Lo=s.div`
|
|
181
314
|
display: grid;
|
|
182
315
|
place-items: center;
|
|
183
|
-
width: ${e=>
|
|
184
|
-
height: ${e=>
|
|
316
|
+
width: ${e=>re(e.$size).iconSize};
|
|
317
|
+
height: ${e=>re(e.$size).iconSize};
|
|
185
318
|
|
|
186
319
|
& svg {
|
|
187
|
-
width: ${e=>
|
|
188
|
-
height: ${e=>
|
|
320
|
+
width: ${e=>re(e.$size).iconSize};
|
|
321
|
+
height: ${e=>re(e.$size).iconSize};
|
|
189
322
|
}
|
|
190
|
-
`,
|
|
323
|
+
`,Po=s.span`
|
|
191
324
|
font-weight: 600;
|
|
192
325
|
overflow: hidden;
|
|
193
326
|
white-space: nowrap;
|
|
194
327
|
text-overflow: ellipsis;
|
|
195
|
-
`,
|
|
196
|
-
width: ${e=>
|
|
197
|
-
height: ${e=>
|
|
328
|
+
`,zo=s(a.LoaderCircle)`
|
|
329
|
+
width: ${e=>re(e.$size).iconSize};
|
|
330
|
+
height: ${e=>re(e.$size).iconSize};
|
|
198
331
|
animation: ${t.KEYFRAMES.rotate} 0.8s linear infinite;
|
|
199
|
-
`,
|
|
332
|
+
`,jo=s.div`
|
|
200
333
|
display: flex;
|
|
201
334
|
gap: 3px;
|
|
202
|
-
`,
|
|
335
|
+
`,Eo=s.span`
|
|
203
336
|
text-align: center;
|
|
204
337
|
display: flex;
|
|
205
338
|
justify-content: center;
|
|
@@ -212,12 +345,12 @@
|
|
|
212
345
|
border-radius: 4px;
|
|
213
346
|
width: fit-content;
|
|
214
347
|
background-color: ${e=>e.$variant==="light"?t.alpha(t.COLORS.white,25):t.alpha(t.COLORS.black,25)};
|
|
215
|
-
`,
|
|
348
|
+
`,To=A.newClassNameGetter("key-symbol"),xr=({className:e,ref:r,symbol:o,variant:i="light",...n})=>o?a.jsx(Eo,{...n,ref:r,className:To("container",e),$variant:i,children:o}):null,_t=A.newClassNameGetter("key-bindings"),Or=({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(jo,{...l,ref:i,className:_t("container",e),children:c.map(d=>a.jsx(xr,{symbol:d,className:_t("item",r==null?void 0:r.item),variant:n},d))})},Mt=A.newClassNameGetter("button"),De=({children:e,className:r,classnames:o,disabled:i,fullWidth:n,icon:l,loading:c,onClick:d,ref:p=null,keyBindings:h=[],size:g="default",type:f="button",variant:O="normal",...C})=>{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(ko,{...C,onClick:d,ref:y,type:S,disabled:i,className:Mt("container",r),$variant:O,$size:g,$fullWidth:!!n,$iconOnly:!!l&&!(e||(h==null?void 0:h.length)>0),children:[c&&a.jsx(zo,{$size:g}),l&&!c&&a.jsx(Lo,{$size:g,children:l}),e&&a.jsx(Po,{className:Mt("label",o==null?void 0:o.label),children:e}),a.jsx(Or,{keys:h,variant:O==="system"?"light":"dark"})]})},No=s.div`
|
|
216
349
|
background-color: ${t.COLORS.white};
|
|
217
350
|
border-radius: 16px;
|
|
218
351
|
border: ${e=>e.$border?`1px solid ${t.alpha(t.COLORS["iron-grey"],15)}`:"none"};
|
|
219
352
|
box-shadow: ${e=>e.$shadow?`0 2px 8px ${t.alpha(t.COLORS.black,10)}`:"none"};
|
|
220
|
-
`,
|
|
353
|
+
`,Io=A.newClassNameGetter("card"),Ao=({children:e,className:r,ref:o,border:i=!1,shadow:n=!1,...l})=>a.jsx(No,{...l,ref:o,className:Io("container",r),$border:i,$shadow:n,children:e}),Ft={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}},be=e=>Ft[e]??Ft.normal,Do=s.label`
|
|
221
354
|
display: inline-flex;
|
|
222
355
|
align-items: flex-start;
|
|
223
356
|
gap: 8px;
|
|
@@ -225,15 +358,15 @@
|
|
|
225
358
|
opacity: ${e=>e.$disabled?.5:1};
|
|
226
359
|
|
|
227
360
|
&:has(input:focus-visible) > span:first-of-type {
|
|
228
|
-
box-shadow: 0 0 0 2px ${e=>
|
|
361
|
+
box-shadow: 0 0 0 2px ${e=>be(e.$variant).box.focusShadow};
|
|
229
362
|
}
|
|
230
|
-
|
|
363
|
+
`,_o=s.input`
|
|
231
364
|
position: absolute;
|
|
232
365
|
opacity: 0;
|
|
233
366
|
width: 0;
|
|
234
367
|
height: 0;
|
|
235
368
|
pointer-events: none;
|
|
236
|
-
`,
|
|
369
|
+
`,Mo=s.span`
|
|
237
370
|
display: inline-flex;
|
|
238
371
|
align-items: center;
|
|
239
372
|
justify-content: center;
|
|
@@ -242,17 +375,17 @@
|
|
|
242
375
|
height: 18px;
|
|
243
376
|
border-radius: 6px;
|
|
244
377
|
border: 1.5px solid
|
|
245
|
-
${e=>e.$checked||e.$indeterminate?
|
|
246
|
-
background-color: ${e=>e.$checked||e.$indeterminate?
|
|
378
|
+
${e=>e.$checked||e.$indeterminate?be(e.$variant).box.borderChecked:be(e.$variant).box.border};
|
|
379
|
+
background-color: ${e=>e.$checked||e.$indeterminate?be(e.$variant).box.backgroundChecked:be(e.$variant).box.background};
|
|
247
380
|
transition:
|
|
248
381
|
border-color 0.15s ease,
|
|
249
382
|
background-color 0.15s ease,
|
|
250
383
|
box-shadow 0.15s ease;
|
|
251
|
-
`,
|
|
384
|
+
`,Fo=s.span`
|
|
252
385
|
display: inline-flex;
|
|
253
386
|
align-items: center;
|
|
254
387
|
justify-content: center;
|
|
255
|
-
color: ${e=>
|
|
388
|
+
color: ${e=>be(e.$variant).icon};
|
|
256
389
|
opacity: ${e=>e.$visible?1:0};
|
|
257
390
|
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
258
391
|
transition:
|
|
@@ -263,11 +396,11 @@
|
|
|
263
396
|
width: 12px;
|
|
264
397
|
height: 12px;
|
|
265
398
|
}
|
|
266
|
-
`,
|
|
399
|
+
`,Bo=s.span`
|
|
267
400
|
font-size: 14px;
|
|
268
401
|
font-weight: 500;
|
|
269
402
|
line-height: 1.4;
|
|
270
|
-
color: ${e=>
|
|
403
|
+
color: ${e=>be(e.$variant).label};
|
|
271
404
|
user-select: none;
|
|
272
405
|
|
|
273
406
|
a {
|
|
@@ -279,15 +412,15 @@
|
|
|
279
412
|
text-decoration: none;
|
|
280
413
|
}
|
|
281
414
|
}
|
|
282
|
-
`,
|
|
415
|
+
`,Le=A.newClassNameGetter("checkbox"),et=({checked:e,className:r,classnames:o,disabled:i,indeterminate:n=!1,label:l,onChange:c,ref:d,variant:p="normal",...h})=>a.jsxs(Do,{className:Le("container",r),$disabled:!!i,$variant:p,children:[a.jsx(_o,{...h,ref:d,type:"checkbox",className:Le("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:c}),a.jsx(Mo,{className:Le("box",o==null?void 0:o.box),$checked:e,$indeterminate:n,$variant:p,children:a.jsx(Fo,{className:Le("icon",o==null?void 0:o.icon),$visible:n||e,$variant:p,children:n?a.jsx(a.Minus,{}):a.jsx(a.Check,{})})}),l&&a.jsx(Bo,{className:Le("label",o==null?void 0:o.label),$variant:p,children:l})]}),Bt={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)}}},se=e=>Bt[e]??Bt.normal,Yo=s.label`
|
|
283
416
|
display: grid;
|
|
284
417
|
grid-template-columns: auto 1fr;
|
|
285
418
|
align-items: start;
|
|
286
419
|
gap: 8px;
|
|
287
420
|
padding: 12px;
|
|
288
|
-
background-color: ${e=>{const
|
|
421
|
+
background-color: ${e=>{const r=se(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
289
422
|
border: 1px solid
|
|
290
|
-
${e=>{const
|
|
423
|
+
${e=>{const r=se(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
291
424
|
border-radius: 12px;
|
|
292
425
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
293
426
|
transition:
|
|
@@ -297,18 +430,18 @@
|
|
|
297
430
|
min-width: 0;
|
|
298
431
|
|
|
299
432
|
&:hover:not([data-disabled='true']) {
|
|
300
|
-
border-color: ${e=>{const
|
|
433
|
+
border-color: ${e=>{const r=se(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
301
434
|
}
|
|
302
435
|
|
|
303
436
|
&:has(:focus-visible) {
|
|
304
437
|
outline: none;
|
|
305
|
-
box-shadow: 0 0 0 3px ${e=>
|
|
438
|
+
box-shadow: 0 0 0 3px ${e=>se(e.$variant).focusRing};
|
|
306
439
|
}
|
|
307
440
|
|
|
308
441
|
.vacano_checkbox_container {
|
|
309
442
|
pointer-events: none;
|
|
310
443
|
}
|
|
311
|
-
`,
|
|
444
|
+
`,Ho=s.input`
|
|
312
445
|
position: absolute;
|
|
313
446
|
width: 1px;
|
|
314
447
|
height: 1px;
|
|
@@ -318,44 +451,44 @@
|
|
|
318
451
|
clip: rect(0, 0, 0, 0);
|
|
319
452
|
white-space: nowrap;
|
|
320
453
|
border: 0;
|
|
321
|
-
`,
|
|
454
|
+
`,Go=s.div`
|
|
322
455
|
display: flex;
|
|
323
456
|
flex-direction: column;
|
|
324
457
|
gap: 2px;
|
|
325
458
|
min-width: 0;
|
|
326
|
-
`,
|
|
459
|
+
`,Vo=s.span`
|
|
327
460
|
font-size: 14px;
|
|
328
461
|
font-weight: 500;
|
|
329
462
|
line-height: 1.4;
|
|
330
|
-
color: ${e=>
|
|
463
|
+
color: ${e=>se(e.$variant).label.static};
|
|
331
464
|
|
|
332
465
|
label[data-disabled='true'] & {
|
|
333
|
-
color: ${e=>
|
|
466
|
+
color: ${e=>se(e.$variant).label.disabled};
|
|
334
467
|
}
|
|
335
|
-
`,
|
|
468
|
+
`,Wo=s.span`
|
|
336
469
|
font-size: 12px;
|
|
337
470
|
font-weight: 400;
|
|
338
471
|
line-height: 1.4;
|
|
339
|
-
color: ${e=>
|
|
472
|
+
color: ${e=>se(e.$variant).description.static};
|
|
340
473
|
|
|
341
474
|
label[data-disabled='true'] & {
|
|
342
|
-
color: ${e=>
|
|
475
|
+
color: ${e=>se(e.$variant).description.disabled};
|
|
343
476
|
}
|
|
344
|
-
`,
|
|
477
|
+
`,Ye=A.newClassNameGetter("checkbox-card"),Uo=({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(Yo,{className:Ye("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(Ho,{...g,ref:p,type:"checkbox",checked:e,disabled:n,onChange:d}),a.jsx(et,{className:o==null?void 0:o.checkbox,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(Go,{className:Ye("content",o==null?void 0:o.content),children:[a.jsx(Vo,{className:Ye("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(Wo,{className:Ye("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),Yt={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},Xo=s.div`
|
|
345
478
|
display: flex;
|
|
346
479
|
flex-direction: column;
|
|
347
480
|
gap: 8px;
|
|
348
|
-
`,
|
|
481
|
+
`,qo=s.span`
|
|
349
482
|
font-size: 13px;
|
|
350
483
|
font-weight: 500;
|
|
351
484
|
line-height: 1.5;
|
|
352
|
-
color: ${e=>e.$disabled?
|
|
485
|
+
color: ${e=>e.$disabled?Yt.label.disabledColor:Yt.label.color};
|
|
353
486
|
margin-bottom: 4px;
|
|
354
|
-
`,
|
|
487
|
+
`,Ko=s.div`
|
|
355
488
|
display: flex;
|
|
356
489
|
flex-direction: column;
|
|
357
490
|
gap: 12px;
|
|
358
|
-
`,
|
|
491
|
+
`,nt=A.newClassNameGetter("checkbox-group"),Zo=({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(Xo,{...p,ref:c,className:nt("container",e),children:[i&&a.jsx(qo,{className:nt("label",r==null?void 0:r.label),$disabled:o,children:i}),a.jsx(Ko,{className:nt("options",r==null?void 0:r.options),children:l.map(g=>a.jsx(et,{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))})]})},Ht={gray:{background:t.alpha(t.COLORS["iron-grey"],10),color:t.COLORS["iron-grey"],deleteHover:t.alpha(t.COLORS["iron-grey"],20)},red:{background:t.alpha(t.COLORS.red,10),color:t.COLORS.red,deleteHover:t.alpha(t.COLORS.red,20)},blue:{background:t.alpha(t.COLORS["steel-blue"],10),color:t.COLORS["steel-blue"],deleteHover:t.alpha(t.COLORS["steel-blue"],20)},black:{background:t.COLORS.black,color:t.COLORS.white,deleteHover:t.alpha(t.COLORS.white,20)}},vt=e=>Ht[e]??Ht.gray,Jo=s.span`
|
|
359
492
|
display: inline-flex;
|
|
360
493
|
align-items: center;
|
|
361
494
|
gap: 4px;
|
|
@@ -365,9 +498,9 @@
|
|
|
365
498
|
font-size: 12px;
|
|
366
499
|
font-weight: 500;
|
|
367
500
|
line-height: 1.5;
|
|
368
|
-
background-color: ${e
|
|
369
|
-
color: ${e
|
|
370
|
-
`,
|
|
501
|
+
background-color: ${e=>vt(e.$variant).background};
|
|
502
|
+
color: ${e=>vt(e.$variant).color};
|
|
503
|
+
`,Qo=s.button`
|
|
371
504
|
display: inline-flex;
|
|
372
505
|
align-items: center;
|
|
373
506
|
justify-content: center;
|
|
@@ -382,17 +515,17 @@
|
|
|
382
515
|
transition: background-color 0.15s ease;
|
|
383
516
|
|
|
384
517
|
&:hover {
|
|
385
|
-
background-color: ${e
|
|
518
|
+
background-color: ${e=>vt(e.$variant).deleteHover};
|
|
386
519
|
}
|
|
387
520
|
|
|
388
521
|
& svg {
|
|
389
522
|
width: 14px;
|
|
390
523
|
height: 14px;
|
|
391
524
|
}
|
|
392
|
-
`,
|
|
525
|
+
`,ei=s.span`
|
|
393
526
|
flex: 1 0 auto;
|
|
394
527
|
text-align: center;
|
|
395
|
-
`,
|
|
528
|
+
`,at=A.newClassNameGetter("chip"),Je=({children:e,className:r,classnames:o,deletable:i,onDelete:n,ref:l,variant:c="gray",...d})=>a.jsxs(Jo,{...d,ref:l,className:at("container",r),$variant:c,$deletable:!!i,children:[a.jsx(ei,{className:at("label",o==null?void 0:o.label),children:e}),i&&a.jsx(Qo,{type:"button",className:at("delete",o==null?void 0:o.delete),$variant:c,onClick:n,children:a.jsx(a.X,{})})]}),ti="Confirm",ri="Cancel",oi=ne.keyframes`
|
|
396
529
|
from {
|
|
397
530
|
opacity: 0;
|
|
398
531
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -401,7 +534,7 @@
|
|
|
401
534
|
opacity: 1;
|
|
402
535
|
transform: translateX(-50%) translateY(0);
|
|
403
536
|
}
|
|
404
|
-
`,
|
|
537
|
+
`,ii=ne.keyframes`
|
|
405
538
|
from {
|
|
406
539
|
opacity: 1;
|
|
407
540
|
transform: translateX(-50%) translateY(0);
|
|
@@ -410,7 +543,7 @@
|
|
|
410
543
|
opacity: 0;
|
|
411
544
|
transform: translateX(-50%) translateY(100%);
|
|
412
545
|
}
|
|
413
|
-
`,
|
|
546
|
+
`,ni=s.div`
|
|
414
547
|
position: fixed;
|
|
415
548
|
bottom: 24px;
|
|
416
549
|
left: 50%;
|
|
@@ -425,53 +558,49 @@
|
|
|
425
558
|
box-shadow:
|
|
426
559
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
427
560
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
428
|
-
animation: ${({$open:e})=>e?
|
|
561
|
+
animation: ${({$open:e})=>e?oi:ii} 0.2s ease-out forwards;
|
|
429
562
|
z-index: 1000;
|
|
430
|
-
`,
|
|
563
|
+
`,ai=s.p`
|
|
431
564
|
margin: 0;
|
|
432
565
|
font-size: 14px;
|
|
433
566
|
color: ${t.COLORS.black};
|
|
434
567
|
white-space: nowrap;
|
|
435
|
-
`,
|
|
568
|
+
`,li=s.div`
|
|
436
569
|
display: flex;
|
|
437
570
|
align-items: center;
|
|
438
571
|
gap: 8px;
|
|
439
|
-
`,
|
|
572
|
+
`,Pe=A.newClassNameGetter("confirmation"),di=({cancelBindings:e,cancelLabel:r=ri,className:o,classnames:i,confirmLabel:n=ti,loading:l=!1,message:c,onCancel:d,onConfirm:p,open:h=!0,ref:g,submitBindings:f,...O})=>h?a.jsxs(ni,{...O,ref:g,className:Pe("container",o),$open:h,children:[a.jsx(ai,{className:Pe("message",i==null?void 0:i.message),children:c}),a.jsxs(li,{className:Pe("actions",i==null?void 0:i.actions),children:[a.jsx(De,{variant:"system",size:"compact",onClick:d,keyBindings:e,className:Pe("cancel-button",i==null?void 0:i.cancelButton),children:r}),a.jsx(De,{variant:"danger",size:"compact",onClick:p,loading:l,keyBindings:f,className:Pe("confirm-button",i==null?void 0:i.confirmButton),children:n})]})]}):null,ze={sm:`${t.BREAKPOINTS.sm}px`,md:`${t.BREAKPOINTS.md}px`,lg:`${t.BREAKPOINTS.lg}px`,xl:`${t.BREAKPOINTS.xl}px`,"2xl":`${t.BREAKPOINTS["2xl"]}px`},ci=s.div`
|
|
440
573
|
width: 100%;
|
|
441
574
|
|
|
442
575
|
${t.mediaUp("sm")} {
|
|
443
|
-
max-width: ${
|
|
576
|
+
max-width: ${ze.sm};
|
|
444
577
|
}
|
|
445
578
|
|
|
446
579
|
${t.mediaUp("md")} {
|
|
447
|
-
max-width: ${
|
|
580
|
+
max-width: ${ze.md};
|
|
448
581
|
}
|
|
449
582
|
|
|
450
583
|
${t.mediaUp("lg")} {
|
|
451
|
-
max-width: ${
|
|
584
|
+
max-width: ${ze.lg};
|
|
452
585
|
}
|
|
453
586
|
|
|
454
587
|
${t.mediaUp("xl")} {
|
|
455
|
-
max-width: ${
|
|
588
|
+
max-width: ${ze.xl};
|
|
456
589
|
}
|
|
457
590
|
|
|
458
591
|
${t.mediaUp("2xl")} {
|
|
459
|
-
max-width: ${
|
|
592
|
+
max-width: ${ze["2xl"]};
|
|
460
593
|
}
|
|
461
|
-
`,
|
|
462
|
-
font-size: 12px;
|
|
463
|
-
font-weight: 500;
|
|
464
|
-
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
465
|
-
`,ri=I.newClassNameGetter("field-label"),fe=({children:e,className:o,ref:r,required:i,variant:n="normal",...l})=>e?a.jsxs(oi,{...l,ref:r,className:ri("container",o),$variant:n,children:[e," ",i&&"*"]}):null,ii=s.div`
|
|
594
|
+
`,si=A.newClassNameGetter("container"),pi=({children:e,className:r,ref:o,...i})=>a.jsx(ci,{...i,ref:o,className:si("container",r),children:e}),Ze={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},Se={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)}},ae=36,tt=2,ui=12,$r=(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),C=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",C],["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},hi=(e,r)=>new Date(e,r+1,0).getDate(),bi=(e,r)=>new Date(e,r,1).getDay(),gi=(e,r,o=1)=>{const i=hi(e,r);let l=bi(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},fi=(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},xi=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},Gt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate(),Vt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth(),Oi=(e,r)=>e.getFullYear()===r.getFullYear(),Wt=(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},Ut=(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},Xt=(e,r,o)=>!!(r&&e<r.getFullYear()||o&&e>o.getFullYear()),$i=(e,r=12)=>{const o=e-Math.floor(r/2),i=[];for(let n=0;n<r;n++)i.push(o+n);return i},Si=e=>{switch(e){case"date":return"02.01.2006";case"month":return"January 2006";case"year":return"2006"}},yi=s.div`
|
|
466
595
|
position: relative;
|
|
467
596
|
display: inline-flex;
|
|
468
597
|
flex-direction: column;
|
|
469
598
|
gap: 2px;
|
|
470
599
|
min-width: 180px;
|
|
471
600
|
width: ${({$fullWidth:e})=>e?"100%":"fit-content"};
|
|
472
|
-
`,
|
|
601
|
+
`,vi=s(ue)`
|
|
473
602
|
margin-left: 6px;
|
|
474
|
-
`,
|
|
603
|
+
`,mi=s.button`
|
|
475
604
|
display: flex;
|
|
476
605
|
align-items: center;
|
|
477
606
|
justify-content: space-between;
|
|
@@ -482,68 +611,68 @@
|
|
|
482
611
|
font-size: 14px;
|
|
483
612
|
font-weight: 500;
|
|
484
613
|
text-align: left;
|
|
485
|
-
height: ${({$size:e})=>
|
|
486
|
-
padding: ${({$size:e})=>
|
|
487
|
-
border-radius: ${({$size:e})=>
|
|
488
|
-
color: ${({$variant:e,$disabled:
|
|
614
|
+
height: ${({$size:e})=>Ze[e].height};
|
|
615
|
+
padding: ${({$size:e})=>Ze[e].padding};
|
|
616
|
+
border-radius: ${({$size:e})=>Ze[e].radius};
|
|
617
|
+
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?Se[e].color[r?"disabled":"static"]:Se[e].placeholder[r?"disabled":"static"]};
|
|
489
618
|
border: 1px solid
|
|
490
|
-
${({$variant:e,$disabled:
|
|
491
|
-
background-color: ${({$variant:e,$disabled:
|
|
619
|
+
${({$variant:e,$disabled:r})=>Se[e].border[r?"disabled":"static"]};
|
|
620
|
+
background-color: ${({$variant:e,$disabled:r})=>Se[e].background[r?"disabled":"static"]};
|
|
492
621
|
|
|
493
622
|
&:focus-visible {
|
|
494
|
-
outline: 2px solid ${({$variant:e})
|
|
623
|
+
outline: 2px solid ${({$variant:e})=>Se[e].focus};
|
|
495
624
|
}
|
|
496
625
|
|
|
497
|
-
${({$open:e,$variant:
|
|
498
|
-
outline: 2px solid ${
|
|
626
|
+
${({$open:e,$variant:r})=>e&&`
|
|
627
|
+
outline: 2px solid ${Se[r].focus};
|
|
499
628
|
`}
|
|
500
|
-
`,
|
|
629
|
+
`,Ci=s.span`
|
|
501
630
|
flex: 1;
|
|
502
631
|
overflow: hidden;
|
|
503
632
|
text-overflow: ellipsis;
|
|
504
633
|
white-space: nowrap;
|
|
505
|
-
`,
|
|
634
|
+
`,wi=s.span`
|
|
506
635
|
display: flex;
|
|
507
636
|
align-items: center;
|
|
508
637
|
justify-content: center;
|
|
509
638
|
flex-shrink: 0;
|
|
510
639
|
transition: transform 0.15s ease;
|
|
511
640
|
transform: ${({$open:e})=>e?"rotate(180deg)":"rotate(0deg)"};
|
|
512
|
-
`,
|
|
641
|
+
`,Sr=`
|
|
513
642
|
z-index: 100;
|
|
514
643
|
background-color: ${t.COLORS.white};
|
|
515
644
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
516
645
|
border-radius: 12px;
|
|
517
646
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
518
|
-
padding: ${
|
|
519
|
-
`,
|
|
647
|
+
padding: ${ui}px;
|
|
648
|
+
`,yr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Ri=s.div`
|
|
520
649
|
position: absolute;
|
|
521
650
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
522
651
|
left: 0;
|
|
523
|
-
${
|
|
652
|
+
${Sr}
|
|
524
653
|
opacity: ${({$open:e})=>e?1:0};
|
|
525
654
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
526
|
-
transform: ${({$open:e,$position:
|
|
655
|
+
transform: ${({$open:e,$position:r})=>yr(e,r)};
|
|
527
656
|
transition:
|
|
528
657
|
opacity 0.15s ease,
|
|
529
658
|
transform 0.15s ease,
|
|
530
659
|
visibility 0.15s;
|
|
531
|
-
`,
|
|
660
|
+
`,ki=s.div`
|
|
532
661
|
position: fixed;
|
|
533
|
-
${
|
|
662
|
+
${Sr}
|
|
534
663
|
opacity: ${({$open:e})=>e?1:0};
|
|
535
664
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
536
|
-
transform: ${({$open:e,$position:
|
|
665
|
+
transform: ${({$open:e,$position:r})=>yr(e,r)};
|
|
537
666
|
transition:
|
|
538
667
|
opacity 0.15s ease,
|
|
539
668
|
transform 0.15s ease,
|
|
540
669
|
visibility 0.15s;
|
|
541
|
-
`,
|
|
670
|
+
`,lt=s.div`
|
|
542
671
|
display: flex;
|
|
543
672
|
align-items: center;
|
|
544
673
|
justify-content: space-between;
|
|
545
674
|
margin-bottom: 8px;
|
|
546
|
-
`,
|
|
675
|
+
`,dt=s.button`
|
|
547
676
|
display: flex;
|
|
548
677
|
align-items: center;
|
|
549
678
|
gap: 4px;
|
|
@@ -563,7 +692,7 @@
|
|
|
563
692
|
&:focus-visible {
|
|
564
693
|
outline: 2px solid ${t.alpha(t.COLORS.black,20)};
|
|
565
694
|
}
|
|
566
|
-
`,
|
|
695
|
+
`,ye=s.button`
|
|
567
696
|
display: flex;
|
|
568
697
|
align-items: center;
|
|
569
698
|
justify-content: center;
|
|
@@ -591,42 +720,42 @@
|
|
|
591
720
|
background: transparent;
|
|
592
721
|
}
|
|
593
722
|
}
|
|
594
|
-
`,
|
|
723
|
+
`,ct=s.div`
|
|
595
724
|
display: flex;
|
|
596
725
|
gap: 4px;
|
|
597
|
-
`,
|
|
726
|
+
`,Li=s.div`
|
|
598
727
|
display: grid;
|
|
599
|
-
grid-template-columns: repeat(7, ${
|
|
600
|
-
gap: ${
|
|
728
|
+
grid-template-columns: repeat(7, ${ae}px);
|
|
729
|
+
gap: ${tt}px;
|
|
601
730
|
margin-bottom: 4px;
|
|
602
|
-
`,
|
|
731
|
+
`,Pi=s.div`
|
|
603
732
|
display: flex;
|
|
604
733
|
align-items: center;
|
|
605
734
|
justify-content: center;
|
|
606
|
-
height: ${
|
|
735
|
+
height: ${ae}px;
|
|
607
736
|
font-size: 12px;
|
|
608
737
|
font-weight: 500;
|
|
609
738
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
610
739
|
text-transform: uppercase;
|
|
611
|
-
`,
|
|
740
|
+
`,zi=s.div`
|
|
612
741
|
display: grid;
|
|
613
|
-
grid-template-columns: repeat(7, ${
|
|
614
|
-
gap: ${
|
|
615
|
-
`,
|
|
742
|
+
grid-template-columns: repeat(7, ${ae}px);
|
|
743
|
+
gap: ${tt}px;
|
|
744
|
+
`,ji=s.button`
|
|
616
745
|
display: flex;
|
|
617
746
|
align-items: center;
|
|
618
747
|
justify-content: center;
|
|
619
|
-
width: ${
|
|
620
|
-
height: ${
|
|
748
|
+
width: ${ae}px;
|
|
749
|
+
height: ${ae}px;
|
|
621
750
|
border: none;
|
|
622
751
|
border-radius: 8px;
|
|
623
752
|
font-size: 13px;
|
|
624
|
-
font-weight: ${({$selected:e,$today:
|
|
753
|
+
font-weight: ${({$selected:e,$today:r})=>e||r?600:500};
|
|
625
754
|
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
626
755
|
background-color: ${({$selected:e})=>e?t.COLORS.black:"transparent"};
|
|
627
|
-
color: ${({$selected:e,$disabled:
|
|
756
|
+
color: ${({$selected:e,$disabled:r})=>e?t.COLORS.white:r?t.alpha(t.COLORS.black,30):t.COLORS.black};
|
|
628
757
|
|
|
629
|
-
${({$today:e,$selected:
|
|
758
|
+
${({$today:e,$selected:r})=>e&&!r&&`
|
|
630
759
|
box-shadow: inset 0 0 0 1px ${t.COLORS.black};
|
|
631
760
|
`}
|
|
632
761
|
|
|
@@ -642,12 +771,12 @@
|
|
|
642
771
|
&:disabled {
|
|
643
772
|
cursor: not-allowed;
|
|
644
773
|
}
|
|
645
|
-
`,
|
|
774
|
+
`,Ei=s.div`
|
|
646
775
|
display: grid;
|
|
647
776
|
grid-template-columns: repeat(3, 1fr);
|
|
648
777
|
gap: 8px;
|
|
649
|
-
width: ${7*
|
|
650
|
-
`,
|
|
778
|
+
width: ${7*ae+6*tt}px;
|
|
779
|
+
`,Ti=s.button`
|
|
651
780
|
display: flex;
|
|
652
781
|
align-items: center;
|
|
653
782
|
justify-content: center;
|
|
@@ -655,12 +784,12 @@
|
|
|
655
784
|
border: none;
|
|
656
785
|
border-radius: 8px;
|
|
657
786
|
font-size: 14px;
|
|
658
|
-
font-weight: ${({$selected:e,$current:
|
|
787
|
+
font-weight: ${({$selected:e,$current:r})=>e||r?600:400};
|
|
659
788
|
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
660
789
|
background-color: ${({$selected:e})=>e?t.COLORS.black:"transparent"};
|
|
661
|
-
color: ${({$selected:e,$disabled:
|
|
790
|
+
color: ${({$selected:e,$disabled:r})=>e?t.COLORS.white:r?t.alpha(t.COLORS.black,30):t.COLORS.black};
|
|
662
791
|
|
|
663
|
-
${({$current:e,$selected:
|
|
792
|
+
${({$current:e,$selected:r})=>e&&!r&&`
|
|
664
793
|
box-shadow: inset 0 0 0 1px ${t.COLORS.black};
|
|
665
794
|
`}
|
|
666
795
|
|
|
@@ -672,12 +801,12 @@
|
|
|
672
801
|
outline: 2px solid ${t.alpha(t.COLORS.black,30)};
|
|
673
802
|
outline-offset: 1px;
|
|
674
803
|
}
|
|
675
|
-
`,
|
|
804
|
+
`,Ni=s.div`
|
|
676
805
|
display: grid;
|
|
677
806
|
grid-template-columns: repeat(3, 1fr);
|
|
678
807
|
gap: 8px;
|
|
679
|
-
width: ${7*
|
|
680
|
-
`,
|
|
808
|
+
width: ${7*ae+6*tt}px;
|
|
809
|
+
`,Ii=s.button`
|
|
681
810
|
display: flex;
|
|
682
811
|
align-items: center;
|
|
683
812
|
justify-content: center;
|
|
@@ -685,12 +814,12 @@
|
|
|
685
814
|
border: none;
|
|
686
815
|
border-radius: 8px;
|
|
687
816
|
font-size: 14px;
|
|
688
|
-
font-weight: ${({$selected:e,$current:
|
|
817
|
+
font-weight: ${({$selected:e,$current:r})=>e||r?600:400};
|
|
689
818
|
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
690
819
|
background-color: ${({$selected:e})=>e?t.COLORS.black:"transparent"};
|
|
691
|
-
color: ${({$selected:e,$disabled:
|
|
820
|
+
color: ${({$selected:e,$disabled:r})=>e?t.COLORS.white:r?t.alpha(t.COLORS.black,30):t.COLORS.black};
|
|
692
821
|
|
|
693
|
-
${({$current:e,$selected:
|
|
822
|
+
${({$current:e,$selected:r})=>e&&!r&&`
|
|
694
823
|
box-shadow: inset 0 0 0 1px ${t.COLORS.black};
|
|
695
824
|
`}
|
|
696
825
|
|
|
@@ -702,42 +831,42 @@
|
|
|
702
831
|
outline: 2px solid ${t.alpha(t.COLORS.black,30)};
|
|
703
832
|
outline-offset: 1px;
|
|
704
833
|
}
|
|
705
|
-
|
|
706
|
-
width: ${
|
|
707
|
-
height: ${
|
|
708
|
-
`,K=
|
|
834
|
+
`,Ai=s.div`
|
|
835
|
+
width: ${ae}px;
|
|
836
|
+
height: ${ae}px;
|
|
837
|
+
`,K=A.newClassNameGetter("date-picker"),He=4,Di=300,_i=({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:C,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"),[m,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),G=u.useRef(null),P=u.useRef(null),D=u.useRef(null),X=S!==void 0,q=X?S:H,Oe=i??Si(o),_e=u.useMemo(()=>fi(l,c),[l,c]),rt=u.useMemo(()=>xi(l),[l]),Ir=u.useMemo(()=>gi(k.getFullYear(),k.getMonth(),c),[k,c]),Me=u.useMemo(()=>$i(F+6,12),[F]),Lt=u.useMemo(()=>e?$r(e,Oe,l):null,[e,Oe,l]),Ar=n??Oe.replace(/2006|06|January|Jan|01|02/g,"__"),me=u.useCallback(()=>{var we;if(!P.current)return;const R=P.current.getBoundingClientRect(),Y=((we=D.current)==null?void 0:we.offsetHeight)??Di,Ce=window.innerHeight-R.bottom-He,Fe=R.top-He,$e=Ce<Y&&Fe>Ce?"top":"bottom";if(M($e),y){const Be=$e==="bottom"?R.bottom+He:R.top-Y-He;E({top:Be,left:R.left})}},[y]),Pt=u.useCallback(()=>{if(f)return;X||z(!0),v==null||v(),I(o==="year"?"years":o==="month"?"months":"days");const R=e??N;T(R),B(R.getFullYear()-6)},[f,X,v,o,e,N]),Z=u.useCallback(()=>{X||z(!1),x==null||x()},[X,x]),Dr=u.useCallback(()=>{q?Z():Pt()},[q,Z,Pt]),_r=u.useCallback(R=>{const Y=new Date(k.getFullYear(),k.getMonth(),R);r==null||r(Y),Z()},[k,r,Z]),Mr=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]),Fr=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]),Br=u.useCallback(()=>{T(R=>new Date(R.getFullYear(),R.getMonth()-1,1))},[]),Yr=u.useCallback(()=>{T(R=>new Date(R.getFullYear(),R.getMonth()+1,1))},[]),Hr=u.useCallback(()=>{T(R=>new Date(R.getFullYear()-1,R.getMonth(),1))},[]),Gr=u.useCallback(()=>{T(R=>new Date(R.getFullYear()+1,R.getMonth(),1))},[]),Vr=u.useCallback(()=>{B(R=>R-12)},[]),Wr=u.useCallback(()=>{B(R=>R+12)},[]),zt=u.useCallback(()=>{m==="days"?I("months"):m==="months"&&I("years")},[m]);u.useLayoutEffect(()=>{q&&me()},[q,me]),u.useEffect(()=>{const R=$e=>{const we=$e.target,Be=G.current&&!G.current.contains(we),Jr=D.current&&!D.current.contains(we);y?Be&&Jr&&Z():Be&&Z()},Y=$e=>{$e.key==="Escape"&&Z()},Ce=()=>{q&&y&&me()},Fe=()=>{q&&y&&me()};return q&&(document.addEventListener("mousedown",R),document.addEventListener("keydown",Y),y&&(window.addEventListener("scroll",Ce,!0),window.addEventListener("resize",Fe))),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",Y),window.removeEventListener("scroll",Ce,!0),window.removeEventListener("resize",Fe)}},[q,Z,y,me]);const Ur=Ze[h].iconSize,Xr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(dt,{onClick:zt,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(k)}),a.jsxs(ct,{children:[a.jsx(ye,{onClick:Br,type:"button","aria-label":"Previous month",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(ye,{onClick:Yr,type:"button","aria-label":"Next month",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Li,{children:_e.map((R,Y)=>a.jsx(Pi,{children:R},Y))}),a.jsx(zi,{className:K("grid",b==null?void 0:b.grid),children:Ir.map((R,Y)=>R===null?a.jsx(Ai,{},Y):a.jsx(ji,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Gt(e,new Date(k.getFullYear(),k.getMonth(),R)):!1,$today:Gt(N,new Date(k.getFullYear(),k.getMonth(),R)),$disabled:Wt(k.getFullYear(),k.getMonth(),R,d,p),disabled:Wt(k.getFullYear(),k.getMonth(),R,d,p),onClick:()=>_r(R),children:R},Y))})]}),qr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(dt,{onClick:zt,type:"button",children:k.getFullYear()}),a.jsxs(ct,{children:[a.jsx(ye,{onClick:Hr,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(ye,{onClick:Gr,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Ei,{className:K("grid",b==null?void 0:b.grid),children:rt.map((R,Y)=>a.jsx(Ti,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Vt(e,new Date(k.getFullYear(),Y,1)):!1,$current:Vt(N,new Date(k.getFullYear(),Y,1)),$disabled:Ut(k.getFullYear(),Y,d,p),disabled:Ut(k.getFullYear(),Y,d,p),onClick:()=>Mr(Y),children:R},Y))})]}),Kr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(lt,{className:K("header",b==null?void 0:b.header),children:[a.jsxs(dt,{type:"button",style:{cursor:"default"},children:[Me[0]," - ",Me[Me.length-1]]}),a.jsxs(ct,{children:[a.jsx(ye,{onClick:Vr,type:"button","aria-label":"Previous years",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(ye,{onClick:Wr,type:"button","aria-label":"Next years",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Ni,{className:K("grid",b==null?void 0:b.grid),children:Me.map(R=>a.jsx(Ii,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Oi(e,new Date(R,0,1)):!1,$current:N.getFullYear()===R,$disabled:Xt(R,d,p),disabled:Xt(R,d,p),onClick:()=>Fr(R),children:R},R))})]}),jt=()=>{switch(m){case"days":return Xr();case"months":return qr();case"years":return Kr()}},Zr=y?xe.createPortal(a.jsx(ki,{ref:D,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),style:{top:_.top,left:_.left},children:jt()}),y):a.jsx(Ri,{ref:D,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),children:jt()});return a.jsxs(yi,{...j,ref:L??G,$fullWidth:O,className:K("container",$),children:[C&&a.jsx(vi,{children:C}),a.jsxs(mi,{ref:P,type:"button",onClick:Dr,disabled:f,$size:h,$variant:g,$disabled:f,$open:q,$hasValue:!!Lt,className:K("trigger",b==null?void 0:b.trigger),children:[a.jsx(Ci,{children:Lt??Ar}),a.jsx(wi,{$open:q,children:a.jsx(a.ChevronDown,{size:Ur})})]}),Zr]})},Mi={left:t.KEYFRAMES.slideInLeft,right:t.KEYFRAMES.slideInRight,top:t.KEYFRAMES.slideInTop,bottom:t.KEYFRAMES.slideInBottom},Fi=(e,r)=>{switch(e){case"left":return`
|
|
709
838
|
top: 0;
|
|
710
839
|
left: 0;
|
|
711
840
|
height: 100%;
|
|
712
|
-
width: ${
|
|
841
|
+
width: ${r};
|
|
713
842
|
`;case"right":return`
|
|
714
843
|
top: 0;
|
|
715
844
|
right: 0;
|
|
716
845
|
height: 100%;
|
|
717
|
-
width: ${
|
|
846
|
+
width: ${r};
|
|
718
847
|
`;case"top":return`
|
|
719
848
|
top: 0;
|
|
720
849
|
left: 0;
|
|
721
850
|
width: 100%;
|
|
722
|
-
height: ${
|
|
851
|
+
height: ${r};
|
|
723
852
|
`;case"bottom":return`
|
|
724
853
|
bottom: 0;
|
|
725
854
|
left: 0;
|
|
726
855
|
width: 100%;
|
|
727
|
-
height: ${
|
|
728
|
-
`}},
|
|
856
|
+
height: ${r};
|
|
857
|
+
`}},Bi=s.div`
|
|
729
858
|
position: fixed;
|
|
730
859
|
z-index: 1001;
|
|
731
860
|
background-color: ${t.COLORS.white};
|
|
732
861
|
box-shadow: 0 4px 24px ${t.alpha(t.COLORS.black,20)};
|
|
733
|
-
${e=>
|
|
734
|
-
animation: ${e=>
|
|
735
|
-
`,
|
|
862
|
+
${e=>Fi(e.$position,e.$size)}
|
|
863
|
+
animation: ${e=>Mi[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
864
|
+
`,Yi=A.newClassNameGetter("drawer"),Hi=({animated:e,children:r,className:o,open:i,position:n="right",ref:l,size:c="400px",...d})=>i?xe.createPortal(a.jsx(Bi,{...d,ref:l,className:Yi("container",o),$animated:!!e,$position:n,$size:c,children:r}),document.body):null,Gi=s.div`
|
|
736
865
|
position: relative;
|
|
737
866
|
display: inline-block;
|
|
738
|
-
`,
|
|
867
|
+
`,Vi=s.div`
|
|
739
868
|
cursor: pointer;
|
|
740
|
-
|
|
869
|
+
`,vr=`
|
|
741
870
|
z-index: 100;
|
|
742
871
|
min-width: 160px;
|
|
743
872
|
padding: 8px;
|
|
@@ -745,39 +874,39 @@
|
|
|
745
874
|
border: 1px solid ${t.COLORS.gray};
|
|
746
875
|
border-radius: 8px;
|
|
747
876
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
748
|
-
`,
|
|
877
|
+
`,mr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Wi=s.div`
|
|
749
878
|
position: absolute;
|
|
750
879
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
751
880
|
${({$align:e})=>e==="left"?"left: 0;":"right: 0;"}
|
|
752
|
-
${
|
|
881
|
+
${vr}
|
|
753
882
|
opacity: ${({$open:e})=>e?1:0};
|
|
754
883
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
755
|
-
transform: ${({$open:e,$position:
|
|
884
|
+
transform: ${({$open:e,$position:r})=>mr(e,r)};
|
|
756
885
|
transition:
|
|
757
886
|
opacity 0.15s ease,
|
|
758
887
|
transform 0.15s ease,
|
|
759
888
|
visibility 0.15s;
|
|
760
|
-
`,
|
|
889
|
+
`,Ui=s.div`
|
|
761
890
|
position: fixed;
|
|
762
|
-
${
|
|
891
|
+
${vr}
|
|
763
892
|
opacity: ${({$open:e})=>e?1:0};
|
|
764
893
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
765
|
-
transform: ${({$open:e,$position:
|
|
894
|
+
transform: ${({$open:e,$position:r})=>mr(e,r)};
|
|
766
895
|
transition:
|
|
767
896
|
opacity 0.15s ease,
|
|
768
897
|
transform 0.15s ease,
|
|
769
898
|
visibility 0.15s;
|
|
770
|
-
`,
|
|
899
|
+
`,Ge=A.newClassNameGetter("dropdown"),Ve=4,Xi=100,qi=({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),[C,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)??Xi,M=((F=b.current)==null?void 0:F.offsetWidth)??160,m=window.innerHeight-E.bottom-Ve,I=E.top-Ve,k=m<w&&I>m?"top":"bottom";if(v(k),d){let B;e==="left"?B=E.left:B=E.right-M;const G=k==="bottom"?E.bottom+Ve:E.top-w-Ve;y({top:G,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()},m=()=>{j&&d&&N()};return j&&(document.addEventListener("mousedown",E),document.addEventListener("keydown",w),d&&(window.addEventListener("scroll",M,!0),window.addEventListener("resize",m))),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",m)}},[j,z,d,N]);const _=d?xe.createPortal(a.jsx(Ui,{ref:b,$open:j,$position:S,className:Ge("content",i==null?void 0:i.content),style:{top:C.top,left:C.left},children:r}),d):a.jsx(Wi,{ref:b,$align:e,$open:j,$position:S,className:Ge("content",i==null?void 0:i.content),children:r});return a.jsxs(Gi,{...g,ref:p??x,className:Ge("container",o),children:[a.jsx(Vi,{ref:$,onClick:H,className:Ge("trigger",i==null?void 0:i.trigger),children:u.cloneElement(h)}),_]})},Ki={normal:t.COLORS["iron-grey"],error:t.COLORS.red,success:t.COLORS.green,warning:t.COLORS.yellow},Zi=s.span`
|
|
771
900
|
display: block;
|
|
772
901
|
font-size: 12px;
|
|
773
902
|
font-weight: 500;
|
|
774
903
|
line-height: 1.4;
|
|
775
|
-
color: ${e=>
|
|
776
|
-
`,
|
|
904
|
+
color: ${e=>Ki[e.$variant]};
|
|
905
|
+
`,Ji=A.newClassNameGetter("field-message"),Qi=({children:e,className:r,ref:o,variant:i="normal",...n})=>e?a.jsx(Zi,{...n,ref:o,className:Ji("container",r),$variant:i,children:e}):null,en=s.div`
|
|
777
906
|
display: flex;
|
|
778
907
|
flex-direction: column;
|
|
779
908
|
gap: 12px;
|
|
780
|
-
`,
|
|
909
|
+
`,tn=s.div`
|
|
781
910
|
width: ${({$size:e})=>e}px;
|
|
782
911
|
height: ${({$size:e})=>e}px;
|
|
783
912
|
border-radius: 8px;
|
|
@@ -793,10 +922,10 @@
|
|
|
793
922
|
height: 100%;
|
|
794
923
|
object-fit: cover;
|
|
795
924
|
}
|
|
796
|
-
`,
|
|
925
|
+
`,rn=s.span`
|
|
797
926
|
font-size: 12px;
|
|
798
927
|
color: ${t.COLORS["iron-grey"]};
|
|
799
|
-
`,
|
|
928
|
+
`,on=e=>`
|
|
800
929
|
.${e} {
|
|
801
930
|
padding: 7px 16px;
|
|
802
931
|
font-size: 14px;
|
|
@@ -814,7 +943,7 @@
|
|
|
814
943
|
.${e}:active {
|
|
815
944
|
transform: translate(0, 1px);
|
|
816
945
|
}
|
|
817
|
-
`,
|
|
946
|
+
`,nn=e=>`
|
|
818
947
|
.${e} {
|
|
819
948
|
display: flex;
|
|
820
949
|
flex: 1 1 auto;
|
|
@@ -838,7 +967,7 @@
|
|
|
838
967
|
max-height: 70vh;
|
|
839
968
|
}
|
|
840
969
|
}
|
|
841
|
-
`,
|
|
970
|
+
`,an=e=>`
|
|
842
971
|
.${e} {
|
|
843
972
|
padding: 7px 16px;
|
|
844
973
|
font-size: 14px;
|
|
@@ -856,7 +985,7 @@
|
|
|
856
985
|
.${e}:active {
|
|
857
986
|
transform: translate(0, 1px);
|
|
858
987
|
}
|
|
859
|
-
`,
|
|
988
|
+
`,ln=e=>`
|
|
860
989
|
.${e} {
|
|
861
990
|
display: flex;
|
|
862
991
|
flex-direction: column;
|
|
@@ -874,7 +1003,7 @@
|
|
|
874
1003
|
border-radius: 8px;
|
|
875
1004
|
}
|
|
876
1005
|
}
|
|
877
|
-
`,
|
|
1006
|
+
`,dn=e=>`
|
|
878
1007
|
.${e} {
|
|
879
1008
|
display: flex;
|
|
880
1009
|
justify-content: flex-end;
|
|
@@ -893,7 +1022,7 @@
|
|
|
893
1022
|
gap: 8px;
|
|
894
1023
|
}
|
|
895
1024
|
}
|
|
896
|
-
`,
|
|
1025
|
+
`,cn=e=>`
|
|
897
1026
|
.${e} {
|
|
898
1027
|
display: flex;
|
|
899
1028
|
justify-content: flex-start;
|
|
@@ -915,7 +1044,7 @@
|
|
|
915
1044
|
font-size: 14px;
|
|
916
1045
|
}
|
|
917
1046
|
}
|
|
918
|
-
`,
|
|
1047
|
+
`,sn=e=>`
|
|
919
1048
|
.${e} {
|
|
920
1049
|
display: block;
|
|
921
1050
|
z-index: 101;
|
|
@@ -933,27 +1062,27 @@
|
|
|
933
1062
|
position: absolute;
|
|
934
1063
|
touch-action: none;
|
|
935
1064
|
}
|
|
936
|
-
`,
|
|
1065
|
+
`,pn=e=>`
|
|
937
1066
|
.${e} {
|
|
938
1067
|
position: absolute;
|
|
939
1068
|
z-index: 2;
|
|
940
1069
|
background-color: rgba(0, 0, 0, 0.6);
|
|
941
1070
|
touch-action: none;
|
|
942
1071
|
}
|
|
943
|
-
`,
|
|
1072
|
+
`,un=e=>`
|
|
944
1073
|
.${e} {
|
|
945
1074
|
position: absolute;
|
|
946
1075
|
z-index: 3;
|
|
947
1076
|
touch-action: none;
|
|
948
1077
|
}
|
|
949
|
-
`,
|
|
1078
|
+
`,hn=e=>`
|
|
950
1079
|
.${e} {
|
|
951
1080
|
backface-visibility: hidden;
|
|
952
1081
|
perspective: 1000px;
|
|
953
1082
|
max-inline-size: unset !important;
|
|
954
1083
|
max-block-size: unset !important;
|
|
955
1084
|
}
|
|
956
|
-
`,
|
|
1085
|
+
`,bn=e=>`
|
|
957
1086
|
.${e} {
|
|
958
1087
|
position: absolute;
|
|
959
1088
|
z-index: 100;
|
|
@@ -964,12 +1093,12 @@
|
|
|
964
1093
|
overflow: hidden;
|
|
965
1094
|
border-radius: 50%;
|
|
966
1095
|
}
|
|
967
|
-
`,
|
|
1096
|
+
`,gn={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},fn={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},We=(e,r)=>{const o=gn[r],{h:i,v:n}=fn[r];return`
|
|
968
1097
|
.${e} {
|
|
969
1098
|
display: block;
|
|
970
1099
|
z-index: 102;
|
|
971
1100
|
background-color: rgba(255, 255, 255, .6);
|
|
972
|
-
cursor: ${
|
|
1101
|
+
cursor: ${o};
|
|
973
1102
|
-webkit-user-select: none;
|
|
974
1103
|
-moz-user-select: none;
|
|
975
1104
|
-ms-user-select: none;
|
|
@@ -990,7 +1119,7 @@
|
|
|
990
1119
|
${n}: -12px;
|
|
991
1120
|
}
|
|
992
1121
|
}
|
|
993
|
-
`},
|
|
1122
|
+
`},xn=e=>`
|
|
994
1123
|
.${e} {
|
|
995
1124
|
display: flex;
|
|
996
1125
|
align-items: center;
|
|
@@ -1016,7 +1145,7 @@
|
|
|
1016
1145
|
padding-bottom: env(safe-area-inset-bottom, 8px);
|
|
1017
1146
|
}
|
|
1018
1147
|
}
|
|
1019
|
-
`,
|
|
1148
|
+
`,On=e=>`
|
|
1020
1149
|
.${e} {
|
|
1021
1150
|
backface-visibility: hidden;
|
|
1022
1151
|
user-select: none;
|
|
@@ -1029,25 +1158,25 @@
|
|
|
1029
1158
|
position: absolute;
|
|
1030
1159
|
z-index: 1;
|
|
1031
1160
|
}
|
|
1032
|
-
|
|
1033
|
-
${
|
|
1034
|
-
${
|
|
1035
|
-
${
|
|
1036
|
-
${
|
|
1037
|
-
${
|
|
1038
|
-
${
|
|
1039
|
-
${
|
|
1040
|
-
${
|
|
1041
|
-
${
|
|
1042
|
-
${
|
|
1043
|
-
${
|
|
1044
|
-
${
|
|
1045
|
-
${
|
|
1046
|
-
${
|
|
1047
|
-
${
|
|
1048
|
-
${
|
|
1049
|
-
${
|
|
1050
|
-
`,i=document.createElement("style");return i.innerHTML=r,document.getElementsByTagName("head")[0].prepend(i),o};let rn=0;const nn=e=>{const o=new Map,r=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(o.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...r}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(r[n]=l)}},subscribe:(i,n)=>{const l=String(++rn),c=o.get(i)||[];return o.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of o.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){o.set(n,c);return}}},unsubscribeAll:()=>{o.clear()}}},St={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},an=(e={},o={})=>nn({...St,config:{...St.config,...e},css:on(o)}),ln=(e,o)=>{var O;const r=e(),i=document.querySelector(`.${(O=r.css)==null?void 0:O.body[0]}`);if(!i)return r.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=o.width/o.height;let p,b,h=0,f=0;return c>d?(p=l*d,b=l,f=(n-p)/2):(p=n,b=n*(o.height/o.width),h=(l-b)/2),{width:p,height:b,left:f,top:h}},dn=(e,o,r)=>{const[i,n]=o,l=i+e>r.width?(r.width-e)/2:i,c=n+e>r.height?(r.height-e)/2:n;return[l,c]},cn=(e,o)=>{const{config:r}=e(),i=Math.min(o.width,o.height)-r.framePadding*2,n=r.portalSize>i?i:r.portalSize;if(Array.isArray(r.portalPosition)&&r.portalPosition.length===2){const[l,c]=dn(n,r.portalPosition,o);return{left:l,top:c,size:n}}return r.portalPosition==="center"?{size:n,left:(o.width-n)/2,top:(o.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 sn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerMove),r.setAttribute("data-action",te.MOVE),r},pn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeBottomLeft),r.setAttribute("data-action",te.RESIZE_BL),r},un=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeBottomRight),r.setAttribute("data-action",te.RESIZE_BR),r},hn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeTopLeft),r.setAttribute("data-action",te.RESIZE_TL),r},bn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeTopRight),r.setAttribute("data-action",te.RESIZE_TR),r},gn=e=>{var i;const o=e(),r=document.createElement("img");return U(r,(i=o.css)==null?void 0:i.previewImage),r},fn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.preview),r.appendChild(gn(e)),r},xn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.portal),r.appendChild(fn(e)),r.appendChild(sn(e)),r.appendChild(hn(e)),r.appendChild(bn(e)),r.appendChild(pn(e)),r.appendChild(un(e)),r},On=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.portalArea),r.appendChild(xn(e)),r},$n=e=>{var i;const o=e(),r=document.createElement("img");return U(r,(i=o.css)==null?void 0:i.sourceImage),r.setAttribute("alt","source"),r.setAttribute("crossOrigin","anonymous"),r.setAttribute("draggable","false"),r.setAttribute("src",o.sourceBase64),r},Sn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.body),r.appendChild($n(e)),r.appendChild(On(e)),r},yn=(e,o)=>{var n;const r=e(),i=document.createElement("div");return U(i,(n=r.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=r.config.applyButtonLabel,i.addEventListener("click",o),i},vn=(e,o)=>{var n;const r=e(),i=document.createElement("div");return U(i,(n=r.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=r.config.cancelButtonLabel,i.addEventListener("click",o),i},mn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.footer),n.appendChild(vn(e,r)),n.appendChild(yn(e,o)),n},Cn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.header),r},wn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.container),n.appendChild(Cn(e)),n.appendChild(Sn(e)),n.appendChild(mn(e,o,r)),n},Rn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");U(n,(l=i.css)==null?void 0:l.root),n.appendChild(wn(e,o,r)),document.body.appendChild(n)},kn=e=>{const o=document.createElement("input");return o.style.display="none",o.setAttribute("type","file"),o.setAttribute("accept","image/x-png,image/jpeg"),o.addEventListener("change",e,!1),document.body.appendChild(o),o},Te=new Map,Ln={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},he=(e,o)=>{if(Te.has(e))return Te.get(e);if(!o)return null;const r=o[Ln[e]],i=document.querySelector(`.${r[0]}`);return Te.set(e,i),i},Pn=()=>{Te.clear()},zn=()=>{Te.clear()},jn=(e,o)=>{const r=he("header",o.css);r&&(r.innerText=e)},En=(e,o)=>{const r=he("sourceImage",o.css);r&&(r.setAttribute("src",e),r.style.height=`${o.frame.height}px`,r.style.width=`${o.frame.width}px`,r.style.left=`${o.frame.left}px`,r.style.top=`${o.frame.top}px`);const i=he("portalArea",o.css);i&&(i.style.height=`${o.frame.height}px`,i.style.width=`${o.frame.width}px`,i.style.left=`${o.frame.left}px`,i.style.top=`${o.frame.top}px`);const n=he("portal",o.css);n&&(n.style.width=`${o.portal.size}px`,n.style.height=`${o.portal.size}px`,n.style.left=`${o.portal.left}px`,n.style.top=`${o.portal.top}px`);const l=he("previewImage",o.css);l&&(l.setAttribute("src",e),l.style.height=`${o.frame.height}px`,l.style.width=`${o.frame.width}px`,l.style.marginLeft=`-${o.portal.left}px`,l.style.marginTop=`-${o.portal.top}px`)},Tn=(e,o)=>{const r=he("portal",o.css);r&&(r.style.left=`${e.left}px`,r.style.top=`${e.top}px`,r.style.width=`${e.size}px`,r.style.height=`${e.size}px`);const i=he("previewImage",o.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},at=1,Nn=e=>{var w,y;const o=e(),r=document.createElement("canvas"),i=o.frame.width||at,n=o.frame.height||at,l=o.sourceWidth/i,c=o.sourceHeight/n,d=o.portal.left*l,p=o.portal.top*c,b=Math.max(o.portal.size*Math.min(l,c),at),h=o.config.outputSize>0?o.config.outputSize:b;r.width=h,r.height=h;const f=document.querySelector(`.${(w=o.css)==null?void 0:w.sourceImage[0]}`);f&&((y=r.getContext("2d"))==null||y.drawImage(f,d,p,b,b,0,0,h,h));const O=r.toDataURL(`image/${o.config.type}`,o.config.compression);return new Promise((S,v)=>{try{r.toBlob(x=>{if(r.remove(),!x){v(new Error(`Failed to create blob for type: image/${o.config.type}`));return}S([O,x])},`image/${o.config.type}`,o.config.compression)}catch(x){r.remove(),v(x)}})},In=(e,o,r)=>{const{emitted:i,portal:n,frame:l,config:c}=o();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const b=c.framePadding,h=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<b&&(d=b),d>h&&(d=h),p<f&&(p=f),p>O&&(p=O),r({portal:{...n,left:d,top:p}})},An=(e,o,r)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=o(),p=e.pageX-n.X,b=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let h=n.size+Math.max(p,b);return h<d.minPortalSize&&(h=d.minPortalSize),n.top+h>c.height-d.framePadding&&(h=c.height-n.top-d.framePadding),n.left+h>c.width-d.framePadding&&(h=c.width-n.left-d.framePadding),r({portal:{...l,size:h}})}case te.RESIZE_TR:{let h=p+b>0?n.size+p:n.size-b,f=p+b>0?n.top-p:n.top+b;return h<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,h=d.minPortalSize),n.left+h>c.width-d.framePadding&&(h=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(h=n.top+n.size,f=d.framePadding),r({portal:{...l,top:f,size:h}})}case te.RESIZE_TL:{const h=Math.min(p,b);let f=n.size-h,O=n.left+h,w=n.top+h;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,w=n.top+y}if(w<d.framePadding){const y=d.framePadding-w;w=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,w=w+y,f=f-y}return r({portal:{...l,top:w,left:O,size:f}})}case te.RESIZE_BL:{let h=p+b>0?n.size+b:n.size-p,f=p+b>0?n.left-b:n.left+p;return h<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,h=d.minPortalSize),h+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,h=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,h=n.left+n.size-d.framePadding),r({portal:{...l,left:f,size:h}})}default:return}},Ht=e=>{if("touches"in e&&e.touches.length>0){const r=e.touches[0];return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const r=e.changedTouches[0];return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}}const o=e;return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}},Dn=(e,o)=>{var O,w,y;const r=e(),i=document.querySelector(`.${(O=r.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(w=r.css)==null?void 0:w.portalArea[0]}`),l=document.querySelector(`.${(y=r.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:v}=e(),x=Ht(S);if(S.target){const $=S.target.getAttribute("data-action"),u={X:x.pageX,Y:x.pageY,left:v.left,top:v.top,size:v.size};o({action:$,emitted:u})}},b=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&o({action:null})},h=()=>{if(c=null,!d)return;const S=d;d=null;const{action:v}=e();if(v)switch(v){case te.MOVE:In(S,e,o);break;default:An(S,e,o)}},f=S=>{const{action:v}=e();v&&(S.preventDefault(),d=Ht(S),c===null&&(c=requestAnimationFrame(h)))};return l&&(l.addEventListener("mouseup",b),l.addEventListener("touchend",b),l.addEventListener("touchcancel",b)),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",b),l.removeEventListener("touchend",b),l.removeEventListener("touchcancel",b)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},Gt=1024*1024,_n=(e,o)=>{if(!o.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${o.allowedTypes.join(", ")}`;if(o.maxFileSize>0&&e.size>o.maxFileSize){const r=(o.maxFileSize/Gt).toFixed(2);return`File size (${(e.size/Gt).toFixed(2)}MB) exceeds maximum allowed size (${r}MB)`}return null},Mn=(e,o,r,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:b}=o(),h=_n(p,b);if(h){d(h),e.target.value="";return}const f=new FileReader;let O=null;const w=()=>{var u;const x=o(),$=document.querySelector(`.${(u=x.css)==null?void 0:u.root[0]}`);$&&($.remove(),document.removeEventListener("keydown",y),O==null||O(),zn(),l(),r(St))},y=x=>{x.key==="Escape"&&o().sourceBase64&&S(x)},S=x=>{x.preventDefault(),w()},v=x=>{x.preventDefault();const $=o();Nn(o).then(([u,P])=>{i(u,P,$),S(x)}).catch(u=>{d(u instanceof Error?u.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;Rn(o,v,S),Pn(),n("fileName",jn),n("sourceBase64",En),n("portal",Tn);const u=ln(o,$),P=cn(o,u);r({frame:u,portal:P,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:$.height,sourceWidth:$.width}),O=Dn(o,r),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},Fn=(e,o,r,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=an(o,r),p=kn(b=>Mn(b,n,l,e,c,d,i));return{open:()=>p.click()}},ae={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Vt="vacano-image-cropper-styles",Bn=`
|
|
1161
|
+
`,$n=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)},V=e=>`hq-cropper__${$n(e)}`,W=e=>e||[],U=(e,r)=>{if(r)for(const o of r)e.classList.add(o)},Sn=e=>{const r={applyButton:[V("applyButton"),...W(e.applyButton)],cancelButton:[V("cancelButton"),...W(e.cancelButton)],container:[V("container"),...W(e.container)],handlerMove:[V("handlerMove"),...W(e.handlerMove)],handlerResizeTopLeft:[V("handlerResizeTopLeft"),...W(e.handlerResizeTopLeft)],handlerResizeTopRight:[V("handlerResizeTopRight"),...W(e.handlerResizeTopRight)],handlerResizeBottomLeft:[V("handlerResizeBottomLeft"),...W(e.handlerResizeBottomLeft)],handlerResizeBottomRight:[V("handlerResizeBottomRight"),...W(e.handlerResizeBottomRight)],sourceImage:[V("sourceImage"),...W(e.sourceImage)],portalArea:[V("portalArea"),...W(e.portalArea)],previewImage:[V("previewImage"),...W(e.previewImage)],body:[V("body"),...W(e.body)],header:[V("header"),...W(e.header)],footer:[V("footer"),...W(e.footer)],portal:[V("portal"),...W(e.portal)],preview:[V("preview"),...W(e.preview)],root:[V("root"),...W(e.root)]},o=`
|
|
1162
|
+
${on(r.applyButton[0])}
|
|
1163
|
+
${nn(r.body[0])}
|
|
1164
|
+
${an(r.cancelButton[0])}
|
|
1165
|
+
${ln(r.container[0])}
|
|
1166
|
+
${dn(r.footer[0])}
|
|
1167
|
+
${cn(r.header[0])}
|
|
1168
|
+
${sn(r.handlerMove[0])}
|
|
1169
|
+
${pn(r.portalArea[0])}
|
|
1170
|
+
${un(r.portal[0])}
|
|
1171
|
+
${hn(r.previewImage[0])}
|
|
1172
|
+
${bn(r.preview[0])}
|
|
1173
|
+
${We(r.handlerResizeBottomLeft[0],"bl")}
|
|
1174
|
+
${We(r.handlerResizeBottomRight[0],"br")}
|
|
1175
|
+
${We(r.handlerResizeTopLeft[0],"tl")}
|
|
1176
|
+
${We(r.handlerResizeTopRight[0],"tr")}
|
|
1177
|
+
${xn(r.root[0])}
|
|
1178
|
+
${On(r.sourceImage[0])}
|
|
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=`
|
|
1051
1180
|
.vacano-cropper-root {
|
|
1052
1181
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1053
1182
|
backdrop-filter: blur(4px);
|
|
@@ -1095,46 +1224,46 @@
|
|
|
1095
1224
|
.vacano-cropper-apply-button:hover {
|
|
1096
1225
|
background-color: ${t.COLORS["iron-grey"]};
|
|
1097
1226
|
}
|
|
1098
|
-
`,
|
|
1227
|
+
`,na=()=>{if(typeof document>"u"||document.getElementById(Zt))return;const e=document.createElement("style");e.id=Zt,e.textContent=ia,document.head.appendChild(e)},aa={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"]},Cr=(e={})=>{const{allowedTypes:r=le.allowedTypes,applyLabel:o=le.applyLabel,cancelLabel:i=le.cancelLabel,compression:n=le.compression,maxFileSize:l=le.maxFileSize,onCrop:c,onError:d,outputSize:p=le.outputSize,portalSize:h=le.portalSize,type:g=le.type}=e,f=u.useRef(null);return{open:u.useCallback(()=>{f.current||(na(),f.current=oa((C,y,S)=>{y&&(c==null||c({base64:C,blob:y,state:S}))},{portalSize:h,outputSize:p,compression:n,type:g,maxFileSize:l,allowedTypes:r,applyButtonLabel:o,cancelButtonLabel:i},aa,C=>{d==null||d({code:"CROPPER_ERROR",message:C})})),f.current.open()},[r,o,i,n,l,c,d,p,h,g])}},pt=A.newClassNameGetter("image-cropper"),la=({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:C,type:y,value:S,...v})=>{const[x,$]=u.useState(S??null),{open:b}=Cr({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(en,{...v,ref:C,className:pt("container",n),children:[a.jsx(tn,{$size:O,className:pt("preview",l==null?void 0:l.preview),children:x?a.jsx("img",{src:x,alt:"Preview"}):a.jsx(rn,{children:"No image"})}),a.jsx(De,{variant:"system",onClick:b,className:pt("button",l==null?void 0:l.button),style:{width:O},children:o})]})},Jt={compact:{height:"32px",padding:"0 10px",radius:"14px",prefixSize:"16px"},default:{height:"40px",padding:"0 14px",radius:"16px",prefixSize:"20px"}},Qt={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=>Qt[e]??Qt.normal,ut=e=>Jt[e]??Jt.default,da=s.div`
|
|
1099
1228
|
display: grid;
|
|
1100
1229
|
flex-direction: column;
|
|
1101
1230
|
gap: 2px;
|
|
1102
1231
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1103
|
-
`,
|
|
1232
|
+
`,ca=s(ue)`
|
|
1104
1233
|
margin-left: 6px;
|
|
1105
|
-
`,
|
|
1234
|
+
`,sa=s.input`
|
|
1106
1235
|
flex: 1;
|
|
1107
1236
|
min-width: 0;
|
|
1108
1237
|
outline: none;
|
|
1109
1238
|
font-size: 14px;
|
|
1110
1239
|
font-weight: 500;
|
|
1111
|
-
height: ${e=>
|
|
1112
|
-
padding: ${e=>
|
|
1113
|
-
border-radius: ${e=>
|
|
1240
|
+
height: ${e=>ut(e.$size).height};
|
|
1241
|
+
padding: ${e=>ut(e.$size).padding};
|
|
1242
|
+
border-radius: ${e=>ut(e.$size).radius};
|
|
1114
1243
|
|
|
1115
|
-
color: ${e=>
|
|
1116
|
-
border: 1px solid ${e=>
|
|
1117
|
-
background-color: ${e=>
|
|
1244
|
+
color: ${e=>ie(e.$variant).color.static};
|
|
1245
|
+
border: 1px solid ${e=>ie(e.$variant).border.static};
|
|
1246
|
+
background-color: ${e=>ie(e.$variant).background.static};
|
|
1118
1247
|
|
|
1119
1248
|
&::placeholder {
|
|
1120
|
-
color: ${e=>
|
|
1249
|
+
color: ${e=>ie(e.$variant).placeholder.static};
|
|
1121
1250
|
}
|
|
1122
1251
|
|
|
1123
1252
|
&:disabled {
|
|
1124
1253
|
cursor: not-allowed;
|
|
1125
|
-
color: ${e=>
|
|
1126
|
-
background-color: ${e=>
|
|
1127
|
-
border-color: ${e=>
|
|
1254
|
+
color: ${e=>ie(e.$variant).color.disabled};
|
|
1255
|
+
background-color: ${e=>ie(e.$variant).background.disabled};
|
|
1256
|
+
border-color: ${e=>ie(e.$variant).border.disabled};
|
|
1128
1257
|
|
|
1129
1258
|
&::placeholder {
|
|
1130
|
-
color: ${e=>
|
|
1259
|
+
color: ${e=>ie(e.$variant).placeholder.disabled};
|
|
1131
1260
|
}
|
|
1132
1261
|
}
|
|
1133
1262
|
|
|
1134
1263
|
&:focus-visible {
|
|
1135
|
-
outline: 2px solid ${e=>
|
|
1264
|
+
outline: 2px solid ${e=>ie(e.$variant).focus};
|
|
1136
1265
|
}
|
|
1137
|
-
`,
|
|
1266
|
+
`,ht=A.newClassNameGetter("input"),wr=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",...p})=>a.jsxs(da,{className:ht("container",e),$fullWidth:!!i,children:[a.jsx(ca,{variant:d,className:ht("label",r==null?void 0:r.label),children:n}),a.jsx(sa,{...p,ref:l,disabled:o,$size:c,$variant:d,className:ht("input",r==null?void 0:r.input)})]}),pa=s.div`
|
|
1138
1267
|
position: fixed;
|
|
1139
1268
|
inset: 0;
|
|
1140
1269
|
z-index: 1000;
|
|
@@ -1143,7 +1272,7 @@
|
|
|
1143
1272
|
justify-content: center;
|
|
1144
1273
|
background-color: ${t.alpha(t.COLORS.black,50)};
|
|
1145
1274
|
animation: ${t.KEYFRAMES.fadeIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1146
|
-
`,
|
|
1275
|
+
`,ua=s.div`
|
|
1147
1276
|
position: relative;
|
|
1148
1277
|
z-index: 1001;
|
|
1149
1278
|
width: ${e=>e.$width};
|
|
@@ -1154,21 +1283,21 @@
|
|
|
1154
1283
|
border-radius: 16px;
|
|
1155
1284
|
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1156
1285
|
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1157
|
-
`,
|
|
1286
|
+
`,er=A.newClassNameGetter("modal"),Rr=({animated:e,children:r,className:o,classnames:i,open:n,ref:l,width:c="500px",...d})=>n?xe.createPortal(a.jsx(pa,{className:er("overlay",i==null?void 0:i.overlay),$animated:!!e,children:a.jsx(ua,{...d,ref:l,className:er("content",o,i==null?void 0:i.content),$animated:!!e,$width:c,children:r})}),document.body):null,kr={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},ha=s.div`
|
|
1158
1287
|
display: flex;
|
|
1159
1288
|
flex-direction: column;
|
|
1160
1289
|
gap: 4px;
|
|
1161
|
-
`,
|
|
1290
|
+
`,ba=s(ue)`
|
|
1162
1291
|
margin-left: 6px;
|
|
1163
|
-
color: ${e=>
|
|
1164
|
-
`,
|
|
1292
|
+
color: ${e=>kr[e.$variant].label};
|
|
1293
|
+
`,ga=s.button`
|
|
1165
1294
|
display: flex;
|
|
1166
1295
|
flex-wrap: wrap;
|
|
1167
1296
|
align-items: center;
|
|
1168
1297
|
gap: 6px;
|
|
1169
1298
|
min-height: 44px;
|
|
1170
1299
|
padding: 8px 12px;
|
|
1171
|
-
border: 1px dashed ${e=>
|
|
1300
|
+
border: 1px dashed ${e=>kr[e.$variant].border};
|
|
1172
1301
|
border-radius: 8px;
|
|
1173
1302
|
background: ${t.COLORS.white};
|
|
1174
1303
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
@@ -1185,31 +1314,31 @@
|
|
|
1185
1314
|
${e=>e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1186
1315
|
outline-offset: 2px;
|
|
1187
1316
|
}
|
|
1188
|
-
`,
|
|
1317
|
+
`,fa=s.span`
|
|
1189
1318
|
color: ${t.COLORS["iron-grey"]};
|
|
1190
1319
|
font-size: 14px;
|
|
1191
|
-
`,
|
|
1320
|
+
`,xa=s.div`
|
|
1192
1321
|
display: flex;
|
|
1193
1322
|
flex-direction: column;
|
|
1194
1323
|
padding: 20px;
|
|
1195
1324
|
gap: 16px;
|
|
1196
|
-
`,
|
|
1325
|
+
`,Oa=s.div`
|
|
1197
1326
|
display: flex;
|
|
1198
1327
|
align-items: center;
|
|
1199
1328
|
justify-content: space-between;
|
|
1200
|
-
|
|
1329
|
+
`,$a=s.h3`
|
|
1201
1330
|
margin: 0;
|
|
1202
1331
|
font-size: 18px;
|
|
1203
1332
|
font-weight: 600;
|
|
1204
1333
|
color: ${t.COLORS.black};
|
|
1205
|
-
`,
|
|
1334
|
+
`,Sa=s.div`
|
|
1206
1335
|
display: flex;
|
|
1207
1336
|
flex-direction: column;
|
|
1208
1337
|
gap: 4px;
|
|
1209
1338
|
min-height: 200px;
|
|
1210
1339
|
max-height: 300px;
|
|
1211
1340
|
overflow-y: auto;
|
|
1212
|
-
`,
|
|
1341
|
+
`,ya=s.label`
|
|
1213
1342
|
display: flex;
|
|
1214
1343
|
align-items: center;
|
|
1215
1344
|
gap: 10px;
|
|
@@ -1222,10 +1351,10 @@
|
|
|
1222
1351
|
&:hover {
|
|
1223
1352
|
background-color: ${e=>e.$disabled?"transparent":t.COLORS.gray};
|
|
1224
1353
|
}
|
|
1225
|
-
`,
|
|
1354
|
+
`,va=s.span`
|
|
1226
1355
|
font-size: 14px;
|
|
1227
1356
|
color: ${t.COLORS.black};
|
|
1228
|
-
`,
|
|
1357
|
+
`,ma=s.div`
|
|
1229
1358
|
display: flex;
|
|
1230
1359
|
align-items: center;
|
|
1231
1360
|
justify-content: center;
|
|
@@ -1233,82 +1362,82 @@
|
|
|
1233
1362
|
color: ${t.COLORS["iron-grey"]};
|
|
1234
1363
|
font-size: 14px;
|
|
1235
1364
|
text-align: center;
|
|
1236
|
-
`,Q=
|
|
1365
|
+
`,Q=A.newClassNameGetter("multi-select"),Ca=({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:C="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(ha,{...y,ref:g,className:Q("container",e),children:[n&&a.jsx(ba,{$variant:C,className:Q("label",r==null?void 0:r.trigger),children:n}),a.jsx(ga,{type:"button",$variant:C,$disabled:o,disabled:o,onClick:H,className:Q("trigger",r==null?void 0:r.trigger),children:b.length===0?a.jsx(fa,{className:Q("placeholder",r==null?void 0:r.placeholder),children:h}):a.jsxs(a.Fragment,{children:[j.map(w=>a.jsx(Je,{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(Je,{variant:"gray",onClick:w=>w.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:["+",N]})]})}),a.jsx(Rr,{open:S,width:"400px",animated:!0,className:Q("modal",r==null?void 0:r.modal),children:a.jsxs(xa,{children:[a.jsxs(Oa,{children:[a.jsx($a,{children:c}),a.jsx(De,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:z})]}),a.jsx(wr,{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(Sa,{className:Q("options",r==null?void 0:r.options),children:L.length===0?a.jsx(ma,{className:Q("empty",r==null?void 0:r.empty),children:i}):L.map(w=>a.jsxs(ya,{$disabled:!!w.disabled,className:Q("option",r==null?void 0:r.option),children:[a.jsx(et,{checked:O.includes(w.value),disabled:w.disabled,onChange:()=>_(w.value)}),a.jsx(va,{children:w.label})]},w.value))})]})})]})},tr={compact:{width:"36px",height:"40px",fontSize:"16px",radius:"10px",gap:"8px"},default:{width:"44px",height:"52px",fontSize:"20px",radius:"12px",gap:"10px"}},rr={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)}},Ne=e=>tr[e]??tr.default,he=e=>rr[e]??rr.normal,wa=s.div`
|
|
1237
1366
|
display: inline-flex;
|
|
1238
1367
|
flex-direction: column;
|
|
1239
1368
|
gap: 2px;
|
|
1240
|
-
`,
|
|
1369
|
+
`,Ra=s(ue)`
|
|
1241
1370
|
margin-left: 6px;
|
|
1242
|
-
`,
|
|
1371
|
+
`,ka=s.div`
|
|
1243
1372
|
display: flex;
|
|
1244
|
-
gap: ${e=>
|
|
1245
|
-
`,
|
|
1246
|
-
width: ${e=>
|
|
1247
|
-
height: ${e=>
|
|
1248
|
-
border-radius: ${e=>
|
|
1249
|
-
font-size: ${e=>
|
|
1373
|
+
gap: ${e=>Ne(e.$size).gap};
|
|
1374
|
+
`,La=s.input`
|
|
1375
|
+
width: ${e=>Ne(e.$size).width};
|
|
1376
|
+
height: ${e=>Ne(e.$size).height};
|
|
1377
|
+
border-radius: ${e=>Ne(e.$size).radius};
|
|
1378
|
+
font-size: ${e=>Ne(e.$size).fontSize};
|
|
1250
1379
|
font-weight: 600;
|
|
1251
1380
|
text-align: center;
|
|
1252
1381
|
outline: none;
|
|
1253
|
-
border: 1px solid ${e=>
|
|
1254
|
-
background-color: ${e=>
|
|
1255
|
-
color: ${e=>
|
|
1382
|
+
border: 1px solid ${e=>he(e.$variant).border.static};
|
|
1383
|
+
background-color: ${e=>he(e.$variant).background.static};
|
|
1384
|
+
color: ${e=>he(e.$variant).color.static};
|
|
1256
1385
|
transition:
|
|
1257
1386
|
border-color 0.15s ease,
|
|
1258
1387
|
box-shadow 0.15s ease;
|
|
1259
1388
|
|
|
1260
1389
|
&:disabled {
|
|
1261
1390
|
cursor: not-allowed;
|
|
1262
|
-
color: ${e=>
|
|
1263
|
-
background-color: ${e=>
|
|
1264
|
-
border-color: ${e=>
|
|
1391
|
+
color: ${e=>he(e.$variant).color.disabled};
|
|
1392
|
+
background-color: ${e=>he(e.$variant).background.disabled};
|
|
1393
|
+
border-color: ${e=>he(e.$variant).border.disabled};
|
|
1265
1394
|
}
|
|
1266
1395
|
|
|
1267
1396
|
&:focus-visible {
|
|
1268
|
-
outline: 2px solid ${e=>
|
|
1397
|
+
outline: 2px solid ${e=>he(e.$variant).focus};
|
|
1269
1398
|
}
|
|
1270
1399
|
|
|
1271
1400
|
&::selection {
|
|
1272
1401
|
background-color: transparent;
|
|
1273
1402
|
}
|
|
1274
|
-
`,
|
|
1403
|
+
`,bt=A.newClassNameGetter("otp-code"),Pa=({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 C=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&&C(_)},[h,l,c,C]),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("")),C(x-1))}else $.key==="ArrowLeft"&&x>0?($.preventDefault(),C(x-1)):$.key==="ArrowRight"&&x<l-1&&($.preventDefault(),C(x+1))},[h,l,c,C]),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);C(b)}},[l,c,C]);return a.jsxs(wa,{ref:d,className:bt("container",r),...f,children:[n&&a.jsx(Ra,{variant:g,className:bt("label",o==null?void 0:o.label),children:n}),a.jsx(ka,{$size:p,children:Array.from({length:l}).map((x,$)=>a.jsx(La,{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:bt("input",o==null?void 0:o.input)},$))})]})},or={light:{background:t.COLORS.white,border:t.alpha(t.COLORS.black,30),title:t.COLORS.black,description:t.COLORS["iron-grey"]},dark:{background:t.alpha(t.COLORS.white,5),border:t.alpha(t.COLORS.white,30),title:t.COLORS.white,description:"#9ca3af"}},Qe=e=>or[e]??or.light,za=s.div`
|
|
1275
1404
|
display: flex;
|
|
1276
1405
|
flex-direction: column;
|
|
1277
1406
|
gap: 16px;
|
|
1278
1407
|
padding: 12px;
|
|
1279
|
-
border: 1px dashed ${({$variant:e})=>
|
|
1408
|
+
border: 1px dashed ${({$variant:e})=>Qe(e).border};
|
|
1280
1409
|
border-radius: 16px;
|
|
1281
|
-
background-color: ${({$variant:e})=>
|
|
1282
|
-
`,
|
|
1410
|
+
background-color: ${({$variant:e})=>Qe(e).background};
|
|
1411
|
+
`,ja=s.div`
|
|
1283
1412
|
display: flex;
|
|
1284
1413
|
flex-direction: column;
|
|
1285
1414
|
gap: 4px;
|
|
1286
|
-
`,
|
|
1415
|
+
`,Ea=s.div`
|
|
1287
1416
|
font-size: 18px;
|
|
1288
1417
|
font-weight: 600;
|
|
1289
1418
|
line-height: 1.4;
|
|
1290
|
-
color: ${({$variant:e})=>
|
|
1291
|
-
`,
|
|
1419
|
+
color: ${({$variant:e})=>Qe(e).title};
|
|
1420
|
+
`,Ta=s.div`
|
|
1292
1421
|
font-size: 14px;
|
|
1293
1422
|
line-height: 1.5;
|
|
1294
|
-
color: ${({$variant:e})=>
|
|
1295
|
-
`,
|
|
1423
|
+
color: ${({$variant:e})=>Qe(e).description};
|
|
1424
|
+
`,Na=s.div`
|
|
1296
1425
|
display: flex;
|
|
1297
1426
|
flex-wrap: wrap;
|
|
1298
1427
|
gap: 8px;
|
|
1299
|
-
`,
|
|
1428
|
+
`,Ue=A.newClassNameGetter("panel"),Ia=({children:e,className:r,classnames:o,description:i,ref:n,title:l,variant:c="light",...d})=>{const p=l||i;return a.jsxs(za,{...d,ref:n,className:Ue("container",r),$variant:c,children:[p&&a.jsxs(ja,{children:[l&&a.jsx(Ea,{className:Ue("title",o==null?void 0:o.title),$variant:c,children:l}),i&&a.jsx(Ta,{className:Ue("description",o==null?void 0:o.description),$variant:c,children:i})]}),a.jsx(Na,{className:Ue("content",o==null?void 0:o.content),children:e})]})},Ct={compact:{height:4,radius:2},default:{height:8,radius:4}},Aa=s.div`
|
|
1300
1429
|
width: 100%;
|
|
1301
|
-
height: ${({$size:e})=>
|
|
1302
|
-
border-radius: ${({$size:e})=>
|
|
1430
|
+
height: ${({$size:e})=>Ct[e].height}px;
|
|
1431
|
+
border-radius: ${({$size:e})=>Ct[e].radius}px;
|
|
1303
1432
|
background-color: ${t.COLORS.gray};
|
|
1304
1433
|
overflow: hidden;
|
|
1305
|
-
`,
|
|
1434
|
+
`,Da=s.div`
|
|
1306
1435
|
height: 100%;
|
|
1307
1436
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1308
|
-
border-radius: ${({$size:e})=>
|
|
1437
|
+
border-radius: ${({$size:e})=>Ct[e].radius}px;
|
|
1309
1438
|
background-color: ${t.COLORS.black};
|
|
1310
1439
|
transition: width 0.2s ease;
|
|
1311
|
-
`,
|
|
1440
|
+
`,ir=A.newClassNameGetter("progress"),_a=({value:e,size:r="default",className:o,classnames:i,ref:n,...l})=>a.jsx(Aa,{...l,ref:n,$size:r,className:ir("track",o,i==null?void 0:i.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(Da,{$size:r,$value:e,className:ir("bar",i==null?void 0:i.bar)})}),nr={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}},fe=e=>nr[e]??nr.normal,Ma=s.label`
|
|
1312
1441
|
display: inline-flex;
|
|
1313
1442
|
align-items: flex-start;
|
|
1314
1443
|
gap: 8px;
|
|
@@ -1316,15 +1445,15 @@
|
|
|
1316
1445
|
opacity: ${e=>e.$disabled?.5:1};
|
|
1317
1446
|
|
|
1318
1447
|
&:has(input:focus-visible) > span:first-of-type {
|
|
1319
|
-
box-shadow: 0 0 0 2px ${e=>
|
|
1448
|
+
box-shadow: 0 0 0 2px ${e=>fe(e.$variant).box.focusShadow};
|
|
1320
1449
|
}
|
|
1321
|
-
`,
|
|
1450
|
+
`,Fa=s.input`
|
|
1322
1451
|
position: absolute;
|
|
1323
1452
|
opacity: 0;
|
|
1324
1453
|
width: 0;
|
|
1325
1454
|
height: 0;
|
|
1326
1455
|
pointer-events: none;
|
|
1327
|
-
`,
|
|
1456
|
+
`,Ba=s.span`
|
|
1328
1457
|
display: inline-flex;
|
|
1329
1458
|
align-items: center;
|
|
1330
1459
|
justify-content: center;
|
|
@@ -1333,27 +1462,27 @@
|
|
|
1333
1462
|
height: 18px;
|
|
1334
1463
|
border-radius: 50%;
|
|
1335
1464
|
border: 1.5px solid
|
|
1336
|
-
${e=>e.$checked?
|
|
1337
|
-
background-color: ${e=>e.$checked?
|
|
1465
|
+
${e=>e.$checked?fe(e.$variant).box.borderChecked:fe(e.$variant).box.border};
|
|
1466
|
+
background-color: ${e=>e.$checked?fe(e.$variant).box.backgroundChecked:fe(e.$variant).box.background};
|
|
1338
1467
|
transition:
|
|
1339
1468
|
border-color 0.15s ease,
|
|
1340
1469
|
background-color 0.15s ease,
|
|
1341
1470
|
box-shadow 0.15s ease;
|
|
1342
|
-
`,
|
|
1471
|
+
`,Ya=s.span`
|
|
1343
1472
|
width: 8px;
|
|
1344
1473
|
height: 8px;
|
|
1345
1474
|
border-radius: 50%;
|
|
1346
|
-
background-color: ${e=>
|
|
1475
|
+
background-color: ${e=>fe(e.$variant).dot};
|
|
1347
1476
|
opacity: ${e=>e.$visible?1:0};
|
|
1348
1477
|
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
1349
1478
|
transition:
|
|
1350
1479
|
opacity 0.15s ease,
|
|
1351
1480
|
transform 0.15s ease;
|
|
1352
|
-
`,
|
|
1481
|
+
`,Ha=s.span`
|
|
1353
1482
|
font-size: 14px;
|
|
1354
1483
|
font-weight: 500;
|
|
1355
1484
|
line-height: 1.5;
|
|
1356
|
-
color: ${e=>
|
|
1485
|
+
color: ${e=>fe(e.$variant).label};
|
|
1357
1486
|
user-select: none;
|
|
1358
1487
|
|
|
1359
1488
|
a {
|
|
@@ -1365,15 +1494,15 @@
|
|
|
1365
1494
|
text-decoration: none;
|
|
1366
1495
|
}
|
|
1367
1496
|
}
|
|
1368
|
-
`,
|
|
1497
|
+
`,je=A.newClassNameGetter("radio"),kt=({checked:e,className:r,classnames:o,disabled:i,label:n,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(Ma,{className:je("container",r),$disabled:!!i,$variant:d,children:[a.jsx(Fa,{...p,ref:c,type:"radio",className:je("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:l}),a.jsx(Ba,{className:je("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(Ya,{className:je("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),n&&a.jsx(Ha,{className:je("label",o==null?void 0:o.label),$variant:d,children:n})]}),ar={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)}}},pe=e=>ar[e]??ar.normal,Ga=s.label`
|
|
1369
1498
|
display: grid;
|
|
1370
1499
|
grid-template-columns: auto 1fr;
|
|
1371
1500
|
align-items: start;
|
|
1372
1501
|
gap: 8px;
|
|
1373
1502
|
padding: 12px;
|
|
1374
|
-
background-color: ${e=>{const
|
|
1503
|
+
background-color: ${e=>{const r=pe(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
1375
1504
|
border: 1px solid
|
|
1376
|
-
${e=>{const
|
|
1505
|
+
${e=>{const r=pe(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
1377
1506
|
border-radius: 12px;
|
|
1378
1507
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1379
1508
|
transition:
|
|
@@ -1383,18 +1512,18 @@
|
|
|
1383
1512
|
min-width: 0;
|
|
1384
1513
|
|
|
1385
1514
|
&:hover:not([data-disabled='true']) {
|
|
1386
|
-
border-color: ${e=>{const
|
|
1515
|
+
border-color: ${e=>{const r=pe(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
1387
1516
|
}
|
|
1388
1517
|
|
|
1389
1518
|
&:has(:focus-visible) {
|
|
1390
1519
|
outline: none;
|
|
1391
|
-
box-shadow: 0 0 0 3px ${e=>
|
|
1520
|
+
box-shadow: 0 0 0 3px ${e=>pe(e.$variant).focusRing};
|
|
1392
1521
|
}
|
|
1393
1522
|
|
|
1394
1523
|
.vacano_radio_container {
|
|
1395
1524
|
pointer-events: none;
|
|
1396
1525
|
}
|
|
1397
|
-
`,
|
|
1526
|
+
`,Va=s.input`
|
|
1398
1527
|
position: absolute;
|
|
1399
1528
|
width: 1px;
|
|
1400
1529
|
height: 1px;
|
|
@@ -1404,44 +1533,44 @@
|
|
|
1404
1533
|
clip: rect(0, 0, 0, 0);
|
|
1405
1534
|
white-space: nowrap;
|
|
1406
1535
|
border: 0;
|
|
1407
|
-
`,
|
|
1536
|
+
`,Wa=s.div`
|
|
1408
1537
|
display: flex;
|
|
1409
1538
|
flex-direction: column;
|
|
1410
1539
|
gap: 2px;
|
|
1411
1540
|
min-width: 0;
|
|
1412
|
-
`,
|
|
1541
|
+
`,Ua=s.span`
|
|
1413
1542
|
font-size: 14px;
|
|
1414
1543
|
font-weight: 500;
|
|
1415
1544
|
line-height: 1.4;
|
|
1416
|
-
color: ${e=>
|
|
1545
|
+
color: ${e=>pe(e.$variant).label.static};
|
|
1417
1546
|
|
|
1418
1547
|
label[data-disabled='true'] & {
|
|
1419
|
-
color: ${e=>
|
|
1548
|
+
color: ${e=>pe(e.$variant).label.disabled};
|
|
1420
1549
|
}
|
|
1421
|
-
`,
|
|
1550
|
+
`,Xa=s.span`
|
|
1422
1551
|
font-size: 12px;
|
|
1423
1552
|
font-weight: 400;
|
|
1424
1553
|
line-height: 1.4;
|
|
1425
|
-
color: ${e=>
|
|
1554
|
+
color: ${e=>pe(e.$variant).description.static};
|
|
1426
1555
|
|
|
1427
1556
|
label[data-disabled='true'] & {
|
|
1428
|
-
color: ${e=>
|
|
1557
|
+
color: ${e=>pe(e.$variant).description.disabled};
|
|
1429
1558
|
}
|
|
1430
|
-
`,
|
|
1559
|
+
`,Xe=A.newClassNameGetter("radio-card"),qa=({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(Ga,{className:Xe("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(Va,{...g,ref:p,type:"radio",checked:e,disabled:n,onChange:d}),a.jsx(kt,{className:o==null?void 0:o.radio,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(Wa,{className:Xe("content",o==null?void 0:o.content),children:[a.jsx(Ua,{className:Xe("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(Xa,{className:Xe("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),lr={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},Ka=s.div`
|
|
1431
1560
|
display: flex;
|
|
1432
1561
|
flex-direction: column;
|
|
1433
1562
|
gap: 8px;
|
|
1434
|
-
`,
|
|
1563
|
+
`,Za=s.span`
|
|
1435
1564
|
font-size: 13px;
|
|
1436
1565
|
font-weight: 500;
|
|
1437
1566
|
line-height: 1.5;
|
|
1438
|
-
color: ${e=>e.$disabled?
|
|
1567
|
+
color: ${e=>e.$disabled?lr.label.disabledColor:lr.label.color};
|
|
1439
1568
|
margin-bottom: 4px;
|
|
1440
|
-
`,
|
|
1569
|
+
`,Ja=s.div`
|
|
1441
1570
|
display: flex;
|
|
1442
1571
|
flex-direction: column;
|
|
1443
1572
|
gap: 12px;
|
|
1444
|
-
`,
|
|
1573
|
+
`,gt=A.newClassNameGetter("radio-group"),Qa=({className:e,classnames:r,disabled:o,label:i,name:n,onChange:l,options:c,ref:d,value:p,...h})=>a.jsxs(Ka,{...h,ref:d,className:gt("container",e),children:[i&&a.jsx(Za,{className:gt("label",r==null?void 0:r.label),$disabled:o,children:i}),a.jsx(Ja,{className:gt("options",r==null?void 0:r.options),children:c.map(g=>a.jsx(kt,{className:r==null?void 0:r.radio,name:n,checked:p===g.value,label:g.label,disabled:o,onChange:()=>l(g.value)},g.value))})]}),Lr=u.createContext(null),el=s.div`
|
|
1445
1574
|
position: fixed;
|
|
1446
1575
|
bottom: 24px;
|
|
1447
1576
|
right: 24px;
|
|
@@ -1456,34 +1585,19 @@
|
|
|
1456
1585
|
animation: ${t.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1457
1586
|
pointer-events: none;
|
|
1458
1587
|
color: ${t.COLORS.black};
|
|
1459
|
-
`,
|
|
1588
|
+
`,tl=s.span`
|
|
1460
1589
|
font-size: 14px;
|
|
1461
1590
|
font-weight: 500;
|
|
1462
1591
|
white-space: nowrap;
|
|
1463
|
-
`,
|
|
1464
|
-
0% {
|
|
1465
|
-
transform: rotate(0deg);
|
|
1466
|
-
}
|
|
1467
|
-
100% {
|
|
1468
|
-
transform: rotate(360deg);
|
|
1469
|
-
}
|
|
1470
|
-
`,Fa=s.div`
|
|
1471
|
-
display: inline-block;
|
|
1472
|
-
width: ${e=>ut(e.$size).size};
|
|
1473
|
-
height: ${e=>ut(e.$size).size};
|
|
1474
|
-
border: ${e=>ut(e.$size).borderWidth} solid ${ro.track};
|
|
1475
|
-
border-top-color: ${ro.indicator};
|
|
1476
|
-
border-radius: 50%;
|
|
1477
|
-
animation: ${Ma} 0.8s linear infinite;
|
|
1478
|
-
`,Ba=I.newClassNameGetter("spinner"),Ro=({"aria-label":e="Loading",className:o,ref:r,size:i="md",...n})=>a.jsx(Fa,{...n,ref:r,className:Ba("container",o),role:"status","aria-label":e,$size:i}),Ya=({children:e,defaultMessage:o="Saving"})=>{const[r,i]=g.useState(!1),[n,l]=g.useState(o),c=g.useCallback(b=>{l(b??o),i(!0)},[o]),d=g.useCallback(()=>{i(!1)},[]),p=g.useMemo(()=>({isVisible:r,show:c,hide:d}),[r,c,d]);return a.jsxs(wo.Provider,{value:p,children:[e,r&&a.jsxs(Da,{children:[a.jsx(Ro,{size:"sm"}),a.jsx(_a,{children:n})]})]})},Ha=()=>{const e=g.useContext(wo);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},ht=40,ze=4,io={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},no={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)}},bt=e=>io[e]??io.default,le=e=>no[e]??no.normal,Ga=s.div`
|
|
1592
|
+
`,rl=({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(Lr.Provider,{value:p,children:[e,o&&a.jsxs(el,{children:[a.jsx(Rt,{size:"sm"}),a.jsx(tl,{children:n})]})]})},ol=()=>{const e=u.useContext(Lr);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},ft=40,Ee=4,dr={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},cr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:t.alpha(t.COLORS.black,40),focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:t.alpha(t.COLORS.red,40),focus:t.alpha(t.COLORS.red,30)}},xt=e=>dr[e]??dr.default,de=e=>cr[e]??cr.normal,il=s.div`
|
|
1479
1593
|
position: relative;
|
|
1480
1594
|
display: grid;
|
|
1481
1595
|
gap: 2px;
|
|
1482
1596
|
min-width: 180px;
|
|
1483
1597
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1484
|
-
`,
|
|
1598
|
+
`,nl=s(ue)`
|
|
1485
1599
|
margin-left: 6px;
|
|
1486
|
-
`,
|
|
1600
|
+
`,al=s.button`
|
|
1487
1601
|
display: flex;
|
|
1488
1602
|
align-items: center;
|
|
1489
1603
|
justify-content: space-between;
|
|
@@ -1494,47 +1608,47 @@
|
|
|
1494
1608
|
font-weight: 500;
|
|
1495
1609
|
text-align: left;
|
|
1496
1610
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1497
|
-
height: ${e=>
|
|
1498
|
-
padding: ${e=>
|
|
1499
|
-
border-radius: ${e=>
|
|
1611
|
+
height: ${e=>xt(e.$size).height};
|
|
1612
|
+
padding: ${e=>xt(e.$size).padding};
|
|
1613
|
+
border-radius: ${e=>xt(e.$size).radius};
|
|
1500
1614
|
|
|
1501
|
-
color: ${e=>e.$hasValue?e.$disabled?
|
|
1615
|
+
color: ${e=>e.$hasValue?e.$disabled?de(e.$variant).color.disabled:de(e.$variant).color.static:de(e.$variant).placeholder};
|
|
1502
1616
|
border: 1px solid
|
|
1503
|
-
${e=>e.$disabled?
|
|
1504
|
-
background-color: ${e=>e.$disabled?
|
|
1617
|
+
${e=>e.$disabled?de(e.$variant).border.disabled:de(e.$variant).border.static};
|
|
1618
|
+
background-color: ${e=>e.$disabled?de(e.$variant).background.disabled:de(e.$variant).background.static};
|
|
1505
1619
|
|
|
1506
1620
|
&:focus-visible {
|
|
1507
|
-
outline: 2px solid ${e=>
|
|
1621
|
+
outline: 2px solid ${e=>de(e.$variant).focus};
|
|
1508
1622
|
}
|
|
1509
|
-
`,
|
|
1623
|
+
`,ll=s.span`
|
|
1510
1624
|
flex: 1;
|
|
1511
1625
|
min-width: 0;
|
|
1512
1626
|
overflow: hidden;
|
|
1513
1627
|
text-overflow: ellipsis;
|
|
1514
1628
|
white-space: nowrap;
|
|
1515
|
-
`,
|
|
1629
|
+
`,dl=s.span`
|
|
1516
1630
|
display: flex;
|
|
1517
1631
|
align-items: center;
|
|
1518
1632
|
justify-content: center;
|
|
1519
1633
|
flex-shrink: 0;
|
|
1520
1634
|
transition: transform 0.2s ease;
|
|
1521
1635
|
transform: rotate(${e=>e.$open?"180deg":"0deg"});
|
|
1522
|
-
`,
|
|
1636
|
+
`,Pr=`
|
|
1523
1637
|
padding: 4px;
|
|
1524
1638
|
background: ${t.COLORS.white};
|
|
1525
1639
|
border: 1px solid ${t.alpha(t.COLORS.black,10)};
|
|
1526
1640
|
border-radius: 16px;
|
|
1527
1641
|
box-shadow: 0 4px 20px ${t.alpha(t.COLORS.black,15)};
|
|
1528
1642
|
z-index: 1000;
|
|
1529
|
-
`,
|
|
1643
|
+
`,cl=s.div`
|
|
1530
1644
|
position: absolute;
|
|
1531
1645
|
left: -4px;
|
|
1532
1646
|
width: calc(100% + 8px);
|
|
1533
|
-
${
|
|
1534
|
-
`,
|
|
1647
|
+
${Pr}
|
|
1648
|
+
`,sl=s.div`
|
|
1535
1649
|
position: fixed;
|
|
1536
|
-
${
|
|
1537
|
-
`,
|
|
1650
|
+
${Pr}
|
|
1651
|
+
`,pl=s.button`
|
|
1538
1652
|
display: flex;
|
|
1539
1653
|
align-items: center;
|
|
1540
1654
|
justify-content: space-between;
|
|
@@ -1560,13 +1674,13 @@
|
|
|
1560
1674
|
outline: none;
|
|
1561
1675
|
background: ${t.alpha(t.COLORS.black,8)};
|
|
1562
1676
|
}
|
|
1563
|
-
`,
|
|
1677
|
+
`,ul=s.span`
|
|
1564
1678
|
display: flex;
|
|
1565
1679
|
align-items: center;
|
|
1566
1680
|
justify-content: center;
|
|
1567
1681
|
flex-shrink: 0;
|
|
1568
1682
|
color: ${t.COLORS.black};
|
|
1569
|
-
`,
|
|
1683
|
+
`,ve=A.newClassNameGetter("select"),hl=({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",...C})=>{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(m=>m.value===f),N=Math.max(0,c.findIndex(m=>m.value===f)),H=-(N*ft+Ee),z=()=>{if(!b.current||!p)return;const m=b.current.getBoundingClientRect(),I=N*ft+Ee;let k=m.top-I;const T=c.length*ft+Ee*2,F=8,B=window.innerHeight-T-8;k<F&&(k=F),k>B&&(k=B),x({top:k,left:m.left-Ee,width:m.width+Ee*2})},_=m=>{var I;l==null||l(m),S(!1),(I=b.current)==null||I.focus()},E=m=>{o||(m.key==="Enter"||m.key===" "?(m.preventDefault(),S(I=>!I)):m.key==="Escape"&&y?(m.preventDefault(),S(!1)):m.key==="ArrowDown"&&!y&&(m.preventDefault(),S(!0)))};u.useLayoutEffect(()=>{y&&p&&z()},[y,p,N,c.length]),u.useEffect(()=>{if(!y)return;const m=T=>{const F=T.target,B=$.current&&!$.current.contains(F),G=L.current&&!L.current.contains(F);p?B&&G&&S(!1):B&&S(!1)},I=()=>{p&&z()},k=()=>{p&&z()};return document.addEventListener("mousedown",m),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",k)),()=>{document.removeEventListener("mousedown",m),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",k)}},[y,p]);const w=()=>c.map(m=>a.jsxs(pl,{type:"button",role:"option",$selected:m.value===f,$disabled:m.disabled??!1,disabled:m.disabled,"aria-selected":m.value===f,onClick:()=>_(m.value),className:ve("option",r==null?void 0:r.option),children:[a.jsx("span",{children:m.label}),m.value===f&&a.jsx(ul,{children:a.jsx(a.Check,{size:16})})]},m.value)),M=p?xe.createPortal(a.jsx(sl,{ref:L,role:"listbox",style:{top:v.top,left:v.left,width:v.width},className:ve("dropdown",r==null?void 0:r.dropdown),children:w()}),p):a.jsx(cl,{ref:L,role:"listbox",style:{top:H},className:ve("dropdown",r==null?void 0:r.dropdown),children:w()});return a.jsxs(il,{...C,ref:m=>{$.current=m,typeof h=="function"?h(m):h&&(h.current=m)},$fullWidth:i,className:ve("container",e),children:[n&&a.jsx(nl,{className:ve("label",r==null?void 0:r.label),children:n}),a.jsxs(al,{ref:b,type:"button",$size:g,$variant:O,$disabled:o,$hasValue:!!j,disabled:o,onClick:()=>!o&&S(m=>!m),onKeyDown:E,"aria-haspopup":"listbox","aria-expanded":y,className:ve("trigger",r==null?void 0:r.trigger),children:[a.jsx(ll,{children:(j==null?void 0:j.label)??d}),a.jsx(dl,{$open:y,children:a.jsx(a.ChevronDown,{size:16})})]}),y&&M]})},sr={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},bl=e=>sr[e]??sr.neutral,gl=s.div`
|
|
1570
1684
|
display: flex;
|
|
1571
1685
|
flex-direction: column;
|
|
1572
1686
|
gap: 4px;
|
|
@@ -1575,16 +1689,16 @@
|
|
|
1575
1689
|
border-radius: 16px;
|
|
1576
1690
|
border: ${({$border:e})=>e?"1px solid #e5e7eb":"none"};
|
|
1577
1691
|
box-shadow: ${({$shadow:e})=>e?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"none"};
|
|
1578
|
-
`,
|
|
1692
|
+
`,fl=s.div`
|
|
1579
1693
|
display: flex;
|
|
1580
1694
|
align-items: center;
|
|
1581
1695
|
justify-content: space-between;
|
|
1582
1696
|
gap: 8px;
|
|
1583
|
-
`,
|
|
1697
|
+
`,xl=s.p`
|
|
1584
1698
|
margin: 0;
|
|
1585
1699
|
font-size: 13px;
|
|
1586
1700
|
color: ${t.COLORS["iron-grey"]};
|
|
1587
|
-
`,
|
|
1701
|
+
`,Ol=s.div`
|
|
1588
1702
|
display: flex;
|
|
1589
1703
|
align-items: center;
|
|
1590
1704
|
justify-content: center;
|
|
@@ -1598,21 +1712,21 @@
|
|
|
1598
1712
|
width: 18px;
|
|
1599
1713
|
height: 18px;
|
|
1600
1714
|
}
|
|
1601
|
-
|
|
1715
|
+
`,$l=s.h3`
|
|
1602
1716
|
margin: 0;
|
|
1603
1717
|
font-size: 28px;
|
|
1604
1718
|
font-weight: 600;
|
|
1605
1719
|
line-height: 1.2;
|
|
1606
1720
|
color: ${t.COLORS.black};
|
|
1607
|
-
`,
|
|
1721
|
+
`,Sl=s.p`
|
|
1608
1722
|
margin: 0;
|
|
1609
1723
|
font-size: 12px;
|
|
1610
|
-
color: ${({$variant:e})=>
|
|
1611
|
-
`,
|
|
1724
|
+
color: ${({$variant:e})=>bl(e)};
|
|
1725
|
+
`,qe=A.newClassNameGetter("status-card"),yl=({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(gl,{...g,ref:l,className:qe("container",r),$border:e,$shadow:c,children:[a.jsxs(fl,{children:[a.jsx(xl,{className:qe("label",o==null?void 0:o.label),children:n}),i&&a.jsx(Ol,{children:i})]}),a.jsx($l,{className:qe("value",o==null?void 0:o.value),children:h}),d&&a.jsx(Sl,{className:qe("trend",o==null?void 0:o.trend),$variant:p,children:d})]}),vl=s.div`
|
|
1612
1726
|
display: flex;
|
|
1613
1727
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1614
1728
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1615
|
-
`,
|
|
1729
|
+
`,ml=s.div`
|
|
1616
1730
|
display: flex;
|
|
1617
1731
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1618
1732
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1621,7 +1735,7 @@
|
|
|
1621
1735
|
&:last-child {
|
|
1622
1736
|
flex: 0;
|
|
1623
1737
|
}
|
|
1624
|
-
`,
|
|
1738
|
+
`,Cl=s.button`
|
|
1625
1739
|
display: flex;
|
|
1626
1740
|
align-items: center;
|
|
1627
1741
|
gap: 10px;
|
|
@@ -1639,7 +1753,7 @@
|
|
|
1639
1753
|
outline-offset: 2px;
|
|
1640
1754
|
}
|
|
1641
1755
|
}
|
|
1642
|
-
`,
|
|
1756
|
+
`,wl=s.div`
|
|
1643
1757
|
display: flex;
|
|
1644
1758
|
align-items: center;
|
|
1645
1759
|
justify-content: center;
|
|
@@ -1663,13 +1777,13 @@
|
|
|
1663
1777
|
border: 2px solid ${t.COLORS.gray};
|
|
1664
1778
|
color: ${t.COLORS["iron-grey"]};
|
|
1665
1779
|
`}
|
|
1666
|
-
`,
|
|
1780
|
+
`,Rl=s.span`
|
|
1667
1781
|
font-size: 14px;
|
|
1668
1782
|
font-weight: 500;
|
|
1669
1783
|
white-space: nowrap;
|
|
1670
1784
|
color: ${e=>e.$active||e.$completed?t.COLORS.black:t.COLORS["iron-grey"]};
|
|
1671
1785
|
transition: color 0.2s ease;
|
|
1672
|
-
`,
|
|
1786
|
+
`,kl=s.div`
|
|
1673
1787
|
background-color: ${e=>e.$completed?t.COLORS.black:t.COLORS.gray};
|
|
1674
1788
|
transition: background-color 0.2s ease;
|
|
1675
1789
|
|
|
@@ -1683,22 +1797,22 @@
|
|
|
1683
1797
|
min-width: 16px;
|
|
1684
1798
|
margin: 0 12px;
|
|
1685
1799
|
`}
|
|
1686
|
-
`,
|
|
1800
|
+
`,Te=A.newClassNameGetter("stepper"),Ll=({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(vl,{...d,ref:n,$orientation:i,className:Te("container",e),children:l.map((h,g)=>{const f=h.value===c,O=g<p,C=g===l.length-1;return a.jsxs(ml,{$orientation:i,children:[a.jsxs(Cl,{type:"button",$active:f,$completed:O,$clickable:!!o,onClick:()=>o==null?void 0:o(h.value),className:Te("step",r==null?void 0:r.step),children:[a.jsx(wl,{$active:f,$completed:O,className:Te("circle",r==null?void 0:r.circle),children:g+1}),a.jsx(Rl,{$active:f,$completed:O,className:Te("label",r==null?void 0:r.label),children:h.label})]}),!C&&a.jsx(kl,{$completed:O,$orientation:i,className:Te("line",r==null?void 0:r.line)})]},h.value)})})},wt={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},Pl=s.div`
|
|
1687
1801
|
position: relative;
|
|
1688
1802
|
display: flex;
|
|
1689
1803
|
flex-direction: column;
|
|
1690
1804
|
gap: 4px;
|
|
1691
|
-
`,
|
|
1805
|
+
`,zl=s(ue)`
|
|
1692
1806
|
margin-left: 6px;
|
|
1693
|
-
color: ${e=>
|
|
1694
|
-
`,
|
|
1807
|
+
color: ${e=>wt[e.$variant].label};
|
|
1808
|
+
`,jl=s.div`
|
|
1695
1809
|
display: flex;
|
|
1696
1810
|
flex-wrap: wrap;
|
|
1697
1811
|
align-items: center;
|
|
1698
1812
|
gap: 6px;
|
|
1699
1813
|
min-height: 44px;
|
|
1700
1814
|
padding: 8px 12px;
|
|
1701
|
-
border: 1px dashed ${e=>
|
|
1815
|
+
border: 1px dashed ${e=>wt[e.$variant].border};
|
|
1702
1816
|
border-radius: 8px;
|
|
1703
1817
|
background: ${t.COLORS.white};
|
|
1704
1818
|
cursor: ${e=>e.$disabled?"not-allowed":"text"};
|
|
@@ -1706,14 +1820,14 @@
|
|
|
1706
1820
|
transition: border-color 0.15s ease;
|
|
1707
1821
|
|
|
1708
1822
|
&:hover {
|
|
1709
|
-
border-color: ${e=>e.$disabled?
|
|
1823
|
+
border-color: ${e=>e.$disabled?wt[e.$variant].border:e.$variant==="error"?t.COLORS.red:t.COLORS.black};
|
|
1710
1824
|
}
|
|
1711
1825
|
|
|
1712
1826
|
${e=>e.$focused&&`
|
|
1713
1827
|
outline: 2px solid ${e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1714
1828
|
outline-offset: 2px;
|
|
1715
1829
|
`}
|
|
1716
|
-
`,
|
|
1830
|
+
`,El=s.input`
|
|
1717
1831
|
flex: 1;
|
|
1718
1832
|
min-width: 80px;
|
|
1719
1833
|
border: none;
|
|
@@ -1730,7 +1844,7 @@
|
|
|
1730
1844
|
&:disabled {
|
|
1731
1845
|
cursor: not-allowed;
|
|
1732
1846
|
}
|
|
1733
|
-
`,
|
|
1847
|
+
`,zr=`
|
|
1734
1848
|
z-index: 100;
|
|
1735
1849
|
background-color: ${t.COLORS.white};
|
|
1736
1850
|
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
@@ -1738,28 +1852,28 @@
|
|
|
1738
1852
|
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
1739
1853
|
max-height: 200px;
|
|
1740
1854
|
overflow-y: auto;
|
|
1741
|
-
`,
|
|
1855
|
+
`,jr=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Er=`
|
|
1742
1856
|
opacity 0.15s ease,
|
|
1743
1857
|
transform 0.15s ease,
|
|
1744
1858
|
visibility 0.15s;
|
|
1745
|
-
|
|
1859
|
+
`,Tl=s.div`
|
|
1746
1860
|
position: absolute;
|
|
1747
1861
|
left: 0;
|
|
1748
1862
|
right: 0;
|
|
1749
1863
|
${e=>e.$position==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
1750
|
-
${
|
|
1864
|
+
${zr}
|
|
1751
1865
|
opacity: ${e=>e.$open?1:0};
|
|
1752
1866
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1753
|
-
transform: ${e=>
|
|
1754
|
-
transition: ${
|
|
1755
|
-
`,
|
|
1867
|
+
transform: ${e=>jr(e.$open,e.$position)};
|
|
1868
|
+
transition: ${Er};
|
|
1869
|
+
`,Nl=s.div`
|
|
1756
1870
|
position: fixed;
|
|
1757
|
-
${
|
|
1871
|
+
${zr}
|
|
1758
1872
|
opacity: ${e=>e.$open?1:0};
|
|
1759
1873
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1760
|
-
transform: ${e=>
|
|
1761
|
-
transition: ${
|
|
1762
|
-
`,
|
|
1874
|
+
transform: ${e=>jr(e.$open,e.$position)};
|
|
1875
|
+
transition: ${Er};
|
|
1876
|
+
`,pr=s.button`
|
|
1763
1877
|
display: flex;
|
|
1764
1878
|
align-items: center;
|
|
1765
1879
|
width: 100%;
|
|
@@ -1787,7 +1901,7 @@
|
|
|
1787
1901
|
&:only-child {
|
|
1788
1902
|
border-radius: 7px;
|
|
1789
1903
|
}
|
|
1790
|
-
`,
|
|
1904
|
+
`,ur=s.div`
|
|
1791
1905
|
display: flex;
|
|
1792
1906
|
align-items: center;
|
|
1793
1907
|
justify-content: center;
|
|
@@ -1795,11 +1909,11 @@
|
|
|
1795
1909
|
color: ${t.COLORS["iron-grey"]};
|
|
1796
1910
|
font-size: 14px;
|
|
1797
1911
|
text-align: center;
|
|
1798
|
-
`,ee=
|
|
1912
|
+
`,ee=A.newClassNameGetter("tags"),Ke=4,Il=({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:C="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(X=>!O.includes(X.value));if(!b.trim())return P;const D=b.toLowerCase().trim();return P.filter(X=>X.label.toLowerCase().includes(D))},[p,O,b]),M=j&&p.length>0,m=u.useCallback(()=>{var _e;if(!v.current)return;const P=v.current.getBoundingClientRect(),D=((_e=x.current)==null?void 0:_e.offsetHeight)??200,X=window.innerHeight-P.bottom-Ke,q=P.top-Ke,Oe=X<D&&q>X?"top":"bottom";if(z(Oe),g){const rt=Oe==="bottom"?P.bottom+Ke:P.top-D-Ke;E({top:rt,left:P.left,width:P.width})}},[g]);u.useEffect(()=>{if(j)return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[j,m]);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(X=>X.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()},G=P=>{const D=p.find(X=>X.value===P);return(D==null?void 0:D.label)??P};return a.jsxs(Pl,{...y,ref:f,className:ee("container",e),children:[c&&a.jsx(zl,{$variant:C,className:ee("label"),children:c}),a.jsxs("div",{ref:S,style:{position:"relative"},children:[a.jsxs(jl,{ref:v,$variant:C,$disabled:i,$focused:j,onClick:B,className:ee("trigger",r==null?void 0:r.trigger),children:[O.map(P=>a.jsx(Je,{deletable:!i,onDelete:()=>F(P),className:ee("chip",r==null?void 0:r.chip),children:G(P)},P)),a.jsx(El,{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?xe.createPortal(a.jsx(Nl,{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(ur,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(pr,{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(Tl,{ref:x,$open:M,$position:H,className:ee("dropdown",r==null?void 0:r.dropdown),children:w.length===0?a.jsx(ur,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(pr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>T(P.value),className:ee("option",r==null?void 0:r.option),children:P.label},P.value))}))]})]})},Al=s.div`
|
|
1799
1913
|
display: flex;
|
|
1800
1914
|
align-items: center;
|
|
1801
1915
|
gap: 6px;
|
|
1802
|
-
`,
|
|
1916
|
+
`,Dl=s.button`
|
|
1803
1917
|
padding: 6px 16px;
|
|
1804
1918
|
border: none;
|
|
1805
1919
|
border-radius: 12px;
|
|
@@ -1822,7 +1936,7 @@
|
|
|
1822
1936
|
outline: 2px solid ${t.COLORS["steel-blue"]};
|
|
1823
1937
|
outline-offset: 2px;
|
|
1824
1938
|
}
|
|
1825
|
-
`,
|
|
1939
|
+
`,hr=A.newClassNameGetter("tabs"),_l=({className:e,classnames:r,onChange:o,ref:i,tabs:n,value:l,...c})=>a.jsx(Al,{...c,ref:i,className:hr("container",e),role:"tablist",children:n.map(d=>a.jsx(Dl,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>o(d.value),className:hr("tab",r==null?void 0:r.tab),children:d.label},d.value))}),Tr=u.createContext(null),Ot=3,br={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}},Ml=(e,r)=>{switch(r.type){case"ADD_TOAST":{const o=r.payload;return e.toasts.length<Ot?{...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<Ot?{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>=Ot?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},Fl={toasts:[],queue:[]},$t=e=>br[e]??br.default,Bl=ne.keyframes`
|
|
1826
1940
|
from {
|
|
1827
1941
|
transform: translateY(100%);
|
|
1828
1942
|
opacity: 0;
|
|
@@ -1831,7 +1945,7 @@
|
|
|
1831
1945
|
transform: translateY(0);
|
|
1832
1946
|
opacity: 1;
|
|
1833
1947
|
}
|
|
1834
|
-
`,
|
|
1948
|
+
`,Yl=ne.keyframes`
|
|
1835
1949
|
from {
|
|
1836
1950
|
transform: translateY(0);
|
|
1837
1951
|
opacity: 1;
|
|
@@ -1840,7 +1954,7 @@
|
|
|
1840
1954
|
transform: translateY(100%);
|
|
1841
1955
|
opacity: 0;
|
|
1842
1956
|
}
|
|
1843
|
-
`,
|
|
1957
|
+
`,Hl=s.div`
|
|
1844
1958
|
position: fixed;
|
|
1845
1959
|
bottom: 24px;
|
|
1846
1960
|
left: 24px;
|
|
@@ -1851,29 +1965,29 @@
|
|
|
1851
1965
|
pointer-events: none;
|
|
1852
1966
|
width: auto;
|
|
1853
1967
|
max-width: 90vw;
|
|
1854
|
-
`,
|
|
1968
|
+
`,Gl=s.div`
|
|
1855
1969
|
display: flex;
|
|
1856
1970
|
align-items: center;
|
|
1857
1971
|
justify-content: space-between;
|
|
1858
1972
|
gap: 12px;
|
|
1859
1973
|
min-height: 32px;
|
|
1860
1974
|
padding: 8px 8px 8px 16px;
|
|
1861
|
-
background-color: ${({$variant:e})
|
|
1862
|
-
color: ${({$variant:e})
|
|
1863
|
-
border: 1px solid ${({$variant:e})
|
|
1975
|
+
background-color: ${({$variant:e})=>$t(e).background};
|
|
1976
|
+
color: ${({$variant:e})=>$t(e).text};
|
|
1977
|
+
border: 1px solid ${({$variant:e})=>$t(e).border};
|
|
1864
1978
|
border-radius: 96px;
|
|
1865
1979
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
1866
|
-
animation: ${({$isExiting:e})=>e?
|
|
1980
|
+
animation: ${({$isExiting:e})=>e?Yl:Bl} 0.3s ease-out;
|
|
1867
1981
|
pointer-events: auto;
|
|
1868
1982
|
max-width: 500px;
|
|
1869
|
-
`,
|
|
1983
|
+
`,Vl=s.span`
|
|
1870
1984
|
font-size: 14px;
|
|
1871
1985
|
font-weight: 500;
|
|
1872
1986
|
line-height: 1.4;
|
|
1873
1987
|
white-space: nowrap;
|
|
1874
1988
|
overflow: hidden;
|
|
1875
1989
|
text-overflow: ellipsis;
|
|
1876
|
-
`,
|
|
1990
|
+
`,Wl=s.button`
|
|
1877
1991
|
display: flex;
|
|
1878
1992
|
align-items: center;
|
|
1879
1993
|
justify-content: center;
|
|
@@ -1891,13 +2005,13 @@
|
|
|
1891
2005
|
&:hover {
|
|
1892
2006
|
opacity: 1;
|
|
1893
2007
|
}
|
|
1894
|
-
`,
|
|
2008
|
+
`,Ul=s.div`
|
|
1895
2009
|
display: flex;
|
|
1896
2010
|
align-items: center;
|
|
1897
2011
|
justify-content: space-between;
|
|
1898
2012
|
gap: 12px;
|
|
1899
2013
|
width: 100%;
|
|
1900
|
-
`,
|
|
2014
|
+
`,Xl=s.div`
|
|
1901
2015
|
display: flex;
|
|
1902
2016
|
align-items: center;
|
|
1903
2017
|
justify-content: center;
|
|
@@ -1912,59 +2026,59 @@
|
|
|
1912
2026
|
font-weight: 500;
|
|
1913
2027
|
white-space: nowrap;
|
|
1914
2028
|
margin-left: auto;
|
|
1915
|
-
`,
|
|
2029
|
+
`,gr=({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(Gl,{$variant:e.variant,$isExiting:o,children:[a.jsx(Vl,{children:e.message}),a.jsx(Wl,{onClick:n,children:a.jsx(a.X,{style:{width:16,height:16}})})]})},ql=({toasts:e,queueCount:r,removeToast:o})=>{if(e.length===0)return null;const i=e.length-1;return a.jsx(Hl,{children:e.map((n,l)=>l===i&&r>0?a.jsxs(Ul,{children:[a.jsx(gr,{toast:n,onRemove:o}),a.jsxs(Xl,{children:["+",r]})]},n.id):a.jsx(gr,{toast:n,onRemove:o},n.id))})},Kl=({children:e})=>{const[r,o]=u.useReducer(Ml,Fl),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(Tr.Provider,{value:{addToast:i,removeToast:n},children:[e,a.jsx(ql,{toasts:r.toasts,queueCount:r.queue.length,removeToast:n})]})},Zl=()=>{const e=u.useContext(Tr);if(!e)throw new Error("useToast must be used within ToastProvider");return e},fr={dark:{background:t.COLORS.black,text:t.COLORS.white},light:{background:t.COLORS.white,text:t.COLORS.black,border:t.COLORS.gray},success:{background:t.COLORS.green,text:t.COLORS.white},warning:{background:t.COLORS.yellow,text:t.COLORS.white},danger:{background:t.COLORS.red,text:t.COLORS.white}},Ae=e=>fr[e]??fr.dark,Jl=(e,r)=>{const o=Ae(r).background;switch(e){case"top":return`
|
|
1916
2030
|
bottom: -12px;
|
|
1917
2031
|
left: 50%;
|
|
1918
2032
|
margin-left: -6px;
|
|
1919
|
-
border-top-color: ${
|
|
2033
|
+
border-top-color: ${o};
|
|
1920
2034
|
`;case"bottom":return`
|
|
1921
2035
|
top: -12px;
|
|
1922
2036
|
left: 50%;
|
|
1923
2037
|
margin-left: -6px;
|
|
1924
|
-
border-bottom-color: ${
|
|
2038
|
+
border-bottom-color: ${o};
|
|
1925
2039
|
`;case"left":return`
|
|
1926
2040
|
right: -12px;
|
|
1927
2041
|
top: 50%;
|
|
1928
2042
|
margin-top: -6px;
|
|
1929
|
-
border-left-color: ${
|
|
2043
|
+
border-left-color: ${o};
|
|
1930
2044
|
`;case"right":return`
|
|
1931
2045
|
left: -12px;
|
|
1932
2046
|
top: 50%;
|
|
1933
2047
|
margin-top: -6px;
|
|
1934
|
-
border-right-color: ${
|
|
1935
|
-
`;default:return""}},
|
|
2048
|
+
border-right-color: ${o};
|
|
2049
|
+
`;default:return""}},Ql=(e,r)=>{if(r!=="light")return"";const o=Ae(r).border;switch(e){case"top":return`
|
|
1936
2050
|
&::after {
|
|
1937
2051
|
bottom: -14px;
|
|
1938
2052
|
left: 50%;
|
|
1939
2053
|
margin-left: -7px;
|
|
1940
|
-
border-top-color: ${
|
|
2054
|
+
border-top-color: ${o};
|
|
1941
2055
|
}
|
|
1942
2056
|
`;case"bottom":return`
|
|
1943
2057
|
&::after {
|
|
1944
2058
|
top: -14px;
|
|
1945
2059
|
left: 50%;
|
|
1946
2060
|
margin-left: -7px;
|
|
1947
|
-
border-bottom-color: ${
|
|
2061
|
+
border-bottom-color: ${o};
|
|
1948
2062
|
}
|
|
1949
2063
|
`;case"left":return`
|
|
1950
2064
|
&::after {
|
|
1951
2065
|
right: -14px;
|
|
1952
2066
|
top: 50%;
|
|
1953
2067
|
margin-top: -7px;
|
|
1954
|
-
border-left-color: ${
|
|
2068
|
+
border-left-color: ${o};
|
|
1955
2069
|
}
|
|
1956
2070
|
`;case"right":return`
|
|
1957
2071
|
&::after {
|
|
1958
2072
|
left: -14px;
|
|
1959
2073
|
top: 50%;
|
|
1960
2074
|
margin-top: -7px;
|
|
1961
|
-
border-right-color: ${
|
|
2075
|
+
border-right-color: ${o};
|
|
1962
2076
|
}
|
|
1963
|
-
`;default:return""}},
|
|
2077
|
+
`;default:return""}},Nr=e=>`
|
|
1964
2078
|
z-index: 1000;
|
|
1965
2079
|
padding: 6px 12px;
|
|
1966
|
-
background-color: ${
|
|
1967
|
-
color: ${
|
|
2080
|
+
background-color: ${Ae(e.$variant).background};
|
|
2081
|
+
color: ${Ae(e.$variant).text};
|
|
1968
2082
|
font-size: 13px;
|
|
1969
2083
|
line-height: 1.4;
|
|
1970
2084
|
border-radius: 6px;
|
|
@@ -1978,7 +2092,7 @@
|
|
|
1978
2092
|
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
|
|
1979
2093
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
1980
2094
|
|
|
1981
|
-
${e.$variant==="light"?`border: 1px solid ${
|
|
2095
|
+
${e.$variant==="light"?`border: 1px solid ${Ae(e.$variant).border};`:""}
|
|
1982
2096
|
|
|
1983
2097
|
&::before {
|
|
1984
2098
|
content: '';
|
|
@@ -1986,7 +2100,7 @@
|
|
|
1986
2100
|
width: 0;
|
|
1987
2101
|
height: 0;
|
|
1988
2102
|
border: 6px solid transparent;
|
|
1989
|
-
${
|
|
2103
|
+
${Jl(e.$placement,e.$variant)}
|
|
1990
2104
|
}
|
|
1991
2105
|
|
|
1992
2106
|
${e.$variant==="light"?`
|
|
@@ -1999,11 +2113,11 @@
|
|
|
1999
2113
|
}
|
|
2000
2114
|
`:""}
|
|
2001
2115
|
|
|
2002
|
-
${
|
|
2003
|
-
`,
|
|
2116
|
+
${Ql(e.$placement,e.$variant)}
|
|
2117
|
+
`,ed=s.div`
|
|
2004
2118
|
position: relative;
|
|
2005
2119
|
display: inline-block;
|
|
2006
|
-
`,
|
|
2120
|
+
`,td=e=>{switch(e){case"top":return`
|
|
2007
2121
|
bottom: calc(100% + 8px);
|
|
2008
2122
|
left: 50%;
|
|
2009
2123
|
transform: translateX(-50%);
|
|
@@ -2019,12 +2133,12 @@
|
|
|
2019
2133
|
left: calc(100% + 8px);
|
|
2020
2134
|
top: 50%;
|
|
2021
2135
|
transform: translateY(-50%);
|
|
2022
|
-
`;default:return""}},
|
|
2136
|
+
`;default:return""}},rd=s.div`
|
|
2023
2137
|
position: absolute;
|
|
2024
|
-
${e=>
|
|
2025
|
-
${({$placement:e})=>
|
|
2026
|
-
`,
|
|
2138
|
+
${e=>Nr(e)}
|
|
2139
|
+
${({$placement:e})=>td(e)}
|
|
2140
|
+
`,od=s.div`
|
|
2027
2141
|
position: fixed;
|
|
2028
|
-
${e=>
|
|
2029
|
-
`,
|
|
2142
|
+
${e=>Nr(e)}
|
|
2143
|
+
`,St=A.newClassNameGetter("tooltip"),ce=8,id=({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,C]=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-ce,M=window.innerHeight-z.bottom-ce,m=z.left-ce,I=window.innerWidth-z.right-ce;let k=l;if(l==="top"&&w<E&&M>w?k="bottom":l==="bottom"&&M<E&&w>M?k="top":l==="left"&&m<_&&I>m?k="right":l==="right"&&I<_&&m>I&&(k="left"),S(k),c){let B,G;switch(k){case"top":B=z.top-E-ce,G=z.left+z.width/2-_/2;break;case"bottom":B=z.bottom+ce,G=z.left+z.width/2-_/2;break;case"left":B=z.top+z.height/2-E/2,G=z.left-_-ce;break;case"right":B=z.top+z.height/2-E/2,G=z.right+ce;break;default:B=0,G=0}const P=8;G=Math.max(P,Math.min(G,window.innerWidth-_-P)),B=Math.max(P,Math.min(B,window.innerHeight-E-P)),x({top:B,left:G})}},[l,c]);u.useLayoutEffect(()=>{g&&L()},[g,L]);const j=()=>{const z=setTimeout(()=>{f(!0)},n);C(z)},N=()=>{O&&(clearTimeout(O),C(null)),f(!1)},H=c?xe.createPortal(a.jsx(od,{ref:b,className:St("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(rd,{ref:b,className:St("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,children:i});return a.jsxs(ed,{...h,ref:z=>{$.current=z,typeof d=="function"?d(z):d&&(d.current=z)},className:St("wrapper",r),onMouseEnter:j,onMouseLeave:N,children:[e,H]})};exports.Autocomplete=wo;exports.Button=De;exports.Card=Ao;exports.Checkbox=et;exports.CheckboxCard=Uo;exports.CheckboxGroup=Zo;exports.Chip=Je;exports.Confirmation=di;exports.Container=pi;exports.DatePicker=_i;exports.Drawer=Hi;exports.Dropdown=qi;exports.FieldLabel=ue;exports.FieldMessage=Qi;exports.GlobalStyle=to;exports.ImageCropper=la;exports.Input=wr;exports.KeySymbol=xr;exports.KeysBindings=Or;exports.Modal=Rr;exports.MultiSelect=Ca;exports.OtpCode=Pa;exports.Panel=Ia;exports.Progress=_a;exports.Radio=kt;exports.RadioCard=qa;exports.RadioGroup=Qa;exports.SaveProgressProvider=rl;exports.Select=hl;exports.Spinner=Rt;exports.StatusCard=yl;exports.Stepper=Ll;exports.Tabs=_l;exports.Tags=Il;exports.ToastProvider=Kl;exports.Tooltip=id;exports.formatDateGo=$r;exports.useImageCropper=Cr;exports.useSaveProgress=ol;exports.useToast=Zl;
|
|
2030
2144
|
//# sourceMappingURL=index.cjs.map
|