@donkit-ai/design-system 0.3.5 → 0.4.2

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.
Files changed (45) hide show
  1. package/dist/index.cjs.js +22 -0
  2. package/dist/index.es.js +1105 -0
  3. package/dist/tokens.css +1 -0
  4. package/package.json +15 -9
  5. package/src/components/Accordion.css +0 -70
  6. package/src/components/Accordion.jsx +0 -42
  7. package/src/components/Alert.css +0 -93
  8. package/src/components/Alert.jsx +0 -47
  9. package/src/components/Badge.css +0 -52
  10. package/src/components/Badge.jsx +0 -25
  11. package/src/components/Button.css +0 -103
  12. package/src/components/Button.jsx +0 -80
  13. package/src/components/Card.css +0 -46
  14. package/src/components/Card.jsx +0 -70
  15. package/src/components/Checkbox.css +0 -88
  16. package/src/components/Checkbox.jsx +0 -47
  17. package/src/components/Code.css +0 -30
  18. package/src/components/Code.jsx +0 -27
  19. package/src/components/CodeAccordion.css +0 -80
  20. package/src/components/CodeAccordion.jsx +0 -42
  21. package/src/components/Input.css +0 -163
  22. package/src/components/Input.jsx +0 -55
  23. package/src/components/Link.css +0 -18
  24. package/src/components/Link.jsx +0 -21
  25. package/src/components/Modal.css +0 -70
  26. package/src/components/Modal.jsx +0 -72
  27. package/src/components/Radio.css +0 -115
  28. package/src/components/Radio.jsx +0 -42
  29. package/src/components/Select.css +0 -167
  30. package/src/components/Select.jsx +0 -118
  31. package/src/components/Stepper.css +0 -183
  32. package/src/components/Stepper.jsx +0 -104
  33. package/src/components/Tabs.css +0 -87
  34. package/src/components/Tabs.jsx +0 -81
  35. package/src/components/Textarea.css +0 -116
  36. package/src/components/Textarea.jsx +0 -41
  37. package/src/components/Toggle.css +0 -133
  38. package/src/components/Toggle.jsx +0 -38
  39. package/src/components/Tooltip.css +0 -134
  40. package/src/components/Tooltip.jsx +0 -158
  41. package/src/components/Typography.css +0 -74
  42. package/src/components/Typography.jsx +0 -42
  43. package/src/index.js +0 -24
  44. package/src/styles/iconSizes.js +0 -15
  45. package/src/styles/tokens.css +0 -298
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),T=require("lucide-react"),S={xs:16,s:20,m:24,l:28,xl:48};var z={exports:{}},B={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Z;function ae(){if(Z)return B;Z=1;var o=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(l,n,a){var i=null;if(a!==void 0&&(i=""+a),n.key!==void 0&&(i=""+n.key),"key"in n){a={};for(var c in n)c!=="key"&&(a[c]=n[c])}else a=n;return n=a.ref,{$$typeof:o,type:l,key:i,ref:n!==void 0?n:null,props:a}}return B.Fragment=s,B.jsx=r,B.jsxs=r,B}var F={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Q;function oe(){return Q||(Q=1,process.env.NODE_ENV!=="production"&&function(){function o(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===se?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case k:return"Profiler";case N:return"StrictMode";case g:return"Suspense";case O:return"SuspenseList";case D:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case R:return"Portal";case y:return t.displayName||"Context";case $:return(t._context.displayName||"Context")+".Consumer";case I:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case P:return f=t.displayName||null,f!==null?f:o(t.type)||"Memo";case A:f=t._payload,t=t._init;try{return o(t(f))}catch{}}return null}function s(t){return""+t}function r(t){try{s(t);var f=!1}catch{f=!0}if(f){f=console;var v=f.error,E=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return v.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),s(t)}}function l(t){if(t===j)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===A)return"<...>";try{var f=o(t);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function n(){var t=L.A;return t===null?null:t.getOwner()}function a(){return Error("react-stack-top-frame")}function i(t){if(q.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function c(t,f){function v(){X||(X=!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)",f))}v.isReactWarning=!0,Object.defineProperty(t,"key",{get:v,configurable:!0})}function m(){var t=o(this.type);return C[t]||(C[t]=!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.")),t=this.props.ref,t!==void 0?t:null}function p(t,f,v,E,W,H){var w=v.ref;return t={$$typeof:_,type:t,key:f,props:v,_owner:E},(w!==void 0?w:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:m}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function d(t,f,v,E,W,H){var w=f.children;if(w!==void 0)if(E)if(re(w)){for(E=0;E<w.length;E++)u(w[E]);Object.freeze&&Object.freeze(w)}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 u(w);if(q.call(f,"key")){w=o(t);var M=Object.keys(f).filter(function(ne){return ne!=="key"});E=0<M.length?"{key: someKey, "+M.join(": ..., ")+": ...}":"{key: someKey}",K[w+E]||(M=0<M.length?"{"+M.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,E,w,M,w),K[w+E]=!0)}if(w=null,v!==void 0&&(r(v),w=""+v),i(f)&&(r(f.key),w=""+f.key),"key"in f){v={};for(var V in f)V!=="key"&&(v[V]=f[V])}else v=f;return w&&c(v,typeof t=="function"?t.displayName||t.name||"Unknown":t),p(t,w,v,n(),W,H)}function u(t){b(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===A&&(t._payload.status==="fulfilled"?b(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function b(t){return typeof t=="object"&&t!==null&&t.$$typeof===_}var h=x,_=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),y=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),se=Symbol.for("react.client.reference"),L=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,re=Array.isArray,Y=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(t){return t()}};var X,C={},G=h.react_stack_bottom_frame.bind(h,a)(),J=Y(l(a)),K={};F.Fragment=j,F.jsx=function(t,f,v){var E=1e4>L.recentlyCreatedOwnerStacks++;return d(t,f,v,!1,E?Error("react-stack-top-frame"):G,E?Y(l(t)):J)},F.jsxs=function(t,f,v){var E=1e4>L.recentlyCreatedOwnerStacks++;return d(t,f,v,!0,E?Error("react-stack-top-frame"):G,E?Y(l(t)):J)}}()),F}process.env.NODE_ENV==="production"?z.exports=ae():z.exports=oe();var e=z.exports;function ee({children:o,variant:s="primary",size:r="m",fullWidth:l=!1,icon:n,disabled:a=!1,onClick:i,type:c="button",href:m,"aria-label":p,...d}){const u=n&&!o,b=["ds-button",`ds-button--${s}`,`ds-button--${r}`,l&&"ds-button--full",u&&"ds-button--icon-only"].filter(Boolean).join(" "),h=e.jsxs(e.Fragment,{children:[n&&!u&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:n}),o,u&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:n})]});if(m){const _=R=>{if(a){R.preventDefault();return}R.metaKey||R.ctrlKey||R.button===1||(R.preventDefault(),i==null||i(R))};return e.jsx("a",{className:b,href:a?void 0:m,onClick:_,"aria-label":p,"aria-disabled":a?"true":void 0,...d,children:h})}return e.jsx("button",{type:c,className:b,disabled:a,onClick:i,"aria-label":p,...d,children:h})}function ce({label:o,error:s,hint:r,fullWidth:l=!0,icon:n,iconRight:a,onIconRightClick:i,size:c="m",disabled:m,id:p,...d}){const u=p||`input-${x.useId()}`,b=r?`${u}-hint`:void 0,h=s?`${u}-error`:void 0,_=h||b;return e.jsxs("div",{className:`ds-input-wrapper ${l?"ds-input-wrapper--full":""} ${m?"ds-input-wrapper--disabled":""}`,children:[o&&e.jsx("label",{className:"ds-input-label",htmlFor:u,children:o}),e.jsxs("div",{className:"ds-input-container",children:[n&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${c}`,"aria-hidden":"true",children:n}),e.jsx("input",{id:u,className:`ds-input ds-input--${c} ${n?"ds-input--with-icon":""} ${a?"ds-input--with-icon-right":""} ${s?"ds-input--error":""}`,disabled:m,"aria-invalid":s?"true":"false","aria-describedby":_,...d}),a&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${c}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:a})]}),r&&!s&&e.jsx("span",{id:b,className:"ds-input-hint",children:r}),s&&e.jsx("span",{id:h,className:"ds-input-error",role:"alert",children:s})]})}function le({label:o,error:s,hint:r,fullWidth:l=!0,size:n="m",disabled:a,id:i,resize:c=!0,rows:m=3,...p}){const d=i||`textarea-${x.useId()}`,u=r?`${d}-hint`:void 0,b=s?`${d}-error`:void 0,h=b||u;return e.jsxs("div",{className:`ds-textarea-wrapper ${l?"ds-textarea-wrapper--full":""} ${a?"ds-textarea-wrapper--disabled":""}`,children:[o&&e.jsx("label",{className:"ds-textarea-label",htmlFor:d,children:o}),e.jsx("textarea",{id:d,className:`ds-textarea ds-textarea--${n} ${s?"ds-textarea--error":""} ${c?"":"ds-textarea--no-resize"}`,disabled:a,"aria-invalid":s?"true":"false","aria-describedby":h,rows:m,...p}),r&&!s&&e.jsx("span",{id:u,className:"ds-textarea-hint",children:r}),s&&e.jsx("span",{id:b,className:"ds-textarea-error",role:"alert",children:s})]})}function ie({label:o,value:s,onChange:r,options:l=[],placeholder:n="Select option",error:a,fullWidth:i=!0,size:c="m",disabled:m=!1,id:p,...d}){const[u,b]=x.useState(!1),[h,_]=x.useState("down"),R=x.useRef(null),j=x.useRef(null),N=p||`select-${x.useId()}`,k=`${N}-label`,$=a?`${N}-error`:void 0;x.useEffect(()=>{const g=O=>{R.current&&!R.current.contains(O.target)&&b(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),x.useEffect(()=>{if(u&&R.current){const g=R.current.getBoundingClientRect(),P=window.innerHeight-g.bottom,A=g.top;P<300&&A>P?_("up"):_("down")}},[u]);const y=l.find(g=>g.value===s),I=c==="xs"?S.xs:c==="small"?S.s:S.m;return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${m?"ds-select-wrapper--disabled":""}`,children:[o&&e.jsx("label",{id:k,className:"ds-select-label",children:o}),e.jsxs("div",{className:"ds-select-container",ref:R,children:[e.jsxs("button",{type:"button",id:N,role:"combobox","aria-haspopup":"listbox","aria-expanded":u,"aria-labelledby":o?k:void 0,"aria-invalid":a?"true":"false","aria-describedby":$,className:`ds-select-trigger ds-select-trigger--${c} ${a?"ds-select-trigger--error":""}`,onClick:()=>!m&&b(!u),disabled:m,...d,children:[e.jsx("span",{className:y?"":"ds-select-placeholder",children:(y==null?void 0:y.label)||n}),e.jsx(T.ChevronDown,{size:I,strokeWidth:1.5,className:`ds-select-icon ${u&&h==="down"?"ds-select-icon--open":""} ${u&&h==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]}),u&&e.jsx("div",{ref:j,role:"listbox","aria-labelledby":o?k:void 0,className:`ds-select-dropdown ds-select-dropdown--${c} ds-select-dropdown--${h}`,children:l.map(g=>e.jsx("button",{type:"button",role:"option","aria-selected":s===g.value,className:`ds-select-option ds-select-option--${c} ${s===g.value?"ds-select-option--selected":""}`,onClick:()=>{r==null||r(g.value),b(!1)},children:g.label},g.value))})]}),a&&e.jsx("span",{id:$,className:"ds-select-error",role:"alert",children:a})]})}function de({label:o,value:s=0,onChange:r,min:l=0,max:n=100,step:a=1,size:i="m",disabled:c=!1,hint:m,error:p,...d}){const u=()=>{if(c)return;const N=Math.min(Number(s)+a,n);r==null||r(N)},b=()=>{if(c)return;const N=Math.max(Number(s)-a,l);r==null||r(N)},h=N=>{if(c)return;const k=N.target.value;if(k===""){r==null||r(l);return}const $=Number(k);if(!isNaN($)){const y=Math.min(Math.max($,l),n);r==null||r(y)}},_=["ds-stepper-wrapper",c&&"ds-stepper-wrapper--disabled",p&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),R=["ds-stepper",`ds-stepper--${i}`,c&&"ds-stepper--disabled"].filter(Boolean).join(" "),j=i==="xs"?S.xs:i==="small"?S.s:S.m;return e.jsxs("div",{className:_,children:[o&&e.jsx("label",{className:"ds-stepper-label",children:o}),e.jsxs("div",{className:R,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:b,disabled:c||s<=l,"aria-label":"Decrease",children:e.jsx(T.Minus,{size:j,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:s,onChange:h,min:l,max:n,step:a,disabled:c,...d}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:u,disabled:c||s>=n,"aria-label":"Increase",children:e.jsx(T.Plus,{size:j,strokeWidth:1.5})})]}),m&&!p&&e.jsx("div",{className:"ds-stepper-hint",children:m}),p&&e.jsx("div",{className:"ds-stepper-error",children:p})]})}function ue({children:o,padding:s="m",variant:r="info",hover:l=!1,onClick:n,href:a,disabled:i=!1,...c}){const p=(l?"interactive":r)==="interactive"||n||a,d=["ds-card",`ds-card--${s}`,p&&"ds-card--interactive"].filter(Boolean).join(" ");if(a){const h=_=>{if(i){_.preventDefault();return}_.metaKey||_.ctrlKey||_.button===1||(_.preventDefault(),n==null||n(_))};return e.jsx("a",{className:d,href:i?void 0:a,onClick:h,"aria-disabled":i?"true":void 0,...c,children:o})}const u=p&&n?"button":"div",b=p&&n?{type:"button",onClick:n,disabled:i}:{};return e.jsx(u,{className:d,role:p&&!n?"article":void 0,...b,...c,children:o})}function fe({children:o,...s}){return e.jsx("h1",{className:"ds-h1",...s,children:o})}function pe({children:o,...s}){return e.jsx("h2",{className:"ds-h2",...s,children:o})}function me({children:o,...s}){return e.jsx("h3",{className:"ds-h3",...s,children:o})}function xe({children:o,...s}){return e.jsx("h4",{className:"ds-h4",...s,children:o})}function be({children:o,secondary:s=!1,...r}){return e.jsx("p",{className:`ds-p1 ${s?"ds-p1--secondary":""}`,...r,children:o})}function he({children:o,secondary:s=!1,...r}){return e.jsx("p",{className:`ds-p2 ${s?"ds-p2--secondary":""}`,...r,children:o})}function je({children:o,secondary:s=!1,...r}){return e.jsx("p",{className:`ds-p3 ${s?"ds-p3--secondary":""}`,...r,children:o})}function ve({children:o,variant:s="default",size:r="m",role:l,...n}){const a=["ds-badge",`ds-badge--${s}`,`ds-badge--${r}`].filter(Boolean).join(" "),i=l||(["info","success","warning","error"].includes(s)?"status":void 0);return e.jsx("span",{className:a,role:i,...n,children:o})}const _e={info:T.Info,success:T.CheckCircle,warning:T.AlertTriangle,error:T.XCircle};function Ne({children:o,variant:s="info",title:r,onClose:l,role:n,...a}){const i=_e[s],c=n||(s==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${s} ${r?"":"ds-alert--no-title"}`,role:c,...a,children:[i&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(i,{size:S.m,strokeWidth:1.5})}),e.jsxs("div",{className:"ds-alert__content",children:[r&&e.jsx("div",{className:"ds-alert__title",children:r}),o&&e.jsx("div",{className:"ds-alert__message",children:o})]}),l&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:l,"aria-label":"Close alert",children:e.jsx(T.X,{size:S.m,strokeWidth:1.5})})]})}function Ee({children:o,title:s,onClose:r,size:l="m",...n}){const a=x.useRef(null),i=x.useId();x.useEffect(()=>{const d=b=>{b.key==="Escape"&&(r==null||r())},u=b=>{a.current&&!a.current.contains(b.target)&&(r==null||r())};return document.addEventListener("keydown",d),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",u)}},[r]);const c=x.Children.toArray(o),m=c.find(d=>(d==null?void 0:d.type)===U),p=c.filter(d=>(d==null?void 0:d.type)!==U);return e.jsx("div",{className:"ds-modal-overlay",...n,children:e.jsxs("div",{className:`ds-modal ds-modal--${l}`,ref:a,role:"dialog","aria-modal":"true","aria-labelledby":s?i:void 0,children:[(s||r)&&e.jsxs("div",{className:"ds-modal__header",children:[s&&e.jsx("h3",{id:i,className:"ds-modal__title",children:s}),r&&e.jsx(ee,{variant:"ghost",size:"small",icon:e.jsx(T.X,{size:S.s,strokeWidth:1.5}),onClick:r,"aria-label":"Close modal"})]}),e.jsx("div",{className:"ds-modal__body",children:p}),m]})})}function U({children:o}){return e.jsx("div",{className:"ds-modal__footer",children:o})}function te({children:o,title:s="Code",defaultExpanded:r=!1,padding:l="s",...n}){const[a,i]=x.useState(r),c=["ds-code-accordion",`ds-code-accordion--${l}`].filter(Boolean).join(" ");return e.jsxs("div",{className:c,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:()=>i(!a),"aria-expanded":a,children:[e.jsx("span",{className:"ds-code-accordion__title",children:s}),e.jsx(T.ChevronDown,{size:S.s,strokeWidth:1.5,className:`ds-code-accordion__icon ${a?"ds-code-accordion__icon--expanded":""}`})]}),a&&e.jsx("pre",{className:"ds-code-accordion__content",...n,children:e.jsx("code",{children:o})})]})}function we({children:o,block:s=!1,collapsible:r=!1,title:l="Code",defaultExpanded:n=!1,...a}){return s?r?e.jsx(te,{title:l,defaultExpanded:n,...a,children:o}):e.jsx("pre",{className:"ds-code-block",...a,children:e.jsx("code",{children:o})}):e.jsx("code",{className:"ds-code-inline",...a,children:o})}function Re({href:o,children:s,onClick:r,target:l,rel:n,...a}){const c=l==="_blank"?n?`${n} noopener noreferrer`:"noopener noreferrer":n;return e.jsx("a",{href:o,className:"ds-link",onClick:r,target:l,rel:c,...a,children:s})}function ge({children:o,size:s="m",variant:r="ghost",...l}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...l,children:x.Children.map(o,n=>x.isValidElement(n)?x.cloneElement(n,{size:s,variant:r}):n)})}function ye({children:o,selected:s=!1,onClick:r,size:l="m",variant:n="ghost",disabled:a=!1,icon:i,href:c,...m}){const p=i&&!o,d=["ds-tab",`ds-tab--${l}`,`ds-tab--${n}`,s&&"ds-tab--selected",p&&"ds-tab--icon-only"].filter(Boolean).join(" "),u=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),o]});if(c){const b=h=>{if(a){h.preventDefault();return}h.metaKey||h.ctrlKey||h.button===1||(h.preventDefault(),r==null||r(h))};return e.jsx("a",{role:"tab","aria-current":s?"page":void 0,"aria-disabled":a?"true":void 0,className:d,href:a?void 0:c,onClick:b,...m,children:u})}return e.jsx("button",{role:"tab","aria-selected":s,className:d,onClick:r,disabled:a,...m,children:u})}function ke({children:o,title:s,defaultExpanded:r=!1,padding:l="m",...n}){const[a,i]=x.useState(r),c=["ds-accordion",`ds-accordion--${l}`].filter(Boolean).join(" ");return e.jsxs("div",{className:c,...n,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:()=>i(!a),"aria-expanded":a,children:[e.jsx("span",{className:"ds-accordion__title",children:s}),e.jsx(T.ChevronDown,{size:S.s,strokeWidth:1.5,className:`ds-accordion__icon ${a?"ds-accordion__icon--expanded":""}`})]}),a&&e.jsx("div",{className:"ds-accordion__content",children:o})]})}function $e({children:o,content:s,position:r,...l}){const[n,a]=x.useState(!1),[i,c]=x.useState(r||"top"),[m,p]=x.useState({x:0,arrowOffset:0}),d=x.useRef(null),u=x.useRef(null),b=x.useRef(!1);x.useEffect(()=>{n&&!r&&d.current&&u.current?requestAnimationFrame(()=>{if(!d.current||!u.current)return;const j=d.current.getBoundingClientRect(),N=u.current.getBoundingClientRect(),k=window.innerHeight,$=window.innerWidth,y=j.top,I=k-j.bottom,g=j.left,O=$-j.right,P=N.height,A=N.width;if(y>=P+8)c("top");else if(I>=P+8)c("bottom");else if(O>=A+8)c("right");else if(g>=A+8)c("left");else{const D=Math.max(y,I,g,O);c(D===y?"top":D===I?"bottom":D===O?"right":"left")}}):r&&c(r)},[n,r]),x.useEffect(()=>{n&&u.current&&d.current?requestAnimationFrame(()=>{if(!u.current||!d.current)return;const j=u.current.getBoundingClientRect(),N=window.innerWidth,k=8;let $=0,y=0;(i==="top"||i==="bottom")&&(j.right>N-k?($=N-k-j.right,y=-$):j.left<k&&($=k-j.left,y=-$)),p({x:$,arrowOffset:y})}):p({x:0,arrowOffset:0})},[n,i]),x.useEffect(()=>{if(!n)return;const j=N=>{d.current&&!d.current.contains(N.target)&&a(!1)};return document.addEventListener("touchstart",j),()=>{document.removeEventListener("touchstart",j)}},[n]);const h=()=>{b.current=!0,a(j=>!j)},_=()=>{b.current||a(!0)},R=()=>{b.current||a(!1)};return s?e.jsxs("div",{ref:d,className:"ds-tooltip-wrapper",onMouseEnter:_,onMouseLeave:R,onTouchStart:h,...l,children:[o,n&&e.jsx("div",{ref:u,className:`ds-tooltip ds-tooltip--${i}`,role:"tooltip",style:{"--tooltip-offset-x":`${m.x}px`,"--arrow-offset":`${m.arrowOffset}px`},children:s})]}):o}function Te({checked:o=!1,onChange:s,size:r="m",disabled:l=!1,label:n,id:a,...i}){const c=a||`toggle-${x.useId()}`,m=["ds-toggle",`ds-toggle--${r}`,l&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:m,htmlFor:c,children:[e.jsx("input",{type:"checkbox",id:c,className:"ds-toggle__input",checked:o,onChange:p=>s==null?void 0:s(p.target.checked),disabled:l,...i}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),n&&e.jsx("span",{className:"ds-toggle__label",children:n})]})}function Se({checked:o=!1,onChange:s,size:r="m",disabled:l=!1,label:n,id:a,...i}){const c=a||`checkbox-${x.useId()}`,m=["ds-checkbox",`ds-checkbox--${r}`,l&&"ds-checkbox--disabled"].filter(Boolean).join(" "),p=r==="xs"?10:r==="small"?14:r==="large"?20:16;return e.jsxs("label",{className:m,htmlFor:c,children:[e.jsx("input",{type:"checkbox",id:c,className:"ds-checkbox__input",checked:o,onChange:d=>s==null?void 0:s(d.target.checked),disabled:l,...i}),e.jsx("span",{className:"ds-checkbox__box",children:o&&e.jsx(T.Check,{size:p,strokeWidth:2.5,className:"ds-checkbox__icon"})}),n&&e.jsx("span",{className:"ds-checkbox__label",children:n})]})}function Oe({checked:o=!1,onChange:s,size:r="m",disabled:l=!1,label:n,name:a,value:i,id:c,...m}){const p=c||`radio-${x.useId()}`,d=["ds-radio",`ds-radio--${r}`,l&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:d,htmlFor:p,children:[e.jsx("input",{type:"radio",id:p,className:"ds-radio__input",checked:o,onChange:u=>s==null?void 0:s(u.target.checked),disabled:l,name:a,value:i,...m}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),n&&e.jsx("span",{className:"ds-radio__label",children:n})]})}exports.Accordion=ke;exports.Alert=Ne;exports.Badge=ve;exports.Button=ee;exports.Card=ue;exports.Checkbox=Se;exports.Code=we;exports.CodeAccordion=te;exports.H1=fe;exports.H2=pe;exports.H3=me;exports.H4=xe;exports.Input=ce;exports.Link=Re;exports.Modal=Ee;exports.ModalFooter=U;exports.P1=be;exports.P2=he;exports.P3=je;exports.Radio=Oe;exports.Select=ie;exports.Stepper=de;exports.Tab=ye;exports.Tabs=ge;exports.Textarea=le;exports.Toggle=Te;exports.Tooltip=$e;exports.iconSizes=S;