@moondreamsdev/dreamer-ui 1.7.4-test.13 → 1.7.4-test.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.cjs.js +1 -1
- package/dist/components.esm.js +18 -18
- package/dist/providers.cjs.js +1 -1
- package/dist/providers.esm.js +1 -1
- package/dist/src/components/accordion/AccordionItem.d.ts +0 -1
- package/dist/src/components/clickable/Clickable.d.ts +0 -1
- package/dist/src/components/radiogroup/RadioGroupItem.d.ts +0 -1
- package/dist/src/hooks/useActionModal.d.ts +0 -1
- package/dist/styles-BRnV0P3g.cjs +2 -0
- package/dist/styles-BRnV0P3g.cjs.map +1 -0
- package/dist/{styles-Bi0bIt3r.js → styles-BUA-lVPu.js} +41 -42
- package/dist/styles-BUA-lVPu.js.map +1 -0
- package/package.json +1 -1
- package/dist/styles-Bi0bIt3r.js.map +0 -1
- package/dist/styles-Bq-bBkmJ.cjs +0 -2
- package/dist/styles-Bq-bBkmJ.cjs.map +0 -1
package/dist/components.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("react"),p=require("./utils.cjs.js"),C=require("./QuestionMarkCircled-o1tqa8ZJ.cjs"),N=require("./styles-Bq-bBkmJ.cjs"),F=require("react-dom");function E({id:n,title:r,content:e,children:t,className:s="",disabled:o=!1,isOpen:i=!1,onToggle:u,triggerClassName:c="",bodyClassName:x=""}){const g=l.useId(),d=n||`accordion-item-${g}`,y=`${d}-header`,b=`${d}-panel`,f=()=>{!o&&u&&u()},j=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),f())};return a.jsxs("div",{className:p.join("border-b border-gray-200",o&&"opacity-60 cursor-not-allowed",s),children:[a.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",o?"cursor-not-allowed":"hover:bg-gray-50/10 cursor-pointer",c),"aria-expanded":i,"aria-controls":b,disabled:o,onClick:f,onKeyDown:j,children:[a.jsx("span",{children:r}),a.jsx("span",{className:p.join("transform transition-transform duration-300 ease-linear",i?"rotate-180":"rotate-0"),"aria-hidden":"true",children:a.jsx(C.ChevronDown,{size:18})})]}),a.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&&(t||e)})]})}function G({id:n,items:r=[],children:e,className:t="",itemClassName:s="",allowMultiple:o=!1,defaultOpenItems:i=[],triggersClassName:u="",bodiesClassName:c=""}){const x=l.useId(),g=n||`accordion-group-${x}`,[d,y]=l.useState(new Set(i)),b=m=>{y(h=>{const v=new Set(h);return v.has(m)?v.delete(m):(o||v.clear(),v.add(m)),v})},f=m=>`${x}-item-${m}`,j=m=>d.has(m);return a.jsxs("div",{id:g,className:t,children:[r.length>0&&r.map((m,h)=>{const v=m.id||f(h);return a.jsx(E,{id:v,title:m.title,content:m.content,disabled:m.disabled,isOpen:j(v),onToggle:()=>b(v),className:s,triggerClassName:u,bodyClassName:c},v)}),r.length===0&&e&&l.Children.map(e,(m,h)=>{if(l.isValidElement(m)&&m.type===E){const v=m.props.id||f(h);return l.createElement(E,{...m.props,key:v,id:v,className:p.join(s,m.props.className),isOpen:j(v),onToggle:()=>b(v),triggerClassName:p.join(u,m.props.triggerClassName),bodyClassName:p.join(c,m.props.bodyClassName)})}return null})]})}function L(){const[n,r]=l.useState(0);return l.useEffect(()=>{const e=setInterval(()=>{r(t=>(t+1)%3)},500);return()=>clearInterval(e)},[]),a.jsx("div",{className:"absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle",children:[0,1,2].map(e=>a.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",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/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"},k={variant:"primary",size:"md",rounded:"md"};function R({variant:n=k.variant,size:r,rounded:e=k.rounded,loading:t,linkTo:s,linkProps:o,type:i="button",className:u,...c}){let x;n==="link"&&!r?x="fitted":x=r||k.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],t&&"relative pointer-events-none",s&&"relative",u);return a.jsxs("button",{...c,role:s?"link":c.role,"aria-label":c["aria-label"]||(o==null?void 0:o["aria-label"]),"aria-description":c["aria-description"]||(o==null?void 0:o["aria-description"]),"aria-disabled":c.disabled||t,"aria-busy":t,type:i,className:d,children:[t&&a.jsx(L,{}),a.jsx("span",{className:p.join(t&&"invisible"),children:c.children}),s&&!c.disabled&&a.jsx("a",{...o,"aria-hidden":!0,href:s,rel:(o==null?void 0:o.rel)||"noreferrer",className:"absolute inset-0"})]})}function U(n){const[r,e]=l.useState(""),t=l.useCallback(s=>{let o=s,i="";for(;o&&!i;){const u=window.getComputedStyle(o).backgroundColor;u&&u!=="transparent"&&u!=="rgba(0, 0, 0, 0)"&&(i=u),o=o.parentElement}return i||"transparent"},[]);return l.useEffect(()=>{const s=document.getElementById(n);if(s){const o=t(s.parentElement);e(o)}},[n,t]),r}function W({ref:n,id:r,size:e=20,color:t,filled:s=!1,rounded:o=!0,checked:i=!1,onCheckedChange:u,disabled:c,className:x="",...g}){const d=l.useId(),y=l.useMemo(()=>r||`checkbox-${d}`,[r,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())},v=p.join("flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",o&&"rounded",c&&"opacity-40 cursor-not-allowed",!c&&"cursor-pointer",x);return a.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:t,backgroundColor:f&&s?"currentcolor":"transparent"},className:v,...g,children:f&&a.jsx(C.Check,{size:e,color:s?b:void 0})})}function X({children:n,className:r,linkTo:e,linkProps:t,onButtonClick:s,buttonProps:o,...i}){return e&&s&&console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'),a.jsxs("div",{className:p.join("relative w-fit",r),...i,children:[n,e&&a.jsx("a",{...t,rel:(t==null?void 0:t.rel)||"noreferrer",href:e,className:p.join("absolute inset-0",t==null?void 0:t.className)}),!e&&s&&a.jsx("button",{...o,type:"button",onClick:s,className:p.join("absolute inset-0 cursor-pointer",o==null?void 0:o.className)})]})}function I({elementId:n,type:r,message:e}){return l.useEffect(()=>{const t=document.getElementById(n);if(t){if(!e&&r==="error"){t.removeAttribute("data-error");return}if(!e&&r==="success"){t.removeAttribute("data-success");return}return t.setAttribute("aria-describedby",`${n}-${r}-message`),t.setAttribute("aria-invalid",r==="error"?"true":"false"),r==="error"&&t.setAttribute("data-error","true"),r==="success"&&t.setAttribute("data-success","true"),()=>{t.removeAttribute("aria-describedby"),t.removeAttribute("aria-invalid"),t.removeAttribute("data-error"),t.removeAttribute("data-success")}}},[n,r,e]),e?a.jsxs("small",{className:p.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",r==="error"&&"text-destructive",r==="success"&&"text-success"),role:"status",children:[r==="error"?a.jsx(C.ExclamationTriangle,{}):a.jsx(C.CheckCircled,{}),a.jsx("span",{id:`${n}-${r}-message`,children:e})]}):null}const J={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"},Y={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},S={variant:"default",rounded:"none"};function Z({variant:n=S.variant,rounded:r,displayOnlyMode:e=!1,errorMessage:t,successMessage:s,type:o="text",className:i,...u}){const c=l.useId(),[x,g]=l.useState(!1);let d=r;n==="outline"&&!r&&(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&&J[n],!e&&Y[d],o==="password"&&"pr-10",!e&&"px-2 py-1",e&&"pointer-events-none",i);return a.jsxs("div",{className:p.join(e&&"cursor-text"),style:{height:u.height,width:u.width},children:[a.jsxs("div",{className:p.join(o==="password"&&"relative"),children:[a.jsx("input",{...u,id:c,type:o==="password"&&x?"text":o,"aria-disabled":u.disabled,readOnly:e,"aria-readonly":e||u["aria-readonly"],"data-error":t?!0:void 0,"data-success":s?!0:void 0,className:f}),o==="password"&&a.jsx("button",{onClick:()=>g(!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?a.jsx(C.EyeClosed$1,{size:20}):a.jsx(C.EyeClosed,{size:20})})]}),!e&&a.jsx(I,{elementId:c,type:"error",message:t}),!e&&a.jsx(I,{elementId:c,type:"success",message:s})]})}function _({display:n="inline",width:r="fit-content",className:e="",required:t,helpMessage:s,suffix:o,htmlFor:i,children:u,...c}){const x=l.useId(),g=p.join("font-medium",n,e),d=s?`${i??x}-help`:void 0;return a.jsxs("div",{style:{display:n==="inline"?"inline-flex":"flex",width:r},className:"relative",children:[a.jsxs("label",{className:g,htmlFor:i,...c,children:[u,t&&a.jsx("span",{className:"text-red-500 font-medium ml-1","aria-label":"required",children:"*"})]}),s&&a.jsx("span",{className:"text-gray-500 ml-1 size-fit -translate-y-1/3","aria-describedby":d,"aria-label":"Help information",title:s,children:a.jsx(C.QuestionMarkCircled,{})}),s&&a.jsx("div",{id:d,className:"sr-only",children:s}),o&&a.jsx("span",{className:"ml-1",children:o})]})}function M(n){const[r,e]=l.useState(!1),[t,s]=l.useState(!1);return l.useEffect(()=>{n?(s(!0),setTimeout(()=>e(!0),10)):(e(!1),setTimeout(()=>s(!1),150))},[n]),{show:r,shouldRender:t}}function O(n,r){l.useEffect(()=>{const e=t=>{t.key==="Escape"&&n&&r()};return document.addEventListener("keydown",e),n&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow="auto"}},[n,r])}function P(n,r){const e=l.useRef(null),t=l.useCallback(()=>{const s=document.getElementById(n);if(!s)return;const o=s.querySelectorAll('[data-modal-action="true"]');if(o.length>0){o[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(()=>(r&&(e.current=document.activeElement,t()),()=>{document.body.style.overflow="auto",e.current instanceof HTMLElement&&e.current.focus()}),[r,t])}function ee({id:n,isOpen:r,onClose:e,title:t,children:s,contentOnly:o=!1,className:i,overlayClassName:u,hideCloseButton:c=!1,actions:x=[],disableCloseOnOverlayClick:g=!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(r);if(P(f,h),O(h,e),!h)return null;const v=()=>t?l.isValidElement(t)?a.jsx("div",{className:"mb-4",children:t}):a.jsx("h2",{className:"mb-4 text-xl font-semibold",id:j,children:t}):null,w=()=>x.length===0?null:a.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(($,B)=>{const{label:q,className:T,...V}=$;return a.jsx(R,{className:T,type:"button",...V,"data-modal-action":"true",children:q},B)})});return a.jsx(a.Fragment,{children:F.createPortal(a.jsx("div",{"aria-labelledby":d??t?j:void 0,"aria-describedby":y,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-y-auto",children:a.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4",children:[a.jsx("div",{className:N.n("fixed inset-0 bg-black/20 transition-all",u),onClick:()=>{g||e()}}),o&&a.jsx("div",{className:N.n("relative w-fit",i),children:s}),!o&&a.jsxs("div",{id:f,tabIndex:-1,className:N.n("relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:ring ease-in duration-75",m?"opacity-100 scale-100":"opacity-0 scale-90",i),children:[!c&&a.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:a.jsx(C.X,{size:18})}),v(),s,w()]})]})}),document.body)})}function te({children:n,ref:r,...e}){if(l.isValidElement(n)){let t={...e};return n.props&&(t={...t,...n.props}),l.cloneElement(n,{...t,ref:s=>{typeof r=="function"?r(s):r&&(r.current=s)}})}return l.createElement("div",{...e,ref:r},n)}function z({itemId:n,checked:r,onChange:e,name:t,disabled:s=!1,className:o=""}){const i="relative inline-flex items-center justify-center rounded-full",u=()=>{s||e()},c=p.join(i,!r&&"hover:border-current/60",!s&&"border-current cursor-pointer",s&&"border-muted/60 cursor-not-allowed",o);return a.jsx("div",{id:n,role:"radio",tabIndex:-1,"aria-checked":r,"aria-disabled":s,"aria-description":`Radio button for ${t}`,"aria-labelledby":`${n}-label`,onClick:u,className:c,style:{width:"1em",height:"1em",padding:"0.1em",borderWidth:"0.06em"},children:r&&a.jsx("div",{className:p.join("size-full aspect-square rounded-full",s&&"bg-muted/60",!s&&"bg-current")})})}function A({value:n,children:r,className:e="",isSelected:t=!1,onChange:s,disabled:o=!1,hideInput:i=!1,description:u,name:c}){const g=`radio-${l.useId()}-${n}`,d=()=>{o||s==null||s(n)};return a.jsxs("div",{title:u,className:p.join("relative flex items-center",e,i&&`p-2 border-2 focus-within:border-dashed focus-within:${o?"border-current/50":"border-current/80"}`,i&&!t&&`border-transparent ${o?"":"not-focus-within:hover:border-border/60"}`,i&&t&&"border-border",o&&"opacity-60 cursor-not-allowed"),style:{gap:"0.5em"},children:[!i&&a.jsx(z,{itemId:g,name:c||"",checked:t,onChange:d,disabled:o,className:p.join(i&&"")}),a.jsx("div",{id:i?g:void 0,tabIndex:i?-1:void 0,role:i?"radio":void 0,onClick:i?d:void 0,"aria-checked":i?t?"true":"false":void 0,"aria-disabled":i?o:void 0,"aria-description":i?u||`Radio button for ${c}`:void 0,"aria-labelledby":i?`${g}-label`:void 0,className:p.join(i&&"size-full",typeof r=="object"&&"grow focus:outline-none"),children:a.jsx("label",{id:`${g}-label`,onClick:i?void 0:d,className:p.join(o&&"cursor-not-allowed",!o&&"cursor-pointer"),children:r})})]})}function re(n,r){const[e,t]=l.useState(r),[s,o]=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(),o(f))},[]),x=l.useCallback((b,f)=>{var m;if(b.preventDefault(),i||!f.length)return;const j=r!==-1?r:0;(m=f[j])==null||m.focus(),t(j),r!==-1&&c(f,j)},[r,i,c]),g=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(v=>!v.hasAttribute("disabled")&&v.tabIndex>=0),j=f.findIndex(v=>v.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($=>$.id===j.id))return;const h=e!==-1?e:0;let v=h;switch(b.key){case"ArrowUp":case"ArrowLeft":b.preventDefault(),v=h>0?h-1:f.length-1;break;case"ArrowDown":case"ArrowRight":b.preventDefault(),v=(h+1)%f.length;break;case" ":b.preventDefault(),c(f,h);return;case"Tab":g(b);return;default:return}(w=f[v])==null||w.focus(),t(v),s!==-1&&c(f,v)},[e,s,g,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),v=()=>u(!1);return document.addEventListener("keydown",m),b.addEventListener("focus",j),b.addEventListener("mousedown",h),document.addEventListener("mouseup",v),()=>{document.removeEventListener("keydown",m),b.removeEventListener("focus",j),b.removeEventListener("mousedown",h),document.removeEventListener("mouseup",v)}},[n,y,x,d])}function se({options:n=[],value:r,onChange:e,id:t,children:s,className:o="",childrenClassName:i="",hideInputs:u=!1}){const c=l.useId(),x=t||`radio-group-${c}`;re(x,n.findIndex(d=>d===r));const g=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 a.jsxs("div",{id:x,role:"radiogroup",tabIndex:0,className:p.join(o,"focus:outline-none"),children:[g.length>0&&g.map((d,y)=>a.jsx(A,{value:d.value,isSelected:r===d.value,onChange:e,name:x,disabled:d.disabled,description:d.description,hideInput:u,className:i,children:d.label},`${d.value}-${y}`)),g.length===0&&s&&l.Children.map(s,d=>l.isValidElement(d)&&d.type===A?a.jsx(A,{...d.props,className:p.join(i,d.props.className),hideInput:d.props.hideInput||u,isSelected:r===d.props.value,onChange:e,name:x,children:d.props.children}):null)]})}function ne({elementId:n,maxLength:r}){const[e,t]=l.useState(0);return l.useEffect(()=>{const s=document.getElementById(n);if(!s)return;const o=()=>{const i=s.value.length;t(i);const u=i>=r;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 o(),s.addEventListener("input",o),s.setAttribute("maxlength",String(r)),()=>{s.removeEventListener("input",o),s.removeAttribute("maxlength"),s.removeAttribute("aria-describedby"),s.removeAttribute("aria-invalid"),s.removeAttribute("data-error")}},[n,r]),a.jsx("small",{className:p.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",e>=r&&"text-destructive",e<r&&"text-current"),role:"status",children:a.jsxs("span",{id:`${n}-character-count`,children:[e," / ",r," characters"]})})}function oe(n,r){l.useEffect(()=>{const e=document.getElementById(n);if(!e)return;if(!r){e.style.height="auto";return}const t=()=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`};return t(),e.addEventListener("input",t),e.addEventListener("resize",t),window.addEventListener("resize",t),()=>{e.removeEventListener("input",t),e.removeEventListener("resize",t),window.removeEventListener("resize",t)}},[n,r])}const ae={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"},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:r,displayOnlyMode:e=!1,errorMessage:t,successMessage:s,hideResizeHandle:o=!1,autoExpand:i=!1,characterLimit:u=0,className:c,...x}){const g=l.useId();oe(g,i||e);let d=r;n==="outline"&&!r&&(d="md"),d=d||D.rounded;let y=o;(e||n==="left-line"&&!o)&&(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&&ae[n],!e&&ie[d],!e&&"px-2 py-1",e&&"pointer-events-none",y&&"no-resize-handle",c);return a.jsxs("div",{className:p.join("-space-y-1.5",e&&"cursor-text"),children:[a.jsx("textarea",{...x,id:g,"aria-disabled":x.disabled,readOnly:e,"aria-readonly":e||x["aria-readonly"],style:{resize:i?"none":void 0},className:f}),u>0&&a.jsx(ne,{elementId:g,maxLength:u}),!e&&a.jsx(I,{elementId:g,type:"error",message:t}),!e&&a.jsx(I,{elementId:g,type:"success",message:s})]})}exports.ActionModal=N.ActionModal;exports.Accordion=G;exports.AccordionItem=E;exports.Button=R;exports.ButtonLoadingDots=L;exports.Checkbox=W;exports.Clickable=X;exports.Input=Z;exports.Label=_;exports.Modal=ee;exports.RadioGroup=se;exports.RadioGroupItem=A;exports.RadioInput=z;exports.Slot=te;exports.Textarea=de;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("react"),p=require("./utils.cjs.js"),C=require("./QuestionMarkCircled-o1tqa8ZJ.cjs"),N=require("./styles-BRnV0P3g.cjs"),F=require("react-dom");function E({id:n,title:r,content:e,children:t,className:s="",disabled:o=!1,isOpen:i=!1,onToggle:u,triggerClassName:c="",bodyClassName:x=""}){const g=l.useId(),d=n||`accordion-item-${g}`,y=`${d}-header`,b=`${d}-panel`,f=()=>{!o&&u&&u()},j=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),f())};return a.jsxs("div",{className:p.join("border-b border-gray-200",o&&"opacity-60 cursor-not-allowed",s),children:[a.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",o?"cursor-not-allowed":"hover:bg-gray-50/10 cursor-pointer",c),"aria-expanded":i,"aria-controls":b,disabled:o,onClick:f,onKeyDown:j,children:[a.jsx("span",{children:r}),a.jsx("span",{className:p.join("transform transition-transform duration-300 ease-linear",i?"rotate-180":"rotate-0"),"aria-hidden":"true",children:a.jsx(C.ChevronDown,{size:18})})]}),a.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&&(t||e)})]})}function G({id:n,items:r=[],children:e,className:t="",itemClassName:s="",allowMultiple:o=!1,defaultOpenItems:i=[],triggersClassName:u="",bodiesClassName:c=""}){const x=l.useId(),g=n||`accordion-group-${x}`,[d,y]=l.useState(new Set(i)),b=m=>{y(h=>{const v=new Set(h);return v.has(m)?v.delete(m):(o||v.clear(),v.add(m)),v})},f=m=>`${x}-item-${m}`,j=m=>d.has(m);return a.jsxs("div",{id:g,className:t,children:[r.length>0&&r.map((m,h)=>{const v=m.id||f(h);return a.jsx(E,{id:v,title:m.title,content:m.content,disabled:m.disabled,isOpen:j(v),onToggle:()=>b(v),className:s,triggerClassName:u,bodyClassName:c},v)}),r.length===0&&e&&l.Children.map(e,(m,h)=>{if(l.isValidElement(m)&&m.type===E){const v=m.props.id||f(h);return l.createElement(E,{...m.props,key:v,id:v,className:p.join(s,m.props.className),isOpen:j(v),onToggle:()=>b(v),triggerClassName:p.join(u,m.props.triggerClassName),bodyClassName:p.join(c,m.props.bodyClassName)})}return null})]})}function L(){const[n,r]=l.useState(0);return l.useEffect(()=>{const e=setInterval(()=>{r(t=>(t+1)%3)},500);return()=>clearInterval(e)},[]),a.jsx("div",{className:"absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle",children:[0,1,2].map(e=>a.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",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/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"},k={variant:"primary",size:"md",rounded:"md"};function R({variant:n=k.variant,size:r,rounded:e=k.rounded,loading:t,linkTo:s,linkProps:o,type:i="button",className:u,...c}){let x;n==="link"&&!r?x="fitted":x=r||k.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],t&&"relative pointer-events-none",s&&"relative",u);return a.jsxs("button",{...c,role:s?"link":c.role,"aria-label":c["aria-label"]||(o==null?void 0:o["aria-label"]),"aria-description":c["aria-description"]||(o==null?void 0:o["aria-description"]),"aria-disabled":c.disabled||t,"aria-busy":t,type:i,className:d,children:[t&&a.jsx(L,{}),a.jsx("span",{className:p.join(t&&"invisible"),children:c.children}),s&&!c.disabled&&a.jsx("a",{...o,"aria-hidden":!0,href:s,rel:(o==null?void 0:o.rel)||"noreferrer",className:"absolute inset-0"})]})}function U(n){const[r,e]=l.useState(""),t=l.useCallback(s=>{let o=s,i="";for(;o&&!i;){const u=window.getComputedStyle(o).backgroundColor;u&&u!=="transparent"&&u!=="rgba(0, 0, 0, 0)"&&(i=u),o=o.parentElement}return i||"transparent"},[]);return l.useEffect(()=>{const s=document.getElementById(n);if(s){const o=t(s.parentElement);e(o)}},[n,t]),r}function W({ref:n,id:r,size:e=20,color:t,filled:s=!1,rounded:o=!0,checked:i=!1,onCheckedChange:u,disabled:c,className:x="",...g}){const d=l.useId(),y=l.useMemo(()=>r||`checkbox-${d}`,[r,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())},v=p.join("flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",o&&"rounded",c&&"opacity-40 cursor-not-allowed",!c&&"cursor-pointer",x);return a.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:t,backgroundColor:f&&s?"currentcolor":"transparent"},className:v,...g,children:f&&a.jsx(C.Check,{size:e,color:s?b:void 0})})}function X({children:n,className:r,linkTo:e,linkProps:t,onButtonClick:s,buttonProps:o,...i}){return e&&s&&console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'),a.jsxs("div",{className:p.join("relative w-fit",r),...i,children:[n,e&&a.jsx("a",{...t,rel:(t==null?void 0:t.rel)||"noreferrer",href:e,className:p.join("absolute inset-0",t==null?void 0:t.className)}),!e&&s&&a.jsx("button",{...o,type:"button",onClick:s,className:p.join("absolute inset-0 cursor-pointer",o==null?void 0:o.className)})]})}function I({elementId:n,type:r,message:e}){return l.useEffect(()=>{const t=document.getElementById(n);if(t){if(!e&&r==="error"){t.removeAttribute("data-error");return}if(!e&&r==="success"){t.removeAttribute("data-success");return}return t.setAttribute("aria-describedby",`${n}-${r}-message`),t.setAttribute("aria-invalid",r==="error"?"true":"false"),r==="error"&&t.setAttribute("data-error","true"),r==="success"&&t.setAttribute("data-success","true"),()=>{t.removeAttribute("aria-describedby"),t.removeAttribute("aria-invalid"),t.removeAttribute("data-error"),t.removeAttribute("data-success")}}},[n,r,e]),e?a.jsxs("small",{className:p.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",r==="error"&&"text-destructive",r==="success"&&"text-success"),role:"status",children:[r==="error"?a.jsx(C.ExclamationTriangle,{}):a.jsx(C.CheckCircled,{}),a.jsx("span",{id:`${n}-${r}-message`,children:e})]}):null}const J={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"},Y={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},S={variant:"default",rounded:"none"};function Z({variant:n=S.variant,rounded:r,displayOnlyMode:e=!1,errorMessage:t,successMessage:s,type:o="text",className:i,...u}){const c=l.useId(),[x,g]=l.useState(!1);let d=r;n==="outline"&&!r&&(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&&J[n],!e&&Y[d],o==="password"&&"pr-10",!e&&"px-2 py-1",e&&"pointer-events-none",i);return a.jsxs("div",{className:p.join(e&&"cursor-text"),style:{height:u.height,width:u.width},children:[a.jsxs("div",{className:p.join(o==="password"&&"relative"),children:[a.jsx("input",{...u,id:c,type:o==="password"&&x?"text":o,"aria-disabled":u.disabled,readOnly:e,"aria-readonly":e||u["aria-readonly"],"data-error":t?!0:void 0,"data-success":s?!0:void 0,className:f}),o==="password"&&a.jsx("button",{onClick:()=>g(!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?a.jsx(C.EyeClosed$1,{size:20}):a.jsx(C.EyeClosed,{size:20})})]}),!e&&a.jsx(I,{elementId:c,type:"error",message:t}),!e&&a.jsx(I,{elementId:c,type:"success",message:s})]})}function _({display:n="inline",width:r="fit-content",className:e="",required:t,helpMessage:s,suffix:o,htmlFor:i,children:u,...c}){const x=l.useId(),g=p.join("font-medium",n,e),d=s?`${i??x}-help`:void 0;return a.jsxs("div",{style:{display:n==="inline"?"inline-flex":"flex",width:r},className:"relative",children:[a.jsxs("label",{className:g,htmlFor:i,...c,children:[u,t&&a.jsx("span",{className:"text-red-500 font-medium ml-1","aria-label":"required",children:"*"})]}),s&&a.jsx("span",{className:"text-gray-500 ml-1 size-fit -translate-y-1/3","aria-describedby":d,"aria-label":"Help information",title:s,children:a.jsx(C.QuestionMarkCircled,{})}),s&&a.jsx("div",{id:d,className:"sr-only",children:s}),o&&a.jsx("span",{className:"ml-1",children:o})]})}function M(n){const[r,e]=l.useState(!1),[t,s]=l.useState(!1);return l.useEffect(()=>{n?(s(!0),setTimeout(()=>e(!0),10)):(e(!1),setTimeout(()=>s(!1),150))},[n]),{show:r,shouldRender:t}}function O(n,r){l.useEffect(()=>{const e=t=>{t.key==="Escape"&&n&&r()};return document.addEventListener("keydown",e),n&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow="auto"}},[n,r])}function P(n,r){const e=l.useRef(null),t=l.useCallback(()=>{const s=document.getElementById(n);if(!s)return;const o=s.querySelectorAll('[data-modal-action="true"]');if(o.length>0){o[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(()=>(r&&(e.current=document.activeElement,t()),()=>{document.body.style.overflow="auto",e.current instanceof HTMLElement&&e.current.focus()}),[r,t])}function ee({id:n,isOpen:r,onClose:e,title:t,children:s,contentOnly:o=!1,className:i,overlayClassName:u,hideCloseButton:c=!1,actions:x=[],disableCloseOnOverlayClick:g=!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(r);if(P(f,h),O(h,e),!h)return null;const v=()=>t?l.isValidElement(t)?a.jsx("div",{className:"mb-4",children:t}):a.jsx("h2",{className:"mb-4 text-xl font-semibold",id:j,children:t}):null,w=()=>x.length===0?null:a.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(($,B)=>{const{label:q,className:T,...V}=$;return a.jsx(R,{className:T,type:"button",...V,"data-modal-action":"true",children:q},B)})});return a.jsx(a.Fragment,{children:F.createPortal(a.jsx("div",{"aria-labelledby":d??t?j:void 0,"aria-describedby":y,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-y-auto",children:a.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4",children:[a.jsx("div",{className:N.n("fixed inset-0 bg-black/20 transition-all",u),onClick:()=>{g||e()}}),o&&a.jsx("div",{className:N.n("relative w-fit",i),children:s}),!o&&a.jsxs("div",{id:f,tabIndex:-1,className:N.n("relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:ring ease-in duration-75",m?"opacity-100 scale-100":"opacity-0 scale-90",i),children:[!c&&a.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:a.jsx(C.X,{size:18})}),v(),s,w()]})]})}),document.body)})}function te({children:n,ref:r,...e}){if(l.isValidElement(n)){let t={...e};return n.props&&(t={...t,...n.props}),l.cloneElement(n,{...t,ref:s=>{typeof r=="function"?r(s):r&&(r.current=s)}})}return l.createElement("div",{...e,ref:r},n)}function z({itemId:n,checked:r,onChange:e,name:t,disabled:s=!1,className:o=""}){const i="relative inline-flex items-center justify-center rounded-full",u=()=>{s||e()},c=p.join(i,!r&&"hover:border-current/60",!s&&"border-current cursor-pointer",s&&"border-muted/60 cursor-not-allowed",o);return a.jsx("div",{id:n,role:"radio",tabIndex:-1,"aria-checked":r,"aria-disabled":s,"aria-description":`Radio button for ${t}`,"aria-labelledby":`${n}-label`,onClick:u,className:c,style:{width:"1em",height:"1em",padding:"0.1em",borderWidth:"0.06em"},children:r&&a.jsx("div",{className:p.join("size-full aspect-square rounded-full",s&&"bg-muted/60",!s&&"bg-current")})})}function A({value:n,children:r,className:e="",isSelected:t=!1,onChange:s,disabled:o=!1,hideInput:i=!1,description:u,name:c}){const g=`radio-${l.useId()}-${n}`,d=()=>{o||s==null||s(n)};return a.jsxs("div",{title:u,className:p.join("relative flex items-center",e,i&&`p-2 border-2 focus-within:border-dashed focus-within:${o?"border-current/50":"border-current/80"}`,i&&!t&&`border-transparent ${o?"":"not-focus-within:hover:border-border/60"}`,i&&t&&"border-border",o&&"opacity-60 cursor-not-allowed"),style:{gap:"0.5em"},children:[!i&&a.jsx(z,{itemId:g,name:c||"",checked:t,onChange:d,disabled:o,className:p.join(i&&"")}),a.jsx("div",{id:i?g:void 0,tabIndex:i?-1:void 0,role:i?"radio":void 0,onClick:i?d:void 0,"aria-checked":i?t?"true":"false":void 0,"aria-disabled":i?o:void 0,"aria-description":i?u||`Radio button for ${c}`:void 0,"aria-labelledby":i?`${g}-label`:void 0,className:p.join(i&&"size-full",typeof r=="object"&&"grow focus:outline-none"),children:a.jsx("label",{id:`${g}-label`,onClick:i?void 0:d,className:p.join(o&&"cursor-not-allowed",!o&&"cursor-pointer"),children:r})})]})}function re(n,r){const[e,t]=l.useState(r),[s,o]=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(),o(f))},[]),x=l.useCallback((b,f)=>{var m;if(b.preventDefault(),i||!f.length)return;const j=r!==-1?r:0;(m=f[j])==null||m.focus(),t(j),r!==-1&&c(f,j)},[r,i,c]),g=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(v=>!v.hasAttribute("disabled")&&v.tabIndex>=0),j=f.findIndex(v=>v.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($=>$.id===j.id))return;const h=e!==-1?e:0;let v=h;switch(b.key){case"ArrowUp":case"ArrowLeft":b.preventDefault(),v=h>0?h-1:f.length-1;break;case"ArrowDown":case"ArrowRight":b.preventDefault(),v=(h+1)%f.length;break;case" ":b.preventDefault(),c(f,h);return;case"Tab":g(b);return;default:return}(w=f[v])==null||w.focus(),t(v),s!==-1&&c(f,v)},[e,s,g,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),v=()=>u(!1);return document.addEventListener("keydown",m),b.addEventListener("focus",j),b.addEventListener("mousedown",h),document.addEventListener("mouseup",v),()=>{document.removeEventListener("keydown",m),b.removeEventListener("focus",j),b.removeEventListener("mousedown",h),document.removeEventListener("mouseup",v)}},[n,y,x,d])}function se({options:n=[],value:r,onChange:e,id:t,children:s,className:o="",childrenClassName:i="",hideInputs:u=!1}){const c=l.useId(),x=t||`radio-group-${c}`;re(x,n.findIndex(d=>d===r));const g=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 a.jsxs("div",{id:x,role:"radiogroup",tabIndex:0,className:p.join(o,"focus:outline-none"),children:[g.length>0&&g.map((d,y)=>a.jsx(A,{value:d.value,isSelected:r===d.value,onChange:e,name:x,disabled:d.disabled,description:d.description,hideInput:u,className:i,children:d.label},`${d.value}-${y}`)),g.length===0&&s&&l.Children.map(s,d=>l.isValidElement(d)&&d.type===A?a.jsx(A,{...d.props,className:p.join(i,d.props.className),hideInput:d.props.hideInput||u,isSelected:r===d.props.value,onChange:e,name:x,children:d.props.children}):null)]})}function ne({elementId:n,maxLength:r}){const[e,t]=l.useState(0);return l.useEffect(()=>{const s=document.getElementById(n);if(!s)return;const o=()=>{const i=s.value.length;t(i);const u=i>=r;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 o(),s.addEventListener("input",o),s.setAttribute("maxlength",String(r)),()=>{s.removeEventListener("input",o),s.removeAttribute("maxlength"),s.removeAttribute("aria-describedby"),s.removeAttribute("aria-invalid"),s.removeAttribute("data-error")}},[n,r]),a.jsx("small",{className:p.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",e>=r&&"text-destructive",e<r&&"text-current"),role:"status",children:a.jsxs("span",{id:`${n}-character-count`,children:[e," / ",r," characters"]})})}function oe(n,r){l.useEffect(()=>{const e=document.getElementById(n);if(!e)return;if(!r){e.style.height="auto";return}const t=()=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`};return t(),e.addEventListener("input",t),e.addEventListener("resize",t),window.addEventListener("resize",t),()=>{e.removeEventListener("input",t),e.removeEventListener("resize",t),window.removeEventListener("resize",t)}},[n,r])}const ae={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"},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:r,displayOnlyMode:e=!1,errorMessage:t,successMessage:s,hideResizeHandle:o=!1,autoExpand:i=!1,characterLimit:u=0,className:c,...x}){const g=l.useId();oe(g,i||e);let d=r;n==="outline"&&!r&&(d="md"),d=d||D.rounded;let y=o;(e||n==="left-line"&&!o)&&(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&&ae[n],!e&&ie[d],!e&&"px-2 py-1",e&&"pointer-events-none",y&&"no-resize-handle",c);return a.jsxs("div",{className:p.join("-space-y-1.5",e&&"cursor-text"),children:[a.jsx("textarea",{...x,id:g,"aria-disabled":x.disabled,readOnly:e,"aria-readonly":e||x["aria-readonly"],style:{resize:i?"none":void 0},className:f}),u>0&&a.jsx(ne,{elementId:g,maxLength:u}),!e&&a.jsx(I,{elementId:g,type:"error",message:t}),!e&&a.jsx(I,{elementId:g,type:"success",message:s})]})}exports.ActionModal=N.ActionModal;exports.Accordion=G;exports.AccordionItem=E;exports.Button=R;exports.ButtonLoadingDots=L;exports.Checkbox=W;exports.Clickable=X;exports.Input=Z;exports.Label=_;exports.Modal=ee;exports.RadioGroup=se;exports.RadioGroupItem=A;exports.RadioInput=z;exports.Slot=te;exports.Textarea=de;
|
|
2
2
|
//# sourceMappingURL=components.cjs.js.map
|
package/dist/components.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as w, jsx as d, Fragment as G } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import I, { useId as A, useState as C, createElement as V, useEffect as E, useCallback as $, useMemo as F, useRef as Q, isValidElement as U, cloneElement as W } from "react";
|
|
3
3
|
import { join as g } from "./utils.esm.js";
|
|
4
4
|
import { b as X, C as J, E as Y, a as Z, d as _, c as M, Q as O, X as P } from "./QuestionMarkCircled-JRFAPLtT.js";
|
|
5
|
-
import { n as L } from "./styles-
|
|
6
|
-
import { A as Re } from "./styles-
|
|
5
|
+
import { n as L } from "./styles-BUA-lVPu.js";
|
|
6
|
+
import { A as Re } from "./styles-BUA-lVPu.js";
|
|
7
7
|
import { createPortal as ee } from "react-dom";
|
|
8
8
|
function j({
|
|
9
9
|
id: a,
|
|
@@ -106,8 +106,8 @@ function Ee({
|
|
|
106
106
|
v
|
|
107
107
|
);
|
|
108
108
|
}),
|
|
109
|
-
r.length === 0 && e &&
|
|
110
|
-
if (
|
|
109
|
+
r.length === 0 && e && I.Children.map(e, (f, h) => {
|
|
110
|
+
if (I.isValidElement(f) && f.type === j) {
|
|
111
111
|
const v = f.props.id || c(h);
|
|
112
112
|
return /* @__PURE__ */ V(
|
|
113
113
|
j,
|
|
@@ -223,7 +223,7 @@ function oe({
|
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
function se(a) {
|
|
226
|
-
const [r, e] = C(""), t =
|
|
226
|
+
const [r, e] = C(""), t = $((n) => {
|
|
227
227
|
let o = n, s = "";
|
|
228
228
|
for (; o && !s; ) {
|
|
229
229
|
const l = window.getComputedStyle(o).backgroundColor;
|
|
@@ -291,7 +291,7 @@ function Ae({
|
|
|
291
291
|
}
|
|
292
292
|
);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function $e({
|
|
295
295
|
children: a,
|
|
296
296
|
className: r,
|
|
297
297
|
linkTo: e,
|
|
@@ -369,7 +369,7 @@ const ie = {
|
|
|
369
369
|
variant: "default",
|
|
370
370
|
rounded: "none"
|
|
371
371
|
};
|
|
372
|
-
function
|
|
372
|
+
function Ie({
|
|
373
373
|
variant: a = B.variant,
|
|
374
374
|
rounded: r,
|
|
375
375
|
displayOnlyMode: e = !1,
|
|
@@ -471,7 +471,7 @@ function ue(a, r) {
|
|
|
471
471
|
}, [a, r]);
|
|
472
472
|
}
|
|
473
473
|
function ce(a, r) {
|
|
474
|
-
const e = Q(null), t =
|
|
474
|
+
const e = Q(null), t = $(() => {
|
|
475
475
|
const n = document.getElementById(a);
|
|
476
476
|
if (!n) return;
|
|
477
477
|
const o = n.querySelectorAll('[data-modal-action="true"]');
|
|
@@ -514,7 +514,7 @@ function ke({
|
|
|
514
514
|
}) {
|
|
515
515
|
const m = A(), c = a || `modal-${m}`, x = a ? `${a}-title` : `modal-title-${m}`, { show: f, shouldRender: h } = le(r);
|
|
516
516
|
if (ce(c, h), ue(h, e), !h) return null;
|
|
517
|
-
const v = () => t ?
|
|
517
|
+
const v = () => t ? I.isValidElement(t) ? /* @__PURE__ */ d("div", { className: "mb-4", children: t }) : /* @__PURE__ */ d("h2", { className: "mb-4 text-xl font-semibold", id: x, children: t }) : null, N = () => b.length === 0 ? null : /* @__PURE__ */ d("div", { className: "mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3", children: b.map((k, q) => {
|
|
518
518
|
const { label: T, className: H, ...K } = k;
|
|
519
519
|
return /* @__PURE__ */ d(oe, { className: H, type: "button", ...K, "data-modal-action": "true", children: T }, q);
|
|
520
520
|
}) });
|
|
@@ -690,11 +690,11 @@ function S({
|
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
692
|
function me(a, r) {
|
|
693
|
-
const [e, t] = C(r), [n, o] = C(-1), [s, l] = C(!1), u =
|
|
693
|
+
const [e, t] = C(r), [n, o] = C(-1), [s, l] = C(!1), u = $((m, c) => {
|
|
694
694
|
var h;
|
|
695
695
|
const x = m[c];
|
|
696
696
|
x.hasAttribute("disabled") || x.getAttribute("aria-disabled") === "true" || ((h = m[c]) == null || h.click(), o(c));
|
|
697
|
-
}, []), b =
|
|
697
|
+
}, []), b = $(
|
|
698
698
|
(m, c) => {
|
|
699
699
|
var f;
|
|
700
700
|
if (m.preventDefault(), s || !c.length) return;
|
|
@@ -702,7 +702,7 @@ function me(a, r) {
|
|
|
702
702
|
(f = c[x]) == null || f.focus(), t(x), r !== -1 && u(c, x);
|
|
703
703
|
},
|
|
704
704
|
[r, s, u]
|
|
705
|
-
), p =
|
|
705
|
+
), p = $(
|
|
706
706
|
(m) => {
|
|
707
707
|
var h;
|
|
708
708
|
if (!m.shiftKey)
|
|
@@ -716,7 +716,7 @@ function me(a, r) {
|
|
|
716
716
|
(h = c[f]) == null || h.focus();
|
|
717
717
|
},
|
|
718
718
|
[a]
|
|
719
|
-
), i =
|
|
719
|
+
), i = $(
|
|
720
720
|
(m, c) => {
|
|
721
721
|
var N;
|
|
722
722
|
if (!c.length) return;
|
|
@@ -746,7 +746,7 @@ function me(a, r) {
|
|
|
746
746
|
(N = c[v]) == null || N.focus(), t(v), n !== -1 && u(c, v);
|
|
747
747
|
},
|
|
748
748
|
[e, n, p, u]
|
|
749
|
-
), y =
|
|
749
|
+
), y = $(() => {
|
|
750
750
|
const m = document.querySelector(`[id="${a}"][role="radiogroup"]`);
|
|
751
751
|
return m ? Array.from(m.querySelectorAll('[role="radio"]')) : [];
|
|
752
752
|
}, [a]);
|
|
@@ -791,7 +791,7 @@ function je({
|
|
|
791
791
|
},
|
|
792
792
|
`${i.value}-${y}`
|
|
793
793
|
)),
|
|
794
|
-
p.length === 0 && n &&
|
|
794
|
+
p.length === 0 && n && I.Children.map(n, (i) => I.isValidElement(i) && i.type === S ? /* @__PURE__ */ d(
|
|
795
795
|
S,
|
|
796
796
|
{
|
|
797
797
|
...i.props,
|
|
@@ -923,8 +923,8 @@ export {
|
|
|
923
923
|
oe as Button,
|
|
924
924
|
te as ButtonLoadingDots,
|
|
925
925
|
Ae as Checkbox,
|
|
926
|
-
|
|
927
|
-
|
|
926
|
+
$e as Clickable,
|
|
927
|
+
Ie as Input,
|
|
928
928
|
De as Label,
|
|
929
929
|
ke as Modal,
|
|
930
930
|
je as RadioGroup,
|
package/dist/providers.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),o=require("./styles-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),o=require("./styles-BRnV0P3g.cjs");require("react-dom");const f=require("./useActionModal-CqT8y2he.cjs");function v({children:a}){const[e,s]=r.useState(null),u=r.useCallback(t=>new Promise(i=>{s({isOpen:!0,type:"confirm",title:t.title,message:t.message,confirmText:t.confirmText,cancelText:t.cancelText,destructive:t.destructive,resolve:i})}),[]),m=r.useCallback(t=>new Promise(i=>{s({isOpen:!0,type:"alert",title:t.title,message:t.message,confirmText:t.confirmText,destructive:t.destructive,resolve:i})}),[]),l=r.useCallback(()=>{e!=null&&e.resolve&&(e.type==="confirm"?e.resolve(!1):e.resolve()),s(null)},[e]),c=r.useCallback(()=>{e!=null&&e.resolve&&(e.type==="confirm"?e.resolve(!0):e.resolve()),s(null)},[e]),d={confirm:u,alert:m};return n.jsxs(f.ActionModalContext.Provider,{value:d,children:[a,e&&e.type==="alert"&&n.jsx(o.ActionModal,{type:"alert",isOpen:e.isOpen,onClose:l,title:e.title,message:e.message,confirmText:e.confirmText,destructive:e.destructive,onConfirm:c,className:"bg-white dark:bg-gray-800 rounded-lg"}),e&&e.type==="confirm"&&n.jsx(o.ActionModal,{type:"confirm",isOpen:e.isOpen,onClose:l,title:e.title,message:e.message,confirmText:e.confirmText,cancelText:e.cancelText,destructive:e.destructive,onConfirm:c,className:"bg-white dark:bg-gray-800 rounded-lg"})]})}exports.ActionModalProvider=v;
|
|
2
2
|
//# sourceMappingURL=providers.cjs.js.map
|
package/dist/providers.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as d, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { useState as v, useCallback as s } from "react";
|
|
3
|
-
import { A as o } from "./styles-
|
|
3
|
+
import { A as o } from "./styles-BUA-lVPu.js";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
import { A as x } from "./useActionModal-C4X_-O9_.js";
|
|
6
6
|
function O({ children: m }) {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),o=require("react"),B=require("react-dom");function f(...e){return e.filter(t=>typeof t=="string"&&t).join(" ").trim()||void 0}function M({size:e=15,color:t="currentColor"}){return i.jsx("svg",{width:e,height:e,className:"inline",viewBox:"0 0 15 15",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:t,fillRule:"evenodd",clipRule:"evenodd"})})}function x(...e){return e.filter(t=>typeof t=="string"&&t).join(" ").trim()||void 0}o.createContext(void 0);function O(){const[e,t]=o.useState(0);return o.useEffect(()=>{const n=setInterval(()=>{t(r=>(r+1)%3)},500);return()=>clearInterval(n)},[]),i.jsx("div",{className:"absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle",children:[0,1,2].map(n=>i.jsx("div",{className:f("rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current",e===n&&"transform -translate-y-1")},n))})}const T={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"},q={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"},R={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"},y={variant:"primary",size:"md",rounded:"md"};function I({variant:e=y.variant,size:t,rounded:n=y.rounded,loading:r,linkTo:l,linkProps:a,type:c="button",className:u,...s}){let d;e==="link"&&!t?d="fitted":d=t||y.size;const m=f("appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",T[e],q[d],R[n],r&&"relative pointer-events-none",l&&"relative",u);return i.jsxs("button",{...s,role:l?"link":s.role,"aria-label":s["aria-label"]||(a==null?void 0:a["aria-label"]),"aria-description":s["aria-description"]||(a==null?void 0:a["aria-description"]),"aria-disabled":s.disabled||r,"aria-busy":r,type:c,className:m,children:[r&&i.jsx(O,{}),i.jsx("span",{className:f(r&&"invisible"),children:s.children}),l&&!s.disabled&&i.jsx("a",{...a,"aria-hidden":!0,href:l,rel:(a==null?void 0:a.rel)||"noreferrer",className:"absolute inset-0"})]})}function S(e){const[t,n]=o.useState(!1),[r,l]=o.useState(!1);return o.useEffect(()=>{e?(l(!0),setTimeout(()=>n(!0),10)):(n(!1),setTimeout(()=>l(!1),150))},[e]),{show:t,shouldRender:r}}function H(e,t){o.useEffect(()=>{const n=r=>{r.key==="Escape"&&e&&t()};return document.addEventListener("keydown",n),e&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",n),document.body.style.overflow="auto"}},[e,t])}function D(e,t){const n=o.useRef(null),r=o.useCallback(()=>{const l=document.getElementById(e);if(!l)return;const a=l.querySelectorAll('[data-modal-action="true"]');if(a.length>0){a[0].focus();return}const c=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(c.length>0){const u=Array.from(c).filter(s=>!(s instanceof HTMLButtonElement&&s.getAttribute("data-modal-close-button")==="true"));if(u.length>0){u[0].focus();return}c[0].focus();return}l.focus()},[e]);o.useEffect(()=>(t&&(n.current=document.activeElement,r()),()=>{document.body.style.overflow="auto",n.current instanceof HTMLElement&&n.current.focus()}),[t,r])}function K({id:e,isOpen:t,onClose:n,title:r,children:l,contentOnly:a=!1,className:c,overlayClassName:u,hideCloseButton:s=!1,actions:d=[],disableCloseOnOverlayClick:m=!1,ariaLabelledBy:h,ariaDescribedBy:j}){const v=o.useId(),p=e||`modal-${v}`,g=e?`${e}-title`:`modal-title-${v}`,{show:w,shouldRender:b}=S(t);if(D(p,b),H(b,n),!b)return null;const N=()=>r?o.isValidElement(r)?i.jsx("div",{className:"mb-4",children:r}):i.jsx("h2",{className:"mb-4 text-xl font-semibold",id:g,children:r}):null,k=()=>d.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:d.map((C,L)=>{const{label:E,className:z,...A}=C;return i.jsx(I,{className:z,type:"button",...A,"data-modal-action":"true",children:E},L)})});return i.jsx(i.Fragment,{children:B.createPortal(i.jsx("div",{"aria-labelledby":h??r?g:void 0,"aria-describedby":j,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:x("fixed inset-0 bg-black/20 transition-all",u),onClick:()=>{m||n()}}),a&&i.jsx("div",{className:x("relative w-fit",c),children:l}),!a&&i.jsxs("div",{id:p,tabIndex:-1,className:x("relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:ring ease-in duration-75",w?"opacity-100 scale-100":"opacity-0 scale-90",c),children:[!s&&i.jsx("button",{type:"button",onClick:n,"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(M,{size:18})}),N(),l,k()]})]})}),document.body)})}function P({type:e,message:t,cancelText:n,confirmText:r,onConfirm:l,onClose:a,destructive:c=!1,title:u,...s}){const d=o.useMemo(()=>e==="confirm"?{confirm:r||"Confirm",cancel:n||"Cancel",defaultTitle:u||"Confirm Action"}:{confirm:r||"OK",cancel:null,defaultTitle:u||"Alert"},[e,r,u,n]),m=o.useMemo(()=>[...d.cancel?[{label:d.cancel,variant:"secondary",onClick:a}]:[],{label:d.confirm,variant:c?"destructive":"primary",onClick:()=>{l==null||l(),a()}}],[d,c,l,a]);return i.jsx(K,{...s,title:u||d.defaultTitle,onClose:a,actions:m,disableCloseOnOverlayClick:e==="confirm",hideCloseButton:e==="confirm",children:typeof t=="string"?i.jsx("p",{className:"text-sm",children:t}):t})}exports.ActionModal=P;exports.n=f;
|
|
2
|
+
//# sourceMappingURL=styles-BRnV0P3g.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles-BRnV0P3g.cjs","sources":["utils.esm.js","QuestionMarkCircled-JRFAPLtT.js","styles-Bi0bIt3r.js","components.esm.js","../src/components/actionmodal/ActionModal.tsx"],"sourcesContent":["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 { jsx as e } from \"react/jsx-runtime\";\nfunction i({ size: C = 15, color: l = \"currentColor\" }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\",\n fill: l,\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction t({ size: C = 15 }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M7.49991 0.877045C3.84222 0.877045 0.877075 3.84219 0.877075 7.49988C0.877075 11.1575 3.84222 14.1227 7.49991 14.1227C11.1576 14.1227 14.1227 11.1575 14.1227 7.49988C14.1227 3.84219 11.1576 0.877045 7.49991 0.877045ZM1.82708 7.49988C1.82708 4.36686 4.36689 1.82704 7.49991 1.82704C10.6329 1.82704 13.1727 4.36686 13.1727 7.49988C13.1727 10.6329 10.6329 13.1727 7.49991 13.1727C4.36689 13.1727 1.82708 10.6329 1.82708 7.49988ZM10.1589 5.53774C10.3178 5.31191 10.2636 5.00001 10.0378 4.84109C9.81194 4.68217 9.50004 4.73642 9.34112 4.96225L6.51977 8.97154L5.35681 7.78706C5.16334 7.59002 4.84677 7.58711 4.64973 7.78058C4.45268 7.97404 4.44978 8.29061 4.64325 8.48765L6.22658 10.1003C6.33054 10.2062 6.47617 10.2604 6.62407 10.2483C6.77197 10.2363 6.90686 10.1591 6.99226 10.0377L10.1589 5.53774Z\",\n fill: \"currentColor\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction o({ size: C = 15, color: l = \"currentColor\" }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\",\n fill: l,\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction r({ size: C = 15 }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z\",\n fill: \"currentColor\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction d({ size: C = 15 }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M14.7649 6.07596C14.9991 6.22231 15.0703 6.53079 14.9239 6.76495C14.4849 7.46743 13.9632 8.10645 13.3702 8.66305L14.5712 9.86406C14.7664 10.0593 14.7664 10.3759 14.5712 10.5712C14.3759 10.7664 14.0593 10.7664 13.8641 10.5712L12.6011 9.30817C11.805 9.90283 10.9089 10.3621 9.93375 10.651L10.383 12.3277C10.4544 12.5944 10.2961 12.8685 10.0294 12.94C9.76267 13.0115 9.4885 12.8532 9.41704 12.5865L8.95917 10.8775C8.48743 10.958 8.00036 10.9999 7.50001 10.9999C6.99965 10.9999 6.51257 10.958 6.04082 10.8775L5.58299 12.5864C5.51153 12.8532 5.23737 13.0115 4.97064 12.94C4.7039 12.8686 4.5456 12.5944 4.61706 12.3277L5.06625 10.651C4.09111 10.3621 3.19503 9.90282 2.3989 9.30815L1.1359 10.5712C0.940638 10.7664 0.624058 10.7664 0.428798 10.5712C0.233537 10.3759 0.233537 10.0593 0.428798 9.86405L1.62982 8.66303C1.03682 8.10643 0.515113 7.46742 0.0760677 6.76495C-0.0702867 6.53079 0.000898544 6.22231 0.235065 6.07596C0.469231 5.9296 0.777703 6.00079 0.924058 6.23496C1.40354 7.00213 1.989 7.68057 2.66233 8.2427C2.67315 8.25096 2.6837 8.25972 2.69397 8.26898C4.00897 9.35527 5.65537 9.99991 7.50001 9.99991C10.3078 9.99991 12.6564 8.5063 14.076 6.23495C14.2223 6.00079 14.5308 5.9296 14.7649 6.07596Z\",\n fill: \"currentColor\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction h({ size: C = 15 }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z\",\n fill: \"currentColor\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction w({ size: C = 15, color: l = \"currentColor\" }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\",\n fill: l,\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction c({ size: C = 15, color: l = \"currentColor\" }) {\n return /* @__PURE__ */ e(\"svg\", { width: C, height: C, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ e(\n \"path\",\n {\n d: \"M0.877075 7.49972C0.877075 3.84204 3.84222 0.876892 7.49991 0.876892C11.1576 0.876892 14.1227 3.84204 14.1227 7.49972C14.1227 11.1574 11.1576 14.1226 7.49991 14.1226C3.84222 14.1226 0.877075 11.1574 0.877075 7.49972ZM7.49991 1.82689C4.36689 1.82689 1.82708 4.36671 1.82708 7.49972C1.82708 10.6327 4.36689 13.1726 7.49991 13.1726C10.6329 13.1726 13.1727 10.6327 13.1727 7.49972C13.1727 4.36671 10.6329 1.82689 7.49991 1.82689ZM8.24993 10.5C8.24993 10.9142 7.91414 11.25 7.49993 11.25C7.08571 11.25 6.74993 10.9142 6.74993 10.5C6.74993 10.0858 7.08571 9.75 7.49993 9.75C7.91414 9.75 8.24993 10.0858 8.24993 10.5ZM6.05003 6.25C6.05003 5.57211 6.63511 4.925 7.50003 4.925C8.36496 4.925 8.95003 5.57211 8.95003 6.25C8.95003 6.74118 8.68002 6.99212 8.21447 7.27494C8.16251 7.30651 8.10258 7.34131 8.03847 7.37854L8.03841 7.37858C7.85521 7.48497 7.63788 7.61119 7.47449 7.73849C7.23214 7.92732 6.95003 8.23198 6.95003 8.7C6.95004 9.00376 7.19628 9.25 7.50004 9.25C7.8024 9.25 8.04778 9.00601 8.05002 8.70417L8.05056 8.7033C8.05924 8.6896 8.08493 8.65735 8.15058 8.6062C8.25207 8.52712 8.36508 8.46163 8.51567 8.37436L8.51571 8.37433C8.59422 8.32883 8.68296 8.27741 8.78559 8.21506C9.32004 7.89038 10.05 7.35382 10.05 6.25C10.05 4.92789 8.93511 3.825 7.50003 3.825C6.06496 3.825 4.95003 4.92789 4.95003 6.25C4.95003 6.55376 5.19628 6.8 5.50003 6.8C5.80379 6.8 6.05003 6.55376 6.05003 6.25Z\",\n fill: l,\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nexport {\n i as C,\n r as E,\n c as Q,\n w as X,\n t as a,\n o as b,\n d as c,\n h as d\n};\n//# sourceMappingURL=QuestionMarkCircled-JRFAPLtT.js.map\n","import { jsx as a, Fragment as I, jsxs as v } from \"react/jsx-runtime\";\nimport M, { createContext as R, useId as q, useState as y, useEffect as m, useRef as H, useCallback as S, useMemo as N } from \"react\";\nimport { createPortal as K } from \"react-dom\";\nfunction g(...e) {\n return e.filter((t) => typeof t == \"string\" && t).join(\" \").trim() || void 0;\n}\nfunction P({ size: e = 15, color: t = \"currentColor\" }) {\n return /* @__PURE__ */ a(\"svg\", { width: e, height: e, className: \"inline\", viewBox: \"0 0 15 15\", xmlns: \"http://www.w3.org/2000/svg\", children: /* @__PURE__ */ a(\n \"path\",\n {\n d: \"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\",\n fill: t,\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }\n ) });\n}\nfunction b(...e) {\n return e.filter((t) => typeof t == \"string\" && t).join(\" \").trim() || void 0;\n}\nR(void 0);\nfunction D() {\n const [e, t] = y(0);\n return m(() => {\n const n = setInterval(() => {\n t((r) => (r + 1) % 3);\n }, 500);\n return () => clearInterval(n);\n }, []), /* @__PURE__ */ a(\"div\", { className: \"absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle\", children: [0, 1, 2].map((n) => /* @__PURE__ */ a(\n \"div\",\n {\n className: g(\n \"rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current\",\n e === n && \"transform -translate-y-1\"\n )\n },\n n\n )) });\n}\nconst F = {\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}, V = {\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}, Z = {\n none: \"rounded-none\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n full: \"rounded-full\"\n}, p = {\n variant: \"primary\",\n size: \"md\",\n rounded: \"md\"\n};\nfunction _({\n variant: e = p.variant,\n size: t,\n rounded: n = p.rounded,\n loading: r,\n linkTo: i,\n linkProps: l,\n type: s = \"button\",\n className: c,\n ...o\n}) {\n let d;\n e === \"link\" && !t ? d = \"fitted\" : d = t || p.size;\n const u = g(\n \"appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all\",\n F[e],\n V[d],\n Z[n],\n r && \"relative pointer-events-none\",\n i && \"relative\",\n c\n );\n return /* @__PURE__ */ v(\n \"button\",\n {\n ...o,\n role: i ? \"link\" : o.role,\n \"aria-label\": o[\"aria-label\"] || (l == null ? void 0 : l[\"aria-label\"]),\n \"aria-description\": o[\"aria-description\"] || (l == null ? void 0 : l[\"aria-description\"]),\n \"aria-disabled\": o.disabled || r,\n \"aria-busy\": r,\n type: s,\n className: u,\n children: [\n r && /* @__PURE__ */ a(D, {}),\n /* @__PURE__ */ a(\"span\", { className: g(r && \"invisible\"), children: o.children }),\n i && !o.disabled && /* @__PURE__ */ a(\n \"a\",\n {\n ...l,\n \"aria-hidden\": !0,\n href: i,\n target: (l == null ? void 0 : l.target) || \"_blank\",\n rel: (l == null ? void 0 : l.rel) || \"noreferrer\",\n className: \"absolute inset-0\"\n }\n )\n ]\n }\n );\n}\nfunction G(e) {\n const [t, n] = y(!1), [r, i] = y(!1);\n return m(() => {\n e ? (i(!0), setTimeout(() => n(!0), 10)) : (n(!1), setTimeout(() => i(!1), 150));\n }, [e]), { show: t, shouldRender: r };\n}\nfunction J(e, t) {\n m(() => {\n const n = (r) => {\n r.key === \"Escape\" && e && t();\n };\n return document.addEventListener(\"keydown\", n), e && (document.body.style.overflow = \"hidden\"), () => {\n document.removeEventListener(\"keydown\", n), document.body.style.overflow = \"auto\";\n };\n }, [e, t]);\n}\nfunction Q(e, t) {\n const n = H(null), r = S(() => {\n const i = document.getElementById(e);\n if (!i) return;\n const l = i.querySelectorAll('[data-modal-action=\"true\"]');\n if (l.length > 0) {\n l[0].focus();\n return;\n }\n const s = i.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n if (s.length > 0) {\n const c = Array.from(s).filter((o) => !(o instanceof HTMLButtonElement && o.getAttribute(\"data-modal-close-button\") === \"true\"));\n if (c.length > 0) {\n c[0].focus();\n return;\n }\n s[0].focus();\n return;\n }\n i.focus();\n }, [e]);\n m(() => (t && (n.current = document.activeElement, r()), () => {\n document.body.style.overflow = \"auto\", n.current instanceof HTMLElement && n.current.focus();\n }), [t, r]);\n}\nfunction U({\n id: e,\n isOpen: t,\n onClose: n,\n title: r,\n children: i,\n contentOnly: l = !1,\n className: s,\n overlayClassName: c,\n hideCloseButton: o = !1,\n actions: d = [],\n disableCloseOnOverlayClick: u = !1,\n ariaLabelledBy: k,\n ariaDescribedBy: C\n}) {\n const h = q(), x = e || `modal-${h}`, w = e ? `${e}-title` : `modal-title-${h}`, { show: L, shouldRender: f } = G(t);\n if (Q(x, f), J(f, n), !f) return null;\n const z = () => r ? M.isValidElement(r) ? /* @__PURE__ */ a(\"div\", { className: \"mb-4\", children: r }) : /* @__PURE__ */ a(\"h2\", { className: \"mb-4 text-xl font-semibold\", id: w, children: r }) : null, E = () => d.length === 0 ? null : /* @__PURE__ */ a(\"div\", { className: \"mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3\", children: d.map((A, j) => {\n const { label: B, className: O, ...T } = A;\n return /* @__PURE__ */ a(_, { className: O, type: \"button\", ...T, \"data-modal-action\": \"true\", children: B }, j);\n }) });\n return /* @__PURE__ */ a(I, { children: K(\n /* @__PURE__ */ a(\n \"div\",\n {\n \"aria-labelledby\": k ?? r ? w : void 0,\n \"aria-describedby\": C,\n role: \"dialog\",\n \"aria-modal\": \"true\",\n className: \"fixed inset-0 z-[100] overflow-y-auto\",\n children: /* @__PURE__ */ v(\"div\", { className: \"flex min-h-screen items-center justify-center p-4\", children: [\n /* @__PURE__ */ a(\n \"div\",\n {\n className: b(\"fixed inset-0 bg-black/20 transition-all\", c),\n onClick: () => {\n u || n();\n }\n }\n ),\n l && /* @__PURE__ */ a(\"div\", { className: b(\"relative w-fit\", s), children: i }),\n !l && /* @__PURE__ */ v(\n \"div\",\n {\n id: x,\n tabIndex: -1,\n className: b(\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 L ? \"opacity-100 scale-100\" : \"opacity-0 scale-90\",\n s\n ),\n children: [\n !o && /* @__PURE__ */ a(\n \"button\",\n {\n type: \"button\",\n onClick: n,\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 children: /* @__PURE__ */ a(P, { size: 18 })\n }\n ),\n z(),\n i,\n E()\n ]\n }\n )\n ] })\n }\n ),\n document.body\n ) });\n}\nfunction $({\n type: e,\n message: t,\n cancelText: n,\n confirmText: r,\n onConfirm: i,\n onClose: l,\n destructive: s = !1,\n title: c,\n ...o\n}) {\n const d = N(() => e === \"confirm\" ? {\n confirm: r || \"Confirm\",\n cancel: n || \"Cancel\",\n defaultTitle: c || \"Confirm Action\"\n } : {\n confirm: r || \"OK\",\n cancel: null,\n defaultTitle: c || \"Alert\"\n }, [e, r, c, n]), u = N(\n () => [\n ...d.cancel ? [\n {\n label: d.cancel,\n variant: \"secondary\",\n onClick: l\n }\n ] : [],\n {\n label: d.confirm,\n variant: s ? \"destructive\" : \"primary\",\n onClick: () => {\n i == null || i(), l();\n }\n }\n ],\n [d, s, i, l]\n );\n return /* @__PURE__ */ a(\n U,\n {\n ...o,\n title: c || d.defaultTitle,\n onClose: l,\n actions: u,\n disableCloseOnOverlayClick: e === \"confirm\",\n hideCloseButton: e === \"confirm\",\n children: typeof t == \"string\" ? /* @__PURE__ */ a(\"p\", { className: \"text-sm\", children: t }) : t\n }\n );\n}\nexport {\n $ as A,\n g as n\n};\n//# sourceMappingURL=styles-Bi0bIt3r.js.map\n","import { jsxs as w, jsx as d, Fragment as G } from \"react/jsx-runtime\";\nimport $, { useId as A, useState as C, createElement as V, useEffect as E, useCallback as I, useMemo as F, useRef as Q, isValidElement as U, cloneElement as W } from \"react\";\nimport { join as g } from \"./utils.esm.js\";\nimport { b as X, C as J, E as Y, a as Z, d as _, c as M, Q as O, X as P } from \"./QuestionMarkCircled-JRFAPLtT.js\";\nimport { n as L } from \"./styles-Bi0bIt3r.js\";\nimport { A as Re } from \"./styles-Bi0bIt3r.js\";\nimport { createPortal as ee } from \"react-dom\";\nfunction j({\n id: a,\n title: r,\n content: e,\n children: t,\n className: n = \"\",\n disabled: o = !1,\n isOpen: s = !1,\n onToggle: l,\n triggerClassName: u = \"\",\n bodyClassName: b = \"\"\n}) {\n const p = A(), i = a || `accordion-item-${p}`, y = `${i}-header`, m = `${i}-panel`, c = () => {\n !o && l && l();\n }, x = (f) => {\n (f.key === \"Enter\" || f.key === \" \") && (f.preventDefault(), c());\n };\n return /* @__PURE__ */ w(\"div\", { className: g(\"border-b border-gray-200\", o && \"opacity-60 cursor-not-allowed\", n), children: [\n /* @__PURE__ */ w(\n \"button\",\n {\n id: y,\n type: \"button\",\n className: g(\n \"w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary\",\n o ? \"cursor-not-allowed\" : \"hover:bg-gray-50/10 cursor-pointer\",\n u\n ),\n \"aria-expanded\": s,\n \"aria-controls\": m,\n disabled: o,\n onClick: c,\n onKeyDown: x,\n children: [\n /* @__PURE__ */ d(\"span\", { children: r }),\n /* @__PURE__ */ d(\n \"span\",\n {\n className: g(\n \"transform transition-transform duration-300 ease-linear\",\n s ? \"rotate-180\" : \"rotate-0\"\n ),\n \"aria-hidden\": \"true\",\n children: /* @__PURE__ */ d(X, { size: 18 })\n }\n )\n ]\n }\n ),\n /* @__PURE__ */ d(\n \"div\",\n {\n id: m,\n role: \"region\",\n \"aria-labelledby\": y,\n className: g(\n \"transition-all duration-300 ease-linear px-4\",\n s ? \"max-h-96 opacity-100 overflow-auto py-3\" : \"max-h-0 opacity-0 overflow-hidden\",\n b\n ),\n children: s && (t || e)\n }\n )\n ] });\n}\nfunction Ee({\n id: a,\n items: r = [],\n children: e,\n className: t = \"\",\n itemClassName: n = \"\",\n allowMultiple: o = !1,\n defaultOpenItems: s = [],\n triggersClassName: l = \"\",\n bodiesClassName: u = \"\"\n}) {\n const b = A(), p = a || `accordion-group-${b}`, [i, y] = C(new Set(s)), m = (f) => {\n y((h) => {\n const v = new Set(h);\n return v.has(f) ? v.delete(f) : (o || v.clear(), v.add(f)), v;\n });\n }, c = (f) => `${b}-item-${f}`, x = (f) => i.has(f);\n return /* @__PURE__ */ w(\"div\", { id: p, className: t, children: [\n r.length > 0 && r.map((f, h) => {\n const v = f.id || c(h);\n return /* @__PURE__ */ d(\n j,\n {\n id: v,\n title: f.title,\n content: f.content,\n disabled: f.disabled,\n isOpen: x(v),\n onToggle: () => m(v),\n className: n,\n triggerClassName: l,\n bodyClassName: u\n },\n v\n );\n }),\n r.length === 0 && e && $.Children.map(e, (f, h) => {\n if ($.isValidElement(f) && f.type === j) {\n const v = f.props.id || c(h);\n return /* @__PURE__ */ V(\n j,\n {\n ...f.props,\n key: v,\n id: v,\n className: g(n, f.props.className),\n isOpen: x(v),\n onToggle: () => m(v),\n triggerClassName: g(l, f.props.triggerClassName),\n bodyClassName: g(u, f.props.bodyClassName)\n }\n );\n }\n return null;\n })\n ] });\n}\nfunction te() {\n const [a, r] = C(0);\n return E(() => {\n const e = setInterval(() => {\n r((t) => (t + 1) % 3);\n }, 500);\n return () => clearInterval(e);\n }, []), /* @__PURE__ */ d(\"div\", { className: \"absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle\", children: [0, 1, 2].map((e) => /* @__PURE__ */ d(\n \"div\",\n {\n className: g(\n \"rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current\",\n a === e && \"transform -translate-y-1\"\n )\n },\n e\n )) });\n}\nconst re = {\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}, ne = {\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}, ae = {\n none: \"rounded-none\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n full: \"rounded-full\"\n}, z = {\n variant: \"primary\",\n size: \"md\",\n rounded: \"md\"\n};\nfunction oe({\n variant: a = z.variant,\n size: r,\n rounded: e = z.rounded,\n loading: t,\n linkTo: n,\n linkProps: o,\n type: s = \"button\",\n className: l,\n ...u\n}) {\n let b;\n a === \"link\" && !r ? b = \"fitted\" : b = r || z.size;\n const i = g(\n \"appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all\",\n re[a],\n ne[b],\n ae[e],\n t && \"relative pointer-events-none\",\n n && \"relative\",\n l\n );\n return /* @__PURE__ */ w(\n \"button\",\n {\n ...u,\n role: n ? \"link\" : u.role,\n \"aria-label\": u[\"aria-label\"] || (o == null ? void 0 : o[\"aria-label\"]),\n \"aria-description\": u[\"aria-description\"] || (o == null ? void 0 : o[\"aria-description\"]),\n \"aria-disabled\": u.disabled || t,\n \"aria-busy\": t,\n type: s,\n className: i,\n children: [\n t && /* @__PURE__ */ d(te, {}),\n /* @__PURE__ */ d(\"span\", { className: g(t && \"invisible\"), children: u.children }),\n n && !u.disabled && /* @__PURE__ */ d(\n \"a\",\n {\n ...o,\n \"aria-hidden\": !0,\n href: n,\n rel: (o == null ? void 0 : o.rel) || \"noreferrer\",\n className: \"absolute inset-0\"\n }\n )\n ]\n }\n );\n}\nfunction se(a) {\n const [r, e] = C(\"\"), t = I((n) => {\n let o = n, s = \"\";\n for (; o && !s; ) {\n const l = window.getComputedStyle(o).backgroundColor;\n l && l !== \"transparent\" && l !== \"rgba(0, 0, 0, 0)\" && (s = l), o = o.parentElement;\n }\n return s || \"transparent\";\n }, []);\n return E(() => {\n const n = document.getElementById(a);\n if (n) {\n const o = t(n.parentElement);\n e(o);\n }\n }, [a, t]), r;\n}\nfunction Ae({\n ref: a,\n id: r,\n size: e = 20,\n color: t,\n filled: n = !1,\n rounded: o = !0,\n checked: s = !1,\n onCheckedChange: l,\n disabled: u,\n className: b = \"\",\n ...p\n}) {\n const i = A(), y = F(() => r || `checkbox-${i}`, [r, i]), m = se(y), [c, x] = C(s);\n E(() => {\n x(s);\n }, [s]);\n const f = () => {\n u || (x(!c), l == null || l(!c));\n }, h = (N) => {\n N.key === \" \" && (N.preventDefault(), f());\n }, v = g(\n \"flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2\",\n o && \"rounded\",\n u && \"opacity-40 cursor-not-allowed\",\n !u && \"cursor-pointer\",\n b\n );\n return /* @__PURE__ */ d(\n \"button\",\n {\n id: y,\n type: \"button\",\n ref: a,\n tabIndex: 0,\n role: \"checkbox\",\n onClick: f,\n \"aria-checked\": c,\n \"aria-disabled\": u,\n onKeyDownCapture: h,\n style: {\n width: e,\n height: e,\n color: t,\n backgroundColor: c && n ? \"currentcolor\" : \"transparent\"\n },\n className: v,\n ...p,\n children: c && /* @__PURE__ */ d(J, { size: e, color: n ? m : void 0 })\n }\n );\n}\nfunction Ie({\n children: a,\n className: r,\n linkTo: e,\n linkProps: t,\n onButtonClick: n,\n buttonProps: o,\n ...s\n}) {\n return e && n && console.warn('Clickable: Both \"linkTo\" and \"onButtonClick\" props are provided. Only \"linkTo\" will be used.'), /* @__PURE__ */ w(\"div\", { className: g(\"relative w-fit\", r), ...s, children: [\n a,\n e && /* @__PURE__ */ d(\n \"a\",\n {\n ...t,\n rel: (t == null ? void 0 : t.rel) || \"noreferrer\",\n href: e,\n className: g(\"absolute inset-0\", t == null ? void 0 : t.className)\n }\n ),\n !e && n && /* @__PURE__ */ d(\n \"button\",\n {\n ...o,\n type: \"button\",\n onClick: n,\n className: g(\"absolute inset-0 cursor-pointer\", o == null ? void 0 : o.className)\n }\n )\n ] });\n}\nfunction D({ elementId: a, type: r, message: e }) {\n return E(() => {\n const t = document.getElementById(a);\n if (t) {\n if (!e && r === \"error\") {\n t.removeAttribute(\"data-error\");\n return;\n }\n if (!e && r === \"success\") {\n t.removeAttribute(\"data-success\");\n return;\n }\n return t.setAttribute(\"aria-describedby\", `${a}-${r}-message`), t.setAttribute(\"aria-invalid\", r === \"error\" ? \"true\" : \"false\"), r === \"error\" && t.setAttribute(\"data-error\", \"true\"), r === \"success\" && t.setAttribute(\"data-success\", \"true\"), () => {\n t.removeAttribute(\"aria-describedby\"), t.removeAttribute(\"aria-invalid\"), t.removeAttribute(\"data-error\"), t.removeAttribute(\"data-success\");\n };\n }\n }, [a, r, e]), e ? /* @__PURE__ */ w(\n \"small\",\n {\n className: g(\n \"mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start\",\n r === \"error\" && \"text-destructive\",\n r === \"success\" && \"text-success\"\n ),\n role: \"status\",\n children: [\n r === \"error\" ? /* @__PURE__ */ d(Y, {}) : /* @__PURE__ */ d(Z, {}),\n /* @__PURE__ */ d(\"span\", { id: `${a}-${r}-message`, children: e })\n ]\n }\n ) : null;\n}\nconst ie = {\n base: \"\",\n default: \"ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-destructive not-disabled:data-success:ring-success\",\n 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\",\n outline: \"border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success\"\n}, de = {\n none: \"rounded-none\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n full: \"px-3 rounded-full\"\n}, B = {\n variant: \"default\",\n rounded: \"none\"\n};\nfunction $e({\n variant: a = B.variant,\n rounded: r,\n displayOnlyMode: e = !1,\n errorMessage: t,\n successMessage: n,\n type: o = \"text\",\n className: s,\n ...l\n}) {\n const u = A(), [b, p] = C(!1);\n let i = r;\n a === \"outline\" && !r && (i = \"md\"), i = i || B.rounded;\n const c = g(\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 \"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 !e && ie[a],\n !e && de[i],\n o === \"password\" && \"pr-10\",\n !e && \"px-2 py-1\",\n e && \"pointer-events-none\",\n s\n );\n return /* @__PURE__ */ w(\"div\", { className: g(e && \"cursor-text\"), style: { height: l.height, width: l.width }, children: [\n /* @__PURE__ */ w(\"div\", { className: g(o === \"password\" && \"relative\"), children: [\n /* @__PURE__ */ d(\n \"input\",\n {\n ...l,\n id: u,\n type: o === \"password\" && b ? \"text\" : o,\n \"aria-disabled\": l.disabled,\n readOnly: e,\n \"aria-readonly\": e || l[\"aria-readonly\"],\n \"data-error\": t ? !0 : void 0,\n \"data-success\": n ? !0 : void 0,\n className: c\n }\n ),\n o === \"password\" && /* @__PURE__ */ d(\n \"button\",\n {\n onClick: () => p(!b),\n className: \"absolute inset-y-0 right-0 px-2 hover:cursor-pointer\",\n \"aria-label\": \"Toggle password visibility\",\n \"data-state\": b ? \"visible\" : \"hidden\",\n children: b ? /* @__PURE__ */ d(_, { size: 20 }) : /* @__PURE__ */ d(M, { size: 20 })\n }\n )\n ] }),\n !e && /* @__PURE__ */ d(D, { elementId: u, type: \"error\", message: t }),\n !e && /* @__PURE__ */ d(D, { elementId: u, type: \"success\", message: n })\n ] });\n}\nfunction De({\n display: a = \"inline\",\n width: r = \"fit-content\",\n className: e = \"\",\n required: t,\n helpMessage: n,\n suffix: o,\n htmlFor: s,\n children: l,\n ...u\n}) {\n const b = A(), p = g(\"font-medium\", a, e), i = n ? `${s ?? b}-help` : void 0;\n return /* @__PURE__ */ w(\"div\", { style: { display: a === \"inline\" ? \"inline-flex\" : \"flex\", width: r }, className: \"relative\", children: [\n /* @__PURE__ */ w(\"label\", { className: p, htmlFor: s, ...u, children: [\n l,\n t && /* @__PURE__ */ d(\"span\", { className: \"text-red-500 font-medium ml-1\", \"aria-label\": \"required\", children: \"*\" })\n ] }),\n n && /* @__PURE__ */ d(\n \"span\",\n {\n className: \"text-gray-500 ml-1 size-fit -translate-y-1/3\",\n \"aria-describedby\": i,\n \"aria-label\": \"Help information\",\n title: n,\n children: /* @__PURE__ */ d(O, {})\n }\n ),\n n && /* @__PURE__ */ d(\"div\", { id: i, className: \"sr-only\", children: n }),\n o && /* @__PURE__ */ d(\"span\", { className: \"ml-1\", children: o })\n ] });\n}\nfunction le(a) {\n const [r, e] = C(!1), [t, n] = C(!1);\n return E(() => {\n a ? (n(!0), setTimeout(() => e(!0), 10)) : (e(!1), setTimeout(() => n(!1), 150));\n }, [a]), { show: r, shouldRender: t };\n}\nfunction ue(a, r) {\n E(() => {\n const e = (t) => {\n t.key === \"Escape\" && a && r();\n };\n return document.addEventListener(\"keydown\", e), a && (document.body.style.overflow = \"hidden\"), () => {\n document.removeEventListener(\"keydown\", e), document.body.style.overflow = \"auto\";\n };\n }, [a, r]);\n}\nfunction ce(a, r) {\n const e = Q(null), t = I(() => {\n const n = document.getElementById(a);\n if (!n) return;\n const o = n.querySelectorAll('[data-modal-action=\"true\"]');\n if (o.length > 0) {\n o[0].focus();\n return;\n }\n const s = n.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n if (s.length > 0) {\n const l = Array.from(s).filter((u) => !(u instanceof HTMLButtonElement && u.getAttribute(\"data-modal-close-button\") === \"true\"));\n if (l.length > 0) {\n l[0].focus();\n return;\n }\n s[0].focus();\n return;\n }\n n.focus();\n }, [a]);\n E(() => (r && (e.current = document.activeElement, t()), () => {\n document.body.style.overflow = \"auto\", e.current instanceof HTMLElement && e.current.focus();\n }), [r, t]);\n}\nfunction ke({\n id: a,\n isOpen: r,\n onClose: e,\n title: t,\n children: n,\n contentOnly: o = !1,\n className: s,\n overlayClassName: l,\n hideCloseButton: u = !1,\n actions: b = [],\n disableCloseOnOverlayClick: p = !1,\n ariaLabelledBy: i,\n ariaDescribedBy: y\n}) {\n const m = A(), c = a || `modal-${m}`, x = a ? `${a}-title` : `modal-title-${m}`, { show: f, shouldRender: h } = le(r);\n if (ce(c, h), ue(h, e), !h) return null;\n const v = () => t ? $.isValidElement(t) ? /* @__PURE__ */ d(\"div\", { className: \"mb-4\", children: t }) : /* @__PURE__ */ d(\"h2\", { className: \"mb-4 text-xl font-semibold\", id: x, children: t }) : null, N = () => b.length === 0 ? null : /* @__PURE__ */ d(\"div\", { className: \"mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3\", children: b.map((k, q) => {\n const { label: T, className: H, ...K } = k;\n return /* @__PURE__ */ d(oe, { className: H, type: \"button\", ...K, \"data-modal-action\": \"true\", children: T }, q);\n }) });\n return /* @__PURE__ */ d(G, { children: ee(\n /* @__PURE__ */ d(\n \"div\",\n {\n \"aria-labelledby\": i ?? t ? x : void 0,\n \"aria-describedby\": y,\n role: \"dialog\",\n \"aria-modal\": \"true\",\n className: \"fixed inset-0 z-[100] overflow-y-auto\",\n children: /* @__PURE__ */ w(\"div\", { className: \"flex min-h-screen items-center justify-center p-4\", children: [\n /* @__PURE__ */ d(\n \"div\",\n {\n className: L(\"fixed inset-0 bg-black/20 transition-all\", l),\n onClick: () => {\n p || e();\n }\n }\n ),\n o && /* @__PURE__ */ d(\"div\", { className: L(\"relative w-fit\", s), children: n }),\n !o && /* @__PURE__ */ w(\n \"div\",\n {\n id: c,\n tabIndex: -1,\n className: L(\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 f ? \"opacity-100 scale-100\" : \"opacity-0 scale-90\",\n s\n ),\n children: [\n !u && /* @__PURE__ */ d(\n \"button\",\n {\n type: \"button\",\n onClick: e,\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 children: /* @__PURE__ */ d(P, { size: 18 })\n }\n ),\n v(),\n n,\n N()\n ]\n }\n )\n ] })\n }\n ),\n document.body\n ) });\n}\nfunction Le({ children: a, ref: r, ...e }) {\n if (U(a)) {\n let t = { ...e };\n return a.props && (t = { ...t, ...a.props }), W(a, {\n ...t,\n ref: (n) => {\n typeof r == \"function\" ? r(n) : r && (r.current = n);\n }\n });\n }\n return V(\"div\", { ...e, ref: r }, a);\n}\nfunction fe({ itemId: a, checked: r, onChange: e, name: t, disabled: n = !1, className: o = \"\" }) {\n const s = \"relative inline-flex items-center justify-center rounded-full\", l = () => {\n n || e();\n }, u = g(\n s,\n !r && \"hover:border-current/60\",\n !n && \"border-current cursor-pointer\",\n n && \"border-muted/60 cursor-not-allowed\",\n o\n );\n return /* @__PURE__ */ d(\n \"div\",\n {\n id: a,\n role: \"radio\",\n tabIndex: -1,\n \"aria-checked\": r,\n \"aria-disabled\": n,\n \"aria-description\": `Radio button for ${t}`,\n \"aria-labelledby\": `${a}-label`,\n onClick: l,\n className: u,\n style: {\n width: \"1em\",\n height: \"1em\",\n padding: \"0.1em\",\n borderWidth: \"0.06em\"\n },\n children: r && /* @__PURE__ */ d(\n \"div\",\n {\n className: g(\"size-full aspect-square rounded-full\", n && \"bg-muted/60\", !n && \"bg-current\")\n }\n )\n }\n );\n}\nfunction S({\n value: a,\n children: r,\n className: e = \"\",\n isSelected: t = !1,\n onChange: n,\n disabled: o = !1,\n hideInput: s = !1,\n description: l,\n name: u\n}) {\n const p = `radio-${A()}-${a}`, i = () => {\n o || n == null || n(a);\n };\n return /* @__PURE__ */ w(\n \"div\",\n {\n title: l,\n className: g(\n \"relative flex items-center\",\n e,\n // Uses text color for borders\n s && `p-2 border-2 focus-within:border-dashed focus-within:${o ? \"border-current/50\" : \"border-current/80\"}`,\n s && !t && `border-transparent ${o ? \"\" : \"not-focus-within:hover:border-border/60\"}`,\n s && t && \"border-border\",\n o && \"opacity-60 cursor-not-allowed\"\n ),\n style: {\n gap: \"0.5em\"\n },\n children: [\n !s && /* @__PURE__ */ d(\n fe,\n {\n itemId: p,\n name: u || \"\",\n checked: t,\n onChange: i,\n disabled: o,\n className: g(s && \"\")\n }\n ),\n /* @__PURE__ */ d(\n \"div\",\n {\n id: s ? p : void 0,\n tabIndex: s ? -1 : void 0,\n role: s ? \"radio\" : void 0,\n onClick: s ? i : void 0,\n \"aria-checked\": s ? t ? \"true\" : \"false\" : void 0,\n \"aria-disabled\": s ? o : void 0,\n \"aria-description\": s ? l || `Radio button for ${u}` : void 0,\n \"aria-labelledby\": s ? `${p}-label` : void 0,\n className: g(s && \"size-full\", typeof r == \"object\" && \"grow focus:outline-none\"),\n children: /* @__PURE__ */ d(\n \"label\",\n {\n id: `${p}-label`,\n onClick: s ? void 0 : i,\n className: g(o && \"cursor-not-allowed\", !o && \"cursor-pointer\"),\n children: r\n }\n )\n }\n )\n ]\n }\n );\n}\nfunction me(a, r) {\n const [e, t] = C(r), [n, o] = C(-1), [s, l] = C(!1), u = I((m, c) => {\n var h;\n const x = m[c];\n x.hasAttribute(\"disabled\") || x.getAttribute(\"aria-disabled\") === \"true\" || ((h = m[c]) == null || h.click(), o(c));\n }, []), b = I(\n (m, c) => {\n var f;\n if (m.preventDefault(), s || !c.length) return;\n const x = r !== -1 ? r : 0;\n (f = c[x]) == null || f.focus(), t(x), r !== -1 && u(c, x);\n },\n [r, s, u]\n ), p = I(\n (m) => {\n var h;\n if (!m.shiftKey)\n return;\n m.preventDefault();\n const c = Array.from(\n document.querySelectorAll(\n 'a, button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])'\n )\n ).filter((v) => !v.hasAttribute(\"disabled\") && v.tabIndex >= 0), x = c.findIndex((v) => v.id === a), f = x > 0 ? x - 1 : c.length - 1;\n (h = c[f]) == null || h.focus();\n },\n [a]\n ), i = I(\n (m, c) => {\n var N;\n if (!c.length) return;\n const x = m.target;\n if (!c.some((k) => k.id === x.id)) return;\n const h = e !== -1 ? e : 0;\n let v = h;\n switch (m.key) {\n case \"ArrowUp\":\n case \"ArrowLeft\":\n m.preventDefault(), v = h > 0 ? h - 1 : c.length - 1;\n break;\n case \"ArrowDown\":\n case \"ArrowRight\":\n m.preventDefault(), v = (h + 1) % c.length;\n break;\n // Select the option when the space key is pressed\n case \" \":\n m.preventDefault(), u(c, h);\n return;\n case \"Tab\":\n p(m);\n return;\n default:\n return;\n }\n (N = c[v]) == null || N.focus(), t(v), n !== -1 && u(c, v);\n },\n [e, n, p, u]\n ), y = I(() => {\n const m = document.querySelector(`[id=\"${a}\"][role=\"radiogroup\"]`);\n return m ? Array.from(m.querySelectorAll('[role=\"radio\"]')) : [];\n }, [a]);\n E(() => {\n const m = document.querySelector(`[id=\"${a}\"][role=\"radiogroup\"]`);\n if (!m) return;\n const c = y(), x = (N) => b(N, c), f = (N) => i(N, c), h = () => l(!0), v = () => l(!1);\n return document.addEventListener(\"keydown\", f), m.addEventListener(\"focus\", x), m.addEventListener(\"mousedown\", h), document.addEventListener(\"mouseup\", v), () => {\n document.removeEventListener(\"keydown\", f), m.removeEventListener(\"focus\", x), m.removeEventListener(\"mousedown\", h), document.removeEventListener(\"mouseup\", v);\n };\n }, [a, y, b, i]);\n}\nfunction je({\n options: a = [],\n value: r,\n onChange: e,\n id: t,\n children: n,\n className: o = \"\",\n childrenClassName: s = \"\",\n hideInputs: l = !1\n}) {\n const u = A(), b = t || `radio-group-${u}`;\n me(\n b,\n a.findIndex((i) => i === r)\n );\n const p = F(() => a.reduce((i, y) => (typeof y == \"string\" ? i.some((m) => m.value === y) || i.push({ label: y, value: y }) : i.push(y), i), []), [a]);\n return /* @__PURE__ */ w(\"div\", { id: b, role: \"radiogroup\", tabIndex: 0, className: g(o, \"focus:outline-none\"), children: [\n p.length > 0 && p.map((i, y) => /* @__PURE__ */ d(\n S,\n {\n value: i.value,\n isSelected: r === i.value,\n onChange: e,\n name: b,\n disabled: i.disabled,\n description: i.description,\n hideInput: l,\n className: s,\n children: i.label\n },\n `${i.value}-${y}`\n )),\n p.length === 0 && n && $.Children.map(n, (i) => $.isValidElement(i) && i.type === S ? /* @__PURE__ */ d(\n S,\n {\n ...i.props,\n className: g(s, i.props.className),\n hideInput: i.props.hideInput || l,\n isSelected: r === i.props.value,\n onChange: e,\n name: b,\n children: i.props.children\n }\n ) : null)\n ] });\n}\nfunction be({ elementId: a, maxLength: r }) {\n const [e, t] = C(0);\n return E(() => {\n const n = document.getElementById(a);\n if (!n)\n return;\n const o = () => {\n const s = n.value.length;\n t(s);\n const l = s >= r;\n n.setAttribute(\"aria-describedby\", `${a}-character-count`), n.setAttribute(\"aria-invalid\", l ? \"true\" : \"false\"), l ? n.setAttribute(\"data-error\", \"true\") : n.removeAttribute(\"data-error\");\n };\n return o(), n.addEventListener(\"input\", o), n.setAttribute(\"maxlength\", String(r)), () => {\n n.removeEventListener(\"input\", o), n.removeAttribute(\"maxlength\"), n.removeAttribute(\"aria-describedby\"), n.removeAttribute(\"aria-invalid\"), n.removeAttribute(\"data-error\");\n };\n }, [a, r]), /* @__PURE__ */ d(\n \"small\",\n {\n className: g(\n \"mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end\",\n e >= r && \"text-destructive\",\n e < r && \"text-current\"\n ),\n role: \"status\",\n children: /* @__PURE__ */ w(\"span\", { id: `${a}-character-count`, children: [\n e,\n \" / \",\n r,\n \" characters\"\n ] })\n }\n );\n}\nfunction ve(a, r) {\n E(() => {\n const e = document.getElementById(a);\n if (!e)\n return;\n if (!r) {\n e.style.height = \"auto\";\n return;\n }\n const t = () => {\n e.style.height = \"auto\", e.style.height = `${e.scrollHeight}px`;\n };\n return t(), e.addEventListener(\"input\", t), e.addEventListener(\"resize\", t), window.addEventListener(\"resize\", t), () => {\n e.removeEventListener(\"input\", t), e.removeEventListener(\"resize\", t), window.removeEventListener(\"resize\", t);\n };\n }, [a, r]);\n}\nconst pe = {\n base: \"\",\n \"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\",\n outline: \"border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success\"\n}, ge = {\n none: \"rounded-none\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n full: \"px-3 rounded-full\"\n}, R = {\n variant: \"outline\",\n rounded: \"none\"\n};\nfunction ze({\n variant: a = R.variant,\n rounded: r,\n displayOnlyMode: e = !1,\n errorMessage: t,\n successMessage: n,\n hideResizeHandle: o = !1,\n autoExpand: s = !1,\n characterLimit: l = 0,\n className: u,\n ...b\n}) {\n const p = A();\n ve(p, s || e);\n let i = r;\n a === \"outline\" && !r && (i = \"md\"), i = i || R.rounded;\n let y = o;\n (e || a === \"left-line\" && !o) && (y = !0);\n const c = g(\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 !e && pe[a],\n !e && ge[i],\n !e && \"px-2 py-1\",\n e && \"pointer-events-none\",\n y && \"no-resize-handle\",\n u\n );\n return /* @__PURE__ */ w(\"div\", { className: g(\"-space-y-1.5\", e && \"cursor-text\"), children: [\n /* @__PURE__ */ d(\n \"textarea\",\n {\n ...b,\n id: p,\n \"aria-disabled\": b.disabled,\n readOnly: e,\n \"aria-readonly\": e || b[\"aria-readonly\"],\n style: {\n resize: s ? \"none\" : void 0\n },\n className: c\n }\n ),\n l > 0 && /* @__PURE__ */ d(be, { elementId: p, maxLength: l }),\n !e && /* @__PURE__ */ d(D, { elementId: p, type: \"error\", message: t }),\n !e && /* @__PURE__ */ d(D, { elementId: p, type: \"success\", message: n })\n ] });\n}\nexport {\n Ee as Accordion,\n j as AccordionItem,\n Re as ActionModal,\n oe as Button,\n te as ButtonLoadingDots,\n Ae as Checkbox,\n Ie as Clickable,\n $e as Input,\n De as Label,\n ke as Modal,\n je as RadioGroup,\n S as RadioGroupItem,\n fe as RadioInput,\n Le as Slot,\n ze as Textarea\n};\n//# sourceMappingURL=components.esm.js.map\n","import { Modal, ModalProps } from '@moondreamsdev/dreamer-ui/components';\nimport React, { useMemo } from 'react';\n\ninterface BaseActionModalProps extends Omit<ModalProps, 'children' | 'actions'> {\n message: React.ReactNode;\n destructive?: boolean;\n}\n\ninterface AlertModalProps extends BaseActionModalProps {\n type: 'alert';\n confirmText?: string;\n onConfirm?: () => void;\n // Cancel-related props are not allowed for alerts\n cancelText?: never;\n}\n\ninterface ConfirmModalProps extends BaseActionModalProps {\n type: 'confirm';\n confirmText?: string;\n cancelText?: string;\n onConfirm?: () => void;\n}\n\nexport type ActionModalProps = AlertModalProps | ConfirmModalProps;\n\nexport function ActionModal({\n type,\n message,\n cancelText,\n confirmText,\n onConfirm,\n onClose,\n destructive = false,\n title,\n ...modalProps\n}: ActionModalProps) {\n const defaultTexts = useMemo(() => {\n if (type === 'confirm') {\n return {\n confirm: confirmText || 'Confirm',\n cancel: cancelText || 'Cancel',\n defaultTitle: title || 'Confirm Action',\n };\n }\n return {\n confirm: confirmText || 'OK',\n cancel: null,\n defaultTitle: title || 'Alert',\n };\n }, [type, confirmText, title, cancelText]);\n\n const actions: ModalProps['actions'] = useMemo(\n () => [\n ...(defaultTexts.cancel\n ? [\n {\n label: defaultTexts.cancel,\n variant: 'secondary' as const,\n onClick: onClose,\n },\n ]\n : []),\n {\n label: defaultTexts.confirm,\n variant: destructive ? 'destructive' : 'primary',\n onClick: () => {\n onConfirm?.();\n onClose();\n },\n },\n ],\n [defaultTexts, destructive, onConfirm, onClose]\n );\n\n return (\n <Modal\n {...modalProps}\n title={title || defaultTexts.defaultTitle}\n onClose={onClose}\n actions={actions}\n disableCloseOnOverlayClick={type === 'confirm'}\n hideCloseButton={type === 'confirm'}\n >\n {typeof message === 'string' ? <p className='text-sm'>{message}</p> : message}\n </Modal>\n );\n}\n"],"names":["n","t","s","w","C","l","e","g","R","te","a","r","E","d","re","ne","ae","z","oe","o","u","b","i","le","ue","ce","Q","I","ke","p","y","m","A","c","x","f","h","v","$","N","k","q","T","H","K","G","ee","L","P","ActionModal","type","message","cancelText","confirmText","onConfirm","onClose","destructive","title","modalProps","defaultTexts","useMemo","actions","jsx","Modal"],"mappings":"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"}
|