@vacano/ui 1.3.0 → 1.4.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 +143 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +589 -562
- 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"),ie=require("@emotion/react"),g=require("react"),t=require("./media-OVL6YjWb.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./X-CI1qRJDP.cjs"),ie=require("@emotion/react"),g=require("react"),t=require("./media-OVL6YjWb.cjs"),N=require("./tooling-Dflq0Y98.cjs"),ge=require("react-dom");function qo(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const Ce=qo(g);function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ot.apply(null,arguments)}const Ko=ie.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
:focus:not(:focus-visible) {
|
|
142
142
|
outline: none;
|
|
143
143
|
}
|
|
144
|
-
`,Zo=()=>a.jsx(ie.Global,{styles:Ko});var Jo=/^((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)-.*))$/,Qo=a.memoize(function(e){return Jo.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),er=Qo,tr=function(o){return o!=="theme"},Lt=function(o){return typeof o=="string"&&o.charCodeAt(0)>96?er:tr},zt=function(o,r,i){var n;if(r){var l=r.shouldForwardProp;n=o.__emotion_forwardProp&&l?function(c){return o.__emotion_forwardProp(c)&&l(c)}:l}return typeof n!="function"&&i&&(n=o.__emotion_forwardProp),n},or=function(o){var r=o.cache,i=o.serialized,n=o.isStringTag;return a.registerStyles(r,i,n),a.useInsertionEffectAlwaysWithSyncFallback(function(){return a.insertStyles(r,i,n)}),null},rr=function e(o,r){var i=o.__emotion_real===o,n=i&&o.__emotion_base||o,l,c;r!==void 0&&(l=r.label,c=r.target);var d=zt(o,r,i),p=d||Lt(n),h=!p("as");return function(){var u=arguments,f=i&&o.__emotion_styles!==void 0?o.__emotion_styles.slice(0):[];if(l!==void 0&&f.push("label:"+l+";"),u[0]==null||u[0].raw===void 0)f.push.apply(f,u);else{var O=u[0];f.push(O[0]);for(var k=u.length,y=1;y<k;y++)f.push(u[y],O[y])}var S=ie.withEmotionCache(function($,x,v){var b=h&&$.as||n,L="",j=[],E=$;if($.theme==null){E={};for(var G in $)E[G]=$[G];E.theme=Ce.useContext(ie.ThemeContext)}typeof $.className=="string"?L=a.getRegisteredStyles(x.registered,j,$.className):$.className!=null&&(L=$.className+" ");var P=a.serializeStyles(f.concat(j),x.registered,E);L+=x.key+"-"+P.name,c!==void 0&&(L+=" "+c);var D=h&&d===void 0?Lt(b):p,
|
|
144
|
+
`,Zo=()=>a.jsx(ie.Global,{styles:Ko});var Jo=/^((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)-.*))$/,Qo=a.memoize(function(e){return Jo.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),er=Qo,tr=function(o){return o!=="theme"},Lt=function(o){return typeof o=="string"&&o.charCodeAt(0)>96?er:tr},zt=function(o,r,i){var n;if(r){var l=r.shouldForwardProp;n=o.__emotion_forwardProp&&l?function(c){return o.__emotion_forwardProp(c)&&l(c)}:l}return typeof n!="function"&&i&&(n=o.__emotion_forwardProp),n},or=function(o){var r=o.cache,i=o.serialized,n=o.isStringTag;return a.registerStyles(r,i,n),a.useInsertionEffectAlwaysWithSyncFallback(function(){return a.insertStyles(r,i,n)}),null},rr=function e(o,r){var i=o.__emotion_real===o,n=i&&o.__emotion_base||o,l,c;r!==void 0&&(l=r.label,c=r.target);var d=zt(o,r,i),p=d||Lt(n),h=!p("as");return function(){var u=arguments,f=i&&o.__emotion_styles!==void 0?o.__emotion_styles.slice(0):[];if(l!==void 0&&f.push("label:"+l+";"),u[0]==null||u[0].raw===void 0)f.push.apply(f,u);else{var O=u[0];f.push(O[0]);for(var k=u.length,y=1;y<k;y++)f.push(u[y],O[y])}var S=ie.withEmotionCache(function($,x,v){var b=h&&$.as||n,L="",j=[],E=$;if($.theme==null){E={};for(var G in $)E[G]=$[G];E.theme=Ce.useContext(ie.ThemeContext)}typeof $.className=="string"?L=a.getRegisteredStyles(x.registered,j,$.className):$.className!=null&&(L=$.className+" ");var P=a.serializeStyles(f.concat(j),x.registered,E);L+=x.key+"-"+P.name,c!==void 0&&(L+=" "+c);var D=h&&d===void 0?Lt(b):p,I={};for(var C in $)h&&C==="as"||D(C)&&(I[C]=$[C]);return I.className=L,v&&(I.ref=v),Ce.createElement(Ce.Fragment,null,Ce.createElement(or,{cache:x,serialized:P,isStringTag:typeof b=="string"}),Ce.createElement(b,I))});return S.displayName=l!==void 0?l:"Styled("+(typeof n=="string"?n:n.displayName||n.name||"Component")+")",S.defaultProps=o.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($,x){var v=e($,Ot({},r,x,{shouldForwardProp:zt(S,x,!0)}));return v.apply(void 0,f)},S}},ir=["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=rr.bind(null);ir.forEach(function(e){s[e]=s(e)});const Pt={compact:{height:"32px",padding:"0 8px",radius:"12px",iconSize:"16px"},default:{height:"40px",padding:"0 12px",radius:"16px",iconSize:"20px"}},jt={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 o=jt[e];return o||jt.normal},oe=e=>{const o=Pt[e];return o||Pt.default},nr=e=>e?"auto":"fit-content",ar=s.button`
|
|
145
145
|
display: flex;
|
|
146
146
|
gap: 6px;
|
|
147
147
|
text-decoration: none;
|
|
@@ -212,12 +212,12 @@
|
|
|
212
212
|
border-radius: 4px;
|
|
213
213
|
width: fit-content;
|
|
214
214
|
background-color: ${e=>e.$variant==="light"?t.alpha(t.COLORS.white,25):t.alpha(t.COLORS.black,25)};
|
|
215
|
-
`,ur=
|
|
215
|
+
`,ur=N.newClassNameGetter("key-symbol"),bo=({className:e,ref:o,symbol:r,variant:i="light",...n})=>r?a.jsx(pr,{...n,ref:o,className:ur("container",e),$variant:i,children:r}):null,Et=N.newClassNameGetter("key-bindings"),go=({className:e,classnames:o,keys:r,ref:i,variant:n,...l})=>{const c=g.useMemo(()=>t.getKeySymbols(r),[r]);return c.length===0?null:a.jsx(sr,{...l,ref:i,className:Et("container",e),children:c.map(d=>a.jsx(bo,{symbol:d,className:Et("item",o==null?void 0:o.item),variant:n},d))})},Tt=N.newClassNameGetter("button"),Ie=({children:e,className:o,classnames:r,disabled:i,fullWidth:n,icon:l,loading:c,onClick:d,ref:p=null,keyBindings:h=[],size:u="default",type:f="button",variant:O="normal",...k})=>{const y=g.useRef(null);g.useImperativeHandle(p,()=>y.current,[]),t.useKeyBinding(h,()=>{var $;($=y.current)==null||$.click()});const S=g.useMemo(()=>{switch(f){case"link":return"button";default:return f}},[f]);return a.jsxs(ar,{...k,onClick:d,ref:y,type:S,disabled:i,className:Tt("container",o),$variant:O,$size:u,$fullWidth:!!n,$iconOnly:!!l&&!(e||(h==null?void 0:h.length)>0),children:[c&&a.jsx(cr,{$size:u}),l&&!c&&a.jsx(lr,{$size:u,children:l}),e&&a.jsx(dr,{className:Tt("label",r==null?void 0:r.label),children:e}),a.jsx(go,{keys:h,variant:O==="system"?"light":"dark"})]})},hr=s.div`
|
|
216
216
|
background-color: ${t.COLORS.white};
|
|
217
217
|
border-radius: 16px;
|
|
218
218
|
border: ${e=>e.$border?`1px solid ${t.alpha(t.COLORS["iron-grey"],15)}`:"none"};
|
|
219
219
|
box-shadow: ${e=>e.$shadow?`0 2px 8px ${t.alpha(t.COLORS.black,10)}`:"none"};
|
|
220
|
-
`,br=
|
|
220
|
+
`,br=N.newClassNameGetter("card"),gr=({children:e,className:o,ref:r,border:i=!1,shadow:n=!1,...l})=>a.jsx(hr,{...l,ref:r,className:br("container",o),$border:i,$shadow:n,children:e}),Nt={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}},ue=e=>Nt[e]??Nt.normal,fr=s.label`
|
|
221
221
|
display: inline-flex;
|
|
222
222
|
align-items: center;
|
|
223
223
|
gap: 8px;
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
line-height: 1;
|
|
270
270
|
color: ${e=>ue(e.$variant).label};
|
|
271
271
|
user-select: none;
|
|
272
|
-
`,Re=
|
|
272
|
+
`,Re=N.newClassNameGetter("checkbox"),Je=({checked:e,className:o,classnames:r,disabled:i,indeterminate:n=!1,label:l,onChange:c,ref:d,variant:p="normal",...h})=>a.jsxs(fr,{className:Re("container",o),$disabled:!!i,$variant:p,children:[a.jsx(xr,{...h,ref:d,type:"checkbox",className:Re("input",r==null?void 0:r.input),checked:e,disabled:i,onChange:c}),a.jsx(Or,{className:Re("box",r==null?void 0:r.box),$checked:e,$indeterminate:n,$variant:p,children:a.jsx($r,{className:Re("icon",r==null?void 0:r.icon),$visible:n||e,$variant:p,children:n?a.jsx(a.Minus,{}):a.jsx(a.Check,{})})}),l&&a.jsx(Sr,{className:Re("label",r==null?void 0:r.label),$variant:p,children:l})]}),It={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)}}},ce=e=>It[e]??It.normal,yr=s.label`
|
|
273
273
|
display: grid;
|
|
274
274
|
grid-template-columns: auto 1fr;
|
|
275
275
|
align-items: start;
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
label[data-disabled='true'] & {
|
|
332
332
|
color: ${e=>ce(e.$variant).description.disabled};
|
|
333
333
|
}
|
|
334
|
-
`,Fe=
|
|
334
|
+
`,Fe=N.newClassNameGetter("checkbox-card"),Rr=({checked:e,className:o,classnames:r,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...u})=>a.jsxs(yr,{className:Fe("container",o),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(vr,{...u,ref:p,type:"checkbox",checked:e,disabled:n,onChange:d}),a.jsx(Je,{className:r==null?void 0:r.checkbox,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(mr,{className:Fe("content",r==null?void 0:r.content),children:[a.jsx(wr,{className:Fe("label",r==null?void 0:r.label),$variant:h,children:c}),i&&a.jsx(Cr,{className:Fe("description",r==null?void 0:r.description),$variant:h,children:i})]})]}),At={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},kr=s.div`
|
|
335
335
|
display: flex;
|
|
336
336
|
flex-direction: column;
|
|
337
337
|
gap: 8px;
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
display: flex;
|
|
346
346
|
flex-direction: column;
|
|
347
347
|
gap: 12px;
|
|
348
|
-
`,tt=
|
|
348
|
+
`,tt=N.newClassNameGetter("checkbox-group"),Pr=({className:e,classnames:o,disabled:r,label:i,onChange:n,options:l,ref:c,value:d,...p})=>{const h=(u,f)=>{n(f?[...d,u]:d.filter(O=>O!==u))};return a.jsxs(kr,{...p,ref:c,className:tt("container",e),children:[i&&a.jsx(Lr,{className:tt("label",o==null?void 0:o.label),$disabled:r,children:i}),a.jsx(zr,{className:tt("options",o==null?void 0:o.options),children:l.map(u=>a.jsx(Je,{className:o==null?void 0:o.checkbox,checked:d.includes(u.value),label:u.label,disabled:r,onChange:f=>h(u.value,f.target.checked)},u.value))})]})},Dt={gray:{background:t.alpha(t.COLORS["iron-grey"],10),color:t.COLORS["iron-grey"],deleteHover:t.alpha(t.COLORS["iron-grey"],20)},red:{background:t.alpha(t.COLORS.red,10),color:t.COLORS.red,deleteHover:t.alpha(t.COLORS.red,20)},blue:{background:t.alpha(t.COLORS["steel-blue"],10),color:t.COLORS["steel-blue"],deleteHover:t.alpha(t.COLORS["steel-blue"],20)},black:{background:t.COLORS.black,color:t.COLORS.white,deleteHover:t.alpha(t.COLORS.white,20)}},$t=e=>Dt[e]??Dt.gray,jr=s.span`
|
|
349
349
|
display: inline-flex;
|
|
350
350
|
align-items: center;
|
|
351
351
|
gap: 4px;
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
`,Tr=s.span`
|
|
383
383
|
flex: 1 0 auto;
|
|
384
384
|
text-align: center;
|
|
385
|
-
`,ot=
|
|
385
|
+
`,ot=N.newClassNameGetter("chip"),Ke=({children:e,className:o,classnames:r,deletable:i,onDelete:n,ref:l,variant:c="gray",...d})=>a.jsxs(jr,{...d,ref:l,className:ot("container",o),$variant:c,$deletable:!!i,children:[a.jsx(Tr,{className:ot("label",r==null?void 0:r.label),children:e}),i&&a.jsx(Er,{type:"button",className:ot("delete",r==null?void 0:r.delete),$variant:c,onClick:n,children:a.jsx(a.X,{})})]}),Nr="Confirm",Ir="Cancel",Ar=ie.keyframes`
|
|
386
386
|
from {
|
|
387
387
|
opacity: 0;
|
|
388
388
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -426,7 +426,7 @@
|
|
|
426
426
|
display: flex;
|
|
427
427
|
align-items: center;
|
|
428
428
|
gap: 8px;
|
|
429
|
-
`,ke=
|
|
429
|
+
`,ke=N.newClassNameGetter("confirmation"),Br=({cancelBindings:e,cancelLabel:o=Ir,className:r,classnames:i,confirmLabel:n=Nr,loading:l=!1,message:c,onCancel:d,onConfirm:p,open:h=!0,ref:u,submitBindings:f,...O})=>h?a.jsxs(_r,{...O,ref:u,className:ke("container",r),$open:h,children:[a.jsx(Mr,{className:ke("message",i==null?void 0:i.message),children:c}),a.jsxs(Fr,{className:ke("actions",i==null?void 0:i.actions),children:[a.jsx(Ie,{variant:"system",size:"compact",onClick:d,keyBindings:e,className:ke("cancel-button",i==null?void 0:i.cancelButton),children:o}),a.jsx(Ie,{variant:"danger",size:"compact",onClick:p,loading:l,keyBindings:f,className:ke("confirm-button",i==null?void 0:i.confirmButton),children:n})]})]}):null,Le={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`},Yr=s.div`
|
|
430
430
|
width: 100%;
|
|
431
431
|
|
|
432
432
|
${t.mediaUp("sm")} {
|
|
@@ -448,11 +448,11 @@
|
|
|
448
448
|
${t.mediaUp("2xl")} {
|
|
449
449
|
max-width: ${Le["2xl"]};
|
|
450
450
|
}
|
|
451
|
-
`,Hr=
|
|
451
|
+
`,Hr=N.newClassNameGetter("container"),Gr=({children:e,className:o,ref:r,...i})=>a.jsx(Yr,{...i,ref:r,className:Hr("container",o),children:e}),qe={compact:{height:"32px",padding:"0 10px",radius:"14px",iconSize:16},default:{height:"40px",padding:"0 14px",radius:"16px",iconSize:20}},$e={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=36,Qe=2,Vr=12,fo=(e,o,r="en")=>{const i=e.getFullYear(),n=e.getMonth(),l=e.getDate(),c=e.getHours(),d=e.getMinutes(),p=e.getSeconds(),h=c%12||12,u=c>=12,f=new Intl.DateTimeFormat(r,{month:"long"}).format(e),O=new Intl.DateTimeFormat(r,{month:"short"}).format(e),k=new Intl.DateTimeFormat(r,{weekday:"long"}).format(e),y=new Intl.DateTimeFormat(r,{weekday:"short"}).format(e),S=L=>L.toString().padStart(2,"0"),$=L=>L.toString().padStart(2," "),x=L=>`\0${L}\0`,v=[["2006","YEARFOUR",i.toString()],["January","MONTHLONG",f],["Monday","WEEKDAYLONG",k],["Jan","MONTHSHORT",O],["Mon","WEEKDAYSHORT",y],["06","YEARTWO",i.toString().slice(-2)],["01","MONTHPAD",S(n+1)],["_2","DAYSPACE",$(l)],["02","DAYPAD",S(l)],["15","HOURTWENTYFOUR",S(c)],["03","HOURTWELVEPAD",S(h)],["04","MINUTE",S(d)],["05","SECOND",S(p)],["PM","AMPMUP",u?"PM":"AM"],["pm","AMPMLOW",u?"pm":"am"],["1","MONTH",(n+1).toString()],["2","DAY",l.toString()],["3","HOURTWELVE",h.toString()]];let b=o;for(const[L,j]of v)b=b.split(L).join(x(j));for(const[,L,j]of v)b=b.split(x(L)).join(j);return b},Wr=(e,o)=>new Date(e,o+1,0).getDate(),Ur=(e,o)=>new Date(e,o,1).getDay(),Xr=(e,o,r=1)=>{const i=Wr(e,o);let l=Ur(e,o)-r;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},qr=(e,o=1)=>{const r=[];for(let i=0;i<7;i++){const n=(o+i)%7,l=new Date(2024,0,7+n);r.push(new Intl.DateTimeFormat(e,{weekday:"short"}).format(l))}return r},Kr=e=>{const o=[];for(let r=0;r<12;r++){const i=new Date(2024,r,1);o.push(new Intl.DateTimeFormat(e,{month:"short"}).format(i))}return o},_t=(e,o)=>e.getFullYear()===o.getFullYear()&&e.getMonth()===o.getMonth()&&e.getDate()===o.getDate(),Mt=(e,o)=>e.getFullYear()===o.getFullYear()&&e.getMonth()===o.getMonth(),Zr=(e,o)=>e.getFullYear()===o.getFullYear(),Ft=(e,o,r,i,n)=>{const l=new Date(e,o,r);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},Bt=(e,o,r,i)=>{if(r){const n=r.getFullYear(),l=r.getMonth();if(e<n||e===n&&o<l)return!0}if(i){const n=i.getFullYear(),l=i.getMonth();if(e>n||e===n&&o>l)return!0}return!1},Yt=(e,o,r)=>!!(o&&e<o.getFullYear()||r&&e>r.getFullYear()),Jr=(e,o=12)=>{const r=e-Math.floor(o/2),i=[];for(let n=0;n<o;n++)i.push(r+n);return i},Qr=e=>{switch(e){case"date":return"02.01.2006";case"month":return"January 2006";case"year":return"2006"}},ei=s.span`
|
|
452
452
|
font-size: 12px;
|
|
453
453
|
font-weight: 500;
|
|
454
454
|
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
455
|
-
`,ti=
|
|
455
|
+
`,ti=N.newClassNameGetter("field-label"),fe=({children:e,className:o,ref:r,required:i,variant:n="normal",...l})=>e?a.jsxs(ei,{...l,ref:r,className:ti("container",o),$variant:n,children:[e," ",i&&"*"]}):null,oi=s.div`
|
|
456
456
|
position: relative;
|
|
457
457
|
display: inline-flex;
|
|
458
458
|
flex-direction: column;
|
|
@@ -695,7 +695,7 @@
|
|
|
695
695
|
`,xi=s.div`
|
|
696
696
|
width: ${ne}px;
|
|
697
697
|
height: ${ne}px;
|
|
698
|
-
`,K=
|
|
698
|
+
`,K=N.newClassNameGetter("date-picker"),Be=4,Oi=300,$i=({value:e,onChange:o,mode:r="date",displayFormat:i,placeholder:n,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:p,size:h="default",variant:u="normal",disabled:f=!1,fullWidth:O=!1,label:k,portalRenderNode:y,open:S,onOpen:$,onClose:x,className:v,classnames:b,ref:L,...j})=>{const E=g.useMemo(()=>new Date,[]),[G,P]=g.useState(!1),[D,I]=g.useState({top:0,left:0}),[C,F]=g.useState("bottom"),[m,T]=g.useState(()=>r==="year"?"years":r==="month"?"months":"days"),[R,_]=g.useState(()=>e??E),[Y,M]=g.useState(()=>((e==null?void 0:e.getFullYear())??E.getFullYear())-6),H=g.useRef(null),z=g.useRef(null),A=g.useRef(null),X=S!==void 0,q=X?S:G,xe=i??Qr(r),Ae=g.useMemo(()=>qr(l,c),[l,c]),et=g.useMemo(()=>Kr(l),[l]),jo=g.useMemo(()=>Xr(R.getFullYear(),R.getMonth(),c),[R,c]),De=g.useMemo(()=>Jr(Y+6,12),[Y]),wt=g.useMemo(()=>e?fo(e,xe,l):null,[e,xe,l]),Eo=n??xe.replace(/2006|06|January|Jan|01|02/g,"__"),ve=g.useCallback(()=>{var we;if(!z.current)return;const w=z.current.getBoundingClientRect(),B=((we=A.current)==null?void 0:we.offsetHeight)??Oi,me=window.innerHeight-w.bottom-Be,_e=w.top-Be,Oe=me<B&&_e>me?"top":"bottom";if(F(Oe),y){const Me=Oe==="bottom"?w.bottom+Be:w.top-B-Be;I({top:Me,left:w.left})}},[y]),Ct=g.useCallback(()=>{if(f)return;X||P(!0),$==null||$(),T(r==="year"?"years":r==="month"?"months":"days");const w=e??E;_(w),M(w.getFullYear()-6)},[f,X,$,r,e,E]),Z=g.useCallback(()=>{X||P(!1),x==null||x()},[X,x]),To=g.useCallback(()=>{q?Z():Ct()},[q,Z,Ct]),No=g.useCallback(w=>{const B=new Date(R.getFullYear(),R.getMonth(),w);o==null||o(B),Z()},[R,o,Z]),Io=g.useCallback(w=>{if(r==="month"){const B=new Date(R.getFullYear(),w,1);o==null||o(B),Z()}else _(new Date(R.getFullYear(),w,1)),T("days")},[r,R,o,Z]),Ao=g.useCallback(w=>{if(r==="year"){const B=new Date(w,0,1);o==null||o(B),Z()}else r==="month"?(_(new Date(w,R.getMonth(),1)),T("months")):(_(new Date(w,R.getMonth(),1)),T("months"))},[r,R,o,Z]),Do=g.useCallback(()=>{_(w=>new Date(w.getFullYear(),w.getMonth()-1,1))},[]),_o=g.useCallback(()=>{_(w=>new Date(w.getFullYear(),w.getMonth()+1,1))},[]),Mo=g.useCallback(()=>{_(w=>new Date(w.getFullYear()-1,w.getMonth(),1))},[]),Fo=g.useCallback(()=>{_(w=>new Date(w.getFullYear()+1,w.getMonth(),1))},[]),Bo=g.useCallback(()=>{M(w=>w-12)},[]),Yo=g.useCallback(()=>{M(w=>w+12)},[]),Rt=g.useCallback(()=>{m==="days"?T("months"):m==="months"&&T("years")},[m]);g.useLayoutEffect(()=>{q&&ve()},[q,ve]),g.useEffect(()=>{const w=Oe=>{const we=Oe.target,Me=H.current&&!H.current.contains(we),Xo=A.current&&!A.current.contains(we);y?Me&&Xo&&Z():Me&&Z()},B=Oe=>{Oe.key==="Escape"&&Z()},me=()=>{q&&y&&ve()},_e=()=>{q&&y&&ve()};return q&&(document.addEventListener("mousedown",w),document.addEventListener("keydown",B),y&&(window.addEventListener("scroll",me,!0),window.addEventListener("resize",_e))),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",B),window.removeEventListener("scroll",me,!0),window.removeEventListener("resize",_e)}},[q,Z,y,ve]);const Ho=qe[h].iconSize,Go=()=>a.jsxs(a.Fragment,{children:[a.jsxs(rt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(it,{onClick:Rt,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(R)}),a.jsxs(nt,{children:[a.jsx(Se,{onClick:Do,type:"button","aria-label":"Previous month",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Se,{onClick:_o,type:"button","aria-label":"Next month",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(ci,{children:Ae.map((w,B)=>a.jsx(si,{children:w},B))}),a.jsx(pi,{className:K("grid",b==null?void 0:b.grid),children:jo.map((w,B)=>w===null?a.jsx(xi,{},B):a.jsx(ui,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?_t(e,new Date(R.getFullYear(),R.getMonth(),w)):!1,$today:_t(E,new Date(R.getFullYear(),R.getMonth(),w)),$disabled:Ft(R.getFullYear(),R.getMonth(),w,d,p),disabled:Ft(R.getFullYear(),R.getMonth(),w,d,p),onClick:()=>No(w),children:w},B))})]}),Vo=()=>a.jsxs(a.Fragment,{children:[a.jsxs(rt,{className:K("header",b==null?void 0:b.header),children:[a.jsx(it,{onClick:Rt,type:"button",children:R.getFullYear()}),a.jsxs(nt,{children:[a.jsx(Se,{onClick:Mo,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Se,{onClick:Fo,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(hi,{className:K("grid",b==null?void 0:b.grid),children:et.map((w,B)=>a.jsx(bi,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Mt(e,new Date(R.getFullYear(),B,1)):!1,$current:Mt(E,new Date(R.getFullYear(),B,1)),$disabled:Bt(R.getFullYear(),B,d,p),disabled:Bt(R.getFullYear(),B,d,p),onClick:()=>Io(B),children:w},B))})]}),Wo=()=>a.jsxs(a.Fragment,{children:[a.jsxs(rt,{className:K("header",b==null?void 0:b.header),children:[a.jsxs(it,{type:"button",style:{cursor:"default"},children:[De[0]," - ",De[De.length-1]]}),a.jsxs(nt,{children:[a.jsx(Se,{onClick:Bo,type:"button","aria-label":"Previous years",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Se,{onClick:Yo,type:"button","aria-label":"Next years",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(gi,{className:K("grid",b==null?void 0:b.grid),children:De.map(w=>a.jsx(fi,{type:"button",className:K("cell",b==null?void 0:b.cell),$selected:e?Zr(e,new Date(w,0,1)):!1,$current:E.getFullYear()===w,$disabled:Yt(w,d,p),disabled:Yt(w,d,p),onClick:()=>Ao(w),children:w},w))})]}),kt=()=>{switch(m){case"days":return Go();case"months":return Vo();case"years":return Wo()}},Uo=y?ge.createPortal(a.jsx(di,{ref:A,$open:q,$position:C,className:K("calendar",b==null?void 0:b.calendar),style:{top:D.top,left:D.left},children:kt()}),y):a.jsx(li,{ref:A,$open:q,$position:C,className:K("calendar",b==null?void 0:b.calendar),children:kt()});return a.jsxs(oi,{...j,ref:L??H,$fullWidth:O,className:K("container",v),children:[k&&a.jsx(ri,{children:k}),a.jsxs(ii,{ref:z,type:"button",onClick:To,disabled:f,$size:h,$variant:u,$disabled:f,$open:q,$hasValue:!!wt,className:K("trigger",b==null?void 0:b.trigger),children:[a.jsx(ni,{children:wt??Eo}),a.jsx(ai,{$open:q,children:a.jsx(a.ChevronDown,{size:Ho})})]}),Uo]})},Si={left:t.KEYFRAMES.slideInLeft,right:t.KEYFRAMES.slideInRight,top:t.KEYFRAMES.slideInTop,bottom:t.KEYFRAMES.slideInBottom},yi=(e,o)=>{switch(e){case"left":return`
|
|
699
699
|
top: 0;
|
|
700
700
|
left: 0;
|
|
701
701
|
height: 100%;
|
|
@@ -722,7 +722,7 @@
|
|
|
722
722
|
box-shadow: 0 4px 24px ${t.alpha(t.COLORS.black,20)};
|
|
723
723
|
${e=>yi(e.$position,e.$size)}
|
|
724
724
|
animation: ${e=>Si[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
725
|
-
`,mi=
|
|
725
|
+
`,mi=N.newClassNameGetter("drawer"),wi=({animated:e,children:o,className:r,open:i,position:n="right",ref:l,size:c="400px",...d})=>i?ge.createPortal(a.jsx(vi,{...d,ref:l,className:mi("container",r),$animated:!!e,$position:n,$size:c,children:o}),document.body):null,Ci=s.div`
|
|
726
726
|
position: relative;
|
|
727
727
|
display: inline-block;
|
|
728
728
|
`,Ri=s.div`
|
|
@@ -757,11 +757,17 @@
|
|
|
757
757
|
opacity 0.15s ease,
|
|
758
758
|
transform 0.15s ease,
|
|
759
759
|
visibility 0.15s;
|
|
760
|
-
`,Ye=
|
|
760
|
+
`,Ye=N.newClassNameGetter("dropdown"),He=4,zi=100,Pi=({align:e="left",children:o,className:r,classnames:i,onClose:n,onOpen:l,open:c,portalRenderNode:d,ref:p,trigger:h,...u})=>{const[f,O]=g.useState(!1),[k,y]=g.useState({top:0,left:0}),[S,$]=g.useState("bottom"),x=g.useRef(null),v=g.useRef(null),b=g.useRef(null),L=c!==void 0,j=L?c:f,E=g.useCallback(()=>{var _,Y;if(!v.current)return;const I=v.current.getBoundingClientRect(),C=((_=b.current)==null?void 0:_.offsetHeight)??zi,F=((Y=b.current)==null?void 0:Y.offsetWidth)??160,m=window.innerHeight-I.bottom-He,T=I.top-He,R=m<C&&T>m?"top":"bottom";if($(R),d){let M;e==="left"?M=I.left:M=I.right-F;const H=R==="bottom"?I.bottom+He:I.top-C-He;y({top:H,left:M})}},[e,d]),G=g.useCallback(()=>{L?j?n==null||n():l==null||l():O(I=>{const C=!I;return C?l==null||l():n==null||n(),C})},[L,j,n,l]),P=g.useCallback(()=>{L||O(!1),n==null||n()},[L,n]);g.useLayoutEffect(()=>{j&&E()},[j,E]),g.useEffect(()=>{const I=T=>{const R=T.target,_=x.current&&!x.current.contains(R),Y=b.current&&!b.current.contains(R);d?_&&Y&&P():_&&P()},C=T=>{T.key==="Escape"&&P()},F=()=>{j&&d&&E()},m=()=>{j&&d&&E()};return j&&(document.addEventListener("mousedown",I),document.addEventListener("keydown",C),d&&(window.addEventListener("scroll",F,!0),window.addEventListener("resize",m))),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",C),window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",m)}},[j,P,d,E]);const D=d?ge.createPortal(a.jsx(Li,{ref:b,$open:j,$position:S,className:Ye("content",i==null?void 0:i.content),style:{top:k.top,left:k.left},children:o}),d):a.jsx(ki,{ref:b,$align:e,$open:j,$position:S,className:Ye("content",i==null?void 0:i.content),children:o});return a.jsxs(Ci,{...u,ref:p??x,className:Ye("container",r),children:[a.jsx(Ri,{ref:v,onClick:G,className:Ye("trigger",i==null?void 0:i.trigger),children:g.cloneElement(h)}),D]})},ji={normal:t.COLORS["iron-grey"],error:t.COLORS.red,success:t.COLORS.green,warning:t.COLORS.yellow},Ei=s.span`
|
|
761
|
+
display: block;
|
|
762
|
+
font-size: 12px;
|
|
763
|
+
font-weight: 500;
|
|
764
|
+
line-height: 1.4;
|
|
765
|
+
color: ${e=>ji[e.$variant]};
|
|
766
|
+
`,Ti=N.newClassNameGetter("field-message"),Ni=({children:e,className:o,ref:r,variant:i="normal",...n})=>e?a.jsx(Ei,{...n,ref:r,className:Ti("container",o),$variant:i,children:e}):null,Ii=s.div`
|
|
761
767
|
display: flex;
|
|
762
768
|
flex-direction: column;
|
|
763
769
|
gap: 12px;
|
|
764
|
-
`,
|
|
770
|
+
`,Ai=s.div`
|
|
765
771
|
width: ${({$size:e})=>e}px;
|
|
766
772
|
height: ${({$size:e})=>e}px;
|
|
767
773
|
border-radius: 8px;
|
|
@@ -777,10 +783,10 @@
|
|
|
777
783
|
height: 100%;
|
|
778
784
|
object-fit: cover;
|
|
779
785
|
}
|
|
780
|
-
`,
|
|
786
|
+
`,Di=s.span`
|
|
781
787
|
font-size: 12px;
|
|
782
788
|
color: ${t.COLORS["iron-grey"]};
|
|
783
|
-
`,
|
|
789
|
+
`,_i=e=>`
|
|
784
790
|
.${e} {
|
|
785
791
|
padding: 7px 16px;
|
|
786
792
|
font-size: 14px;
|
|
@@ -798,7 +804,7 @@
|
|
|
798
804
|
.${e}:active {
|
|
799
805
|
transform: translate(0, 1px);
|
|
800
806
|
}
|
|
801
|
-
`,
|
|
807
|
+
`,Mi=e=>`
|
|
802
808
|
.${e} {
|
|
803
809
|
display: flex;
|
|
804
810
|
flex: 1 1 auto;
|
|
@@ -822,7 +828,7 @@
|
|
|
822
828
|
max-height: 70vh;
|
|
823
829
|
}
|
|
824
830
|
}
|
|
825
|
-
`,
|
|
831
|
+
`,Fi=e=>`
|
|
826
832
|
.${e} {
|
|
827
833
|
padding: 7px 16px;
|
|
828
834
|
font-size: 14px;
|
|
@@ -840,7 +846,7 @@
|
|
|
840
846
|
.${e}:active {
|
|
841
847
|
transform: translate(0, 1px);
|
|
842
848
|
}
|
|
843
|
-
`,
|
|
849
|
+
`,Bi=e=>`
|
|
844
850
|
.${e} {
|
|
845
851
|
display: flex;
|
|
846
852
|
flex-direction: column;
|
|
@@ -858,7 +864,7 @@
|
|
|
858
864
|
border-radius: 8px;
|
|
859
865
|
}
|
|
860
866
|
}
|
|
861
|
-
`,
|
|
867
|
+
`,Yi=e=>`
|
|
862
868
|
.${e} {
|
|
863
869
|
display: flex;
|
|
864
870
|
justify-content: flex-end;
|
|
@@ -877,7 +883,7 @@
|
|
|
877
883
|
gap: 8px;
|
|
878
884
|
}
|
|
879
885
|
}
|
|
880
|
-
`,
|
|
886
|
+
`,Hi=e=>`
|
|
881
887
|
.${e} {
|
|
882
888
|
display: flex;
|
|
883
889
|
justify-content: flex-start;
|
|
@@ -899,7 +905,7 @@
|
|
|
899
905
|
font-size: 14px;
|
|
900
906
|
}
|
|
901
907
|
}
|
|
902
|
-
`,
|
|
908
|
+
`,Gi=e=>`
|
|
903
909
|
.${e} {
|
|
904
910
|
display: block;
|
|
905
911
|
z-index: 101;
|
|
@@ -917,27 +923,27 @@
|
|
|
917
923
|
position: absolute;
|
|
918
924
|
touch-action: none;
|
|
919
925
|
}
|
|
920
|
-
`,
|
|
926
|
+
`,Vi=e=>`
|
|
921
927
|
.${e} {
|
|
922
928
|
position: absolute;
|
|
923
929
|
z-index: 2;
|
|
924
930
|
background-color: rgba(0, 0, 0, 0.6);
|
|
925
931
|
touch-action: none;
|
|
926
932
|
}
|
|
927
|
-
`,
|
|
933
|
+
`,Wi=e=>`
|
|
928
934
|
.${e} {
|
|
929
935
|
position: absolute;
|
|
930
936
|
z-index: 3;
|
|
931
937
|
touch-action: none;
|
|
932
938
|
}
|
|
933
|
-
`,
|
|
939
|
+
`,Ui=e=>`
|
|
934
940
|
.${e} {
|
|
935
941
|
backface-visibility: hidden;
|
|
936
942
|
perspective: 1000px;
|
|
937
943
|
max-inline-size: unset !important;
|
|
938
944
|
max-block-size: unset !important;
|
|
939
945
|
}
|
|
940
|
-
`,
|
|
946
|
+
`,Xi=e=>`
|
|
941
947
|
.${e} {
|
|
942
948
|
position: absolute;
|
|
943
949
|
z-index: 100;
|
|
@@ -948,7 +954,7 @@
|
|
|
948
954
|
overflow: hidden;
|
|
949
955
|
border-radius: 50%;
|
|
950
956
|
}
|
|
951
|
-
`,
|
|
957
|
+
`,qi={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},Ki={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},Ge=(e,o)=>{const r=qi[o],{h:i,v:n}=Ki[o];return`
|
|
952
958
|
.${e} {
|
|
953
959
|
display: block;
|
|
954
960
|
z-index: 102;
|
|
@@ -974,7 +980,7 @@
|
|
|
974
980
|
${n}: -12px;
|
|
975
981
|
}
|
|
976
982
|
}
|
|
977
|
-
`},
|
|
983
|
+
`},Zi=e=>`
|
|
978
984
|
.${e} {
|
|
979
985
|
display: flex;
|
|
980
986
|
align-items: center;
|
|
@@ -1000,7 +1006,7 @@
|
|
|
1000
1006
|
padding-bottom: env(safe-area-inset-bottom, 8px);
|
|
1001
1007
|
}
|
|
1002
1008
|
}
|
|
1003
|
-
`,
|
|
1009
|
+
`,Ji=e=>`
|
|
1004
1010
|
.${e} {
|
|
1005
1011
|
backface-visibility: hidden;
|
|
1006
1012
|
user-select: none;
|
|
@@ -1013,25 +1019,25 @@
|
|
|
1013
1019
|
position: absolute;
|
|
1014
1020
|
z-index: 1;
|
|
1015
1021
|
}
|
|
1016
|
-
`,
|
|
1017
|
-
${
|
|
1018
|
-
${
|
|
1019
|
-
${
|
|
1020
|
-
${
|
|
1021
|
-
${
|
|
1022
|
-
${
|
|
1023
|
-
${
|
|
1024
|
-
${
|
|
1025
|
-
${
|
|
1026
|
-
${
|
|
1027
|
-
${
|
|
1022
|
+
`,Qi=e=>{let o=5381;for(let r=0;r<e.length;r++)o=(o<<5)+o^e.charCodeAt(r);return Math.abs(o).toString(36)},V=e=>`hq-cropper__${Qi(e)}`,W=e=>e||[],U=(e,o)=>{if(o)for(const r of o)e.classList.add(r)},en=e=>{const o={applyButton:[V("applyButton"),...W(e.applyButton)],cancelButton:[V("cancelButton"),...W(e.cancelButton)],container:[V("container"),...W(e.container)],handlerMove:[V("handlerMove"),...W(e.handlerMove)],handlerResizeTopLeft:[V("handlerResizeTopLeft"),...W(e.handlerResizeTopLeft)],handlerResizeTopRight:[V("handlerResizeTopRight"),...W(e.handlerResizeTopRight)],handlerResizeBottomLeft:[V("handlerResizeBottomLeft"),...W(e.handlerResizeBottomLeft)],handlerResizeBottomRight:[V("handlerResizeBottomRight"),...W(e.handlerResizeBottomRight)],sourceImage:[V("sourceImage"),...W(e.sourceImage)],portalArea:[V("portalArea"),...W(e.portalArea)],previewImage:[V("previewImage"),...W(e.previewImage)],body:[V("body"),...W(e.body)],header:[V("header"),...W(e.header)],footer:[V("footer"),...W(e.footer)],portal:[V("portal"),...W(e.portal)],preview:[V("preview"),...W(e.preview)],root:[V("root"),...W(e.root)]},r=`
|
|
1023
|
+
${_i(o.applyButton[0])}
|
|
1024
|
+
${Mi(o.body[0])}
|
|
1025
|
+
${Fi(o.cancelButton[0])}
|
|
1026
|
+
${Bi(o.container[0])}
|
|
1027
|
+
${Yi(o.footer[0])}
|
|
1028
|
+
${Hi(o.header[0])}
|
|
1029
|
+
${Gi(o.handlerMove[0])}
|
|
1030
|
+
${Vi(o.portalArea[0])}
|
|
1031
|
+
${Wi(o.portal[0])}
|
|
1032
|
+
${Ui(o.previewImage[0])}
|
|
1033
|
+
${Xi(o.preview[0])}
|
|
1028
1034
|
${Ge(o.handlerResizeBottomLeft[0],"bl")}
|
|
1029
1035
|
${Ge(o.handlerResizeBottomRight[0],"br")}
|
|
1030
1036
|
${Ge(o.handlerResizeTopLeft[0],"tl")}
|
|
1031
1037
|
${Ge(o.handlerResizeTopRight[0],"tr")}
|
|
1032
|
-
${
|
|
1033
|
-
${
|
|
1034
|
-
`,i=document.createElement("style");return i.innerHTML=r,document.getElementsByTagName("head")[0].prepend(i),o};let Zi=0;const Ji=e=>{const o=new Map,r=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(o.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...r}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(r[n]=l)}},subscribe:(i,n)=>{const l=String(++Zi),c=o.get(i)||[];return o.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of o.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){o.set(n,c);return}}},unsubscribeAll:()=>{o.clear()}}},St={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},Qi=(e={},o={})=>Ji({...St,config:{...St.config,...e},css:Ki(o)}),en=(e,o)=>{var O;const r=e(),i=document.querySelector(`.${(O=r.css)==null?void 0:O.body[0]}`);if(!i)return r.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=o.width/o.height;let p,h,u=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(o.height/o.width),u=(l-h)/2),{width:p,height:h,left:f,top:u}},tn=(e,o,r)=>{const[i,n]=o,l=i+e>r.width?(r.width-e)/2:i,c=n+e>r.height?(r.height-e)/2:n;return[l,c]},on=(e,o)=>{const{config:r}=e(),i=Math.min(o.width,o.height)-r.framePadding*2,n=r.portalSize>i?i:r.portalSize;if(Array.isArray(r.portalPosition)&&r.portalPosition.length===2){const[l,c]=tn(n,r.portalPosition,o);return{left:l,top:c,size:n}}return r.portalPosition==="center"?{size:n,left:(o.width-n)/2,top:(o.height-n)/2}:{left:0,top:0,size:n}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const rn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerMove),r.setAttribute("data-action",te.MOVE),r},nn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeBottomLeft),r.setAttribute("data-action",te.RESIZE_BL),r},an=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeBottomRight),r.setAttribute("data-action",te.RESIZE_BR),r},ln=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeTopLeft),r.setAttribute("data-action",te.RESIZE_TL),r},dn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeTopRight),r.setAttribute("data-action",te.RESIZE_TR),r},cn=e=>{var i;const o=e(),r=document.createElement("img");return U(r,(i=o.css)==null?void 0:i.previewImage),r},sn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.preview),r.appendChild(cn(e)),r},pn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.portal),r.appendChild(sn(e)),r.appendChild(rn(e)),r.appendChild(ln(e)),r.appendChild(dn(e)),r.appendChild(nn(e)),r.appendChild(an(e)),r},un=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.portalArea),r.appendChild(pn(e)),r},hn=e=>{var i;const o=e(),r=document.createElement("img");return U(r,(i=o.css)==null?void 0:i.sourceImage),r.setAttribute("alt","source"),r.setAttribute("crossOrigin","anonymous"),r.setAttribute("draggable","false"),r.setAttribute("src",o.sourceBase64),r},bn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.body),r.appendChild(hn(e)),r.appendChild(un(e)),r},gn=(e,o)=>{var n;const r=e(),i=document.createElement("div");return U(i,(n=r.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=r.config.applyButtonLabel,i.addEventListener("click",o),i},fn=(e,o)=>{var n;const r=e(),i=document.createElement("div");return U(i,(n=r.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=r.config.cancelButtonLabel,i.addEventListener("click",o),i},xn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.footer),n.appendChild(fn(e,r)),n.appendChild(gn(e,o)),n},On=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.header),r},$n=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.container),n.appendChild(On(e)),n.appendChild(bn(e)),n.appendChild(xn(e,o,r)),n},Sn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");U(n,(l=i.css)==null?void 0:l.root),n.appendChild($n(e,o,r)),document.body.appendChild(n)},yn=e=>{const o=document.createElement("input");return o.style.display="none",o.setAttribute("type","file"),o.setAttribute("accept","image/x-png,image/jpeg"),o.addEventListener("change",e,!1),document.body.appendChild(o),o},Te=new Map,vn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},he=(e,o)=>{if(Te.has(e))return Te.get(e);if(!o)return null;const r=o[vn[e]],i=document.querySelector(`.${r[0]}`);return Te.set(e,i),i},mn=()=>{Te.clear()},wn=()=>{Te.clear()},Cn=(e,o)=>{const r=he("header",o.css);r&&(r.innerText=e)},Rn=(e,o)=>{const r=he("sourceImage",o.css);r&&(r.setAttribute("src",e),r.style.height=`${o.frame.height}px`,r.style.width=`${o.frame.width}px`,r.style.left=`${o.frame.left}px`,r.style.top=`${o.frame.top}px`);const i=he("portalArea",o.css);i&&(i.style.height=`${o.frame.height}px`,i.style.width=`${o.frame.width}px`,i.style.left=`${o.frame.left}px`,i.style.top=`${o.frame.top}px`);const n=he("portal",o.css);n&&(n.style.width=`${o.portal.size}px`,n.style.height=`${o.portal.size}px`,n.style.left=`${o.portal.left}px`,n.style.top=`${o.portal.top}px`);const l=he("previewImage",o.css);l&&(l.setAttribute("src",e),l.style.height=`${o.frame.height}px`,l.style.width=`${o.frame.width}px`,l.style.marginLeft=`-${o.portal.left}px`,l.style.marginTop=`-${o.portal.top}px`)},kn=(e,o)=>{const r=he("portal",o.css);r&&(r.style.left=`${e.left}px`,r.style.top=`${e.top}px`,r.style.width=`${e.size}px`,r.style.height=`${e.size}px`);const i=he("previewImage",o.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},at=1,Ln=e=>{var k,y;const o=e(),r=document.createElement("canvas"),i=o.frame.width||at,n=o.frame.height||at,l=o.sourceWidth/i,c=o.sourceHeight/n,d=o.portal.left*l,p=o.portal.top*c,h=Math.max(o.portal.size*Math.min(l,c),at),u=o.config.outputSize>0?o.config.outputSize:h;r.width=u,r.height=u;const f=document.querySelector(`.${(k=o.css)==null?void 0:k.sourceImage[0]}`);f&&((y=r.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,u,u));const O=r.toDataURL(`image/${o.config.type}`,o.config.compression);return new Promise((S,$)=>{try{r.toBlob(x=>{if(r.remove(),!x){$(new Error(`Failed to create blob for type: image/${o.config.type}`));return}S([O,x])},`image/${o.config.type}`,o.config.compression)}catch(x){r.remove(),$(x)}})},zn=(e,o,r)=>{const{emitted:i,portal:n,frame:l,config:c}=o();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,u=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>u&&(d=u),p<f&&(p=f),p>O&&(p=O),r({portal:{...n,left:d,top:p}})},Pn=(e,o,r)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=o(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let u=n.size+Math.max(p,h);return u<d.minPortalSize&&(u=d.minPortalSize),n.top+u>c.height-d.framePadding&&(u=c.height-n.top-d.framePadding),n.left+u>c.width-d.framePadding&&(u=c.width-n.left-d.framePadding),r({portal:{...l,size:u}})}case te.RESIZE_TR:{let u=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return u<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,u=d.minPortalSize),n.left+u>c.width-d.framePadding&&(u=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(u=n.top+n.size,f=d.framePadding),r({portal:{...l,top:f,size:u}})}case te.RESIZE_TL:{const u=Math.min(p,h);let f=n.size-u,O=n.left+u,k=n.top+u;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,k=n.top+y}if(k<d.framePadding){const y=d.framePadding-k;k=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,k=k+y,f=f-y}return r({portal:{...l,top:k,left:O,size:f}})}case te.RESIZE_BL:{let u=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return u<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,u=d.minPortalSize),u+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,u=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,u=n.left+n.size-d.framePadding),r({portal:{...l,left:f,size:u}})}default:return}},Ht=e=>{if("touches"in e&&e.touches.length>0){const r=e.touches[0];return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const r=e.changedTouches[0];return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}}const o=e;return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}},jn=(e,o)=>{var O,k,y;const r=e(),i=document.querySelector(`.${(O=r.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(k=r.css)==null?void 0:k.portalArea[0]}`),l=document.querySelector(`.${(y=r.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:$}=e(),x=Ht(S);if(S.target){const v=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:$.left,top:$.top,size:$.size};o({action:v,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&o({action:null})},u=()=>{if(c=null,!d)return;const S=d;d=null;const{action:$}=e();if($)switch($){case te.MOVE:zn(S,e,o);break;default:Pn(S,e,o)}},f=S=>{const{action:$}=e();$&&(S.preventDefault(),d=Ht(S),c===null&&(c=requestAnimationFrame(u)))};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))}},Gt=1024*1024,En=(e,o)=>{if(!o.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${o.allowedTypes.join(", ")}`;if(o.maxFileSize>0&&e.size>o.maxFileSize){const r=(o.maxFileSize/Gt).toFixed(2);return`File size (${(e.size/Gt).toFixed(2)}MB) exceeds maximum allowed size (${r}MB)`}return null},Tn=(e,o,r,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=o(),u=En(p,h);if(u){d(u),e.target.value="";return}const f=new FileReader;let O=null;const k=()=>{var b;const x=o(),v=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);v&&(v.remove(),document.removeEventListener("keydown",y),O==null||O(),wn(),l(),r(St))},y=x=>{x.key==="Escape"&&o().sourceBase64&&S(x)},S=x=>{x.preventDefault(),k()},$=x=>{x.preventDefault();const v=o();Ln(o).then(([b,L])=>{i(b,L,v),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const v=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}v.src=x.target.result,v.onerror=()=>{d("Failed to load image")},v.onload=()=>{var j;Sn(o,$,S),mn(),n("fileName",Cn),n("sourceBase64",Rn),n("portal",kn);const b=en(o,v),L=on(o,b);r({frame:b,portal:L,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:v.height,sourceWidth:v.width}),O=jn(o,r),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},Nn=(e,o,r,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=Qi(o,r),p=yn(h=>Tn(h,n,l,e,c,d,i));return{open:()=>p.click()}},ae={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Vt="vacano-image-cropper-styles",In=`
|
|
1038
|
+
${Zi(o.root[0])}
|
|
1039
|
+
${Ji(o.sourceImage[0])}
|
|
1040
|
+
`,i=document.createElement("style");return i.innerHTML=r,document.getElementsByTagName("head")[0].prepend(i),o};let tn=0;const on=e=>{const o=new Map,r=new Proxy({...e},{set(i,n,l){return Reflect.set(i,n,l),(o.get(n)||[]).forEach(c=>c.action(l,i,n)),!0}});return{getState:()=>({...r}),setState:i=>{for(const n of Object.keys(i)){const l=i[n];l!==void 0&&(r[n]=l)}},subscribe:(i,n)=>{const l=String(++tn),c=o.get(i)||[];return o.set(i,[...c,{action:n,id:l}]),l},unsubscribe:i=>{for(const[n,l]of o.entries()){const c=l.filter(d=>d.id!==i);if(c.length!==l.length){o.set(n,c);return}}},unsubscribeAll:()=>{o.clear()}}},St={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},rn=(e={},o={})=>on({...St,config:{...St.config,...e},css:en(o)}),nn=(e,o)=>{var O;const r=e(),i=document.querySelector(`.${(O=r.css)==null?void 0:O.body[0]}`);if(!i)return r.frame;const{width:n,height:l}=i.getBoundingClientRect(),c=n/l,d=o.width/o.height;let p,h,u=0,f=0;return c>d?(p=l*d,h=l,f=(n-p)/2):(p=n,h=n*(o.height/o.width),u=(l-h)/2),{width:p,height:h,left:f,top:u}},an=(e,o,r)=>{const[i,n]=o,l=i+e>r.width?(r.width-e)/2:i,c=n+e>r.height?(r.height-e)/2:n;return[l,c]},ln=(e,o)=>{const{config:r}=e(),i=Math.min(o.width,o.height)-r.framePadding*2,n=r.portalSize>i?i:r.portalSize;if(Array.isArray(r.portalPosition)&&r.portalPosition.length===2){const[l,c]=an(n,r.portalPosition,o);return{left:l,top:c,size:n}}return r.portalPosition==="center"?{size:n,left:(o.width-n)/2,top:(o.height-n)/2}:{left:0,top:0,size:n}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const dn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerMove),r.setAttribute("data-action",te.MOVE),r},cn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeBottomLeft),r.setAttribute("data-action",te.RESIZE_BL),r},sn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeBottomRight),r.setAttribute("data-action",te.RESIZE_BR),r},pn=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeTopLeft),r.setAttribute("data-action",te.RESIZE_TL),r},un=e=>{var i;const o=e(),r=document.createElement("span");return U(r,(i=o.css)==null?void 0:i.handlerResizeTopRight),r.setAttribute("data-action",te.RESIZE_TR),r},hn=e=>{var i;const o=e(),r=document.createElement("img");return U(r,(i=o.css)==null?void 0:i.previewImage),r},bn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.preview),r.appendChild(hn(e)),r},gn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.portal),r.appendChild(bn(e)),r.appendChild(dn(e)),r.appendChild(pn(e)),r.appendChild(un(e)),r.appendChild(cn(e)),r.appendChild(sn(e)),r},fn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.portalArea),r.appendChild(gn(e)),r},xn=e=>{var i;const o=e(),r=document.createElement("img");return U(r,(i=o.css)==null?void 0:i.sourceImage),r.setAttribute("alt","source"),r.setAttribute("crossOrigin","anonymous"),r.setAttribute("draggable","false"),r.setAttribute("src",o.sourceBase64),r},On=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.body),r.appendChild(xn(e)),r.appendChild(fn(e)),r},$n=(e,o)=>{var n;const r=e(),i=document.createElement("div");return U(i,(n=r.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=r.config.applyButtonLabel,i.addEventListener("click",o),i},Sn=(e,o)=>{var n;const r=e(),i=document.createElement("div");return U(i,(n=r.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=r.config.cancelButtonLabel,i.addEventListener("click",o),i},yn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.footer),n.appendChild(Sn(e,r)),n.appendChild($n(e,o)),n},vn=e=>{var i;const o=e(),r=document.createElement("div");return U(r,(i=o.css)==null?void 0:i.header),r},mn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");return U(n,(l=i.css)==null?void 0:l.container),n.appendChild(vn(e)),n.appendChild(On(e)),n.appendChild(yn(e,o,r)),n},wn=(e,o,r)=>{var l;const i=e(),n=document.createElement("div");U(n,(l=i.css)==null?void 0:l.root),n.appendChild(mn(e,o,r)),document.body.appendChild(n)},Cn=e=>{const o=document.createElement("input");return o.style.display="none",o.setAttribute("type","file"),o.setAttribute("accept","image/x-png,image/jpeg"),o.addEventListener("change",e,!1),document.body.appendChild(o),o},Te=new Map,Rn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},he=(e,o)=>{if(Te.has(e))return Te.get(e);if(!o)return null;const r=o[Rn[e]],i=document.querySelector(`.${r[0]}`);return Te.set(e,i),i},kn=()=>{Te.clear()},Ln=()=>{Te.clear()},zn=(e,o)=>{const r=he("header",o.css);r&&(r.innerText=e)},Pn=(e,o)=>{const r=he("sourceImage",o.css);r&&(r.setAttribute("src",e),r.style.height=`${o.frame.height}px`,r.style.width=`${o.frame.width}px`,r.style.left=`${o.frame.left}px`,r.style.top=`${o.frame.top}px`);const i=he("portalArea",o.css);i&&(i.style.height=`${o.frame.height}px`,i.style.width=`${o.frame.width}px`,i.style.left=`${o.frame.left}px`,i.style.top=`${o.frame.top}px`);const n=he("portal",o.css);n&&(n.style.width=`${o.portal.size}px`,n.style.height=`${o.portal.size}px`,n.style.left=`${o.portal.left}px`,n.style.top=`${o.portal.top}px`);const l=he("previewImage",o.css);l&&(l.setAttribute("src",e),l.style.height=`${o.frame.height}px`,l.style.width=`${o.frame.width}px`,l.style.marginLeft=`-${o.portal.left}px`,l.style.marginTop=`-${o.portal.top}px`)},jn=(e,o)=>{const r=he("portal",o.css);r&&(r.style.left=`${e.left}px`,r.style.top=`${e.top}px`,r.style.width=`${e.size}px`,r.style.height=`${e.size}px`);const i=he("previewImage",o.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},at=1,En=e=>{var k,y;const o=e(),r=document.createElement("canvas"),i=o.frame.width||at,n=o.frame.height||at,l=o.sourceWidth/i,c=o.sourceHeight/n,d=o.portal.left*l,p=o.portal.top*c,h=Math.max(o.portal.size*Math.min(l,c),at),u=o.config.outputSize>0?o.config.outputSize:h;r.width=u,r.height=u;const f=document.querySelector(`.${(k=o.css)==null?void 0:k.sourceImage[0]}`);f&&((y=r.getContext("2d"))==null||y.drawImage(f,d,p,h,h,0,0,u,u));const O=r.toDataURL(`image/${o.config.type}`,o.config.compression);return new Promise((S,$)=>{try{r.toBlob(x=>{if(r.remove(),!x){$(new Error(`Failed to create blob for type: image/${o.config.type}`));return}S([O,x])},`image/${o.config.type}`,o.config.compression)}catch(x){r.remove(),$(x)}})},Tn=(e,o,r)=>{const{emitted:i,portal:n,frame:l,config:c}=o();let d=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=c.framePadding,u=l.width-c.framePadding-n.size,f=c.framePadding,O=l.height-c.framePadding-n.size;d<h&&(d=h),d>u&&(d=u),p<f&&(p=f),p>O&&(p=O),r({portal:{...n,left:d,top:p}})},Nn=(e,o,r)=>{const{action:i,emitted:n,portal:l,frame:c,config:d}=o(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case te.RESIZE_BR:{let u=n.size+Math.max(p,h);return u<d.minPortalSize&&(u=d.minPortalSize),n.top+u>c.height-d.framePadding&&(u=c.height-n.top-d.framePadding),n.left+u>c.width-d.framePadding&&(u=c.width-n.left-d.framePadding),r({portal:{...l,size:u}})}case te.RESIZE_TR:{let u=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return u<d.minPortalSize&&(f=n.top+n.size-d.minPortalSize,u=d.minPortalSize),n.left+u>c.width-d.framePadding&&(u=c.width-n.left-d.framePadding,f=n.top-c.width+n.left+n.size),f<d.framePadding&&(u=n.top+n.size,f=d.framePadding),r({portal:{...l,top:f,size:u}})}case te.RESIZE_TL:{const u=Math.min(p,h);let f=n.size-u,O=n.left+u,k=n.top+u;if(f<d.minPortalSize){const y=n.size-d.minPortalSize;f=d.minPortalSize,O=n.left+y,k=n.top+y}if(k<d.framePadding){const y=d.framePadding-k;k=d.framePadding,O=O+y,f=f-y}if(O<d.framePadding){const y=d.framePadding-O;O=d.framePadding,k=k+y,f=f-y}return r({portal:{...l,top:k,left:O,size:f}})}case te.RESIZE_BL:{let u=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return u<d.minPortalSize&&(f=n.left+n.size-d.minPortalSize,u=d.minPortalSize),u+n.top>c.height-d.framePadding&&(f=n.left-c.height+n.top+n.size,u=c.height-n.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,u=n.left+n.size-d.framePadding),r({portal:{...l,left:f,size:u}})}default:return}},Ht=e=>{if("touches"in e&&e.touches.length>0){const r=e.touches[0];return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const r=e.changedTouches[0];return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}}const o=e;return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}},In=(e,o)=>{var O,k,y;const r=e(),i=document.querySelector(`.${(O=r.css)==null?void 0:O.portal[0]}`),n=document.querySelector(`.${(k=r.css)==null?void 0:k.portalArea[0]}`),l=document.querySelector(`.${(y=r.css)==null?void 0:y.root[0]}`);let c=null,d=null;const p=S=>{S.preventDefault();const{portal:$}=e(),x=Ht(S);if(S.target){const v=S.target.getAttribute("data-action"),b={X:x.pageX,Y:x.pageY,left:$.left,top:$.top,size:$.size};o({action:v,emitted:b})}},h=()=>{const{action:S}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,S&&o({action:null})},u=()=>{if(c=null,!d)return;const S=d;d=null;const{action:$}=e();if($)switch($){case te.MOVE:Tn(S,e,o);break;default:Nn(S,e,o)}},f=S=>{const{action:$}=e();$&&(S.preventDefault(),d=Ht(S),c===null&&(c=requestAnimationFrame(u)))};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))}},Gt=1024*1024,An=(e,o)=>{if(!o.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${o.allowedTypes.join(", ")}`;if(o.maxFileSize>0&&e.size>o.maxFileSize){const r=(o.maxFileSize/Gt).toFixed(2);return`File size (${(e.size/Gt).toFixed(2)}MB) exceeds maximum allowed size (${r}MB)`}return null},Dn=(e,o,r,i,n,l,c)=>{const d=x=>{c?c(x):console.error(`HqCropper: ${x}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const p=e.target.files[0],{config:h}=o(),u=An(p,h);if(u){d(u),e.target.value="";return}const f=new FileReader;let O=null;const k=()=>{var b;const x=o(),v=document.querySelector(`.${(b=x.css)==null?void 0:b.root[0]}`);v&&(v.remove(),document.removeEventListener("keydown",y),O==null||O(),Ln(),l(),r(St))},y=x=>{x.key==="Escape"&&o().sourceBase64&&S(x)},S=x=>{x.preventDefault(),k()},$=x=>{x.preventDefault();const v=o();En(o).then(([b,L])=>{i(b,L,v),S(x)}).catch(b=>{d(b instanceof Error?b.message:"Failed to crop image")})};f.onload=x=>{const v=new Image;if(!x.target||typeof x.target.result!="string"){d("Can't load result image");return}v.src=x.target.result,v.onerror=()=>{d("Failed to load image")},v.onload=()=>{var j;wn(o,$,S),kn(),n("fileName",zn),n("sourceBase64",Pn),n("portal",jn);const b=nn(o,v),L=ln(o,b);r({frame:b,portal:L,fileName:p.name,sourceBase64:(j=x.target)==null?void 0:j.result,sourceHeight:v.height,sourceWidth:v.width}),O=In(o,r),document.addEventListener("keydown",y)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(p),e.target.value=""},_n=(e,o,r,i)=>{const{getState:n,setState:l,subscribe:c,unsubscribeAll:d}=rn(o,r),p=Cn(h=>Dn(h,n,l,e,c,d,i));return{open:()=>p.click()}},ae={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},Vt="vacano-image-cropper-styles",Mn=`
|
|
1035
1041
|
.vacano-cropper-root {
|
|
1036
1042
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1037
1043
|
backdrop-filter: blur(4px);
|
|
@@ -1079,14 +1085,14 @@
|
|
|
1079
1085
|
.vacano-cropper-apply-button:hover {
|
|
1080
1086
|
background-color: ${t.COLORS["iron-grey"]};
|
|
1081
1087
|
}
|
|
1082
|
-
`,
|
|
1088
|
+
`,Fn=()=>{if(typeof document>"u"||document.getElementById(Vt))return;const e=document.createElement("style");e.id=Vt,e.textContent=Mn,document.head.appendChild(e)},Bn={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"]},yo=(e={})=>{const{allowedTypes:o=ae.allowedTypes,applyLabel:r=ae.applyLabel,cancelLabel:i=ae.cancelLabel,compression:n=ae.compression,maxFileSize:l=ae.maxFileSize,onCrop:c,onError:d,outputSize:p=ae.outputSize,portalSize:h=ae.portalSize,type:u=ae.type}=e,f=g.useRef(null);return{open:g.useCallback(()=>{f.current||(Fn(),f.current=_n((k,y,S)=>{y&&(c==null||c({base64:k,blob:y,state:S}))},{portalSize:h,outputSize:p,compression:n,type:u,maxFileSize:l,allowedTypes:o,applyButtonLabel:r,cancelButtonLabel:i},Bn,k=>{d==null||d({code:"CROPPER_ERROR",message:k})})),f.current.open()},[o,r,i,n,l,c,d,p,h,u])}},lt=N.newClassNameGetter("image-cropper"),Yn=({allowedTypes:e,applyLabel:o,buttonLabel:r="Select Image",cancelLabel:i,className:n,classnames:l,compression:c,maxFileSize:d,onCrop:p,onError:h,outputSize:u,portalSize:f,previewSize:O=120,ref:k,type:y,value:S,...$})=>{const[x,v]=g.useState(S??null),{open:b}=yo({allowedTypes:e,applyLabel:o,cancelLabel:i,compression:c,maxFileSize:d,onCrop:L=>{v(L.base64),p==null||p(L)},onError:h,outputSize:u,portalSize:f,type:y});return a.jsxs(Ii,{...$,ref:k,className:lt("container",n),children:[a.jsx(Ai,{$size:O,className:lt("preview",l==null?void 0:l.preview),children:x?a.jsx("img",{src:x,alt:"Preview"}):a.jsx(Di,{children:"No image"})}),a.jsx(Ie,{variant:"system",onClick:b,className:lt("button",l==null?void 0:l.button),style:{width:O},children:r})]})},Wt={compact:{height:"32px",padding:"0 10px",radius:"14px",prefixSize:"16px"},default:{height:"40px",padding:"0 14px",radius:"16px",prefixSize:"20px"}},Ut={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)}},re=e=>Ut[e]??Ut.normal,dt=e=>Wt[e]??Wt.default,Hn=s.div`
|
|
1083
1089
|
display: grid;
|
|
1084
1090
|
flex-direction: column;
|
|
1085
1091
|
gap: 2px;
|
|
1086
1092
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1087
|
-
`,
|
|
1093
|
+
`,Gn=s(fe)`
|
|
1088
1094
|
margin-left: 6px;
|
|
1089
|
-
`,
|
|
1095
|
+
`,Vn=s.input`
|
|
1090
1096
|
flex: 1;
|
|
1091
1097
|
min-width: 0;
|
|
1092
1098
|
outline: none;
|
|
@@ -1118,7 +1124,7 @@
|
|
|
1118
1124
|
&:focus-visible {
|
|
1119
1125
|
outline: 2px solid ${e=>re(e.$variant).focus};
|
|
1120
1126
|
}
|
|
1121
|
-
`,ct=
|
|
1127
|
+
`,ct=N.newClassNameGetter("input"),vo=({className:e,classnames:o,disabled:r,fullWidth:i,label:n,ref:l,size:c="default",variant:d="normal",...p})=>a.jsxs(Hn,{className:ct("container",e),$fullWidth:!!i,children:[a.jsx(Gn,{variant:d,className:ct("label",o==null?void 0:o.label),children:n}),a.jsx(Vn,{...p,ref:l,disabled:r,$size:c,$variant:d,className:ct("input",o==null?void 0:o.input)})]}),Wn=s.div`
|
|
1122
1128
|
position: fixed;
|
|
1123
1129
|
inset: 0;
|
|
1124
1130
|
z-index: 1000;
|
|
@@ -1127,7 +1133,7 @@
|
|
|
1127
1133
|
justify-content: center;
|
|
1128
1134
|
background-color: ${t.alpha(t.COLORS.black,50)};
|
|
1129
1135
|
animation: ${t.KEYFRAMES.fadeIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1130
|
-
`,
|
|
1136
|
+
`,Un=s.div`
|
|
1131
1137
|
position: relative;
|
|
1132
1138
|
z-index: 1001;
|
|
1133
1139
|
width: ${e=>e.$width};
|
|
@@ -1138,14 +1144,14 @@
|
|
|
1138
1144
|
border-radius: 16px;
|
|
1139
1145
|
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1140
1146
|
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1141
|
-
`,Xt=
|
|
1147
|
+
`,Xt=N.newClassNameGetter("modal"),mo=({animated:e,children:o,className:r,classnames:i,open:n,ref:l,width:c="500px",...d})=>n?ge.createPortal(a.jsx(Wn,{className:Xt("overlay",i==null?void 0:i.overlay),$animated:!!e,children:a.jsx(Un,{...d,ref:l,className:Xt("content",r,i==null?void 0:i.content),$animated:!!e,$width:c,children:o})}),document.body):null,wo={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},Xn=s.div`
|
|
1142
1148
|
display: flex;
|
|
1143
1149
|
flex-direction: column;
|
|
1144
1150
|
gap: 4px;
|
|
1145
|
-
`,
|
|
1151
|
+
`,qn=s(fe)`
|
|
1146
1152
|
margin-left: 6px;
|
|
1147
1153
|
color: ${e=>wo[e.$variant].label};
|
|
1148
|
-
`,
|
|
1154
|
+
`,Kn=s.button`
|
|
1149
1155
|
display: flex;
|
|
1150
1156
|
flex-wrap: wrap;
|
|
1151
1157
|
align-items: center;
|
|
@@ -1169,31 +1175,31 @@
|
|
|
1169
1175
|
${e=>e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1170
1176
|
outline-offset: 2px;
|
|
1171
1177
|
}
|
|
1172
|
-
`,
|
|
1178
|
+
`,Zn=s.span`
|
|
1173
1179
|
color: ${t.COLORS["iron-grey"]};
|
|
1174
1180
|
font-size: 14px;
|
|
1175
|
-
`,
|
|
1181
|
+
`,Jn=s.div`
|
|
1176
1182
|
display: flex;
|
|
1177
1183
|
flex-direction: column;
|
|
1178
1184
|
padding: 20px;
|
|
1179
1185
|
gap: 16px;
|
|
1180
|
-
`,
|
|
1186
|
+
`,Qn=s.div`
|
|
1181
1187
|
display: flex;
|
|
1182
1188
|
align-items: center;
|
|
1183
1189
|
justify-content: space-between;
|
|
1184
|
-
`,
|
|
1190
|
+
`,ea=s.h3`
|
|
1185
1191
|
margin: 0;
|
|
1186
1192
|
font-size: 18px;
|
|
1187
1193
|
font-weight: 600;
|
|
1188
1194
|
color: ${t.COLORS.black};
|
|
1189
|
-
`,
|
|
1195
|
+
`,ta=s.div`
|
|
1190
1196
|
display: flex;
|
|
1191
1197
|
flex-direction: column;
|
|
1192
1198
|
gap: 4px;
|
|
1193
1199
|
min-height: 200px;
|
|
1194
1200
|
max-height: 300px;
|
|
1195
1201
|
overflow-y: auto;
|
|
1196
|
-
`,
|
|
1202
|
+
`,oa=s.label`
|
|
1197
1203
|
display: flex;
|
|
1198
1204
|
align-items: center;
|
|
1199
1205
|
gap: 10px;
|
|
@@ -1206,10 +1212,10 @@
|
|
|
1206
1212
|
&:hover {
|
|
1207
1213
|
background-color: ${e=>e.$disabled?"transparent":t.COLORS.gray};
|
|
1208
1214
|
}
|
|
1209
|
-
`,
|
|
1215
|
+
`,ra=s.span`
|
|
1210
1216
|
font-size: 14px;
|
|
1211
1217
|
color: ${t.COLORS.black};
|
|
1212
|
-
`,
|
|
1218
|
+
`,ia=s.div`
|
|
1213
1219
|
display: flex;
|
|
1214
1220
|
align-items: center;
|
|
1215
1221
|
justify-content: center;
|
|
@@ -1217,16 +1223,16 @@
|
|
|
1217
1223
|
color: ${t.COLORS["iron-grey"]};
|
|
1218
1224
|
font-size: 14px;
|
|
1219
1225
|
text-align: center;
|
|
1220
|
-
`,Q=
|
|
1226
|
+
`,Q=N.newClassNameGetter("multi-select"),na=({className:e,classnames:o,disabled:r=!1,emptyMessage:i="No options found",label:n,maxVisible:l=1/0,modalTitle:c="Select options",onChange:d,options:p,placeholder:h="Select...",ref:u,searchPlaceholder:f="Search...",value:O,variant:k="normal",...y})=>{const[S,$]=g.useState(!1),[x,v]=g.useState(""),b=g.useMemo(()=>p.filter(C=>O.includes(C.value)),[p,O]),L=g.useMemo(()=>{if(!x.trim())return p;const C=x.toLowerCase().trim();return p.filter(F=>F.label.toLowerCase().includes(C))},[p,x]),j=l===1/0?b:b.slice(0,l),E=b.length-j.length,G=()=>{r||($(!0),v(""))},P=()=>{$(!1),v("")},D=C=>{O.includes(C)?d(O.filter(F=>F!==C)):d([...O,C])},I=C=>{d(O.filter(F=>F!==C))};return a.jsxs(Xn,{...y,ref:u,className:Q("container",e),children:[n&&a.jsx(qn,{$variant:k,className:Q("label",o==null?void 0:o.trigger),children:n}),a.jsx(Kn,{type:"button",$variant:k,$disabled:r,disabled:r,onClick:G,className:Q("trigger",o==null?void 0:o.trigger),children:b.length===0?a.jsx(Zn,{className:Q("placeholder",o==null?void 0:o.placeholder),children:h}):a.jsxs(a.Fragment,{children:[j.map(C=>a.jsx(Ke,{deletable:!0,onDelete:()=>I(C.value),onClick:F=>F.stopPropagation(),className:Q("chip",o==null?void 0:o.chip),children:C.label},C.value)),E>0&&a.jsxs(Ke,{variant:"gray",onClick:C=>C.stopPropagation(),className:Q("chip",o==null?void 0:o.chip),children:["+",E]})]})}),a.jsx(mo,{open:S,width:"400px",animated:!0,className:Q("modal",o==null?void 0:o.modal),children:a.jsxs(Jn,{children:[a.jsxs(Qn,{children:[a.jsx(ea,{children:c}),a.jsx(Ie,{variant:"transparent",size:"compact",icon:a.jsx(a.X,{}),onClick:P})]}),a.jsx(vo,{type:"text",value:x,onChange:C=>v(C.target.value),placeholder:f,autoFocus:!0,fullWidth:!0,className:Q("search",o==null?void 0:o.search)}),a.jsx(ta,{className:Q("options",o==null?void 0:o.options),children:L.length===0?a.jsx(ia,{className:Q("empty",o==null?void 0:o.empty),children:i}):L.map(C=>a.jsxs(oa,{$disabled:!!C.disabled,className:Q("option",o==null?void 0:o.option),children:[a.jsx(Je,{checked:O.includes(C.value),disabled:C.disabled,onChange:()=>D(C.value)}),a.jsx(ra,{children:C.label})]},C.value))})]})})]})},qt={compact:{width:"36px",height:"40px",fontSize:"16px",radius:"10px",gap:"8px"},default:{width:"44px",height:"52px",fontSize:"20px",radius:"12px",gap:"10px"}},Kt={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)}},Ee=e=>qt[e]??qt.default,pe=e=>Kt[e]??Kt.normal,aa=s.div`
|
|
1221
1227
|
display: inline-flex;
|
|
1222
1228
|
flex-direction: column;
|
|
1223
1229
|
gap: 2px;
|
|
1224
|
-
`,
|
|
1230
|
+
`,la=s(fe)`
|
|
1225
1231
|
margin-left: 6px;
|
|
1226
|
-
`,
|
|
1232
|
+
`,da=s.div`
|
|
1227
1233
|
display: flex;
|
|
1228
1234
|
gap: ${e=>Ee(e.$size).gap};
|
|
1229
|
-
`,
|
|
1235
|
+
`,ca=s.input`
|
|
1230
1236
|
width: ${e=>Ee(e.$size).width};
|
|
1231
1237
|
height: ${e=>Ee(e.$size).height};
|
|
1232
1238
|
border-radius: ${e=>Ee(e.$size).radius};
|
|
@@ -1255,7 +1261,7 @@
|
|
|
1255
1261
|
&::selection {
|
|
1256
1262
|
background-color: transparent;
|
|
1257
1263
|
}
|
|
1258
|
-
`,st=
|
|
1264
|
+
`,st=N.newClassNameGetter("otp-code"),sa=({className:e,classnames:o,disabled:r,label:i,length:n=6,onChange:l,ref:c,size:d="default",value:p="",variant:h="normal",...u})=>{const f=g.useRef([]),O=g.useCallback($=>{const x=f.current[$];x&&(x.focus(),x.select())},[]),k=g.useCallback(($,x)=>{const b=x.target.value.replace(/\D/g,"").slice(-1);if(!b)return;const L=p.padEnd(n," ").split(""),j=L.findIndex(D=>D===" "||D===""),E=j!==-1?j:$;L[E]=b;const G=L.join("").replace(/ /g,"");l==null||l(G);const P=E+1;P<n&&O(P)},[p,n,l,O]),y=g.useCallback(($,x)=>{if(x.key==="Backspace"){x.preventDefault();const v=p.split("");v[$]?(v[$]="",l==null||l(v.join(""))):$>0&&(v[$-1]="",l==null||l(v.join("")),O($-1))}else x.key==="ArrowLeft"&&$>0?(x.preventDefault(),O($-1)):x.key==="ArrowRight"&&$<n-1&&(x.preventDefault(),O($+1))},[p,n,l,O]),S=g.useCallback($=>{$.preventDefault();const x=$.clipboardData.getData("text").replace(/\D/g,"").slice(0,n);if(x){l==null||l(x);const v=Math.min(x.length,n-1);O(v)}},[n,l,O]);return a.jsxs(aa,{ref:c,className:st("container",e),...u,children:[i&&a.jsx(la,{variant:h,className:st("label",o==null?void 0:o.label),children:i}),a.jsx(da,{$size:d,children:Array.from({length:n}).map(($,x)=>a.jsx(ca,{ref:v=>{f.current[x]=v},type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:2,disabled:r,value:p[x]??"",onChange:v=>k(x,v),onKeyDown:v=>y(x,v),onPaste:S,onFocus:v=>v.target.select(),$size:d,$variant:h,className:st("input",o==null?void 0:o.input)},x))})]})},Zt={light:{background:t.COLORS.white,border:t.alpha(t.COLORS.black,30),title:t.COLORS.black,description:t.COLORS["iron-grey"]},dark:{background:t.alpha(t.COLORS.white,5),border:t.alpha(t.COLORS.white,30),title:t.COLORS.white,description:"#9ca3af"}},Ze=e=>Zt[e]??Zt.light,pa=s.div`
|
|
1259
1265
|
display: flex;
|
|
1260
1266
|
flex-direction: column;
|
|
1261
1267
|
gap: 16px;
|
|
@@ -1263,36 +1269,36 @@
|
|
|
1263
1269
|
border: 1px dashed ${({$variant:e})=>Ze(e).border};
|
|
1264
1270
|
border-radius: 16px;
|
|
1265
1271
|
background-color: ${({$variant:e})=>Ze(e).background};
|
|
1266
|
-
`,
|
|
1272
|
+
`,ua=s.div`
|
|
1267
1273
|
display: flex;
|
|
1268
1274
|
flex-direction: column;
|
|
1269
1275
|
gap: 4px;
|
|
1270
|
-
`,
|
|
1276
|
+
`,ha=s.div`
|
|
1271
1277
|
font-size: 18px;
|
|
1272
1278
|
font-weight: 600;
|
|
1273
1279
|
line-height: 1.4;
|
|
1274
1280
|
color: ${({$variant:e})=>Ze(e).title};
|
|
1275
|
-
`,
|
|
1281
|
+
`,ba=s.div`
|
|
1276
1282
|
font-size: 14px;
|
|
1277
1283
|
line-height: 1.5;
|
|
1278
1284
|
color: ${({$variant:e})=>Ze(e).description};
|
|
1279
|
-
`,
|
|
1285
|
+
`,ga=s.div`
|
|
1280
1286
|
display: flex;
|
|
1281
1287
|
flex-wrap: wrap;
|
|
1282
1288
|
gap: 8px;
|
|
1283
|
-
`,Ve=
|
|
1289
|
+
`,Ve=N.newClassNameGetter("panel"),fa=({children:e,className:o,classnames:r,description:i,ref:n,title:l,variant:c="light",...d})=>{const p=l||i;return a.jsxs(pa,{...d,ref:n,className:Ve("container",o),$variant:c,children:[p&&a.jsxs(ua,{children:[l&&a.jsx(ha,{className:Ve("title",r==null?void 0:r.title),$variant:c,children:l}),i&&a.jsx(ba,{className:Ve("description",r==null?void 0:r.description),$variant:c,children:i})]}),a.jsx(ga,{className:Ve("content",r==null?void 0:r.content),children:e})]})},yt={compact:{height:4,radius:2},default:{height:8,radius:4}},xa=s.div`
|
|
1284
1290
|
width: 100%;
|
|
1285
1291
|
height: ${({$size:e})=>yt[e].height}px;
|
|
1286
1292
|
border-radius: ${({$size:e})=>yt[e].radius}px;
|
|
1287
1293
|
background-color: ${t.COLORS.gray};
|
|
1288
1294
|
overflow: hidden;
|
|
1289
|
-
`,
|
|
1295
|
+
`,Oa=s.div`
|
|
1290
1296
|
height: 100%;
|
|
1291
1297
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1292
1298
|
border-radius: ${({$size:e})=>yt[e].radius}px;
|
|
1293
1299
|
background-color: ${t.COLORS.black};
|
|
1294
1300
|
transition: width 0.2s ease;
|
|
1295
|
-
`,Jt=
|
|
1301
|
+
`,Jt=N.newClassNameGetter("progress"),$a=({value:e,size:o="default",className:r,classnames:i,ref:n,...l})=>a.jsx(xa,{...l,ref:n,$size:o,className:Jt("track",r,i==null?void 0:i.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx(Oa,{$size:o,$value:e,className:Jt("bar",i==null?void 0:i.bar)})}),Qt={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}},be=e=>Qt[e]??Qt.normal,Sa=s.label`
|
|
1296
1302
|
display: inline-flex;
|
|
1297
1303
|
align-items: center;
|
|
1298
1304
|
gap: 8px;
|
|
@@ -1302,13 +1308,13 @@
|
|
|
1302
1308
|
&:has(input:focus-visible) > span:first-of-type {
|
|
1303
1309
|
box-shadow: 0 0 0 2px ${e=>be(e.$variant).box.focusShadow};
|
|
1304
1310
|
}
|
|
1305
|
-
`,
|
|
1311
|
+
`,ya=s.input`
|
|
1306
1312
|
position: absolute;
|
|
1307
1313
|
opacity: 0;
|
|
1308
1314
|
width: 0;
|
|
1309
1315
|
height: 0;
|
|
1310
1316
|
pointer-events: none;
|
|
1311
|
-
`,
|
|
1317
|
+
`,va=s.span`
|
|
1312
1318
|
display: inline-flex;
|
|
1313
1319
|
align-items: center;
|
|
1314
1320
|
justify-content: center;
|
|
@@ -1323,7 +1329,7 @@
|
|
|
1323
1329
|
border-color 0.15s ease,
|
|
1324
1330
|
background-color 0.15s ease,
|
|
1325
1331
|
box-shadow 0.15s ease;
|
|
1326
|
-
|
|
1332
|
+
`,ma=s.span`
|
|
1327
1333
|
width: 8px;
|
|
1328
1334
|
height: 8px;
|
|
1329
1335
|
border-radius: 50%;
|
|
@@ -1333,13 +1339,13 @@
|
|
|
1333
1339
|
transition:
|
|
1334
1340
|
opacity 0.15s ease,
|
|
1335
1341
|
transform 0.15s ease;
|
|
1336
|
-
`,
|
|
1342
|
+
`,wa=s.span`
|
|
1337
1343
|
font-size: 14px;
|
|
1338
1344
|
font-weight: 500;
|
|
1339
1345
|
line-height: 1.5;
|
|
1340
1346
|
color: ${e=>be(e.$variant).label};
|
|
1341
1347
|
user-select: none;
|
|
1342
|
-
`,ze=
|
|
1348
|
+
`,ze=N.newClassNameGetter("radio"),mt=({checked:e,className:o,classnames:r,disabled:i,label:n,onChange:l,ref:c,variant:d="normal",...p})=>a.jsxs(Sa,{className:ze("container",o),$disabled:!!i,$variant:d,children:[a.jsx(ya,{...p,ref:c,type:"radio",className:ze("input",r==null?void 0:r.input),checked:e,disabled:i,onChange:l}),a.jsx(va,{className:ze("box",r==null?void 0:r.box),$checked:e,$variant:d,children:a.jsx(ma,{className:ze("dot",r==null?void 0:r.dot),$visible:e,$variant:d})}),n&&a.jsx(wa,{className:ze("label",r==null?void 0:r.label),$variant:d,children:n})]}),eo={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},se=e=>eo[e]??eo.normal,Ca=s.label`
|
|
1343
1349
|
display: grid;
|
|
1344
1350
|
grid-template-columns: auto 1fr;
|
|
1345
1351
|
align-items: start;
|
|
@@ -1368,7 +1374,7 @@
|
|
|
1368
1374
|
.vacano_radio_container {
|
|
1369
1375
|
pointer-events: none;
|
|
1370
1376
|
}
|
|
1371
|
-
`,
|
|
1377
|
+
`,Ra=s.input`
|
|
1372
1378
|
position: absolute;
|
|
1373
1379
|
width: 1px;
|
|
1374
1380
|
height: 1px;
|
|
@@ -1378,12 +1384,12 @@
|
|
|
1378
1384
|
clip: rect(0, 0, 0, 0);
|
|
1379
1385
|
white-space: nowrap;
|
|
1380
1386
|
border: 0;
|
|
1381
|
-
`,
|
|
1387
|
+
`,ka=s.div`
|
|
1382
1388
|
display: flex;
|
|
1383
1389
|
flex-direction: column;
|
|
1384
1390
|
gap: 2px;
|
|
1385
1391
|
min-width: 0;
|
|
1386
|
-
`,
|
|
1392
|
+
`,La=s.span`
|
|
1387
1393
|
font-size: 14px;
|
|
1388
1394
|
font-weight: 500;
|
|
1389
1395
|
line-height: 1.4;
|
|
@@ -1392,7 +1398,7 @@
|
|
|
1392
1398
|
label[data-disabled='true'] & {
|
|
1393
1399
|
color: ${e=>se(e.$variant).label.disabled};
|
|
1394
1400
|
}
|
|
1395
|
-
`,
|
|
1401
|
+
`,za=s.span`
|
|
1396
1402
|
font-size: 12px;
|
|
1397
1403
|
font-weight: 400;
|
|
1398
1404
|
line-height: 1.4;
|
|
@@ -1401,29 +1407,29 @@
|
|
|
1401
1407
|
label[data-disabled='true'] & {
|
|
1402
1408
|
color: ${e=>se(e.$variant).description.disabled};
|
|
1403
1409
|
}
|
|
1404
|
-
`,We=
|
|
1410
|
+
`,We=N.newClassNameGetter("radio-card"),Pa=({checked:e,className:o,classnames:r,description:i,disabled:n,fullWidth:l=!1,label:c,onChange:d,ref:p,variant:h="normal",...u})=>a.jsxs(Ca,{className:We("container",o),$checked:e,$disabled:!!n,$fullWidth:l,$variant:h,"data-disabled":n,children:[a.jsx(Ra,{...u,ref:p,type:"radio",checked:e,disabled:n,onChange:d}),a.jsx(mt,{className:r==null?void 0:r.radio,checked:e,disabled:n,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(ka,{className:We("content",r==null?void 0:r.content),children:[a.jsx(La,{className:We("label",r==null?void 0:r.label),$variant:h,children:c}),i&&a.jsx(za,{className:We("description",r==null?void 0:r.description),$variant:h,children:i})]})]}),to={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},ja=s.div`
|
|
1405
1411
|
display: flex;
|
|
1406
1412
|
flex-direction: column;
|
|
1407
1413
|
gap: 8px;
|
|
1408
|
-
`,
|
|
1414
|
+
`,Ea=s.span`
|
|
1409
1415
|
font-size: 13px;
|
|
1410
1416
|
font-weight: 500;
|
|
1411
1417
|
line-height: 1.5;
|
|
1412
1418
|
color: ${e=>e.$disabled?to.label.disabledColor:to.label.color};
|
|
1413
1419
|
margin-bottom: 4px;
|
|
1414
|
-
`,
|
|
1420
|
+
`,Ta=s.div`
|
|
1415
1421
|
display: flex;
|
|
1416
1422
|
flex-direction: column;
|
|
1417
1423
|
gap: 12px;
|
|
1418
|
-
`,pt=
|
|
1424
|
+
`,pt=N.newClassNameGetter("radio-group"),Na=({className:e,classnames:o,disabled:r,label:i,name:n,onChange:l,options:c,ref:d,value:p,...h})=>a.jsxs(ja,{...h,ref:d,className:pt("container",e),children:[i&&a.jsx(Ea,{className:pt("label",o==null?void 0:o.label),$disabled:r,children:i}),a.jsx(Ta,{className:pt("options",o==null?void 0:o.options),children:c.map(u=>a.jsx(mt,{className:o==null?void 0:o.radio,name:n,checked:p===u.value,label:u.label,disabled:r,onChange:()=>l(u.value)},u.value))})]}),ut=40,Pe=4,oo={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},ro={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)}},ht=e=>oo[e]??oo.default,le=e=>ro[e]??ro.normal,Ia=s.div`
|
|
1419
1425
|
position: relative;
|
|
1420
1426
|
display: grid;
|
|
1421
1427
|
gap: 2px;
|
|
1422
1428
|
min-width: 180px;
|
|
1423
1429
|
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1424
|
-
`,
|
|
1430
|
+
`,Aa=s(fe)`
|
|
1425
1431
|
margin-left: 6px;
|
|
1426
|
-
`,
|
|
1432
|
+
`,Da=s.button`
|
|
1427
1433
|
display: flex;
|
|
1428
1434
|
align-items: center;
|
|
1429
1435
|
justify-content: space-between;
|
|
@@ -1446,13 +1452,13 @@
|
|
|
1446
1452
|
&:focus-visible {
|
|
1447
1453
|
outline: 2px solid ${e=>le(e.$variant).focus};
|
|
1448
1454
|
}
|
|
1449
|
-
`,
|
|
1455
|
+
`,_a=s.span`
|
|
1450
1456
|
flex: 1;
|
|
1451
1457
|
min-width: 0;
|
|
1452
1458
|
overflow: hidden;
|
|
1453
1459
|
text-overflow: ellipsis;
|
|
1454
1460
|
white-space: nowrap;
|
|
1455
|
-
`,
|
|
1461
|
+
`,Ma=s.span`
|
|
1456
1462
|
display: flex;
|
|
1457
1463
|
align-items: center;
|
|
1458
1464
|
justify-content: center;
|
|
@@ -1466,15 +1472,15 @@
|
|
|
1466
1472
|
border-radius: 16px;
|
|
1467
1473
|
box-shadow: 0 4px 20px ${t.alpha(t.COLORS.black,15)};
|
|
1468
1474
|
z-index: 1000;
|
|
1469
|
-
`,
|
|
1475
|
+
`,Fa=s.div`
|
|
1470
1476
|
position: absolute;
|
|
1471
1477
|
left: -4px;
|
|
1472
1478
|
width: calc(100% + 8px);
|
|
1473
1479
|
${Co}
|
|
1474
|
-
`,
|
|
1480
|
+
`,Ba=s.div`
|
|
1475
1481
|
position: fixed;
|
|
1476
1482
|
${Co}
|
|
1477
|
-
`,
|
|
1483
|
+
`,Ya=s.button`
|
|
1478
1484
|
display: flex;
|
|
1479
1485
|
align-items: center;
|
|
1480
1486
|
justify-content: space-between;
|
|
@@ -1500,28 +1506,28 @@
|
|
|
1500
1506
|
outline: none;
|
|
1501
1507
|
background: ${t.alpha(t.COLORS.black,8)};
|
|
1502
1508
|
}
|
|
1503
|
-
`,
|
|
1509
|
+
`,Ha=s.span`
|
|
1504
1510
|
display: flex;
|
|
1505
1511
|
align-items: center;
|
|
1506
1512
|
justify-content: center;
|
|
1507
1513
|
flex-shrink: 0;
|
|
1508
1514
|
color: ${t.COLORS.black};
|
|
1509
|
-
`,ye=
|
|
1515
|
+
`,ye=N.newClassNameGetter("select"),Ga=({className:e,classnames:o,disabled:r=!1,fullWidth:i=!1,label:n,onChange:l,options:c,placeholder:d="Select...",portalRenderNode:p,ref:h,size:u="default",value:f,variant:O="normal",...k})=>{const[y,S]=g.useState(!1),[$,x]=g.useState({top:0,left:0,width:0}),v=g.useRef(null),b=g.useRef(null),L=g.useRef(null),j=c.find(m=>m.value===f),E=Math.max(0,c.findIndex(m=>m.value===f)),G=-(E*ut+Pe),P=()=>{if(!b.current||!p)return;const m=b.current.getBoundingClientRect(),T=E*ut+Pe;let R=m.top-T;const _=c.length*ut+Pe*2,Y=8,M=window.innerHeight-_-8;R<Y&&(R=Y),R>M&&(R=M),x({top:R,left:m.left-Pe,width:m.width+Pe*2})},D=m=>{var T;l==null||l(m),S(!1),(T=b.current)==null||T.focus()},I=m=>{r||(m.key==="Enter"||m.key===" "?(m.preventDefault(),S(T=>!T)):m.key==="Escape"&&y?(m.preventDefault(),S(!1)):m.key==="ArrowDown"&&!y&&(m.preventDefault(),S(!0)))};g.useLayoutEffect(()=>{y&&p&&P()},[y,p,E,c.length]),g.useEffect(()=>{if(!y)return;const m=_=>{const Y=_.target,M=v.current&&!v.current.contains(Y),H=L.current&&!L.current.contains(Y);p?M&&H&&S(!1):M&&S(!1)},T=()=>{p&&P()},R=()=>{p&&P()};return document.addEventListener("mousedown",m),p&&(window.addEventListener("scroll",T,!0),window.addEventListener("resize",R)),()=>{document.removeEventListener("mousedown",m),window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",R)}},[y,p]);const C=()=>c.map(m=>a.jsxs(Ya,{type:"button",role:"option",$selected:m.value===f,$disabled:m.disabled??!1,disabled:m.disabled,"aria-selected":m.value===f,onClick:()=>D(m.value),className:ye("option",o==null?void 0:o.option),children:[a.jsx("span",{children:m.label}),m.value===f&&a.jsx(Ha,{children:a.jsx(a.Check,{size:16})})]},m.value)),F=p?ge.createPortal(a.jsx(Ba,{ref:L,role:"listbox",style:{top:$.top,left:$.left,width:$.width},className:ye("dropdown",o==null?void 0:o.dropdown),children:C()}),p):a.jsx(Fa,{ref:L,role:"listbox",style:{top:G},className:ye("dropdown",o==null?void 0:o.dropdown),children:C()});return a.jsxs(Ia,{...k,ref:m=>{v.current=m,typeof h=="function"?h(m):h&&(h.current=m)},$fullWidth:i,className:ye("container",e),children:[n&&a.jsx(Aa,{className:ye("label",o==null?void 0:o.label),children:n}),a.jsxs(Da,{ref:b,type:"button",$size:u,$variant:O,$disabled:r,$hasValue:!!j,disabled:r,onClick:()=>!r&&S(m=>!m),onKeyDown:I,"aria-haspopup":"listbox","aria-expanded":y,className:ye("trigger",o==null?void 0:o.trigger),children:[a.jsx(_a,{children:(j==null?void 0:j.label)??d}),a.jsx(Ma,{$open:y,children:a.jsx(a.ChevronDown,{size:16})})]}),y&&F]})},io={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},no={track:t.alpha(t.COLORS.black,15),indicator:t.COLORS.black},bt=e=>io[e]??io.md,Va=ie.keyframes`
|
|
1510
1516
|
0% {
|
|
1511
1517
|
transform: rotate(0deg);
|
|
1512
1518
|
}
|
|
1513
1519
|
100% {
|
|
1514
1520
|
transform: rotate(360deg);
|
|
1515
1521
|
}
|
|
1516
|
-
`,
|
|
1522
|
+
`,Wa=s.div`
|
|
1517
1523
|
display: inline-block;
|
|
1518
1524
|
width: ${e=>bt(e.$size).size};
|
|
1519
1525
|
height: ${e=>bt(e.$size).size};
|
|
1520
1526
|
border: ${e=>bt(e.$size).borderWidth} solid ${no.track};
|
|
1521
1527
|
border-top-color: ${no.indicator};
|
|
1522
1528
|
border-radius: 50%;
|
|
1523
|
-
animation: ${
|
|
1524
|
-
`,
|
|
1529
|
+
animation: ${Va} 0.8s linear infinite;
|
|
1530
|
+
`,Ua=N.newClassNameGetter("spinner"),Xa=({"aria-label":e="Loading",className:o,ref:r,size:i="md",...n})=>a.jsx(Wa,{...n,ref:r,className:Ua("container",o),role:"status","aria-label":e,$size:i}),ao={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},qa=e=>ao[e]??ao.neutral,Ka=s.div`
|
|
1525
1531
|
display: flex;
|
|
1526
1532
|
flex-direction: column;
|
|
1527
1533
|
gap: 4px;
|
|
@@ -1530,16 +1536,16 @@
|
|
|
1530
1536
|
border-radius: 16px;
|
|
1531
1537
|
border: ${({$border:e})=>e?"1px solid #e5e7eb":"none"};
|
|
1532
1538
|
box-shadow: ${({$shadow:e})=>e?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"none"};
|
|
1533
|
-
`,
|
|
1539
|
+
`,Za=s.div`
|
|
1534
1540
|
display: flex;
|
|
1535
1541
|
align-items: center;
|
|
1536
1542
|
justify-content: space-between;
|
|
1537
1543
|
gap: 8px;
|
|
1538
|
-
`,
|
|
1544
|
+
`,Ja=s.p`
|
|
1539
1545
|
margin: 0;
|
|
1540
1546
|
font-size: 13px;
|
|
1541
1547
|
color: ${t.COLORS["iron-grey"]};
|
|
1542
|
-
`,
|
|
1548
|
+
`,Qa=s.div`
|
|
1543
1549
|
display: flex;
|
|
1544
1550
|
align-items: center;
|
|
1545
1551
|
justify-content: center;
|
|
@@ -1553,21 +1559,21 @@
|
|
|
1553
1559
|
width: 18px;
|
|
1554
1560
|
height: 18px;
|
|
1555
1561
|
}
|
|
1556
|
-
`,
|
|
1562
|
+
`,el=s.h3`
|
|
1557
1563
|
margin: 0;
|
|
1558
1564
|
font-size: 28px;
|
|
1559
1565
|
font-weight: 600;
|
|
1560
1566
|
line-height: 1.2;
|
|
1561
1567
|
color: ${t.COLORS.black};
|
|
1562
|
-
`,
|
|
1568
|
+
`,tl=s.p`
|
|
1563
1569
|
margin: 0;
|
|
1564
1570
|
font-size: 12px;
|
|
1565
|
-
color: ${({$variant:e})=>
|
|
1566
|
-
`,Ue=
|
|
1571
|
+
color: ${({$variant:e})=>qa(e)};
|
|
1572
|
+
`,Ue=N.newClassNameGetter("status-card"),ol=({border:e=!1,className:o,classnames:r,icon:i,label:n,ref:l,shadow:c=!1,trend:d,trendVariant:p="neutral",value:h,...u})=>a.jsxs(Ka,{...u,ref:l,className:Ue("container",o),$border:e,$shadow:c,children:[a.jsxs(Za,{children:[a.jsx(Ja,{className:Ue("label",r==null?void 0:r.label),children:n}),i&&a.jsx(Qa,{children:i})]}),a.jsx(el,{className:Ue("value",r==null?void 0:r.value),children:h}),d&&a.jsx(tl,{className:Ue("trend",r==null?void 0:r.trend),$variant:p,children:d})]}),rl=s.div`
|
|
1567
1573
|
display: flex;
|
|
1568
1574
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1569
1575
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1570
|
-
`,
|
|
1576
|
+
`,il=s.div`
|
|
1571
1577
|
display: flex;
|
|
1572
1578
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1573
1579
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1576,7 +1582,7 @@
|
|
|
1576
1582
|
&:last-child {
|
|
1577
1583
|
flex: 0;
|
|
1578
1584
|
}
|
|
1579
|
-
`,
|
|
1585
|
+
`,nl=s.button`
|
|
1580
1586
|
display: flex;
|
|
1581
1587
|
align-items: center;
|
|
1582
1588
|
gap: 10px;
|
|
@@ -1594,7 +1600,7 @@
|
|
|
1594
1600
|
outline-offset: 2px;
|
|
1595
1601
|
}
|
|
1596
1602
|
}
|
|
1597
|
-
`,
|
|
1603
|
+
`,al=s.div`
|
|
1598
1604
|
display: flex;
|
|
1599
1605
|
align-items: center;
|
|
1600
1606
|
justify-content: center;
|
|
@@ -1618,13 +1624,13 @@
|
|
|
1618
1624
|
border: 2px solid ${t.COLORS.gray};
|
|
1619
1625
|
color: ${t.COLORS["iron-grey"]};
|
|
1620
1626
|
`}
|
|
1621
|
-
`,
|
|
1627
|
+
`,ll=s.span`
|
|
1622
1628
|
font-size: 14px;
|
|
1623
1629
|
font-weight: 500;
|
|
1624
1630
|
white-space: nowrap;
|
|
1625
1631
|
color: ${e=>e.$active||e.$completed?t.COLORS.black:t.COLORS["iron-grey"]};
|
|
1626
1632
|
transition: color 0.2s ease;
|
|
1627
|
-
`,
|
|
1633
|
+
`,dl=s.div`
|
|
1628
1634
|
background-color: ${e=>e.$completed?t.COLORS.black:t.COLORS.gray};
|
|
1629
1635
|
transition: background-color 0.2s ease;
|
|
1630
1636
|
|
|
@@ -1638,15 +1644,15 @@
|
|
|
1638
1644
|
min-width: 16px;
|
|
1639
1645
|
margin: 0 12px;
|
|
1640
1646
|
`}
|
|
1641
|
-
`,je=
|
|
1647
|
+
`,je=N.newClassNameGetter("stepper"),cl=({className:e,classnames:o,onChange:r,orientation:i="horizontal",ref:n,steps:l,value:c,...d})=>{const p=g.useMemo(()=>l.findIndex(h=>h.value===c),[l,c]);return a.jsx(rl,{...d,ref:n,$orientation:i,className:je("container",e),children:l.map((h,u)=>{const f=h.value===c,O=u<p,k=u===l.length-1;return a.jsxs(il,{$orientation:i,children:[a.jsxs(nl,{type:"button",$active:f,$completed:O,$clickable:!!r,onClick:()=>r==null?void 0:r(h.value),className:je("step",o==null?void 0:o.step),children:[a.jsx(al,{$active:f,$completed:O,className:je("circle",o==null?void 0:o.circle),children:u+1}),a.jsx(ll,{$active:f,$completed:O,className:je("label",o==null?void 0:o.label),children:h.label})]}),!k&&a.jsx(dl,{$completed:O,$orientation:i,className:je("line",o==null?void 0:o.line)})]},h.value)})})},vt={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},sl=s.div`
|
|
1642
1648
|
position: relative;
|
|
1643
1649
|
display: flex;
|
|
1644
1650
|
flex-direction: column;
|
|
1645
1651
|
gap: 4px;
|
|
1646
|
-
`,
|
|
1652
|
+
`,pl=s(fe)`
|
|
1647
1653
|
margin-left: 6px;
|
|
1648
1654
|
color: ${e=>vt[e.$variant].label};
|
|
1649
|
-
`,
|
|
1655
|
+
`,ul=s.div`
|
|
1650
1656
|
display: flex;
|
|
1651
1657
|
flex-wrap: wrap;
|
|
1652
1658
|
align-items: center;
|
|
@@ -1668,7 +1674,7 @@
|
|
|
1668
1674
|
outline: 2px solid ${e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1669
1675
|
outline-offset: 2px;
|
|
1670
1676
|
`}
|
|
1671
|
-
`,
|
|
1677
|
+
`,hl=s.input`
|
|
1672
1678
|
flex: 1;
|
|
1673
1679
|
min-width: 80px;
|
|
1674
1680
|
border: none;
|
|
@@ -1697,7 +1703,7 @@
|
|
|
1697
1703
|
opacity 0.15s ease,
|
|
1698
1704
|
transform 0.15s ease,
|
|
1699
1705
|
visibility 0.15s;
|
|
1700
|
-
`,
|
|
1706
|
+
`,bl=s.div`
|
|
1701
1707
|
position: absolute;
|
|
1702
1708
|
left: 0;
|
|
1703
1709
|
right: 0;
|
|
@@ -1707,7 +1713,7 @@
|
|
|
1707
1713
|
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1708
1714
|
transform: ${e=>ko(e.$open,e.$position)};
|
|
1709
1715
|
transition: ${Lo};
|
|
1710
|
-
`,
|
|
1716
|
+
`,gl=s.div`
|
|
1711
1717
|
position: fixed;
|
|
1712
1718
|
${Ro}
|
|
1713
1719
|
opacity: ${e=>e.$open?1:0};
|
|
@@ -1750,11 +1756,11 @@
|
|
|
1750
1756
|
color: ${t.COLORS["iron-grey"]};
|
|
1751
1757
|
font-size: 14px;
|
|
1752
1758
|
text-align: center;
|
|
1753
|
-
`,ee=
|
|
1759
|
+
`,ee=N.newClassNameGetter("tags"),Xe=4,fl=({className:e,classnames:o,createKey:r="Tab",disabled:i=!1,emptyMessage:n="No options",freeSolo:l=!0,label:c,onChange:d,options:p=[],placeholder:h="Add tag...",portalRenderNode:u,ref:f,value:O,variant:k="normal",...y})=>{const S=g.useRef(null),$=g.useRef(null),x=g.useRef(null),v=g.useRef(null),[b,L]=g.useState(""),[j,E]=g.useState(!1),[G,P]=g.useState("bottom"),[D,I]=g.useState({top:0,left:0,width:0}),C=g.useMemo(()=>{const z=p.filter(X=>!O.includes(X.value));if(!b.trim())return z;const A=b.toLowerCase().trim();return z.filter(X=>X.label.toLowerCase().includes(A))},[p,O,b]),F=j&&p.length>0,m=g.useCallback(()=>{var Ae;if(!$.current)return;const z=$.current.getBoundingClientRect(),A=((Ae=x.current)==null?void 0:Ae.offsetHeight)??200,X=window.innerHeight-z.bottom-Xe,q=z.top-Xe,xe=X<A&&q>X?"top":"bottom";if(P(xe),u){const et=xe==="bottom"?z.bottom+Xe:z.top-A-Xe;I({top:et,left:z.left,width:z.width})}},[u]);g.useEffect(()=>{if(j)return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[j,m]);const T=g.useCallback(z=>{const A=z.trim();return!A||O.includes(A)?!1:(d([...O,A]),L(""),!0)},[O,d]),R=z=>{if(z.key===r&&b.trim())if(z.preventDefault(),l)T(b);else{const A=C.find(X=>X.label.toLowerCase()===b.toLowerCase().trim());A&&T(A.value)}else z.key==="Backspace"&&!b&&O.length>0&&d(O.slice(0,-1))},_=z=>{var A;T(z),(A=v.current)==null||A.focus()},Y=z=>{d(O.filter(A=>A!==z))},M=()=>{var z;i||(z=v.current)==null||z.focus()},H=z=>{const A=p.find(X=>X.value===z);return(A==null?void 0:A.label)??z};return a.jsxs(sl,{...y,ref:f,className:ee("container",e),children:[c&&a.jsx(pl,{$variant:k,className:ee("label"),children:c}),a.jsxs("div",{ref:S,style:{position:"relative"},children:[a.jsxs(ul,{ref:$,$variant:k,$disabled:i,$focused:j,onClick:M,className:ee("trigger",o==null?void 0:o.trigger),children:[O.map(z=>a.jsx(Ke,{deletable:!i,onDelete:()=>Y(z),className:ee("chip",o==null?void 0:o.chip),children:H(z)},z)),a.jsx(hl,{ref:v,type:"text",value:b,onChange:z=>L(z.target.value),onFocus:()=>E(!0),onBlur:()=>setTimeout(()=>E(!1),150),onKeyDown:R,placeholder:O.length===0?h:"",disabled:i,$disabled:i,className:ee("input",o==null?void 0:o.input)})]}),p.length>0&&(u?ge.createPortal(a.jsx(gl,{ref:x,$open:F,$position:G,style:{top:D.top,left:D.left,width:D.width},className:ee("dropdown",o==null?void 0:o.dropdown),children:C.length===0?a.jsx(co,{className:ee("empty",o==null?void 0:o.empty),children:n}):C.map(z=>a.jsx(lo,{type:"button",onMouseDown:A=>A.preventDefault(),onClick:()=>_(z.value),className:ee("option",o==null?void 0:o.option),children:z.label},z.value))}),u):a.jsx(bl,{ref:x,$open:F,$position:G,className:ee("dropdown",o==null?void 0:o.dropdown),children:C.length===0?a.jsx(co,{className:ee("empty",o==null?void 0:o.empty),children:n}):C.map(z=>a.jsx(lo,{type:"button",onMouseDown:A=>A.preventDefault(),onClick:()=>_(z.value),className:ee("option",o==null?void 0:o.option),children:z.label},z.value))}))]})]})},xl=s.div`
|
|
1754
1760
|
display: flex;
|
|
1755
1761
|
align-items: center;
|
|
1756
1762
|
gap: 6px;
|
|
1757
|
-
`,
|
|
1763
|
+
`,Ol=s.button`
|
|
1758
1764
|
padding: 6px 16px;
|
|
1759
1765
|
border: none;
|
|
1760
1766
|
border-radius: 12px;
|
|
@@ -1777,7 +1783,7 @@
|
|
|
1777
1783
|
outline: 2px solid ${t.COLORS["steel-blue"]};
|
|
1778
1784
|
outline-offset: 2px;
|
|
1779
1785
|
}
|
|
1780
|
-
`,so=
|
|
1786
|
+
`,so=N.newClassNameGetter("tabs"),$l=({className:e,classnames:o,onChange:r,ref:i,tabs:n,value:l,...c})=>a.jsx(xl,{...c,ref:i,className:so("container",e),role:"tablist",children:n.map(d=>a.jsx(Ol,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>r(d.value),className:so("tab",o==null?void 0:o.tab),children:d.label},d.value))}),zo=g.createContext(null),gt=3,po={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}},Sl=(e,o)=>{switch(o.type){case"ADD_TOAST":{const r=o.payload;return e.toasts.length<gt?{...e,toasts:[...e.toasts,r]}:{...e,queue:[...e.queue,r]}}case"REMOVE_TOAST":{const r=o.payload,i=e.toasts.filter(l=>l.id!==r),n=e.queue[0];return n&&i.length<gt?{toasts:[...i,n],queue:e.queue.slice(1)}:{...e,toasts:i}}case"SHOW_NEXT_FROM_QUEUE":{const r=e.queue[0];return!r||e.toasts.length>=gt?e:{toasts:[...e.toasts,r],queue:e.queue.slice(1)}}default:return e}},yl={toasts:[],queue:[]},ft=e=>po[e]??po.default,vl=ie.keyframes`
|
|
1781
1787
|
from {
|
|
1782
1788
|
transform: translateY(100%);
|
|
1783
1789
|
opacity: 0;
|
|
@@ -1786,7 +1792,7 @@
|
|
|
1786
1792
|
transform: translateY(0);
|
|
1787
1793
|
opacity: 1;
|
|
1788
1794
|
}
|
|
1789
|
-
|
|
1795
|
+
`,ml=ie.keyframes`
|
|
1790
1796
|
from {
|
|
1791
1797
|
transform: translateY(0);
|
|
1792
1798
|
opacity: 1;
|
|
@@ -1795,7 +1801,7 @@
|
|
|
1795
1801
|
transform: translateY(100%);
|
|
1796
1802
|
opacity: 0;
|
|
1797
1803
|
}
|
|
1798
|
-
`,
|
|
1804
|
+
`,wl=s.div`
|
|
1799
1805
|
position: fixed;
|
|
1800
1806
|
bottom: 24px;
|
|
1801
1807
|
left: 24px;
|
|
@@ -1806,7 +1812,7 @@
|
|
|
1806
1812
|
pointer-events: none;
|
|
1807
1813
|
width: auto;
|
|
1808
1814
|
max-width: 90vw;
|
|
1809
|
-
`,
|
|
1815
|
+
`,Cl=s.div`
|
|
1810
1816
|
display: flex;
|
|
1811
1817
|
align-items: center;
|
|
1812
1818
|
justify-content: space-between;
|
|
@@ -1818,17 +1824,17 @@
|
|
|
1818
1824
|
border: 1px solid ${({$variant:e})=>ft(e).border};
|
|
1819
1825
|
border-radius: 96px;
|
|
1820
1826
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
1821
|
-
animation: ${({$isExiting:e})=>e
|
|
1827
|
+
animation: ${({$isExiting:e})=>e?ml:vl} 0.3s ease-out;
|
|
1822
1828
|
pointer-events: auto;
|
|
1823
1829
|
max-width: 500px;
|
|
1824
|
-
`,
|
|
1830
|
+
`,Rl=s.span`
|
|
1825
1831
|
font-size: 14px;
|
|
1826
1832
|
font-weight: 500;
|
|
1827
1833
|
line-height: 1.4;
|
|
1828
1834
|
white-space: nowrap;
|
|
1829
1835
|
overflow: hidden;
|
|
1830
1836
|
text-overflow: ellipsis;
|
|
1831
|
-
`,
|
|
1837
|
+
`,kl=s.button`
|
|
1832
1838
|
display: flex;
|
|
1833
1839
|
align-items: center;
|
|
1834
1840
|
justify-content: center;
|
|
@@ -1846,13 +1852,13 @@
|
|
|
1846
1852
|
&:hover {
|
|
1847
1853
|
opacity: 1;
|
|
1848
1854
|
}
|
|
1849
|
-
`,
|
|
1855
|
+
`,Ll=s.div`
|
|
1850
1856
|
display: flex;
|
|
1851
1857
|
align-items: center;
|
|
1852
1858
|
justify-content: space-between;
|
|
1853
1859
|
gap: 12px;
|
|
1854
1860
|
width: 100%;
|
|
1855
|
-
`,
|
|
1861
|
+
`,zl=s.div`
|
|
1856
1862
|
display: flex;
|
|
1857
1863
|
align-items: center;
|
|
1858
1864
|
justify-content: center;
|
|
@@ -1867,7 +1873,7 @@
|
|
|
1867
1873
|
font-weight: 500;
|
|
1868
1874
|
white-space: nowrap;
|
|
1869
1875
|
margin-left: auto;
|
|
1870
|
-
`,uo=({toast:e,onRemove:o})=>{const[r,i]=g.useState(!1),n=()=>{i(!0),setTimeout(()=>{o(e.id)},300)};return g.useEffect(()=>{if(e.duration){const l=setTimeout(()=>{n()},e.duration);return()=>clearTimeout(l)}},[e.duration,e.id]),a.jsxs(
|
|
1876
|
+
`,uo=({toast:e,onRemove:o})=>{const[r,i]=g.useState(!1),n=()=>{i(!0),setTimeout(()=>{o(e.id)},300)};return g.useEffect(()=>{if(e.duration){const l=setTimeout(()=>{n()},e.duration);return()=>clearTimeout(l)}},[e.duration,e.id]),a.jsxs(Cl,{$variant:e.variant,$isExiting:r,children:[a.jsx(Rl,{children:e.message}),a.jsx(kl,{onClick:n,children:a.jsx(a.X,{style:{width:16,height:16}})})]})},Pl=({toasts:e,queueCount:o,removeToast:r})=>{if(e.length===0)return null;const i=e.length-1;return a.jsx(wl,{children:e.map((n,l)=>l===i&&o>0?a.jsxs(Ll,{children:[a.jsx(uo,{toast:n,onRemove:r}),a.jsxs(zl,{children:["+",o]})]},n.id):a.jsx(uo,{toast:n,onRemove:r},n.id))})},jl=({children:e})=>{const[o,r]=g.useReducer(Sl,yl),i=g.useCallback((l,c="default",d)=>{const p=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r({type:"ADD_TOAST",payload:{id:p,message:l,variant:c,duration:d}})},[]),n=g.useCallback(l=>{r({type:"REMOVE_TOAST",payload:l})},[]);return a.jsxs(zo.Provider,{value:{addToast:i,removeToast:n},children:[e,a.jsx(Pl,{toasts:o.toasts,queueCount:o.queue.length,removeToast:n})]})},El=()=>{const e=g.useContext(zo);if(!e)throw new Error("useToast must be used within ToastProvider");return e},ho={dark:{background:t.COLORS.black,text:t.COLORS.white},light:{background:t.COLORS.white,text:t.COLORS.black,border:t.COLORS.gray},success:{background:t.COLORS.green,text:t.COLORS.white},warning:{background:t.COLORS.yellow,text:t.COLORS.white},danger:{background:t.COLORS.red,text:t.COLORS.white}},Ne=e=>ho[e]??ho.dark,Tl=(e,o)=>{const r=Ne(o).background;switch(e){case"top":return`
|
|
1871
1877
|
bottom: -12px;
|
|
1872
1878
|
left: 50%;
|
|
1873
1879
|
margin-left: -6px;
|
|
@@ -1887,7 +1893,7 @@
|
|
|
1887
1893
|
top: 50%;
|
|
1888
1894
|
margin-top: -6px;
|
|
1889
1895
|
border-right-color: ${r};
|
|
1890
|
-
`;default:return""}},
|
|
1896
|
+
`;default:return""}},Nl=(e,o)=>{if(o!=="light")return"";const r=Ne(o).border;switch(e){case"top":return`
|
|
1891
1897
|
&::after {
|
|
1892
1898
|
bottom: -14px;
|
|
1893
1899
|
left: 50%;
|
|
@@ -1941,7 +1947,7 @@
|
|
|
1941
1947
|
width: 0;
|
|
1942
1948
|
height: 0;
|
|
1943
1949
|
border: 6px solid transparent;
|
|
1944
|
-
${
|
|
1950
|
+
${Tl(e.$placement,e.$variant)}
|
|
1945
1951
|
}
|
|
1946
1952
|
|
|
1947
1953
|
${e.$variant==="light"?`
|
|
@@ -1954,11 +1960,11 @@
|
|
|
1954
1960
|
}
|
|
1955
1961
|
`:""}
|
|
1956
1962
|
|
|
1957
|
-
${
|
|
1958
|
-
`,
|
|
1963
|
+
${Nl(e.$placement,e.$variant)}
|
|
1964
|
+
`,Il=s.div`
|
|
1959
1965
|
position: relative;
|
|
1960
1966
|
display: inline-block;
|
|
1961
|
-
`,
|
|
1967
|
+
`,Al=e=>{switch(e){case"top":return`
|
|
1962
1968
|
bottom: calc(100% + 8px);
|
|
1963
1969
|
left: 50%;
|
|
1964
1970
|
transform: translateX(-50%);
|
|
@@ -1974,12 +1980,12 @@
|
|
|
1974
1980
|
left: calc(100% + 8px);
|
|
1975
1981
|
top: 50%;
|
|
1976
1982
|
transform: translateY(-50%);
|
|
1977
|
-
`;default:return""}},
|
|
1983
|
+
`;default:return""}},Dl=s.div`
|
|
1978
1984
|
position: absolute;
|
|
1979
1985
|
${e=>Po(e)}
|
|
1980
|
-
${({$placement:e})=>
|
|
1981
|
-
`,
|
|
1986
|
+
${({$placement:e})=>Al(e)}
|
|
1987
|
+
`,_l=s.div`
|
|
1982
1988
|
position: fixed;
|
|
1983
1989
|
${e=>Po(e)}
|
|
1984
|
-
`,xt=
|
|
1990
|
+
`,xt=N.newClassNameGetter("tooltip"),de=8,Ml=({children:e,className:o,classnames:r,content:i,delay:n=200,placement:l="top",portalRenderNode:c,ref:d,variant:p="dark",...h})=>{const[u,f]=g.useState(!1),[O,k]=g.useState(null),[y,S]=g.useState(l),[$,x]=g.useState({top:0,left:0}),v=g.useRef(null),b=g.useRef(null),L=g.useCallback(()=>{var _,Y;if(!v.current)return;const P=v.current.getBoundingClientRect(),D=((_=b.current)==null?void 0:_.offsetWidth)??100,I=((Y=b.current)==null?void 0:Y.offsetHeight)??30,C=P.top-de,F=window.innerHeight-P.bottom-de,m=P.left-de,T=window.innerWidth-P.right-de;let R=l;if(l==="top"&&C<I&&F>C?R="bottom":l==="bottom"&&F<I&&C>F?R="top":l==="left"&&m<D&&T>m?R="right":l==="right"&&T<D&&m>T&&(R="left"),S(R),c){let M,H;switch(R){case"top":M=P.top-I-de,H=P.left+P.width/2-D/2;break;case"bottom":M=P.bottom+de,H=P.left+P.width/2-D/2;break;case"left":M=P.top+P.height/2-I/2,H=P.left-D-de;break;case"right":M=P.top+P.height/2-I/2,H=P.right+de;break;default:M=0,H=0}const z=8;H=Math.max(z,Math.min(H,window.innerWidth-D-z)),M=Math.max(z,Math.min(M,window.innerHeight-I-z)),x({top:M,left:H})}},[l,c]);g.useLayoutEffect(()=>{u&&L()},[u,L]);const j=()=>{const P=setTimeout(()=>{f(!0)},n);k(P)},E=()=>{O&&(clearTimeout(O),k(null)),f(!1)},G=c?ge.createPortal(a.jsx(_l,{ref:b,className:xt("content",r==null?void 0:r.content),$placement:y,$variant:p,$visible:u,style:{top:$.top,left:$.left},children:i}),c):a.jsx(Dl,{ref:b,className:xt("content",r==null?void 0:r.content),$placement:y,$variant:p,$visible:u,children:i});return a.jsxs(Il,{...h,ref:P=>{v.current=P,typeof d=="function"?d(P):d&&(d.current=P)},className:xt("wrapper",o),onMouseEnter:j,onMouseLeave:E,children:[e,G]})};exports.Button=Ie;exports.Card=gr;exports.Checkbox=Je;exports.CheckboxCard=Rr;exports.CheckboxGroup=Pr;exports.Chip=Ke;exports.Confirmation=Br;exports.Container=Gr;exports.DatePicker=$i;exports.Drawer=wi;exports.Dropdown=Pi;exports.FieldLabel=fe;exports.FieldMessage=Ni;exports.GlobalStyle=Zo;exports.ImageCropper=Yn;exports.Input=vo;exports.KeySymbol=bo;exports.KeysBindings=go;exports.Modal=mo;exports.MultiSelect=na;exports.OtpCode=sa;exports.Panel=fa;exports.Progress=$a;exports.Radio=mt;exports.RadioCard=Pa;exports.RadioGroup=Na;exports.Select=Ga;exports.Spinner=Xa;exports.StatusCard=ol;exports.Stepper=cl;exports.Tabs=$l;exports.Tags=fl;exports.ToastProvider=jl;exports.Tooltip=Ml;exports.formatDateGo=fo;exports.useImageCropper=yo;exports.useToast=El;
|
|
1985
1991
|
//# sourceMappingURL=index.cjs.map
|