@opencxh/ui-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +261 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +3076 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.umd.cjs +2 -0
  6. package/dist/index.umd.cjs.map +1 -0
  7. package/dist/src/action/Button.d.ts +50 -0
  8. package/dist/src/action/ButtonGroup.d.ts +17 -0
  9. package/dist/src/action/Link.d.ts +21 -0
  10. package/dist/src/command-palette/CommandPalette.d.ts +22 -0
  11. package/dist/src/command-palette/index.d.ts +2 -0
  12. package/dist/src/content/Icon.d.ts +21 -0
  13. package/dist/src/content/Image.d.ts +29 -0
  14. package/dist/src/content/PageHeader.d.ts +43 -0
  15. package/dist/src/content/Table.d.ts +108 -0
  16. package/dist/src/feedback/Badge.d.ts +48 -0
  17. package/dist/src/feedback/ContentLoading.d.ts +21 -0
  18. package/dist/src/feedback/Spinner.d.ts +32 -0
  19. package/dist/src/forms/Form.d.ts +119 -0
  20. package/dist/src/index.d.ts +28 -0
  21. package/dist/src/input/Checkbox.d.ts +55 -0
  22. package/dist/src/input/DatePicker.d.ts +26 -0
  23. package/dist/src/input/Select.d.ts +89 -0
  24. package/dist/src/input/TextArea.d.ts +39 -0
  25. package/dist/src/input/TextField.d.ts +68 -0
  26. package/dist/src/navigation/Sidebar.d.ts +17 -0
  27. package/dist/src/navigation/Tabs.d.ts +59 -0
  28. package/dist/src/overlays/Dropdown.d.ts +41 -0
  29. package/dist/src/overlays/Modal.d.ts +82 -0
  30. package/dist/src/primitives/Box.d.ts +47 -0
  31. package/dist/src/primitives/Card.d.ts +6 -0
  32. package/dist/src/typography/Heading.d.ts +23 -0
  33. package/dist/src/typography/List.d.ts +31 -0
  34. package/dist/src/typography/Text.d.ts +31 -0
  35. package/dist/src/utils/cn.d.ts +14 -0
  36. package/dist/vite.config.d.ts +2 -0
  37. package/package.json +62 -0
