@donkit-ai/design-system 1.1.29 → 1.1.31
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.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +803 -699
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),g=require("lucide-react"),ee=require("react-dom"),B={1:16,2:20,3:24,4:28,5:48};var se={exports:{}},Z={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ae;function
|
|
9
|
+
*/var ae;function be(){if(ae)return Z;ae=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(c,n,a){var l=null;if(a!==void 0&&(l=""+a),n.key!==void 0&&(l=""+n.key),"key"in n){a={};for(var i in n)i!=="key"&&(a[i]=n[i])}else a=n;return n=a.ref,{$$typeof:t,type:c,key:l,ref:n!==void 0?n:null,props:a}}return Z.Fragment=e,Z.jsx=r,Z.jsxs=r,Z}var Q={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var oe;function
|
|
17
|
+
*/var oe;function he(){return oe||(oe=1,process.env.NODE_ENV!=="production"&&function(){function t(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===H?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case T:return"Fragment";case P:return"Profiler";case y:return"StrictMode";case D:return"Suspense";case U:return"SuspenseList";case V:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case N:return"Portal";case R:return o.displayName||"Context";case S:return(o._context.displayName||"Context")+".Consumer";case C:var x=o.render;return o=o.displayName,o||(o=x.displayName||x.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case O:return x=o.displayName||null,x!==null?x:t(o.type)||"Memo";case M:x=o._payload,o=o._init;try{return t(o(x))}catch{}}return null}function e(o){return""+o}function r(o){try{e(o);var x=!1}catch{x=!0}if(x){x=console;var E=x.error,$=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return E.call(x,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",$),e(o)}}function c(o){if(o===T)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===M)return"<...>";try{var x=t(o);return x?"<"+x+">":"<...>"}catch{return"<...>"}}function n(){var o=Y.A;return o===null?null:o.getOwner()}function a(){return Error("react-stack-top-frame")}function l(o){if(F.call(o,"key")){var x=Object.getOwnPropertyDescriptor(o,"key").get;if(x&&x.isReactWarning)return!1}return o.key!==void 0}function i(o,x){function E(){k||(k=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",x))}E.isReactWarning=!0,Object.defineProperty(o,"key",{get:E,configurable:!0})}function h(){var o=t(this.type);return A[o]||(A[o]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),o=this.props.ref,o!==void 0?o:null}function m(o,x,E,$,q,X){var I=E.ref;return o={$$typeof:w,type:o,key:x,props:E,_owner:$},(I!==void 0?I:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:h}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function p(o,x,E,$,q,X){var I=x.children;if(I!==void 0)if($)if(b(I)){for($=0;$<I.length;$++)f(I[$]);Object.freeze&&Object.freeze(I)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(I);if(F.call(x,"key")){I=t(o);var K=Object.keys(x).filter(function(pe){return pe!=="key"});$=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",j[I+$]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,g,S,V,S),U[S+g]=!0)}if(S=null,y!==void 0&&(r(y),S=""+y),i(x)&&(r(x.key),S=""+x.key),"key"in x){y={};for(var te in x)te!=="key"&&(y[te]=x[te])}else y=x;return S&&l(y,typeof c=="function"?c.displayName||c.name||"Unknown":c),f(c,S,y,n(),J,ee)}function h(c){v(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===A&&(c._payload.status==="fulfilled"?v(c._payload.value)&&c._payload.value._store&&(c._payload.value._store.validated=1):c._store&&(c._store.validated=1))}function v(c){return typeof c=="object"&&c!==null&&c.$$typeof===_}var d=u,_=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),k=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),O=Symbol.for("react.client.reference"),B=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,Z=Array.isArray,N=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(c){return c()}};var F,Y={},G=d.react_stack_bottom_frame.bind(d,a)(),Q=N(o(a)),U={};H.Fragment=R,H.jsx=function(c,x,y){var g=1e4>B.recentlyCreatedOwnerStacks++;return m(c,x,y,!1,g?Error("react-stack-top-frame"):G,g?N(o(c)):Q)},H.jsxs=function(c,x,y){var g=1e4>B.recentlyCreatedOwnerStacks++;return m(c,x,y,!0,g?Error("react-stack-top-frame"):G,g?N(o(c)):Q)}}()),H}process.env.NODE_ENV==="production"?se.exports=he():se.exports=be();var s=se.exports;function ie({size:t="m",color:e="default",className:r="",...o}){return s.jsx("span",{className:["ds-spinner",`ds-spinner--${t}`,`ds-spinner--${e}`,r].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...o})}const xe={xs:12,s:14,m:16,l:20};function le({children:t,variant:e="primary",size:r="m",fullWidth:o=!1,icon:n,disabled:a=!1,state:i="idle",onClick:l,type:p="button",href:f,"aria-label":m,...h}){const v=n&&!t,d=i==="loading",_=i==="success",j=i==="error",R=d||_||j,T=r==="xs"?"s":"m",$=xe[r]??16,I=d?s.jsx(ie,{size:T}):_?s.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:s.jsx(E.Check,{size:$,strokeWidth:2.5})}):j?s.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:s.jsx(E.X,{size:$,strokeWidth:2.5})}):null,k=["ds-button",`ds-button--${e}`,`ds-button--${r}`,o&&"ds-button--full",v&&"ds-button--icon-only"].filter(Boolean).join(" "),C=i!=="idle"?i:void 0,L=s.jsxs(s.Fragment,{children:[R?I:n&&s.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:n}),t]});if(f){const b=w=>{if(a||d){w.preventDefault();return}w.metaKey||w.ctrlKey||w.button===1||(w.preventDefault(),l==null||l(w))};return s.jsx("a",{className:k,href:a||d?void 0:f,onClick:b,"aria-label":m,"aria-disabled":a||d?"true":void 0,"aria-busy":d?"true":void 0,"data-state":C,...h,children:L})}return s.jsx("button",{type:p,className:k,disabled:a,onClick:d?void 0:l,"aria-label":m,"aria-busy":d?"true":void 0,"data-state":C,...h,children:L})}function ve({label:t,error:e,hint:r,fullWidth:o=!0,icon:n,iconRight:a,onIconRightClick:i,size:l="m",disabled:p,id:f,...m}){const h=f||`input-${u.useId()}`,v=r?`${h}-hint`:void 0,d=e?`${h}-error`:void 0,_=d||v;return s.jsxs("div",{className:`ds-input-wrapper ${o?"ds-input-wrapper--full":""} ${p?"ds-input-wrapper--disabled":""} ${e?"ds-input-wrapper--error":""}`,children:[t&&s.jsx("label",{className:"ds-input-label",htmlFor:h,children:t}),s.jsxs("div",{className:"ds-input-container",children:[n&&s.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:n}),s.jsx("input",{id:h,className:`ds-input ds-input--${l} ${n?"ds-input--with-icon":""} ${a?"ds-input--with-icon-right":""} ${e?"ds-input--error":""}`,disabled:p,"aria-invalid":e?"true":"false","aria-describedby":_,...m}),a&&s.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:a})]}),r&&!e&&s.jsx("span",{id:v,className:"ds-input-hint",children:r}),s.jsx("div",{className:"ds-input-error-wrap",children:s.jsx("div",{className:"ds-input-error-inner",children:e&&s.jsx("span",{id:d,className:"ds-input-error",role:"alert",children:e})})})]})}function _e({label:t,error:e,hint:r,fullWidth:o=!0,size:n="m",disabled:a,id:i,resize:l=!0,rows:p=3,...f}){const m=i||`textarea-${u.useId()}`,h=r?`${m}-hint`:void 0,v=e?`${m}-error`:void 0,d=v||h;return s.jsxs("div",{className:`ds-textarea-wrapper ${o?"ds-textarea-wrapper--full":""} ${a?"ds-textarea-wrapper--disabled":""}`,children:[t&&s.jsx("label",{className:"ds-textarea-label",htmlFor:m,children:t}),s.jsx("textarea",{id:m,className:`ds-textarea ds-textarea--${n} ${e?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:a,"aria-invalid":e?"true":"false","aria-describedby":d,rows:p,...f}),r&&!e&&s.jsx("span",{id:h,className:"ds-textarea-hint",children:r}),e&&s.jsx("span",{id:v,className:"ds-textarea-error",role:"alert",children:e})]})}function je({label:t,value:e,onChange:r,options:o=[],placeholder:n="Select option",error:a,fullWidth:i=!0,size:l="m",disabled:p=!1,id:f,...m}){const[h,v]=u.useState(!1),[d,_]=u.useState(!1),[j,R]=u.useState({}),[T,$]=u.useState("down"),I=u.useRef(null),k=u.useRef(null),C=u.useRef(null),L=f||`select-${u.useId()}`,b=`${L}-label`,w=a?`${L}-error`:void 0,A=150,M=()=>{d||(_(!0),C.current=setTimeout(()=>{v(!1),_(!1)},A))};u.useEffect(()=>()=>clearTimeout(C.current),[]);const O=()=>{var c;const N=(c=I.current)==null?void 0:c.getBoundingClientRect();if(!N)return;const F=window.innerHeight,Y=F-N.bottom,G=N.top,U=Y<300&&G>Y;$(U?"up":"down"),R(U?{bottom:F-N.top+4,left:N.left,width:N.width}:{top:N.bottom+4,left:N.left,width:N.width})};u.useEffect(()=>{if(h)return O(),window.addEventListener("scroll",O,!0),window.addEventListener("resize",O),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O)}},[h]),u.useEffect(()=>{const N=F=>{I.current&&!I.current.contains(F.target)&&k.current&&!k.current.contains(F.target)&&M()};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]);const B=o.find(N=>N.value===e),X=l==="xs"?P[1]:l==="small"?P[2]:P[3],Z=h&&s.jsx("div",{ref:k,role:"listbox","aria-labelledby":t?b:void 0,className:["ds-select-dropdown",`ds-select-dropdown--${l}`,`ds-select-dropdown--${T}`,d&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:j,children:o.map(N=>s.jsx("button",{type:"button",role:"option","aria-selected":e===N.value,className:`ds-select-option ds-select-option--${l} ${e===N.value?"ds-select-option--selected":""}`,onClick:()=>{r==null||r(N.value),M()},children:N.label},N.value))});return s.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${p?"ds-select-wrapper--disabled":""}`,children:[t&&s.jsx("label",{id:b,className:"ds-select-label",children:t}),s.jsx("div",{className:"ds-select-container",ref:I,children:s.jsxs("button",{type:"button",id:L,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-labelledby":t?b:void 0,"aria-invalid":a?"true":"false","aria-describedby":w,className:`ds-select-trigger ds-select-trigger--${l} ${a?"ds-select-trigger--error":""}`,onClick:()=>{p||(h?M():(clearTimeout(C.current),_(!1),v(!0)))},disabled:p,...m,children:[s.jsx("span",{className:B?"":"ds-select-placeholder",children:(B==null?void 0:B.label)||n}),s.jsx(E.ChevronDown,{size:X,strokeWidth:1.5,className:`ds-select-icon ${h&&T==="down"?"ds-select-icon--open":""} ${h&&T==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),a&&s.jsx("span",{id:w,className:"ds-select-error",role:"alert",children:a}),typeof document<"u"&&K.createPortal(Z,document.body)]})}function we({label:t,value:e=0,onChange:r,min:o=0,max:n=100,step:a=1,size:i="m",disabled:l=!1,hint:p,error:f,...m}){const h=()=>{if(l)return;const T=Math.min(Number(e)+a,n);r==null||r(T)},v=()=>{if(l)return;const T=Math.max(Number(e)-a,o);r==null||r(T)},d=T=>{if(l)return;const $=T.target.value;if($===""){r==null||r(o);return}const I=Number($);if(!isNaN(I)){const k=Math.min(Math.max(I,o),n);r==null||r(k)}},_=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",f&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),j=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),R=i==="xs"?P[1]:i==="small"?P[2]:P[3];return s.jsxs("div",{className:_,children:[t&&s.jsx("label",{className:"ds-stepper-label",children:t}),s.jsxs("div",{className:j,children:[s.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:v,disabled:l||e<=o,"aria-label":"Decrease",children:s.jsx(E.Minus,{size:R,strokeWidth:1.5})}),s.jsx("input",{type:"number",className:"ds-stepper-input",value:e,onChange:d,min:o,max:n,step:a,disabled:l,...m}),s.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:h,disabled:l||e>=n,"aria-label":"Increase",children:s.jsx(E.Plus,{size:R,strokeWidth:1.5})})]}),p&&!f&&s.jsx("div",{className:"ds-stepper-hint",children:p}),f&&s.jsx("div",{className:"ds-stepper-error",children:f})]})}function Ne({children:t,padding:e="m",variant:r="info",hover:o=!1,onClick:n,href:a,disabled:i=!1,...l}){const f=(o?"interactive":r)==="interactive"||n||a,m=["ds-card",`ds-card--${e}`,f&&"ds-card--interactive"].filter(Boolean).join(" ");if(a){const d=_=>{if(i){_.preventDefault();return}_.metaKey||_.ctrlKey||_.button===1||(_.preventDefault(),n==null||n(_))};return s.jsx("a",{className:m,href:i?void 0:a,onClick:d,"aria-disabled":i?"true":void 0,...l,children:t})}const h=f&&n?"button":"div",v=f&&n?{type:"button",onClick:n,disabled:i}:{};return s.jsx(h,{className:m,role:f&&!n?"article":void 0,...v,...l,children:t})}function ye({children:t,...e}){return s.jsx("h1",{className:"ds-h1",...e,children:t})}function Ee({children:t,...e}){return s.jsx("h2",{className:"ds-h2",...e,children:t})}function Re({children:t,...e}){return s.jsx("h3",{className:"ds-h3",...e,children:t})}function Te({children:t,...e}){return s.jsx("h4",{className:"ds-h4",...e,children:t})}function ke({children:t,secondary:e=!1,...r}){return s.jsx("p",{className:`ds-p1 ${e?"ds-p1--secondary":""}`,...r,children:t})}function ge({children:t,secondary:e=!1,...r}){return s.jsx("p",{className:`ds-p2 ${e?"ds-p2--secondary":""}`,...r,children:t})}function Se({children:t,secondary:e=!1,...r}){return s.jsx("p",{className:`ds-p3 ${e?"ds-p3--secondary":""}`,...r,children:t})}function $e({children:t,variant:e="default",size:r="m",role:o,...n}){const a=["ds-badge",`ds-badge--${e}`,`ds-badge--${r}`].filter(Boolean).join(" "),i=o||(["info","success","warning","error"].includes(e)?"status":void 0);return s.jsx("span",{className:a,role:i,...n,children:t})}const Ie={info:E.Info,success:E.CheckCircle,warning:E.AlertTriangle,error:E.XCircle};function Ae({children:t,variant:e="info",title:r,onClose:o,role:n,...a}){const i=Ie[e],l=n||(e==="error"?"alert":"status");return s.jsxs("div",{className:`ds-alert ds-alert--${e} ${r?"":"ds-alert--no-title"}`,role:l,...a,children:[i&&s.jsx("div",{className:"ds-alert__icon",children:s.jsx(i,{size:P[3],strokeWidth:1.5})}),s.jsxs("div",{className:"ds-alert__content",children:[r&&s.jsx("div",{className:"ds-alert__title",children:r}),t&&s.jsx("div",{className:"ds-alert__message",children:t})]}),o&&s.jsx("button",{type:"button",className:"ds-alert__close",onClick:o,"aria-label":"Close alert",children:s.jsx(E.X,{size:P[3],strokeWidth:1.5})})]})}const Pe=200;function Oe({children:t,title:e,onClose:r,size:o="m",...n}){const a=u.useRef(null),i=u.useId(),[l,p]=u.useState(!1),f=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},Pe))};u.useEffect(()=>{const d=j=>{j.key==="Escape"&&f()},_=j=>{a.current&&!a.current.contains(j.target)&&f()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",_)}},[r,l]);const m=u.Children.toArray(t),h=m.find(d=>(d==null?void 0:d.type)===re),v=m.filter(d=>(d==null?void 0:d.type)!==re);return s.jsx("div",{className:["ds-modal-overlay",l&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...n,children:s.jsxs("div",{className:`ds-modal ds-modal--${o}`,ref:a,role:"dialog","aria-modal":"true","aria-labelledby":e?i:void 0,children:[(e||r)&&s.jsxs("div",{className:"ds-modal__header",children:[e&&s.jsx("h3",{id:i,className:"ds-modal__title",children:e}),r&&s.jsx(le,{variant:"ghost",size:"small",icon:s.jsx(E.X,{size:P[2],strokeWidth:1.5}),onClick:f,"aria-label":"Close modal"})]}),s.jsx("div",{className:"ds-modal__body",children:v}),h]})})}function re({children:t}){return s.jsx("div",{className:"ds-modal__footer",children:t})}function de({children:t,title:e="Code",defaultExpanded:r=!1,expanded:o,onToggle:n,padding:a="s",className:i="",...l}){const[p,f]=u.useState(r),m=o!==void 0,h=m?o:p,v=()=>{m?n==null||n(!o):f(_=>!_)},d=["ds-code-accordion",`ds-code-accordion--${a}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return s.jsxs("div",{className:d,...l,children:[s.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:v,"aria-expanded":h,children:[s.jsx("span",{className:"ds-code-accordion__title",children:e}),s.jsx(E.ChevronDown,{size:P[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${h?"ds-code-accordion__icon--expanded":""}`})]}),s.jsx("div",{className:"ds-code-accordion__content",children:s.jsx("div",{className:"ds-code-accordion__inner",children:s.jsx("pre",{className:"ds-code-accordion__pre",children:s.jsx("code",{children:t})})})})]})}function Be({children:t,block:e=!1,collapsible:r=!1,title:o="Code",defaultExpanded:n=!1,...a}){return e?r?s.jsx(de,{title:o,defaultExpanded:n,...a,children:t}):s.jsx("pre",{className:"ds-code-block",...a,children:s.jsx("code",{children:t})}):s.jsx("code",{className:"ds-code-inline",...a,children:t})}function Ce({href:t,children:e,onClick:r,target:o,rel:n,...a}){const l=o==="_blank"?n?`${n} noopener noreferrer`:"noopener noreferrer":n;return s.jsx("a",{href:t,className:"ds-link",onClick:r,target:o,rel:l,...a,children:e})}function Le({children:t,size:e="m",variant:r="ghost",...o}){return s.jsx("div",{className:"ds-tabs",role:"tablist",...o,children:u.Children.map(t,n=>u.isValidElement(n)?u.cloneElement(n,{size:e,variant:r}):n)})}function Me({children:t,selected:e=!1,onClick:r,size:o="m",variant:n="ghost",disabled:a=!1,icon:i,href:l,...p}){const f=i&&!t,m=["ds-tab",`ds-tab--${o}`,`ds-tab--${n}`,e&&"ds-tab--selected",f&&"ds-tab--icon-only"].filter(Boolean).join(" "),h=s.jsxs(s.Fragment,{children:[i&&s.jsx("span",{className:"ds-tab-icon",children:i}),t]});if(l){const v=d=>{if(a){d.preventDefault();return}d.metaKey||d.ctrlKey||d.button===1||(d.preventDefault(),r==null||r(d))};return s.jsx("a",{role:"tab","aria-current":e?"page":void 0,"aria-disabled":a?"true":void 0,className:m,href:a?void 0:l,onClick:v,...p,children:h})}return s.jsx("button",{role:"tab","aria-selected":e,className:m,onClick:r,disabled:a,...p,children:h})}function De({options:t,value:e,onChange:r,size:o="m",disabled:n=!1}){const a=u.useRef(null),i=u.useRef(null),[l,p]=u.useState(!1),f=u.useRef(!1),m=u.useRef(null),h=u.useRef(null),v=()=>{if(!a.current)return;const d=a.current.querySelector(`[data-value="${e}"]`);if(!d)return;const _=a.current.getBoundingClientRect(),j=d.getBoundingClientRect(),R=j.left-_.left,T=j.width;i.current?(i.current.style.transition=f.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=R+"px",i.current.style.width=T+"px",f.current=!1):(p(!0),requestAnimationFrame(()=>{if(!i.current||!a.current)return;const $=a.current.querySelector(`[data-value="${e}"]`);if(!$)return;const I=a.current.getBoundingClientRect(),k=$.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=k.left-I.left+"px",i.current.style.width=k.width+"px"}))};return h.current=v,u.useLayoutEffect(()=>{const d=m.current!==e;m.current=e,f.current=l&&d,v()}),u.useEffect(()=>{if(!a.current)return;const d=new ResizeObserver(()=>{f.current=!1,h.current()});return d.observe(a.current),()=>d.disconnect()},[]),s.jsxs("div",{className:["ds-seg",`ds-seg--${o}`,n&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:a,role:"group",children:[l&&s.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),t.map(d=>s.jsxs("button",{type:"button","data-value":d.value,className:["ds-seg__btn",e===d.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!n&&r(d.value),"aria-pressed":e===d.value,disabled:n,children:[d.icon&&s.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:d.icon}),d.label]},d.value))]})}function Fe({children:t,title:e,defaultExpanded:r=!1,expanded:o,onToggle:n,padding:a="m",...i}){const[l,p]=u.useState(r),f=o!==void 0,m=f?o:l,h=()=>{f?n==null||n(!o):p(d=>!d)},v=["ds-accordion",`ds-accordion--${a}`,m&&"ds-accordion--expanded"].filter(Boolean).join(" ");return s.jsxs("div",{className:v,...i,children:[s.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:h,"aria-expanded":m,children:[s.jsx("span",{className:"ds-accordion__title",children:e}),s.jsx(E.ChevronDown,{size:P[2],strokeWidth:1.5,className:`ds-accordion__icon ${m?"ds-accordion__icon--expanded":""}`})]}),s.jsx("div",{className:"ds-accordion__content",children:s.jsx("div",{className:"ds-accordion__content-inner",children:s.jsx("div",{className:"ds-accordion__content-body",children:t})})})]})}const D=8,W=8;function Ve(t,e,r){const o=window.innerWidth;let n,a;switch(t){case"top":n=e.top-r.height-D,a=e.left+e.width/2-r.width/2;break;case"bottom":n=e.bottom+D,a=e.left+e.width/2-r.width/2;break;case"left":n=e.top+e.height/2-r.height/2,a=e.left-r.width-D;break;case"right":n=e.top+e.height/2-r.height/2,a=e.right+D;break;default:n=e.bottom+D,a=e.left}const i=Math.max(W,Math.min(o-r.width-W,a)),l=a-i;return{top:n,left:i,arrowOffset:l}}function We(t,e,r){const o=window.innerWidth,n=window.innerHeight;if(t.top>=e+D+W)return"top";if(n-t.bottom>=e+D+W)return"bottom";if(o-t.right>=r+D+W)return"right";if(t.left>=r+D+W)return"left";const a=Math.max(t.top,n-t.bottom,t.left,o-t.right);return a===t.top?"top":a===n-t.bottom?"bottom":a===o-t.right?"right":"left"}function ze({children:t,content:e,position:r,...o}){const[n,a]=u.useState(!1),[i,l]=u.useState({visibility:"hidden"}),[p,f]=u.useState(r||"top"),m=u.useRef(null),h=u.useRef(null),v=u.useRef(!1),d=()=>{if(!m.current||!h.current)return;const j=m.current.getBoundingClientRect(),R=h.current.getBoundingClientRect(),T=r||We(j,R.height,R.width),{top:$,left:I,arrowOffset:k}=Ve(T,j,R);f(T),l({position:"fixed",top:$,left:I,visibility:"visible","--arrow-offset":`${k}px`})};if(u.useEffect(()=>{if(!n)return;l({position:"fixed",visibility:"hidden"});const j=requestAnimationFrame(d);return window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{cancelAnimationFrame(j),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[n,r]),u.useEffect(()=>{if(!n)return;const j=R=>{m.current&&!m.current.contains(R.target)&&a(!1)};return document.addEventListener("touchstart",j),()=>document.removeEventListener("touchstart",j)},[n]),!e)return t;const _=n&&s.jsx("div",{ref:h,className:`ds-tooltip ds-tooltip--${p}`,role:"tooltip",style:i,children:e});return s.jsxs("div",{ref:m,className:"ds-tooltip-wrapper",onMouseEnter:()=>{v.current||a(!0)},onMouseLeave:()=>{v.current||a(!1)},onTouchStart:()=>{v.current=!0,a(j=>!j)},...o,children:[t,typeof document<"u"&&K.createPortal(_,document.body)]})}function Ye({checked:t=!1,onChange:e,size:r="m",disabled:o=!1,label:n,id:a,...i}){const l=a||`toggle-${u.useId()}`,p=["ds-toggle",`ds-toggle--${r}`,o&&"ds-toggle--disabled"].filter(Boolean).join(" ");return s.jsxs("label",{className:p,htmlFor:l,children:[s.jsx("input",{type:"checkbox",id:l,className:"ds-toggle__input",checked:t,onChange:f=>e==null?void 0:e(f.target.checked),disabled:o,...i}),s.jsx("span",{className:"ds-toggle__track",children:s.jsx("span",{className:"ds-toggle__thumb"})}),n&&s.jsx("span",{className:"ds-toggle__label",children:n})]})}function Ue({checked:t=!1,onChange:e,size:r="m",disabled:o=!1,label:n,id:a,...i}){const l=a||`checkbox-${u.useId()}`,p=["ds-checkbox",`ds-checkbox--${r}`,o&&"ds-checkbox--disabled"].filter(Boolean).join(" "),f=r==="xs"?10:r==="small"?14:r==="large"?20:16;return s.jsxs("label",{className:p,htmlFor:l,children:[s.jsx("input",{type:"checkbox",id:l,className:"ds-checkbox__input",checked:t,onChange:m=>e==null?void 0:e(m.target.checked),disabled:o,...i}),s.jsx("span",{className:"ds-checkbox__box",children:t&&s.jsx(E.Check,{size:f,strokeWidth:2.5,className:"ds-checkbox__icon"})}),n&&s.jsx("span",{className:"ds-checkbox__label",children:n})]})}function qe({checked:t=!1,onChange:e,size:r="m",disabled:o=!1,label:n,name:a,value:i,id:l,...p}){const f=l||`radio-${u.useId()}`,m=["ds-radio",`ds-radio--${r}`,o&&"ds-radio--disabled"].filter(Boolean).join(" ");return s.jsxs("label",{className:m,htmlFor:f,children:[s.jsx("input",{type:"radio",id:f,className:"ds-radio__input",checked:t,onChange:h=>e==null?void 0:e(h.target.checked),disabled:o,name:a,value:i,...p}),s.jsx("span",{className:"ds-radio__circle",children:s.jsx("span",{className:"ds-radio__dot"})}),n&&s.jsx("span",{className:"ds-radio__label",children:n})]})}function He({width:t,height:e,shape:r="rect",className:o="",style:n={},...a}){return s.jsx("span",{className:["ds-skeleton",`ds-skeleton--${r}`,o].filter(Boolean).join(" "),style:{width:t,height:e,...n},"aria-hidden":"true",...a})}function Xe(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e%360}function Ge(t){if(!t)return"";const e=t.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[1][0]).toUpperCase():t[0].toUpperCase()}function Je({seed:t,icon:e,src:r,size:o=32,className:n="",style:a={},...i}){const l=Xe(t??""),[p,f]=u.useState(!1),m=e??s.jsx("span",{className:"ds-avatar__initials",children:Ge(t)});return s.jsx("div",{className:["ds-avatar",n].filter(Boolean).join(" "),style:{width:o,height:o,"--ds-avatar-h":l,...a},"aria-hidden":"true",...i,children:r&&!p?s.jsx("img",{src:r,alt:"",onError:()=>f(!0)}):m})}function Ke({children:t,size:e="compact",stickyTop:r,maxHeight:o,className:n="",style:a={},...i}){const l={...o?{maxHeight:o}:{},...r!==void 0?{"--ds-table-sticky-top":typeof r=="number"?`${r}px`:r}:{},...a};return s.jsx("div",{className:["ds-table-wrap",o?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:s.jsx("table",{className:["ds-table",`ds-table--${e}`,n].filter(Boolean).join(" "),...i,children:t})})}function Ze({children:t,...e}){return s.jsx("thead",{...e,children:t})}function Qe({children:t,...e}){return s.jsx("tbody",{...e,children:t})}function et({children:t,interactive:e,selected:r,subheader:o,className:n="",onClick:a,...i}){return s.jsx("tr",{className:["ds-table-row",e||a?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",o?"ds-table-row--subheader":"",n].filter(Boolean).join(" "),onClick:a,...i,children:t})}function tt({children:t,colSpan:e=999,...r}){return s.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...r,children:s.jsx("td",{colSpan:e,children:t})})}function st({children:t,align:e="left",sortDir:r,onSort:o,width:n,className:a="",style:i={},...l}){const p=!!o||r!==void 0,f=r==="asc"?E.ChevronUp:r==="desc"?E.ChevronDown:E.ChevronsUpDown;return s.jsx("th",{className:["ds-th",p?"ds-th--sortable":"",r?"ds-th--sorted":"",e!=="left"?`ds-table-cell--${e}`:"",a].filter(Boolean).join(" "),onClick:o,style:{width:n,...i},...l,children:p?s.jsxs("span",{className:"ds-th__inner",children:[t,s.jsx("span",{className:"ds-th__sort-icon",children:s.jsx(f,{size:11,strokeWidth:2.5})})]}):t})}function rt({children:t,align:e="left",secondary:r,muted:o,truncate:n,nowrap:a,className:i="",...l}){return s.jsx("td",{className:["ds-td",e!=="left"?`ds-table-cell--${e}`:"",r?"ds-table-cell--secondary":"",o?"ds-table-cell--muted":"",n?"ds-table-cell--truncate":"",a?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:t})}function nt({icon:t,title:e,description:r,action:o,size:n="m",className:a="",...i}){return s.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${n}`,a].filter(Boolean).join(" "),...i,children:[t&&s.jsx("div",{className:"ds-empty-state__icon",children:t}),s.jsx("div",{className:"ds-empty-state__title",children:e}),r&&s.jsx("div",{className:"ds-empty-state__description",children:r}),o&&s.jsx("div",{className:"ds-empty-state__action",children:o})]})}function at({trigger:t,items:e=[],open:r,onOpenChange:o,align:n="left",className:a="",style:i,...l}){const[p,f]=u.useState(!1),[m,h]=u.useState(!1),v=r!==void 0,d=v?r:p,_=u.useRef(null),j=u.useRef(null),[R,T]=u.useState({}),$=u.useRef(null),I=150,k=()=>{if(v)o==null||o(!1);else{if(m)return;h(!0),$.current=setTimeout(()=>{f(!1),h(!1)},I)}},C=()=>{const b=!d;v?o==null||o(b):b?(clearTimeout($.current),h(!1),f(!0)):k()};u.useEffect(()=>()=>clearTimeout($.current),[]),u.useEffect(()=>{if(!d)return;const b=()=>{var A;const w=(A=_.current)==null?void 0:A.getBoundingClientRect();w&&T(n==="right"?{top:w.bottom+4,right:window.innerWidth-w.right}:{top:w.bottom+4,left:w.left})};return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[d,n]),u.useEffect(()=>{if(!d)return;const b=A=>{var M,O;!((M=_.current)!=null&&M.contains(A.target))&&!((O=j.current)!=null&&O.contains(A.target))&&k()},w=A=>{A.key==="Escape"&&k()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[d]);const L=d&&s.jsx("div",{ref:j,className:["ds-dropdown__menu",`ds-dropdown__menu--${n}`,m&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:R,children:e.map((b,w)=>{if(b.separator)return s.jsx("div",{className:"ds-dropdown__separator"},w);if(b.type==="section")return s.jsxs("div",{className:"ds-dropdown__section",children:[b.label&&s.jsx("div",{className:"ds-dropdown__section-label",children:b.label}),s.jsx("div",{className:"ds-dropdown__section-content",children:b.content})]},w);const A=!!b.href,M=A?"a":"button",O=A?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return s.jsxs(M,{className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...O,onClick:()=>{var B;(B=b.onClick)==null||B.call(b),k()},children:[b.icon&&s.jsx("span",{className:"ds-dropdown__item-icon",children:b.icon}),s.jsx("span",{className:"ds-dropdown__item-label",children:b.label}),b.shortcut&&s.jsx("span",{className:"ds-dropdown__item-shortcut",children:b.shortcut})]},w)})});return s.jsxs("div",{ref:_,className:["ds-dropdown",a].filter(Boolean).join(" "),style:i,...l,children:[s.jsx("div",{className:"ds-dropdown__trigger",onClick:C,children:t}),typeof document<"u"&&K.createPortal(L,document.body)]})}function ot({value:t=0,size:e="m",variant:r="default",showValue:o=!1,min:n=2,animate:a=!0}){const i=Math.min(100,Math.max(0,t)),l=Math.max(n,i),p=r==="auto"?i>=70?"success":i>=50?"warning":"danger":r;return s.jsxs("div",{className:["ds-progress",`ds-progress--${e}`,!a&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:[s.jsx("div",{className:"ds-progress__track",children:s.jsx("div",{className:`ds-progress__fill ds-progress__fill--${p}`,style:{width:`${l}%`}})}),o&&s.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const ct=t=>1-Math.pow(1-t,3),it=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function ue(t,{duration:e=600}={}){const[r,o]=u.useState(t),n=u.useRef(t),a=u.useRef(null);return u.useEffect(()=>{if(it()){o(t),n.current=t;return}const i=n.current,l=t-i;if(l===0)return;let p=null;const f=m=>{p||(p=m);const h=Math.min((m-p)/e,1);o(i+l*ct(h)),h<1?a.current=requestAnimationFrame(f):n.current=t};return a.current=requestAnimationFrame(f),()=>cancelAnimationFrame(a.current)},[t,e]),r}function lt({value:t,duration:e=600,decimals:r=0,prefix:o="",suffix:n=""}){const i=ue(t,{duration:e}).toFixed(r);return`${o}${i}${n}`}function fe({threshold:t=.1,rootMargin:e="0px",once:r=!1}={}){const o=u.useRef(null),[n,a]=u.useState(!1);return u.useEffect(()=>{const i=o.current;if(!i)return;const l=new IntersectionObserver(([p])=>{p.isIntersecting?(a(!0),r&&l.disconnect()):r||a(!1)},{threshold:t,rootMargin:e});return l.observe(i),()=>l.disconnect()},[t,e,r]),{ref:o,inView:n}}function dt({children:t,as:e="div",once:r=!1,threshold:o=.1,rootMargin:n="0px",onEnter:a,onLeave:i,...l}){const{ref:p,inView:f}=fe({threshold:o,rootMargin:n,once:r}),m=u.useRef(!1);return u.useEffect(()=>{f&&!m.current&&(a==null||a()),!f&&m.current&&(i==null||i()),m.current=f},[f]),s.jsx(e,{ref:p,...l,children:typeof t=="function"?t(f):t})}const ce={default:E.Info,success:E.CheckCircle,warning:E.AlertTriangle,error:E.XCircle};let z=[];const ne=new Set;function me(){ne.forEach(t=>t([...z]))}function ut(t){z=[...z,t],me()}function ft(t){z=z.filter(e=>e.id!==t),me()}function mt(){const t=(e,r={})=>{ut({id:`${Date.now()}-${Math.random()}`,message:e,type:"default",duration:4e3,...r})};return t.success=(e,r)=>t(e,{...r,type:"success"}),t.error=(e,r)=>t(e,{...r,type:"error"}),t.warning=(e,r)=>t(e,{...r,type:"warning"}),{toast:t}}function pt({data:t,onDismiss:e}){const[r,o]=u.useState(!1),n=u.useRef(null);u.useEffect(()=>(requestAnimationFrame(()=>o(!0)),t.duration>0&&(n.current=setTimeout(()=>a(),t.duration)),()=>clearTimeout(n.current)),[]);function a(){o(!1),setTimeout(()=>e(t.id),250)}const i=ce[t.type]??ce.default;return s.jsxs("div",{className:["ds-toast",`ds-toast--${t.type}`,r&&"ds-toast--visible"].filter(Boolean).join(" "),role:t.type==="error"?"alert":"status","aria-live":"polite",children:[s.jsx("div",{className:"ds-toast__icon",children:s.jsx(i,{size:P[3],strokeWidth:1.5})}),s.jsx("span",{className:"ds-toast__message",children:t.message}),s.jsx("button",{className:"ds-toast__close",onClick:a,"aria-label":"Закрыть",children:s.jsx(E.X,{size:P[3],strokeWidth:1.5})})]})}function ht({position:t="bottom-right"}){const[e,r]=u.useState(()=>[...z]);return u.useEffect(()=>(ne.add(r),()=>ne.delete(r)),[]),!e.length||typeof document>"u"?null:K.createPortal(s.jsx("div",{className:["ds-toast-container",`ds-toast-container--${t}`].join(" "),children:e.map(o=>s.jsx(pt,{data:o,onDismiss:ft},o.id))}),document.body)}exports.Accordion=Fe;exports.Alert=Ae;exports.AnimatedNumber=lt;exports.Avatar=Je;exports.Badge=$e;exports.Button=le;exports.Card=Ne;exports.Checkbox=Ue;exports.Code=Be;exports.CodeAccordion=de;exports.Dropdown=at;exports.EmptyState=nt;exports.H1=ye;exports.H2=Ee;exports.H3=Re;exports.H4=Te;exports.InView=dt;exports.Input=ve;exports.Link=Ce;exports.Modal=Oe;exports.ModalFooter=re;exports.P1=ke;exports.P2=ge;exports.P3=Se;exports.ProgressBar=ot;exports.Radio=qe;exports.SegmentedControl=De;exports.Select=je;exports.Skeleton=He;exports.Spinner=ie;exports.Stepper=we;exports.Tab=Me;exports.Table=Ke;exports.TableBody=Qe;exports.TableHead=Ze;exports.TableRow=et;exports.TableSubheaderRow=tt;exports.Tabs=Le;exports.Td=rt;exports.Textarea=_e;exports.Th=st;exports.ToastContainer=ht;exports.Toggle=Ye;exports.Tooltip=ze;exports.iconSizes=P;exports.useAnimatedNumber=ue;exports.useInView=fe;exports.useToast=mt;
|
|
22
|
+
<%s key={someKey} {...props} />`,$,I,K,I),j[I+$]=!0)}if(I=null,E!==void 0&&(r(E),I=""+E),l(x)&&(r(x.key),I=""+x.key),"key"in x){E={};for(var te in x)te!=="key"&&(E[te]=x[te])}else E=x;return I&&i(E,typeof o=="function"?o.displayName||o.name||"Unknown":o),m(o,I,E,n(),q,X)}function f(o){_(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===M&&(o._payload.status==="fulfilled"?_(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function _(o){return typeof o=="object"&&o!==null&&o.$$typeof===w}var d=u,w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),R=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),Y=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,b=Array.isArray,v=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(o){return o()}};var k,A={},L=d.react_stack_bottom_frame.bind(d,a)(),W=v(c(a)),j={};Q.Fragment=T,Q.jsx=function(o,x,E){var $=1e4>Y.recentlyCreatedOwnerStacks++;return p(o,x,E,!1,$?Error("react-stack-top-frame"):L,$?v(c(o)):W)},Q.jsxs=function(o,x,E){var $=1e4>Y.recentlyCreatedOwnerStacks++;return p(o,x,E,!0,$?Error("react-stack-top-frame"):L,$?v(c(o)):W)}}()),Q}process.env.NODE_ENV==="production"?se.exports=be():se.exports=he();var s=se.exports;function le({size:t="m",color:e="default",className:r="",...c}){return s.jsx("span",{className:["ds-spinner",`ds-spinner--${t}`,`ds-spinner--${e}`,r].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...c})}const xe={xs:12,s:14,m:16,l:20};function ie({children:t,variant:e="primary",size:r="m",fullWidth:c=!1,icon:n,disabled:a=!1,state:l="idle",onClick:i,type:h="button",href:m,"aria-label":p,...f}){const _=n&&!t,d=l==="loading",w=l==="success",N=l==="error",T=d||w||N,y=r==="xs"?"s":"m",P=xe[r]??16,S=d?s.jsx(le,{size:y}):w?s.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:s.jsx(g.Check,{size:P,strokeWidth:2.5})}):N?s.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:s.jsx(g.X,{size:P,strokeWidth:2.5})}):null,R=["ds-button",`ds-button--${e}`,`ds-button--${r}`,c&&"ds-button--full",_&&"ds-button--icon-only"].filter(Boolean).join(" "),C=l!=="idle"?l:void 0,D=s.jsxs(s.Fragment,{children:[T?S:n&&s.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:n}),t]});if(m){const U=O=>{if(a||d){O.preventDefault();return}O.metaKey||O.ctrlKey||O.button===1||(O.preventDefault(),i==null||i(O))};return s.jsx("a",{className:R,href:a||d?void 0:m,onClick:U,"aria-label":p,"aria-disabled":a||d?"true":void 0,"aria-busy":d?"true":void 0,"data-state":C,...f,children:D})}return s.jsx("button",{type:h,className:R,disabled:a,onClick:d?void 0:i,"aria-label":p,"aria-busy":d?"true":void 0,"data-state":C,...f,children:D})}function ve({label:t,error:e,hint:r,fullWidth:c=!0,icon:n,iconRight:a,onIconRightClick:l,size:i="m",disabled:h,id:m,...p}){const f=m||`input-${u.useId()}`,_=r?`${f}-hint`:void 0,d=e?`${f}-error`:void 0,w=d||_;return s.jsxs("div",{className:`ds-input-wrapper ${c?"ds-input-wrapper--full":""} ${h?"ds-input-wrapper--disabled":""} ${e?"ds-input-wrapper--error":""}`,children:[t&&s.jsx("label",{className:"ds-input-label",htmlFor:f,children:t}),s.jsxs("div",{className:"ds-input-container",children:[n&&s.jsx("span",{className:`ds-input-icon ds-input-icon--${i}`,"aria-hidden":"true",children:n}),s.jsx("input",{id:f,className:`ds-input ds-input--${i} ${n?"ds-input--with-icon":""} ${a?"ds-input--with-icon-right":""} ${e?"ds-input--error":""}`,disabled:h,"aria-invalid":e?"true":"false","aria-describedby":w,...p}),a&&s.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${i}`,onClick:l,tabIndex:-1,"aria-label":"Toggle visibility",children:a})]}),r&&!e&&s.jsx("span",{id:_,className:"ds-input-hint",children:r}),s.jsx("div",{className:"ds-input-error-wrap",children:s.jsx("div",{className:"ds-input-error-inner",children:e&&s.jsx("span",{id:d,className:"ds-input-error",role:"alert",children:e})})})]})}function je({label:t,error:e,hint:r,fullWidth:c=!0,size:n="m",disabled:a,id:l,resize:i=!0,rows:h=3,...m}){const p=l||`textarea-${u.useId()}`,f=r?`${p}-hint`:void 0,_=e?`${p}-error`:void 0,d=_||f;return s.jsxs("div",{className:`ds-textarea-wrapper ${c?"ds-textarea-wrapper--full":""} ${a?"ds-textarea-wrapper--disabled":""}`,children:[t&&s.jsx("label",{className:"ds-textarea-label",htmlFor:p,children:t}),s.jsx("textarea",{id:p,className:`ds-textarea ds-textarea--${n} ${e?"ds-textarea--error":""} ${i?"":"ds-textarea--no-resize"}`,disabled:a,"aria-invalid":e?"true":"false","aria-describedby":d,rows:h,...m}),r&&!e&&s.jsx("span",{id:f,className:"ds-textarea-hint",children:r}),e&&s.jsx("span",{id:_,className:"ds-textarea-error",role:"alert",children:e})]})}function _e({label:t,value:e,onChange:r,options:c=[],placeholder:n="Select option",error:a,fullWidth:l=!0,size:i="m",disabled:h=!1,id:m,...p}){const[f,_]=u.useState(!1),[d,w]=u.useState(!1),[N,T]=u.useState({}),[y,P]=u.useState("down"),[S,R]=u.useState(-1),C=u.useRef(null),D=u.useRef(null),U=u.useRef(null),O=u.useRef(null),M=m||`select-${u.useId()}`,V=`${M}-label`,H=a?`${M}-error`:void 0,Y=150,F=(j=!1)=>{d||(w(!0),R(-1),O.current=setTimeout(()=>{var o;_(!1),w(!1),j&&((o=U.current)==null||o.focus())},Y))},b=j=>{clearTimeout(O.current),w(!1);const o=j!==void 0?j:Math.max(c.findIndex(x=>x.value===e),0);R(o),_(!0)};u.useEffect(()=>()=>clearTimeout(O.current),[]);const v=()=>{var X;const j=(X=C.current)==null?void 0:X.getBoundingClientRect();if(!j)return;const o=window.innerHeight,x=o-j.bottom,E=j.top,q=x<300&&E>x;P(q?"up":"down"),T(q?{bottom:o-j.top+4,left:j.left,width:j.width}:{top:j.bottom+4,left:j.left,width:j.width})};u.useEffect(()=>{if(f)return v(),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[f]),u.useEffect(()=>{const j=o=>{C.current&&!C.current.contains(o.target)&&D.current&&!D.current.contains(o.target)&&F()};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[d]),u.useEffect(()=>{var o;if(!f||S<0||!D.current)return;(o=D.current.querySelectorAll(".ds-select-option")[S])==null||o.scrollIntoView({block:"nearest"})},[S,f]);const k=j=>{switch(j.key){case"ArrowDown":j.preventDefault(),f?R(o=>Math.min(o+1,c.length-1)):b();break;case"ArrowUp":j.preventDefault(),f?R(o=>Math.max(o-1,0)):b(c.length-1);break;case"Home":f&&(j.preventDefault(),R(0));break;case"End":f&&(j.preventDefault(),R(c.length-1));break;case"Enter":case" ":j.preventDefault(),f?S>=0&&(r==null||r(c[S].value),F(!0)):b();break;case"Escape":f&&(j.preventDefault(),F(!0));break;case"Tab":f&&F(!1);break}},A=c.find(j=>j.value===e),L=i==="xs"?B[1]:i==="small"?B[2]:B[3],W=f&&s.jsx("div",{ref:D,role:"listbox","aria-labelledby":t?V:void 0,tabIndex:-1,className:["ds-select-dropdown",`ds-select-dropdown--${i}`,`ds-select-dropdown--${y}`,d&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:N,children:c.map((j,o)=>s.jsx("button",{id:`${M}-opt-${o}`,type:"button",role:"option",tabIndex:-1,"aria-selected":e===j.value,className:["ds-select-option",`ds-select-option--${i}`,e===j.value&&"ds-select-option--selected",o===S&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{r==null||r(j.value),F(!0)},children:j.label},j.value))});return s.jsxs("div",{className:`ds-select-wrapper ${l?"ds-select-wrapper--full":""} ${h?"ds-select-wrapper--disabled":""}`,children:[t&&s.jsx("label",{id:V,className:"ds-select-label",children:t}),s.jsx("div",{className:"ds-select-container",ref:C,children:s.jsxs("button",{ref:U,type:"button",id:M,role:"combobox","aria-haspopup":"listbox","aria-expanded":f,"aria-activedescendant":f&&S>=0?`${M}-opt-${S}`:void 0,"aria-labelledby":t?V:void 0,"aria-invalid":a?"true":"false","aria-describedby":H,className:`ds-select-trigger ds-select-trigger--${i} ${a?"ds-select-trigger--error":""}`,onClick:()=>{h||(f?F():b())},onKeyDown:k,disabled:h,...p,children:[s.jsx("span",{className:A?"":"ds-select-placeholder",children:(A==null?void 0:A.label)||n}),s.jsx(g.ChevronDown,{size:L,strokeWidth:1.5,className:`ds-select-icon ${f&&y==="down"?"ds-select-icon--open":""} ${f&&y==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),a&&s.jsx("span",{id:H,className:"ds-select-error",role:"alert",children:a}),typeof document<"u"&&ee.createPortal(W,document.body)]})}function we({label:t,value:e=0,onChange:r,min:c=0,max:n=100,step:a=1,size:l="m",disabled:i=!1,hint:h,error:m,...p}){const f=()=>{if(i)return;const y=Math.min(Number(e)+a,n);r==null||r(y)},_=()=>{if(i)return;const y=Math.max(Number(e)-a,c);r==null||r(y)},d=y=>{if(i)return;const P=y.target.value;if(P===""){r==null||r(c);return}const S=Number(P);if(!isNaN(S)){const R=Math.min(Math.max(S,c),n);r==null||r(R)}},w=["ds-stepper-wrapper",i&&"ds-stepper-wrapper--disabled",m&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),N=["ds-stepper",`ds-stepper--${l}`,i&&"ds-stepper--disabled"].filter(Boolean).join(" "),T=l==="xs"?B[1]:l==="small"?B[2]:B[3];return s.jsxs("div",{className:w,children:[t&&s.jsx("label",{className:"ds-stepper-label",children:t}),s.jsxs("div",{className:N,children:[s.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:_,disabled:i||e<=c,"aria-label":"Decrease",children:s.jsx(g.Minus,{size:T,strokeWidth:1.5})}),s.jsx("input",{type:"number",className:"ds-stepper-input",value:e,onChange:d,min:c,max:n,step:a,disabled:i,...p}),s.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:f,disabled:i||e>=n,"aria-label":"Increase",children:s.jsx(g.Plus,{size:T,strokeWidth:1.5})})]}),h&&!m&&s.jsx("div",{className:"ds-stepper-hint",children:h}),m&&s.jsx("div",{className:"ds-stepper-error",children:m})]})}function Ne({children:t,padding:e="m",variant:r="info",hover:c=!1,onClick:n,href:a,disabled:l=!1,...i}){const m=(c?"interactive":r)==="interactive"||n||a,p=["ds-card",`ds-card--${e}`,m&&"ds-card--interactive"].filter(Boolean).join(" ");if(a){const d=w=>{if(l){w.preventDefault();return}w.metaKey||w.ctrlKey||w.button===1||(w.preventDefault(),n==null||n(w))};return s.jsx("a",{className:p,href:l?void 0:a,onClick:d,"aria-disabled":l?"true":void 0,...i,children:t})}const f=m&&n?"button":"div",_=m&&n?{type:"button",onClick:n,disabled:l}:{};return s.jsx(f,{className:p,role:m&&!n?"article":void 0,..._,...i,children:t})}function ye({children:t,...e}){return s.jsx("h1",{className:"ds-h1",...e,children:t})}function Ee({children:t,...e}){return s.jsx("h2",{className:"ds-h2",...e,children:t})}function Re({children:t,...e}){return s.jsx("h3",{className:"ds-h3",...e,children:t})}function ke({children:t,...e}){return s.jsx("h4",{className:"ds-h4",...e,children:t})}function ge({children:t,secondary:e=!1,...r}){return s.jsx("p",{className:`ds-p1 ${e?"ds-p1--secondary":""}`,...r,children:t})}function Te({children:t,secondary:e=!1,...r}){return s.jsx("p",{className:`ds-p2 ${e?"ds-p2--secondary":""}`,...r,children:t})}function Se({children:t,secondary:e=!1,...r}){return s.jsx("p",{className:`ds-p3 ${e?"ds-p3--secondary":""}`,...r,children:t})}function $e({children:t,variant:e="default",size:r="m",role:c,...n}){const a=["ds-badge",`ds-badge--${e}`,`ds-badge--${r}`].filter(Boolean).join(" "),l=c||(["info","success","warning","error"].includes(e)?"status":void 0);return s.jsx("span",{className:a,role:l,...n,children:t})}const Ie={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function Ae({children:t,variant:e="info",title:r,onClose:c,role:n,...a}){const l=Ie[e],i=n||(e==="error"?"alert":"status");return s.jsxs("div",{className:`ds-alert ds-alert--${e} ${r?"":"ds-alert--no-title"}`,role:i,...a,children:[l&&s.jsx("div",{className:"ds-alert__icon",children:s.jsx(l,{size:B[3],strokeWidth:1.5})}),s.jsxs("div",{className:"ds-alert__content",children:[r&&s.jsx("div",{className:"ds-alert__title",children:r}),t&&s.jsx("div",{className:"ds-alert__message",children:t})]}),c&&s.jsx("button",{type:"button",className:"ds-alert__close",onClick:c,"aria-label":"Close alert",children:s.jsx(g.X,{size:B[3],strokeWidth:1.5})})]})}const Pe=200;function De({children:t,title:e,onClose:r,size:c="m",...n}){const a=u.useRef(null),l=u.useId(),[i,h]=u.useState(!1),m=()=>{!r||i||(h(!0),setTimeout(()=>{h(!1),r()},Pe))};u.useEffect(()=>{const d=N=>{N.key==="Escape"&&m()},w=N=>{a.current&&!a.current.contains(N.target)&&m()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",w),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",w)}},[r,i]);const p=u.Children.toArray(t),f=p.find(d=>(d==null?void 0:d.type)===re),_=p.filter(d=>(d==null?void 0:d.type)!==re);return s.jsx("div",{className:["ds-modal-overlay",i&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...n,children:s.jsxs("div",{className:`ds-modal ds-modal--${c}`,ref:a,role:"dialog","aria-modal":"true","aria-labelledby":e?l:void 0,children:[(e||r)&&s.jsxs("div",{className:"ds-modal__header",children:[e&&s.jsx("h3",{id:l,className:"ds-modal__title",children:e}),r&&s.jsx(ie,{variant:"ghost",size:"small",icon:s.jsx(g.X,{size:B[2],strokeWidth:1.5}),onClick:m,"aria-label":"Close modal"})]}),s.jsx("div",{className:"ds-modal__body",children:_}),f]})})}function re({children:t}){return s.jsx("div",{className:"ds-modal__footer",children:t})}function de({children:t,title:e="Code",defaultExpanded:r=!1,expanded:c,onToggle:n,padding:a="s",className:l="",...i}){const[h,m]=u.useState(r),p=c!==void 0,f=p?c:h,_=()=>{p?n==null||n(!c):m(w=>!w)},d=["ds-code-accordion",`ds-code-accordion--${a}`,f&&"ds-code-accordion--expanded",l].filter(Boolean).join(" ");return s.jsxs("div",{className:d,...i,children:[s.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:_,"aria-expanded":f,children:[s.jsx("span",{className:"ds-code-accordion__title",children:e}),s.jsx(g.ChevronDown,{size:B[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${f?"ds-code-accordion__icon--expanded":""}`})]}),s.jsx("div",{className:"ds-code-accordion__content",children:s.jsx("div",{className:"ds-code-accordion__inner",children:s.jsx("pre",{className:"ds-code-accordion__pre",children:s.jsx("code",{children:t})})})})]})}function Oe({children:t,block:e=!1,collapsible:r=!1,title:c="Code",defaultExpanded:n=!1,...a}){return e?r?s.jsx(de,{title:c,defaultExpanded:n,...a,children:t}):s.jsx("pre",{className:"ds-code-block",...a,children:s.jsx("code",{children:t})}):s.jsx("code",{className:"ds-code-inline",...a,children:t})}function Be({href:t,children:e,onClick:r,target:c,rel:n,...a}){const i=c==="_blank"?n?`${n} noopener noreferrer`:"noopener noreferrer":n;return s.jsx("a",{href:t,className:"ds-link",onClick:r,target:c,rel:i,...a,children:e})}function Me({children:t,size:e="m",variant:r="ghost",...c}){return s.jsx("div",{className:"ds-tabs",role:"tablist",...c,children:u.Children.map(t,n=>u.isValidElement(n)?u.cloneElement(n,{size:e,variant:r}):n)})}function Le({children:t,selected:e=!1,onClick:r,size:c="m",variant:n="ghost",disabled:a=!1,icon:l,href:i,...h}){const m=l&&!t,p=["ds-tab",`ds-tab--${c}`,`ds-tab--${n}`,e&&"ds-tab--selected",m&&"ds-tab--icon-only"].filter(Boolean).join(" "),f=s.jsxs(s.Fragment,{children:[l&&s.jsx("span",{className:"ds-tab-icon",children:l}),t]});if(i){const _=d=>{if(a){d.preventDefault();return}d.metaKey||d.ctrlKey||d.button===1||(d.preventDefault(),r==null||r(d))};return s.jsx("a",{role:"tab","aria-current":e?"page":void 0,"aria-disabled":a?"true":void 0,className:p,href:a?void 0:i,onClick:_,...h,children:f})}return s.jsx("button",{role:"tab","aria-selected":e,className:p,onClick:r,disabled:a,...h,children:f})}function Ce({options:t,value:e,onChange:r,size:c="m",disabled:n=!1}){const a=u.useRef(null),l=u.useRef(null),[i,h]=u.useState(!1),m=u.useRef(!1),p=u.useRef(null),f=u.useRef(null),_=()=>{if(!a.current)return;const d=a.current.querySelector(`[data-value="${e}"]`);if(!d)return;const w=a.current.getBoundingClientRect(),N=d.getBoundingClientRect(),T=N.left-w.left,y=N.width;l.current?(l.current.style.transition=m.current?"left var(--transition-normal), width var(--transition-normal)":"none",l.current.style.left=T+"px",l.current.style.width=y+"px",m.current=!1):(h(!0),requestAnimationFrame(()=>{if(!l.current||!a.current)return;const P=a.current.querySelector(`[data-value="${e}"]`);if(!P)return;const S=a.current.getBoundingClientRect(),R=P.getBoundingClientRect();l.current.style.transition="none",l.current.style.left=R.left-S.left+"px",l.current.style.width=R.width+"px"}))};return f.current=_,u.useLayoutEffect(()=>{const d=p.current!==e;p.current=e,m.current=i&&d,_()}),u.useEffect(()=>{if(!a.current)return;const d=new ResizeObserver(()=>{m.current=!1,f.current()});return d.observe(a.current),()=>d.disconnect()},[]),s.jsxs("div",{className:["ds-seg",`ds-seg--${c}`,n&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:a,role:"group",children:[i&&s.jsx("div",{ref:l,className:"ds-seg__pill","aria-hidden":"true"}),t.map(d=>s.jsxs("button",{type:"button","data-value":d.value,className:["ds-seg__btn",e===d.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!n&&r(d.value),"aria-pressed":e===d.value,disabled:n,children:[d.icon&&s.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:d.icon}),d.label]},d.value))]})}function Fe({children:t,title:e,defaultExpanded:r=!1,expanded:c,onToggle:n,padding:a="m",...l}){const[i,h]=u.useState(r),m=c!==void 0,p=m?c:i,f=()=>{m?n==null||n(!c):h(d=>!d)},_=["ds-accordion",`ds-accordion--${a}`,p&&"ds-accordion--expanded"].filter(Boolean).join(" ");return s.jsxs("div",{className:_,...l,children:[s.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:f,"aria-expanded":p,children:[s.jsx("span",{className:"ds-accordion__title",children:e}),s.jsx(g.ChevronDown,{size:B[2],strokeWidth:1.5,className:`ds-accordion__icon ${p?"ds-accordion__icon--expanded":""}`})]}),s.jsx("div",{className:"ds-accordion__content",children:s.jsx("div",{className:"ds-accordion__content-inner",children:s.jsx("div",{className:"ds-accordion__content-body",children:t})})})]})}const z=8,G=8;function Ve(t,e,r){const c=window.innerWidth;let n,a;switch(t){case"top":n=e.top-r.height-z,a=e.left+e.width/2-r.width/2;break;case"bottom":n=e.bottom+z,a=e.left+e.width/2-r.width/2;break;case"left":n=e.top+e.height/2-r.height/2,a=e.left-r.width-z;break;case"right":n=e.top+e.height/2-r.height/2,a=e.right+z;break;default:n=e.bottom+z,a=e.left}const l=Math.max(G,Math.min(c-r.width-G,a)),i=a-l;return{top:n,left:l,arrowOffset:i}}function We(t,e,r){const c=window.innerWidth,n=window.innerHeight;if(t.top>=e+z+G)return"top";if(n-t.bottom>=e+z+G)return"bottom";if(c-t.right>=r+z+G)return"right";if(t.left>=r+z+G)return"left";const a=Math.max(t.top,n-t.bottom,t.left,c-t.right);return a===t.top?"top":a===n-t.bottom?"bottom":a===c-t.right?"right":"left"}function ze({children:t,content:e,position:r,...c}){const[n,a]=u.useState(!1),[l,i]=u.useState({visibility:"hidden"}),[h,m]=u.useState(r||"top"),p=u.useRef(null),f=u.useRef(null),_=u.useRef(!1),d=()=>{if(!p.current||!f.current)return;const N=p.current.getBoundingClientRect(),T=f.current.getBoundingClientRect(),y=r||We(N,T.height,T.width),{top:P,left:S,arrowOffset:R}=Ve(y,N,T);m(y),i({position:"fixed",top:P,left:S,visibility:"visible","--arrow-offset":`${R}px`})};if(u.useEffect(()=>{if(!n)return;i({position:"fixed",visibility:"hidden"});const N=requestAnimationFrame(d);return window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{cancelAnimationFrame(N),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[n,r]),u.useEffect(()=>{if(!n)return;const N=T=>{p.current&&!p.current.contains(T.target)&&a(!1)};return document.addEventListener("touchstart",N),()=>document.removeEventListener("touchstart",N)},[n]),!e)return t;const w=n&&s.jsx("div",{ref:f,className:`ds-tooltip ds-tooltip--${h}`,role:"tooltip",style:l,children:e});return s.jsxs("div",{ref:p,className:"ds-tooltip-wrapper",onMouseEnter:()=>{_.current||a(!0)},onMouseLeave:()=>{_.current||a(!1)},onTouchStart:()=>{_.current=!0,a(N=>!N)},...c,children:[t,typeof document<"u"&&ee.createPortal(w,document.body)]})}function Ue({checked:t=!1,onChange:e,size:r="m",disabled:c=!1,label:n,id:a,...l}){const i=a||`toggle-${u.useId()}`,h=["ds-toggle",`ds-toggle--${r}`,c&&"ds-toggle--disabled"].filter(Boolean).join(" ");return s.jsxs("label",{className:h,htmlFor:i,children:[s.jsx("input",{type:"checkbox",id:i,className:"ds-toggle__input",checked:t,onChange:m=>e==null?void 0:e(m.target.checked),disabled:c,...l}),s.jsx("span",{className:"ds-toggle__track",children:s.jsx("span",{className:"ds-toggle__thumb"})}),n&&s.jsx("span",{className:"ds-toggle__label",children:n})]})}function Ye({checked:t=!1,onChange:e,size:r="m",disabled:c=!1,label:n,id:a,...l}){const i=a||`checkbox-${u.useId()}`,h=["ds-checkbox",`ds-checkbox--${r}`,c&&"ds-checkbox--disabled"].filter(Boolean).join(" "),m=r==="xs"?10:r==="small"?14:r==="large"?20:16;return s.jsxs("label",{className:h,htmlFor:i,children:[s.jsx("input",{type:"checkbox",id:i,className:"ds-checkbox__input",checked:t,onChange:p=>e==null?void 0:e(p.target.checked),disabled:c,...l}),s.jsx("span",{className:"ds-checkbox__box",children:t&&s.jsx(g.Check,{size:m,strokeWidth:2.5,className:"ds-checkbox__icon"})}),n&&s.jsx("span",{className:"ds-checkbox__label",children:n})]})}function qe({checked:t=!1,onChange:e,size:r="m",disabled:c=!1,label:n,name:a,value:l,id:i,...h}){const m=i||`radio-${u.useId()}`,p=["ds-radio",`ds-radio--${r}`,c&&"ds-radio--disabled"].filter(Boolean).join(" ");return s.jsxs("label",{className:p,htmlFor:m,children:[s.jsx("input",{type:"radio",id:m,className:"ds-radio__input",checked:t,onChange:f=>e==null?void 0:e(f.target.checked),disabled:c,name:a,value:l,...h}),s.jsx("span",{className:"ds-radio__circle",children:s.jsx("span",{className:"ds-radio__dot"})}),n&&s.jsx("span",{className:"ds-radio__label",children:n})]})}function He({width:t,height:e,shape:r="rect",className:c="",style:n={},...a}){return s.jsx("span",{className:["ds-skeleton",`ds-skeleton--${r}`,c].filter(Boolean).join(" "),style:{width:t,height:e,...n},"aria-hidden":"true",...a})}function Xe(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e%360}function Ke(t){if(!t)return"";const e=t.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[1][0]).toUpperCase():t[0].toUpperCase()}function Ge({seed:t,icon:e,src:r,size:c=32,className:n="",style:a={},...l}){const i=Xe(t??""),[h,m]=u.useState(!1),p=e??s.jsx("span",{className:"ds-avatar__initials",children:Ke(t)});return s.jsx("div",{className:["ds-avatar",n].filter(Boolean).join(" "),style:{width:c,height:c,"--ds-avatar-h":i,...a},"aria-hidden":"true",...l,children:r&&!h?s.jsx("img",{src:r,alt:"",onError:()=>m(!0)}):p})}function Je({children:t,size:e="compact",stickyTop:r,maxHeight:c,className:n="",style:a={},...l}){const i={...c?{maxHeight:c}:{},...r!==void 0?{"--ds-table-sticky-top":typeof r=="number"?`${r}px`:r}:{},...a};return s.jsx("div",{className:["ds-table-wrap",c?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:i,children:s.jsx("table",{className:["ds-table",`ds-table--${e}`,n].filter(Boolean).join(" "),...l,children:t})})}function Ze({children:t,...e}){return s.jsx("thead",{...e,children:t})}function Qe({children:t,...e}){return s.jsx("tbody",{...e,children:t})}function et({children:t,interactive:e,selected:r,subheader:c,className:n="",onClick:a,...l}){return s.jsx("tr",{className:["ds-table-row",e||a?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",c?"ds-table-row--subheader":"",n].filter(Boolean).join(" "),onClick:a,...l,children:t})}function tt({children:t,colSpan:e=999,...r}){return s.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...r,children:s.jsx("td",{colSpan:e,children:t})})}function st({children:t,align:e="left",sortDir:r,onSort:c,width:n,className:a="",style:l={},...i}){const h=!!c||r!==void 0,m=r==="asc"?g.ChevronUp:r==="desc"?g.ChevronDown:g.ChevronsUpDown;return s.jsx("th",{className:["ds-th",h?"ds-th--sortable":"",r?"ds-th--sorted":"",e!=="left"?`ds-table-cell--${e}`:"",a].filter(Boolean).join(" "),onClick:c,style:{width:n,...l},...i,children:h?s.jsxs("span",{className:"ds-th__inner",children:[t,s.jsx("span",{className:"ds-th__sort-icon",children:s.jsx(m,{size:11,strokeWidth:2.5})})]}):t})}function rt({children:t,align:e="left",secondary:r,muted:c,truncate:n,nowrap:a,className:l="",...i}){return s.jsx("td",{className:["ds-td",e!=="left"?`ds-table-cell--${e}`:"",r?"ds-table-cell--secondary":"",c?"ds-table-cell--muted":"",n?"ds-table-cell--truncate":"",a?"ds-table-cell--nowrap":"",l].filter(Boolean).join(" "),...i,children:t})}function nt({icon:t,title:e,description:r,action:c,size:n="m",className:a="",...l}){return s.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${n}`,a].filter(Boolean).join(" "),...l,children:[t&&s.jsx("div",{className:"ds-empty-state__icon",children:t}),s.jsx("div",{className:"ds-empty-state__title",children:e}),r&&s.jsx("div",{className:"ds-empty-state__description",children:r}),c&&s.jsx("div",{className:"ds-empty-state__action",children:c})]})}function at({trigger:t,items:e=[],open:r,onOpenChange:c,align:n="left",className:a="",style:l,...i}){const[h,m]=u.useState(!1),[p,f]=u.useState(!1),_=r!==void 0,d=_?r:h,w=u.useRef(null),N=u.useRef(null),T=u.useRef(null),y=u.useRef(null),[P,S]=u.useState({}),R=u.useRef(null),C=150,D=()=>{if(_)c==null||c(!1);else{if(p)return;f(!0),R.current=setTimeout(()=>{m(!1),f(!1)},C)}},U=()=>{const b=!d;_?c==null||c(b):b?(clearTimeout(R.current),f(!1),m(!0)):D()},O=()=>{d||(_?c==null||c(!0):(clearTimeout(R.current),f(!1),m(!0)))};u.useEffect(()=>()=>clearTimeout(R.current),[]),u.useEffect(()=>{if(!d)return;const b=()=>{var k;const v=(k=w.current)==null?void 0:k.getBoundingClientRect();v&&S(n==="right"?{top:v.bottom+4,right:window.innerWidth-v.right}:{top:v.bottom+4,left:v.left})};return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[d,n]);const M=()=>{var v;const b=(v=T.current)==null?void 0:v.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};u.useEffect(()=>{if(!d)return;const b=k=>{var A,L;!((A=w.current)!=null&&A.contains(k.target))&&!((L=N.current)!=null&&L.contains(k.target))&&D()},v=k=>{k.key==="Escape"&&(D(),M())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v)}},[d]),u.useEffect(()=>{if(!d||!y.current||!N.current)return;const b=V(),v=y.current==="last"?b[b.length-1]:b[0];v==null||v.focus(),y.current=null},[d]);const V=()=>N.current?[...N.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],H=b=>{var v,k;if(b.key==="ArrowDown")b.preventDefault(),d?(v=V()[0])==null||v.focus():(y.current="first",O());else if(b.key==="ArrowUp")if(b.preventDefault(),!d)y.current="last",O();else{const A=V();(k=A[A.length-1])==null||k.focus()}},Y=b=>{var A,L,W,j;const v=V(),k=v.findIndex(o=>o===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(A=v[Math.min(k+1,v.length-1)])==null||A.focus();break;case"ArrowUp":b.preventDefault(),k<=0?M():(L=v[k-1])==null||L.focus();break;case"Home":b.preventDefault(),(W=v[0])==null||W.focus();break;case"End":b.preventDefault(),(j=v[v.length-1])==null||j.focus();break;case"Tab":D();break}},F=d&&s.jsx("div",{ref:N,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${n}`,p&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:P,onKeyDown:Y,children:e.map((b,v)=>{if(b.separator)return s.jsx("div",{className:"ds-dropdown__separator"},v);if(b.type==="section")return s.jsxs("div",{className:"ds-dropdown__section",children:[b.label&&s.jsx("div",{className:"ds-dropdown__section-label",children:b.label}),s.jsx("div",{className:"ds-dropdown__section-content",children:b.content})]},v);const k=!!b.href,A=k?"a":"button",L=k?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return s.jsxs(A,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...L,onClick:()=>{var W;(W=b.onClick)==null||W.call(b),D()},children:[b.icon&&s.jsx("span",{className:"ds-dropdown__item-icon",children:b.icon}),s.jsx("span",{className:"ds-dropdown__item-label",children:b.label}),b.shortcut&&s.jsx("span",{className:"ds-dropdown__item-shortcut",children:b.shortcut})]},v)})});return s.jsxs("div",{ref:w,className:["ds-dropdown",a].filter(Boolean).join(" "),style:l,...i,children:[s.jsx("div",{ref:T,className:"ds-dropdown__trigger",onClick:U,onKeyDown:H,children:t}),typeof document<"u"&&ee.createPortal(F,document.body)]})}function ot({value:t=0,size:e="m",variant:r="default",showValue:c=!1,min:n=2,animate:a=!0}){const l=Math.min(100,Math.max(0,t)),i=Math.max(n,l),h=r==="auto"?l>=70?"success":l>=50?"warning":"danger":r;return s.jsxs("div",{className:["ds-progress",`ds-progress--${e}`,!a&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":100,children:[s.jsx("div",{className:"ds-progress__track",children:s.jsx("div",{className:`ds-progress__fill ds-progress__fill--${h}`,style:{width:`${i}%`}})}),c&&s.jsxs("span",{className:"ds-progress__value",children:[Math.round(l),"%"]})]})}const ct=t=>1-Math.pow(1-t,3),lt=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function ue(t,{duration:e=600}={}){const[r,c]=u.useState(t),n=u.useRef(t),a=u.useRef(null);return u.useEffect(()=>{if(lt()){c(t),n.current=t;return}const l=n.current,i=t-l;if(i===0)return;let h=null;const m=p=>{h||(h=p);const f=Math.min((p-h)/e,1);c(l+i*ct(f)),f<1?a.current=requestAnimationFrame(m):n.current=t};return a.current=requestAnimationFrame(m),()=>cancelAnimationFrame(a.current)},[t,e]),r}function it({value:t,duration:e=600,decimals:r=0,prefix:c="",suffix:n=""}){const l=ue(t,{duration:e}).toFixed(r);return`${c}${l}${n}`}function fe({threshold:t=.1,rootMargin:e="0px",once:r=!1}={}){const c=u.useRef(null),[n,a]=u.useState(!1);return u.useEffect(()=>{const l=c.current;if(!l)return;const i=new IntersectionObserver(([h])=>{h.isIntersecting?(a(!0),r&&i.disconnect()):r||a(!1)},{threshold:t,rootMargin:e});return i.observe(l),()=>i.disconnect()},[t,e,r]),{ref:c,inView:n}}function dt({children:t,as:e="div",once:r=!1,threshold:c=.1,rootMargin:n="0px",onEnter:a,onLeave:l,...i}){const{ref:h,inView:m}=fe({threshold:c,rootMargin:n,once:r}),p=u.useRef(!1);return u.useEffect(()=>{m&&!p.current&&(a==null||a()),!m&&p.current&&(l==null||l()),p.current=m},[m]),s.jsx(e,{ref:h,...i,children:typeof t=="function"?t(m):t})}const ce={default:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};let J=[];const ne=new Set;function me(){ne.forEach(t=>t([...J]))}function ut(t){J=[...J,t],me()}function ft(t){J=J.filter(e=>e.id!==t),me()}function mt(){const t=(e,r={})=>{ut({id:`${Date.now()}-${Math.random()}`,message:e,type:"default",duration:4e3,...r})};return t.success=(e,r)=>t(e,{...r,type:"success"}),t.error=(e,r)=>t(e,{...r,type:"error"}),t.warning=(e,r)=>t(e,{...r,type:"warning"}),{toast:t}}function pt({data:t,onDismiss:e}){const[r,c]=u.useState(!1),n=u.useRef(null);u.useEffect(()=>(requestAnimationFrame(()=>c(!0)),t.duration>0&&(n.current=setTimeout(()=>a(),t.duration)),()=>clearTimeout(n.current)),[]);function a(){c(!1),setTimeout(()=>e(t.id),250)}const l=ce[t.type]??ce.default;return s.jsxs("div",{className:["ds-toast",`ds-toast--${t.type}`,r&&"ds-toast--visible"].filter(Boolean).join(" "),role:t.type==="error"?"alert":"status","aria-live":"polite",children:[s.jsx("div",{className:"ds-toast__icon",children:s.jsx(l,{size:B[3],strokeWidth:1.5})}),s.jsx("span",{className:"ds-toast__message",children:t.message}),s.jsx("button",{className:"ds-toast__close",onClick:a,"aria-label":"Закрыть",children:s.jsx(g.X,{size:B[3],strokeWidth:1.5})})]})}function bt({position:t="bottom-right"}){const[e,r]=u.useState(()=>[...J]);return u.useEffect(()=>(ne.add(r),()=>ne.delete(r)),[]),!e.length||typeof document>"u"?null:ee.createPortal(s.jsx("div",{className:["ds-toast-container",`ds-toast-container--${t}`].join(" "),children:e.map(c=>s.jsx(pt,{data:c,onDismiss:ft},c.id))}),document.body)}exports.Accordion=Fe;exports.Alert=Ae;exports.AnimatedNumber=it;exports.Avatar=Ge;exports.Badge=$e;exports.Button=ie;exports.Card=Ne;exports.Checkbox=Ye;exports.Code=Oe;exports.CodeAccordion=de;exports.Dropdown=at;exports.EmptyState=nt;exports.H1=ye;exports.H2=Ee;exports.H3=Re;exports.H4=ke;exports.InView=dt;exports.Input=ve;exports.Link=Be;exports.Modal=De;exports.ModalFooter=re;exports.P1=ge;exports.P2=Te;exports.P3=Se;exports.ProgressBar=ot;exports.Radio=qe;exports.SegmentedControl=Ce;exports.Select=_e;exports.Skeleton=He;exports.Spinner=le;exports.Stepper=we;exports.Tab=Le;exports.Table=Je;exports.TableBody=Qe;exports.TableHead=Ze;exports.TableRow=et;exports.TableSubheaderRow=tt;exports.Tabs=Me;exports.Td=rt;exports.Textarea=je;exports.Th=st;exports.ToastContainer=bt;exports.Toggle=Ue;exports.Tooltip=ze;exports.iconSizes=B;exports.useAnimatedNumber=ue;exports.useInView=fe;exports.useToast=mt;
|
package/dist/index.d.ts
CHANGED
|
@@ -196,7 +196,7 @@ export declare function Radio(props: RadioProps): JSX.Element;
|
|
|
196
196
|
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
197
197
|
children?: ReactNode;
|
|
198
198
|
variant?: 'default' | 'info' | 'success' | 'warning' | 'error' | 'accent';
|
|
199
|
-
size?: 's' | 'm';
|
|
199
|
+
size?: 'xs' | 's' | 'm';
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
export declare function Badge(props: BadgeProps): JSX.Element;
|