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