@@ -0,0 +1,2 @@
1
+ (function(D,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("clsx"),require("react/jsx-runtime"),require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","clsx","react/jsx-runtime","react","lucide-react"],se):(D=typeof globalThis<"u"?globalThis:D||self,se(D["@opencxh/ui-kit"]={},D.clsx,D.jsxRuntime,D.React,D.lucideReact))})(this,function(D,se,e,m,ie){"use strict";function x(...r){return se.clsx(r)}function pe(r){return(s,t)=>{var a;return((a=r[s])==null?void 0:a[t])||""}}function ye(r){return s=>r[s]||""}const me={primary:"btn o__primary",secondary:"btn o__secondary",outline:"btn o__secondary",ghost:"btn text-gray-700",destructive:"btn o__destructive"},ve={xs:"px-2 py-1 text-xs",sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base",xl:"px-8 py-4 text-lg",full:"px-4 py-3 text-base"},ke={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4",full:"p-4"},X=m.forwardRef(({variant:r="primary",size:s="md",fullWidth:t=!1,loading:a=!1,leftIcon:l,rightIcon:o,iconOnly:g=!1,className:h,children:b,disabled:c,...w},d)=>{const i=c||a;return e.jsxs("button",{ref:d,className:x("inline-flex items-center justify-center font-medium rounded-lg transition-colors duration-200","focus:outline-none focus:ring-1 focus:ring-offset-1","disabled:opacity-50 disabled:cursor-not-allowed",me[r],g?ke[s]:ve[s],t&&"w-full",a&&"cursor-wait",h),disabled:i,...w,children:[a&&e.jsxs("svg",{className:x("animate-spin",g?"h-4 w-4":"h-4 w-4 mr-2"),fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),!a&&l&&e.jsx("span",{className:x("flex-shrink-0",!g&&"mr-2"),children:l}),!g&&b,!a&&o&&e.jsx("span",{className:x("flex-shrink-0",!g&&"ml-2"),children:o}),g&&!a&&!l&&!o&&b]})});X.displayName="Button";const Ne=({children:r,size:s="md",orientation:t="horizontal",attached:a=!0,className:l})=>{const o=x("inline-flex",{"flex-row":t==="horizontal","flex-col":t==="vertical","[&>*:not(:first-child):not(:last-child)]:rounded-none":a,"[&>*:first-child]:rounded-r-none":a&&t==="horizontal","[&>*:last-child]:rounded-l-none":a&&t==="horizontal","[&>*:first-child]:rounded-b-none":a&&t==="vertical","[&>*:last-child]:rounded-t-none":a&&t==="vertical","[&>*:not(:first-child)]:-ml-px":a&&t==="horizontal","[&>*:not(:first-child)]:-mt-px":a&&t==="vertical","gap-1":!a&&s==="xs","gap-2":!a&&(s==="sm"||s==="md"),"gap-3":!a&&(s==="lg"||s==="xl")},l);return e.jsx("div",{className:o,role:"group",children:r})},we=({variant:r="default",size:s="md",color:t="primary",disabled:a=!1,external:l=!1,className:o,children:g,href:h,target:b,rel:c,...w})=>{const d=l||h&&(h.startsWith("http")||h.startsWith("mailto:")),i=x("inline-flex items-center gap-1 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2",{"text-xs":s==="xs","text-sm":s==="sm","text-base":s==="md","text-lg":s==="lg","text-xl":s==="xl"},{"text-primary hover:text-primary/80 focus:ring-primary/20":t==="primary"&&!a,"text-secondary hover:text-secondary/80 focus:ring-secondary/20":t==="secondary"&&!a,"text-accent hover:text-accent/80 focus:ring-accent/20":t==="accent"&&!a,"text-success hover:text-success/80 focus:ring-success/20":t==="success"&&!a,"text-warning hover:text-warning/80 focus:ring-warning/20":t==="warning"&&!a,"text-error hover:text-error/80 focus:ring-error/20":t==="error"&&!a,"text-info hover:text-info/80 focus:ring-info/20":t==="info"&&!a,"text-neutral hover:text-neutral/80 focus:ring-neutral/20":t==="neutral"&&!a},{"":r==="default","text-opacity-70 hover:text-opacity-100":r==="subtle","underline underline-offset-2 decoration-1 hover:decoration-2":r==="underline","px-3 py-1.5 rounded-md bg-opacity-10 hover:bg-opacity-20":r==="button","bg-primary":r==="button"&&t==="primary","bg-secondary":r==="button"&&t==="secondary","bg-accent":r==="button"&&t==="accent","bg-success":r==="button"&&t==="success","bg-warning":r==="button"&&t==="warning","bg-error":r==="button"&&t==="error","bg-info":r==="button"&&t==="info","bg-neutral":r==="button"&&t==="neutral"},{"opacity-50 cursor-not-allowed pointer-events-none":a},o),k={...w,href:a?void 0:h,target:d?"_blank":b,rel:d?"noopener noreferrer":c};return e.jsxs("a",{className:i,...k,children:[g,d&&e.jsx("svg",{className:"w-3 h-3 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},Ce={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",full:"h-6 w-6"},Se={sm:"text-sm",md:"text-sm",lg:"text-base",full:"text-base"},ne=m.forwardRef(({label:r,helperText:s,error:t,size:a="md",indeterminate:l=!1,containerClassName:o,labelClassName:g,className:h,id:b,...c},w)=>{const d=b||`checkbox-${Math.random().toString(36).substr(2,9)}`,i=!!t;return m.useEffect(()=>{w&&typeof w=="object"&&w.current&&(w.current.indeterminate=l)},[l,w]),e.jsxs("div",{className:x("flex flex-col",o),children:[e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex items-center h-5",children:e.jsx("input",{ref:w,id:d,type:"checkbox",className:x("rounded border transition-colors duration-200","focus:ring-2 focus:ring-offset-2 focus:outline-none","disabled:opacity-50 disabled:cursor-not-allowed",Ce[a],i?"border-error text-error focus:border-error focus:ring-error":"border-gray-100 text-primary focus:border-primary focus:ring-primary dark:border-gray-600 dark:bg-secondary-800",h),...c})}),r&&e.jsxs("div",{className:"ml-3 flex-1",children:[e.jsx("label",{htmlFor:d,className:x("font-medium cursor-pointer",i?"text-error":"text-secondary-900 dark:text-secondary-100",Se[a],g),children:r}),s&&!t&&e.jsx("p",{className:"mt-1 text-xs text-secondary-500 dark:text-secondary-400",children:s})]})]}),t&&e.jsx("p",{className:"mt-1 text-xs text-error",children:t})]})});ne.displayName="Checkbox";const Me=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),Le=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m15 18-6-6 6-6"})}),Ee=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m9 18 6-6-6-6"})}),de=m.forwardRef(({value:r,onChange:s,placeholder:t="Select date",disabled:a=!1,required:l=!1,size:o="md",className:g,minDate:h,maxDate:b,format:c="MM/dd/yyyy"},w)=>{const[d,i]=m.useState(!1),[k,p]=m.useState(()=>r||new Date),C=m.useRef(null);m.useEffect(()=>{const S=y=>{C.current&&!C.current.contains(y.target)&&i(!1)};return d&&document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[d]);const M=S=>{if(!S)return"";const y=S.getDate().toString().padStart(2,"0"),n=(S.getMonth()+1).toString().padStart(2,"0"),v=S.getFullYear();switch(c){case"dd/MM/yyyy":return`${y}/${n}/${v}`;case"yyyy-MM-dd":return`${v}-${n}-${y}`;case"MM/dd/yyyy":default:return`${n}/${y}/${v}`}},q=()=>{const S=k.getFullYear(),y=k.getMonth(),n=new Date(S,y,1),v=new Date(n);v.setDate(v.getDate()-n.getDay());const N=[],f=new Date(v);for(let j=0;j<42;j++)N.push(new Date(f)),f.setDate(f.getDate()+1);return N},A=S=>{S.getMonth()===k.getMonth()&&(h&&S<h||b&&S>b||(s==null||s(S),i(!1)))},J=()=>{p(new Date(k.getFullYear(),k.getMonth()-1,1))},H=()=>{p(new Date(k.getFullYear(),k.getMonth()+1,1))},V=()=>{s==null||s(null),i(!1)},B=x("w-full border border-neutral-100 dark:border-neutral-600 rounded-md transition-colors duration-200","bg-white dark:bg-neutral-800 text-gray-700 dark:text-gray-300","placeholder:text-gray-800 dark:placeholder:text-gray-500","focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary","disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-neutral-50 dark:disabled:bg-neutral-900",{"px-3 py-2 text-sm":o==="sm","px-3 py-2 text-base":o==="md","px-4 py-3 text-lg":o==="lg","px-4 py-3 text-base":o==="full"},g),I=q(),U=["January","February","March","April","May","June","July","August","September","October","November","December"];return e.jsxs("div",{ref:C,className:"relative",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:w,type:"text",value:M(r??null),placeholder:t,disabled:a,required:l,readOnly:!0,onClick:()=>!a&&i(!d),className:x(B,"pr-10 cursor-pointer")}),e.jsx("button",{type:"button",onClick:()=>!a&&i(!d),disabled:a,className:"absolute inset-y-0 right-0 flex items-center pr-3 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300",children:e.jsx(Me,{})})]}),d&&e.jsxs("div",{className:"absolute z-50 mt-1 bg-white dark:bg-neutral-800 border border-neutral-100 dark:border-neutral-600 rounded-md shadow-lg p-4 min-w-[280px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("button",{onClick:J,className:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded",children:e.jsx(Le,{})}),e.jsxs("h3",{className:"text-sm font-medium text-neutral-900 dark:text-neutral-100",children:[U[k.getMonth()]," ",k.getFullYear()]}),e.jsx("button",{onClick:H,className:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded",children:e.jsx(Ee,{})})]}),e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(S=>e.jsx("div",{className:"text-xs font-medium text-neutral-500 dark:text-neutral-400 text-center py-1",children:S},S))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:I.map((S,y)=>{const n=S.getMonth()===k.getMonth(),v=r&&S.toDateString()===r.toDateString(),N=S.toDateString()===new Date().toDateString(),f=!n||h&&S<h||b&&S>b;return e.jsx("button",{onClick:()=>!f&&A(S),disabled:f,className:x("w-8 h-8 text-sm rounded transition-colors duration-200",{"text-neutral-900 dark:text-neutral-100 hover:bg-neutral-100 dark:hover:bg-neutral-700":n&&!v&&!f,"bg-primary text-white":v,"bg-neutral-100 dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100":N&&!v,"text-neutral-300 dark:text-neutral-600 cursor-not-allowed":f}),children:S.getDate()},y)})}),e.jsxs("div",{className:"flex justify-between items-center mt-4 pt-3 border-t border-neutral-200 dark:border-neutral-700",children:[e.jsx("button",{onClick:V,className:"text-sm text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300",children:"Clear"}),e.jsx("button",{onClick:()=>i(!1),className:"text-sm text-primary hover:text-primary/80",children:"Close"})]})]})]})}),De={sm:"px-3 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-3 py-2 text-sm",full:"px-3 py-2 text-sm"},oe=m.forwardRef(({label:r,helperText:s,error:t,size:a="md",fullWidth:l=!1,options:o,placeholder:g,containerClassName:h,labelClassName:b,className:c,id:w,searchable:d,multiple:i,value:k,onChange:p,...C},M)=>{const q=w||`select-${Math.random().toString(36).substr(2,9)}`,A=!!t,[J,H]=m.useState(!1),[V,B]=m.useState(""),I=m.useRef(null);m.useImperativeHandle(M,()=>I.current),m.useEffect(()=>{const N=f=>{I.current&&!I.current.contains(f.target)&&H(!1)};return document.addEventListener("mousedown",N),()=>{document.removeEventListener("mousedown",N)}},[]);const U=N=>{if(i){const f=Array.isArray(k)?k:[],j=f.includes(N)?f.filter(_=>_!==N):[...f,N];p==null||p(j)}else p==null||p(N),H(!1),B("")},S=i?null:o.find(N=>N.value===k),y=i?o.filter(N=>Array.isArray(k)&&k.includes(N.value)):[],n=d&&V?o.filter(N=>N.label.toLowerCase().includes(V.toLowerCase())):o,v=()=>i?y.length>0?y.map(N=>N.label).join(", "):g||"Select options":(S==null?void 0:S.label)||g||"Select an option";return e.jsxs("div",{ref:I,className:x("relative flex flex-col",l&&"w-full",h),...C,children:[r&&e.jsx("label",{htmlFor:q,onClick:()=>H(!J),className:x("block text-sm font-medium mb-1",A?"text-error":"text-secondary-700 dark:text-secondary-300",b),children:r}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{type:"button",id:q,onClick:()=>H(!J),className:x("block w-full rounded-lg border transition-colors duration-200 text-left","focus:outline-none focus:ring-0 focus:ring-offset-0","disabled:opacity-50 disabled:cursor-not-allowed","bg-white dark:bg-secondary-800",De[a],A?"border-error text-error focus:border-error focus:ring-error":"border-gray-100 text-secondary-900 focus:border-primary focus:ring-primary dark:border-gray-600 dark:bg-secondary-800 dark:text-secondary-100",c),children:e.jsx("span",{className:"block truncate",children:v()})}),J&&e.jsxs("div",{className:"absolute z-10 mt-1 w-full rounded-md bg-white dark:bg-secondary-800 shadow-lg border dark:border-gray-600",children:[d&&e.jsx("div",{className:"p-2",children:e.jsx("input",{type:"text",placeholder:"Search...",value:V,onChange:N=>B(N.target.value),className:x("w-full px-3 py-2 text-sm rounded-md border","text-secondary-900 border-gray-100 dark:border-gray-600 focus:outline-none focus:ring-0")})}),e.jsxs("ul",{className:"max-h-60 overflow-auto py-1",children:[g&&!i&&e.jsx("li",{className:"px-4 py-2 text-sm text-secondary-500",onClick:()=>{p==null||p(""),H(!1)},children:g}),n.map(N=>{const f=i?Array.isArray(k)&&k.includes(N.value):k===N.value;return e.jsx("li",{onClick:()=>!N.disabled&&U(N.value),className:x("px-4 py-2 text-sm cursor-pointer","text-secondary-900 dark:text-secondary-100",N.disabled?"opacity-50 cursor-not-allowed":"hover:bg-gray-100 dark:hover:bg-secondary-700",f&&"font-semibold"),children:e.jsxs("div",{className:"flex items-center",children:[i&&e.jsx("input",{type:"checkbox",checked:f,readOnly:!0,className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),e.jsx("span",{children:N.label})]})},N.value)})]})]})]}),(t||s)&&e.jsx("p",{className:x("mt-1 text-xs",A?"text-error":"text-secondary-500"),children:t||s})]})});oe.displayName="Select";const Te={sm:"px-3 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base",full:"px-4 py-3 text-base"},ce=m.forwardRef(({label:r,helperText:s,error:t,size:a="md",fullWidth:l=!1,loading:o=!1,containerClassName:g,labelClassName:h,className:b,id:c,rows:w=4,...d},i)=>{const k=c||`textarea-${Math.random().toString(36).substr(2,9)}`,p=!!t;return e.jsxs("div",{className:x("flex flex-col",l&&"w-full",g),children:[r&&e.jsx("label",{htmlFor:k,className:x("block text-sm font-medium mb-1",p?"text-error":"text-secondary-700 dark:text-secondary-300",h),children:r}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:i,id:k,rows:w,className:x("block w-full rounded-lg border transition-colors duration-200 resize-vertical","placeholder-secondary-400 focus:outline-none focus:ring-0","disabled:opacity-50 disabled:cursor-not-allowed",Te[a],p?"border-error text-error focus:border-error focus:ring-error":"border-gray-100 text-secondary-900 dark:border-gray-600 dark:bg-secondary-800 dark:text-secondary-100",b),...d}),o&&e.jsx("div",{className:"absolute top-3 right-3",children:e.jsxs("svg",{className:"animate-spin h-4 w-4 text-secondary-400",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]}),(t||s)&&e.jsx("p",{className:x("mt-1 text-xs",p?"text-error":"text-secondary-500"),children:t||s})]})});ce.displayName="TextArea";const je={sm:"px-3 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-3 py-2 text-sm",full:"px-3 py-2 text-sm"},ue={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",full:"h-6 w-6"},le=m.forwardRef(({label:r,helperText:s,error:t,size:a="md",fullWidth:l=!1,startIcon:o,endIcon:g,loading:h=!1,containerClassName:b,labelClassName:c,className:w,id:d,...i},k)=>{const p=d||`textfield-${Math.random().toString(36).substr(2,9)}`,C=!!t;return e.jsxs("div",{className:x("flex flex-col",l&&"w-full",b),children:[r&&e.jsx("label",{htmlFor:p,className:x("block text-sm font-medium mb-1",C?"text-error":"text-secondary-700 dark:text-secondary-300",c),children:r}),e.jsxs("div",{className:"relative",children:[o&&e.jsx("div",{className:"absolute left-0 pl-3 flex items-center pointer-events-none h-full",children:e.jsx("span",{className:x("text-secondary-400",ue[a]),children:o})}),e.jsx("input",{ref:k,id:p,className:x("block w-full rounded-lg border dark:border-gray-600 transition-colors duration-200","placeholder-gray-500 dark:placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-offset-0","disabled:opacity-50 disabled:cursor-not-allowed",je[a],o&&"pl-10",g&&"pr-10",C?"border-error text-error focus:border-error focus:ring-error":"border-gray-100 text-secondary-900 focus:border-primary focus:ring-primary dark:border-gray-600 dark:bg-secondary-800 dark:text-secondary-100",w),...i}),(g||h)&&e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:h?e.jsxs("svg",{className:x("animate-spin text-secondary-400",ue[a]),fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):g&&e.jsx("span",{className:x("text-secondary-400",ue[a]),children:g})})]}),(t||s)&&e.jsx("p",{className:x("mt-1 text-xs",C?"text-error":"text-secondary-500"),children:t||s})]})});le.displayName="TextField";const ee=({variant:r="body",size:s="md",weight:t="normal",color:a="current",align:l="left",truncate:o=!1,italic:g=!1,underline:h=!1,lineHeight:b="normal",as:c,className:w,children:d,...i})=>{const k=c||Ae(r),p=x("font-primary",{"leading-relaxed":r==="body","text-sm leading-tight":r==="caption","text-sm font-medium leading-none":r==="label","font-mono text-sm bg-neutral-100 dark:bg-neutral-800 px-1 py-0.5 rounded":r==="code"},r!=="code"&&{"text-xs":s==="xs","text-sm":s==="sm","text-base":s==="md","text-lg":s==="lg","text-xl":s==="xl"},r!=="label"&&{"font-light":t==="light","font-normal":t==="normal","font-medium":t==="medium","font-semibold":t==="semibold","font-bold":t==="bold"},{"text-primary":a==="primary","text-secondary":a==="secondary","text-accent":a==="accent","text-success":a==="success","text-warning":a==="warning","text-error":a==="error","text-info":a==="info","text-neutral":a==="neutral","text-current":a==="current","text-neutral-400 dark:text-neutral-500":a==="muted"},{"text-left":l==="left","text-center":l==="center","text-right":l==="right","text-justify":l==="justify"},r==="body"&&{"leading-tight":b==="tight","leading-normal":b==="normal","leading-relaxed":b==="relaxed"},{italic:g,underline:h,truncate:o},w),C=k;return e.jsx(C,{className:p,...i,children:d})};function Ae(r){return{body:"p",caption:"span",label:"span",code:"code"}[r]||"p"}const $e=({groups:r,data:s,onSubmit:t,onCancel:a,onChange:l,transform:o,validate:g,submitButton:h={label:"Submit",variant:"primary"},cancelButton:b={label:"Cancel",variant:"outline"},showButtons:c=!0,layout:w="vertical",size:d="md",loading:i=!1,className:k,ref:p})=>{const[C,M]=m.useState(s||{}),[q,A]=m.useState({}),[J,H]=m.useState({});m.useEffect(()=>{s&&M(s)},[s]);const V=m.useCallback((n,v,N)=>{const f=r.flatMap(j=>j.items).find(j=>j.name===n);if(!f)return null;if(f.required&&(v==null||v===""))return`${f.label} is required`;if(f.type==="array"){if(f.required&&(!v||v.length===0))return`${f.label} cannot be empty.`;if(v&&!Array.isArray(v))return`${f.label} must be an array.`;if(Array.isArray(v)&&f.arrayFields){const j=[];let _=!1;if(v.forEach((F,P)=>{const Z={};for(const G of f.arrayFields){const Q=F==null?void 0:F[G.name];if(G.required&&(Q==null||Q===""))Z[G.name]=`${G.label} is required`,_=!0;else if(G.validator){const K=G.validator(Q,F);K&&(Z[G.name]=K,_=!0)}}j[P]=Z}),_)return JSON.stringify(j)}}return f.validator?f.validator(v,N):null},[r]),B=m.useCallback((n,v)=>{const N={...C,[n]:v},f=r.flatMap(_=>_.items).find(_=>_.name===n);f!=null&&f.removeIfEmpty&&(v==null||v==="")&&delete N[n],M(N),H(_=>({..._,[n]:!0}));const j=V(n,v,N);A(_=>({..._,[n]:j||""})),l==null||l(N,n)},[C,r,V,l]),I=m.useCallback(async n=>{if(n.preventDefault(),i)return;const v={},N=r.flatMap(j=>j.items);for(const j of N){if(j.hidden||j.conditional&&!j.conditional(C))continue;const _=V(j.name,C[j.name],C);_&&(v[j.name]=_)}if(g){const j=g(C);j&&Object.assign(v,j)}if(A(v),Object.keys(v).some(j=>v[j]))return;const f=o?o(C):C;await(t==null?void 0:t(C,f))},[C,r,V,g,o,t,i]),U=m.useCallback(n=>{var _,F;const v=C[n.name],N=J[n.name]?q[n.name]:void 0,f=n.disabled||i,j={value:v||"",disabled:f,required:n.required,placeholder:n.placeholder,...n.fieldProps};switch(n.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(le,{...j,onChange:P=>B(n.name,P.target.value),type:n.textType||n.type,autoComplete:n.autocomplete,error:N,size:d});case"textarea":return e.jsx(ce,{...j,onChange:P=>B(n.name,P.target.value),rows:4,error:N,size:d});case"select":return e.jsx(oe,{...j,onChange:P=>B(n.name,P),options:(n.options||[]).map(P=>({...P,value:String(P.value)})),searchable:n.searchable,multiple:n.multiple,error:N,size:d});case"checkbox":return e.jsx(ne,{...j,checked:!!v,onChange:P=>B(n.name,P.target.checked),size:d});case"radio":return e.jsx("div",{className:"space-y-1",children:(_=n.options)==null?void 0:_.map(P=>e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"radio",name:n.name,value:P.value,checked:v===P.value,onChange:()=>B(n.name,P.value),disabled:f||P.disabled,className:"rounded-full border-neutral-100 dark:border-neutral-600"}),e.jsx(ee,{variant:"label",size:"sm",children:P.label})]},P.value))});case"date":return e.jsx(de,{...j,value:v?new Date(v):null,onChange:P=>B(n.name,P),size:d});case"custom":return(F=n.customComponent)==null?void 0:F.call(n,{value:v,onChange:P=>B(n.name,P),error:N,disabled:f});case"array":{const P=v||[];let Z=[];if(typeof N=="string"&&N.startsWith("["))try{Z=JSON.parse(N)}catch{}const G=()=>{B(n.name,[...P,{}])},Q=W=>{B(n.name,P.filter((Y,re)=>re!==W))},K=(W,Y,re)=>{const T=[...P];T[W]={...T[W],[Y]:re},B(n.name,T)};return e.jsxs("div",{className:"space-y-2",children:[P.map((W,Y)=>{var re;return e.jsxs("div",{className:"p-4 border rounded-md dark:border-neutral-700 space-y-2 relative",children:[e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:()=>Q(Y),disabled:f,children:"Remove"})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:(re=n.arrayFields)==null?void 0:re.map(T=>{var R;const ae=(R=Z==null?void 0:Z[Y])==null?void 0:R[T.name];return e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block",children:e.jsxs(ee,{variant:"label",size:"sm",className:"font-semibold text-neutral-700 dark:text-neutral-300",children:[T.label,T.required&&e.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})}),(()=>{var u,$;const te={value:(W==null?void 0:W[T.name])||"",disabled:f,required:T.required,placeholder:T.placeholder,...T.fieldProps};switch(T.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(le,{...te,onChange:L=>K(Y,T.name,L.target.value),type:T.textType||T.type,autoComplete:T.autocomplete,error:ae,size:d});case"textarea":return e.jsx(ce,{...te,onChange:L=>K(Y,T.name,L.target.value),rows:4,error:ae,size:d});case"select":return e.jsx(oe,{...te,onChange:L=>K(Y,T.name,L),options:(T.options||[]).map(L=>({...L,value:String(L.value)})),searchable:T.searchable,multiple:T.multiple,error:ae,size:d});case"checkbox":return e.jsx(ne,{...te,checked:!!(W!=null&&W[T.name]),onChange:L=>K(Y,T.name,L.target.checked),size:d});case"radio":return e.jsx("div",{className:"space-y-1",children:(u=T.options)==null?void 0:u.map(L=>e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"radio",name:`${n.name}.${Y}.${T.name}`,value:L.value,checked:(W==null?void 0:W[T.name])===L.value,onChange:()=>K(Y,T.name,L.value),disabled:f||L.disabled,className:"rounded-full border-neutral-100 dark:border-neutral-600"}),e.jsx(ee,{variant:"label",size:"sm",children:L.label})]},L.value))});case"date":{const L=W==null?void 0:W[T.name];return e.jsx(de,{...te,value:L?new Date(L):null,onChange:z=>K(Y,T.name,z),size:d})}case"custom":return($=T.customComponent)==null?void 0:$.call(T,{value:W==null?void 0:W[T.name],onChange:L=>K(Y,T.name,L),error:ae,disabled:f});default:return e.jsxs("p",{children:["Unsupported field type in array:"," ",T.type]})}})(),ae&&e.jsx(ee,{variant:"body",size:"sm",className:"text-red-600 dark:text-red-400",children:ae})]},T.name)})})]},Y)}),e.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:G,disabled:f,children:["Add ",n.label]})]})}default:return null}},[C,J,q,i,d,B]),S=m.useCallback(n=>{if(n.conditional&&!n.conditional(C))return null;const v=n.items.filter(f=>!(f.hidden||f.conditional&&!f.conditional(C)));if(v.length===0)return null;const N=x("space-y-2",{"grid gap-2":n.layout==="grid","flex flex-wrap gap-2":n.layout==="flex"},n.layout==="grid"&&{"grid-cols-1":!n.columns||n.columns===1,"grid-cols-2":n.columns===2,"grid-cols-3":n.columns===3,"grid-cols-4":n.columns===4},n.className);return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 p-6 border border-neutral dark:border-neutral-700 rounded-xl",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx(ee,{variant:"label",size:"lg",weight:"semibold",className:"text-neutral-900 dark:text-neutral-100",children:n.title}),n.description&&e.jsx(ee,{variant:"body",size:"sm",className:"text-neutral-600 dark:text-neutral-400 mt-1",children:n.description})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:N,children:v.map(f=>(J[f.name]&&q[f.name],e.jsxs("div",{className:x("space-y-1",f.width&&typeof f.width=="string"&&`w-[${f.width}]`,f.width&&typeof f.width=="number"&&`col-span-${f.width}`),children:[f.type!=="custom"&&e.jsx("label",{className:"block",children:e.jsxs(ee,{variant:"label",size:"sm",className:"font-medium text-neutral-700 dark:text-neutral-300",children:[f.label,f.required&&e.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})}),U(f)]},f.name)))})})]},n.id)},[C,J,q,U]),y=x("space-y-6",{"max-w-md":d==="sm","max-w-2xl":d==="md","max-w-4xl":d==="lg","max-w-full":d==="full"},k);return e.jsxs("form",{ref:p,onSubmit:I,className:y,children:[e.jsx("div",{className:"space-y-8",children:r.map(S)}),c&&e.jsxs("div",{className:x("flex gap-3 justify-end pt-8"),children:[a&&e.jsx(X,{type:"button",variant:b.variant,size:b.size||d,disabled:b.disabled||i,onClick:a,className:b.className,children:b.label}),e.jsx(X,{type:"submit",variant:h.variant,size:h.size||d,disabled:h.disabled||i,loading:i,className:h.className,children:h.label})]})]})},he=({trigger:r,options:s,value:t,onSelect:a,placement:l="bottom-start",disabled:o=!1,className:g,showCheck:h=!0,header:b})=>{const[c,w]=m.useState(!1),[d,i]=m.useState(null),[k,p]=m.useState({top:0,left:0}),C=m.useRef(null),M=m.useRef(null),q=m.useRef(null),A=m.useRef(null);m.useEffect(()=>{const y=n=>{C.current&&!C.current.contains(n.target)&&q.current&&!q.current.contains(n.target)&&(w(!1),i(null),A.current&&(clearTimeout(A.current),A.current=null))};return c&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[c]),m.useEffect(()=>{const y=n=>{n.key==="Escape"&&(w(!1),i(null),A.current&&(clearTimeout(A.current),A.current=null))};return c&&document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[c]),m.useEffect(()=>{if(d&&C.current){const y=C.current.querySelector(`[data-option-value="${d}"]`);if(y){const n=y.getBoundingClientRect();p({top:n.top,left:n.right+8})}}},[d]),m.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const J=y=>{y.stopPropagation(),o||(w(!c),i(null),A.current&&(clearTimeout(A.current),A.current=null))},H=(y,n,v)=>{y.stopPropagation(),!n.disabled&&!n.divider&&(!n.children||n.children.length===0)&&(a==null||a(n.value,v),w(!1),i(null))},V=y=>{A.current&&(clearTimeout(A.current),A.current=null),y.children&&y.children.length>0?i(y.value):i(null)},B=y=>{y.children&&y.children.length>0?A.current=setTimeout(()=>{i(null)},150):i(null)},I=(y,n,v)=>{y.stopPropagation(),!n.disabled&&!n.divider&&(a==null||a(n.value,v),w(!1),i(null))},U=x("absolute z-50 min-w-[200px] bg-white dark:bg-gray-800 rounded-md shadow-xs border border-gray-100 dark:border-gray-600","max-h-60 overflow-auto",{"top-full left-0 mt-2":l==="bottom-start","top-full right-0 mt-2":l==="bottom-end","bottom-full left-0 mb-2":l==="top-start","bottom-full right-0 mb-2":l==="top-end"}),S=x("fixed z-[60] min-w-[200px] bg-white dark:bg-gray-800 rounded-md shadow-lg border border-gray-100 dark:border-gray-600","max-h-60 overflow-auto");return e.jsxs("div",{ref:C,className:x("relative flex flex-row items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700",g),children:[e.jsx("button",{ref:M,onClick:J,disabled:o,className:x("inline-flex items-center justify-center",{"opacity-50 cursor-not-allowed":o}),children:r}),c&&e.jsx("div",{className:U,children:e.jsxs("div",{className:"p-2",children:[b&&e.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider px-3 py-2",children:b}),s.map((y,n)=>{if(y.divider)return e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-2"},`divider-${n}`);const v=y.children&&y.children.length>0,N=d===y.value;return e.jsxs("div",{className:"relative group",children:[e.jsxs("button",{"data-option-value":y.value,onClick:f=>H(f,y),onMouseEnter:()=>V(y),onMouseLeave:()=>B(y),disabled:y.disabled,className:x("w-full flex items-center justify-between px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",{"opacity-50 cursor-not-allowed":y.disabled,"bg-gray-100 dark:bg-gray-700":N&&v}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[y.icon&&e.jsx("span",{className:"flex-shrink-0",children:y.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:y.label}),y.description&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:y.description})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[h&&t===y.value&&e.jsx("span",{className:"h-4 w-4 text-green-600 flex-shrink-0 text-sm font-bold",children:"✓"}),v&&e.jsx("span",{className:"text-gray-400 dark:text-gray-500 text-xs",children:"▶"})]})]}),v&&N&&e.jsx("div",{ref:q,className:S,style:{top:`${k.top}px`,left:`${k.left}px`},onMouseEnter:()=>{A.current&&(clearTimeout(A.current),A.current=null),i(y.value)},onMouseLeave:()=>{A.current=setTimeout(()=>{i(null)},150)},children:e.jsx("div",{className:"p-2",children:y.children.map((f,j)=>{if(f.divider)return e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-2"},`divider-${j}`);const _=typeof t=="object"&&t[y.value]&&t[y.value].includes(f.value)||t===f.value;return e.jsxs("button",{onClick:F=>I(F,f,y.value),disabled:f.disabled,className:x("w-full flex items-center justify-between px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",{"opacity-50 cursor-not-allowed":f.disabled}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[f.icon&&e.jsx("span",{className:"flex-shrink-0",children:f.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:f.label}),f.description&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:f.description})]})]}),h&&_&&e.jsx("span",{className:"h-4 w-4 text-green-600 flex-shrink-0 text-sm font-bold",children:"✓"})]},f.value)})})})]},y.value)}),(()=>{const y=s.reduce((n,v)=>{if(v.divider)return n;const N=v.children?v.children.filter(f=>!f.divider).length:0;return n+1+N},0);return y>1&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 mt-2 pt-2",children:e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 px-3 py-1",children:[y," options available"]})})})()]})})]})},Pe={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-full mx-4"};function Be({open:r,onClose:s,title:t,size:a="md",closeOnBackdropClick:l=!0,closeOnEscape:o=!0,className:g,backdropClassName:h,children:b,footer:c,showCloseButton:w=!0}){const d=m.useRef(null),i=m.useRef(null);m.useEffect(()=>{if(!r||!o)return;const p=C=>{C.key==="Escape"&&s()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[r,o,s]),m.useEffect(()=>(r?(i.current=document.activeElement,d.current&&d.current.focus(),document.body.style.overflow="hidden"):(i.current&&i.current.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}),[r]);const k=p=>{l&&p.target===p.currentTarget&&s()};return r?e.jsx("div",{className:x("fixed inset-0 z-50 flex items-center justify-center p-4","bg-black/20",h),onClick:k,children:e.jsxs("div",{ref:d,className:x("relative w-full bg-white dark:bg-secondary-800 rounded-modal shadow-modal rounded-md","focus:outline-none",Pe[a],g),role:"dialog","aria-modal":"true","aria-labelledby":t?"modal-title":void 0,tabIndex:-1,children:[(t||w)&&e.jsxs("div",{className:"flex items-center justify-between p-6 pb-0",children:[t&&e.jsx("span",{id:"modal-title",className:"text-lg font-semibold text-secondary-800 dark:text-secondary-200",children:t}),w&&e.jsx("button",{onClick:s,className:"p-1 text-secondary-400 hover:text-secondary-600 dark:hover:text-secondary-300 transition-colors","aria-label":"Close modal",children:e.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-6",children:b}),c&&e.jsx("div",{className:"px-6 py-4",children:c})]})}):null}const Ie={default:"bg-secondary-100 text-secondary-800 dark:bg-secondary-800 dark:text-secondary-200",primary:"bg-primary-100 text-primary-800 dark:bg-primary-900 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-800 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",info:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"},_e={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm",lg:"px-3 py-1.5 text-base"},ze={default:"bg-secondary-400",primary:"bg-primary-500",secondary:"bg-secondary-400",success:"bg-green-500",warning:"bg-yellow-500",error:"bg-red-500",info:"bg-blue-500"};function Ve({variant:r="default",size:s="md",dot:t=!1,icon:a,dismissible:l=!1,onDismiss:o,className:g,children:h,...b}){return e.jsxs("span",{className:x("inline-flex items-center font-medium rounded-full",Ie[r],_e[s],g),...b,children:[t&&e.jsx("span",{className:x("w-2 h-2 rounded-full mr-1.5",ze[r])}),a&&e.jsx("span",{className:x("flex-shrink-0",h&&"mr-1"),children:a}),h,l&&o&&e.jsx("button",{onClick:o,className:"ml-1.5 flex-shrink-0 hover:opacity-70 transition-opacity","aria-label":"Remove badge",children:e.jsx("svg",{className:"h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})}function xe({children:r,showTableSkeleton:s=!1,tableColumns:t=6,tableRows:a=8}){return r?e.jsx("main",{className:"flex-1 bg-gray-50 dark:bg-gray-950 p-6",children:e.jsx("div",{className:"w-full max-w-6xl mx-auto animate-pulse",children:r})}):e.jsx("main",{className:"flex-1 bg-gray-50 dark:bg-gray-950 p-6",children:e.jsxs("div",{className:"w-full mx-auto space-y-6 animate-pulse",children:[!s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-1/4"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2"})]})]}),s&&e.jsxs("div",{className:"rounded-lg overflow-hidden",children:[e.jsx("div",{className:`grid grid-cols-${t} gap-2 bg-gray-100 dark:bg-gray-800 p-3`,children:Array.from({length:t}).map((l,o)=>e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-2/3"},`header-${o}`))}),Array.from({length:a}).map((l,o)=>e.jsx("div",{className:`grid grid-cols-${t} gap-2 p-3 border-t border-gray-100 dark:border-gray-800`,children:Array.from({length:t}).map((g,h)=>e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-full"},`cell-${o}-${h}`))},`row-${o}`))]})]})})}const We={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8",xl:"h-12 w-12"},qe={primary:"text-primary",secondary:"text-secondary-600",white:"text-white",current:"text-current"},He={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"};function Oe({size:r="md",variant:s="primary",label:t="Loading...",showLabel:a=!1,className:l,...o}){return e.jsxs("div",{className:x("inline-flex items-center",a?"flex-col space-y-2":"",l),...o,children:[e.jsxs("svg",{className:x("animate-spin",We[r],qe[s]),fill:"none",viewBox:"0 0 24 24","aria-hidden":!a,role:a?"status":void 0,children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),a&&e.jsx("span",{className:x("text-secondary-600 dark:text-secondary-400",He[r]),children:t}),!a&&e.jsx("span",{className:"sr-only",children:t})]})}const Je=({icon:r,size:s="md",color:t="current",clickable:a=!1,onClick:l,className:o,"aria-label":g,...h})=>{const b=typeof s=="number"?s:Ye(s),c=x("inline-block",{"text-primary":t==="primary","text-secondary":t==="secondary","text-accent":t==="accent","text-success":t==="success","text-warning":t==="warning","text-error":t==="error","text-info":t==="info","text-neutral":t==="neutral","text-current":t==="current"},{"cursor-pointer hover:opacity-80 transition-opacity duration-200":a,"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/20 rounded":a},o),w={size:b,className:c,onClick:a?l:void 0,"aria-label":g,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:a?d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l==null||l())}:void 0,...h};return e.jsx(r,{...w})};function Ye(r){return{xs:12,sm:16,md:20,lg:24,xl:32}[r]}const Ge=({src:r,alt:s,size:t="md",aspectRatio:a="auto",radius:l="md",showLoading:o=!0,showError:g=!0,fallback:h,loadingContent:b,errorContent:c,className:w,onLoad:d,onError:i,...k})=>{const[p,C]=m.useState(!0),[M,q]=m.useState(!1),[A,J]=m.useState(r),H=n=>{C(!1),q(!1),d==null||d(n)},V=n=>{if(C(!1),q(!0),h&&A!==h){J(h),q(!1),C(!0);return}i==null||i(n)},B=x("relative overflow-hidden bg-neutral-100 dark:bg-neutral-800",{"w-8 h-8":t==="xs","w-12 h-12":t==="sm","w-16 h-16":t==="md","w-24 h-24":t==="lg","w-32 h-32":t==="xl","w-full h-full":t==="full"},{"aspect-square":a==="square","aspect-video":a==="video","aspect-[3/4]":a==="portrait","aspect-[4/3]":a==="landscape"},{"rounded-none":l==="none","rounded-sm":l==="sm","rounded-md":l==="md","rounded-lg":l==="lg","rounded-xl":l==="xl","rounded-full":l==="full"},w),I=x("w-full h-full object-cover transition-opacity duration-200",{"opacity-0":p||M,"opacity-100":!p&&!M}),U=x("absolute inset-0 flex items-center justify-center","text-neutral-400 dark:text-neutral-500"),S=e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"w-6 h-6 bg-neutral-300 dark:bg-neutral-600 rounded"})}),y=e.jsxs("div",{className:"text-center",children:[e.jsx("svg",{className:"w-6 h-6 mx-auto mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e.jsx("span",{className:"text-xs",children:"Failed to load"})]});return e.jsxs("div",{className:B,children:[e.jsx("img",{...k,src:A,alt:s,className:I,onLoad:H,onError:V}),p&&o&&e.jsx("div",{className:U,children:b||S}),M&&g&&e.jsx("div",{className:U,children:c||y})]})},Ue=({title:r,subtitle:s,actions:t=[],children:a,className:l,backLabel:o="Back",backClassName:g,onBack:h})=>e.jsxs("div",{className:x("p-5 pb-3 border-b border-gray-100 dark:border-gray-700",l),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-center gap-2 text-neutral-900 dark:text-neutral-100 pb-2",children:[h&&e.jsx("button",{onClick:h,className:x("flex items-center text-sm dark:hover:text-neutral-300 cursor-pointer transition",g),children:e.jsx(ie.ArrowLeft,{size:16,color:"currentColor"})}),e.jsx("h2",{className:"text-2xl font-semibold truncate",children:r})]})}),t.length>0&&e.jsx("div",{className:"flex flex-wrap sm:flex-nowrap gap-2 sm:gap-3",children:t.map(b=>e.jsxs("button",{onClick:c=>{c.stopPropagation(),c.target.blur(),b.onClick()},disabled:b.disabled,className:x("btn",{o__primary:b.variant==="primary",o__secondary:b.variant==="secondary"||b.variant==="outline",o__ghost:b.variant==="ghost",o__destructive:b.variant==="destructive"}),children:[b.icon&&e.jsx("span",{className:"mr-2",children:b.icon}),b.label]},b.id))})]}),a&&e.jsx("div",{className:"mt-4",children:a})]}),Ke=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m21 21-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),Fe=({active:r})=>e.jsx("svg",{className:x("h-3 w-3",r?"text-neutral-900 dark:text-neutral-100":"text-neutral-400"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m18 15-6-6-6 6"})}),Qe=({active:r})=>e.jsx("svg",{className:x("h-3 w-3",r?"text-neutral-900 dark:text-neutral-100":"text-neutral-400"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m6 9 6 6 6-6"})}),Xe=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m15 18-6-6 6-6"})}),Ze=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m9 18 6-6-6-6"})}),Re=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m11 17-5-5 5-5m6 10-5-5 5-5"})}),er=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m7 17 5-5-5-5m6 10 5-5-5-5"})}),be=()=>e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m6 9 6 6 6-6"})}),rr=r=>{var a,l,o,g;const s=h=>{var b;return r.multiSelect&&Array.isArray(r.value)?(b=r.value)==null?void 0:b.includes(h):r.value===h},t=h=>{r.multiSelect&&Array.isArray(r.value)?r.onChange(r.value.filter(b=>b!==h)):r.onChange(h)};return r.type==="date"?e.jsx("div",{className:"flex items-center space-x-1 max-w-[140px]",children:e.jsx(de,{size:"sm",value:r.value,onChange:h=>r.onChange(h),placeholder:r.placeholder||`Select ${r.label.toLowerCase()}`,className:"min-w-[160px] btn btn o__secondary"})}):e.jsx("div",{className:"flex items-center space-x-1 max-w-[240px]",children:e.jsx("div",{className:"relative",children:e.jsxs("details",{className:"group",children:[e.jsxs("summary",{className:"flex items-center space-x-2 cursor-pointer hover:bg-white rounded-full px-3 py-2 text-sm btn btn o__secondary",children:[e.jsx("span",{children:r.label}),e.jsx("span",{className:"text-gray-800",children:r.multiSelect&&Array.isArray(r.value)?(a=r.value)==null?void 0:a.map(h=>{var b,c;return(c=(b=r.options)==null?void 0:b.find(w=>w.value===h))==null?void 0:c.label}).join(", "):(o=(l=r.options)==null?void 0:l.find(h=>h.value===r.value))==null?void 0:o.label}),e.jsx("span",{className:"text-gray-500 text-sm group-open:rotate-180 transition-transform",children:e.jsx(be,{})})]}),e.jsxs("div",{className:"absolute z-10 left-0 mt-1 bg-white border border-gray-100 rounded-lg shadow-sm p-2 w-48",children:[(g=r.options)==null?void 0:g.map(h=>e.jsx("button",{className:"w-full text-left px-3 py-2 rounded-md hover:bg-gray-50 text-sm text-gray-700 flex items-center space-x-2",onClick:()=>t(h.value),children:e.jsx("span",{className:x(s(h.value)&&"text-primary-500"),children:h.label})},h.value)),r.value&&e.jsx("button",{className:"w-full text-left px-3 py-2 rounded-md hover:bg-gray-50 text-sm text-gray-700 flex items-center space-x-2 mt-2",onClick:()=>t(null),children:e.jsx("span",{className:"text-gray-400 dark:text-gray-600",children:"Clear filter"})})]})]})})})},ar=({data:r,columns:s,loading:t=!1,searchable:a=!1,searchPlaceholder:l="Search...",filters:o=[],paginated:g=!1,pageSizeOptions:h=[10,25,50,100],defaultPageSize:b=10,actions:c=[],onRowClick:w,selectable:d=!1,selectedRows:i=[],onSelectionChange:k,getRowKey:p=(V,B)=>B,emptyContent:C,hoverable:M=!0,bordered:q=!1,striped:A=!1,className:J,rowClassName:H})=>{const[V,B]=m.useState(""),[I,U]=m.useState({column:null,direction:null}),[S,y]=m.useState({page:0,pageSize:b}),n=m.useRef(null),v=m.useMemo(()=>{let u=r;if(a&&V.trim()){const $=s.filter(z=>z.searchable!==!1),L=V.toLowerCase();u=u.filter(z=>$.some(E=>{const O=typeof E.accessor=="function"?E.accessor(z):z[E.accessor];return String(O||"").toLowerCase().includes(L)}))}return o.forEach($=>{$.value&&$.value!=="all"&&(u=u.filter(L=>{const z=s.find(O=>O.id===$.id);if(!z)return!0;const E=typeof z.accessor=="function"?z.accessor(L):L[z.accessor];return String(E||"")===$.value}))}),u},[r,V,s,a,o]),N=m.useMemo(()=>{if(!I.column||!I.direction)return v;const u=s.find($=>$.id===I.column);return u?[...v].sort(($,L)=>{const z=typeof u.accessor=="function"?u.accessor($):$[u.accessor],E=typeof u.accessor=="function"?u.accessor(L):L[u.accessor];let O=0;return z<E?O=-1:z>E&&(O=1),I.direction==="desc"?-O:O}):v},[v,I,s]),f=m.useMemo(()=>{if(!g)return N;const u=S.page*S.pageSize,$=u+S.pageSize;return N.slice(u,$)},[N,S,g]),j=m.useCallback(u=>{const $=s.find(L=>L.id===u);$!=null&&$.sortable&&U(L=>L.column!==u?{column:u,direction:"asc"}:L.direction==="asc"?{column:u,direction:"desc"}:{column:null,direction:null})},[s]),_=m.useCallback(u=>{y($=>({...$,page:u}))},[]),F=m.useCallback(u=>{y({page:0,pageSize:u})},[]),P=m.useCallback((u,$)=>{if(!k)return;const L=p(u,0);i.map((z,E)=>p(z,E)),k($?[...i,u]:i.filter((z,E)=>p(i[E],E)!==L))},[i,k,p]),Z=m.useCallback(u=>{k&&k(u?[...f]:[])},[f,k]);m.useEffect(()=>{y(u=>({...u,page:0}))},[V,I]),m.useEffect(()=>{y(u=>({...u,page:0}))},[o.map(u=>u.value).join(",")]);const G=N.length,Q=Math.ceil(G/S.pageSize),K=S.page*S.pageSize+1,W=Math.min(K+S.pageSize-1,G),Y=f.length>0&&f.every(u=>{const $=p(u,0);return i.some((L,z)=>p(L,z)===$)}),re=f.some(u=>{const $=p(u,0);return i.some((L,z)=>p(L,z)===$)}),T=x("w-full text-sm leading-5 text-[var(--text-default)] border-collapse",J),ae=x("bg-[var(--base-module)]"),R=x("text-[var(--text-default)] dark:text-[var(--text-on-neutral)] truncate p-3 border-b border-[var(--neutral-border)]"),te=x("h-12",{"hover:bg-[var(--neutral-container)] dark:hover:bg-[var(--neutral-container-emphasis)]":M,"cursor-pointer":w});return e.jsxs("div",{className:"space-y-4",children:[(a||o.length>0)&&e.jsx("div",{className:"pt-4 pb-2",children:e.jsxs("div",{className:"flex flex-wrap gap-4 items-start",children:[o.map(u=>e.jsx(rr,{...u},u.id)),e.jsx("div",{className:"w-full sm:w-auto sm:ml-auto min-w-[200px]",children:e.jsx(le,{placeholder:l,value:V,onChange:u=>B(u.target.value),startIcon:e.jsx(Ke,{}),className:"max-w-sm"})})]})}),e.jsxs("div",{className:"relative w-full overflow-x-auto min-h-[400px]",children:[t&&e.jsx("div",{className:"flex items-center justify-center z-10",children:e.jsx(xe,{showTableSkeleton:!0,tableRows:10,tableColumns:s.length})}),e.jsxs("table",{ref:n,className:x(T,"min-w-full"),children:[e.jsx("thead",{className:ae,children:e.jsxs("tr",{children:[d&&e.jsx("th",{className:x(R,"w-12"),children:e.jsx("input",{type:"checkbox",checked:Y,ref:u=>{u&&(u.indeterminate=re&&!Y)},onChange:u=>Z(u.target.checked),className:"rounded border-neutral-300 dark:border-neutral-600"})}),!t&&s.map(u=>e.jsx("th",{className:x(R,"font-semibold text-xs text-[var(--text-muted)] dark:text-[var(--text-muted)] uppercase tracking-wider","group",{"text-left":u.align==="left"||!u.align,"text-center":u.align==="center","text-right":u.align==="right","cursor-pointer select-none":u.sortable,"sticky left-0 bg-white dark:bg-neutral-900":u.sticky==="left","sticky right-0 bg-white dark:bg-neutral-900":u.sticky==="right"}),style:{width:u.width},onClick:()=>u.sortable&&j(u.id),children:e.jsxs("div",{className:"flex items-center gap-2",children:[u.headerCell?u.headerCell():u.header,u.sortable&&e.jsxs("div",{className:x("flex flex-col opacity-0 group-hover:opacity-100 transition-opacity",I.column===u.id&&"opacity-100"),children:[e.jsx(Fe,{active:I.column===u.id&&I.direction==="asc"}),e.jsx(Qe,{active:I.column===u.id&&I.direction==="desc"})]})]})},u.id)),c.length>0&&e.jsx("th",{className:x(R,"w-20"),children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:f.length===0||t?!t&&e.jsx("tr",{children:e.jsx("td",{colSpan:s.length+(d?1:0)+(c.length>0?1:0),className:x(R,"text-center py-8 text-neutral-500 dark:text-neutral-400"),children:C||"No data available"})}):f.map((u,$)=>{const L=p(u,$),z=i.some((E,O)=>p(E,O)===L);return e.jsxs("tr",{className:x(te,{"bg-blue-50 dark:bg-blue-900/20":z},H==null?void 0:H(u,$)),onClick:E=>{E.stopPropagation(),w==null||w(u,$)},children:[d&&e.jsx("td",{className:R,children:e.jsx("input",{type:"checkbox",checked:z,onChange:E=>{E.stopPropagation(),P(u,E.target.checked)},className:"rounded border-neutral-300 dark:border-neutral-600"})}),s.map(E=>{const O=typeof E.accessor=="function"?E.accessor(u):u[E.accessor];return e.jsx("td",{className:x(R,{"text-left":E.align==="left"||!E.align,"text-center":E.align==="center","text-right":E.align==="right","sticky left-0 bg-white dark:bg-neutral-900":E.sticky==="left","sticky right-0 bg-white dark:bg-neutral-900":E.sticky==="right"}),children:E.cell?E.cell(O,u,$):String(O||"")},E.id)}),c.length>0&&e.jsx("td",{className:R,children:e.jsx(he,{trigger:e.jsxs("div",{className:"inline-flex items-center gap-1 px-2 py-1 text-sm text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100",children:[e.jsx("span",{children:"Options"}),e.jsx(be,{})]}),options:c.map(E=>{var O;return{value:E.id,label:E.label,icon:E.icon,disabled:(O=E.disabled)==null?void 0:O.call(E,u)}}),onSelect:E=>{const O=c.find(mr=>mr.id===E);O&&O.onClick(u,$)},placement:"bottom-end"})})]},L)})})]})]}),g&&G>0&&e.jsxs("div",{className:"flex items-center justify-between px-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:["Showing ",K," to ",W," of ",G," results"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Rows per page:"}),e.jsx("select",{value:S.pageSize,onChange:u=>F(Number(u.target.value)),className:"border border-[var(--neutral-border)] text-[var(--text-default)] dark:text-[var(--text-on-neutral)] rounded-md px-2 py-1 text-sm bg-[var(--base-input)] dark:bg-[var(--base-input)] w-16",children:h.map(u=>e.jsx("option",{value:u,children:u},u))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(X,{size:"sm",variant:"ghost",onClick:()=>_(0),disabled:S.page===0,iconOnly:!0,children:e.jsx(Re,{})}),e.jsx(X,{size:"sm",variant:"ghost",onClick:()=>_(S.page-1),disabled:S.page===0,iconOnly:!0,children:e.jsx(Xe,{})}),e.jsxs("span",{className:"px-3 py-1 text-sm text-gray-500 dark:text-gray-400",children:["Page ",S.page+1," of ",Q]}),e.jsx(X,{size:"sm",variant:"ghost",onClick:()=>_(S.page+1),disabled:S.page>=Q-1,iconOnly:!0,children:e.jsx(Ze,{})}),e.jsx(X,{size:"sm",variant:"ghost",onClick:()=>_(Q-1),disabled:S.page>=Q-1,iconOnly:!0,children:e.jsx(er,{})})]})]})]})},ge=({item:r,isSelectedHandler:s,onClick:t})=>{var b;const[a,l]=m.useState(!1),o=r.children&&r.children.length>0,g=()=>{o&&l(!a)},h=s?s(r.path):!1;return e.jsxs("li",{children:[e.jsxs("div",{className:x("flex flex-row w-full py-1 rounded-lg items-center h-8 transition-colors cursor-pointer px-3 pr-1 no-underline text-sm",{"active-nav-item":h,"shadow-lvl-0":h,"font-semibold":h||o||r.children!==void 0}),onClick:()=>{o?g():r.path&&(t==null||t(r.path))},children:[r.icon&&e.jsx("span",{className:"mr-2",children:r.icon}),e.jsx("span",{className:"flex-1",children:r.label}),r.count!==void 0&&r.count>0&&e.jsx("span",{className:"ml-2 mr-1.5",children:r.count}),o&&e.jsx("span",{className:`${a?"collapsed":""}`,children:e.jsx(ie.ChevronDownIcon,{className:"w-4 h-4 text-gray-300"})})]}),o&&!a&&e.jsx("ul",{className:"sidebar-menu-nested-items",children:(b=r.children)==null?void 0:b.map((c,w)=>e.jsx(ge,{item:c,isSelectedHandler:s,onClick:t},w))})]})},tr=({title:r,actionIcons:s,items:t,isSelectedHandler:a,onClick:l})=>e.jsxs("div",{className:"flex flex-col h-screen mb-6",children:[e.jsxs("div",{className:"sidebar-menu-header",children:[e.jsx("span",{className:"text-xl font-semibold text-gray-800 mb-2",children:r}),e.jsx("div",{className:"sidebar-menu-actions",children:s==null?void 0:s.map((o,g)=>e.jsx("span",{className:"sidebar-menu-action-icon",children:o},g))})]}),e.jsx("ul",{children:t.map((o,g)=>!o.path&&!o.label&&!o.children?e.jsx("span",{className:"flex w-full h-4"},g):e.jsx(ge,{item:o,isSelectedHandler:a,onClick:l},g))})]}),sr=m.createContext(null),lr=({items:r,activeTab:s,onTabChange:t,className:a})=>{var b;const[l,o]=m.useState(((b=r[0])==null?void 0:b.id)||""),g=s||l,h=c=>{t?t(c):o(c)};return e.jsx("div",{className:x("border-b border-neutral-200 dark:border-neutral-700",a),children:e.jsx("nav",{className:"-mb-px flex space-x-8",children:r.map(c=>e.jsx("button",{onClick:()=>!c.disabled&&h(c.id),disabled:c.disabled,className:x("border-b-2 py-2 px-1 text-sm font-medium transition-colors duration-200",{"border-primary text-primary":g===c.id,"border-transparent text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300":g!==c.id&&!c.disabled,"border-transparent text-neutral-300 cursor-not-allowed dark:text-neutral-600":c.disabled}),children:e.jsxs("span",{className:"flex items-center gap-2",children:[c.label,c.badge&&e.jsx("span",{className:x("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",g===c.id?"bg-primary/10 text-primary":"bg-neutral-100 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-400"),children:c.badge})]})},c.id))})})},nr=({items:r,defaultTab:s,activeTab:t,onTabChange:a,variant:l="default",size:o="md",className:g})=>{var C;const[h,b]=m.useState(s||t||((C=r[0])==null?void 0:C.id)||""),c=t||h,w=M=>{a?a(M):b(M)},d={activeTab:c,setActiveTab:w},i=r.find(M=>M.id===c),k=x("flex",{"border-b border-neutral-200 dark:border-neutral-700":l==="default"||l==="underline","bg-neutral-100 dark:bg-neutral-800 p-1 rounded-lg":l==="pills","space-x-1":l==="pills","space-x-8":l==="default"||l==="underline"},g),p=(M,q)=>{const A="transition-colors duration-200 font-medium",J={"text-xs px-2 py-1":o==="sm","text-sm px-3 py-2":o==="md","text-base px-4 py-3":o==="lg"},H={"border-b-2 -mb-px":l==="default","rounded-md":l==="pills","border-b-2 pb-2":l==="underline"},V={"opacity-50 cursor-not-allowed":M.disabled,"cursor-pointer":!M.disabled},B=q?{"border-primary text-primary":l==="default"||l==="underline","bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100 shadow-sm":l==="pills"}:{},I=!q&&!M.disabled?{"border-transparent text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-100":l==="default","text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-100":l==="pills","border-transparent text-neutral-600 hover:text-neutral-900 hover:border-neutral-300 dark:text-neutral-400 dark:hover:text-neutral-100":l==="underline"}:{};return x(A,J,H,V,B,I)};return e.jsx(sr.Provider,{value:d,children:e.jsxs("div",{children:[e.jsx("div",{className:k,role:"tablist",children:r.map(M=>e.jsx("button",{role:"tab","aria-selected":c===M.id,"aria-controls":`tabpanel-${M.id}`,disabled:M.disabled,onClick:()=>!M.disabled&&w(M.id),className:p(M,c===M.id),children:e.jsxs("span",{className:"flex items-center gap-2",children:[M.label,M.badge&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-neutral-200 text-neutral-700 dark:bg-neutral-700 dark:text-neutral-300",children:M.badge})]})},M.id))}),(i==null?void 0:i.content)&&e.jsx("div",{role:"tabpanel",id:`tabpanel-${c}`,"aria-labelledby":`tab-${c}`,className:"mt-4",children:i.content})]})})},dr=({level:r=1,size:s,weight:t="bold",color:a="current",align:l="left",truncate:o=!1,className:g,children:h,...b})=>{const c=s||or(r),w=x("font-primary",{"text-xs":c==="xs","text-sm":c==="sm","text-base":c==="md","text-lg":c==="lg","text-xl":c==="xl","text-2xl":c==="2xl","text-3xl":c==="3xl","text-4xl":c==="4xl"},{"font-light":t==="light","font-normal":t==="normal","font-medium":t==="medium","font-semibold":t==="semibold","font-bold":t==="bold"},{"text-primary":a==="primary","text-secondary":a==="secondary","text-accent":a==="accent","text-success":a==="success","text-warning":a==="warning","text-error":a==="error","text-info":a==="info","text-neutral":a==="neutral","text-current":a==="current"},{"text-left":l==="left","text-center":l==="center","text-right":l==="right"},{truncate:o},g),d=`h${r}`;return e.jsx(d,{className:w,...b,children:h})};function or(r){return{1:"4xl",2:"3xl",3:"2xl",4:"xl",5:"lg",6:"md"}[r]||"md"}const cr=({items:r,type:s="unordered",variant:t="default",size:a="md",interactive:l=!1,className:o,itemClassName:g})=>{const h=x("space-y-1",{"":t==="default","space-y-0":t==="flush","border border-neutral-200 dark:border-neutral-700 rounded-lg overflow-hidden":t==="bordered","divide-y divide-neutral-200 dark:divide-neutral-700":t==="divided"},{"text-sm":a==="sm","text-base":a==="md","text-lg":a==="lg"},o),b=(d,i)=>x("transition-colors duration-200",{"py-1 px-2":a==="sm"&&(t==="bordered"||t==="divided"),"py-2 px-3":a==="md"&&(t==="bordered"||t==="divided"),"py-3 px-4":a==="lg"&&(t==="bordered"||t==="divided")},l&&!d.disabled&&{"cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800":!0,"focus:outline-none focus:bg-neutral-100 dark:focus:bg-neutral-700":!0},d.disabled&&{"opacity-50 cursor-not-allowed":!0},g),c=d=>{l&&!d.disabled&&d.onClick&&d.onClick()},w=(d,i)=>{var k;l&&!i.disabled&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),(k=i.onClick)==null||k.call(i))};return s==="ordered"?e.jsx("ol",{className:h,children:r.map((d,i)=>e.jsx("li",{className:b(d),onClick:()=>c(d),onKeyDown:k=>w(k,d),tabIndex:l&&!d.disabled?0:void 0,role:l?"button":void 0,children:d.content},d.id||i))}):s==="description"?e.jsx("dl",{className:h,children:r.map((d,i)=>e.jsx("div",{className:b(d),onClick:()=>c(d),onKeyDown:k=>w(k,d),tabIndex:l&&!d.disabled?0:void 0,role:l?"button":void 0,children:d.content},d.id||i))}):e.jsx("ul",{className:h,children:r.map((d,i)=>e.jsx("li",{className:b(d),onClick:()=>c(d),onKeyDown:k=>w(k,d),tabIndex:l&&!d.disabled?0:void 0,role:l?"button":void 0,children:d.content},d.id||i))})},ir=({commands:r,isOpen:s,onClose:t,labels:a})=>{var k;const[l,o]=m.useState(""),[g,h]=m.useState([]),[b,c]=m.useState(0),w=m.useRef(null),i=(g.length?((k=r.find(p=>p.id===g[0]))==null?void 0:k.subCommands)||[]:r).filter(p=>p.label.toLowerCase().includes(l.toLowerCase()));return m.useEffect(()=>{s||(o(""),h([]),c(0))},[s]),m.useEffect(()=>{const p=C=>{if(s){if(C.key==="Escape")t();else if(C.key==="ArrowUp")c(M=>M>0?M-1:i.length-1);else if(C.key==="ArrowDown")c(M=>M<i.length-1?M+1:0);else if(C.key==="Enter"){const M=i[b];M&&(M.subCommands?(h([...g,M.id]),c(0)):M.action&&(M.action(),t()))}}};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s,t,i,b,g]),m.useEffect(()=>{const p=C=>{w.current&&!w.current.contains(C.target)&&t()};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s,t]),s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center shadow-lvl-0",children:e.jsxs("div",{className:"flex flex-col w-full max-w-lg p-2 mx-auto rounded-lg shadow-lg bg-white",ref:w,children:[e.jsx("input",{type:"text",placeholder:(a==null?void 0:a.searchPlaceholder)||"Search commands...",value:l,onChange:p=>o(p.target.value),className:"w-full px-4 py-2 text-gray-800 border-none border-b border-gray-200 focus:outline-none focus:ring-0 rounded-lg bg-transparent"}),e.jsxs("div",{className:"mt-2 pt-2 text-sm border-t border-gray-200",children:[i.length===0&&e.jsx("div",{className:"text-gray-500 text-center text-sm",children:(a==null?void 0:a.noCommandsFound)||"No commands found"}),i.map((p,C)=>e.jsxs("div",{className:`flex items-center p-2 cursor-pointer rounded-md text-secondary-800 ${C===b?"bg-gray-100":""}`,onClick:()=>{p.subCommands?(h([...g,p.id]),c(0)):p.action&&(p.action(),t())},onMouseEnter:()=>c(C),children:[p.icon&&e.jsx("span",{className:"mr-3",children:p.icon}),e.jsx("span",{className:"flex-grow",children:p.label}),p.subCommands&&e.jsx("span",{className:"text-gray-400",children:e.jsx(ie.ChevronRight,{className:"w-4 h-4"})})]},p.id))]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 mt-2 text-xs text-gray-500 border-t border-gray-200",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-bold",children:"↑↓"})," ",(a==null?void 0:a.navigate)||"to navigate"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-bold",children:"↵"})," ",(a==null?void 0:a.select)||"to select"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-bold",children:"Esc"})," ",(a==null?void 0:a.close)||"to close"]})]})]})}):null},ur={none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-12"},fr={none:"m-0",xs:"m-1",sm:"m-2",md:"m-4",lg:"m-6",xl:"m-8","2xl":"m-12"},hr={none:"",primary:"bg-primary",secondary:"bg-secondary",accent:"bg-accent",success:"bg-success",warning:"bg-warning",error:"bg-error",info:"bg-info",neutral:"bg-neutral",white:"bg-white",module:"bg-module"},xr={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},br={none:"shadow-none",sm:"shadow-sm shadow-lvl-0",md:"shadow-md shadow-lvl-0",lg:"shadow-lg shadow-lvl-0",xl:"shadow-xl shadow-lvl-0","2xl":"shadow-2xl shadow-lvl-0"},gr={none:"border-0",sm:"border",md:"border-2",lg:"border-4"},pr={primary:"border-primary",secondary:"border-secondary",accent:"border-accent",success:"border-success",warning:"border-warning",error:"border-error",info:"border-info",neutral:"border-neutral",white:"border-white"},fe=m.forwardRef(({padding:r,margin:s,background:t,radius:a,shadow:l,border:o,borderColor:g,className:h,children:b,...c},w)=>e.jsx("div",{ref:w,className:x(r&&ur[r],s&&fr[s],t&&hr[t],a&&xr[a],l&&br[l],o&&gr[o],g&&pr[g],h),...c,children:b}));fe.displayName="Box";const yr=({children:r,title:s,...t})=>e.jsxs(fe,{background:"module",radius:"xl",shadow:"sm",...t,children:[s&&e.jsx("span",{className:"text-base font-medium text-gray-800 mb-2",children:s}),r]});D.Badge=Ve,D.Box=fe,D.Button=X,D.ButtonGroup=Ne,D.Card=yr,D.Checkbox=ne,D.CommandPalette=ir,D.ContentLoading=xe,D.DatePicker=de,D.Dropdown=he,D.Form=$e,D.Heading=dr,D.Icon=Je,D.Image=Ge,D.Link=we,D.List=cr,D.Modal=Be,D.PageHeader=Ue,D.Select=oe,D.SidebarMenu=tr,D.Spinner=Oe,D.TabBar=lr,D.Table=ar,D.Tabs=nr,D.Text=ee,D.TextArea=ce,D.TextField=le,D.cn=x,D.createSizes=ye,D.createVariants=pe,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=index.umd.cjs.map