@vacano/ui 1.4.5 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +109 -203
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1297 -1391
- 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"),oe=require("@emotion/react"),u=require("react"),t=require("./media-OVL6YjWb.cjs"),A=require("./tooling-Dflq0Y98.cjs"),ge=require("react-dom");function ro(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const Re=ro(u);function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var i in o)({}).hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},Ct.apply(null,arguments)}const oo=oe.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -141,16 +141,16 @@
|
|
|
141
141
|
:focus:not(:focus-visible) {
|
|
142
142
|
outline: none;
|
|
143
143
|
}
|
|
144
|
-
`,io=()=>a.jsx(
|
|
144
|
+
`,io=()=>a.jsx(oe.Global,{styles:oo});var no=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,ao=a.memoize(function(e){return no.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),lo=ao,co=function(r){return r!=="theme"},Nt=function(r){return typeof r=="string"&&r.charCodeAt(0)>96?lo:co},It=function(r,o,i){var n;if(o){var l=o.shouldForwardProp;n=r.__emotion_forwardProp&&l?function(c){return r.__emotion_forwardProp(c)&&l(c)}:l}return typeof n!="function"&&i&&(n=r.__emotion_forwardProp),n},so=function(r){var o=r.cache,i=r.serialized,n=r.isStringTag;return a.registerStyles(o,i,n),a.useInsertionEffectAlwaysWithSyncFallback(function(){return a.insertStyles(o,i,n)}),null},po=function e(r,o){var i=r.__emotion_real===r,n=i&&r.__emotion_base||r,l,c;o!==void 0&&(l=o.label,c=o.target);var d=It(r,o,i),p=d||Nt(n),h=!p("as");return function(){var g=arguments,f=i&&r.__emotion_styles!==void 0?r.__emotion_styles.slice(0):[];if(l!==void 0&&f.push("label:"+l+";"),g[0]==null||g[0].raw===void 0)f.push.apply(f,g);else{var O=g[0];f.push(O[0]);for(var m=g.length,y=1;y<m;y++)f.push(g[y],O[y])}var S=oe.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(oe.ThemeContext)}typeof v.className=="string"?L=a.getRegisteredStyles(x.registered,j,v.className):v.className!=null&&(L=v.className+" ");var z=a.serializeStyles(f.concat(j),x.registered,N);L+=x.key+"-"+z.name,c!==void 0&&(L+=" "+c);var _=h&&d===void 0?Nt(b):p,E={};for(var w in v)h&&w==="as"||_(w)&&(E[w]=v[w]);return E.className=L,$&&(E.ref=$),Re.createElement(Re.Fragment,null,Re.createElement(so,{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,Ct({},o,x,{shouldForwardProp:It(S,x,!0)}));return $.apply(void 0,f)},S}},uo=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],s=po.bind(null);uo.forEach(function(e){s[e]=s(e)});const ho=s.span`
|
|
145
145
|
font-size: 12px;
|
|
146
146
|
font-weight: 500;
|
|
147
147
|
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
148
|
-
`,bo=A.newClassNameGetter("field-label"),
|
|
148
|
+
`,bo=A.newClassNameGetter("field-label"),ne=({children:e,className:r,ref:o,required:i,variant:n="normal",...l})=>e?a.jsxs(ho,{...l,ref:o,className:bo("container",r),$variant:n,children:[e," ",i&&"*"]}):null,it={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},ae={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},go=s.div`
|
|
149
149
|
position: relative;
|
|
150
150
|
display: grid;
|
|
151
151
|
gap: 2px;
|
|
152
152
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
153
|
-
`,fo=s(
|
|
153
|
+
`,fo=s(ne)`
|
|
154
154
|
margin-left: 6px;
|
|
155
155
|
`,xo=s.div`
|
|
156
156
|
position: relative;
|
|
@@ -168,28 +168,24 @@
|
|
|
168
168
|
padding-right: 40px;
|
|
169
169
|
border-radius: ${e=>it[e.$size].radius};
|
|
170
170
|
|
|
171
|
-
color: ${e=>
|
|
172
|
-
border: 1px solid ${e=>
|
|
173
|
-
background-color: ${e=>
|
|
171
|
+
color: ${e=>ae[e.$variant].color.static};
|
|
172
|
+
border: 1px solid ${e=>ae[e.$variant].border.static};
|
|
173
|
+
background-color: ${e=>ae[e.$variant].background.static};
|
|
174
174
|
|
|
175
175
|
&::placeholder {
|
|
176
|
-
color: ${e=>
|
|
176
|
+
color: ${e=>ae[e.$variant].placeholder.static};
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
&:disabled {
|
|
180
180
|
cursor: not-allowed;
|
|
181
|
-
color: ${e=>
|
|
182
|
-
background-color: ${e=>
|
|
183
|
-
border-color: ${e=>
|
|
181
|
+
color: ${e=>ae[e.$variant].color.disabled};
|
|
182
|
+
background-color: ${e=>ae[e.$variant].background.disabled};
|
|
183
|
+
border-color: ${e=>ae[e.$variant].border.disabled};
|
|
184
184
|
|
|
185
185
|
&::placeholder {
|
|
186
|
-
color: ${e=>
|
|
186
|
+
color: ${e=>ae[e.$variant].placeholder.disabled};
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
&:focus-visible {
|
|
191
|
-
outline: 2px solid ${e=>oe[e.$variant].focus};
|
|
192
|
-
}
|
|
193
189
|
`,$o=s.div`
|
|
194
190
|
position: absolute;
|
|
195
191
|
right: 12px;
|
|
@@ -259,7 +255,7 @@
|
|
|
259
255
|
font-size: 14px;
|
|
260
256
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
261
257
|
text-align: center;
|
|
262
|
-
`,At={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},Dt={track:t.alpha(t.COLORS.black,15),indicator:t.COLORS.black},nt=e=>At[e]??At.md,wo=
|
|
258
|
+
`,At={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},Dt={track:t.alpha(t.COLORS.black,15),indicator:t.COLORS.black},nt=e=>At[e]??At.md,wo=oe.keyframes`
|
|
263
259
|
0% {
|
|
264
260
|
transform: rotate(0deg);
|
|
265
261
|
}
|
|
@@ -274,7 +270,7 @@
|
|
|
274
270
|
border-top-color: ${Dt.indicator};
|
|
275
271
|
border-radius: 50%;
|
|
276
272
|
animation: ${wo} 0.8s linear infinite;
|
|
277
|
-
`,ko=A.newClassNameGetter("spinner"),Lt=({"aria-label":e="Loading",className:r,ref:o,size:i="md",...n})=>a.jsx(Ro,{...n,ref:o,className:ko("container",r),role:"status","aria-label":e,$size:i}),
|
|
273
|
+
`,ko=A.newClassNameGetter("spinner"),Lt=({"aria-label":e="Loading",className:r,ref:o,size:i="md",...n})=>a.jsx(Ro,{...n,ref:o,className:ko("container",r),role:"status","aria-label":e,$size:i}),ke=A.newClassNameGetter("autocomplete"),Lo=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",value:p,onChange:h,onSearch:g,debounceMs:f=300,minChars:O=1,noResultsMessage:m="No results found",...y})=>{const[S,v]=u.useState((p==null?void 0:p.value)??""),[x,$]=u.useState([]),[b,L]=u.useState(!1),[j,N]=u.useState(!1),[H,z]=u.useState(!1),_=u.useRef(null),E=u.useRef(null);u.useEffect(()=>{(p==null?void 0:p.value)!==void 0&&v(p.value)},[p==null?void 0:p.value]);const w=u.useCallback(async T=>{if(T.length<O){$([]),z(!1);return}L(!0),z(!0);try{const F=await g(T);$(F),N(!0)}catch{$([])}finally{L(!1)}},[g,O]),M=u.useCallback(T=>{const F=T.target.value;v(F),h==null||h({value:F,image_url:null}),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{w(F)},f)},[h,w,f]),C=u.useCallback(T=>{v(T.value),$([]),N(!1),z(!1),h==null||h({value:T.value,image_url:T.image_url})},[h]),I=u.useCallback(()=>{setTimeout(()=>{N(!1)},150)},[]),k=u.useCallback(()=>{x.length>0&&N(!0)},[x.length]);return u.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]),a.jsxs(go,{ref:_,className:ke("container",e),$fullWidth:!!i,children:[n&&a.jsx(fo,{variant:d,className:ke("label",r==null?void 0:r.label),children:n}),a.jsxs(xo,{children:[a.jsx(Oo,{...y,ref:l,type:"text",value:S,onChange:M,onBlur:I,onFocus:k,disabled:o,$size:c,$variant:d,className:ke("input",r==null?void 0:r.input)}),b&&a.jsx($o,{children:a.jsx(Lt,{size:"xs"})})]}),a.jsx(So,{$open:j&&H,className:ke("dropdown",r==null?void 0:r.dropdown),children:x.length>0?x.map(T=>a.jsxs(yo,{onClick:()=>C(T),className:ke("item",r==null?void 0:r.item),children:[T.image_url&&a.jsx(vo,{src:T.image_url,alt:T.value}),a.jsx(Co,{children:T.value})]},T.id)):!b&&a.jsx(mo,{children:m})})]})},_t={compact:{height:"32px",padding:"0 8px",radius:"12px",iconSize:"16px"},default:{height:"40px",padding:"0 12px",radius:"16px",iconSize:"20px"}},Mt={normal:{background:{static:t.COLORS["steel-blue"],hover:t.alpha(t.COLORS["steel-blue"],90),active:t.alpha(t.COLORS["steel-blue"],80),disabled:t.alpha(t.COLORS["steel-blue"],50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},system:{background:{static:t.COLORS.black,hover:t.alpha(t.COLORS.black,90),active:t.alpha(t.COLORS.black,80),disabled:t.alpha(t.COLORS.black,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},success:{background:{static:t.COLORS.green,hover:t.alpha(t.COLORS.green,90),active:t.alpha(t.COLORS.green,80),disabled:t.alpha(t.COLORS.green,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},warning:{background:{static:t.COLORS.yellow,hover:t.alpha(t.COLORS.yellow,90),active:t.alpha(t.COLORS.yellow,80),disabled:t.alpha(t.COLORS.yellow,50)},color:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.COLORS.black},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},danger:{background:{static:t.COLORS.red,hover:t.alpha(t.COLORS.red,90),active:t.alpha(t.COLORS.red,80),disabled:t.alpha(t.COLORS.red,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},transparent:{background:{static:t.alpha(t.COLORS["iron-grey"],1),hover:t.alpha(t.COLORS["iron-grey"],5),active:t.alpha(t.COLORS["iron-grey"],10),disabled:t.alpha(t.COLORS["iron-grey"],5)},color:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,30)},borderColor:{static:t.alpha(t.COLORS["iron-grey"],20),hover:t.alpha(t.COLORS["iron-grey"],20),active:t.alpha(t.COLORS["iron-grey"],20),disabled:t.alpha(t.COLORS["iron-grey"],10)}}},J=e=>{const r=Mt[e];return r||Mt.normal},re=e=>{const r=_t[e];return r||_t.default},Po=e=>e?"auto":"fit-content",zo=s.button`
|
|
278
274
|
display: flex;
|
|
279
275
|
gap: 6px;
|
|
280
276
|
text-decoration: none;
|
|
@@ -300,10 +296,6 @@
|
|
|
300
296
|
border-color: ${e=>J(e.$variant).borderColor.active};
|
|
301
297
|
}
|
|
302
298
|
|
|
303
|
-
&:focus-visible {
|
|
304
|
-
outline-color: ${t.alpha(t.COLORS["iron-grey"],30)};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
299
|
&:disabled {
|
|
308
300
|
cursor: not-allowed;
|
|
309
301
|
color: ${e=>J(e.$variant).color.disabled};
|
|
@@ -350,16 +342,12 @@
|
|
|
350
342
|
border-radius: 16px;
|
|
351
343
|
border: ${e=>e.$border?`1px solid ${t.alpha(t.COLORS["iron-grey"],15)}`:"none"};
|
|
352
344
|
box-shadow: ${e=>e.$shadow?`0 2px 8px ${t.alpha(t.COLORS.black,10)}`:"none"};
|
|
353
|
-
`,_o=A.newClassNameGetter("card"),Mo=({children:e,className:r,ref:o,border:i=!1,shadow:n=!1,...l})=>a.jsx(Do,{...l,ref:o,className:_o("container",r),$border:i,$shadow:n,children:e}),Yt={normal:{box:{border:t.alpha(t.COLORS["iron-grey"],30),borderChecked:t.COLORS["iron-grey"],background:t.COLORS.white,backgroundChecked:t.COLORS.black,focusShadow:t.alpha(t.COLORS["iron-grey"],30)},label:t.COLORS.black,icon:t.COLORS.white},error:{box:{border:t.COLORS.red,borderChecked:t.COLORS.red,background:t.COLORS.white,backgroundChecked:t.COLORS.red,focusShadow:t.alpha(t.COLORS.red,30)},label:t.COLORS.red,icon:t.COLORS.white}},
|
|
345
|
+
`,_o=A.newClassNameGetter("card"),Mo=({children:e,className:r,ref:o,border:i=!1,shadow:n=!1,...l})=>a.jsx(Do,{...l,ref:o,className:_o("container",r),$border:i,$shadow:n,children:e}),Yt={normal:{box:{border:t.alpha(t.COLORS["iron-grey"],30),borderChecked:t.COLORS["iron-grey"],background:t.COLORS.white,backgroundChecked:t.COLORS.black,focusShadow:t.alpha(t.COLORS["iron-grey"],30)},label:t.COLORS.black,icon:t.COLORS.white},error:{box:{border:t.COLORS.red,borderChecked:t.COLORS.red,background:t.COLORS.white,backgroundChecked:t.COLORS.red,focusShadow:t.alpha(t.COLORS.red,30)},label:t.COLORS.red,icon:t.COLORS.white}},ye=e=>Yt[e]??Yt.normal,Fo=s.label`
|
|
354
346
|
display: inline-flex;
|
|
355
347
|
align-items: flex-start;
|
|
356
348
|
gap: 8px;
|
|
357
349
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
358
350
|
opacity: ${e=>e.$disabled?.5:1};
|
|
359
|
-
|
|
360
|
-
&:has(input:focus-visible) > span:first-of-type {
|
|
361
|
-
box-shadow: 0 0 0 2px ${e=>ge(e.$variant).box.focusShadow};
|
|
362
|
-
}
|
|
363
351
|
`,Bo=s.input`
|
|
364
352
|
position: absolute;
|
|
365
353
|
opacity: 0;
|
|
@@ -375,8 +363,8 @@
|
|
|
375
363
|
height: 18px;
|
|
376
364
|
border-radius: 6px;
|
|
377
365
|
border: 1.5px solid
|
|
378
|
-
${e=>e.$checked||e.$indeterminate?
|
|
379
|
-
background-color: ${e=>e.$checked||e.$indeterminate?
|
|
366
|
+
${e=>e.$checked||e.$indeterminate?ye(e.$variant).box.borderChecked:ye(e.$variant).box.border};
|
|
367
|
+
background-color: ${e=>e.$checked||e.$indeterminate?ye(e.$variant).box.backgroundChecked:ye(e.$variant).box.background};
|
|
380
368
|
transition:
|
|
381
369
|
border-color 0.15s ease,
|
|
382
370
|
background-color 0.15s ease,
|
|
@@ -385,7 +373,7 @@
|
|
|
385
373
|
display: inline-flex;
|
|
386
374
|
align-items: center;
|
|
387
375
|
justify-content: center;
|
|
388
|
-
color: ${e=>
|
|
376
|
+
color: ${e=>ye(e.$variant).icon};
|
|
389
377
|
opacity: ${e=>e.$visible?1:0};
|
|
390
378
|
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
391
379
|
transition:
|
|
@@ -400,7 +388,7 @@
|
|
|
400
388
|
font-size: 14px;
|
|
401
389
|
font-weight: 500;
|
|
402
390
|
line-height: 1.4;
|
|
403
|
-
color: ${e=>
|
|
391
|
+
color: ${e=>ye(e.$variant).label};
|
|
404
392
|
user-select: none;
|
|
405
393
|
|
|
406
394
|
a {
|
|
@@ -412,15 +400,15 @@
|
|
|
412
400
|
text-decoration: none;
|
|
413
401
|
}
|
|
414
402
|
}
|
|
415
|
-
`,
|
|
403
|
+
`,Le=A.newClassNameGetter("checkbox"),tt=({checked:e,className:r,classnames:o,disabled:i,indeterminate:n=!1,label:l,onChange:c,ref:d,variant:p="normal",...h})=>a.jsxs(Fo,{className:Le("container",r),$disabled:!!i,$variant:p,children:[a.jsx(Bo,{...h,ref:d,type:"checkbox",className:Le("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:c}),a.jsx(Yo,{className:Le("box",o==null?void 0:o.box),$checked:e,$indeterminate:n,$variant:p,children:a.jsx(Ho,{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(Vo,{className:Le("label",o==null?void 0:o.label),$variant:p,children:l})]}),Ht={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},he=e=>Ht[e]??Ht.normal,Go=s.label`
|
|
416
404
|
display: grid;
|
|
417
405
|
grid-template-columns: auto 1fr;
|
|
418
406
|
align-items: start;
|
|
419
407
|
gap: 8px;
|
|
420
408
|
padding: 12px;
|
|
421
|
-
background-color: ${e=>{const r=
|
|
409
|
+
background-color: ${e=>{const r=he(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
422
410
|
border: 1px solid
|
|
423
|
-
${e=>{const r=
|
|
411
|
+
${e=>{const r=he(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
424
412
|
border-radius: 12px;
|
|
425
413
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
426
414
|
transition:
|
|
@@ -430,12 +418,7 @@
|
|
|
430
418
|
min-width: 0;
|
|
431
419
|
|
|
432
420
|
&:hover:not([data-disabled='true']) {
|
|
433
|
-
border-color: ${e=>{const r=
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
&:has(:focus-visible) {
|
|
437
|
-
outline: none;
|
|
438
|
-
box-shadow: 0 0 0 3px ${e=>ue(e.$variant).focusRing};
|
|
421
|
+
border-color: ${e=>{const r=he(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
439
422
|
}
|
|
440
423
|
|
|
441
424
|
.vacano_checkbox_container {
|
|
@@ -460,19 +443,19 @@
|
|
|
460
443
|
font-size: 14px;
|
|
461
444
|
font-weight: 500;
|
|
462
445
|
line-height: 1.4;
|
|
463
|
-
color: ${e=>
|
|
446
|
+
color: ${e=>he(e.$variant).label.static};
|
|
464
447
|
|
|
465
448
|
label[data-disabled='true'] & {
|
|
466
|
-
color: ${e=>
|
|
449
|
+
color: ${e=>he(e.$variant).label.disabled};
|
|
467
450
|
}
|
|
468
451
|
`,qo=s.span`
|
|
469
452
|
font-size: 12px;
|
|
470
453
|
font-weight: 400;
|
|
471
454
|
line-height: 1.4;
|
|
472
|
-
color: ${e=>
|
|
455
|
+
color: ${e=>he(e.$variant).description.static};
|
|
473
456
|
|
|
474
457
|
label[data-disabled='true'] & {
|
|
475
|
-
color: ${e=>
|
|
458
|
+
color: ${e=>he(e.$variant).description.disabled};
|
|
476
459
|
}
|
|
477
460
|
`,He=A.newClassNameGetter("checkbox-card"),Ko=({checked:e,className:r,classnames:o,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...g})=>a.jsxs(Go,{className:He("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(Wo,{...g,ref:p,type:"checkbox",checked:e,disabled:n,onChange:d}),a.jsx(tt,{className:o==null?void 0:o.checkbox,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(Xo,{className:He("content",o==null?void 0:o.content),children:[a.jsx(Uo,{className:He("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(qo,{className:He("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),Vt={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},Zo=s.div`
|
|
478
461
|
display: flex;
|
|
@@ -525,7 +508,7 @@
|
|
|
525
508
|
`,oi=s.span`
|
|
526
509
|
flex: 1 0 auto;
|
|
527
510
|
text-align: center;
|
|
528
|
-
`,lt=A.newClassNameGetter("chip"),Qe=({children:e,className:r,classnames:o,deletable:i,onDelete:n,ref:l,variant:c="gray",...d})=>a.jsxs(ti,{...d,ref:l,className:lt("container",r),$variant:c,$deletable:!!i,children:[a.jsx(oi,{className:lt("label",o==null?void 0:o.label),children:e}),i&&a.jsx(ri,{type:"button",className:lt("delete",o==null?void 0:o.delete),$variant:c,onClick:n,children:a.jsx(a.X,{})})]}),ii="Confirm",ni="Cancel",ai=
|
|
511
|
+
`,lt=A.newClassNameGetter("chip"),Qe=({children:e,className:r,classnames:o,deletable:i,onDelete:n,ref:l,variant:c="gray",...d})=>a.jsxs(ti,{...d,ref:l,className:lt("container",r),$variant:c,$deletable:!!i,children:[a.jsx(oi,{className:lt("label",o==null?void 0:o.label),children:e}),i&&a.jsx(ri,{type:"button",className:lt("delete",o==null?void 0:o.delete),$variant:c,onClick:n,children:a.jsx(a.X,{})})]}),ii="Confirm",ni="Cancel",ai=oe.keyframes`
|
|
529
512
|
from {
|
|
530
513
|
opacity: 0;
|
|
531
514
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -534,7 +517,7 @@
|
|
|
534
517
|
opacity: 1;
|
|
535
518
|
transform: translateX(-50%) translateY(0);
|
|
536
519
|
}
|
|
537
|
-
`,li=
|
|
520
|
+
`,li=oe.keyframes`
|
|
538
521
|
from {
|
|
539
522
|
opacity: 1;
|
|
540
523
|
transform: translateX(-50%) translateY(0);
|
|
@@ -569,36 +552,36 @@
|
|
|
569
552
|
display: flex;
|
|
570
553
|
align-items: center;
|
|
571
554
|
gap: 8px;
|
|
572
|
-
`,
|
|
555
|
+
`,Pe=A.newClassNameGetter("confirmation"),pi=({cancelBindings:e,cancelLabel:r=ni,className:o,classnames:i,confirmLabel:n=ii,loading:l=!1,message:c,onCancel:d,onConfirm:p,open:h=!0,ref:g,submitBindings:f,...O})=>h?a.jsxs(di,{...O,ref:g,className:Pe("container",o),$open:h,children:[a.jsx(ci,{className:Pe("message",i==null?void 0:i.message),children:c}),a.jsxs(si,{className:Pe("actions",i==null?void 0:i.actions),children:[a.jsx(_e,{variant:"system",size:"compact",onClick:d,keyBindings:e,className:Pe("cancel-button",i==null?void 0:i.cancelButton),children:r}),a.jsx(_e,{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`},ui=s.div`
|
|
573
556
|
width: 100%;
|
|
574
557
|
|
|
575
558
|
${t.mediaUp("sm")} {
|
|
576
|
-
max-width: ${
|
|
559
|
+
max-width: ${ze.sm};
|
|
577
560
|
}
|
|
578
561
|
|
|
579
562
|
${t.mediaUp("md")} {
|
|
580
|
-
max-width: ${
|
|
563
|
+
max-width: ${ze.md};
|
|
581
564
|
}
|
|
582
565
|
|
|
583
566
|
${t.mediaUp("lg")} {
|
|
584
|
-
max-width: ${
|
|
567
|
+
max-width: ${ze.lg};
|
|
585
568
|
}
|
|
586
569
|
|
|
587
570
|
${t.mediaUp("xl")} {
|
|
588
|
-
max-width: ${
|
|
571
|
+
max-width: ${ze.xl};
|
|
589
572
|
}
|
|
590
573
|
|
|
591
574
|
${t.mediaUp("2xl")} {
|
|
592
|
-
max-width: ${
|
|
575
|
+
max-width: ${ze["2xl"]};
|
|
593
576
|
}
|
|
594
|
-
`,hi=A.newClassNameGetter("container"),bi=({children:e,className:r,ref:o,...i})=>a.jsx(ui,{...i,ref:o,className:hi("container",r),children:e}),Je={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},
|
|
577
|
+
`,hi=A.newClassNameGetter("container"),bi=({children:e,className:r,ref:o,...i})=>a.jsx(ui,{...i,ref:o,className:hi("container",r),children:e}),Je={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},je={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=36,rt=2,gi=12,vr=(e,r,o="en")=>{const i=e.getFullYear(),n=e.getMonth(),l=e.getDate(),c=e.getHours(),d=e.getMinutes(),p=e.getSeconds(),h=c%12||12,g=c>=12,f=new Intl.DateTimeFormat(o,{month:"long"}).format(e),O=new Intl.DateTimeFormat(o,{month:"short"}).format(e),m=new Intl.DateTimeFormat(o,{weekday:"long"}).format(e),y=new Intl.DateTimeFormat(o,{weekday:"short"}).format(e),S=L=>L.toString().padStart(2,"0"),v=L=>L.toString().padStart(2," "),x=L=>`\0${L}\0`,$=[["2006","YEARFOUR",i.toString()],["January","MONTHLONG",f],["Monday","WEEKDAYLONG",m],["Jan","MONTHSHORT",O],["Mon","WEEKDAYSHORT",y],["06","YEARTWO",i.toString().slice(-2)],["01","MONTHPAD",S(n+1)],["_2","DAYSPACE",v(l)],["02","DAYPAD",S(l)],["15","HOURTWENTYFOUR",S(c)],["03","HOURTWELVEPAD",S(h)],["04","MINUTE",S(d)],["05","SECOND",S(p)],["PM","AMPMUP",g?"PM":"AM"],["pm","AMPMLOW",g?"pm":"am"],["1","MONTH",(n+1).toString()],["2","DAY",l.toString()],["3","HOURTWELVE",h.toString()]];let b=r;for(const[L,j]of $)b=b.split(L).join(x(j));for(const[,L,j]of $)b=b.split(x(L)).join(j);return b},fi=(e,r)=>new Date(e,r+1,0).getDate(),xi=(e,r)=>new Date(e,r,1).getDay(),Oi=(e,r,o=1)=>{const i=fi(e,r);let l=xi(e,r)-o;l<0&&(l+=7);const c=[];for(let d=0;d<l;d++)c.push(null);for(let d=1;d<=i;d++)c.push(d);for(;c.length<42;)c.push(null);return c},$i=(e,r=1)=>{const o=[];for(let i=0;i<7;i++){const n=(r+i)%7,l=new Date(2024,0,7+n);o.push(new Intl.DateTimeFormat(e,{weekday:"short"}).format(l))}return o},Si=e=>{const r=[];for(let o=0;o<12;o++){const i=new Date(2024,o,1);r.push(new Intl.DateTimeFormat(e,{month:"short"}).format(i))}return r},Wt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate(),Xt=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth(),yi=(e,r)=>e.getFullYear()===r.getFullYear(),Ut=(e,r,o,i,n)=>{const l=new Date(e,r,o);if(i){const c=new Date(i.getFullYear(),i.getMonth(),i.getDate());if(l<c)return!0}if(n){const c=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(l>c)return!0}return!1},qt=(e,r,o,i)=>{if(o){const n=o.getFullYear(),l=o.getMonth();if(e<n||e===n&&r<l)return!0}if(i){const n=i.getFullYear(),l=i.getMonth();if(e>n||e===n&&r>l)return!0}return!1},Kt=(e,r,o)=>!!(r&&e<r.getFullYear()||o&&e>o.getFullYear()),vi=(e,r=12)=>{const o=e-Math.floor(r/2),i=[];for(let n=0;n<r;n++)i.push(o+n);return i},Ci=e=>{switch(e){case"date":return"02.01.2006";case"month":return"January 2006";case"year":return"2006"}},mi=s.div`
|
|
595
578
|
position: relative;
|
|
596
579
|
display: inline-flex;
|
|
597
580
|
flex-direction: column;
|
|
598
581
|
gap: 2px;
|
|
599
582
|
min-width: 180px;
|
|
600
583
|
width: ${({$fullWidth:e})=>e?"100%":"fit-content"};
|
|
601
|
-
`,wi=s(
|
|
584
|
+
`,wi=s(ne)`
|
|
602
585
|
margin-left: 6px;
|
|
603
586
|
`,Ri=s.button`
|
|
604
587
|
display: flex;
|
|
@@ -614,17 +597,13 @@
|
|
|
614
597
|
height: ${({$size:e})=>Je[e].height};
|
|
615
598
|
padding: ${({$size:e})=>Je[e].padding};
|
|
616
599
|
border-radius: ${({$size:e})=>Je[e].radius};
|
|
617
|
-
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?
|
|
600
|
+
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?je[e].color[r?"disabled":"static"]:je[e].placeholder[r?"disabled":"static"]};
|
|
618
601
|
border: 1px solid
|
|
619
|
-
${({$variant:e,$disabled:r})=>
|
|
620
|
-
background-color: ${({$variant:e,$disabled:r})=>
|
|
621
|
-
|
|
622
|
-
&:focus-visible {
|
|
623
|
-
outline: 2px solid ${({$variant:e})=>ye[e].focus};
|
|
624
|
-
}
|
|
602
|
+
${({$variant:e,$disabled:r})=>je[e].border[r?"disabled":"static"]};
|
|
603
|
+
background-color: ${({$variant:e,$disabled:r})=>je[e].background[r?"disabled":"static"]};
|
|
625
604
|
|
|
626
605
|
${({$open:e,$variant:r})=>e&&`
|
|
627
|
-
outline: 2px solid ${
|
|
606
|
+
outline: 2px solid ${je[r].focus};
|
|
628
607
|
`}
|
|
629
608
|
`,ki=s.span`
|
|
630
609
|
flex: 1;
|
|
@@ -688,11 +667,7 @@
|
|
|
688
667
|
&:hover {
|
|
689
668
|
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
690
669
|
}
|
|
691
|
-
|
|
692
|
-
&:focus-visible {
|
|
693
|
-
outline: 2px solid ${t.alpha(t.COLORS.black,20)};
|
|
694
|
-
}
|
|
695
|
-
`,ve=s.button`
|
|
670
|
+
`,Oe=s.button`
|
|
696
671
|
display: flex;
|
|
697
672
|
align-items: center;
|
|
698
673
|
justify-content: center;
|
|
@@ -708,10 +683,6 @@
|
|
|
708
683
|
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
709
684
|
}
|
|
710
685
|
|
|
711
|
-
&:focus-visible {
|
|
712
|
-
outline: 2px solid ${t.alpha(t.COLORS.black,20)};
|
|
713
|
-
}
|
|
714
|
-
|
|
715
686
|
&:disabled {
|
|
716
687
|
opacity: 0.3;
|
|
717
688
|
cursor: not-allowed;
|
|
@@ -725,28 +696,28 @@
|
|
|
725
696
|
gap: 4px;
|
|
726
697
|
`,ji=s.div`
|
|
727
698
|
display: grid;
|
|
728
|
-
grid-template-columns: repeat(7, ${
|
|
699
|
+
grid-template-columns: repeat(7, ${ie}px);
|
|
729
700
|
gap: ${rt}px;
|
|
730
701
|
margin-bottom: 4px;
|
|
731
702
|
`,Ei=s.div`
|
|
732
703
|
display: flex;
|
|
733
704
|
align-items: center;
|
|
734
705
|
justify-content: center;
|
|
735
|
-
height: ${
|
|
706
|
+
height: ${ie}px;
|
|
736
707
|
font-size: 12px;
|
|
737
708
|
font-weight: 500;
|
|
738
709
|
color: ${t.alpha(t.COLORS.black,50)};
|
|
739
710
|
text-transform: uppercase;
|
|
740
711
|
`,Ti=s.div`
|
|
741
712
|
display: grid;
|
|
742
|
-
grid-template-columns: repeat(7, ${
|
|
713
|
+
grid-template-columns: repeat(7, ${ie}px);
|
|
743
714
|
gap: ${rt}px;
|
|
744
715
|
`,Ni=s.button`
|
|
745
716
|
display: flex;
|
|
746
717
|
align-items: center;
|
|
747
718
|
justify-content: center;
|
|
748
|
-
width: ${
|
|
749
|
-
height: ${
|
|
719
|
+
width: ${ie}px;
|
|
720
|
+
height: ${ie}px;
|
|
750
721
|
border: none;
|
|
751
722
|
border-radius: 8px;
|
|
752
723
|
font-size: 13px;
|
|
@@ -763,11 +734,6 @@
|
|
|
763
734
|
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
764
735
|
}
|
|
765
736
|
|
|
766
|
-
&:focus-visible {
|
|
767
|
-
outline: 2px solid ${t.alpha(t.COLORS.black,30)};
|
|
768
|
-
outline-offset: 1px;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
737
|
&:disabled {
|
|
772
738
|
cursor: not-allowed;
|
|
773
739
|
}
|
|
@@ -775,7 +741,7 @@
|
|
|
775
741
|
display: grid;
|
|
776
742
|
grid-template-columns: repeat(3, 1fr);
|
|
777
743
|
gap: 8px;
|
|
778
|
-
width: ${7*
|
|
744
|
+
width: ${7*ie+6*rt}px;
|
|
779
745
|
`,Ai=s.button`
|
|
780
746
|
display: flex;
|
|
781
747
|
align-items: center;
|
|
@@ -796,16 +762,11 @@
|
|
|
796
762
|
&:hover:not(:disabled) {
|
|
797
763
|
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
798
764
|
}
|
|
799
|
-
|
|
800
|
-
&:focus-visible {
|
|
801
|
-
outline: 2px solid ${t.alpha(t.COLORS.black,30)};
|
|
802
|
-
outline-offset: 1px;
|
|
803
|
-
}
|
|
804
765
|
`,Di=s.div`
|
|
805
766
|
display: grid;
|
|
806
767
|
grid-template-columns: repeat(3, 1fr);
|
|
807
768
|
gap: 8px;
|
|
808
|
-
width: ${7*
|
|
769
|
+
width: ${7*ie+6*rt}px;
|
|
809
770
|
`,_i=s.button`
|
|
810
771
|
display: flex;
|
|
811
772
|
align-items: center;
|
|
@@ -826,15 +787,10 @@
|
|
|
826
787
|
&:hover:not(:disabled) {
|
|
827
788
|
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
828
789
|
}
|
|
829
|
-
|
|
830
|
-
&:focus-visible {
|
|
831
|
-
outline: 2px solid ${t.alpha(t.COLORS.black,30)};
|
|
832
|
-
outline-offset: 1px;
|
|
833
|
-
}
|
|
834
790
|
`,Mi=s.div`
|
|
835
|
-
width: ${
|
|
836
|
-
height: ${
|
|
837
|
-
`,K=A.newClassNameGetter("date-picker"),Ve=4,Fi=300,Bi=({value:e,onChange:r,mode:o="date",displayFormat:i,placeholder:n,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:p,size:h="default",variant:g="normal",disabled:f=!1,fullWidth:O=!1,label:m,portalRenderNode:y,open:S,onOpen:v,onClose:x,className:$,classnames:b,ref:L,...j})=>{const N=u.useMemo(()=>new Date,[]),[H,z]=u.useState(!1),[_,E]=u.useState({top:0,left:0}),[w,M]=u.useState("bottom"),[C,I]=u.useState(()=>o==="year"?"years":o==="month"?"months":"days"),[k,T]=u.useState(()=>e??N),[F,B]=u.useState(()=>((e==null?void 0:e.getFullYear())??N.getFullYear())-6),V=u.useRef(null),P=u.useRef(null),D=u.useRef(null),U=S!==void 0,q=U?S:H
|
|
791
|
+
width: ${ie}px;
|
|
792
|
+
height: ${ie}px;
|
|
793
|
+
`,K=A.newClassNameGetter("date-picker"),Ve=4,Fi=300,Bi=({value:e,onChange:r,mode:o="date",displayFormat:i,placeholder:n,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:p,size:h="default",variant:g="normal",disabled:f=!1,fullWidth:O=!1,label:m,portalRenderNode:y,open:S,onOpen:v,onClose:x,className:$,classnames:b,ref:L,...j})=>{const N=u.useMemo(()=>new Date,[]),[H,z]=u.useState(!1),[_,E]=u.useState({top:0,left:0}),[w,M]=u.useState("bottom"),[C,I]=u.useState(()=>o==="year"?"years":o==="month"?"months":"days"),[k,T]=u.useState(()=>e??N),[F,B]=u.useState(()=>((e==null?void 0:e.getFullYear())??N.getFullYear())-6),V=u.useRef(null),P=u.useRef(null),D=u.useRef(null),U=S!==void 0,q=U?S:H,fe=i??Ci(o),Me=u.useMemo(()=>$i(l,c),[l,c]),ot=u.useMemo(()=>Si(l),[l]),_r=u.useMemo(()=>Oi(k.getFullYear(),k.getMonth(),c),[k,c]),Fe=u.useMemo(()=>vi(F+6,12),[F]),zt=u.useMemo(()=>e?vr(e,fe,l):null,[e,fe,l]),Mr=n??fe.replace(/2006|06|January|Jan|01|02/g,"__"),Ce=u.useCallback(()=>{var we;if(!P.current)return;const R=P.current.getBoundingClientRect(),Y=((we=D.current)==null?void 0:we.offsetHeight)??Fi,me=window.innerHeight-R.bottom-Ve,Be=R.top-Ve,xe=me<Y&&Be>me?"top":"bottom";if(M(xe),y){const Ye=xe==="bottom"?R.bottom+Ve:R.top-Y-Ve;E({top:Ye,left:R.left})}},[y]),jt=u.useCallback(()=>{if(f)return;U||z(!0),v==null||v(),I(o==="year"?"years":o==="month"?"months":"days");const R=e??N;T(R),B(R.getFullYear()-6)},[f,U,v,o,e,N]),Z=u.useCallback(()=>{U||z(!1),x==null||x()},[U,x]),Fr=u.useCallback(()=>{q?Z():jt()},[q,Z,jt]),Br=u.useCallback(R=>{const Y=new Date(k.getFullYear(),k.getMonth(),R);r==null||r(Y),Z()},[k,r,Z]),Yr=u.useCallback(R=>{if(o==="month"){const Y=new Date(k.getFullYear(),R,1);r==null||r(Y),Z()}else T(new Date(k.getFullYear(),R,1)),I("days")},[o,k,r,Z]),Hr=u.useCallback(R=>{if(o==="year"){const Y=new Date(R,0,1);r==null||r(Y),Z()}else o==="month"?(T(new Date(R,k.getMonth(),1)),I("months")):(T(new Date(R,k.getMonth(),1)),I("months"))},[o,k,r,Z]),Vr=u.useCallback(()=>{T(R=>new Date(R.getFullYear(),R.getMonth()-1,1))},[]),Gr=u.useCallback(()=>{T(R=>new Date(R.getFullYear(),R.getMonth()+1,1))},[]),Wr=u.useCallback(()=>{T(R=>new Date(R.getFullYear()-1,R.getMonth(),1))},[]),Xr=u.useCallback(()=>{T(R=>new Date(R.getFullYear()+1,R.getMonth(),1))},[]),Ur=u.useCallback(()=>{B(R=>R-12)},[]),qr=u.useCallback(()=>{B(R=>R+12)},[]),Et=u.useCallback(()=>{C==="days"?I("months"):C==="months"&&I("years")},[C]);u.useLayoutEffect(()=>{q&&Ce()},[q,Ce]),u.useEffect(()=>{const R=xe=>{const we=xe.target,Ye=V.current&&!V.current.contains(we),to=D.current&&!D.current.contains(we);y?Ye&&to&&Z():Ye&&Z()},Y=xe=>{xe.key==="Escape"&&Z()},me=()=>{q&&y&&Ce()},Be=()=>{q&&y&&Ce()};return q&&(document.addEventListener("mousedown",R),document.addEventListener("keydown",Y),y&&(window.addEventListener("scroll",me,!0),window.addEventListener("resize",Be))),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",Y),window.removeEventListener("scroll",me,!0),window.removeEventListener("resize",Be)}},[q,Z,y,Ce]);const Kr=Je[h].iconSize,Zr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(ct,{onClick:Et,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(k)}),a.jsxs(st,{children:[a.jsx(Oe,{onClick:Vr,type:"button","aria-label":"Previous month",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Gr,type:"button","aria-label":"Next month",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(ji,{children:Me.map((R,Y)=>a.jsx(Ei,{children:R},Y))}),a.jsx(Ti,{className:K("grid",b==null?void 0:b.grid),children:_r.map((R,Y)=>R===null?a.jsx(Mi,{},Y):a.jsx(Ni,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Wt(e,new Date(k.getFullYear(),k.getMonth(),R)):!1,$today:Wt(N,new Date(k.getFullYear(),k.getMonth(),R)),$disabled:Ut(k.getFullYear(),k.getMonth(),R,d,p),disabled:Ut(k.getFullYear(),k.getMonth(),R,d,p),onClick:()=>Br(R),children:R},Y))})]}),Jr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(ct,{onClick:Et,type:"button",children:k.getFullYear()}),a.jsxs(st,{children:[a.jsx(Oe,{onClick:Wr,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:Xr,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Ii,{className:K("grid",b==null?void 0:b.grid),children:ot.map((R,Y)=>a.jsx(Ai,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Xt(e,new Date(k.getFullYear(),Y,1)):!1,$current:Xt(N,new Date(k.getFullYear(),Y,1)),$disabled:qt(k.getFullYear(),Y,d,p),disabled:qt(k.getFullYear(),Y,d,p),onClick:()=>Yr(Y),children:R},Y))})]}),Qr=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:K("header",b==null?void 0:b.header),children:[a.jsxs(ct,{type:"button",style:{cursor:"default"},children:[Fe[0]," - ",Fe[Fe.length-1]]}),a.jsxs(st,{children:[a.jsx(Oe,{onClick:Ur,type:"button","aria-label":"Previous years",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Oe,{onClick:qr,type:"button","aria-label":"Next years",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Di,{className:K("grid",b==null?void 0:b.grid),children:Fe.map(R=>a.jsx(_i,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?yi(e,new Date(R,0,1)):!1,$current:N.getFullYear()===R,$disabled:Kt(R,d,p),disabled:Kt(R,d,p),onClick:()=>Hr(R),children:R},R))})]}),Tt=()=>{switch(C){case"days":return Zr();case"months":return Jr();case"years":return Qr()}},eo=y?ge.createPortal(a.jsx(zi,{ref:D,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),style:{top:_.top,left:_.left},children:Tt()}),y):a.jsx(Pi,{ref:D,$open:q,$position:w,className:K("calendar",b==null?void 0:b.calendar),children:Tt()});return a.jsxs(mi,{...j,ref:L??V,$fullWidth:O,className:K("container",$),children:[m&&a.jsx(wi,{children:m}),a.jsxs(Ri,{ref:P,type:"button",onClick:Fr,disabled:f,$size:h,$variant:g,$disabled:f,$open:q,$hasValue:!!zt,className:K("trigger",b==null?void 0:b.trigger),children:[a.jsx(ki,{children:zt??Mr}),a.jsx(Li,{$open:q,children:a.jsx(a.ChevronDown,{size:Kr})})]}),eo]})},Yi={left:t.KEYFRAMES.slideInLeft,right:t.KEYFRAMES.slideInRight,top:t.KEYFRAMES.slideInTop,bottom:t.KEYFRAMES.slideInBottom},Hi=(e,r)=>{switch(e){case"left":return`
|
|
838
794
|
top: 0;
|
|
839
795
|
left: 0;
|
|
840
796
|
height: 100%;
|
|
@@ -861,7 +817,7 @@
|
|
|
861
817
|
box-shadow: 0 4px 24px ${t.alpha(t.COLORS.black,20)};
|
|
862
818
|
${e=>Hi(e.$position,e.$size)}
|
|
863
819
|
animation: ${e=>Yi[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
864
|
-
`,Gi=A.newClassNameGetter("drawer"),Wi=({animated:e,children:r,className:o,open:i,position:n="right",ref:l,size:c="400px",...d})=>i?
|
|
820
|
+
`,Gi=A.newClassNameGetter("drawer"),Wi=({animated:e,children:r,className:o,open:i,position:n="right",ref:l,size:c="400px",...d})=>i?ge.createPortal(a.jsx(Vi,{...d,ref:l,className:Gi("container",o),$animated:!!e,$position:n,$size:c,children:r}),document.body):null,Xi=s.div`
|
|
865
821
|
position: relative;
|
|
866
822
|
display: inline-block;
|
|
867
823
|
`,Ui=s.div`
|
|
@@ -896,7 +852,7 @@
|
|
|
896
852
|
opacity 0.15s ease,
|
|
897
853
|
transform 0.15s ease,
|
|
898
854
|
visibility 0.15s;
|
|
899
|
-
`,Ge=A.newClassNameGetter("dropdown"),We=4,Zi=100,Ji=({align:e="left",children:r,className:o,classnames:i,onClose:n,onOpen:l,open:c,portalRenderNode:d,ref:p,trigger:h,...g})=>{const[f,O]=u.useState(!1),[m,y]=u.useState({top:0,left:0}),[S,v]=u.useState("bottom"),x=u.useRef(null),$=u.useRef(null),b=u.useRef(null),L=c!==void 0,j=L?c:f,N=u.useCallback(()=>{var T,F;if(!$.current)return;const E=$.current.getBoundingClientRect(),w=((T=b.current)==null?void 0:T.offsetHeight)??Zi,M=((F=b.current)==null?void 0:F.offsetWidth)??160,C=window.innerHeight-E.bottom-We,I=E.top-We,k=C<w&&I>C?"top":"bottom";if(v(k),d){let B;e==="left"?B=E.left:B=E.right-M;const V=k==="bottom"?E.bottom+We:E.top-w-We;y({top:V,left:B})}},[e,d]),H=u.useCallback(()=>{L?j?n==null||n():l==null||l():O(E=>{const w=!E;return w?l==null||l():n==null||n(),w})},[L,j,n,l]),z=u.useCallback(()=>{L||O(!1),n==null||n()},[L,n]);u.useLayoutEffect(()=>{j&&N()},[j,N]),u.useEffect(()=>{const E=I=>{const k=I.target,T=x.current&&!x.current.contains(k),F=b.current&&!b.current.contains(k);d?T&&F&&z():T&&z()},w=I=>{I.key==="Escape"&&z()},M=()=>{j&&d&&N()},C=()=>{j&&d&&N()};return j&&(document.addEventListener("mousedown",E),document.addEventListener("keydown",w),d&&(window.addEventListener("scroll",M,!0),window.addEventListener("resize",C))),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",C)}},[j,z,d,N]);const _=d?
|
|
855
|
+
`,Ge=A.newClassNameGetter("dropdown"),We=4,Zi=100,Ji=({align:e="left",children:r,className:o,classnames:i,onClose:n,onOpen:l,open:c,portalRenderNode:d,ref:p,trigger:h,...g})=>{const[f,O]=u.useState(!1),[m,y]=u.useState({top:0,left:0}),[S,v]=u.useState("bottom"),x=u.useRef(null),$=u.useRef(null),b=u.useRef(null),L=c!==void 0,j=L?c:f,N=u.useCallback(()=>{var T,F;if(!$.current)return;const E=$.current.getBoundingClientRect(),w=((T=b.current)==null?void 0:T.offsetHeight)??Zi,M=((F=b.current)==null?void 0:F.offsetWidth)??160,C=window.innerHeight-E.bottom-We,I=E.top-We,k=C<w&&I>C?"top":"bottom";if(v(k),d){let B;e==="left"?B=E.left:B=E.right-M;const V=k==="bottom"?E.bottom+We:E.top-w-We;y({top:V,left:B})}},[e,d]),H=u.useCallback(()=>{L?j?n==null||n():l==null||l():O(E=>{const w=!E;return w?l==null||l():n==null||n(),w})},[L,j,n,l]),z=u.useCallback(()=>{L||O(!1),n==null||n()},[L,n]);u.useLayoutEffect(()=>{j&&N()},[j,N]),u.useEffect(()=>{const E=I=>{const k=I.target,T=x.current&&!x.current.contains(k),F=b.current&&!b.current.contains(k);d?T&&F&&z():T&&z()},w=I=>{I.key==="Escape"&&z()},M=()=>{j&&d&&N()},C=()=>{j&&d&&N()};return j&&(document.addEventListener("mousedown",E),document.addEventListener("keydown",w),d&&(window.addEventListener("scroll",M,!0),window.addEventListener("resize",C))),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",C)}},[j,z,d,N]);const _=d?ge.createPortal(a.jsx(Ki,{ref:b,$open:j,$position:S,className:Ge("content",i==null?void 0:i.content),style:{top:m.top,left:m.left},children:r}),d):a.jsx(qi,{ref:b,$align:e,$open:j,$position:S,className:Ge("content",i==null?void 0:i.content),children:r});return a.jsxs(Xi,{...g,ref:p??x,className:Ge("container",o),children:[a.jsx(Ui,{ref:$,onClick:H,className:Ge("trigger",i==null?void 0:i.trigger),children:u.cloneElement(h)}),_]})},Qi={normal:t.COLORS["iron-grey"],error:t.COLORS.red,success:t.COLORS.green,warning:t.COLORS.yellow},en=s.span`
|
|
900
856
|
display: block;
|
|
901
857
|
font-size: 12px;
|
|
902
858
|
font-weight: 500;
|
|
@@ -1176,7 +1132,7 @@
|
|
|
1176
1132
|
${Xe(r.handlerResizeTopRight[0],"tr")}
|
|
1177
1133
|
${Sn(r.root[0])}
|
|
1178
1134
|
${yn(r.sourceImage[0])}
|
|
1179
|
-
`,i=document.createElement("style");return i.innerHTML=o,document.getElementsByTagName("head")[0].prepend(i),r};let mn=0;const wn=e=>{const r=new Map,o=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(r.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...o}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(o[n]=l)}},subscribe:(i,n)=>{const l=String(++mn),c=r.get(i)||[];return r.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of r.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){r.set(n,c);return}}},unsubscribeAll:()=>{r.clear()}}},wt={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},Rn=(e={},r={})=>wn({...wt,config:{...wt.config,...e},css:Cn(r)}),kn=(e,r)=>{var O;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!i)return o.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=r.width/r.height;let p,h,g=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(r.height/r.width),g=(l-h)/2),{width:p,height:h,left:f,top:g}},Ln=(e,r,o)=>{const[i,n]=r,l=i+e>o.width?(o.width-e)/2:i,c=n+e>o.height?(o.height-e)/2:n;return[l,c]},Pn=(e,r)=>{const{config:o}=e(),i=Math.min(r.width,r.height)-o.framePadding*2,n=o.portalSize>i?i:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=Ln(n,o.portalPosition,r);return{left:l,top:c,size:n}}return o.portalPosition==="center"?{size:n,left:(r.width-n)/2,top:(r.height-n)/2}:{left:0,top:0,size:n}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const zn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerMove),o.setAttribute("data-action",te.MOVE),o},jn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},En=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Tn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Nn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},In=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.previewImage),o},An=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.preview),o.appendChild(In(e)),o},Dn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portal),o.appendChild(An(e)),o.appendChild(zn(e)),o.appendChild(Tn(e)),o.appendChild(Nn(e)),o.appendChild(jn(e)),o.appendChild(En(e)),o},_n=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portalArea),o.appendChild(Dn(e)),o},Mn=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Fn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.body),o.appendChild(Mn(e)),o.appendChild(_n(e)),o},Bn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=o.config.applyButtonLabel,i.addEventListener("click",r),i},Yn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=o.config.cancelButtonLabel,i.addEventListener("click",r),i},Hn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.footer),n.appendChild(Yn(e,o)),n.appendChild(Bn(e,r)),n},Vn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.header),o},Gn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.container),n.appendChild(Vn(e)),n.appendChild(Fn(e)),n.appendChild(Hn(e,r,o)),n},Wn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");X(n,(l=i.css)==null?void 0:l.root),n.appendChild(Gn(e,r,o)),document.body.appendChild(n)},Xn=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ae=new Map,Un={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},fe=(e,r)=>{if(Ae.has(e))return Ae.get(e);if(!r)return null;const o=r[Un[e]],i=document.querySelector(`.${o[0]}`);return Ae.set(e,i),i},qn=()=>{Ae.clear()},Kn=()=>{Ae.clear()},Zn=(e,r)=>{const o=fe("header",r.css);o&&(o.innerText=e)},Jn=(e,r)=>{const o=fe("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const i=fe("portalArea",r.css);i&&(i.style.height=`${r.frame.height}px`,i.style.width=`${r.frame.width}px`,i.style.left=`${r.frame.left}px`,i.style.top=`${r.frame.top}px`);const n=fe("portal",r.css);n&&(n.style.width=`${r.portal.size}px`,n.style.height=`${r.portal.size}px`,n.style.left=`${r.portal.left}px`,n.style.top=`${r.portal.top}px`);const l=fe("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},Qn=(e,r)=>{const o=fe("portal",r.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const i=fe("previewImage",r.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},pt=1,ea=e=>{var m,y;const r=e(),o=document.createElement("canvas"),i=r.frame.width||pt,n=r.frame.height||pt,l=r.sourceWidth/i,c=r.sourceHeight/n,d=r.portal.left*l,p=r.portal.top*c,h=Math.max(r.portal.size*Math.min(l,c),pt),g=r.config.outputSize>0?r.config.outputSize:h;o.width=g,o.height=g;const f=document.querySelector(`.${(m=r.css)==null?void 0:m.sourceImage[0]}`);f&&((y=o.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,g,g));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((S,v)=>{try{o.toBlob(x=>{if(o.remove(),!x){v(new Error(`Failed to create blob for type: image/${r.config.type}`));return}S([O,x])},`image/${r.config.type}`,r.config.compression)}catch(x){o.remove(),v(x)}})},ta=(e,r,o)=>{const{emitted:i,portal:n,frame:l,config:c}=r();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,g=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>g&&(d=g),p<f&&(p=f),p>O&&(p=O),o({portal:{...n,left:d,top:p}})},ra=(e,r,o)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=r(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let g=n.size+Math.max(p,h);return g<d.minPortalSize&&(g=d.minPortalSize),n.top+g>c.height-d.framePadding&&(g=c.height-n.top-d.framePadding),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding),o({portal:{...l,size:g}})}case te.RESIZE_TR:{let g=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return g<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,g=d.minPortalSize),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(g=n.top+n.size,f=d.framePadding),o({portal:{...l,top:f,size:g}})}case te.RESIZE_TL:{const g=Math.min(p,h);let f=n.size-g,O=n.left+g,m=n.top+g;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,m=n.top+y}if(m<d.framePadding){const y=d.framePadding-m;m=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,m=m+y,f=f-y}return o({portal:{...l,top:m,left:O,size:f}})}case te.RESIZE_BL:{let g=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return g<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,g=d.minPortalSize),g+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,g=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,g=n.left+n.size-d.framePadding),o({portal:{...l,left:f,size:g}})}default:return}},Zt=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const r=e;return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}},oa=(e,r)=>{var O,m,y;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(m=o.css)==null?void 0:m.portalArea[0]}`),l=document.querySelector(`.${(y=o.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:v}=e(),x=Zt(S);if(S.target){const $=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:v.left,top:v.top,size:v.size};r({action:$,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&r({action:null})},g=()=>{if(c=null,!d)return;const S=d;d=null;const{action:v}=e();if(v)switch(v){case te.MOVE:ta(S,e,r);break;default:ra(S,e,r)}},f=S=>{const{action:v}=e();v&&(S.preventDefault(),d=Zt(S),c===null&&(c=requestAnimationFrame(g)))};return l&&(l.addEventListener("mouseup",h),l.addEventListener("touchend",h),l.addEventListener("touchcancel",h)),i&&(i.addEventListener("mousedown",p),i.addEventListener("touchstart",p,{passive:!1})),n&&(n.addEventListener("mousemove",f),n.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",h),l.removeEventListener("touchend",h),l.removeEventListener("touchcancel",h)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},Jt=1024*1024,ia=(e,r)=>{if(!r.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${r.allowedTypes.join(", ")}`;if(r.maxFileSize>0&&e.size>r.maxFileSize){const o=(r.maxFileSize/Jt).toFixed(2);return`File size (${(e.size/Jt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},na=(e,r,o,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=r(),g=ia(p,h);if(g){d(g),e.target.value="";return}const f=new FileReader;let O=null;const m=()=>{var b;const x=r(),$=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);$&&($.remove(),document.removeEventListener("keydown",y),O==null||O(),Kn(),l(),o(wt))},y=x=>{x.key==="Escape"&&r().sourceBase64&&S(x)},S=x=>{x.preventDefault(),m()},v=x=>{x.preventDefault();const $=r();ea(r).then(([b,L])=>{i(b,L,$),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const $=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}$.src=x.target.result,$.onerror=()=>{d("Failed to load image")},$.onload=()=>{var j;Wn(r,v,S),qn(),n("fileName",Zn),n("sourceBase64",Jn),n("portal",Qn);const b=kn(r,$),L=Pn(r,b);o({frame:b,portal:L,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:$.height,sourceWidth:$.width}),O=oa(r,o),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},aa=(e,r,o,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=Rn(r,o),p=Xn(h=>na(h,n,l,e,c,d,i));return{open:()=>p.click()}},ce={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Qt="vacano-image-cropper-styles",la=`
|
|
1135
|
+
`,i=document.createElement("style");return i.innerHTML=o,document.getElementsByTagName("head")[0].prepend(i),r};let mn=0;const wn=e=>{const r=new Map,o=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(r.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...o}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(o[n]=l)}},subscribe:(i,n)=>{const l=String(++mn),c=r.get(i)||[];return r.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of r.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){r.set(n,c);return}}},unsubscribeAll:()=>{r.clear()}}},wt={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},Rn=(e={},r={})=>wn({...wt,config:{...wt.config,...e},css:Cn(r)}),kn=(e,r)=>{var O;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!i)return o.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=r.width/r.height;let p,h,g=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(r.height/r.width),g=(l-h)/2),{width:p,height:h,left:f,top:g}},Ln=(e,r,o)=>{const[i,n]=r,l=i+e>o.width?(o.width-e)/2:i,c=n+e>o.height?(o.height-e)/2:n;return[l,c]},Pn=(e,r)=>{const{config:o}=e(),i=Math.min(r.width,r.height)-o.framePadding*2,n=o.portalSize>i?i:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=Ln(n,o.portalPosition,r);return{left:l,top:c,size:n}}return o.portalPosition==="center"?{size:n,left:(r.width-n)/2,top:(r.height-n)/2}:{left:0,top:0,size:n}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const zn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerMove),o.setAttribute("data-action",te.MOVE),o},jn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},En=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},Tn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Nn=e=>{var i;const r=e(),o=document.createElement("span");return X(o,(i=r.css)==null?void 0:i.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},In=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.previewImage),o},An=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.preview),o.appendChild(In(e)),o},Dn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portal),o.appendChild(An(e)),o.appendChild(zn(e)),o.appendChild(Tn(e)),o.appendChild(Nn(e)),o.appendChild(jn(e)),o.appendChild(En(e)),o},_n=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.portalArea),o.appendChild(Dn(e)),o},Mn=e=>{var i;const r=e(),o=document.createElement("img");return X(o,(i=r.css)==null?void 0:i.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},Fn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.body),o.appendChild(Mn(e)),o.appendChild(_n(e)),o},Bn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=o.config.applyButtonLabel,i.addEventListener("click",r),i},Yn=(e,r)=>{var n;const o=e(),i=document.createElement("div");return X(i,(n=o.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=o.config.cancelButtonLabel,i.addEventListener("click",r),i},Hn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.footer),n.appendChild(Yn(e,o)),n.appendChild(Bn(e,r)),n},Vn=e=>{var i;const r=e(),o=document.createElement("div");return X(o,(i=r.css)==null?void 0:i.header),o},Gn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");return X(n,(l=i.css)==null?void 0:l.container),n.appendChild(Vn(e)),n.appendChild(Fn(e)),n.appendChild(Hn(e,r,o)),n},Wn=(e,r,o)=>{var l;const i=e(),n=document.createElement("div");X(n,(l=i.css)==null?void 0:l.root),n.appendChild(Gn(e,r,o)),document.body.appendChild(n)},Xn=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ae=new Map,Un={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},ue=(e,r)=>{if(Ae.has(e))return Ae.get(e);if(!r)return null;const o=r[Un[e]],i=document.querySelector(`.${o[0]}`);return Ae.set(e,i),i},qn=()=>{Ae.clear()},Kn=()=>{Ae.clear()},Zn=(e,r)=>{const o=ue("header",r.css);o&&(o.innerText=e)},Jn=(e,r)=>{const o=ue("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const i=ue("portalArea",r.css);i&&(i.style.height=`${r.frame.height}px`,i.style.width=`${r.frame.width}px`,i.style.left=`${r.frame.left}px`,i.style.top=`${r.frame.top}px`);const n=ue("portal",r.css);n&&(n.style.width=`${r.portal.size}px`,n.style.height=`${r.portal.size}px`,n.style.left=`${r.portal.left}px`,n.style.top=`${r.portal.top}px`);const l=ue("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},Qn=(e,r)=>{const o=ue("portal",r.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const i=ue("previewImage",r.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},pt=1,ea=e=>{var m,y;const r=e(),o=document.createElement("canvas"),i=r.frame.width||pt,n=r.frame.height||pt,l=r.sourceWidth/i,c=r.sourceHeight/n,d=r.portal.left*l,p=r.portal.top*c,h=Math.max(r.portal.size*Math.min(l,c),pt),g=r.config.outputSize>0?r.config.outputSize:h;o.width=g,o.height=g;const f=document.querySelector(`.${(m=r.css)==null?void 0:m.sourceImage[0]}`);f&&((y=o.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,g,g));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((S,v)=>{try{o.toBlob(x=>{if(o.remove(),!x){v(new Error(`Failed to create blob for type: image/${r.config.type}`));return}S([O,x])},`image/${r.config.type}`,r.config.compression)}catch(x){o.remove(),v(x)}})},ta=(e,r,o)=>{const{emitted:i,portal:n,frame:l,config:c}=r();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,g=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>g&&(d=g),p<f&&(p=f),p>O&&(p=O),o({portal:{...n,left:d,top:p}})},ra=(e,r,o)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=r(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let g=n.size+Math.max(p,h);return g<d.minPortalSize&&(g=d.minPortalSize),n.top+g>c.height-d.framePadding&&(g=c.height-n.top-d.framePadding),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding),o({portal:{...l,size:g}})}case te.RESIZE_TR:{let g=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return g<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,g=d.minPortalSize),n.left+g>c.width-d.framePadding&&(g=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(g=n.top+n.size,f=d.framePadding),o({portal:{...l,top:f,size:g}})}case te.RESIZE_TL:{const g=Math.min(p,h);let f=n.size-g,O=n.left+g,m=n.top+g;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,m=n.top+y}if(m<d.framePadding){const y=d.framePadding-m;m=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,m=m+y,f=f-y}return o({portal:{...l,top:m,left:O,size:f}})}case te.RESIZE_BL:{let g=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return g<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,g=d.minPortalSize),g+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,g=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,g=n.left+n.size-d.framePadding),o({portal:{...l,left:f,size:g}})}default:return}},Zt=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const r=e;return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}},oa=(e,r)=>{var O,m,y;const o=e(),i=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(m=o.css)==null?void 0:m.portalArea[0]}`),l=document.querySelector(`.${(y=o.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:v}=e(),x=Zt(S);if(S.target){const $=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:v.left,top:v.top,size:v.size};r({action:$,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&r({action:null})},g=()=>{if(c=null,!d)return;const S=d;d=null;const{action:v}=e();if(v)switch(v){case te.MOVE:ta(S,e,r);break;default:ra(S,e,r)}},f=S=>{const{action:v}=e();v&&(S.preventDefault(),d=Zt(S),c===null&&(c=requestAnimationFrame(g)))};return l&&(l.addEventListener("mouseup",h),l.addEventListener("touchend",h),l.addEventListener("touchcancel",h)),i&&(i.addEventListener("mousedown",p),i.addEventListener("touchstart",p,{passive:!1})),n&&(n.addEventListener("mousemove",f),n.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",h),l.removeEventListener("touchend",h),l.removeEventListener("touchcancel",h)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},Jt=1024*1024,ia=(e,r)=>{if(!r.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${r.allowedTypes.join(", ")}`;if(r.maxFileSize>0&&e.size>r.maxFileSize){const o=(r.maxFileSize/Jt).toFixed(2);return`File size (${(e.size/Jt).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},na=(e,r,o,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=r(),g=ia(p,h);if(g){d(g),e.target.value="";return}const f=new FileReader;let O=null;const m=()=>{var b;const x=r(),$=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);$&&($.remove(),document.removeEventListener("keydown",y),O==null||O(),Kn(),l(),o(wt))},y=x=>{x.key==="Escape"&&r().sourceBase64&&S(x)},S=x=>{x.preventDefault(),m()},v=x=>{x.preventDefault();const $=r();ea(r).then(([b,L])=>{i(b,L,$),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const $=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}$.src=x.target.result,$.onerror=()=>{d("Failed to load image")},$.onload=()=>{var j;Wn(r,v,S),qn(),n("fileName",Zn),n("sourceBase64",Jn),n("portal",Qn);const b=kn(r,$),L=Pn(r,b);o({frame:b,portal:L,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:$.height,sourceWidth:$.width}),O=oa(r,o),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},aa=(e,r,o,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=Rn(r,o),p=Xn(h=>na(h,n,l,e,c,d,i));return{open:()=>p.click()}},le={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Qt="vacano-image-cropper-styles",la=`
|
|
1180
1136
|
.vacano-cropper-root {
|
|
1181
1137
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1182
1138
|
backdrop-filter: blur(4px);
|
|
@@ -1224,12 +1180,12 @@
|
|
|
1224
1180
|
.vacano-cropper-apply-button:hover {
|
|
1225
1181
|
background-color: ${t.COLORS["iron-grey"]};
|
|
1226
1182
|
}
|
|
1227
|
-
`,da=()=>{if(typeof document>"u"||document.getElementById(Qt))return;const e=document.createElement("style");e.id=Qt,e.textContent=la,document.head.appendChild(e)},ca={root:["vacano-cropper-root"],container:["vacano-cropper-container"],header:["vacano-cropper-header"],body:["vacano-cropper-body"],footer:["vacano-cropper-footer"],cancelButton:["vacano-cropper-cancel-button"],applyButton:["vacano-cropper-apply-button"],portal:["vacano-cropper-portal"]},kr=(e={})=>{const{allowedTypes:r=
|
|
1183
|
+
`,da=()=>{if(typeof document>"u"||document.getElementById(Qt))return;const e=document.createElement("style");e.id=Qt,e.textContent=la,document.head.appendChild(e)},ca={root:["vacano-cropper-root"],container:["vacano-cropper-container"],header:["vacano-cropper-header"],body:["vacano-cropper-body"],footer:["vacano-cropper-footer"],cancelButton:["vacano-cropper-cancel-button"],applyButton:["vacano-cropper-apply-button"],portal:["vacano-cropper-portal"]},kr=(e={})=>{const{allowedTypes:r=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||(da(),f.current=aa((m,y,S)=>{y&&(c==null||c({base64:m,blob:y,state:S}))},{portalSize:h,outputSize:p,compression:n,type:g,maxFileSize:l,allowedTypes:r,applyButtonLabel:o,cancelButtonLabel:i},ca,m=>{d==null||d({code:"CROPPER_ERROR",message:m})})),f.current.open()},[r,o,i,n,l,c,d,p,h,g])}},ut=A.newClassNameGetter("image-cropper"),sa=({allowedTypes:e,applyLabel:r,buttonLabel:o="Select Image",cancelLabel:i,className:n,classnames:l,compression:c,maxFileSize:d,onCrop:p,onError:h,outputSize:g,portalSize:f,previewSize:O=120,ref:m,type:y,value:S,...v})=>{const[x,$]=u.useState(S??null),{open:b}=kr({allowedTypes:e,applyLabel:r,cancelLabel:i,compression:c,maxFileSize:d,onCrop:L=>{$(L.base64),p==null||p(L)},onError:h,outputSize:g,portalSize:f,type:y});return a.jsxs(on,{...v,ref:m,className:ut("container",n),children:[a.jsx(nn,{$size:O,className:ut("preview",l==null?void 0:l.preview),children:x?a.jsx("img",{src:x,alt:"Preview"}):a.jsx(an,{children:"No image"})}),a.jsx(_e,{variant:"system",onClick:b,className:ut("button",l==null?void 0:l.button),style:{width:O},children:o})]})},er={compact:{height:"32px",padding:"0 10px",radius:"14px",prefixSize:"16px"},default:{height:"40px",padding:"0 14px",radius:"16px",prefixSize:"20px"}},tr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},de=e=>tr[e]??tr.normal,ht=e=>er[e]??er.default,pa=s.div`
|
|
1228
1184
|
display: grid;
|
|
1229
1185
|
flex-direction: column;
|
|
1230
1186
|
gap: 2px;
|
|
1231
1187
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1232
|
-
`,ua=s(
|
|
1188
|
+
`,ua=s(ne)`
|
|
1233
1189
|
margin-left: 6px;
|
|
1234
1190
|
`,ha=s.input`
|
|
1235
1191
|
flex: 1;
|
|
@@ -1241,28 +1197,24 @@
|
|
|
1241
1197
|
padding: ${e=>ht(e.$size).padding};
|
|
1242
1198
|
border-radius: ${e=>ht(e.$size).radius};
|
|
1243
1199
|
|
|
1244
|
-
color: ${e=>
|
|
1245
|
-
border: 1px solid ${e=>
|
|
1246
|
-
background-color: ${e=>
|
|
1200
|
+
color: ${e=>de(e.$variant).color.static};
|
|
1201
|
+
border: 1px solid ${e=>de(e.$variant).border.static};
|
|
1202
|
+
background-color: ${e=>de(e.$variant).background.static};
|
|
1247
1203
|
|
|
1248
1204
|
&::placeholder {
|
|
1249
|
-
color: ${e=>
|
|
1205
|
+
color: ${e=>de(e.$variant).placeholder.static};
|
|
1250
1206
|
}
|
|
1251
1207
|
|
|
1252
1208
|
&:disabled {
|
|
1253
1209
|
cursor: not-allowed;
|
|
1254
|
-
color: ${e=>
|
|
1255
|
-
background-color: ${e=>
|
|
1256
|
-
border-color: ${e=>
|
|
1210
|
+
color: ${e=>de(e.$variant).color.disabled};
|
|
1211
|
+
background-color: ${e=>de(e.$variant).background.disabled};
|
|
1212
|
+
border-color: ${e=>de(e.$variant).border.disabled};
|
|
1257
1213
|
|
|
1258
1214
|
&::placeholder {
|
|
1259
|
-
color: ${e=>
|
|
1215
|
+
color: ${e=>de(e.$variant).placeholder.disabled};
|
|
1260
1216
|
}
|
|
1261
1217
|
}
|
|
1262
|
-
|
|
1263
|
-
&:focus-visible {
|
|
1264
|
-
outline: 2px solid ${e=>ie(e.$variant).focus};
|
|
1265
|
-
}
|
|
1266
1218
|
`,bt=A.newClassNameGetter("input"),Lr=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",...p})=>a.jsxs(pa,{className:bt("container",e),$fullWidth:!!i,children:[a.jsx(ua,{variant:d,className:bt("label",r==null?void 0:r.label),children:n}),a.jsx(ha,{...p,ref:l,disabled:o,$size:c,$variant:d,className:bt("input",r==null?void 0:r.input)})]}),ba=s.div`
|
|
1267
1219
|
position: fixed;
|
|
1268
1220
|
inset: 0;
|
|
@@ -1283,11 +1235,11 @@
|
|
|
1283
1235
|
border-radius: 16px;
|
|
1284
1236
|
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1285
1237
|
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1286
|
-
`,rr=A.newClassNameGetter("modal"),Pr=({animated:e,children:r,className:o,classnames:i,open:n,ref:l,width:c="500px",...d})=>n?
|
|
1238
|
+
`,rr=A.newClassNameGetter("modal"),Pr=({animated:e,children:r,className:o,classnames:i,open:n,ref:l,width:c="500px",...d})=>n?ge.createPortal(a.jsx(ba,{className:rr("overlay",i==null?void 0:i.overlay),$animated:!!e,children:a.jsx(ga,{...d,ref:l,className:rr("content",o,i==null?void 0:i.content),$animated:!!e,$width:c,children:r})}),document.body):null,zr={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},fa=s.div`
|
|
1287
1239
|
display: flex;
|
|
1288
1240
|
flex-direction: column;
|
|
1289
1241
|
gap: 4px;
|
|
1290
|
-
`,xa=s(
|
|
1242
|
+
`,xa=s(ne)`
|
|
1291
1243
|
margin-left: 6px;
|
|
1292
1244
|
color: ${e=>zr[e.$variant].label};
|
|
1293
1245
|
`,Oa=s.button`
|
|
@@ -1308,12 +1260,6 @@
|
|
|
1308
1260
|
&:hover:not(:disabled) {
|
|
1309
1261
|
border-color: ${e=>e.$variant==="error"?t.COLORS.red:t.COLORS.black};
|
|
1310
1262
|
}
|
|
1311
|
-
|
|
1312
|
-
&:focus-visible {
|
|
1313
|
-
outline: 2px solid
|
|
1314
|
-
${e=>e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1315
|
-
outline-offset: 2px;
|
|
1316
|
-
}
|
|
1317
1263
|
`,$a=s.span`
|
|
1318
1264
|
color: ${t.COLORS["iron-grey"]};
|
|
1319
1265
|
font-size: 14px;
|
|
@@ -1362,11 +1308,11 @@
|
|
|
1362
1308
|
color: ${t.COLORS["iron-grey"]};
|
|
1363
1309
|
font-size: 14px;
|
|
1364
1310
|
text-align: center;
|
|
1365
|
-
`,Q=A.newClassNameGetter("multi-select"),ka=({className:e,classnames:r,disabled:o=!1,emptyMessage:i="No options found",label:n,maxVisible:l=1/0,modalTitle:c="Select options",onChange:d,options:p,placeholder:h="Select...",ref:g,searchPlaceholder:f="Search...",value:O,variant:m="normal",...y})=>{const[S,v]=u.useState(!1),[x,$]=u.useState(""),b=u.useMemo(()=>p.filter(w=>O.includes(w.value)),[p,O]),L=u.useMemo(()=>{if(!x.trim())return p;const w=x.toLowerCase().trim();return p.filter(M=>M.label.toLowerCase().includes(w))},[p,x]),j=l===1/0?b:b.slice(0,l),N=b.length-j.length,H=()=>{o||(v(!0),$(""))},z=()=>{v(!1),$("")},_=w=>{O.includes(w)?d(O.filter(M=>M!==w)):d([...O,w])},E=w=>{d(O.filter(M=>M!==w))};return a.jsxs(fa,{...y,ref:g,className:Q("container",e),children:[n&&a.jsx(xa,{$variant:m,className:Q("label",r==null?void 0:r.trigger),children:n}),a.jsx(Oa,{type:"button",$variant:m,$disabled:o,disabled:o,onClick:H,className:Q("trigger",r==null?void 0:r.trigger),children:b.length===0?a.jsx($a,{className:Q("placeholder",r==null?void 0:r.placeholder),children:h}):a.jsxs(a.Fragment,{children:[j.map(w=>a.jsx(Qe,{deletable:!0,onDelete:()=>E(w.value),onClick:M=>M.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:w.label},w.value)),N>0&&a.jsxs(Qe,{variant:"gray",onClick:w=>w.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:["+",N]})]})}),a.jsx(Pr,{open:S,width:"400px",animated:!0,className:Q("modal",r==null?void 0:r.modal),children:a.jsxs(Sa,{children:[a.jsxs(ya,{children:[a.jsx(va,{children:c}),a.jsx(_e,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:z})]}),a.jsx(Lr,{type:"text",value:x,onChange:w=>$(w.target.value),placeholder:f,autoFocus:!0,fullWidth:!0,className:Q("search",r==null?void 0:r.search)}),a.jsx(Ca,{className:Q("options",r==null?void 0:r.options),children:L.length===0?a.jsx(Ra,{className:Q("empty",r==null?void 0:r.empty),children:i}):L.map(w=>a.jsxs(ma,{$disabled:!!w.disabled,className:Q("option",r==null?void 0:r.option),children:[a.jsx(tt,{checked:O.includes(w.value),disabled:w.disabled,onChange:()=>_(w.value)}),a.jsx(wa,{children:w.label})]},w.value))})]})})]})},or={compact:{width:"36px",height:"40px",fontSize:"16px",radius:"10px",gap:"8px"},default:{width:"44px",height:"52px",fontSize:"20px",radius:"12px",gap:"10px"}},ir={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},Ie=e=>or[e]??or.default
|
|
1311
|
+
`,Q=A.newClassNameGetter("multi-select"),ka=({className:e,classnames:r,disabled:o=!1,emptyMessage:i="No options found",label:n,maxVisible:l=1/0,modalTitle:c="Select options",onChange:d,options:p,placeholder:h="Select...",ref:g,searchPlaceholder:f="Search...",value:O,variant:m="normal",...y})=>{const[S,v]=u.useState(!1),[x,$]=u.useState(""),b=u.useMemo(()=>p.filter(w=>O.includes(w.value)),[p,O]),L=u.useMemo(()=>{if(!x.trim())return p;const w=x.toLowerCase().trim();return p.filter(M=>M.label.toLowerCase().includes(w))},[p,x]),j=l===1/0?b:b.slice(0,l),N=b.length-j.length,H=()=>{o||(v(!0),$(""))},z=()=>{v(!1),$("")},_=w=>{O.includes(w)?d(O.filter(M=>M!==w)):d([...O,w])},E=w=>{d(O.filter(M=>M!==w))};return a.jsxs(fa,{...y,ref:g,className:Q("container",e),children:[n&&a.jsx(xa,{$variant:m,className:Q("label",r==null?void 0:r.trigger),children:n}),a.jsx(Oa,{type:"button",$variant:m,$disabled:o,disabled:o,onClick:H,className:Q("trigger",r==null?void 0:r.trigger),children:b.length===0?a.jsx($a,{className:Q("placeholder",r==null?void 0:r.placeholder),children:h}):a.jsxs(a.Fragment,{children:[j.map(w=>a.jsx(Qe,{deletable:!0,onDelete:()=>E(w.value),onClick:M=>M.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:w.label},w.value)),N>0&&a.jsxs(Qe,{variant:"gray",onClick:w=>w.stopPropagation(),className:Q("chip",r==null?void 0:r.chip),children:["+",N]})]})}),a.jsx(Pr,{open:S,width:"400px",animated:!0,className:Q("modal",r==null?void 0:r.modal),children:a.jsxs(Sa,{children:[a.jsxs(ya,{children:[a.jsx(va,{children:c}),a.jsx(_e,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:z})]}),a.jsx(Lr,{type:"text",value:x,onChange:w=>$(w.target.value),placeholder:f,autoFocus:!0,fullWidth:!0,className:Q("search",r==null?void 0:r.search)}),a.jsx(Ca,{className:Q("options",r==null?void 0:r.options),children:L.length===0?a.jsx(Ra,{className:Q("empty",r==null?void 0:r.empty),children:i}):L.map(w=>a.jsxs(ma,{$disabled:!!w.disabled,className:Q("option",r==null?void 0:r.option),children:[a.jsx(tt,{checked:O.includes(w.value),disabled:w.disabled,onChange:()=>_(w.value)}),a.jsx(wa,{children:w.label})]},w.value))})]})})]})},or={compact:{width:"36px",height:"40px",fontSize:"16px",radius:"10px",gap:"8px"},default:{width:"44px",height:"52px",fontSize:"20px",radius:"12px",gap:"10px"}},ir={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},Ie=e=>or[e]??or.default,$e=e=>ir[e]??ir.normal,La=s.div`
|
|
1366
1312
|
display: inline-flex;
|
|
1367
1313
|
flex-direction: column;
|
|
1368
1314
|
gap: 2px;
|
|
1369
|
-
`,Pa=s(
|
|
1315
|
+
`,Pa=s(ne)`
|
|
1370
1316
|
margin-left: 6px;
|
|
1371
1317
|
`,za=s.div`
|
|
1372
1318
|
display: flex;
|
|
@@ -1379,22 +1325,18 @@
|
|
|
1379
1325
|
font-weight: 600;
|
|
1380
1326
|
text-align: center;
|
|
1381
1327
|
outline: none;
|
|
1382
|
-
border: 1px solid ${e
|
|
1383
|
-
background-color: ${e
|
|
1384
|
-
color: ${e
|
|
1328
|
+
border: 1px solid ${e=>$e(e.$variant).border.static};
|
|
1329
|
+
background-color: ${e=>$e(e.$variant).background.static};
|
|
1330
|
+
color: ${e=>$e(e.$variant).color.static};
|
|
1385
1331
|
transition:
|
|
1386
1332
|
border-color 0.15s ease,
|
|
1387
1333
|
box-shadow 0.15s ease;
|
|
1388
1334
|
|
|
1389
1335
|
&:disabled {
|
|
1390
1336
|
cursor: not-allowed;
|
|
1391
|
-
color: ${e
|
|
1392
|
-
background-color: ${e
|
|
1393
|
-
border-color: ${e
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
&:focus-visible {
|
|
1397
|
-
outline: 2px solid ${e=>be(e.$variant).focus};
|
|
1337
|
+
color: ${e=>$e(e.$variant).color.disabled};
|
|
1338
|
+
background-color: ${e=>$e(e.$variant).background.disabled};
|
|
1339
|
+
border-color: ${e=>$e(e.$variant).border.disabled};
|
|
1398
1340
|
}
|
|
1399
1341
|
|
|
1400
1342
|
&::selection {
|
|
@@ -1437,16 +1379,12 @@
|
|
|
1437
1379
|
border-radius: ${({$size:e})=>Rt[e].radius}px;
|
|
1438
1380
|
background-color: ${t.COLORS.black};
|
|
1439
1381
|
transition: width 0.2s ease;
|
|
1440
|
-
`,ar=A.newClassNameGetter("progress"),Ba=({value:e,size:r="default",className:o,classnames:i,ref:n,...l})=>a.jsx(Ma,{...l,ref:n,$size:r,className:ar("track",o,i==null?void 0:i.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(Fa,{$size:r,$value:e,className:ar("bar",i==null?void 0:i.bar)})}),lr={normal:{box:{border:t.alpha(t.COLORS["iron-grey"],30),borderChecked:t.COLORS["iron-grey"],background:t.COLORS.white,backgroundChecked:t.COLORS.white,focusShadow:t.alpha(t.COLORS["iron-grey"],30)},dot:t.COLORS.black,label:t.COLORS.black},error:{box:{border:t.COLORS.red,borderChecked:t.COLORS.red,background:t.COLORS.white,backgroundChecked:t.COLORS.white,focusShadow:t.alpha(t.COLORS.red,30)},dot:t.COLORS.red,label:t.COLORS.red}},
|
|
1382
|
+
`,ar=A.newClassNameGetter("progress"),Ba=({value:e,size:r="default",className:o,classnames:i,ref:n,...l})=>a.jsx(Ma,{...l,ref:n,$size:r,className:ar("track",o,i==null?void 0:i.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(Fa,{$size:r,$value:e,className:ar("bar",i==null?void 0:i.bar)})}),lr={normal:{box:{border:t.alpha(t.COLORS["iron-grey"],30),borderChecked:t.COLORS["iron-grey"],background:t.COLORS.white,backgroundChecked:t.COLORS.white,focusShadow:t.alpha(t.COLORS["iron-grey"],30)},dot:t.COLORS.black,label:t.COLORS.black},error:{box:{border:t.COLORS.red,borderChecked:t.COLORS.red,background:t.COLORS.white,backgroundChecked:t.COLORS.white,focusShadow:t.alpha(t.COLORS.red,30)},dot:t.COLORS.red,label:t.COLORS.red}},ve=e=>lr[e]??lr.normal,Ya=s.label`
|
|
1441
1383
|
display: inline-flex;
|
|
1442
1384
|
align-items: flex-start;
|
|
1443
1385
|
gap: 8px;
|
|
1444
1386
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1445
1387
|
opacity: ${e=>e.$disabled?.5:1};
|
|
1446
|
-
|
|
1447
|
-
&:has(input:focus-visible) > span:first-of-type {
|
|
1448
|
-
box-shadow: 0 0 0 2px ${e=>xe(e.$variant).box.focusShadow};
|
|
1449
|
-
}
|
|
1450
1388
|
`,Ha=s.input`
|
|
1451
1389
|
position: absolute;
|
|
1452
1390
|
opacity: 0;
|
|
@@ -1462,8 +1400,8 @@
|
|
|
1462
1400
|
height: 18px;
|
|
1463
1401
|
border-radius: 50%;
|
|
1464
1402
|
border: 1.5px solid
|
|
1465
|
-
${e=>e.$checked?
|
|
1466
|
-
background-color: ${e=>e.$checked?
|
|
1403
|
+
${e=>e.$checked?ve(e.$variant).box.borderChecked:ve(e.$variant).box.border};
|
|
1404
|
+
background-color: ${e=>e.$checked?ve(e.$variant).box.backgroundChecked:ve(e.$variant).box.background};
|
|
1467
1405
|
transition:
|
|
1468
1406
|
border-color 0.15s ease,
|
|
1469
1407
|
background-color 0.15s ease,
|
|
@@ -1472,7 +1410,7 @@
|
|
|
1472
1410
|
width: 8px;
|
|
1473
1411
|
height: 8px;
|
|
1474
1412
|
border-radius: 50%;
|
|
1475
|
-
background-color: ${e=>
|
|
1413
|
+
background-color: ${e=>ve(e.$variant).dot};
|
|
1476
1414
|
opacity: ${e=>e.$visible?1:0};
|
|
1477
1415
|
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
1478
1416
|
transition:
|
|
@@ -1482,7 +1420,7 @@
|
|
|
1482
1420
|
font-size: 14px;
|
|
1483
1421
|
font-weight: 500;
|
|
1484
1422
|
line-height: 1.5;
|
|
1485
|
-
color: ${e=>
|
|
1423
|
+
color: ${e=>ve(e.$variant).label};
|
|
1486
1424
|
user-select: none;
|
|
1487
1425
|
|
|
1488
1426
|
a {
|
|
@@ -1494,15 +1432,15 @@
|
|
|
1494
1432
|
text-decoration: none;
|
|
1495
1433
|
}
|
|
1496
1434
|
}
|
|
1497
|
-
`,Ee=A.newClassNameGetter("radio"),Pt=({checked:e,className:r,classnames:o,disabled:i,label:n,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(Ya,{className:Ee("container",r),$disabled:!!i,$variant:d,children:[a.jsx(Ha,{...p,ref:c,type:"radio",className:Ee("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:l}),a.jsx(Va,{className:Ee("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(Ga,{className:Ee("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),n&&a.jsx(Wa,{className:Ee("label",o==null?void 0:o.label),$variant:d,children:n})]}),dr={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},
|
|
1435
|
+
`,Ee=A.newClassNameGetter("radio"),Pt=({checked:e,className:r,classnames:o,disabled:i,label:n,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(Ya,{className:Ee("container",r),$disabled:!!i,$variant:d,children:[a.jsx(Ha,{...p,ref:c,type:"radio",className:Ee("input",o==null?void 0:o.input),checked:e,disabled:i,onChange:l}),a.jsx(Va,{className:Ee("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(Ga,{className:Ee("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),n&&a.jsx(Wa,{className:Ee("label",o==null?void 0:o.label),$variant:d,children:n})]}),dr={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},be=e=>dr[e]??dr.normal,Xa=s.label`
|
|
1498
1436
|
display: grid;
|
|
1499
1437
|
grid-template-columns: auto 1fr;
|
|
1500
1438
|
align-items: start;
|
|
1501
1439
|
gap: 8px;
|
|
1502
1440
|
padding: 12px;
|
|
1503
|
-
background-color: ${e=>{const r=
|
|
1441
|
+
background-color: ${e=>{const r=be(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
1504
1442
|
border: 1px solid
|
|
1505
|
-
${e=>{const r=
|
|
1443
|
+
${e=>{const r=be(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
1506
1444
|
border-radius: 12px;
|
|
1507
1445
|
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1508
1446
|
transition:
|
|
@@ -1512,12 +1450,7 @@
|
|
|
1512
1450
|
min-width: 0;
|
|
1513
1451
|
|
|
1514
1452
|
&:hover:not([data-disabled='true']) {
|
|
1515
|
-
border-color: ${e=>{const r=
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
&:has(:focus-visible) {
|
|
1519
|
-
outline: none;
|
|
1520
|
-
box-shadow: 0 0 0 3px ${e=>he(e.$variant).focusRing};
|
|
1453
|
+
border-color: ${e=>{const r=be(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
1521
1454
|
}
|
|
1522
1455
|
|
|
1523
1456
|
.vacano_radio_container {
|
|
@@ -1542,19 +1475,19 @@
|
|
|
1542
1475
|
font-size: 14px;
|
|
1543
1476
|
font-weight: 500;
|
|
1544
1477
|
line-height: 1.4;
|
|
1545
|
-
color: ${e=>
|
|
1478
|
+
color: ${e=>be(e.$variant).label.static};
|
|
1546
1479
|
|
|
1547
1480
|
label[data-disabled='true'] & {
|
|
1548
|
-
color: ${e=>
|
|
1481
|
+
color: ${e=>be(e.$variant).label.disabled};
|
|
1549
1482
|
}
|
|
1550
1483
|
`,Za=s.span`
|
|
1551
1484
|
font-size: 12px;
|
|
1552
1485
|
font-weight: 400;
|
|
1553
1486
|
line-height: 1.4;
|
|
1554
|
-
color: ${e=>
|
|
1487
|
+
color: ${e=>be(e.$variant).description.static};
|
|
1555
1488
|
|
|
1556
1489
|
label[data-disabled='true'] & {
|
|
1557
|
-
color: ${e=>
|
|
1490
|
+
color: ${e=>be(e.$variant).description.disabled};
|
|
1558
1491
|
}
|
|
1559
1492
|
`,qe=A.newClassNameGetter("radio-card"),Ja=({checked:e,className:r,classnames:o,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...g})=>a.jsxs(Xa,{className:qe("container",r),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(Ua,{...g,ref:p,type:"radio",checked:e,disabled:n,onChange:d}),a.jsx(Pt,{className:o==null?void 0:o.radio,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(qa,{className:qe("content",o==null?void 0:o.content),children:[a.jsx(Ka,{className:qe("label",o==null?void 0:o.label),$variant:h,children:c}),i&&a.jsx(Za,{className:qe("description",o==null?void 0:o.description),$variant:h,children:i})]})]}),cr={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},Qa=s.div`
|
|
1560
1493
|
display: flex;
|
|
@@ -1589,13 +1522,13 @@
|
|
|
1589
1522
|
font-size: 14px;
|
|
1590
1523
|
font-weight: 500;
|
|
1591
1524
|
white-space: nowrap;
|
|
1592
|
-
`,nl=({children:e,defaultMessage:r="Saving"})=>{const[o,i]=u.useState(!1),[n,l]=u.useState(r),c=u.useCallback(h=>{l(h??r),i(!0)},[r]),d=u.useCallback(()=>{i(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:d}),[o,c,d]);return a.jsxs(jr.Provider,{value:p,children:[e,o&&a.jsxs(ol,{children:[a.jsx(Lt,{size:"sm"}),a.jsx(il,{children:n})]})]})},al=()=>{const e=u.useContext(jr);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},xt=40,Te=4,sr={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},pr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:t.alpha(t.COLORS.black,40),focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:t.alpha(t.COLORS.red,40),focus:t.alpha(t.COLORS.red,30)}},Ot=e=>sr[e]??sr.default,
|
|
1525
|
+
`,nl=({children:e,defaultMessage:r="Saving"})=>{const[o,i]=u.useState(!1),[n,l]=u.useState(r),c=u.useCallback(h=>{l(h??r),i(!0)},[r]),d=u.useCallback(()=>{i(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:d}),[o,c,d]);return a.jsxs(jr.Provider,{value:p,children:[e,o&&a.jsxs(ol,{children:[a.jsx(Lt,{size:"sm"}),a.jsx(il,{children:n})]})]})},al=()=>{const e=u.useContext(jr);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},xt=40,Te=4,sr={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},pr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:t.alpha(t.COLORS.black,40),focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:t.alpha(t.COLORS.red,40),focus:t.alpha(t.COLORS.red,30)}},Ot=e=>sr[e]??sr.default,pe=e=>pr[e]??pr.normal,ll=s.div`
|
|
1593
1526
|
position: relative;
|
|
1594
1527
|
display: grid;
|
|
1595
1528
|
gap: 2px;
|
|
1596
1529
|
min-width: 180px;
|
|
1597
1530
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1598
|
-
`,dl=s(
|
|
1531
|
+
`,dl=s(ne)`
|
|
1599
1532
|
margin-left: 6px;
|
|
1600
1533
|
`,cl=s.button`
|
|
1601
1534
|
display: flex;
|
|
@@ -1612,14 +1545,10 @@
|
|
|
1612
1545
|
padding: ${e=>Ot(e.$size).padding};
|
|
1613
1546
|
border-radius: ${e=>Ot(e.$size).radius};
|
|
1614
1547
|
|
|
1615
|
-
color: ${e=>e.$hasValue?e.$disabled?
|
|
1548
|
+
color: ${e=>e.$hasValue?e.$disabled?pe(e.$variant).color.disabled:pe(e.$variant).color.static:pe(e.$variant).placeholder};
|
|
1616
1549
|
border: 1px solid
|
|
1617
|
-
${e=>e.$disabled?
|
|
1618
|
-
background-color: ${e=>e.$disabled?
|
|
1619
|
-
|
|
1620
|
-
&:focus-visible {
|
|
1621
|
-
outline: 2px solid ${e=>se(e.$variant).focus};
|
|
1622
|
-
}
|
|
1550
|
+
${e=>e.$disabled?pe(e.$variant).border.disabled:pe(e.$variant).border.static};
|
|
1551
|
+
background-color: ${e=>e.$disabled?pe(e.$variant).background.disabled:pe(e.$variant).background.static};
|
|
1623
1552
|
`,sl=s.span`
|
|
1624
1553
|
flex: 1;
|
|
1625
1554
|
min-width: 0;
|
|
@@ -1669,18 +1598,13 @@
|
|
|
1669
1598
|
&:hover:not(:disabled) {
|
|
1670
1599
|
background: ${t.alpha(t.COLORS.black,8)};
|
|
1671
1600
|
}
|
|
1672
|
-
|
|
1673
|
-
&:focus-visible {
|
|
1674
|
-
outline: none;
|
|
1675
|
-
background: ${t.alpha(t.COLORS.black,8)};
|
|
1676
|
-
}
|
|
1677
1601
|
`,gl=s.span`
|
|
1678
1602
|
display: flex;
|
|
1679
1603
|
align-items: center;
|
|
1680
1604
|
justify-content: center;
|
|
1681
1605
|
flex-shrink: 0;
|
|
1682
1606
|
color: ${t.COLORS.black};
|
|
1683
|
-
`,
|
|
1607
|
+
`,Se=A.newClassNameGetter("select"),fl=({className:e,classnames:r,disabled:o=!1,fullWidth:i=!1,label:n,onChange:l,options:c,placeholder:d="Select...",portalRenderNode:p,ref:h,size:g="default",value:f,variant:O="normal",...m})=>{const[y,S]=u.useState(!1),[v,x]=u.useState({top:0,left:0,width:0}),$=u.useRef(null),b=u.useRef(null),L=u.useRef(null),j=c.find(C=>C.value===f),N=Math.max(0,c.findIndex(C=>C.value===f)),H=-(N*xt+Te),z=()=>{if(!b.current||!p)return;const C=b.current.getBoundingClientRect(),I=N*xt+Te;let k=C.top-I;const T=c.length*xt+Te*2,F=8,B=window.innerHeight-T-8;k<F&&(k=F),k>B&&(k=B),x({top:k,left:C.left-Te,width:C.width+Te*2})},_=C=>{var I;l==null||l(C),S(!1),(I=b.current)==null||I.focus()},E=C=>{o||(C.key==="Enter"||C.key===" "?(C.preventDefault(),S(I=>!I)):C.key==="Escape"&&y?(C.preventDefault(),S(!1)):C.key==="ArrowDown"&&!y&&(C.preventDefault(),S(!0)))};u.useLayoutEffect(()=>{y&&p&&z()},[y,p,N,c.length]),u.useEffect(()=>{if(!y)return;const C=T=>{const F=T.target,B=$.current&&!$.current.contains(F),V=L.current&&!L.current.contains(F);p?B&&V&&S(!1):B&&S(!1)},I=()=>{p&&z()},k=()=>{p&&z()};return document.addEventListener("mousedown",C),p&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",k)),()=>{document.removeEventListener("mousedown",C),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",k)}},[y,p]);const w=()=>c.map(C=>a.jsxs(bl,{type:"button",role:"option",$selected:C.value===f,$disabled:C.disabled??!1,disabled:C.disabled,"aria-selected":C.value===f,onClick:()=>_(C.value),className:Se("option",r==null?void 0:r.option),children:[a.jsx("span",{children:C.label}),C.value===f&&a.jsx(gl,{children:a.jsx(a.Check,{size:16})})]},C.value)),M=p?ge.createPortal(a.jsx(hl,{ref:L,role:"listbox",style:{top:v.top,left:v.left,width:v.width},className:Se("dropdown",r==null?void 0:r.dropdown),children:w()}),p):a.jsx(ul,{ref:L,role:"listbox",style:{top:H},className:Se("dropdown",r==null?void 0:r.dropdown),children:w()});return a.jsxs(ll,{...m,ref:C=>{$.current=C,typeof h=="function"?h(C):h&&(h.current=C)},$fullWidth:i,className:Se("container",e),children:[n&&a.jsx(dl,{className:Se("label",r==null?void 0:r.label),children:n}),a.jsxs(cl,{ref:b,type:"button",$size:g,$variant:O,$disabled:o,$hasValue:!!j,disabled:o,onClick:()=>!o&&S(C=>!C),onKeyDown:E,"aria-haspopup":"listbox","aria-expanded":y,className:Se("trigger",r==null?void 0:r.trigger),children:[a.jsx(sl,{children:(j==null?void 0:j.label)??d}),a.jsx(pl,{$open:y,children:a.jsx(a.ChevronDown,{size:16})})]}),y&&M]})},ur={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},xl=e=>ur[e]??ur.neutral,Ol=s.div`
|
|
1684
1608
|
display: flex;
|
|
1685
1609
|
flex-direction: column;
|
|
1686
1610
|
gap: 4px;
|
|
@@ -1744,15 +1668,6 @@
|
|
|
1744
1668
|
background: transparent;
|
|
1745
1669
|
cursor: ${e=>e.$clickable?"pointer":"default"};
|
|
1746
1670
|
flex-shrink: 0;
|
|
1747
|
-
|
|
1748
|
-
&:focus-visible {
|
|
1749
|
-
outline: none;
|
|
1750
|
-
|
|
1751
|
-
& > div:first-of-type {
|
|
1752
|
-
outline: 2px solid ${t.COLORS["steel-blue"]};
|
|
1753
|
-
outline-offset: 2px;
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
1671
|
`,Ll=s.div`
|
|
1757
1672
|
display: flex;
|
|
1758
1673
|
align-items: center;
|
|
@@ -1802,7 +1717,7 @@
|
|
|
1802
1717
|
display: flex;
|
|
1803
1718
|
flex-direction: column;
|
|
1804
1719
|
gap: 4px;
|
|
1805
|
-
`,Tl=s(
|
|
1720
|
+
`,Tl=s(ne)`
|
|
1806
1721
|
margin-left: 6px;
|
|
1807
1722
|
color: ${e=>kt[e.$variant].label};
|
|
1808
1723
|
`,Nl=s.div`
|
|
@@ -1909,7 +1824,7 @@
|
|
|
1909
1824
|
color: ${t.COLORS["iron-grey"]};
|
|
1910
1825
|
font-size: 14px;
|
|
1911
1826
|
text-align: center;
|
|
1912
|
-
`,ee=A.newClassNameGetter("tags"),Ze=4,_l=({className:e,classnames:r,createKey:o="Tab",disabled:i=!1,emptyMessage:n="No options",freeSolo:l=!0,label:c,onChange:d,options:p=[],placeholder:h="Add tag...",portalRenderNode:g,ref:f,value:O,variant:m="normal",...y})=>{const S=u.useRef(null),v=u.useRef(null),x=u.useRef(null),$=u.useRef(null),[b,L]=u.useState(""),[j,N]=u.useState(!1),[H,z]=u.useState("bottom"),[_,E]=u.useState({top:0,left:0,width:0}),w=u.useMemo(()=>{const P=p.filter(U=>!O.includes(U.value));if(!b.trim())return P;const D=b.toLowerCase().trim();return P.filter(U=>U.label.toLowerCase().includes(D))},[p,O,b]),M=j&&p.length>0,C=u.useCallback(()=>{var Me;if(!v.current)return;const P=v.current.getBoundingClientRect(),D=((Me=x.current)==null?void 0:Me.offsetHeight)??200,U=window.innerHeight-P.bottom-Ze,q=P.top-Ze
|
|
1827
|
+
`,ee=A.newClassNameGetter("tags"),Ze=4,_l=({className:e,classnames:r,createKey:o="Tab",disabled:i=!1,emptyMessage:n="No options",freeSolo:l=!0,label:c,onChange:d,options:p=[],placeholder:h="Add tag...",portalRenderNode:g,ref:f,value:O,variant:m="normal",...y})=>{const S=u.useRef(null),v=u.useRef(null),x=u.useRef(null),$=u.useRef(null),[b,L]=u.useState(""),[j,N]=u.useState(!1),[H,z]=u.useState("bottom"),[_,E]=u.useState({top:0,left:0,width:0}),w=u.useMemo(()=>{const P=p.filter(U=>!O.includes(U.value));if(!b.trim())return P;const D=b.toLowerCase().trim();return P.filter(U=>U.label.toLowerCase().includes(D))},[p,O,b]),M=j&&p.length>0,C=u.useCallback(()=>{var Me;if(!v.current)return;const P=v.current.getBoundingClientRect(),D=((Me=x.current)==null?void 0:Me.offsetHeight)??200,U=window.innerHeight-P.bottom-Ze,q=P.top-Ze,fe=U<D&&q>U?"top":"bottom";if(z(fe),g){const ot=fe==="bottom"?P.bottom+Ze:P.top-D-Ze;E({top:ot,left:P.left,width:P.width})}},[g]);u.useEffect(()=>{if(j)return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[j,C]);const I=u.useCallback(P=>{const D=P.trim();return!D||O.includes(D)?!1:(d([...O,D]),L(""),!0)},[O,d]),k=P=>{if(P.key===o&&b.trim())if(P.preventDefault(),l)I(b);else{const D=w.find(U=>U.label.toLowerCase()===b.toLowerCase().trim());D&&I(D.value)}else P.key==="Backspace"&&!b&&O.length>0&&d(O.slice(0,-1))},T=P=>{var D;I(P),(D=$.current)==null||D.focus()},F=P=>{d(O.filter(D=>D!==P))},B=()=>{var P;i||(P=$.current)==null||P.focus()},V=P=>{const D=p.find(U=>U.value===P);return(D==null?void 0:D.label)??P};return a.jsxs(El,{...y,ref:f,className:ee("container",e),children:[c&&a.jsx(Tl,{$variant:m,className:ee("label"),children:c}),a.jsxs("div",{ref:S,style:{position:"relative"},children:[a.jsxs(Nl,{ref:v,$variant:m,$disabled:i,$focused:j,onClick:B,className:ee("trigger",r==null?void 0:r.trigger),children:[O.map(P=>a.jsx(Qe,{deletable:!i,onDelete:()=>F(P),className:ee("chip",r==null?void 0:r.chip),children:V(P)},P)),a.jsx(Il,{ref:$,type:"text",value:b,onChange:P=>L(P.target.value),onFocus:()=>N(!0),onBlur:()=>setTimeout(()=>N(!1),150),onKeyDown:k,placeholder:O.length===0?h:"",disabled:i,$disabled:i,className:ee("input",r==null?void 0:r.input)})]}),p.length>0&&(g?ge.createPortal(a.jsx(Dl,{ref:x,$open:M,$position:H,style:{top:_.top,left:_.left,width:_.width},className:ee("dropdown",r==null?void 0:r.dropdown),children:w.length===0?a.jsx(br,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(hr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>T(P.value),className:ee("option",r==null?void 0:r.option),children:P.label},P.value))}),g):a.jsx(Al,{ref:x,$open:M,$position:H,className:ee("dropdown",r==null?void 0:r.dropdown),children:w.length===0?a.jsx(br,{className:ee("empty",r==null?void 0:r.empty),children:n}):w.map(P=>a.jsx(hr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>T(P.value),className:ee("option",r==null?void 0:r.option),children:P.label},P.value))}))]})]})},Ml=s.div`
|
|
1913
1828
|
display: flex;
|
|
1914
1829
|
align-items: center;
|
|
1915
1830
|
gap: 6px;
|
|
@@ -1931,17 +1846,12 @@
|
|
|
1931
1846
|
&:hover:not(:disabled) {
|
|
1932
1847
|
background-color: ${e=>e.$active?t.COLORS.gray:"rgba(0, 0, 0, 0.05)"};
|
|
1933
1848
|
}
|
|
1934
|
-
|
|
1935
|
-
&:focus-visible {
|
|
1936
|
-
outline: 2px solid ${t.COLORS["steel-blue"]};
|
|
1937
|
-
outline-offset: 2px;
|
|
1938
|
-
}
|
|
1939
|
-
`,gr=A.newClassNameGetter("tabs"),Bl=({className:e,classnames:r,onChange:o,ref:i,tabs:n,value:l,...c})=>a.jsx(Ml,{...c,ref:i,className:gr("container",e),role:"tablist",children:n.map(d=>a.jsx(Fl,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>o(d.value),className:gr("tab",r==null?void 0:r.tab),children:d.label},d.value))}),fr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},ne=e=>fr[e]??fr.normal,Yl=s.div`
|
|
1849
|
+
`,gr=A.newClassNameGetter("tabs"),Bl=({className:e,classnames:r,onChange:o,ref:i,tabs:n,value:l,...c})=>a.jsx(Ml,{...c,ref:i,className:gr("container",e),role:"tablist",children:n.map(d=>a.jsx(Fl,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>o(d.value),className:gr("tab",r==null?void 0:r.tab),children:d.label},d.value))}),fr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},ce=e=>fr[e]??fr.normal,Yl=s.div`
|
|
1940
1850
|
display: grid;
|
|
1941
1851
|
flex-direction: column;
|
|
1942
1852
|
gap: 2px;
|
|
1943
1853
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1944
|
-
`,Hl=s(
|
|
1854
|
+
`,Hl=s(ne)`
|
|
1945
1855
|
margin-left: 6px;
|
|
1946
1856
|
`,Vl=s.textarea`
|
|
1947
1857
|
flex: 1;
|
|
@@ -1954,30 +1864,26 @@
|
|
|
1954
1864
|
border-radius: 16px;
|
|
1955
1865
|
resize: vertical;
|
|
1956
1866
|
|
|
1957
|
-
color: ${e=>
|
|
1958
|
-
border: 1px solid ${e=>
|
|
1959
|
-
background-color: ${e=>
|
|
1867
|
+
color: ${e=>ce(e.$variant).color.static};
|
|
1868
|
+
border: 1px solid ${e=>ce(e.$variant).border.static};
|
|
1869
|
+
background-color: ${e=>ce(e.$variant).background.static};
|
|
1960
1870
|
|
|
1961
1871
|
&::placeholder {
|
|
1962
|
-
color: ${e=>
|
|
1872
|
+
color: ${e=>ce(e.$variant).placeholder.static};
|
|
1963
1873
|
}
|
|
1964
1874
|
|
|
1965
1875
|
&:disabled {
|
|
1966
1876
|
cursor: not-allowed;
|
|
1967
1877
|
resize: none;
|
|
1968
|
-
color: ${e=>
|
|
1969
|
-
background-color: ${e=>
|
|
1970
|
-
border-color: ${e=>
|
|
1878
|
+
color: ${e=>ce(e.$variant).color.disabled};
|
|
1879
|
+
background-color: ${e=>ce(e.$variant).background.disabled};
|
|
1880
|
+
border-color: ${e=>ce(e.$variant).border.disabled};
|
|
1971
1881
|
|
|
1972
1882
|
&::placeholder {
|
|
1973
|
-
color: ${e=>
|
|
1883
|
+
color: ${e=>ce(e.$variant).placeholder.disabled};
|
|
1974
1884
|
}
|
|
1975
1885
|
}
|
|
1976
|
-
|
|
1977
|
-
&:focus-visible {
|
|
1978
|
-
outline: 2px solid ${e=>ne(e.$variant).focus};
|
|
1979
|
-
}
|
|
1980
|
-
`,$t=A.newClassNameGetter("textarea"),Gl=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,variant:c="normal",rows:d=4,...p})=>a.jsxs(Yl,{className:$t("container",e),$fullWidth:!!i,children:[n&&a.jsx(Hl,{variant:c,className:$t("label",r==null?void 0:r.label),children:n}),a.jsx(Vl,{...p,ref:l,rows:d,disabled:o,$variant:c,className:$t("textarea",r==null?void 0:r.textarea)})]}),Ar=u.createContext(null),St=3,xr={default:{background:"#374151",text:t.COLORS.white,border:"#374151"},success:{background:t.COLORS.green,text:t.COLORS.white,border:t.COLORS.green},warning:{background:t.COLORS.yellow,text:t.COLORS.white,border:t.COLORS.yellow},danger:{background:t.COLORS.red,text:t.COLORS.white,border:t.COLORS.red}},Wl=(e,r)=>{switch(r.type){case"ADD_TOAST":{const o=r.payload;return e.toasts.length<St?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=r.payload,i=e.toasts.filter(l=>l.id!==o),n=e.queue[0];return n&&i.length<St?{toasts:[...i,n],queue:e.queue.slice(1)}:{...e,toasts:i}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=St?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},Xl={toasts:[],queue:[]},yt=e=>xr[e]??xr.default,Ul=ae.keyframes`
|
|
1886
|
+
`,$t=A.newClassNameGetter("textarea"),Gl=({className:e,classnames:r,disabled:o,fullWidth:i,label:n,ref:l,variant:c="normal",rows:d=4,...p})=>a.jsxs(Yl,{className:$t("container",e),$fullWidth:!!i,children:[n&&a.jsx(Hl,{variant:c,className:$t("label",r==null?void 0:r.label),children:n}),a.jsx(Vl,{...p,ref:l,rows:d,disabled:o,$variant:c,className:$t("textarea",r==null?void 0:r.textarea)})]}),Ar=u.createContext(null),St=3,xr={default:{background:"#374151",text:t.COLORS.white,border:"#374151"},success:{background:t.COLORS.green,text:t.COLORS.white,border:t.COLORS.green},warning:{background:t.COLORS.yellow,text:t.COLORS.white,border:t.COLORS.yellow},danger:{background:t.COLORS.red,text:t.COLORS.white,border:t.COLORS.red}},Wl=(e,r)=>{switch(r.type){case"ADD_TOAST":{const o=r.payload;return e.toasts.length<St?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=r.payload,i=e.toasts.filter(l=>l.id!==o),n=e.queue[0];return n&&i.length<St?{toasts:[...i,n],queue:e.queue.slice(1)}:{...e,toasts:i}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=St?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},Xl={toasts:[],queue:[]},yt=e=>xr[e]??xr.default,Ul=oe.keyframes`
|
|
1981
1887
|
from {
|
|
1982
1888
|
transform: translateY(100%);
|
|
1983
1889
|
opacity: 0;
|
|
@@ -1986,7 +1892,7 @@
|
|
|
1986
1892
|
transform: translateY(0);
|
|
1987
1893
|
opacity: 1;
|
|
1988
1894
|
}
|
|
1989
|
-
`,ql=
|
|
1895
|
+
`,ql=oe.keyframes`
|
|
1990
1896
|
from {
|
|
1991
1897
|
transform: translateY(0);
|
|
1992
1898
|
opacity: 1;
|
|
@@ -2181,5 +2087,5 @@
|
|
|
2181
2087
|
`,sd=s.div`
|
|
2182
2088
|
position: fixed;
|
|
2183
2089
|
${e=>Dr(e)}
|
|
2184
|
-
`,vt=A.newClassNameGetter("tooltip"),
|
|
2090
|
+
`,vt=A.newClassNameGetter("tooltip"),se=8,pd=({children:e,className:r,classnames:o,content:i,delay:n=200,placement:l="top",portalRenderNode:c,ref:d,variant:p="dark",...h})=>{const[g,f]=u.useState(!1),[O,m]=u.useState(null),[y,S]=u.useState(l),[v,x]=u.useState({top:0,left:0}),$=u.useRef(null),b=u.useRef(null),L=u.useCallback(()=>{var T,F;if(!$.current)return;const z=$.current.getBoundingClientRect(),_=((T=b.current)==null?void 0:T.offsetWidth)??100,E=((F=b.current)==null?void 0:F.offsetHeight)??30,w=z.top-se,M=window.innerHeight-z.bottom-se,C=z.left-se,I=window.innerWidth-z.right-se;let k=l;if(l==="top"&&w<E&&M>w?k="bottom":l==="bottom"&&M<E&&w>M?k="top":l==="left"&&C<_&&I>C?k="right":l==="right"&&I<_&&C>I&&(k="left"),S(k),c){let B,V;switch(k){case"top":B=z.top-E-se,V=z.left+z.width/2-_/2;break;case"bottom":B=z.bottom+se,V=z.left+z.width/2-_/2;break;case"left":B=z.top+z.height/2-E/2,V=z.left-_-se;break;case"right":B=z.top+z.height/2-E/2,V=z.right+se;break;default:B=0,V=0}const P=8;V=Math.max(P,Math.min(V,window.innerWidth-_-P)),B=Math.max(P,Math.min(B,window.innerHeight-E-P)),x({top:B,left:V})}},[l,c]);u.useLayoutEffect(()=>{g&&L()},[g,L]);const j=()=>{const z=setTimeout(()=>{f(!0)},n);m(z)},N=()=>{O&&(clearTimeout(O),m(null)),f(!1)},H=c?ge.createPortal(a.jsx(sd,{ref:b,className:vt("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,style:{top:v.top,left:v.left},children:i}),c):a.jsx(cd,{ref:b,className:vt("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,children:i});return a.jsxs(ld,{...h,ref:z=>{$.current=z,typeof d=="function"?d(z):d&&(d.current=z)},className:vt("wrapper",r),onMouseEnter:j,onMouseLeave:N,children:[e,H]})};exports.Autocomplete=Lo;exports.Button=_e;exports.Card=Mo;exports.Checkbox=tt;exports.CheckboxCard=Ko;exports.CheckboxGroup=ei;exports.Chip=Qe;exports.Confirmation=pi;exports.Container=bi;exports.DatePicker=Bi;exports.Drawer=Wi;exports.Dropdown=Ji;exports.FieldLabel=ne;exports.FieldMessage=rn;exports.GlobalStyle=io;exports.ImageCropper=sa;exports.Input=Lr;exports.KeySymbol=Sr;exports.KeysBindings=yr;exports.Modal=Pr;exports.MultiSelect=ka;exports.OtpCode=Ea;exports.Panel=_a;exports.Progress=Ba;exports.Radio=Pt;exports.RadioCard=Ja;exports.RadioGroup=rl;exports.SaveProgressProvider=nl;exports.Select=fl;exports.Spinner=Lt;exports.StatusCard=ml;exports.Stepper=jl;exports.Tabs=Bl;exports.Tags=_l;exports.Textarea=Gl;exports.ToastProvider=od;exports.Tooltip=pd;exports.formatDateGo=vr;exports.useImageCropper=kr;exports.useSaveProgress=al;exports.useToast=id;
|
|
2185
2091
|
//# sourceMappingURL=index.cjs.map
|