@moondreamsdev/dreamer-ui 1.7.4-test.9 → 1.7.6

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 (38) hide show
  1. package/dist/components.cjs.js +1 -1
  2. package/dist/components.cjs.js.map +1 -1
  3. package/dist/components.esm.js +686 -481
  4. package/dist/components.esm.js.map +1 -1
  5. package/dist/hooks.cjs.js +2 -0
  6. package/dist/hooks.cjs.js.map +1 -0
  7. package/dist/hooks.esm.js +6 -0
  8. package/dist/hooks.esm.js.map +1 -0
  9. package/dist/providers.cjs.js +2 -0
  10. package/dist/providers.cjs.js.map +1 -0
  11. package/dist/providers.esm.js +72 -0
  12. package/dist/providers.esm.js.map +1 -0
  13. package/dist/src/components/accordion/AccordionItem.d.ts +0 -1
  14. package/dist/src/components/actionmodal/ActionModal.d.ts +21 -0
  15. package/dist/src/components/actionmodal/index.d.ts +2 -0
  16. package/dist/src/components/button/variants.d.ts +1 -1
  17. package/dist/src/components/clickable/Clickable.d.ts +0 -1
  18. package/dist/src/components/index.d.ts +3 -1
  19. package/dist/src/components/input/variants.d.ts +3 -3
  20. package/dist/src/components/radiogroup/RadioGroupItem.d.ts +0 -1
  21. package/dist/src/components/textarea/variants.d.ts +2 -2
  22. package/dist/src/components/tooltip/Tooltip.d.ts +23 -0
  23. package/dist/src/components/tooltip/hooks.d.ts +30 -0
  24. package/dist/src/components/tooltip/index.d.ts +2 -0
  25. package/dist/src/hooks/index.d.ts +1 -0
  26. package/dist/src/hooks/useActionModal.d.ts +3 -0
  27. package/dist/src/providers/ActionModalProvider.d.ts +21 -0
  28. package/dist/src/providers/index.d.ts +1 -0
  29. package/dist/styles-Bxzm1DQb.cjs +2 -0
  30. package/dist/styles-Bxzm1DQb.cjs.map +1 -0
  31. package/dist/styles-eVzajhIX.js +289 -0
  32. package/dist/styles-eVzajhIX.js.map +1 -0
  33. package/dist/theme.css +2 -2
  34. package/dist/useActionModal-C4X_-O9_.js +13 -0
  35. package/dist/useActionModal-C4X_-O9_.js.map +1 -0
  36. package/dist/useActionModal-CqT8y2he.cjs +2 -0
  37. package/dist/useActionModal-CqT8y2he.cjs.map +1 -0
  38. package/package.json +11 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),l=require("react"),p=require("./utils.cjs.js"),C=require("./QuestionMarkCircled-o1tqa8ZJ.cjs"),F=require("react-dom");function N({id:n,title:t,content:e,children:r,className:s="",disabled:a=!1,isOpen:i=!1,onToggle:u,triggerClassName:c="",bodyClassName:x=""}){const v=l.useId(),d=n||`accordion-item-${v}`,y=`${d}-header`,b=`${d}-panel`,f=()=>{!a&&u&&u()},j=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),f())};return o.jsxs("div",{className:p.join("border-b border-gray-200",a&&"opacity-60 cursor-not-allowed",s),children:[o.jsxs("button",{id:y,type:"button",className:p.join("w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary",a?"cursor-not-allowed":"hover:bg-gray-50/10 cursor-pointer",c),"aria-expanded":i,"aria-controls":b,disabled:a,onClick:f,onKeyDown:j,children:[o.jsx("span",{children:t}),o.jsx("span",{className:p.join("transform transition-transform duration-300 ease-linear",i?"rotate-180":"rotate-0"),"aria-hidden":"true",children:o.jsx(C.ChevronDown,{size:18})})]}),o.jsx("div",{id:b,role:"region","aria-labelledby":y,className:p.join("transition-all duration-300 ease-linear px-4",i?"max-h-96 opacity-100 overflow-auto py-3":"max-h-0 opacity-0 overflow-hidden",x),children:i&&(r||e)})]})}function G({id:n,items:t=[],children:e,className:r="",itemClassName:s="",allowMultiple:a=!1,defaultOpenItems:i=[],triggersClassName:u="",bodiesClassName:c=""}){const x=l.useId(),v=n||`accordion-group-${x}`,[d,y]=l.useState(new Set(i)),b=m=>{y(h=>{const g=new Set(h);return g.has(m)?g.delete(m):(a||g.clear(),g.add(m)),g})},f=m=>`${x}-item-${m}`,j=m=>d.has(m);return o.jsxs("div",{id:v,className:r,children:[t.length>0&&t.map((m,h)=>{const g=m.id||f(h);return o.jsx(N,{id:g,title:m.title,content:m.content,disabled:m.disabled,isOpen:j(g),onToggle:()=>b(g),className:s,triggerClassName:u,bodyClassName:c},g)}),t.length===0&&e&&l.Children.map(e,(m,h)=>{if(l.isValidElement(m)&&m.type===N){const g=m.props.id||f(h);return l.createElement(N,{...m.props,key:g,id:g,className:p.join(s,m.props.className),isOpen:j(g),onToggle:()=>b(g),triggerClassName:p.join(u,m.props.triggerClassName),bodyClassName:p.join(c,m.props.bodyClassName)})}return null})]})}function L(){const[n,t]=l.useState(0);return l.useEffect(()=>{const e=setInterval(()=>{t(r=>(r+1)%3)},500);return()=>clearInterval(e)},[]),o.jsx("div",{className:"absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle",children:[0,1,2].map(e=>o.jsx("div",{className:p.join("rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current",n===e&&"transform -translate-y-1")},e))})}const H={base:"",primary:"bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-muted disabled:text-muted-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/85 disabled:bg-muted/80 disabled:text-muted-foreground/80",tertiary:"text-primary hover:text-primary-foreground disabled:text-muted",outline:"border border-primary text-primary hover:border-primary-foreground hover:text-primary-foreground disabled:border-muted disabled:text-muted",link:"underline-offset-4 hover:underline disabled:underline disabled:text-muted",danger:"bg-danger text-danger-foreground hover:bg-danger/85 disabled:bg-muted disabled:text-muted-foreground"},K={stripped:"",fitted:"size-fit",sm:"px-2 py-1 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg",icon:"p-1 w-fit aspect-square",full:"p-2 w-full"},Q={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"},$={variant:"primary",size:"md",rounded:"md"};function R({variant:n=$.variant,size:t,rounded:e=$.rounded,loading:r,linkTo:s,linkProps:a,type:i="button",className:u,...c}){let x;n==="link"&&!t?x="fitted":x=t||$.size;const d=p.join("appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",H[n],K[x],Q[e],r&&"relative pointer-events-none",s&&"relative",u);return o.jsxs("button",{...c,role:s?"link":c.role,"aria-label":c["aria-label"]||(a==null?void 0:a["aria-label"]),"aria-description":c["aria-description"]||(a==null?void 0:a["aria-description"]),"aria-disabled":c.disabled||r,"aria-busy":r,type:i,className:d,children:[r&&o.jsx(L,{}),o.jsx("span",{className:p.join(r&&"invisible"),children:c.children}),s&&!c.disabled&&o.jsx("a",{...a,"aria-hidden":!0,href:s,target:(a==null?void 0:a.target)||"_blank",rel:(a==null?void 0:a.rel)||"noreferrer",className:"absolute inset-0"})]})}function U(n){const[t,e]=l.useState(""),r=l.useCallback(s=>{let a=s,i="";for(;a&&!i;){const u=window.getComputedStyle(a).backgroundColor;u&&u!=="transparent"&&u!=="rgba(0, 0, 0, 0)"&&(i=u),a=a.parentElement}return i||"transparent"},[]);return l.useEffect(()=>{const s=document.getElementById(n);if(s){const a=r(s.parentElement);e(a)}},[n,r]),t}function W({ref:n,id:t,size:e=20,color:r,filled:s=!1,rounded:a=!0,checked:i=!1,onCheckedChange:u,disabled:c,className:x="",...v}){const d=l.useId(),y=l.useMemo(()=>t||`checkbox-${d}`,[t,d]),b=U(y),[f,j]=l.useState(i);l.useEffect(()=>{j(i)},[i]);const m=()=>{c||(j(!f),u==null||u(!f))},h=w=>{w.key===" "&&(w.preventDefault(),m())},g=p.join("flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",a&&"rounded",c&&"opacity-40 cursor-not-allowed",!c&&"cursor-pointer",x);return o.jsx("button",{id:y,type:"button",ref:n,tabIndex:0,role:"checkbox",onClick:m,"aria-checked":f,"aria-disabled":c,onKeyDownCapture:h,style:{width:e,height:e,color:r,backgroundColor:f&&s?"currentcolor":"transparent"},className:g,...v,children:f&&o.jsx(C.Check,{size:e,color:s?b:void 0})})}function X({children:n,className:t,linkTo:e,linkProps:r,onButtonClick:s,buttonProps:a,...i}){return e&&s&&console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'),o.jsxs("div",{className:p.join("relative w-fit",t),...i,children:[n,e&&o.jsx("a",{...r,href:e,className:p.join("absolute inset-0",r==null?void 0:r.className)}),!e&&s&&o.jsx("button",{...a,type:"button",onClick:s,className:p.join("absolute inset-0 cursor-pointer",a==null?void 0:a.className)})]})}function I({elementId:n,type:t,message:e}){return l.useEffect(()=>{const r=document.getElementById(n);if(r){if(!e&&t==="error"){r.removeAttribute("data-error");return}if(!e&&t==="success"){r.removeAttribute("data-success");return}return r.setAttribute("aria-describedby",`${n}-${t}-message`),r.setAttribute("aria-invalid",t==="error"?"true":"false"),t==="error"&&r.setAttribute("data-error","true"),t==="success"&&r.setAttribute("data-success","true"),()=>{r.removeAttribute("aria-describedby"),r.removeAttribute("aria-invalid"),r.removeAttribute("data-error"),r.removeAttribute("data-success")}}},[n,t,e]),e?o.jsxs("small",{className:p.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",t==="error"&&"text-danger",t==="success"&&"text-success"),role:"status",children:[t==="error"?o.jsx(C.ExclamationTriangle,{}):o.jsx(C.CheckCircled,{}),o.jsx("span",{id:`${n}-${t}-message`,children:e})]}):null}const _={base:"",default:"ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-danger not-disabled:data-success:ring-success",underline:"border-b border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success",outline:"border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success"},J={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},S={variant:"default",rounded:"none"};function Y({variant:n=S.variant,rounded:t,displayOnlyMode:e=!1,errorMessage:r,successMessage:s,type:a="text",className:i,...u}){const c=l.useId(),[x,v]=l.useState(!1);let d=t;n==="outline"&&!t&&(d="md"),d=d||S.rounded;const f=p.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all","file:mr-2 file:border-0 file:rounded-md file:px-1.5 file:py-1 file:bg-primary hover:file:bg-primary/85 file:text-sm file:font-medium file:text-foreground file:transition-colors",!e&&_[n],!e&&J[d],a==="password"&&"pr-10",!e&&"px-2 py-1",e&&"pointer-events-none",i);return o.jsxs("div",{className:p.join(e&&"cursor-text"),style:{height:u.height,width:u.width},children:[o.jsxs("div",{className:p.join(a==="password"&&"relative"),children:[o.jsx("input",{...u,id:c,type:a==="password"&&x?"text":a,"aria-disabled":u.disabled,readOnly:e,"aria-readonly":e||u["aria-readonly"],"data-error":r?!0:void 0,"data-success":s?!0:void 0,className:f}),a==="password"&&o.jsx("button",{onClick:()=>v(!x),className:"absolute inset-y-0 right-0 px-2 hover:cursor-pointer","aria-label":"Toggle password visibility","data-state":x?"visible":"hidden",children:x?o.jsx(C.EyeClosed$1,{size:20}):o.jsx(C.EyeClosed,{size:20})})]}),!e&&o.jsx(I,{elementId:c,type:"error",message:r}),!e&&o.jsx(I,{elementId:c,type:"success",message:s})]})}function Z({display:n="inline",width:t="fit-content",className:e="",required:r,helpMessage:s,suffix:a,htmlFor:i,children:u,...c}){const x=l.useId(),v=p.join("font-medium",n,e),d=s?`${i??x}-help`:void 0;return o.jsxs("div",{style:{display:n==="inline"?"inline-flex":"flex",width:t},className:"relative",children:[o.jsxs("label",{className:v,htmlFor:i,...c,children:[u,r&&o.jsx("span",{className:"text-red-500 font-medium ml-1","aria-label":"required",children:"*"})]}),s&&o.jsx("span",{className:"text-gray-500 ml-1 size-fit -translate-y-1/3","aria-describedby":d,"aria-label":"Help information",title:s,children:o.jsx(C.QuestionMarkCircled,{})}),s&&o.jsx("div",{id:d,className:"sr-only",children:s}),a&&o.jsx("span",{className:"ml-1",children:a})]})}function k(...n){return n.filter(t=>typeof t=="string"&&t).join(" ").trim()||void 0}function M(n){const[t,e]=l.useState(!1),[r,s]=l.useState(!1);return l.useEffect(()=>{n?(s(!0),setTimeout(()=>e(!0),10)):(e(!1),setTimeout(()=>s(!1),150))},[n]),{show:t,shouldRender:r}}function O(n,t){l.useEffect(()=>{const e=r=>{r.key==="Escape"&&n&&t()};return document.addEventListener("keydown",e),n&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow="auto"}},[n,t])}function P(n,t){const e=l.useRef(null),r=l.useCallback(()=>{const s=document.getElementById(n);if(!s)return;const a=s.querySelectorAll('[data-modal-action="true"]');if(a.length>0){a[0].focus();return}const i=s.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(i.length>0){const u=Array.from(i).filter(c=>!(c instanceof HTMLButtonElement&&c.getAttribute("data-modal-close-button")==="true"));if(u.length>0){u[0].focus();return}i[0].focus();return}s.focus()},[n]);l.useEffect(()=>(t&&(e.current=document.activeElement,r()),()=>{document.body.style.overflow="auto",e.current instanceof HTMLElement&&e.current.focus()}),[t,r])}function ee({id:n,isOpen:t,onClose:e,title:r,children:s,contentOnly:a=!1,className:i,overlayClassName:u,hideCloseButton:c=!1,actions:x=[],disableCloseOnOverlayClick:v=!1,ariaLabelledBy:d,ariaDescribedBy:y}){const b=l.useId(),f=n||`modal-${b}`,j=n?`${n}-title`:`modal-title-${b}`,{show:m,shouldRender:h}=M(t);if(P(f,h),O(h,e),!h)return null;const g=()=>r?l.isValidElement(r)?o.jsx("div",{className:"mb-4",children:r}):o.jsx("h2",{className:"mb-4 text-xl font-semibold",id:j,children:r}):null,w=()=>x.length===0?null:o.jsx("div",{className:"mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3",children:x.map((A,B)=>{const{label:q,className:T,...V}=A;return o.jsx(R,{className:T,type:"button",...V,"data-modal-action":"true",children:q},B)})});return o.jsx(o.Fragment,{children:F.createPortal(o.jsx("div",{"aria-labelledby":d??r?j:void 0,"aria-describedby":y,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-y-auto",children:o.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4",children:[o.jsx("div",{className:k("fixed inset-0 bg-black/20 transition-all",u),onClick:()=>{v||e()}}),a&&o.jsx("div",{className:k("relative w-fit",i),children:s}),!a&&o.jsxs("div",{id:f,tabIndex:-1,className:k("relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:border ease-in duration-75",m?"opacity-100 scale-100":"opacity-0 scale-90",i),children:[!c&&o.jsx("button",{type:"button",onClick:e,"data-modal-close-button":"true",className:"rounded-md p-0.5 top-2.5 right-2.5 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",children:o.jsx(C.X,{size:18})}),g(),s,w()]})]})}),document.body)})}function te({children:n,ref:t,...e}){if(l.isValidElement(n)){let r={...e};return n.props&&(r={...r,...n.props}),l.cloneElement(n,{...r,ref:s=>{typeof t=="function"?t(s):t&&(t.current=s)}})}return l.createElement("div",{...e,ref:t},n)}function z({itemId:n,checked:t,onChange:e,name:r,disabled:s=!1,className:a=""}){const i="relative inline-flex items-center justify-center rounded-full",u=()=>{s||e()},c=p.join(i,!t&&"hover:border-current/60",!s&&"border-current cursor-pointer",s&&"border-muted/60 cursor-not-allowed",a);return o.jsx("div",{id:n,role:"radio",tabIndex:-1,"aria-checked":t,"aria-disabled":s,"aria-description":`Radio button for ${r}`,"aria-labelledby":`${n}-label`,onClick:u,className:c,style:{width:"1em",height:"1em",padding:"0.1em",borderWidth:"0.06em"},children:t&&o.jsx("div",{className:p.join("size-full aspect-square rounded-full",s&&"bg-muted/60",!s&&"bg-current")})})}function E({value:n,children:t,className:e="",isSelected:r=!1,onChange:s,disabled:a=!1,hideInput:i=!1,description:u,name:c}){const v=`radio-${l.useId()}-${n}`,d=()=>{a||s==null||s(n)};return o.jsxs("div",{title:u,className:p.join("relative flex items-center",e,i&&`p-2 border-2 focus-within:border-dashed focus-within:${a?"border-current/50":"border-current/80"}`,i&&!r&&`border-transparent ${a?"":"not-focus-within:hover:border-border/60"}`,i&&r&&"border-border",a&&"opacity-60 cursor-not-allowed"),style:{gap:"0.5em"},children:[!i&&o.jsx(z,{itemId:v,name:c||"",checked:r,onChange:d,disabled:a,className:p.join(i&&"")}),o.jsx("div",{id:i?v:void 0,tabIndex:i?-1:void 0,role:i?"radio":void 0,onClick:i?d:void 0,"aria-checked":i?r?"true":"false":void 0,"aria-disabled":i?a:void 0,"aria-description":i?u||`Radio button for ${c}`:void 0,"aria-labelledby":i?`${v}-label`:void 0,className:p.join(i&&"size-full",typeof t=="object"&&"grow focus:outline-none"),children:o.jsx("label",{id:`${v}-label`,onClick:i?void 0:d,className:p.join(a&&"cursor-not-allowed",!a&&"cursor-pointer"),children:t})})]})}function re(n,t){const[e,r]=l.useState(t),[s,a]=l.useState(-1),[i,u]=l.useState(!1),c=l.useCallback((b,f)=>{var h;const j=b[f];j.hasAttribute("disabled")||j.getAttribute("aria-disabled")==="true"||((h=b[f])==null||h.click(),a(f))},[]),x=l.useCallback((b,f)=>{var m;if(b.preventDefault(),i||!f.length)return;const j=t!==-1?t:0;(m=f[j])==null||m.focus(),r(j),t!==-1&&c(f,j)},[t,i,c]),v=l.useCallback(b=>{var h;if(!b.shiftKey)return;b.preventDefault();const f=Array.from(document.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')).filter(g=>!g.hasAttribute("disabled")&&g.tabIndex>=0),j=f.findIndex(g=>g.id===n),m=j>0?j-1:f.length-1;(h=f[m])==null||h.focus()},[n]),d=l.useCallback((b,f)=>{var w;if(!f.length)return;const j=b.target;if(!f.some(A=>A.id===j.id))return;const h=e!==-1?e:0;let g=h;switch(b.key){case"ArrowUp":case"ArrowLeft":b.preventDefault(),g=h>0?h-1:f.length-1;break;case"ArrowDown":case"ArrowRight":b.preventDefault(),g=(h+1)%f.length;break;case" ":b.preventDefault(),c(f,h);return;case"Tab":v(b);return;default:return}(w=f[g])==null||w.focus(),r(g),s!==-1&&c(f,g)},[e,s,v,c]),y=l.useCallback(()=>{const b=document.querySelector(`[id="${n}"][role="radiogroup"]`);return b?Array.from(b.querySelectorAll('[role="radio"]')):[]},[n]);l.useEffect(()=>{const b=document.querySelector(`[id="${n}"][role="radiogroup"]`);if(!b)return;const f=y(),j=w=>x(w,f),m=w=>d(w,f),h=()=>u(!0),g=()=>u(!1);return document.addEventListener("keydown",m),b.addEventListener("focus",j),b.addEventListener("mousedown",h),document.addEventListener("mouseup",g),()=>{document.removeEventListener("keydown",m),b.removeEventListener("focus",j),b.removeEventListener("mousedown",h),document.removeEventListener("mouseup",g)}},[n,y,x,d])}function ne({options:n=[],value:t,onChange:e,id:r,children:s,className:a="",childrenClassName:i="",hideInputs:u=!1}){const c=l.useId(),x=r||`radio-group-${c}`;re(x,n.findIndex(d=>d===t));const v=l.useMemo(()=>n.reduce((d,y)=>(typeof y=="string"?d.some(b=>b.value===y)||d.push({label:y,value:y}):d.push(y),d),[]),[n]);return o.jsxs("div",{id:x,role:"radiogroup",tabIndex:0,className:p.join(a,"focus:outline-none"),children:[v.length>0&&v.map((d,y)=>o.jsx(E,{value:d.value,isSelected:t===d.value,onChange:e,name:x,disabled:d.disabled,description:d.description,hideInput:u,className:i,children:d.label},`${d.value}-${y}`)),v.length===0&&s&&l.Children.map(s,d=>l.isValidElement(d)&&d.type===E?o.jsx(E,{...d.props,className:p.join(i,d.props.className),hideInput:d.props.hideInput||u,isSelected:t===d.props.value,onChange:e,name:x,children:d.props.children}):null)]})}function se({elementId:n,maxLength:t}){const[e,r]=l.useState(0);return l.useEffect(()=>{const s=document.getElementById(n);if(!s)return;const a=()=>{const i=s.value.length;r(i);const u=i>=t;s.setAttribute("aria-describedby",`${n}-character-count`),s.setAttribute("aria-invalid",u?"true":"false"),u?s.setAttribute("data-error","true"):s.removeAttribute("data-error")};return a(),s.addEventListener("input",a),s.setAttribute("maxlength",String(t)),()=>{s.removeEventListener("input",a),s.removeAttribute("maxlength"),s.removeAttribute("aria-describedby"),s.removeAttribute("aria-invalid"),s.removeAttribute("data-error")}},[n,t]),o.jsx("small",{className:p.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",e>=t&&"text-danger",e<t&&"text-current"),role:"status",children:o.jsxs("span",{id:`${n}-character-count`,children:[e," / ",t," characters"]})})}function ae(n,t){l.useEffect(()=>{const e=document.getElementById(n);if(!e)return;if(!t){e.style.height="auto";return}const r=()=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`};return r(),e.addEventListener("input",r),e.addEventListener("resize",r),window.addEventListener("resize",r),()=>{e.removeEventListener("input",r),e.removeEventListener("resize",r),window.removeEventListener("resize",r)}},[n,t])}const oe={base:"","left-line":"border-l border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success",outline:"border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success"},ie={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},D={variant:"outline",rounded:"none"};function de({variant:n=D.variant,rounded:t,displayOnlyMode:e=!1,errorMessage:r,successMessage:s,hideResizeHandle:a=!1,autoExpand:i=!1,characterLimit:u=0,className:c,...x}){const v=l.useId();ae(v,i||e);let d=t;n==="outline"&&!t&&(d="md"),d=d||D.rounded;let y=a;(e||n==="left-line"&&!a)&&(y=!0);const f=p.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",!e&&oe[n],!e&&ie[d],!e&&"px-2 py-1",e&&"pointer-events-none",y&&"no-resize-handle",c);return o.jsxs("div",{className:p.join("-space-y-1.5",e&&"cursor-text"),children:[o.jsx("textarea",{...x,id:v,"aria-disabled":x.disabled,readOnly:e,"aria-readonly":e||x["aria-readonly"],style:{resize:i?"none":void 0},className:f}),u>0&&o.jsx(se,{elementId:v,maxLength:u}),!e&&o.jsx(I,{elementId:v,type:"error",message:r}),!e&&o.jsx(I,{elementId:v,type:"success",message:s})]})}exports.Accordion=G;exports.AccordionItem=N;exports.Button=R;exports.ButtonLoadingDots=L;exports.Checkbox=W;exports.Clickable=X;exports.Input=Y;exports.Label=Z;exports.Modal=ee;exports.RadioGroup=ne;exports.RadioGroupItem=E;exports.RadioInput=z;exports.Slot=te;exports.Textarea=de;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("react"),y=require("./utils.cjs.js"),E=require("./QuestionMarkCircled-o1tqa8ZJ.cjs"),S=require("./styles-Bxzm1DQb.cjs"),K=require("react-dom");function T({id:n,title:s,content:e,children:o,className:t="",disabled:r=!1,isOpen:a=!1,onToggle:d,triggerClassName:c="",bodyClassName:f=""}){const m=u.useId(),l=n||`accordion-item-${m}`,p=`${l}-header`,h=`${l}-panel`,b=()=>{!r&&d&&d()},v=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),b())};return i.jsxs("div",{className:y.join("border-b border-gray-200",r&&"opacity-60 cursor-not-allowed",t),children:[i.jsxs("button",{id:p,type:"button",className:y.join("w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary",r?"cursor-not-allowed":"hover:bg-gray-50/10 cursor-pointer",c),"aria-expanded":a,"aria-controls":h,disabled:r,onClick:b,onKeyDown:v,children:[i.jsx("span",{children:s}),i.jsx("span",{className:y.join("transform transition-transform duration-300 ease-linear",a?"rotate-180":"rotate-0"),"aria-hidden":"true",children:i.jsx(E.ChevronDown,{size:18})})]}),i.jsx("div",{id:h,role:"region","aria-labelledby":p,className:y.join("transition-all duration-300 ease-linear px-4",a?"max-h-96 opacity-100 overflow-auto py-3":"max-h-0 opacity-0 overflow-hidden",f),children:a&&(o||e)})]})}function Q({id:n,items:s=[],children:e,className:o="",itemClassName:t="",allowMultiple:r=!1,defaultOpenItems:a=[],triggersClassName:d="",bodiesClassName:c=""}){const f=u.useId(),m=n||`accordion-group-${f}`,[l,p]=u.useState(new Set(a)),h=x=>{p(w=>{const g=new Set(w);return g.has(x)?g.delete(x):(r||g.clear(),g.add(x)),g})},b=x=>`${f}-item-${x}`,v=x=>l.has(x);return i.jsxs("div",{id:m,className:o,children:[s.length>0&&s.map((x,w)=>{const g=x.id||b(w);return i.jsx(T,{id:g,title:x.title,content:x.content,disabled:x.disabled,isOpen:v(g),onToggle:()=>h(g),className:t,triggerClassName:d,bodyClassName:c},g)}),s.length===0&&e&&u.Children.map(e,(x,w)=>{if(u.isValidElement(x)&&x.type===T){const g=x.props.id||b(w);return u.createElement(T,{...x.props,key:g,id:g,className:y.join(t,x.props.className),isOpen:v(g),onToggle:()=>h(g),triggerClassName:y.join(d,x.props.triggerClassName),bodyClassName:y.join(c,x.props.bodyClassName)})}return null})]})}function M(){const[n,s]=u.useState(0);return u.useEffect(()=>{const e=setInterval(()=>{s(o=>(o+1)%3)},500);return()=>clearInterval(e)},[]),i.jsx("div",{className:"absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle",children:[0,1,2].map(e=>i.jsx("div",{className:y.join("rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current",n===e&&"transform -translate-y-1")},e))})}const X={base:"",primary:"bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-muted disabled:text-muted-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/85 disabled:bg-muted/80 disabled:text-muted-foreground/80",tertiary:"text-primary hover:text-primary-foreground disabled:text-muted",outline:"border border-primary text-primary hover:border-primary-foreground hover:text-primary-foreground disabled:border-muted disabled:text-muted",link:"underline-offset-4 hover:underline disabled:underline disabled:text-muted",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/85 disabled:bg-muted disabled:text-muted-foreground"},Z={stripped:"",fitted:"size-fit",sm:"px-2 py-1 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg",icon:"p-1 w-fit aspect-square",full:"p-2 w-full"},J={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"},q={variant:"primary",size:"md",rounded:"md"};function W({variant:n=q.variant,size:s,rounded:e=q.rounded,loading:o,linkTo:t,linkProps:r,type:a="button",className:d,...c}){let f;n==="link"&&!s?f="fitted":f=s||q.size;const l=y.join("appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",X[n],Z[f],J[e],o&&"relative pointer-events-none",t&&"relative",d);return i.jsxs("button",{...c,role:t?"link":c.role,"aria-label":c["aria-label"]||(r==null?void 0:r["aria-label"]),"aria-description":c["aria-description"]||(r==null?void 0:r["aria-description"]),"aria-disabled":c.disabled||o,"aria-busy":o,type:a,className:l,children:[o&&i.jsx(M,{}),i.jsx("span",{className:y.join(o&&"invisible"),children:c.children}),t&&!c.disabled&&i.jsx("a",{...r,"aria-hidden":!0,href:t,rel:(r==null?void 0:r.rel)||"noreferrer",className:"absolute inset-0"})]})}function Y(n){const[s,e]=u.useState(""),o=u.useCallback(t=>{let r=t,a="";for(;r&&!a;){const d=window.getComputedStyle(r).backgroundColor;d&&d!=="transparent"&&d!=="rgba(0, 0, 0, 0)"&&(a=d),r=r.parentElement}return a||"transparent"},[]);return u.useEffect(()=>{const t=document.getElementById(n);if(t){const r=o(t.parentElement);e(r)}},[n,o]),s}function O({ref:n,id:s,size:e=20,color:o,filled:t=!1,rounded:r=!0,checked:a=!1,onCheckedChange:d,disabled:c,className:f="",...m}){const l=u.useId(),p=u.useMemo(()=>s||`checkbox-${l}`,[s,l]),h=Y(p),[b,v]=u.useState(a);u.useEffect(()=>{v(a)},[a]);const x=()=>{c||(v(!b),d==null||d(!b))},w=j=>{j.key===" "&&(j.preventDefault(),x())},g=y.join("flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",r&&"rounded",c&&"opacity-40 cursor-not-allowed",!c&&"cursor-pointer",f);return i.jsx("button",{id:p,type:"button",ref:n,tabIndex:0,role:"checkbox",onClick:x,"aria-checked":b,"aria-disabled":c,onKeyDownCapture:w,style:{width:e,height:e,color:o,backgroundColor:b&&t?"currentcolor":"transparent"},className:g,...m,children:b&&i.jsx(E.Check,{size:e,color:t?h:void 0})})}function P({children:n,className:s,linkTo:e,linkProps:o,onButtonClick:t,buttonProps:r,...a}){return e&&t&&console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'),i.jsxs("div",{className:y.join("relative w-fit",s),...a,children:[n,e&&i.jsx("a",{...o,rel:(o==null?void 0:o.rel)||"noreferrer",href:e,className:y.join("absolute inset-0",o==null?void 0:o.className)}),!e&&t&&i.jsx("button",{...r,type:"button",onClick:t,className:y.join("absolute inset-0 cursor-pointer",r==null?void 0:r.className)})]})}function D({elementId:n,type:s,message:e}){return u.useEffect(()=>{const o=document.getElementById(n);if(o){if(!e&&s==="error"){o.removeAttribute("data-error");return}if(!e&&s==="success"){o.removeAttribute("data-success");return}return o.setAttribute("aria-describedby",`${n}-${s}-message`),o.setAttribute("aria-invalid",s==="error"?"true":"false"),s==="error"&&o.setAttribute("data-error","true"),s==="success"&&o.setAttribute("data-success","true"),()=>{o.removeAttribute("aria-describedby"),o.removeAttribute("aria-invalid"),o.removeAttribute("data-error"),o.removeAttribute("data-success")}}},[n,s,e]),e?i.jsxs("small",{className:y.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",s==="error"&&"text-destructive",s==="success"&&"text-success"),role:"status",children:[s==="error"?i.jsx(E.ExclamationTriangle,{}):i.jsx(E.CheckCircled,{}),i.jsx("span",{id:`${n}-${s}-message`,children:e})]}):null}const ee={base:"",default:"ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-destructive not-disabled:data-success:ring-success",underline:"border-b border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",outline:"border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success"},te={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},G={variant:"default",rounded:"none"};function re({variant:n=G.variant,rounded:s,displayOnlyMode:e=!1,errorMessage:o,successMessage:t,type:r="text",className:a,...d}){const c=u.useId(),[f,m]=u.useState(!1);let l=s;n==="outline"&&!s&&(l="md"),l=l||G.rounded;const b=y.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all","file:mr-2 file:border-0 file:rounded-md file:px-1.5 file:py-1 file:bg-primary hover:file:bg-primary/85 file:text-sm file:font-medium file:text-foreground file:transition-colors",!e&&ee[n],!e&&te[l],r==="password"&&"pr-10",!e&&"px-2 py-1",e&&"pointer-events-none",a);return i.jsxs("div",{className:y.join(e&&"cursor-text"),style:{height:d.height,width:d.width},children:[i.jsxs("div",{className:y.join(r==="password"&&"relative"),children:[i.jsx("input",{...d,id:c,type:r==="password"&&f?"text":r,"aria-disabled":d.disabled,readOnly:e,"aria-readonly":e||d["aria-readonly"],"data-error":o?!0:void 0,"data-success":t?!0:void 0,className:b}),r==="password"&&i.jsx("button",{onClick:()=>m(!f),className:"absolute inset-y-0 right-0 px-2 hover:cursor-pointer","aria-label":"Toggle password visibility","data-state":f?"visible":"hidden",children:f?i.jsx(E.EyeClosed$1,{size:20}):i.jsx(E.EyeClosed,{size:20})})]}),!e&&i.jsx(D,{elementId:c,type:"error",message:o}),!e&&i.jsx(D,{elementId:c,type:"success",message:t})]})}function oe({display:n="inline",width:s="fit-content",className:e="",required:o,helpMessage:t,suffix:r,htmlFor:a,children:d,...c}){const f=u.useId(),m=y.join("font-medium",n,e),l=t?`${a??f}-help`:void 0;return i.jsxs("div",{style:{display:n==="inline"?"inline-flex":"flex",width:s},className:"relative",children:[i.jsxs("label",{className:m,htmlFor:a,...c,children:[d,o&&i.jsx("span",{className:"text-red-500 font-medium ml-1","aria-label":"required",children:"*"})]}),t&&i.jsx("span",{className:"text-gray-500 ml-1 size-fit -translate-y-1/3","aria-describedby":l,"aria-label":"Help information",title:t,children:i.jsx(E.QuestionMarkCircled,{})}),t&&i.jsx("div",{id:l,className:"sr-only",children:t}),r&&i.jsx("span",{className:"ml-1",children:r})]})}function ne(n){const[s,e]=u.useState(!1),[o,t]=u.useState(!1);return u.useEffect(()=>{n?(t(!0),setTimeout(()=>e(!0),10)):(e(!1),setTimeout(()=>t(!1),150))},[n]),{show:s,shouldRender:o}}function se(n,s){u.useEffect(()=>{const e=o=>{o.key==="Escape"&&n&&s()};return document.addEventListener("keydown",e),n&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow="auto"}},[n,s])}function ae(n,s){const e=u.useRef(null),o=u.useCallback(()=>{const t=document.getElementById(n);if(!t)return;const r=t.querySelectorAll('[data-modal-action="true"]');if(r.length>0){r[0].focus();return}const a=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(a.length>0){const d=Array.from(a).filter(c=>!(c instanceof HTMLButtonElement&&c.getAttribute("data-modal-close-button")==="true"));if(d.length>0){d[0].focus();return}a[0].focus();return}t.focus()},[n]);u.useEffect(()=>(s&&(e.current=document.activeElement,o()),()=>{document.body.style.overflow="auto",e.current instanceof HTMLElement&&e.current.focus()}),[s,o])}function ie({id:n,isOpen:s,onClose:e,title:o,children:t,contentOnly:r=!1,className:a,overlayClassName:d,hideCloseButton:c=!1,actions:f=[],disableCloseOnOverlayClick:m=!1,ariaLabelledBy:l,ariaDescribedBy:p}){const h=u.useId(),b=n||`modal-${h}`,v=n?`${n}-title`:`modal-title-${h}`,{show:x,shouldRender:w}=ne(s);if(ae(b,w),se(w,e),!w)return null;const g=()=>o?u.isValidElement(o)?i.jsx("div",{className:"mb-4",children:o}):i.jsx("h2",{className:"mb-4 text-xl font-semibold",id:v,children:o}):null,j=()=>f.length===0?null:i.jsx("div",{className:"mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3",children:f.map((N,L)=>{const{label:z,className:I,...A}=N;return i.jsx(W,{className:I,type:"button",...A,"data-modal-action":"true",children:z},L)})});return i.jsx(i.Fragment,{children:K.createPortal(i.jsx("div",{"aria-labelledby":l??o?v:void 0,"aria-describedby":p,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-y-auto",children:i.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4",children:[i.jsx("div",{className:S.n("fixed inset-0 bg-black/20 transition-all",d),onClick:()=>{m||e()}}),r&&i.jsx("div",{className:S.n("relative w-fit",a),children:t}),!r&&i.jsxs("div",{id:b,tabIndex:-1,className:S.n("relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:ring ease-in duration-75",x?"opacity-100 scale-100":"opacity-0 scale-90",a),children:[!c&&i.jsx("button",{type:"button",onClick:e,"data-modal-close-button":"true",className:"rounded-md p-0.5 top-2.5 right-2.5 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",children:i.jsx(E.X,{size:18})}),g(),t,j()]})]})}),document.body)})}function U({itemId:n,checked:s,onChange:e,name:o,disabled:t=!1,className:r=""}){const a="relative inline-flex items-center justify-center rounded-full",d=()=>{t||e()},c=y.join(a,!s&&"hover:border-current/60",!t&&"border-current cursor-pointer",t&&"border-muted/60 cursor-not-allowed",r);return i.jsx("div",{id:n,role:"radio",tabIndex:-1,"aria-checked":s,"aria-disabled":t,"aria-description":`Radio button for ${o}`,"aria-labelledby":`${n}-label`,onClick:d,className:c,style:{width:"1em",height:"1em",padding:"0.1em",borderWidth:"0.06em"},children:s&&i.jsx("div",{className:y.join("size-full aspect-square rounded-full",t&&"bg-muted/60",!t&&"bg-current")})})}function R({value:n,children:s,className:e="",isSelected:o=!1,onChange:t,disabled:r=!1,hideInput:a=!1,description:d,name:c}){const m=`radio-${u.useId()}-${n}`,l=()=>{r||t==null||t(n)};return i.jsxs("div",{title:d,className:y.join("relative flex items-center",e,a&&`p-2 border-2 focus-within:border-dashed focus-within:${r?"border-current/50":"border-current/80"}`,a&&!o&&`border-transparent ${r?"":"not-focus-within:hover:border-border/60"}`,a&&o&&"border-border",r&&"opacity-60 cursor-not-allowed"),style:{gap:"0.5em"},children:[!a&&i.jsx(U,{itemId:m,name:c||"",checked:o,onChange:l,disabled:r,className:y.join(a&&"")}),i.jsx("div",{id:a?m:void 0,tabIndex:a?-1:void 0,role:a?"radio":void 0,onClick:a?l:void 0,"aria-checked":a?o?"true":"false":void 0,"aria-disabled":a?r:void 0,"aria-description":a?d||`Radio button for ${c}`:void 0,"aria-labelledby":a?`${m}-label`:void 0,className:y.join(a&&"size-full",typeof s=="object"&&"grow focus:outline-none"),children:i.jsx("label",{id:`${m}-label`,onClick:a?void 0:l,className:y.join(r&&"cursor-not-allowed",!r&&"cursor-pointer"),children:s})})]})}function ue(n,s){const[e,o]=u.useState(s),[t,r]=u.useState(-1),[a,d]=u.useState(!1),c=u.useCallback((h,b)=>{var w;const v=h[b];v.hasAttribute("disabled")||v.getAttribute("aria-disabled")==="true"||((w=h[b])==null||w.click(),r(b))},[]),f=u.useCallback((h,b)=>{var x;if(h.preventDefault(),a||!b.length)return;const v=s!==-1?s:0;(x=b[v])==null||x.focus(),o(v),s!==-1&&c(b,v)},[s,a,c]),m=u.useCallback(h=>{var w;if(!h.shiftKey)return;h.preventDefault();const b=Array.from(document.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')).filter(g=>!g.hasAttribute("disabled")&&g.tabIndex>=0),v=b.findIndex(g=>g.id===n),x=v>0?v-1:b.length-1;(w=b[x])==null||w.focus()},[n]),l=u.useCallback((h,b)=>{var j;if(!b.length)return;const v=h.target;if(!b.some(N=>N.id===v.id))return;const w=e!==-1?e:0;let g=w;switch(h.key){case"ArrowUp":case"ArrowLeft":h.preventDefault(),g=w>0?w-1:b.length-1;break;case"ArrowDown":case"ArrowRight":h.preventDefault(),g=(w+1)%b.length;break;case" ":h.preventDefault(),c(b,w);return;case"Tab":m(h);return;default:return}(j=b[g])==null||j.focus(),o(g),t!==-1&&c(b,g)},[e,t,m,c]),p=u.useCallback(()=>{const h=document.querySelector(`[id="${n}"][role="radiogroup"]`);return h?Array.from(h.querySelectorAll('[role="radio"]')):[]},[n]);u.useEffect(()=>{const h=document.querySelector(`[id="${n}"][role="radiogroup"]`);if(!h)return;const b=p(),v=j=>f(j,b),x=j=>l(j,b),w=()=>d(!0),g=()=>d(!1);return document.addEventListener("keydown",x),h.addEventListener("focus",v),h.addEventListener("mousedown",w),document.addEventListener("mouseup",g),()=>{document.removeEventListener("keydown",x),h.removeEventListener("focus",v),h.removeEventListener("mousedown",w),document.removeEventListener("mouseup",g)}},[n,p,f,l])}function le({options:n=[],value:s,onChange:e,id:o,children:t,className:r="",childrenClassName:a="",hideInputs:d=!1}){const c=u.useId(),f=o||`radio-group-${c}`;ue(f,n.findIndex(l=>l===s));const m=u.useMemo(()=>n.reduce((l,p)=>(typeof p=="string"?l.some(h=>h.value===p)||l.push({label:p,value:p}):l.push(p),l),[]),[n]);return i.jsxs("div",{id:f,role:"radiogroup",tabIndex:0,className:y.join(r,"focus:outline-none"),children:[m.length>0&&m.map((l,p)=>i.jsx(R,{value:l.value,isSelected:s===l.value,onChange:e,name:f,disabled:l.disabled,description:l.description,hideInput:d,className:a,children:l.label},`${l.value}-${p}`)),m.length===0&&t&&u.Children.map(t,l=>u.isValidElement(l)&&l.type===R?i.jsx(R,{...l.props,className:y.join(a,l.props.className),hideInput:l.props.hideInput||d,isSelected:s===l.props.value,onChange:e,name:f,children:l.props.children}):null)]})}function de({children:n,ref:s,...e}){if(u.isValidElement(n)){let o={...e};return n.props&&(o={...o,...n.props}),u.cloneElement(n,{...o,ref:t=>{typeof s=="function"?s(t):s&&(s.current=t)}})}return u.createElement("div",{...e,ref:s},n)}function ce({elementId:n,maxLength:s}){const[e,o]=u.useState(0);return u.useEffect(()=>{const t=document.getElementById(n);if(!t)return;const r=()=>{const a=t.value.length;o(a);const d=a>=s;t.setAttribute("aria-describedby",`${n}-character-count`),t.setAttribute("aria-invalid",d?"true":"false"),d?t.setAttribute("data-error","true"):t.removeAttribute("data-error")};return r(),t.addEventListener("input",r),t.setAttribute("maxlength",String(s)),()=>{t.removeEventListener("input",r),t.removeAttribute("maxlength"),t.removeAttribute("aria-describedby"),t.removeAttribute("aria-invalid"),t.removeAttribute("data-error")}},[n,s]),i.jsx("small",{className:y.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",e>=s&&"text-destructive",e<s&&"text-current"),role:"status",children:i.jsxs("span",{id:`${n}-character-count`,children:[e," / ",s," characters"]})})}function fe(n,s){u.useEffect(()=>{const e=document.getElementById(n);if(!e)return;if(!s){e.style.height="auto";return}const o=()=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`};return o(),e.addEventListener("input",o),e.addEventListener("resize",o),window.addEventListener("resize",o),()=>{e.removeEventListener("input",o),e.removeEventListener("resize",o),window.removeEventListener("resize",o)}},[n,s])}const me={base:"","left-line":"border-l border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",outline:"border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success"},be={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},V={variant:"outline",rounded:"none"};function he({variant:n=V.variant,rounded:s,displayOnlyMode:e=!1,errorMessage:o,successMessage:t,hideResizeHandle:r=!1,autoExpand:a=!1,characterLimit:d=0,className:c,...f}){const m=u.useId();fe(m,a||e);let l=s;n==="outline"&&!s&&(l="md"),l=l||V.rounded;let p=r;(e||n==="left-line"&&!r)&&(p=!0);const b=y.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",!e&&me[n],!e&&be[l],!e&&"px-2 py-1",e&&"pointer-events-none",p&&"no-resize-handle",c);return i.jsxs("div",{className:y.join("-space-y-1.5",e&&"cursor-text"),children:[i.jsx("textarea",{...f,id:m,"aria-disabled":f.disabled,readOnly:e,"aria-readonly":e||f["aria-readonly"],style:{resize:a?"none":void 0},className:b}),d>0&&i.jsx(ce,{elementId:m,maxLength:d}),!e&&i.jsx(D,{elementId:m,type:"error",message:o}),!e&&i.jsx(D,{elementId:m,type:"success",message:t})]})}const k=8,$=4,C=6;function xe(n){return{calculatePosition:u.useCallback((e,o)=>{const t=e.getBoundingClientRect(),r=o.getBoundingClientRect(),a={width:window.innerWidth,height:window.innerHeight},d=(p,h,b,v)=>p<0||h<0||p+b>a.width||h+v>a.height,c={top:{x:t.left+t.width/2-r.width/2,y:t.top-r.height-$,arrow:{x:r.width/2-C,y:r.height}},bottom:{x:t.left+t.width/2-r.width/2,y:t.bottom+$,arrow:{x:r.width/2-C,y:-6}},left:{x:t.left-r.width-$,y:t.top+t.height/2-r.height/2,arrow:{x:r.width,y:r.height/2-C}},right:{x:t.right+$,y:t.top+t.height/2-r.height/2,arrow:{x:-6,y:r.height/2-C}}};let f=n,m=c[n];if(d(m.x,m.y,r.width,r.height)){const p={top:"bottom",bottom:"top",left:"right",right:"left"},h=c[p[n]];if(!d(h.x,h.y,r.width,r.height))f=p[n],m=h;else{const b=["top","bottom","left","right"].filter(v=>v!==n&&v!==p[n]);for(const v of b){const x=c[v];if(!d(x.x,x.y,r.width,r.height)){f=v,m=x;break}}}}m.x=Math.max(k,Math.min(m.x,a.width-r.width-k)),m.y=Math.max(k,Math.min(m.y,a.height-r.height-k));const l={x:t.left+t.width/2,y:t.top+t.height/2};return f==="top"||f==="bottom"?m.arrow.x=Math.max(C,Math.min(l.x-m.x-C,r.width-C*2)):m.arrow.y=Math.max(C,Math.min(l.y-m.y-C,r.height-C*2)),{...m,placement:f}},[n])}}function ge(n,s,e){const o=u.useRef(null),t=u.useRef(null),r=u.useCallback(()=>{if(!o.current||!t.current)return;const a=n(o.current,t.current);e(a)},[n,e]);return u.useEffect(()=>{if(!s)return;const a=()=>r();return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,r]),{triggerRef:o,tooltipRef:t,updatePosition:r}}function pe(n,s,e,o,t,r,a,d,c){const f=u.useRef(null),m=u.useCallback(()=>{n||(f.current&&clearTimeout(f.current),f.current=window.setTimeout(()=>{e(!0),requestAnimationFrame(()=>{t(),o(!0)})},s))},[n,s,e,t,o]),l=u.useCallback((p=!1)=>{if(f.current&&clearTimeout(f.current),p){o(!1),setTimeout(()=>e(!1),150);return}f.current=window.setTimeout(()=>{o(!1),setTimeout(()=>e(!1),150)},100)},[o,e]);return u.useEffect(()=>{!r&&!a&&!d&&c&&l()},[r,a,d,c,l]),u.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{showTooltip:m,hideTooltip:l,timeoutRef:f}}function ve({id:n,children:s,message:e,placement:o="top",disabled:t=!1,delay:r=200,className:a}){const[d,c]=u.useState(!1),[f,m]=u.useState(!1),[l,p]=u.useState(null),[h,b]=u.useState(!1),[v,x]=u.useState(!1),[w,g]=u.useState(!1),{calculatePosition:j}=xe(o),{triggerRef:N,tooltipRef:L,updatePosition:z}=ge(j,f,p),{showTooltip:I,hideTooltip:A,timeoutRef:F}=pe(t,r,m,c,z,h,v,w,d),_=u.useId(),H=n??_;return i.jsxs(i.Fragment,{children:[u.cloneElement(s,{ref:B=>{N.current=B},onMouseEnter:()=>{b(!0),I()},onMouseLeave:()=>{b(!1)},onFocus:()=>{g(!0),I()},onBlur:()=>{g(!1),A(!0)},onKeyDown:B=>{B.key==="Escape"&&A(!0)},"aria-describedby":t?void 0:H}),f&&K.createPortal(i.jsx("div",{ref:L,id:H,role:"tooltip",className:y.join("fixed z-50 px-2 py-1 text-sm rounded shadow-lg pointer-events-auto transition-all duration-150 ease-out",d?"opacity-100":"opacity-0",a),style:l?{left:l.x,top:l.y}:{opacity:0},onMouseEnter:()=>{x(!0),F.current&&clearTimeout(F.current)},onMouseLeave:()=>{x(!1)},children:e}),document.body)]})}exports.ActionModal=S.ActionModal;exports.Accordion=Q;exports.AccordionItem=T;exports.Button=W;exports.ButtonLoadingDots=M;exports.Checkbox=O;exports.Clickable=P;exports.Input=re;exports.Label=oe;exports.Modal=ie;exports.RadioGroup=le;exports.RadioGroupItem=R;exports.RadioInput=U;exports.Slot=de;exports.Textarea=he;exports.Tooltip=ve;
2
2
  //# sourceMappingURL=components.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.cjs.js","sources":["../src/components/accordion/AccordionItem.tsx","../src/components/accordion/Accordion.tsx","../src/components/button/LoadingDots.tsx","../src/components/button/variants.ts","../src/components/button/Button.tsx","../src/components/checkbox/hooks.ts","../src/components/checkbox/Checkbox.tsx","../src/components/clickable/Clickable.tsx","../src/shared/forms/StatusHelpMessage.tsx","../src/components/input/variants.ts","../src/components/input/Input.tsx","../src/components/label/Label.tsx","utils.esm.js","../src/components/modal/hooks.ts","../src/components/modal/Modal.tsx","../src/components/slot/Slot.tsx","../src/components/radiogroup/RadioInput.tsx","../src/components/radiogroup/RadioGroupItem.tsx","../src/components/radiogroup/hooks.ts","../src/components/radiogroup/RadioGroup.tsx","../src/components/textarea/CharacterCount.tsx","../src/components/textarea/hooks.ts","../src/components/textarea/variants.ts","../src/components/textarea/Textarea.tsx"],"sourcesContent":["import { useId } from 'react';\nimport { ChevronDown } from '../../symbols';\nimport { join } from '../../utils';\nimport { AccordionOption } from './Accordion';\n\nexport interface AccordionItemProps extends Omit<AccordionOption, 'defaultOpen'> {\n children?: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n onToggle?: () => void;\n triggerClassName?: string;\n bodyClassName?: string;\n}\n\nexport function AccordionItem({\n id,\n title,\n content,\n children,\n className = '',\n disabled = false,\n isOpen = false,\n onToggle,\n triggerClassName = '',\n bodyClassName = '',\n}: AccordionItemProps) {\n const fallbackId = useId();\n const itemId = id || `accordion-item-${fallbackId}`;\n const headerId = `${itemId}-header`;\n const panelId = `${itemId}-panel`;\n\n const handleToggle = () => {\n if (!disabled && onToggle) {\n onToggle();\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleToggle();\n }\n };\n\n return (\n <div className={join('border-b border-gray-200', disabled && 'opacity-60 cursor-not-allowed', className)}>\n <button\n id={headerId}\n type='button'\n className={join(\n 'w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary',\n disabled ? 'cursor-not-allowed' : 'hover:bg-gray-50/10 cursor-pointer',\n triggerClassName\n )}\n aria-expanded={isOpen}\n aria-controls={panelId}\n disabled={disabled}\n onClick={handleToggle}\n onKeyDown={handleKeyDown}\n >\n <span>{title}</span>\n <span\n className={join(\n 'transform transition-transform duration-300 ease-linear',\n isOpen ? 'rotate-180' : 'rotate-0'\n )}\n aria-hidden='true'\n >\n <ChevronDown size={18} />\n </span>\n </button>\n\n <div\n id={panelId}\n role='region'\n aria-labelledby={headerId}\n className={join(\n 'transition-all duration-300 ease-linear px-4',\n isOpen ? 'max-h-96 opacity-100 overflow-auto py-3' : 'max-h-0 opacity-0 overflow-hidden',\n bodyClassName\n )}\n >\n {isOpen && (children || content)}\n </div>\n </div>\n );\n}\n","import React, { useId, useState } from 'react';\nimport { join } from '../../utils';\nimport { AccordionItem, AccordionItemProps } from './AccordionItem';\n\nexport interface AccordionOption {\n id?: string;\n title: React.ReactNode;\n content: React.ReactNode;\n disabled?: boolean;\n defaultOpen?: boolean;\n}\n\nexport interface AccordionProps {\n id?: string;\n items?: AccordionOption[];\n children?: React.ReactElement<AccordionItemProps>[] | React.ReactElement<AccordionItemProps>;\n className?: string;\n itemClassName?: string;\n allowMultiple?: boolean;\n defaultOpenItems?: string[];\n triggersClassName?: string;\n bodiesClassName?: string;\n}\n\nexport function Accordion({\n id,\n items = [],\n children,\n className = '',\n itemClassName = '',\n allowMultiple = false,\n defaultOpenItems = [],\n triggersClassName = '',\n bodiesClassName = '',\n}: AccordionProps) {\n const groupId = useId();\n const groupName = id || `accordion-group-${groupId}`;\n const [openItems, setOpenItems] = useState<Set<string>>(new Set(defaultOpenItems));\n\n const toggleItem = (itemId: string) => {\n setOpenItems((prev) => {\n const newOpenItems = new Set(prev);\n\n if (newOpenItems.has(itemId)) {\n newOpenItems.delete(itemId);\n } else {\n if (!allowMultiple) {\n newOpenItems.clear();\n }\n newOpenItems.add(itemId);\n }\n\n return newOpenItems;\n });\n };\n\n const getItemId = (index: number) => `${groupId}-item-${index}`;\n const isItemOpen = (itemId: string) => openItems.has(itemId);\n\n return (\n <div id={groupName} className={className}>\n {/* Render from items prop */}\n {items.length > 0 &&\n items.map((item, index) => {\n const itemId = item.id || getItemId(index);\n return (\n <AccordionItem\n key={itemId}\n id={itemId}\n title={item.title}\n content={item.content}\n disabled={item.disabled}\n isOpen={isItemOpen(itemId)}\n onToggle={() => toggleItem(itemId)}\n className={itemClassName}\n triggerClassName={triggersClassName}\n bodyClassName={bodiesClassName}\n />\n );\n })}\n\n {/* Render AccordionItem components */}\n {items.length === 0 &&\n children &&\n React.Children.map(children, (child, index) => {\n if (React.isValidElement<AccordionItemProps>(child) && child.type === AccordionItem) {\n const itemId = child.props.id || getItemId(index);\n return (\n <AccordionItem\n {...child.props}\n key={itemId}\n id={itemId}\n className={join(itemClassName, child.props.className)}\n isOpen={isItemOpen(itemId)}\n onToggle={() => toggleItem(itemId)}\n triggerClassName={join(triggersClassName, child.props.triggerClassName)}\n bodyClassName={join(bodiesClassName, child.props.bodyClassName)}\n />\n );\n }\n return null;\n })}\n </div>\n );\n}\n","import { useEffect, useState } from 'react';\nimport { join } from '../../utils';\n\nexport default function LoadingDots() {\n const [activeIndex, setActiveIndex] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setActiveIndex((prevIndex) => (prevIndex + 1) % 3);\n }, 500);\n\n return () => clearInterval(interval);\n }, []);\n\n return (\n <div className='absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle'>\n {[0, 1, 2].map((index) => (\n <div\n key={index}\n className={join(\n 'rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current',\n activeIndex === index && 'transform -translate-y-1'\n )}\n />\n ))}\n </div>\n );\n}\n","export const buttonVariants = {\n base: '',\n primary: 'bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-muted disabled:text-muted-foreground',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/85 disabled:bg-muted/80 disabled:text-muted-foreground/80',\n tertiary: 'text-primary hover:text-primary-foreground disabled:text-muted',\n outline: 'border border-primary text-primary hover:border-primary-foreground hover:text-primary-foreground disabled:border-muted disabled:text-muted',\n link: 'underline-offset-4 hover:underline disabled:underline disabled:text-muted',\n danger: 'bg-danger text-danger-foreground hover:bg-danger/85 disabled:bg-muted disabled:text-muted-foreground',\n} as const;\nexport type ButtonVariant = keyof typeof buttonVariants;\n\nexport const sizeVariants = {\n stripped: '',\n fitted: 'size-fit',\n sm: 'px-2 py-1 text-sm',\n md: 'px-4 py-2 text-base',\n lg: 'px-6 py-3 text-lg',\n icon: 'p-1 w-fit aspect-square',\n full: 'p-2 w-full',\n} as const;\nexport type ButtonSize = keyof typeof sizeVariants;\n\nexport const roundedVariants = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'rounded-full',\n} as const;\nexport type ButtonRounded = keyof typeof roundedVariants;\n\nexport interface ButtonVariants {\n variant: ButtonVariant;\n size: ButtonSize;\n rounded: ButtonRounded;\n}\n\nexport const buttonDefaults: ButtonVariants = {\n variant: 'primary',\n size: 'md',\n rounded: 'md',\n} as const;\n","// Button.tsx\nimport { ButtonHTMLAttributes, Ref } from 'react';\nimport { join } from '../../utils';\nimport LoadingDots from './LoadingDots';\nimport { ButtonSize, ButtonVariants, buttonDefaults, buttonVariants, roundedVariants, sizeVariants } from './variants';\n\nexport interface ButtonProps extends Partial<ButtonVariants>, ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: Ref<HTMLButtonElement>;\n loading?: boolean;\n linkTo?: string;\n linkProps?: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n}\n\nexport default function Button({\n variant = buttonDefaults.variant,\n size,\n rounded = buttonDefaults.rounded,\n loading,\n linkTo,\n linkProps,\n type = 'button',\n className,\n ...rest\n}: ButtonProps) {\n let adjustedSize: ButtonSize;\n if (variant === 'link' && !size) {\n // default links to fitted size\n adjustedSize = 'fitted';\n } else {\n adjustedSize = size || buttonDefaults.size;\n }\n\n const baseClasses =\n 'appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all';\n\n const buttonClasses = join(\n baseClasses,\n buttonVariants[variant],\n sizeVariants[adjustedSize],\n roundedVariants[rounded],\n loading && 'relative pointer-events-none',\n linkTo && 'relative',\n className\n );\n\n return (\n <button\n {...rest}\n role={linkTo ? 'link' : rest.role}\n aria-label={rest['aria-label'] || linkProps?.['aria-label']}\n aria-description={rest['aria-description'] || linkProps?.['aria-description']}\n aria-disabled={rest.disabled || loading}\n aria-busy={loading}\n type={type}\n className={buttonClasses}\n >\n {loading && <LoadingDots />}\n <span className={join(loading && 'invisible')}>{rest.children}</span>\n\n {linkTo && !rest.disabled && (\n <a\n {...linkProps}\n aria-hidden={true} // Hide from screen readers since the button is already accessible\n href={linkTo}\n target={linkProps?.target || '_blank'}\n rel={linkProps?.rel || 'noreferrer'}\n className='absolute inset-0'\n />\n )}\n </button>\n );\n}\n","import { useCallback, useEffect, useState } from 'react';\n\nexport function useFilledBackgroundColor(id: string) {\n const [filledBackgroundColor, setFilledBackgroundColor] = useState<string>('');\n\n const getFirstNonTransparentBackgroundColor = useCallback((element: Element | null): string => {\n let currentElement = element;\n let color = '';\n while (currentElement && !color) {\n const backgroundColor = window.getComputedStyle(currentElement).backgroundColor;\n if (backgroundColor && backgroundColor !== 'transparent' && backgroundColor !== 'rgba(0, 0, 0, 0)') {\n color = backgroundColor;\n }\n currentElement = currentElement.parentElement;\n }\n return color || 'transparent';\n }, []);\n\n useEffect(() => {\n const checkbox = document.getElementById(id);\n if (checkbox) {\n const backgroundColor = getFirstNonTransparentBackgroundColor(checkbox.parentElement);\n setFilledBackgroundColor(backgroundColor);\n }\n }, [id, getFirstNonTransparentBackgroundColor]);\n\n return filledBackgroundColor;\n}\n","import React, { Ref, useEffect, useId, useMemo, useState } from 'react';\nimport Check from '../../symbols/Check';\nimport { join } from '../../utils';\nimport { useFilledBackgroundColor } from './hooks';\n\nexport interface CheckboxProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: Ref<HTMLButtonElement>;\n size?: number;\n color?: string; // can be adjusted with tailwindcss by using `text-<color>`\n filled?: boolean;\n rounded?: boolean;\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nexport default function Checkbox({\n ref,\n id,\n size = 20,\n color,\n filled = false,\n rounded = true,\n checked = false,\n onCheckedChange,\n disabled,\n className = '',\n ...props\n}: CheckboxProps) {\n const generatedId = useId();\n const checkboxId = useMemo(() => id || `checkbox-${generatedId}`, [id, generatedId]);\n const parentBackgroundColor = useFilledBackgroundColor(checkboxId);\n const [isChecked, setIsChecked] = useState(checked);\n\n useEffect(() => {\n setIsChecked(checked);\n }, [checked]);\n\n const handleChange = () => {\n if (!disabled) {\n setIsChecked(!isChecked);\n onCheckedChange?.(!isChecked);\n }\n };\n\n const handleOnKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === ' ') {\n e.preventDefault();\n handleChange();\n }\n };\n\n const checkboxClasses = join(\n 'flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2',\n rounded && 'rounded',\n disabled && 'opacity-40 cursor-not-allowed',\n !disabled && 'cursor-pointer',\n className\n );\n\n return (\n <button\n id={checkboxId}\n type='button'\n ref={ref}\n tabIndex={0}\n role='checkbox'\n onClick={handleChange}\n aria-checked={isChecked}\n aria-disabled={disabled}\n onKeyDownCapture={handleOnKeyDown}\n style={{\n width: size,\n height: size,\n color: color,\n backgroundColor: isChecked && filled ? 'currentcolor' : 'transparent',\n }}\n className={checkboxClasses}\n {...props}\n >\n {isChecked && <Check size={size} color={filled ? parentBackgroundColor : undefined} />}\n </button>\n );\n}\n","import { join } from '../../utils';\n\ninterface ClickableProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onClick'> {\n children: React.ReactNode;\n linkTo?: React.HTMLProps<HTMLAnchorElement>['href'];\n linkProps?: Omit<React.HTMLProps<HTMLAnchorElement>, 'href'>;\n onButtonClick?: React.HTMLProps<HTMLButtonElement>['onClick'];\n buttonProps?: Omit<React.HTMLProps<HTMLButtonElement>, 'onClick'>;\n}\n\nexport default function Clickable({\n children,\n className,\n linkTo,\n linkProps,\n onButtonClick,\n buttonProps,\n ...props\n}: ClickableProps) {\n if (linkTo && onButtonClick) {\n console.warn('Clickable: Both \"linkTo\" and \"onButtonClick\" props are provided. Only \"linkTo\" will be used.');\n }\n\n return (\n <div className={join('relative w-fit', className)} {...props}>\n {children}\n\n {/* Link */}\n {linkTo && (\n <a\n {...linkProps}\n href={linkTo}\n className={join('absolute inset-0', linkProps?.className)}\n />\n )}\n\n {/* Button */}\n {!linkTo && onButtonClick && (\n <button\n {...buttonProps}\n type='button'\n onClick={onButtonClick}\n className={join('absolute inset-0 cursor-pointer', buttonProps?.className)}\n />\n )}\n </div>\n );\n}\n","import { useEffect } from 'react';\nimport { CheckCircled, ExclamationTriangle } from '../../symbols';\nimport { join } from '../../utils';\n\ninterface StatusHelpMessageProps {\n elementId: string;\n type: 'error' | 'success';\n message?: string;\n}\n\nexport default function StatusHelpMessage({ elementId, type, message }: StatusHelpMessageProps) {\n useEffect(() => {\n const element = document.getElementById(elementId) as HTMLElement;\n if (!element) {\n return;\n }\n if (!message && type === 'error') {\n element.removeAttribute('data-error');\n return;\n }\n if (!message && type === 'success') {\n element.removeAttribute('data-success');\n return;\n }\n\n element.setAttribute('aria-describedby', `${elementId}-${type}-message`);\n element.setAttribute('aria-invalid', type === 'error' ? 'true' : 'false');\n\n if (type === 'error') {\n element.setAttribute('data-error', 'true');\n }\n if (type === 'success') {\n element.setAttribute('data-success', 'true');\n }\n\n return () => {\n element.removeAttribute('aria-describedby');\n element.removeAttribute('aria-invalid');\n element.removeAttribute('data-error');\n element.removeAttribute('data-success');\n };\n }, [elementId, type, message]);\n\n if (!message) {\n return null;\n }\n\n return (\n <small\n className={join(\n 'mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start',\n type === 'error' && 'text-danger',\n type === 'success' && 'text-success'\n )}\n role='status'\n >\n {type === 'error' ? <ExclamationTriangle /> : <CheckCircled />}\n <span id={`${elementId}-${type}-message`}>{message}</span>\n </small>\n );\n}\n","export const inputVariants = {\n base: '',\n default:\n 'ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-danger not-disabled:data-success:ring-success',\n underline:\n 'border-b border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success',\n outline:\n 'border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success',\n} as const;\nexport type InputVariant = keyof typeof inputVariants;\n\nexport const roundedVariants = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'px-3 rounded-full',\n} as const;\nexport type InputRounded = keyof typeof roundedVariants;\n\nexport interface InputVariants {\n variant: InputVariant;\n rounded: InputRounded;\n}\n\nexport const inputDefaults: InputVariants = {\n variant: 'default',\n rounded: 'none',\n} as const;\n","import { Ref, useId, useState } from 'react';\nimport { StatusHelpMessage } from '../../shared/forms';\nimport { EyeClosed, EyeOpened } from '../../symbols';\nimport { join } from '../../utils';\nimport './styles.css';\nimport { inputDefaults, inputVariants, InputVariants, roundedVariants } from './variants';\n\ninterface InputProps extends Partial<InputVariants>, React.InputHTMLAttributes<HTMLInputElement> {\n ref?: Ref<HTMLInputElement>;\n displayOnlyMode?: boolean;\n errorMessage?: string;\n successMessage?: string;\n}\n\nexport default function Input({\n variant = inputDefaults.variant,\n rounded,\n displayOnlyMode = false,\n errorMessage,\n successMessage,\n type = 'text',\n className,\n ...rest\n}: InputProps) {\n const id = useId();\n const [showPassword, setShowPassword] = useState(false);\n\n // Default `round` of `md` for `outline` variant\n let adjustedRound = rounded;\n if (variant === 'outline' && !rounded) {\n adjustedRound = 'md';\n }\n adjustedRound = adjustedRound || inputDefaults.rounded;\n\n const baseClasses =\n 'appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all';\n const fileClasses =\n 'file:mr-2 file:border-0 file:rounded-md file:px-1.5 file:py-1 file:bg-primary hover:file:bg-primary/85 file:text-sm file:font-medium file:text-foreground file:transition-colors';\n\n const inputClasses = join(\n baseClasses,\n fileClasses,\n !displayOnlyMode && inputVariants[variant],\n !displayOnlyMode && roundedVariants[adjustedRound],\n type === 'password' && 'pr-10',\n !displayOnlyMode && 'px-2 py-1',\n displayOnlyMode && 'pointer-events-none',\n className\n );\n\n return (\n <div className={join(displayOnlyMode && 'cursor-text')} style={{ height: rest.height, width: rest.width }}>\n <div className={join(type === 'password' && 'relative')}>\n <input\n {...rest}\n id={id}\n type={type === 'password' && showPassword ? 'text' : type}\n aria-disabled={rest.disabled}\n readOnly={displayOnlyMode}\n aria-readonly={displayOnlyMode || rest['aria-readonly']}\n data-error={errorMessage ? true : undefined}\n data-success={successMessage ? true : undefined}\n className={inputClasses}\n />\n {type === 'password' && (\n <button\n onClick={() => setShowPassword(!showPassword)}\n className='absolute inset-y-0 right-0 px-2 hover:cursor-pointer'\n aria-label='Toggle password visibility'\n data-state={showPassword ? 'visible' : 'hidden'}\n >\n {showPassword ? <EyeOpened size={20} /> : <EyeClosed size={20} />}\n </button>\n )}\n </div>\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='error' message={errorMessage} />}\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='success' message={successMessage} />}\n </div>\n );\n}\n","import React, { useId } from 'react';\nimport { QuestionMarkCircled } from '../../symbols';\nimport { join } from '../../utils';\n\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n display?: 'block' | 'inline';\n width?: React.CSSProperties['width'];\n required?: boolean;\n helpMessage?: string;\n suffix?: React.ReactNode;\n}\n\nexport function Label({\n display = 'inline',\n width = 'fit-content',\n className = '',\n required,\n helpMessage,\n suffix,\n htmlFor,\n children,\n ...props\n}: LabelProps) {\n const id = useId();\n const labelClasses = join('font-medium', display, className);\n const helpId = helpMessage ? `${htmlFor ?? id}-help` : undefined;\n\n return (\n <div style={{ display: display === 'inline' ? 'inline-flex' : 'flex', width }} className='relative'>\n <label className={labelClasses} htmlFor={htmlFor} {...props}>\n {children}\n {required && (\n <span className='text-red-500 font-medium ml-1' aria-label='required'>\n *\n </span>\n )}\n </label>\n {helpMessage && (\n <span\n className='text-gray-500 ml-1 size-fit -translate-y-1/3'\n aria-describedby={helpId}\n aria-label='Help information'\n title={helpMessage}\n >\n <QuestionMarkCircled />\n </span>\n )}\n {helpMessage && (\n <div id={helpId} className='sr-only'>\n {helpMessage}\n </div>\n )}\n {suffix && <span className='ml-1'>{suffix}</span>}\n </div>\n );\n}\n","function n(...t) {\n return t.filter((s) => typeof s == \"string\" && s).join(\" \").trim() || void 0;\n}\nexport {\n n as join\n};\n//# sourceMappingURL=utils.esm.js.map\n","import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport function useAnimationOpenClose(isOpen: boolean) {\n const [show, setShow] = useState(false);\n const [shouldRender, setShouldRender] = useState(false);\n\n useEffect(() => {\n if (isOpen) {\n setShouldRender(true);\n setTimeout(() => setShow(true), 10);\n } else {\n setShow(false);\n setTimeout(() => setShouldRender(false), 150);\n }\n }, [isOpen]);\n\n return { show, shouldRender };\n}\n\nexport function useDocumentChanges(isOpen: boolean, onClose: () => void) {\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && isOpen) {\n onClose();\n }\n };\n\n document.addEventListener('keydown', handleEscape);\n // Prevent background scrolling when modal is open\n if (isOpen) {\n document.body.style.overflow = 'hidden';\n }\n\n return () => {\n document.removeEventListener('keydown', handleEscape);\n document.body.style.overflow = 'auto';\n };\n }, [isOpen, onClose]);\n}\n\nexport function useHandleFocus(modalId: string, isOpen: boolean) {\n const previousActiveElement = useRef<Element | null>(null);\n\n const focusAppropriateElement = useCallback(() => {\n const modalElement = document.getElementById(modalId);\n if (!modalElement) return;\n\n // 1. First, try to focus on the first action button, if available\n const modalActions = modalElement.querySelectorAll('[data-modal-action=\"true\"]');\n if (modalActions.length > 0) {\n (modalActions[0] as HTMLElement).focus();\n return;\n }\n\n // 2. Then try first focusable element in content (giving preference to non-close button)\n const focusableElements = modalElement.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n\n if (focusableElements.length > 0) {\n const allBesidesCloseButton = Array.from(focusableElements).filter((el) => {\n return !(el instanceof HTMLButtonElement && el.getAttribute('data-modal-close-button') === 'true');\n });\n\n if (allBesidesCloseButton.length > 0) {\n (allBesidesCloseButton[0] as HTMLElement).focus();\n return;\n }\n\n (focusableElements[0] as HTMLElement).focus();\n return;\n }\n\n // 3. Fallback to modal container\n modalElement.focus();\n }, [modalId]);\n\n useEffect(() => {\n if (isOpen) {\n // Store the currently focused element to restore focus later\n previousActiveElement.current = document.activeElement;\n\n focusAppropriateElement();\n }\n\n return () => {\n document.body.style.overflow = 'auto';\n\n // Restore focus to the previously focused element when modal closes\n if (previousActiveElement.current instanceof HTMLElement) {\n previousActiveElement.current.focus();\n }\n };\n }, [isOpen, focusAppropriateElement]);\n}\n","import { join } from '@moondreamsdev/dreamer-ui/utils';\nimport React, { useId } from 'react';\nimport { createPortal } from 'react-dom';\nimport { X } from '../../symbols';\nimport { Button, ButtonProps } from '../button';\nimport { useAnimationOpenClose, useDocumentChanges, useHandleFocus } from './hooks';\n\ninterface ModalAction extends Omit<ButtonProps, 'children'> {\n label: string;\n}\n\nexport interface ModalProps {\n id?: string;\n isOpen: boolean;\n onClose: () => void;\n title?: React.ReactNode;\n children: React.ReactNode;\n contentOnly?: boolean;\n className?: string;\n overlayClassName?: string;\n hideCloseButton?: boolean;\n actions?: ModalAction[];\n disableCloseOnOverlayClick?: boolean;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n}\n\nexport function Modal({\n id,\n isOpen,\n onClose,\n title,\n children,\n contentOnly = false,\n className,\n overlayClassName,\n hideCloseButton = false,\n actions = [],\n disableCloseOnOverlayClick = false,\n ariaLabelledBy,\n ariaDescribedBy,\n}: ModalProps) {\n const generatedId = useId();\n const modalId = id || `modal-${generatedId}`;\n const titleId = id ? `${id}-title` : `modal-title-${generatedId}`;\n\n const { show, shouldRender } = useAnimationOpenClose(isOpen);\n useHandleFocus(modalId, shouldRender);\n useDocumentChanges(shouldRender, onClose);\n\n if (!shouldRender) return null;\n\n const renderTitle = () => {\n if (!title) return null;\n\n if (React.isValidElement(title)) {\n return <div className='mb-4'>{title}</div>;\n }\n\n return (\n <h2 className='mb-4 text-xl font-semibold' id={titleId}>\n {title}\n </h2>\n );\n };\n\n const renderActions = () => {\n if (actions.length === 0) return null;\n\n return (\n <div className='mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3'>\n {actions.map((action, index) => {\n const { label, className, ...buttonProps } = action;\n return (\n <Button key={index} className={className} type='button' {...buttonProps} data-modal-action='true'>\n {label}\n </Button>\n );\n })}\n </div>\n );\n };\n\n return (\n <>\n {createPortal(\n <div\n aria-labelledby={ariaLabelledBy ?? title ? titleId : undefined}\n aria-describedby={ariaDescribedBy}\n role='dialog'\n aria-modal='true'\n className='fixed inset-0 z-[100] overflow-y-auto'\n >\n <div className='flex min-h-screen items-center justify-center p-4'>\n <div\n className={join('fixed inset-0 bg-black/20 transition-all', overlayClassName)}\n onClick={() => {\n if (!disableCloseOnOverlayClick) {\n onClose();\n }\n }}\n />\n\n {contentOnly && <div className={join('relative w-fit', className)}>{children}</div>}\n\n {!contentOnly && (\n <div\n id={modalId}\n tabIndex={-1}\n className={join(\n 'relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:border ease-in duration-75',\n show ? 'opacity-100 scale-100' : 'opacity-0 scale-90',\n className\n )}\n >\n {!hideCloseButton && (\n <button\n type='button'\n onClick={onClose}\n data-modal-close-button='true'\n className='rounded-md p-0.5 top-2.5 right-2.5 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0'\n >\n <X size={18} />\n </button>\n )}\n\n {renderTitle()}\n\n {children}\n\n {renderActions()}\n </div>\n )}\n </div>\n </div>,\n document.body\n )}\n </>\n );\n}\n","import React, {\n cloneElement,\n createElement,\n HTMLAttributes,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n} from 'react';\n\ninterface SlotProps<T> extends HTMLAttributes<T> {\n children?: ReactNode;\n ref?: Ref<T>;\n}\n\nexport function Slot<T = HTMLElement>({ children, ref, ...props }: SlotProps<T>) {\n\n if (isValidElement(children)) {\n let allProps = { ...props };\n if (children.props) {\n allProps = { ...allProps, ...children.props };\n }\n return cloneElement(children, {\n ...allProps,\n ref: (node: T) => {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n (ref as React.RefObject<T>).current = node;\n }\n },\n } as unknown as ReactElement);\n }\n\n // If not asChild or no valid child, render as div\n return createElement('div', { ...props, ref }, children);\n}\n","import { join } from '../../utils';\n\nexport type RadioInputProps = {\n itemId: string;\n checked: boolean;\n onChange: () => void;\n name: string;\n disabled?: boolean;\n className?: string;\n};\n\n// Custom RadioInput Component\nexport function RadioInput({ itemId, checked, onChange, name, disabled = false, className = '' }: RadioInputProps) {\n const baseClasses = 'relative inline-flex items-center justify-center rounded-full';\n\n const handleClick = () => {\n if (disabled) return;\n onChange();\n };\n\n const radioClasses = join(\n baseClasses,\n !checked && 'hover:border-current/60',\n !disabled && 'border-current cursor-pointer',\n disabled && 'border-muted/60 cursor-not-allowed',\n className\n );\n return (\n <div\n id={itemId}\n role='radio'\n tabIndex={-1} // necessary so that the radio button can be focused as div is not a focusable element\n aria-checked={checked}\n aria-disabled={disabled}\n aria-description={`Radio button for ${name}`}\n aria-labelledby={`${itemId}-label`}\n onClick={handleClick}\n className={radioClasses}\n style={{\n width: '1em',\n height: '1em',\n padding: '0.1em',\n borderWidth: '0.06em',\n }}\n >\n {checked && (\n <div\n className={join(`size-full aspect-square rounded-full`, disabled && 'bg-muted/60', !disabled && 'bg-current')}\n />\n )}\n </div>\n );\n}\n","import { useId } from 'react';\nimport { join } from '../../utils';\nimport { RadioInput } from './RadioInput';\n\nexport interface RadioGroupItemProps {\n value: string;\n children: React.ReactNode;\n className?: string;\n isSelected?: boolean;\n onChange?: (value: string) => void;\n disabled?: boolean;\n name?: string;\n hideInput?: boolean;\n description?: string;\n}\n\nexport function RadioGroupItem({\n value,\n children,\n className = '',\n isSelected = false,\n onChange,\n disabled = false,\n hideInput = false,\n description,\n name,\n}: RadioGroupItemProps) {\n const id = useId();\n const itemId = `radio-${id}-${value}`;\n\n const handleChange = () => {\n if (!disabled) {\n onChange?.(value);\n }\n };\n\n return (\n <div\n title={description}\n className={join(\n 'relative flex items-center',\n className,\n // Uses text color for borders\n hideInput &&\n `p-2 border-2 focus-within:border-dashed focus-within:${\n disabled ? 'border-current/50' : 'border-current/80'\n }`,\n hideInput && !isSelected && `border-transparent ${disabled ? '' : 'not-focus-within:hover:border-border/60'}`,\n hideInput && isSelected && 'border-border',\n disabled && 'opacity-60 cursor-not-allowed'\n )}\n style={{\n gap: '0.5em',\n }}\n >\n {!hideInput && (\n <RadioInput\n itemId={itemId}\n name={name || ''}\n checked={isSelected}\n onChange={handleChange}\n disabled={disabled}\n className={join(hideInput && '')}\n />\n )}\n <div\n id={hideInput ? itemId : undefined}\n tabIndex={hideInput ? -1 : undefined}\n role={hideInput ? 'radio' : undefined}\n onClick={hideInput ? handleChange : undefined}\n aria-checked={!hideInput ? undefined : isSelected ? 'true' : 'false'}\n aria-disabled={hideInput ? disabled : undefined}\n aria-description={!hideInput ? undefined : description || `Radio button for ${name}`}\n aria-labelledby={hideInput ? `${itemId}-label` : undefined}\n className={join(hideInput && 'size-full', typeof children === 'object' && 'grow focus:outline-none')}\n >\n <label\n id={`${itemId}-label`}\n onClick={hideInput ? undefined : handleChange}\n className={join(disabled && 'cursor-not-allowed', !disabled && 'cursor-pointer')}\n >\n {children}\n </label>\n </div>\n </div>\n );\n}\n","import { useCallback, useEffect, useState } from 'react';\n\nexport function useRadioFocus(id: string, selectedOptionIndex: number) {\n // Manage state locally to avoid race conditions, which can result in\n // the an option failing to be selected or incorrectly selected\n const [focusedIndex, setFocusedIndex] = useState<number>(selectedOptionIndex);\n const [clickedIndex, setClickedIndex] = useState<number>(-1);\n // Prevent onClicks from triggering focus events and automatically selecting the first option\n const [isMouseDown, setIsMouseDown] = useState<boolean>(false);\n\n const handleClicked = useCallback((options: HTMLElement[], index: number) => {\n const target = options[index] as HTMLElement;\n\n // Check if the target element is disabled\n const isDisabled = target.hasAttribute('disabled') || target.getAttribute('aria-disabled') === 'true';\n if (isDisabled) return;\n\n // Update the selected index\n options[index]?.click();\n setClickedIndex(index);\n }, []);\n\n const setInitialFocus = useCallback(\n (e: Event, options: HTMLElement[]) => {\n e.preventDefault();\n if (isMouseDown) return;\n if (!options.length) return;\n\n const indexToFocus = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;\n options[indexToFocus]?.focus();\n setFocusedIndex(indexToFocus);\n\n // Only update the selected index if one is already set\n if (selectedOptionIndex !== -1) {\n handleClicked(options, indexToFocus);\n }\n },\n [selectedOptionIndex, isMouseDown, handleClicked]\n );\n\n /* Focus preceding element when Shift + Tab is pressed */\n const handleFocusPreceding = useCallback(\n (e: KeyboardEvent) => {\n // If the Shift key is not pressed while tab is entered, do nothing\n if (!e.shiftKey) {\n return;\n }\n\n e.preventDefault();\n const focusableElements = Array.from(\n document.querySelectorAll<HTMLElement>(\n 'a, button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])'\n )\n ).filter((el) => !el.hasAttribute('disabled') && el.tabIndex >= 0);\n const currentIndex = focusableElements.findIndex((el) => el.id === id);\n const previousIndex = currentIndex > 0 ? currentIndex - 1 : focusableElements.length - 1;\n focusableElements[previousIndex]?.focus();\n },\n [id]\n );\n\n const handleKeyboardNavigation = useCallback(\n (e: KeyboardEvent, options: HTMLElement[]) => {\n if (!options.length) return;\n\n // Ensure we only toggle options part of radio group\n const target = e.target as HTMLElement;\n const isGroupOption = options.some((option) => option.id === target.id);\n if (!isGroupOption) return;\n\n const currentIndex = focusedIndex !== -1 ? focusedIndex : 0;\n let newIndex = currentIndex;\n\n switch (e.key) {\n case 'ArrowUp':\n case 'ArrowLeft':\n e.preventDefault();\n newIndex = currentIndex > 0 ? currentIndex - 1 : options.length - 1;\n break;\n\n case 'ArrowDown':\n case 'ArrowRight':\n e.preventDefault();\n newIndex = (currentIndex + 1) % options.length;\n break;\n\n // Select the option when the space key is pressed\n case ' ':\n e.preventDefault();\n handleClicked(options, currentIndex);\n return;\n\n case 'Tab':\n handleFocusPreceding(e);\n return;\n\n default:\n return;\n }\n\n options[newIndex]?.focus();\n setFocusedIndex(newIndex);\n // Only update the selected index if one is already set\n if (clickedIndex !== -1) {\n handleClicked(options, newIndex);\n }\n },\n [focusedIndex, clickedIndex, handleFocusPreceding, handleClicked]\n );\n\n const getRadioOptions = useCallback((): HTMLElement[] => {\n const radioGroup = document.querySelector(`[id=\"${id}\"][role=\"radiogroup\"]`);\n if (!radioGroup) return [];\n\n return Array.from(radioGroup.querySelectorAll('[role=\"radio\"]'));\n }, [id]);\n\n useEffect(() => {\n const radioGroup = document.querySelector(`[id=\"${id}\"][role=\"radiogroup\"]`);\n if (!radioGroup) return;\n\n const options = getRadioOptions();\n const handleFocus = (e: Event) => setInitialFocus(e, options);\n const handleKeyDown = (e: KeyboardEvent) => handleKeyboardNavigation(e, options);\n const handleMouseDown = () => setIsMouseDown(true);\n const handleMouseUp = () => setIsMouseDown(false);\n\n document.addEventListener('keydown', handleKeyDown);\n radioGroup.addEventListener('focus', handleFocus);\n radioGroup.addEventListener('mousedown', handleMouseDown);\n document.addEventListener('mouseup', handleMouseUp); // place on document since mouseup event can occur outside of radio group\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n radioGroup.removeEventListener('focus', handleFocus);\n radioGroup.removeEventListener('mousedown', handleMouseDown);\n document.removeEventListener('mouseup', handleMouseUp);\n };\n }, [id, getRadioOptions, setInitialFocus, handleKeyboardNavigation]);\n}\n","import React, { useId, useMemo } from 'react';\nimport { join } from '../../utils';\nimport { RadioGroupItem, RadioGroupItemProps } from './RadioGroupItem';\nimport { useRadioFocus } from './hooks';\n\nexport type RadioOption = { label: string; value: string; disabled?: boolean; description?: string };\n\nexport type RadioGroupProps = {\n options?: (string | RadioOption)[];\n value: string | undefined;\n onChange: (value: string) => void;\n id?: string;\n children?: React.ReactElement<RadioGroupItemProps>[] | React.ReactElement<RadioGroupItemProps>;\n className?: string;\n childrenClassName?: string;\n hideInputs?: boolean;\n};\n\nexport function RadioGroup({\n options = [],\n value,\n onChange,\n id,\n children,\n className = '',\n childrenClassName = '',\n hideInputs = false,\n}: RadioGroupProps) {\n const groupId = useId();\n const groupName = id || `radio-group-${groupId}`;\n useRadioFocus(\n groupName,\n options.findIndex((option) => option === value)\n );\n\n // Check for duplicates if string options are provided\n const processedOptions = useMemo(() => {\n return options.reduce<RadioOption[]>((acc, option) => {\n if (typeof option === 'string') {\n // Check if we already have this string option\n if (!acc.some((item) => item.value === option)) {\n acc.push({ label: option, value: option });\n }\n } else {\n acc.push(option);\n }\n return acc;\n }, []);\n }, [options]);\n\n return (\n <div id={groupName} role='radiogroup' tabIndex={0} className={join(className, 'focus:outline-none')}>\n {/* Render from options prop */}\n {processedOptions.length > 0 &&\n processedOptions.map((option, index) => (\n <RadioGroupItem\n key={`${option.value}-${index}`}\n value={option.value}\n isSelected={value === option.value}\n onChange={onChange}\n name={groupName}\n disabled={option.disabled}\n description={option.description}\n hideInput={hideInputs}\n className={childrenClassName}\n >\n {option.label}\n </RadioGroupItem>\n ))}\n\n {/* Render RadioGroupItem components */}\n {processedOptions.length === 0 &&\n children &&\n React.Children.map(children, (child) => {\n // TypeScript enforces that child is a RadioGroupItem\n if (React.isValidElement(child) && child.type === RadioGroupItem) {\n return (\n <RadioGroupItem\n {...child.props}\n className={join(childrenClassName, child.props.className)}\n hideInput={child.props.hideInput || hideInputs}\n isSelected={value === child.props.value}\n onChange={onChange}\n name={groupName}\n >\n {child.props.children}\n </RadioGroupItem>\n );\n }\n return null;\n })}\n </div>\n );\n}\n","import { useEffect, useState } from 'react';\nimport { join } from '../../utils';\n\ninterface CharacterCountProps {\n elementId: string;\n maxLength: number;\n}\n\nexport default function CharacterCount({ elementId, maxLength }: CharacterCountProps) {\n const [characterCount, setCharacterCount] = useState(0);\n\n useEffect(() => {\n const textarea = document.getElementById(elementId) as HTMLTextAreaElement;\n if (!textarea) {\n return;\n }\n\n const updateCharacterCount = () => {\n const updatedCharacterCount = textarea.value.length;\n setCharacterCount(updatedCharacterCount);\n const isError = updatedCharacterCount >= maxLength;\n textarea.setAttribute('aria-describedby', `${elementId}-character-count`);\n textarea.setAttribute('aria-invalid', isError ? 'true' : 'false');\n\n if (isError) {\n textarea.setAttribute('data-error', 'true');\n } else {\n textarea.removeAttribute('data-error');\n }\n };\n\n updateCharacterCount();\n textarea.addEventListener('input', updateCharacterCount);\n textarea.setAttribute('maxlength', String(maxLength));\n\n return () => {\n textarea.removeEventListener('input', updateCharacterCount);\n textarea.removeAttribute('maxlength');\n textarea.removeAttribute('aria-describedby');\n textarea.removeAttribute('aria-invalid');\n textarea.removeAttribute('data-error');\n };\n }, [elementId, maxLength]);\n\n return (\n <small\n className={join(\n 'mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end',\n characterCount >= maxLength && 'text-danger',\n characterCount < maxLength && 'text-current'\n )}\n role='status'\n >\n <span id={`${elementId}-character-count`}>\n {characterCount} / {maxLength} characters\n </span>\n </small>\n );\n}\n","import { useEffect } from 'react';\n\nexport function useAutoExpand(id: string, autoExpand: boolean) {\n useEffect(() => {\n const textarea = document.getElementById(id) as HTMLTextAreaElement;\n if (!textarea) {\n return;\n }\n\n if (!autoExpand) {\n textarea.style.height = 'auto';\n return;\n }\n\n const adjustHeight = () => {\n // necessary to reset the height to `auto` before calculating the new height\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n };\n\n adjustHeight();\n textarea.addEventListener('input', adjustHeight);\n textarea.addEventListener('resize', adjustHeight);\n window.addEventListener('resize', adjustHeight);\n\n return () => {\n textarea.removeEventListener('input', adjustHeight);\n textarea.removeEventListener('resize', adjustHeight);\n window.removeEventListener('resize', adjustHeight);\n };\n }, [id, autoExpand]);\n}\n","export const textareaVariants = {\n base: '',\n 'left-line':\n 'border-l border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success',\n outline:\n 'border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success',\n} as const;\nexport type TextareaVariant = keyof typeof textareaVariants;\n\nexport const roundedVariants = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'px-3 rounded-full',\n} as const;\nexport type TextareaRounded = keyof typeof roundedVariants;\n\nexport interface TextareaVariants {\n variant: TextareaVariant;\n rounded: TextareaRounded;\n}\n\nexport const textareaDefaults: TextareaVariants = {\n variant: 'outline',\n rounded: 'none',\n} as const;\n","import { Ref, useId } from 'react';\nimport { StatusHelpMessage } from '../../shared/forms';\nimport { join } from '../../utils';\nimport CharacterCount from './CharacterCount';\nimport { useAutoExpand } from './hooks';\nimport './styles.css';\nimport { roundedVariants, textareaDefaults, textareaVariants, TextareaVariants } from './variants';\n\ninterface TextareaProps extends Partial<TextareaVariants>, React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n ref?: Ref<HTMLTextAreaElement>;\n displayOnlyMode?: boolean;\n errorMessage?: string;\n successMessage?: string;\n hideResizeHandle?: boolean; // only works for Webkit browsers\n autoExpand?: boolean;\n characterLimit?: number;\n}\n\nexport default function Textarea({\n variant = textareaDefaults.variant,\n rounded,\n displayOnlyMode = false,\n errorMessage,\n successMessage,\n hideResizeHandle = false,\n autoExpand = false,\n characterLimit = 0,\n className,\n ...rest\n}: TextareaProps) {\n const id = useId();\n useAutoExpand(id, autoExpand || displayOnlyMode);\n\n // Default `round` of `md` for `outline` variant\n let adjustedRound = rounded;\n if (variant === 'outline' && !rounded) {\n adjustedRound = 'md';\n }\n adjustedRound = adjustedRound || textareaDefaults.rounded;\n\n let adjustedHideResizeHandle = hideResizeHandle;\n if (displayOnlyMode || (variant === 'left-line' && !hideResizeHandle)) {\n adjustedHideResizeHandle = true;\n }\n\n const baseClasses =\n 'appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all';\n\n const inputClasses = join(\n baseClasses,\n !displayOnlyMode && textareaVariants[variant],\n !displayOnlyMode && roundedVariants[adjustedRound],\n !displayOnlyMode && 'px-2 py-1',\n displayOnlyMode && 'pointer-events-none',\n adjustedHideResizeHandle && 'no-resize-handle',\n\n className\n );\n\n return (\n <div className={join('-space-y-1.5', displayOnlyMode && 'cursor-text')}>\n <textarea\n {...rest}\n id={id}\n aria-disabled={rest.disabled}\n readOnly={displayOnlyMode}\n aria-readonly={displayOnlyMode || rest['aria-readonly']}\n style={{\n resize: autoExpand ? 'none' : undefined,\n }}\n className={inputClasses}\n />\n {characterLimit > 0 && <CharacterCount elementId={id} maxLength={characterLimit} />}\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='error' message={errorMessage} />}\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='success' message={successMessage} />}\n </div>\n );\n}\n"],"names":["AccordionItem","id","title","content","children","className","disabled","isOpen","onToggle","triggerClassName","bodyClassName","fallbackId","useId","itemId","headerId","panelId","handleToggle","handleKeyDown","e","jsxs","join","jsx","ChevronDown","Accordion","items","itemClassName","allowMultiple","defaultOpenItems","triggersClassName","bodiesClassName","groupId","groupName","openItems","setOpenItems","useState","toggleItem","prev","newOpenItems","getItemId","index","isItemOpen","item","React","child","createElement","LoadingDots","activeIndex","setActiveIndex","useEffect","interval","prevIndex","buttonVariants","sizeVariants","roundedVariants","buttonDefaults","Button","variant","size","rounded","loading","linkTo","linkProps","type","rest","adjustedSize","buttonClasses","useFilledBackgroundColor","filledBackgroundColor","setFilledBackgroundColor","getFirstNonTransparentBackgroundColor","useCallback","element","currentElement","color","backgroundColor","checkbox","Checkbox","ref","filled","checked","onCheckedChange","props","generatedId","checkboxId","useMemo","parentBackgroundColor","isChecked","setIsChecked","handleChange","handleOnKeyDown","checkboxClasses","Check","Clickable","onButtonClick","buttonProps","StatusHelpMessage","elementId","message","ExclamationTriangle","CheckCircled","inputVariants","inputDefaults","Input","displayOnlyMode","errorMessage","successMessage","showPassword","setShowPassword","adjustedRound","inputClasses","EyeOpened","EyeClosed","Label","display","width","required","helpMessage","suffix","htmlFor","labelClasses","helpId","QuestionMarkCircled","n","t","s","useAnimationOpenClose","show","setShow","shouldRender","setShouldRender","useDocumentChanges","onClose","handleEscape","useHandleFocus","modalId","previousActiveElement","useRef","focusAppropriateElement","modalElement","modalActions","focusableElements","allBesidesCloseButton","el","Modal","contentOnly","overlayClassName","hideCloseButton","actions","disableCloseOnOverlayClick","ariaLabelledBy","ariaDescribedBy","titleId","renderTitle","renderActions","action","label","Fragment","createPortal","X","Slot","isValidElement","allProps","cloneElement","node","RadioInput","onChange","name","baseClasses","handleClick","radioClasses","RadioGroupItem","value","isSelected","hideInput","description","useRadioFocus","selectedOptionIndex","focusedIndex","setFocusedIndex","clickedIndex","setClickedIndex","isMouseDown","setIsMouseDown","handleClicked","options","target","_a","setInitialFocus","indexToFocus","handleFocusPreceding","currentIndex","previousIndex","handleKeyboardNavigation","option","newIndex","getRadioOptions","radioGroup","handleFocus","handleMouseDown","handleMouseUp","RadioGroup","childrenClassName","hideInputs","processedOptions","acc","CharacterCount","maxLength","characterCount","setCharacterCount","textarea","updateCharacterCount","updatedCharacterCount","isError","useAutoExpand","autoExpand","adjustHeight","textareaVariants","textareaDefaults","Textarea","hideResizeHandle","characterLimit","adjustedHideResizeHandle"],"mappings":"2OAcO,SAASA,EAAc,CAC5B,GAAAC,EACA,MAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,EAAW,GACX,OAAAC,EAAS,GACT,SAAAC,EACA,iBAAAC,EAAmB,GACnB,cAAAC,EAAgB,EAClB,EAAuB,CACrB,MAAMC,EAAaC,EAAAA,MAAM,EACnBC,EAASZ,GAAM,kBAAkBU,CAAU,GAC3CG,EAAW,GAAGD,CAAM,UACpBE,EAAU,GAAGF,CAAM,SAEnBG,EAAe,IAAM,CACrB,CAACV,GAAYE,GACNA,EAAA,CAEb,EAEMS,EAAiBC,GAA2B,EAC5CA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,OACjCA,EAAE,eAAe,EACJF,EAAA,EAEjB,EAGE,OAAAG,OAAC,OAAI,UAAWC,EAAA,KAAK,2BAA4Bd,GAAY,gCAAiCD,CAAS,EACrG,SAAA,CAAAc,EAAA,KAAC,SAAA,CACC,GAAIL,EACJ,KAAK,SACL,UAAWM,EAAA,KACT,qGACAd,EAAW,qBAAuB,qCAClCG,CACF,EACA,gBAAeF,EACf,gBAAeQ,EACf,SAAAT,EACA,QAASU,EACT,UAAWC,EAEX,SAAA,CAAAI,EAAAA,IAAC,QAAM,SAAMnB,CAAA,CAAA,EACbmB,EAAA,IAAC,OAAA,CACC,UAAWD,EAAA,KACT,0DACAb,EAAS,aAAe,UAC1B,EACA,cAAY,OAEZ,SAAAc,EAAAA,IAACC,EAAAA,YAAY,CAAA,KAAM,EAAI,CAAA,CAAA,CAAA,CACzB,CAAA,CACF,EAEAD,EAAA,IAAC,MAAA,CACC,GAAI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H,GAAiBhK,CAAO,EAC5C,CAAC+C,GAAmBlD,GAAgBuD,CAAa,EACjD,CAACL,GAAmB,YACpBA,GAAmB,sBACnBsH,GAA4B,mBAE5BxN,CACF,EAEA,cACG,MAAI,CAAA,UAAWe,EAAAA,KAAK,eAAgBmF,GAAmB,aAAa,EACnE,SAAA,CAAAlF,EAAA,IAAC,WAAA,CACE,GAAG0C,EACJ,GAAA9D,EACA,gBAAe8D,EAAK,SACpB,SAAUwC,EACV,gBAAeA,GAAmBxC,EAAK,eAAe,EACtD,MAAO,CACL,OAAQuJ,EAAa,OAAS,MAChC,EACA,UAAWzG,CAAA,CACb,EACC+G,EAAiB,GAAKvM,EAAAA,IAACwL,IAAe,UAAW5M,EAAI,UAAW2N,EAAgB,EAChF,CAACrH,GAAoBlF,EAAAA,IAAA0E,EAAA,CAAkB,UAAW9F,EAAI,KAAK,QAAQ,QAASuG,EAAc,EAC1F,CAACD,GAAoBlF,MAAA0E,EAAA,CAAkB,UAAW9F,EAAI,KAAK,UAAU,QAASwG,CAAgB,CAAA,CAAA,EACjG,CAEJ"}
1
+ {"version":3,"file":"components.cjs.js","sources":["../src/components/accordion/AccordionItem.tsx","../src/components/accordion/Accordion.tsx","../src/components/button/LoadingDots.tsx","../src/components/button/variants.ts","../src/components/button/Button.tsx","../src/components/checkbox/hooks.ts","../src/components/checkbox/Checkbox.tsx","../src/components/clickable/Clickable.tsx","../src/shared/forms/StatusHelpMessage.tsx","../src/components/input/variants.ts","../src/components/input/Input.tsx","../src/components/label/Label.tsx","../src/components/modal/hooks.ts","../src/components/modal/Modal.tsx","../src/components/radiogroup/RadioInput.tsx","../src/components/radiogroup/RadioGroupItem.tsx","../src/components/radiogroup/hooks.ts","../src/components/radiogroup/RadioGroup.tsx","../src/components/slot/Slot.tsx","../src/components/textarea/CharacterCount.tsx","../src/components/textarea/hooks.ts","../src/components/textarea/variants.ts","../src/components/textarea/Textarea.tsx","../src/components/tooltip/hooks.ts","../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import { useId } from 'react';\nimport { ChevronDown } from '../../symbols';\nimport { join } from '../../utils';\nimport { AccordionOption } from './Accordion';\n\nexport interface AccordionItemProps extends Omit<AccordionOption, 'defaultOpen'> {\n children?: React.ReactNode;\n className?: string;\n isOpen?: boolean;\n onToggle?: () => void;\n triggerClassName?: string;\n bodyClassName?: string;\n}\n\nexport function AccordionItem({\n id,\n title,\n content,\n children,\n className = '',\n disabled = false,\n isOpen = false,\n onToggle,\n triggerClassName = '',\n bodyClassName = '',\n}: AccordionItemProps) {\n const fallbackId = useId();\n const itemId = id || `accordion-item-${fallbackId}`;\n const headerId = `${itemId}-header`;\n const panelId = `${itemId}-panel`;\n\n const handleToggle = () => {\n if (!disabled && onToggle) {\n onToggle();\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleToggle();\n }\n };\n\n return (\n <div className={join('border-b border-gray-200', disabled && 'opacity-60 cursor-not-allowed', className)}>\n <button\n id={headerId}\n type='button'\n className={join(\n 'w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary',\n disabled ? 'cursor-not-allowed' : 'hover:bg-gray-50/10 cursor-pointer',\n triggerClassName\n )}\n aria-expanded={isOpen}\n aria-controls={panelId}\n disabled={disabled}\n onClick={handleToggle}\n onKeyDown={handleKeyDown}\n >\n <span>{title}</span>\n <span\n className={join(\n 'transform transition-transform duration-300 ease-linear',\n isOpen ? 'rotate-180' : 'rotate-0'\n )}\n aria-hidden='true'\n >\n <ChevronDown size={18} />\n </span>\n </button>\n\n <div\n id={panelId}\n role='region'\n aria-labelledby={headerId}\n className={join(\n 'transition-all duration-300 ease-linear px-4',\n isOpen ? 'max-h-96 opacity-100 overflow-auto py-3' : 'max-h-0 opacity-0 overflow-hidden',\n bodyClassName\n )}\n >\n {isOpen && (children || content)}\n </div>\n </div>\n );\n}\n","import React, { useId, useState } from 'react';\nimport { join } from '../../utils';\nimport { AccordionItem, AccordionItemProps } from './AccordionItem';\n\nexport interface AccordionOption {\n id?: string;\n title: React.ReactNode;\n content: React.ReactNode;\n disabled?: boolean;\n defaultOpen?: boolean;\n}\n\nexport interface AccordionProps {\n id?: string;\n items?: AccordionOption[];\n children?: React.ReactElement<AccordionItemProps>[] | React.ReactElement<AccordionItemProps>;\n className?: string;\n itemClassName?: string;\n allowMultiple?: boolean;\n defaultOpenItems?: string[];\n triggersClassName?: string;\n bodiesClassName?: string;\n}\n\nexport function Accordion({\n id,\n items = [],\n children,\n className = '',\n itemClassName = '',\n allowMultiple = false,\n defaultOpenItems = [],\n triggersClassName = '',\n bodiesClassName = '',\n}: AccordionProps) {\n const groupId = useId();\n const groupName = id || `accordion-group-${groupId}`;\n const [openItems, setOpenItems] = useState<Set<string>>(new Set(defaultOpenItems));\n\n const toggleItem = (itemId: string) => {\n setOpenItems((prev) => {\n const newOpenItems = new Set(prev);\n\n if (newOpenItems.has(itemId)) {\n newOpenItems.delete(itemId);\n } else {\n if (!allowMultiple) {\n newOpenItems.clear();\n }\n newOpenItems.add(itemId);\n }\n\n return newOpenItems;\n });\n };\n\n const getItemId = (index: number) => `${groupId}-item-${index}`;\n const isItemOpen = (itemId: string) => openItems.has(itemId);\n\n return (\n <div id={groupName} className={className}>\n {/* Render from items prop */}\n {items.length > 0 &&\n items.map((item, index) => {\n const itemId = item.id || getItemId(index);\n return (\n <AccordionItem\n key={itemId}\n id={itemId}\n title={item.title}\n content={item.content}\n disabled={item.disabled}\n isOpen={isItemOpen(itemId)}\n onToggle={() => toggleItem(itemId)}\n className={itemClassName}\n triggerClassName={triggersClassName}\n bodyClassName={bodiesClassName}\n />\n );\n })}\n\n {/* Render AccordionItem components */}\n {items.length === 0 &&\n children &&\n React.Children.map(children, (child, index) => {\n if (React.isValidElement<AccordionItemProps>(child) && child.type === AccordionItem) {\n const itemId = child.props.id || getItemId(index);\n return (\n <AccordionItem\n {...child.props}\n key={itemId}\n id={itemId}\n className={join(itemClassName, child.props.className)}\n isOpen={isItemOpen(itemId)}\n onToggle={() => toggleItem(itemId)}\n triggerClassName={join(triggersClassName, child.props.triggerClassName)}\n bodyClassName={join(bodiesClassName, child.props.bodyClassName)}\n />\n );\n }\n return null;\n })}\n </div>\n );\n}\n","import { useEffect, useState } from 'react';\nimport { join } from '../../utils';\n\nexport default function LoadingDots() {\n const [activeIndex, setActiveIndex] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setActiveIndex((prevIndex) => (prevIndex + 1) % 3);\n }, 500);\n\n return () => clearInterval(interval);\n }, []);\n\n return (\n <div className='absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle'>\n {[0, 1, 2].map((index) => (\n <div\n key={index}\n className={join(\n 'rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current',\n activeIndex === index && 'transform -translate-y-1'\n )}\n />\n ))}\n </div>\n );\n}\n","export const buttonVariants = {\n base: '',\n primary: 'bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-muted disabled:text-muted-foreground',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/85 disabled:bg-muted/80 disabled:text-muted-foreground/80',\n tertiary: 'text-primary hover:text-primary-foreground disabled:text-muted',\n outline: 'border border-primary text-primary hover:border-primary-foreground hover:text-primary-foreground disabled:border-muted disabled:text-muted',\n link: 'underline-offset-4 hover:underline disabled:underline disabled:text-muted',\n destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/85 disabled:bg-muted disabled:text-muted-foreground',\n} as const;\nexport type ButtonVariant = keyof typeof buttonVariants;\n\nexport const sizeVariants = {\n stripped: '',\n fitted: 'size-fit',\n sm: 'px-2 py-1 text-sm',\n md: 'px-4 py-2 text-base',\n lg: 'px-6 py-3 text-lg',\n icon: 'p-1 w-fit aspect-square',\n full: 'p-2 w-full',\n} as const;\nexport type ButtonSize = keyof typeof sizeVariants;\n\nexport const roundedVariants = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'rounded-full',\n} as const;\nexport type ButtonRounded = keyof typeof roundedVariants;\n\nexport interface ButtonVariants {\n variant: ButtonVariant;\n size: ButtonSize;\n rounded: ButtonRounded;\n}\n\nexport const buttonDefaults: ButtonVariants = {\n variant: 'primary',\n size: 'md',\n rounded: 'md',\n} as const;\n","// Button.tsx\nimport { ButtonHTMLAttributes, Ref } from 'react';\nimport { join } from '../../utils';\nimport LoadingDots from './LoadingDots';\nimport { ButtonSize, ButtonVariants, buttonDefaults, buttonVariants, roundedVariants, sizeVariants } from './variants';\n\nexport interface ButtonProps extends Partial<ButtonVariants>, ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: Ref<HTMLButtonElement>;\n loading?: boolean;\n linkTo?: string;\n linkProps?: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n}\n\nexport default function Button({\n variant = buttonDefaults.variant,\n size,\n rounded = buttonDefaults.rounded,\n loading,\n linkTo,\n linkProps,\n type = 'button',\n className,\n ...rest\n}: ButtonProps) {\n let adjustedSize: ButtonSize;\n if (variant === 'link' && !size) {\n // default links to fitted size\n adjustedSize = 'fitted';\n } else {\n adjustedSize = size || buttonDefaults.size;\n }\n\n const baseClasses =\n 'appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all';\n\n const buttonClasses = join(\n baseClasses,\n buttonVariants[variant],\n sizeVariants[adjustedSize],\n roundedVariants[rounded],\n loading && 'relative pointer-events-none',\n linkTo && 'relative',\n className\n );\n\n return (\n <button\n {...rest}\n role={linkTo ? 'link' : rest.role}\n aria-label={rest['aria-label'] || linkProps?.['aria-label']}\n aria-description={rest['aria-description'] || linkProps?.['aria-description']}\n aria-disabled={rest.disabled || loading}\n aria-busy={loading}\n type={type}\n className={buttonClasses}\n >\n {loading && <LoadingDots />}\n <span className={join(loading && 'invisible')}>{rest.children}</span>\n\n {linkTo && !rest.disabled && (\n <a\n {...linkProps}\n aria-hidden={true} // Hide from screen readers since the button is already accessible\n href={linkTo}\n rel={linkProps?.rel || 'noreferrer'}\n className='absolute inset-0'\n />\n )}\n </button>\n );\n}\n","import { useCallback, useEffect, useState } from 'react';\n\nexport function useFilledBackgroundColor(id: string) {\n const [filledBackgroundColor, setFilledBackgroundColor] = useState<string>('');\n\n const getFirstNonTransparentBackgroundColor = useCallback((element: Element | null): string => {\n let currentElement = element;\n let color = '';\n while (currentElement && !color) {\n const backgroundColor = window.getComputedStyle(currentElement).backgroundColor;\n if (backgroundColor && backgroundColor !== 'transparent' && backgroundColor !== 'rgba(0, 0, 0, 0)') {\n color = backgroundColor;\n }\n currentElement = currentElement.parentElement;\n }\n return color || 'transparent';\n }, []);\n\n useEffect(() => {\n const checkbox = document.getElementById(id);\n if (checkbox) {\n const backgroundColor = getFirstNonTransparentBackgroundColor(checkbox.parentElement);\n setFilledBackgroundColor(backgroundColor);\n }\n }, [id, getFirstNonTransparentBackgroundColor]);\n\n return filledBackgroundColor;\n}\n","import React, { Ref, useEffect, useId, useMemo, useState } from 'react';\nimport Check from '../../symbols/Check';\nimport { join } from '../../utils';\nimport { useFilledBackgroundColor } from './hooks';\n\nexport interface CheckboxProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: Ref<HTMLButtonElement>;\n size?: number;\n color?: string; // can be adjusted with tailwindcss by using `text-<color>`\n filled?: boolean;\n rounded?: boolean;\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nexport default function Checkbox({\n ref,\n id,\n size = 20,\n color,\n filled = false,\n rounded = true,\n checked = false,\n onCheckedChange,\n disabled,\n className = '',\n ...props\n}: CheckboxProps) {\n const generatedId = useId();\n const checkboxId = useMemo(() => id || `checkbox-${generatedId}`, [id, generatedId]);\n const parentBackgroundColor = useFilledBackgroundColor(checkboxId);\n const [isChecked, setIsChecked] = useState(checked);\n\n useEffect(() => {\n setIsChecked(checked);\n }, [checked]);\n\n const handleChange = () => {\n if (!disabled) {\n setIsChecked(!isChecked);\n onCheckedChange?.(!isChecked);\n }\n };\n\n const handleOnKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === ' ') {\n e.preventDefault();\n handleChange();\n }\n };\n\n const checkboxClasses = join(\n 'flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2',\n rounded && 'rounded',\n disabled && 'opacity-40 cursor-not-allowed',\n !disabled && 'cursor-pointer',\n className\n );\n\n return (\n <button\n id={checkboxId}\n type='button'\n ref={ref}\n tabIndex={0}\n role='checkbox'\n onClick={handleChange}\n aria-checked={isChecked}\n aria-disabled={disabled}\n onKeyDownCapture={handleOnKeyDown}\n style={{\n width: size,\n height: size,\n color: color,\n backgroundColor: isChecked && filled ? 'currentcolor' : 'transparent',\n }}\n className={checkboxClasses}\n {...props}\n >\n {isChecked && <Check size={size} color={filled ? parentBackgroundColor : undefined} />}\n </button>\n );\n}\n","import { join } from '../../utils';\n\ninterface ClickableProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onClick'> {\n children: React.ReactNode;\n linkTo?: React.HTMLProps<HTMLAnchorElement>['href'];\n linkProps?: Omit<React.HTMLProps<HTMLAnchorElement>, 'href'>;\n onButtonClick?: React.HTMLProps<HTMLButtonElement>['onClick'];\n buttonProps?: Omit<React.HTMLProps<HTMLButtonElement>, 'onClick'>;\n}\n\nexport default function Clickable({\n children,\n className,\n linkTo,\n linkProps,\n onButtonClick,\n buttonProps,\n ...props\n}: ClickableProps) {\n if (linkTo && onButtonClick) {\n console.warn('Clickable: Both \"linkTo\" and \"onButtonClick\" props are provided. Only \"linkTo\" will be used.');\n }\n\n return (\n <div className={join('relative w-fit', className)} {...props}>\n {children}\n\n {/* Link */}\n {linkTo && (\n <a\n {...linkProps}\n rel={linkProps?.rel || 'noreferrer'}\n href={linkTo}\n className={join('absolute inset-0', linkProps?.className)}\n />\n )}\n\n {/* Button */}\n {!linkTo && onButtonClick && (\n <button\n {...buttonProps}\n type='button'\n onClick={onButtonClick}\n className={join('absolute inset-0 cursor-pointer', buttonProps?.className)}\n />\n )}\n </div>\n );\n}\n","import { useEffect } from 'react';\nimport { CheckCircled, ExclamationTriangle } from '../../symbols';\nimport { join } from '../../utils';\n\ninterface StatusHelpMessageProps {\n elementId: string;\n type: 'error' | 'success';\n message?: string;\n}\n\nexport default function StatusHelpMessage({ elementId, type, message }: StatusHelpMessageProps) {\n useEffect(() => {\n const element = document.getElementById(elementId) as HTMLElement;\n if (!element) {\n return;\n }\n if (!message && type === 'error') {\n element.removeAttribute('data-error');\n return;\n }\n if (!message && type === 'success') {\n element.removeAttribute('data-success');\n return;\n }\n\n element.setAttribute('aria-describedby', `${elementId}-${type}-message`);\n element.setAttribute('aria-invalid', type === 'error' ? 'true' : 'false');\n\n if (type === 'error') {\n element.setAttribute('data-error', 'true');\n }\n if (type === 'success') {\n element.setAttribute('data-success', 'true');\n }\n\n return () => {\n element.removeAttribute('aria-describedby');\n element.removeAttribute('aria-invalid');\n element.removeAttribute('data-error');\n element.removeAttribute('data-success');\n };\n }, [elementId, type, message]);\n\n if (!message) {\n return null;\n }\n\n return (\n <small\n className={join(\n 'mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start',\n type === 'error' && 'text-destructive',\n type === 'success' && 'text-success'\n )}\n role='status'\n >\n {type === 'error' ? <ExclamationTriangle /> : <CheckCircled />}\n <span id={`${elementId}-${type}-message`}>{message}</span>\n </small>\n );\n}\n","export const inputVariants = {\n base: '',\n default:\n 'ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-destructive not-disabled:data-success:ring-success',\n underline:\n 'border-b border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success',\n outline:\n 'border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success',\n} as const;\nexport type InputVariant = keyof typeof inputVariants;\n\nexport const roundedVariants = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'px-3 rounded-full',\n} as const;\nexport type InputRounded = keyof typeof roundedVariants;\n\nexport interface InputVariants {\n variant: InputVariant;\n rounded: InputRounded;\n}\n\nexport const inputDefaults: InputVariants = {\n variant: 'default',\n rounded: 'none',\n} as const;\n","import { Ref, useId, useState } from 'react';\nimport { StatusHelpMessage } from '../../shared/forms';\nimport { EyeClosed, EyeOpened } from '../../symbols';\nimport { join } from '../../utils';\nimport './styles.css';\nimport { inputDefaults, inputVariants, InputVariants, roundedVariants } from './variants';\n\ninterface InputProps extends Partial<InputVariants>, React.InputHTMLAttributes<HTMLInputElement> {\n ref?: Ref<HTMLInputElement>;\n displayOnlyMode?: boolean;\n errorMessage?: string;\n successMessage?: string;\n}\n\nexport default function Input({\n variant = inputDefaults.variant,\n rounded,\n displayOnlyMode = false,\n errorMessage,\n successMessage,\n type = 'text',\n className,\n ...rest\n}: InputProps) {\n const id = useId();\n const [showPassword, setShowPassword] = useState(false);\n\n // Default `round` of `md` for `outline` variant\n let adjustedRound = rounded;\n if (variant === 'outline' && !rounded) {\n adjustedRound = 'md';\n }\n adjustedRound = adjustedRound || inputDefaults.rounded;\n\n const baseClasses =\n 'appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all';\n const fileClasses =\n 'file:mr-2 file:border-0 file:rounded-md file:px-1.5 file:py-1 file:bg-primary hover:file:bg-primary/85 file:text-sm file:font-medium file:text-foreground file:transition-colors';\n\n const inputClasses = join(\n baseClasses,\n fileClasses,\n !displayOnlyMode && inputVariants[variant],\n !displayOnlyMode && roundedVariants[adjustedRound],\n type === 'password' && 'pr-10',\n !displayOnlyMode && 'px-2 py-1',\n displayOnlyMode && 'pointer-events-none',\n className\n );\n\n return (\n <div className={join(displayOnlyMode && 'cursor-text')} style={{ height: rest.height, width: rest.width }}>\n <div className={join(type === 'password' && 'relative')}>\n <input\n {...rest}\n id={id}\n type={type === 'password' && showPassword ? 'text' : type}\n aria-disabled={rest.disabled}\n readOnly={displayOnlyMode}\n aria-readonly={displayOnlyMode || rest['aria-readonly']}\n data-error={errorMessage ? true : undefined}\n data-success={successMessage ? true : undefined}\n className={inputClasses}\n />\n {type === 'password' && (\n <button\n onClick={() => setShowPassword(!showPassword)}\n className='absolute inset-y-0 right-0 px-2 hover:cursor-pointer'\n aria-label='Toggle password visibility'\n data-state={showPassword ? 'visible' : 'hidden'}\n >\n {showPassword ? <EyeOpened size={20} /> : <EyeClosed size={20} />}\n </button>\n )}\n </div>\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='error' message={errorMessage} />}\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='success' message={successMessage} />}\n </div>\n );\n}\n","import React, { useId } from 'react';\nimport { QuestionMarkCircled } from '../../symbols';\nimport { join } from '../../utils';\n\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n display?: 'block' | 'inline';\n width?: React.CSSProperties['width'];\n required?: boolean;\n helpMessage?: string;\n suffix?: React.ReactNode;\n}\n\nexport function Label({\n display = 'inline',\n width = 'fit-content',\n className = '',\n required,\n helpMessage,\n suffix,\n htmlFor,\n children,\n ...props\n}: LabelProps) {\n const id = useId();\n const labelClasses = join('font-medium', display, className);\n const helpId = helpMessage ? `${htmlFor ?? id}-help` : undefined;\n\n return (\n <div style={{ display: display === 'inline' ? 'inline-flex' : 'flex', width }} className='relative'>\n <label className={labelClasses} htmlFor={htmlFor} {...props}>\n {children}\n {required && (\n <span className='text-red-500 font-medium ml-1' aria-label='required'>\n *\n </span>\n )}\n </label>\n {helpMessage && (\n <span\n className='text-gray-500 ml-1 size-fit -translate-y-1/3'\n aria-describedby={helpId}\n aria-label='Help information'\n title={helpMessage}\n >\n <QuestionMarkCircled />\n </span>\n )}\n {helpMessage && (\n <div id={helpId} className='sr-only'>\n {helpMessage}\n </div>\n )}\n {suffix && <span className='ml-1'>{suffix}</span>}\n </div>\n );\n}\n","import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport function useAnimationOpenClose(isOpen: boolean) {\n const [show, setShow] = useState(false);\n const [shouldRender, setShouldRender] = useState(false);\n\n useEffect(() => {\n if (isOpen) {\n setShouldRender(true);\n setTimeout(() => setShow(true), 10);\n } else {\n setShow(false);\n setTimeout(() => setShouldRender(false), 150);\n }\n }, [isOpen]);\n\n return { show, shouldRender };\n}\n\nexport function useDocumentChanges(isOpen: boolean, onClose: () => void) {\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && isOpen) {\n onClose();\n }\n };\n\n document.addEventListener('keydown', handleEscape);\n // Prevent background scrolling when modal is open\n if (isOpen) {\n document.body.style.overflow = 'hidden';\n }\n\n return () => {\n document.removeEventListener('keydown', handleEscape);\n document.body.style.overflow = 'auto';\n };\n }, [isOpen, onClose]);\n}\n\nexport function useHandleFocus(modalId: string, isOpen: boolean) {\n const previousActiveElement = useRef<Element | null>(null);\n\n const focusAppropriateElement = useCallback(() => {\n const modalElement = document.getElementById(modalId);\n if (!modalElement) return;\n\n // 1. First, try to focus on the first action button, if available\n const modalActions = modalElement.querySelectorAll('[data-modal-action=\"true\"]');\n if (modalActions.length > 0) {\n (modalActions[0] as HTMLElement).focus();\n return;\n }\n\n // 2. Then try first focusable element in content (giving preference to non-close button)\n const focusableElements = modalElement.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n\n if (focusableElements.length > 0) {\n const allBesidesCloseButton = Array.from(focusableElements).filter((el) => {\n return !(el instanceof HTMLButtonElement && el.getAttribute('data-modal-close-button') === 'true');\n });\n\n if (allBesidesCloseButton.length > 0) {\n (allBesidesCloseButton[0] as HTMLElement).focus();\n return;\n }\n\n (focusableElements[0] as HTMLElement).focus();\n return;\n }\n\n // 3. Fallback to modal container\n modalElement.focus();\n }, [modalId]);\n\n useEffect(() => {\n if (isOpen) {\n // Store the currently focused element to restore focus later\n previousActiveElement.current = document.activeElement;\n\n focusAppropriateElement();\n }\n\n return () => {\n document.body.style.overflow = 'auto';\n\n // Restore focus to the previously focused element when modal closes\n if (previousActiveElement.current instanceof HTMLElement) {\n previousActiveElement.current.focus();\n }\n };\n }, [isOpen, focusAppropriateElement]);\n}\n","import { join } from '@moondreamsdev/dreamer-ui/utils';\nimport React, { useId } from 'react';\nimport { createPortal } from 'react-dom';\nimport { X } from '../../symbols';\nimport { Button, ButtonProps } from '../button';\nimport { useAnimationOpenClose, useDocumentChanges, useHandleFocus } from './hooks';\n\ninterface ModalAction extends Omit<ButtonProps, 'children'> {\n label: string;\n}\n\nexport interface ModalProps {\n id?: string;\n isOpen: boolean;\n onClose: () => void;\n title?: React.ReactNode;\n children: React.ReactNode;\n contentOnly?: boolean;\n className?: string;\n overlayClassName?: string;\n hideCloseButton?: boolean;\n actions?: ModalAction[];\n disableCloseOnOverlayClick?: boolean;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n}\n\nexport function Modal({\n id,\n isOpen,\n onClose,\n title,\n children,\n contentOnly = false,\n className,\n overlayClassName,\n hideCloseButton = false,\n actions = [],\n disableCloseOnOverlayClick = false,\n ariaLabelledBy,\n ariaDescribedBy,\n}: ModalProps) {\n const generatedId = useId();\n const modalId = id || `modal-${generatedId}`;\n const titleId = id ? `${id}-title` : `modal-title-${generatedId}`;\n\n const { show, shouldRender } = useAnimationOpenClose(isOpen);\n useHandleFocus(modalId, shouldRender);\n useDocumentChanges(shouldRender, onClose);\n\n if (!shouldRender) return null;\n\n const renderTitle = () => {\n if (!title) return null;\n\n if (React.isValidElement(title)) {\n return <div className='mb-4'>{title}</div>;\n }\n\n return (\n <h2 className='mb-4 text-xl font-semibold' id={titleId}>\n {title}\n </h2>\n );\n };\n\n const renderActions = () => {\n if (actions.length === 0) return null;\n\n return (\n <div className='mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3'>\n {actions.map((action, index) => {\n const { label, className, ...buttonProps } = action;\n return (\n <Button key={index} className={className} type='button' {...buttonProps} data-modal-action='true'>\n {label}\n </Button>\n );\n })}\n </div>\n );\n };\n\n return (\n <>\n {createPortal(\n <div\n aria-labelledby={ariaLabelledBy ?? title ? titleId : undefined}\n aria-describedby={ariaDescribedBy}\n role='dialog'\n aria-modal='true'\n className='fixed inset-0 z-[100] overflow-y-auto'\n >\n <div className='flex min-h-screen items-center justify-center p-4'>\n <div\n className={join('fixed inset-0 bg-black/20 transition-all', overlayClassName)}\n onClick={() => {\n if (!disableCloseOnOverlayClick) {\n onClose();\n }\n }}\n />\n\n {contentOnly && <div className={join('relative w-fit', className)}>{children}</div>}\n\n {!contentOnly && (\n <div\n id={modalId}\n tabIndex={-1}\n className={join(\n 'relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:ring ease-in duration-75',\n show ? 'opacity-100 scale-100' : 'opacity-0 scale-90',\n className\n )}\n >\n {!hideCloseButton && (\n <button\n type='button'\n onClick={onClose}\n data-modal-close-button='true'\n className='rounded-md p-0.5 top-2.5 right-2.5 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0'\n >\n <X size={18} />\n </button>\n )}\n\n {renderTitle()}\n\n {children}\n\n {renderActions()}\n </div>\n )}\n </div>\n </div>,\n document.body\n )}\n </>\n );\n}\n","import { join } from '../../utils';\n\nexport type RadioInputProps = {\n itemId: string;\n checked: boolean;\n onChange: () => void;\n name: string;\n disabled?: boolean;\n className?: string;\n};\n\n// Custom RadioInput Component\nexport function RadioInput({ itemId, checked, onChange, name, disabled = false, className = '' }: RadioInputProps) {\n const baseClasses = 'relative inline-flex items-center justify-center rounded-full';\n\n const handleClick = () => {\n if (disabled) return;\n onChange();\n };\n\n const radioClasses = join(\n baseClasses,\n !checked && 'hover:border-current/60',\n !disabled && 'border-current cursor-pointer',\n disabled && 'border-muted/60 cursor-not-allowed',\n className\n );\n return (\n <div\n id={itemId}\n role='radio'\n tabIndex={-1} // necessary so that the radio button can be focused as div is not a focusable element\n aria-checked={checked}\n aria-disabled={disabled}\n aria-description={`Radio button for ${name}`}\n aria-labelledby={`${itemId}-label`}\n onClick={handleClick}\n className={radioClasses}\n style={{\n width: '1em',\n height: '1em',\n padding: '0.1em',\n borderWidth: '0.06em',\n }}\n >\n {checked && (\n <div\n className={join(`size-full aspect-square rounded-full`, disabled && 'bg-muted/60', !disabled && 'bg-current')}\n />\n )}\n </div>\n );\n}\n","import { useId } from 'react';\nimport { join } from '../../utils';\nimport { RadioInput } from './RadioInput';\n\nexport interface RadioGroupItemProps {\n value: string;\n children: React.ReactNode;\n className?: string;\n isSelected?: boolean;\n onChange?: (value: string) => void;\n disabled?: boolean;\n name?: string;\n hideInput?: boolean;\n description?: string;\n}\n\nexport function RadioGroupItem({\n value,\n children,\n className = '',\n isSelected = false,\n onChange,\n disabled = false,\n hideInput = false,\n description,\n name,\n}: RadioGroupItemProps) {\n const id = useId();\n const itemId = `radio-${id}-${value}`;\n\n const handleChange = () => {\n if (!disabled) {\n onChange?.(value);\n }\n };\n\n return (\n <div\n title={description}\n className={join(\n 'relative flex items-center',\n className,\n // Uses text color for borders\n hideInput &&\n `p-2 border-2 focus-within:border-dashed focus-within:${\n disabled ? 'border-current/50' : 'border-current/80'\n }`,\n hideInput && !isSelected && `border-transparent ${disabled ? '' : 'not-focus-within:hover:border-border/60'}`,\n hideInput && isSelected && 'border-border',\n disabled && 'opacity-60 cursor-not-allowed'\n )}\n style={{\n gap: '0.5em',\n }}\n >\n {!hideInput && (\n <RadioInput\n itemId={itemId}\n name={name || ''}\n checked={isSelected}\n onChange={handleChange}\n disabled={disabled}\n className={join(hideInput && '')}\n />\n )}\n <div\n id={hideInput ? itemId : undefined}\n tabIndex={hideInput ? -1 : undefined}\n role={hideInput ? 'radio' : undefined}\n onClick={hideInput ? handleChange : undefined}\n aria-checked={!hideInput ? undefined : isSelected ? 'true' : 'false'}\n aria-disabled={hideInput ? disabled : undefined}\n aria-description={!hideInput ? undefined : description || `Radio button for ${name}`}\n aria-labelledby={hideInput ? `${itemId}-label` : undefined}\n className={join(hideInput && 'size-full', typeof children === 'object' && 'grow focus:outline-none')}\n >\n <label\n id={`${itemId}-label`}\n onClick={hideInput ? undefined : handleChange}\n className={join(disabled && 'cursor-not-allowed', !disabled && 'cursor-pointer')}\n >\n {children}\n </label>\n </div>\n </div>\n );\n}\n","import { useCallback, useEffect, useState } from 'react';\n\nexport function useRadioFocus(id: string, selectedOptionIndex: number) {\n // Manage state locally to avoid race conditions, which can result in\n // the an option failing to be selected or incorrectly selected\n const [focusedIndex, setFocusedIndex] = useState<number>(selectedOptionIndex);\n const [clickedIndex, setClickedIndex] = useState<number>(-1);\n // Prevent onClicks from triggering focus events and automatically selecting the first option\n const [isMouseDown, setIsMouseDown] = useState<boolean>(false);\n\n const handleClicked = useCallback((options: HTMLElement[], index: number) => {\n const target = options[index] as HTMLElement;\n\n // Check if the target element is disabled\n const isDisabled = target.hasAttribute('disabled') || target.getAttribute('aria-disabled') === 'true';\n if (isDisabled) return;\n\n // Update the selected index\n options[index]?.click();\n setClickedIndex(index);\n }, []);\n\n const setInitialFocus = useCallback(\n (e: Event, options: HTMLElement[]) => {\n e.preventDefault();\n if (isMouseDown) return;\n if (!options.length) return;\n\n const indexToFocus = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;\n options[indexToFocus]?.focus();\n setFocusedIndex(indexToFocus);\n\n // Only update the selected index if one is already set\n if (selectedOptionIndex !== -1) {\n handleClicked(options, indexToFocus);\n }\n },\n [selectedOptionIndex, isMouseDown, handleClicked]\n );\n\n /* Focus preceding element when Shift + Tab is pressed */\n const handleFocusPreceding = useCallback(\n (e: KeyboardEvent) => {\n // If the Shift key is not pressed while tab is entered, do nothing\n if (!e.shiftKey) {\n return;\n }\n\n e.preventDefault();\n const focusableElements = Array.from(\n document.querySelectorAll<HTMLElement>(\n 'a, button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])'\n )\n ).filter((el) => !el.hasAttribute('disabled') && el.tabIndex >= 0);\n const currentIndex = focusableElements.findIndex((el) => el.id === id);\n const previousIndex = currentIndex > 0 ? currentIndex - 1 : focusableElements.length - 1;\n focusableElements[previousIndex]?.focus();\n },\n [id]\n );\n\n const handleKeyboardNavigation = useCallback(\n (e: KeyboardEvent, options: HTMLElement[]) => {\n if (!options.length) return;\n\n // Ensure we only toggle options part of radio group\n const target = e.target as HTMLElement;\n const isGroupOption = options.some((option) => option.id === target.id);\n if (!isGroupOption) return;\n\n const currentIndex = focusedIndex !== -1 ? focusedIndex : 0;\n let newIndex = currentIndex;\n\n switch (e.key) {\n case 'ArrowUp':\n case 'ArrowLeft':\n e.preventDefault();\n newIndex = currentIndex > 0 ? currentIndex - 1 : options.length - 1;\n break;\n\n case 'ArrowDown':\n case 'ArrowRight':\n e.preventDefault();\n newIndex = (currentIndex + 1) % options.length;\n break;\n\n // Select the option when the space key is pressed\n case ' ':\n e.preventDefault();\n handleClicked(options, currentIndex);\n return;\n\n case 'Tab':\n handleFocusPreceding(e);\n return;\n\n default:\n return;\n }\n\n options[newIndex]?.focus();\n setFocusedIndex(newIndex);\n // Only update the selected index if one is already set\n if (clickedIndex !== -1) {\n handleClicked(options, newIndex);\n }\n },\n [focusedIndex, clickedIndex, handleFocusPreceding, handleClicked]\n );\n\n const getRadioOptions = useCallback((): HTMLElement[] => {\n const radioGroup = document.querySelector(`[id=\"${id}\"][role=\"radiogroup\"]`);\n if (!radioGroup) return [];\n\n return Array.from(radioGroup.querySelectorAll('[role=\"radio\"]'));\n }, [id]);\n\n useEffect(() => {\n const radioGroup = document.querySelector(`[id=\"${id}\"][role=\"radiogroup\"]`);\n if (!radioGroup) return;\n\n const options = getRadioOptions();\n const handleFocus = (e: Event) => setInitialFocus(e, options);\n const handleKeyDown = (e: KeyboardEvent) => handleKeyboardNavigation(e, options);\n const handleMouseDown = () => setIsMouseDown(true);\n const handleMouseUp = () => setIsMouseDown(false);\n\n document.addEventListener('keydown', handleKeyDown);\n radioGroup.addEventListener('focus', handleFocus);\n radioGroup.addEventListener('mousedown', handleMouseDown);\n document.addEventListener('mouseup', handleMouseUp); // place on document since mouseup event can occur outside of radio group\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n radioGroup.removeEventListener('focus', handleFocus);\n radioGroup.removeEventListener('mousedown', handleMouseDown);\n document.removeEventListener('mouseup', handleMouseUp);\n };\n }, [id, getRadioOptions, setInitialFocus, handleKeyboardNavigation]);\n}\n","import React, { useId, useMemo } from 'react';\nimport { join } from '../../utils';\nimport { RadioGroupItem, RadioGroupItemProps } from './RadioGroupItem';\nimport { useRadioFocus } from './hooks';\n\nexport type RadioOption = { label: string; value: string; disabled?: boolean; description?: string };\n\nexport type RadioGroupProps = {\n options?: (string | RadioOption)[];\n value: string | undefined;\n onChange: (value: string) => void;\n id?: string;\n children?: React.ReactElement<RadioGroupItemProps>[] | React.ReactElement<RadioGroupItemProps>;\n className?: string;\n childrenClassName?: string;\n hideInputs?: boolean;\n};\n\nexport function RadioGroup({\n options = [],\n value,\n onChange,\n id,\n children,\n className = '',\n childrenClassName = '',\n hideInputs = false,\n}: RadioGroupProps) {\n const groupId = useId();\n const groupName = id || `radio-group-${groupId}`;\n useRadioFocus(\n groupName,\n options.findIndex((option) => option === value)\n );\n\n // Check for duplicates if string options are provided\n const processedOptions = useMemo(() => {\n return options.reduce<RadioOption[]>((acc, option) => {\n if (typeof option === 'string') {\n // Check if we already have this string option\n if (!acc.some((item) => item.value === option)) {\n acc.push({ label: option, value: option });\n }\n } else {\n acc.push(option);\n }\n return acc;\n }, []);\n }, [options]);\n\n return (\n <div id={groupName} role='radiogroup' tabIndex={0} className={join(className, 'focus:outline-none')}>\n {/* Render from options prop */}\n {processedOptions.length > 0 &&\n processedOptions.map((option, index) => (\n <RadioGroupItem\n key={`${option.value}-${index}`}\n value={option.value}\n isSelected={value === option.value}\n onChange={onChange}\n name={groupName}\n disabled={option.disabled}\n description={option.description}\n hideInput={hideInputs}\n className={childrenClassName}\n >\n {option.label}\n </RadioGroupItem>\n ))}\n\n {/* Render RadioGroupItem components */}\n {processedOptions.length === 0 &&\n children &&\n React.Children.map(children, (child) => {\n // TypeScript enforces that child is a RadioGroupItem\n if (React.isValidElement(child) && child.type === RadioGroupItem) {\n return (\n <RadioGroupItem\n {...child.props}\n className={join(childrenClassName, child.props.className)}\n hideInput={child.props.hideInput || hideInputs}\n isSelected={value === child.props.value}\n onChange={onChange}\n name={groupName}\n >\n {child.props.children}\n </RadioGroupItem>\n );\n }\n return null;\n })}\n </div>\n );\n}\n","import React, {\n cloneElement,\n createElement,\n HTMLAttributes,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n} from 'react';\n\ninterface SlotProps<T> extends HTMLAttributes<T> {\n children?: ReactNode;\n ref?: Ref<T>;\n}\n\nexport function Slot<T = HTMLElement>({ children, ref, ...props }: SlotProps<T>) {\n\n if (isValidElement(children)) {\n let allProps = { ...props };\n if (children.props) {\n allProps = { ...allProps, ...children.props };\n }\n return cloneElement(children, {\n ...allProps,\n ref: (node: T) => {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n (ref as React.RefObject<T>).current = node;\n }\n },\n } as unknown as ReactElement);\n }\n\n // If not asChild or no valid child, render as div\n return createElement('div', { ...props, ref }, children);\n}\n","import { useEffect, useState } from 'react';\nimport { join } from '../../utils';\n\ninterface CharacterCountProps {\n elementId: string;\n maxLength: number;\n}\n\nexport default function CharacterCount({ elementId, maxLength }: CharacterCountProps) {\n const [characterCount, setCharacterCount] = useState(0);\n\n useEffect(() => {\n const textarea = document.getElementById(elementId) as HTMLTextAreaElement;\n if (!textarea) {\n return;\n }\n\n const updateCharacterCount = () => {\n const updatedCharacterCount = textarea.value.length;\n setCharacterCount(updatedCharacterCount);\n const isError = updatedCharacterCount >= maxLength;\n textarea.setAttribute('aria-describedby', `${elementId}-character-count`);\n textarea.setAttribute('aria-invalid', isError ? 'true' : 'false');\n\n if (isError) {\n textarea.setAttribute('data-error', 'true');\n } else {\n textarea.removeAttribute('data-error');\n }\n };\n\n updateCharacterCount();\n textarea.addEventListener('input', updateCharacterCount);\n textarea.setAttribute('maxlength', String(maxLength));\n\n return () => {\n textarea.removeEventListener('input', updateCharacterCount);\n textarea.removeAttribute('maxlength');\n textarea.removeAttribute('aria-describedby');\n textarea.removeAttribute('aria-invalid');\n textarea.removeAttribute('data-error');\n };\n }, [elementId, maxLength]);\n\n return (\n <small\n className={join(\n 'mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end',\n characterCount >= maxLength && 'text-destructive',\n characterCount < maxLength && 'text-current'\n )}\n role='status'\n >\n <span id={`${elementId}-character-count`}>\n {characterCount} / {maxLength} characters\n </span>\n </small>\n );\n}\n","import { useEffect } from 'react';\n\nexport function useAutoExpand(id: string, autoExpand: boolean) {\n useEffect(() => {\n const textarea = document.getElementById(id) as HTMLTextAreaElement;\n if (!textarea) {\n return;\n }\n\n if (!autoExpand) {\n textarea.style.height = 'auto';\n return;\n }\n\n const adjustHeight = () => {\n // necessary to reset the height to `auto` before calculating the new height\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n };\n\n adjustHeight();\n textarea.addEventListener('input', adjustHeight);\n textarea.addEventListener('resize', adjustHeight);\n window.addEventListener('resize', adjustHeight);\n\n return () => {\n textarea.removeEventListener('input', adjustHeight);\n textarea.removeEventListener('resize', adjustHeight);\n window.removeEventListener('resize', adjustHeight);\n };\n }, [id, autoExpand]);\n}\n","export const textareaVariants = {\n base: '',\n 'left-line':\n 'border-l border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success',\n outline:\n 'border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success',\n} as const;\nexport type TextareaVariant = keyof typeof textareaVariants;\n\nexport const roundedVariants = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n full: 'px-3 rounded-full',\n} as const;\nexport type TextareaRounded = keyof typeof roundedVariants;\n\nexport interface TextareaVariants {\n variant: TextareaVariant;\n rounded: TextareaRounded;\n}\n\nexport const textareaDefaults: TextareaVariants = {\n variant: 'outline',\n rounded: 'none',\n} as const;\n","import { Ref, useId } from 'react';\nimport { StatusHelpMessage } from '../../shared/forms';\nimport { join } from '../../utils';\nimport CharacterCount from './CharacterCount';\nimport { useAutoExpand } from './hooks';\nimport './styles.css';\nimport { roundedVariants, textareaDefaults, textareaVariants, TextareaVariants } from './variants';\n\ninterface TextareaProps extends Partial<TextareaVariants>, React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n ref?: Ref<HTMLTextAreaElement>;\n displayOnlyMode?: boolean;\n errorMessage?: string;\n successMessage?: string;\n hideResizeHandle?: boolean; // only works for Webkit browsers\n autoExpand?: boolean;\n characterLimit?: number;\n}\n\nexport default function Textarea({\n variant = textareaDefaults.variant,\n rounded,\n displayOnlyMode = false,\n errorMessage,\n successMessage,\n hideResizeHandle = false,\n autoExpand = false,\n characterLimit = 0,\n className,\n ...rest\n}: TextareaProps) {\n const id = useId();\n useAutoExpand(id, autoExpand || displayOnlyMode);\n\n // Default `round` of `md` for `outline` variant\n let adjustedRound = rounded;\n if (variant === 'outline' && !rounded) {\n adjustedRound = 'md';\n }\n adjustedRound = adjustedRound || textareaDefaults.rounded;\n\n let adjustedHideResizeHandle = hideResizeHandle;\n if (displayOnlyMode || (variant === 'left-line' && !hideResizeHandle)) {\n adjustedHideResizeHandle = true;\n }\n\n const baseClasses =\n 'appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all';\n\n const inputClasses = join(\n baseClasses,\n !displayOnlyMode && textareaVariants[variant],\n !displayOnlyMode && roundedVariants[adjustedRound],\n !displayOnlyMode && 'px-2 py-1',\n displayOnlyMode && 'pointer-events-none',\n adjustedHideResizeHandle && 'no-resize-handle',\n\n className\n );\n\n return (\n <div className={join('-space-y-1.5', displayOnlyMode && 'cursor-text')}>\n <textarea\n {...rest}\n id={id}\n aria-disabled={rest.disabled}\n readOnly={displayOnlyMode}\n aria-readonly={displayOnlyMode || rest['aria-readonly']}\n style={{\n resize: autoExpand ? 'none' : undefined,\n }}\n className={inputClasses}\n />\n {characterLimit > 0 && <CharacterCount elementId={id} maxLength={characterLimit} />}\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='error' message={errorMessage} />}\n {!displayOnlyMode && <StatusHelpMessage elementId={id} type='success' message={successMessage} />}\n </div>\n );\n}\n","import { useCallback, useEffect, useRef } from 'react';\nimport { TooltipPlacement, TooltipPosition } from './Tooltip';\n\nexport const VIEWPORT_PADDING = 8; // Padding from viewport edges\nexport const TOOLTIP_OFFSET = 4; // Distance from target element\nexport const ARROW_SIZE = 6; // Size of the arrow\n\n/**\n * Calculates the optimal position for a tooltip based on the target element and viewport constraints.\n * Automatically adjusts placement if the preferred position would be out of bounds.\n */\nexport function useCalculatePosition(placement: TooltipPlacement) {\n const calculatePosition = useCallback(\n (targetElement: HTMLElement, tooltipElement: HTMLElement): TooltipPosition => {\n const targetRect = targetElement.getBoundingClientRect();\n const tooltipRect = tooltipElement.getBoundingClientRect();\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n };\n\n const isOutOfBounds = (x: number, y: number, width: number, height: number) => {\n return x < 0 || y < 0 || x + width > viewport.width || y + height > viewport.height;\n };\n\n // Calculate positions for all placements\n const positions = {\n top: {\n x: targetRect.left + targetRect.width / 2 - tooltipRect.width / 2,\n y: targetRect.top - tooltipRect.height - TOOLTIP_OFFSET,\n arrow: {\n x: tooltipRect.width / 2 - ARROW_SIZE,\n y: tooltipRect.height,\n },\n },\n bottom: {\n x: targetRect.left + targetRect.width / 2 - tooltipRect.width / 2,\n y: targetRect.bottom + TOOLTIP_OFFSET,\n arrow: {\n x: tooltipRect.width / 2 - ARROW_SIZE,\n y: -ARROW_SIZE,\n },\n },\n left: {\n x: targetRect.left - tooltipRect.width - TOOLTIP_OFFSET,\n y: targetRect.top + targetRect.height / 2 - tooltipRect.height / 2,\n arrow: {\n x: tooltipRect.width,\n y: tooltipRect.height / 2 - ARROW_SIZE,\n },\n },\n right: {\n x: targetRect.right + TOOLTIP_OFFSET,\n y: targetRect.top + targetRect.height / 2 - tooltipRect.height / 2,\n arrow: {\n x: -ARROW_SIZE,\n y: tooltipRect.height / 2 - ARROW_SIZE,\n },\n },\n };\n\n // Determine the best placement, starting with the preferred one\n let bestPlacement = placement;\n let bestPosition = positions[placement];\n\n // Check if preferred placement is out of bounds\n if (isOutOfBounds(bestPosition.x, bestPosition.y, tooltipRect.width, tooltipRect.height)) {\n // Try opposite placement first\n const oppositePlacement: Record<TooltipPlacement, TooltipPlacement> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left',\n };\n\n const oppositePos = positions[oppositePlacement[placement]];\n if (!isOutOfBounds(oppositePos.x, oppositePos.y, tooltipRect.width, tooltipRect.height)) {\n bestPlacement = oppositePlacement[placement];\n bestPosition = oppositePos;\n } else {\n // Try all other placements\n const otherPlacements = (['top', 'bottom', 'left', 'right'] as TooltipPlacement[]).filter(\n (p) => p !== placement && p !== oppositePlacement[placement]\n );\n\n for (const p of otherPlacements) {\n const pos = positions[p];\n if (!isOutOfBounds(pos.x, pos.y, tooltipRect.width, tooltipRect.height)) {\n bestPlacement = p;\n bestPosition = pos;\n break;\n }\n }\n }\n }\n\n // Adjust position to stay within viewport bounds\n bestPosition.x = Math.max(\n VIEWPORT_PADDING,\n Math.min(bestPosition.x, viewport.width - tooltipRect.width - VIEWPORT_PADDING)\n );\n bestPosition.y = Math.max(\n VIEWPORT_PADDING,\n Math.min(bestPosition.y, viewport.height - tooltipRect.height - VIEWPORT_PADDING)\n );\n\n // Adjust arrow position based on the tooltip adjustment\n const targetCenter = {\n x: targetRect.left + targetRect.width / 2,\n y: targetRect.top + targetRect.height / 2,\n };\n\n if (bestPlacement === 'top' || bestPlacement === 'bottom') {\n bestPosition.arrow.x = Math.max(\n ARROW_SIZE,\n Math.min(targetCenter.x - bestPosition.x - ARROW_SIZE, tooltipRect.width - ARROW_SIZE * 2)\n );\n } else {\n bestPosition.arrow.y = Math.max(\n ARROW_SIZE,\n Math.min(targetCenter.y - bestPosition.y - ARROW_SIZE, tooltipRect.height - ARROW_SIZE * 2)\n );\n }\n\n return {\n ...bestPosition,\n placement: bestPlacement,\n };\n },\n [placement]\n );\n\n return { calculatePosition };\n}\n\n/**\n * Manages tooltip positioning logic including refs, position updates, and resize handling.\n * Automatically updates position when the window is resized.\n */\nexport function useTooltipPosition(\n calculatePosition: (target: HTMLElement, tooltip: HTMLElement) => TooltipPosition,\n shouldRender: boolean,\n setPosition: (position: TooltipPosition | null) => void\n) {\n const triggerRef = useRef<HTMLElement>(null);\n const tooltipRef = useRef<HTMLDivElement>(null);\n\n const updatePosition = useCallback(() => {\n if (!triggerRef.current || !tooltipRef.current) return;\n\n const newPosition = calculatePosition(triggerRef.current, tooltipRef.current);\n setPosition(newPosition);\n }, [calculatePosition, setPosition]);\n\n // Update position on resize\n useEffect(() => {\n if (!shouldRender) return;\n\n const handleUpdate = () => updatePosition();\n\n window.addEventListener('resize', handleUpdate);\n\n return () => {\n window.removeEventListener('resize', handleUpdate);\n };\n }, [shouldRender, updatePosition]);\n\n return {\n triggerRef,\n tooltipRef,\n updatePosition,\n };\n}\n\n/**\n * Manages tooltip show/hide events with delay handling and hover state coordination.\n * Handles timeout cleanup, delayed showing/hiding, and hover state transitions to prevent\n * flickering when moving between trigger and tooltip elements.\n */\nexport function useTooltipEvents(\n disabled: boolean,\n delay: number,\n setShouldRender: (shouldRender: boolean) => void,\n setIsVisible: (isVisible: boolean) => void,\n updatePosition: () => void,\n isHoveringTrigger: boolean,\n isHoveringTooltip: boolean,\n isFocused: boolean,\n isVisible: boolean\n) {\n const timeoutRef = useRef<number | null>(null);\n\n const showTooltip = useCallback(() => {\n if (disabled) return;\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = window.setTimeout(() => {\n setShouldRender(true);\n // Small delay to ensure DOM is updated before calculating position\n requestAnimationFrame(() => {\n updatePosition();\n setIsVisible(true);\n });\n }, delay);\n }, [disabled, delay, setShouldRender, updatePosition, setIsVisible]);\n\n const hideTooltip = useCallback(\n (forceHide = false) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n if (forceHide) {\n setIsVisible(false);\n setTimeout(() => setShouldRender(false), 150);\n return;\n }\n\n // Small delay to allow moving from trigger to tooltip\n timeoutRef.current = window.setTimeout(() => {\n setIsVisible(false);\n setTimeout(() => setShouldRender(false), 150);\n }, 100);\n },\n [setIsVisible, setShouldRender]\n );\n\n // Handle hover state changes\n useEffect(() => {\n if (!isHoveringTrigger && !isHoveringTooltip && !isFocused && isVisible) {\n // Neither trigger nor tooltip is being hovered/focused, hide the tooltip\n hideTooltip();\n }\n }, [isHoveringTrigger, isHoveringTooltip, isFocused, isVisible, hideTooltip]);\n\n // Cleanup timeout on unmount\n useEffect(() => {\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n return {\n showTooltip,\n hideTooltip,\n timeoutRef,\n };\n}\n","import React, { useId, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { join } from '../../utils';\nimport { useCalculatePosition, useTooltipEvents, useTooltipPosition } from './hooks';\n\nexport type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';\n\nexport interface TooltipProps {\n id?: string;\n children: React.ReactElement;\n message: React.ReactNode;\n placement?: TooltipPlacement;\n disabled?: boolean;\n delay?: number;\n className?: string;\n arrowClassName?: string;\n}\n\nexport interface TooltipPosition {\n x: number;\n y: number;\n placement: TooltipPlacement;\n arrow: {\n x: number;\n y: number;\n };\n}\n\nexport function Tooltip({\n id,\n children,\n message,\n placement = 'top',\n disabled = false,\n delay = 200,\n className,\n}: TooltipProps) {\n const [isVisible, setIsVisible] = useState(false); // Controls visibility of the tooltip\n const [shouldRender, setShouldRender] = useState(false); // Controls whether the tooltip is rendered in the DOM\n const [position, setPosition] = useState<TooltipPosition | null>(null);\n const [isHoveringTrigger, setIsHoveringTrigger] = useState(false);\n const [isHoveringTooltip, setIsHoveringTooltip] = useState(false);\n const [isFocused, setIsFocused] = useState(false);\n\n const { calculatePosition } = useCalculatePosition(placement);\n const { triggerRef, tooltipRef, updatePosition } = useTooltipPosition(calculatePosition, shouldRender, setPosition);\n const { showTooltip, hideTooltip, timeoutRef } = useTooltipEvents(\n disabled,\n delay,\n setShouldRender,\n setIsVisible,\n updatePosition,\n isHoveringTrigger,\n isHoveringTooltip,\n isFocused,\n isVisible\n );\n\n const reactId = useId();\n const tooltipId = id ?? reactId;\n\n // const getArrowClasses = (arrowPlacement: TooltipPlacement) => {\n // const baseArrow = 'absolute w-0 h-0';\n // const arrowClasses = {\n // top: 'border-l-[6px] border-r-[6px] border-t-[6px] border-l-transparent border-r-transparent border-t-border',\n // bottom: 'border-l-[6px] border-r-[6px] border-b-[6px] border-l-transparent border-r-transparent border-b-border',\n // left: 'border-t-[6px] border-b-[6px] border-l-[6px] border-t-transparent border-b-transparent border-l-border',\n // right: 'border-t-[6px] border-b-[6px] border-r-[6px] border-t-transparent border-b-transparent border-r-border',\n // };\n\n // return join(baseArrow, arrowClasses[arrowPlacement], arrowClassName);\n // };\n\n return (\n <>\n {React.cloneElement(children, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node;\n },\n onMouseEnter: () => {\n setIsHoveringTrigger(true);\n showTooltip();\n },\n onMouseLeave: () => {\n setIsHoveringTrigger(false);\n },\n onFocus: () => {\n setIsFocused(true);\n showTooltip();\n },\n onBlur: () => {\n setIsFocused(false);\n hideTooltip(true);\n },\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n hideTooltip(true);\n }\n },\n 'aria-describedby': disabled ? undefined : tooltipId,\n } as Record<string, unknown>)}\n {shouldRender &&\n createPortal(\n <div\n ref={tooltipRef}\n id={tooltipId}\n role='tooltip'\n className={join(\n 'fixed z-50 px-2 py-1 text-sm rounded shadow-lg pointer-events-auto transition-all duration-150 ease-out',\n isVisible ? 'opacity-100' : 'opacity-0',\n className\n )}\n style={position ? { left: position.x, top: position.y } : { opacity: 0 }}\n onMouseEnter={() => {\n setIsHoveringTooltip(true);\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n }}\n onMouseLeave={() => {\n setIsHoveringTooltip(false);\n }}\n >\n {message}\n {/* {position && (\n <div\n className={getArrowClasses(position.placement)}\n style={{ left: position.arrow.x, top: position.arrow.y }}\n />\n )} */}\n </div>,\n document.body\n )}\n </>\n );\n}\n\nexport default Tooltip;\n"],"names":["AccordionItem","id","title","content","children","className","disabled","isOpen","onToggle","triggerClassName","bodyClassName","fallbackId","useId","itemId","headerId","panelId","handleToggle","handleKeyDown","e","jsxs","join","jsx","ChevronDown","Accordion","items","itemClassName","allowMultiple","defaultOpenItems","triggersClassName","bodiesClassName","groupId","groupName","openItems","setOpenItems","useState","toggleItem","prev","newOpenItems","getItemId","index","isItemOpen","item","React","child","createElement","LoadingDots","activeIndex","setActiveIndex","useEffect","interval","prevIndex","buttonVariants","sizeVariants","roundedVariants","buttonDefaults","Button","variant","size","rounded","loading","linkTo","linkProps","type","rest","adjustedSize","buttonClasses","useFilledBackgroundColor","filledBackgroundColor","setFilledBackgroundColor","getFirstNonTransparentBackgroundColor","useCallback","element","currentElement","color","backgroundColor","checkbox","Checkbox","ref","filled","checked","onCheckedChange","props","generatedId","checkboxId","useMemo","parentBackgroundColor","isChecked","setIsChecked","handleChange","handleOnKeyDown","checkboxClasses","Check","Clickable","onButtonClick","buttonProps","StatusHelpMessage","elementId","message","ExclamationTriangle","CheckCircled","inputVariants","inputDefaults","Input","displayOnlyMode","errorMessage","successMessage","showPassword","setShowPassword","adjustedRound","inputClasses","EyeOpened","EyeClosed","Label","display","width","required","helpMessage","suffix","htmlFor","labelClasses","helpId","QuestionMarkCircled","useAnimationOpenClose","show","setShow","shouldRender","setShouldRender","useDocumentChanges","onClose","handleEscape","useHandleFocus","modalId","previousActiveElement","useRef","focusAppropriateElement","modalElement","modalActions","focusableElements","allBesidesCloseButton","el","Modal","contentOnly","overlayClassName","hideCloseButton","actions","disableCloseOnOverlayClick","ariaLabelledBy","ariaDescribedBy","titleId","renderTitle","renderActions","action","label","Fragment","createPortal","X","RadioInput","onChange","name","baseClasses","handleClick","radioClasses","RadioGroupItem","value","isSelected","hideInput","description","useRadioFocus","selectedOptionIndex","focusedIndex","setFocusedIndex","clickedIndex","setClickedIndex","isMouseDown","setIsMouseDown","handleClicked","options","target","_a","setInitialFocus","indexToFocus","handleFocusPreceding","currentIndex","previousIndex","handleKeyboardNavigation","option","newIndex","getRadioOptions","radioGroup","handleFocus","handleMouseDown","handleMouseUp","RadioGroup","childrenClassName","hideInputs","processedOptions","acc","Slot","isValidElement","allProps","cloneElement","node","CharacterCount","maxLength","characterCount","setCharacterCount","textarea","updateCharacterCount","updatedCharacterCount","isError","useAutoExpand","autoExpand","adjustHeight","textareaVariants","textareaDefaults","Textarea","hideResizeHandle","characterLimit","adjustedHideResizeHandle","VIEWPORT_PADDING","TOOLTIP_OFFSET","ARROW_SIZE","useCalculatePosition","placement","targetElement","tooltipElement","targetRect","tooltipRect","viewport","isOutOfBounds","x","y","height","positions","bestPlacement","bestPosition","oppositePlacement","oppositePos","otherPlacements","p","pos","targetCenter","useTooltipPosition","calculatePosition","setPosition","triggerRef","tooltipRef","updatePosition","newPosition","handleUpdate","useTooltipEvents","delay","setIsVisible","isHoveringTrigger","isHoveringTooltip","isFocused","isVisible","timeoutRef","showTooltip","hideTooltip","forceHide","Tooltip","position","setIsHoveringTrigger","setIsHoveringTooltip","setIsFocused","reactId","tooltipId"],"mappings":"8QAcO,SAASA,EAAc,CAC5B,GAAAC,EACA,MAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,EAAW,GACX,OAAAC,EAAS,GACT,SAAAC,EACA,iBAAAC,EAAmB,GACnB,cAAAC,EAAgB,EAClB,EAAuB,CACrB,MAAMC,EAAaC,E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