blunt-ui 0.3.3 → 0.3.5

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 (4) hide show
  1. package/README.md +249 -125
  2. package/dist/index.cjs +32 -29
  3. package/dist/index.js +368 -360
  4. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("styled-components"),l=require("react"),bo=require("react-dom"),B=(o,r,n)=>s.css`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("styled-components"),a=require("react"),bo=require("react-dom"),B=(o,r,n)=>s.css`
2
2
  background: ${r};
3
3
  color: ${n};
4
4
  border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
@@ -107,7 +107,7 @@
107
107
  padding: ${r.spacing[3]} ${r.spacing[6]};
108
108
  font-size: ${r.fontSizes.lg};
109
109
  `})[o]}
110
- `;function H({ref:o,as:r,href:n,variant:e="primary",size:a="md",isLoading:i,disabled:c,children:d,...f}){const $=r??(n?"a":"button");return t.jsx(No,{ref:o,as:$,href:n,$variant:e,$size:a,disabled:i||c,...f,children:i?"Loading...":d})}H.displayName="Button";const Fo=s.div`
110
+ `;function H({ref:o,as:r,href:n,variant:e="primary",size:l="md",isLoading:i,disabled:c,children:d,...p}){const b=r??(n?"a":"button");return t.jsx(No,{ref:o,as:b,href:n,$variant:e,$size:l,disabled:i||c,...p,children:i?"Loading...":d})}H.displayName="Button";const Fo=s.div`
111
111
  display: flex;
112
112
  flex-direction: column;
113
113
  gap: ${({theme:o})=>o.spacing[1]};
@@ -175,7 +175,7 @@
175
175
  display: inline-flex;
176
176
  align-items: center;
177
177
  margin: 0 ${({theme:o})=>o.spacing[1]};
178
- `,Ao=s.button`
178
+ `,Ro=s.button`
179
179
  display: inline-flex;
180
180
  align-items: center;
181
181
  margin: 0 ${({theme:o})=>o.spacing[1]};
@@ -188,7 +188,7 @@
188
188
  &:hover {
189
189
  opacity: 0.8;
190
190
  }
191
- `;function xo({ref:o,type:r="text",size:n="md",variant:e="default",label:a,helperText:i,error:c,leftElement:d,rightElement:f,clearable:$,onClear:b,fullWidth:y,id:g,value:p,defaultValue:x,onChange:m,...S}){const C=l.useId(),j=g??C,z=`${j}-hint`,[k,w]=l.useState(x??""),v=p!==void 0,T=v?p:k,I=typeof c=="string"?c:void 0,W=!!(i||c),M=D=>{v||w(D.target.value),m?.(D)},V=()=>{v||w(""),b?.()};return t.jsxs(Fo,{$fullWidth:y,children:[a&&t.jsx(Lo,{htmlFor:j,children:a}),t.jsxs(Vo,{$size:n,$variant:e,$error:!!c,children:[d&&t.jsx(to,{children:d}),t.jsx(_o,{id:j,ref:o,type:r,value:T,onChange:M,...S,"aria-invalid":!!c,"aria-describedby":W?z:void 0}),$&&T&&t.jsx(Ao,{type:"button",onClick:V,"aria-label":"Clear input",children:"✕"}),f&&t.jsx(to,{children:f})]}),W&&t.jsx(Bo,{id:z,$error:!!c,children:I??i})]})}xo.displayName="Input";const Ro=s.div`
191
+ `;function xo({ref:o,type:r="text",size:n="md",variant:e="default",label:l,helperText:i,error:c,leftElement:d,rightElement:p,clearable:b,onClear:g,fullWidth:h,id:y,value:f,defaultValue:x,onChange:v,...k}){const T=a.useId(),$=y??T,C=`${$}-hint`,[S,j]=a.useState(x??""),w=f!==void 0,z=w?f:S,I=typeof c=="string"?c:void 0,M=!!(i||c),D=E=>{w||j(E.target.value),v?.(E)},V=()=>{w||j(""),g?.()};return t.jsxs(Fo,{$fullWidth:h,children:[l&&t.jsx(Lo,{htmlFor:$,children:l}),t.jsxs(Vo,{$size:n,$variant:e,$error:!!c,children:[d&&t.jsx(to,{children:d}),t.jsx(_o,{id:$,ref:o,type:r,value:z,onChange:D,...k,"aria-invalid":!!c,"aria-describedby":M?C:void 0}),b&&z&&t.jsx(Ro,{type:"button",onClick:V,"aria-label":"Clear input",children:"✕"}),p&&t.jsx(to,{children:p})]}),M&&t.jsx(Bo,{id:C,$error:!!c,children:I??i})]})}xo.displayName="Input";const Ao=s.div`
192
192
  display: flex;
193
193
  flex-direction: column;
194
194
  gap: ${({theme:o})=>o.spacing[1]};
@@ -253,7 +253,7 @@
253
253
  cursor: not-allowed;
254
254
  opacity: 0.6;
255
255
  }
256
- `;function yo({ref:o,size:r="md",variant:n="default",label:e,helperText:a,error:i,fullWidth:c,id:d,value:f,defaultValue:$,onChange:b,...y}){const g=l.useId(),p=d??g,x=`${p}-hint`,[m,S]=l.useState($??""),C=f!==void 0,j=C?f:m,z=typeof i=="string"?i:void 0,k=!!(a||i),w=v=>{C||S(v.target.value),b?.(v)};return t.jsxs(Ro,{$fullWidth:c,children:[e&&t.jsx(Yo,{htmlFor:p,children:e}),t.jsx(qo,{$size:r,$variant:n,$error:!!i,children:t.jsx(Uo,{id:p,ref:o,value:j,onChange:w,...y,"aria-invalid":!!i,"aria-describedby":k?x:void 0})}),k&&t.jsx(Ho,{id:x,$error:!!i,children:z??a})]})}yo.displayName="Textarea";const ho=(...o)=>o.filter((r,n,e)=>!!r&&r.trim()!==""&&e.indexOf(r)===n).join(" ").trim();const Ko=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Go=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,e)=>e?e.toUpperCase():n.toLowerCase());const eo=o=>{const r=Go(o);return r.charAt(0).toUpperCase()+r.slice(1)};var X={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Jo=o=>{for(const r in o)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},Xo=l.createContext({}),Zo=()=>l.useContext(Xo),Qo=l.forwardRef(({color:o,size:r,strokeWidth:n,absoluteStrokeWidth:e,className:a="",children:i,iconNode:c,...d},f)=>{const{size:$=24,strokeWidth:b=2,absoluteStrokeWidth:y=!1,color:g="currentColor",className:p=""}=Zo()??{},x=e??y?Number(n??b)*24/Number(r??$):n??b;return l.createElement("svg",{ref:f,...X,width:r??$??X.width,height:r??$??X.height,stroke:o??g,strokeWidth:x,className:ho("lucide",p,a),...!i&&!Jo(d)&&{"aria-hidden":"true"},...d},[...c.map(([m,S])=>l.createElement(m,S)),...Array.isArray(i)?i:[i]])});const N=(o,r)=>{const n=l.forwardRef(({className:e,...a},i)=>l.createElement(Qo,{ref:i,iconNode:r,className:ho(`lucide-${Ko(eo(o))}`,`lucide-${o}`,e),...a}));return n.displayName=eo(o),n};const or=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rr=N("arrow-down",or);const sr=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],nr=N("arrow-up-down",sr);const tr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],er=N("arrow-up",tr);const ir=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ar=N("calendar",ir);const lr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],mo=N("chevron-down",lr);const cr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],dr=N("chevron-left",cr);const ur=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pr=N("chevron-right",ur);const fr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Q=N("x",fr),$r=s.div`
256
+ `;function yo({ref:o,size:r="md",variant:n="default",label:e,helperText:l,error:i,fullWidth:c,id:d,value:p,defaultValue:b,onChange:g,...h}){const y=a.useId(),f=d??y,x=`${f}-hint`,[v,k]=a.useState(b??""),T=p!==void 0,$=T?p:v,C=typeof i=="string"?i:void 0,S=!!(l||i),j=w=>{T||k(w.target.value),g?.(w)};return t.jsxs(Ao,{$fullWidth:c,children:[e&&t.jsx(Yo,{htmlFor:f,children:e}),t.jsx(qo,{$size:r,$variant:n,$error:!!i,children:t.jsx(Uo,{id:f,ref:o,value:$,onChange:j,...h,"aria-invalid":!!i,"aria-describedby":S?x:void 0})}),S&&t.jsx(Ho,{id:x,$error:!!i,children:C??l})]})}yo.displayName="Textarea";const ho=(...o)=>o.filter((r,n,e)=>!!r&&r.trim()!==""&&e.indexOf(r)===n).join(" ").trim();const Ko=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Go=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,e)=>e?e.toUpperCase():n.toLowerCase());const eo=o=>{const r=Go(o);return r.charAt(0).toUpperCase()+r.slice(1)};var X={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Jo=o=>{for(const r in o)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},Xo=a.createContext({}),Zo=()=>a.useContext(Xo),Qo=a.forwardRef(({color:o,size:r,strokeWidth:n,absoluteStrokeWidth:e,className:l="",children:i,iconNode:c,...d},p)=>{const{size:b=24,strokeWidth:g=2,absoluteStrokeWidth:h=!1,color:y="currentColor",className:f=""}=Zo()??{},x=e??h?Number(n??g)*24/Number(r??b):n??g;return a.createElement("svg",{ref:p,...X,width:r??b??X.width,height:r??b??X.height,stroke:o??y,strokeWidth:x,className:ho("lucide",f,l),...!i&&!Jo(d)&&{"aria-hidden":"true"},...d},[...c.map(([v,k])=>a.createElement(v,k)),...Array.isArray(i)?i:[i]])});const N=(o,r)=>{const n=a.forwardRef(({className:e,...l},i)=>a.createElement(Qo,{ref:i,iconNode:r,className:ho(`lucide-${Ko(eo(o))}`,`lucide-${o}`,e),...l}));return n.displayName=eo(o),n};const or=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rr=N("arrow-down",or);const sr=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],nr=N("arrow-up-down",sr);const tr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],er=N("arrow-up",tr);const ir=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ar=N("calendar",ir);const lr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],wo=N("chevron-down",lr);const cr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],dr=N("chevron-left",cr);const ur=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pr=N("chevron-right",ur);const fr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Q=N("x",fr),$r=s.div`
257
257
  display: inline-flex;
258
258
  flex-direction: column;
259
259
  gap: ${({theme:o})=>o.spacing[1]};
@@ -346,9 +346,9 @@
346
346
  display: flex;
347
347
  align-items: center;
348
348
  color: ${({theme:o})=>o.colors.neutral[500]};
349
- `;function wo({options:o,placeholder:r,size:n="md",variant:e="default",error:a,fullWidth:i,clearable:c,onClear:d,id:f,value:$,defaultValue:b,onChange:y,...g}){const p=l.useId(),x=f??p,m=`${x}-hint`,S=typeof a=="string"?a:void 0,[C,j]=l.useState(b??""),z=$!==void 0,k=z?$:C,w=I=>{z||j(I.target.value),y?.(I)},v=()=>{z||j(""),d?.()},T=c&&!!k;return t.jsxs($r,{$fullWidth:i,children:[t.jsxs(br,{children:[t.jsxs(xr,{id:x,$size:n,$variant:e,$error:!!a,"aria-invalid":!!a,"aria-describedby":S?m:void 0,value:k,onChange:w,...g,children:[r&&t.jsx("option",{value:"",disabled:!0,children:r}),o.map(I=>t.jsx("option",{value:I.value,disabled:I.disabled,children:I.label},I.value))]}),T?t.jsx(yr,{type:"button",onClick:v,"aria-label":"Clear selection",children:t.jsx(Q,{size:14})}):t.jsx(hr,{"aria-hidden":"true",children:t.jsx(mo,{size:14})})]}),S&&t.jsx(gr,{id:m,$error:!0,children:S})]})}wo.displayName="Select";const io=s.span`
349
+ `;function mo({options:o,placeholder:r,size:n="md",variant:e="default",error:l,fullWidth:i,clearable:c,onClear:d,id:p,value:b,defaultValue:g,onChange:h,...y}){const f=a.useId(),x=p??f,v=`${x}-hint`,k=typeof l=="string"?l:void 0,[T,$]=a.useState(g??""),C=b!==void 0,S=C?b:T,j=I=>{C||$(I.target.value),h?.(I)},w=()=>{C||$(""),d?.()},z=c&&!!S;return t.jsxs($r,{$fullWidth:i,children:[t.jsxs(br,{children:[t.jsxs(xr,{id:x,$size:n,$variant:e,$error:!!l,"aria-invalid":!!l,"aria-describedby":k?v:void 0,value:S,onChange:j,...y,children:[r&&t.jsx("option",{value:"",disabled:!0,children:r}),o.map(I=>t.jsx("option",{value:I.value,disabled:I.disabled,children:I.label},I.value))]}),z?t.jsx(yr,{type:"button",onClick:w,"aria-label":"Clear selection",children:t.jsx(Q,{size:14})}):t.jsx(hr,{"aria-hidden":"true",children:t.jsx(wo,{size:14})})]}),k&&t.jsx(gr,{id:v,$error:!0,children:k})]})}mo.displayName="Select";const io=s.span`
350
350
  display: inline-block;
351
- `,mr=s.span`
351
+ `,wr=s.span`
352
352
  display: inline-block;
353
353
  min-width: 60px;
354
354
  padding: ${({theme:o})=>`${o.spacing[1]} ${o.spacing[2]}`};
@@ -365,6 +365,9 @@
365
365
  opacity: 0.5;
366
366
  `:s.css`
367
367
  cursor: text;
368
+ transition:
369
+ border-color 0.15s ease,
370
+ box-shadow 0.15s ease;
368
371
 
369
372
  &:hover {
370
373
  ${r.brutalism?s.css`
@@ -383,7 +386,7 @@
383
386
  box-shadow: ${r.shadows.focusRing};
384
387
  }
385
388
  `}
386
- `,wr=s.input`
389
+ `,mr=s.input`
387
390
  display: inline-block;
388
391
  min-width: 60px;
389
392
  padding: ${({theme:o})=>`${o.spacing[1]} ${o.spacing[2]}`};
@@ -402,7 +405,7 @@
402
405
  border: 1px solid ${o.colors.primary[500]};
403
406
  box-shadow: ${o.shadows.focusRing};
404
407
  `}
405
- `;function vo({value:o,defaultValue:r="",onChange:n,onSubmit:e,onCancel:a,placeholder:i="Click to edit",disabled:c=!1}){const d=o!==void 0,[f,$]=l.useState(r),b=d?o:f,[y,g]=l.useState(!1),[p,x]=l.useState(""),m=l.useRef(null),S=()=>{c||(x(b),g(!0),setTimeout(()=>{m.current?.focus(),m.current?.select()},0))},C=()=>{d||$(p),n?.(p),e?.(p),g(!1)},j=()=>{a?.(b),g(!1)},z=k=>{k.key==="Enter"?C():k.key==="Escape"&&j()};return y?t.jsx(io,{children:t.jsx(wr,{ref:m,value:p,size:Math.max(p.length,i.length,10),onChange:k=>x(k.target.value),onBlur:C,onKeyDown:z,"aria-label":"Edit value"})}):t.jsx(io,{children:t.jsx(mr,{role:c?void 0:"button",tabIndex:c?void 0:0,$disabled:c,$empty:!b,onClick:S,onKeyDown:k=>k.key==="Enter"&&S(),children:b||i})})}vo.displayName="Editable";const vr=s.a`
408
+ `;function vo({value:o,defaultValue:r="",onChange:n,onSubmit:e,onCancel:l,placeholder:i="Click to edit",disabled:c=!1}){const d=o!==void 0,[p,b]=a.useState(r),g=d?o:p,[h,y]=a.useState(!1),[f,x]=a.useState(""),v=a.useRef(null),k=()=>{c||(x(g),y(!0),setTimeout(()=>{v.current?.focus(),v.current?.select()},0))},T=()=>{d||b(f),n?.(f),e?.(f),y(!1)},$=()=>{l?.(g),y(!1)},C=S=>{S.key==="Enter"?T():S.key==="Escape"&&$()};return h?t.jsx(io,{children:t.jsx(mr,{ref:v,value:f,size:Math.max(f.length,i.length,10),onChange:S=>x(S.target.value),onBlur:T,onKeyDown:C,"aria-label":"Edit value"})}):t.jsx(io,{children:t.jsx(wr,{role:c?void 0:"button",tabIndex:c?void 0:0,$disabled:c,$empty:!g,onClick:k,onKeyDown:S=>S.key==="Enter"&&k(),children:g||i})})}vo.displayName="Editable";const vr=s.a`
406
409
  text-decoration: underline;
407
410
  text-underline-offset: 2px;
408
411
  transition: color 0.15s;
@@ -533,7 +536,7 @@
533
536
  padding: ${({theme:o})=>o.spacing[4]};
534
537
  border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
535
538
  flex-shrink: 0;
536
- `,Fr=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");function ao(o){return Array.from(o.querySelectorAll(Fr))}function ro({open:o,onClose:r,title:n,children:e,footer:a,size:i="md",closeOnBackdrop:c=!0,closeOnEscape:d=!0,ariaLabelledBy:f,ariaDescribedBy:$}){const b=l.useRef(null),y=l.useId(),g=f??(n?y:void 0),[p,x]=l.useState(o),[m,S]=l.useState(!1);return l.useEffect(()=>{if(o)x(!0),S(!1);else if(p){S(!0);const C=setTimeout(()=>{x(!1),S(!1)},150);return()=>clearTimeout(C)}},[o,p]),l.useEffect(()=>{if(!o)return;const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C}},[o]),l.useEffect(()=>{if(!o||!b.current)return;const C=b.current,j=document.activeElement;(ao(C)[0]??C).focus();const k=w=>{if(w.key==="Escape"&&d){r();return}if(w.key!=="Tab")return;const v=ao(C);if(v.length===0){w.preventDefault();return}const T=v[0],I=v[v.length-1];w.shiftKey?document.activeElement===T&&(w.preventDefault(),I.focus()):document.activeElement===I&&(w.preventDefault(),T.focus())};return document.addEventListener("keydown",k),()=>{document.removeEventListener("keydown",k),j?.focus()}},[o,d,r,p]),p?bo.createPortal(t.jsx(Mr,{$closing:m,onClick:c?r:void 0,children:t.jsxs(Dr,{ref:b,role:"dialog","aria-modal":"true","aria-labelledby":g,"aria-describedby":$,$size:i,$closing:m,tabIndex:-1,onClick:C=>C.stopPropagation(),children:[t.jsxs(Er,{children:[n&&t.jsx(Pr,{id:y,children:n}),t.jsx(Wr,{onClick:r,"aria-label":"Close modal",children:"×"})]}),t.jsx(Or,{children:e}),a&&t.jsx(Nr,{children:a})]})}),document.body):null}ro.displayName="Modal";const Lr=s.keyframes`
539
+ `,Fr=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");function ao(o){return Array.from(o.querySelectorAll(Fr))}function ro({open:o,onClose:r,title:n,children:e,footer:l,size:i="md",closeOnBackdrop:c=!0,closeOnEscape:d=!0,ariaLabelledBy:p,ariaDescribedBy:b}){const g=a.useRef(null),h=a.useRef(null),y=a.useId(),f=p??(n?y:void 0),[x,v]=a.useState(o),[k,T]=a.useState(!1);return a.useEffect(()=>{if(o)v(!0),T(!1);else if(x){T(!0);const $=setTimeout(()=>{v(!1),T(!1)},150);return()=>clearTimeout($)}},[o,x]),a.useEffect(()=>{if(!o)return;const $=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=$}},[o]),a.useEffect(()=>{if(!o||!g.current)return;const $=g.current,C=document.activeElement;(ao($)[0]??$).focus();const j=w=>{if(w.key==="Escape"&&d){r();return}if(w.key!=="Tab")return;const z=ao($);if(z.length===0){w.preventDefault();return}const I=z[0],M=z[z.length-1];w.shiftKey?document.activeElement===I&&(w.preventDefault(),M.focus()):document.activeElement===M&&(w.preventDefault(),I.focus())};return document.addEventListener("keydown",j),()=>{document.removeEventListener("keydown",j),C?.focus()}},[o,d,r,x]),x?bo.createPortal(t.jsx(Mr,{$closing:k,onMouseDown:$=>{h.current=$.target},onClick:$=>{c&&h.current===$.currentTarget&&r()},children:t.jsxs(Dr,{ref:g,role:"dialog","aria-modal":"true","aria-labelledby":f,"aria-describedby":b,$size:i,$closing:k,tabIndex:-1,onClick:$=>$.stopPropagation(),children:[t.jsxs(Er,{children:[n&&t.jsx(Pr,{id:y,children:n}),t.jsx(Wr,{onClick:r,"aria-label":"Close modal",children:"×"})]}),t.jsx(Or,{children:e}),l&&t.jsx(Nr,{children:l})]})}),document.body):null}ro.displayName="Modal";const Lr=s.keyframes`
537
540
  from { opacity: 0; transform: translateY(12px); }
538
541
  to { opacity: 1; transform: translateY(0); }
539
542
  `,Br=s.keyframes`
@@ -573,13 +576,13 @@
573
576
  top: ${r.spacing[6]};
574
577
  left: ${r.spacing[6]};
575
578
  `})[o]}
576
- `,R=(o,r,n)=>s.css`
579
+ `,A=(o,r,n)=>s.css`
577
580
  background: ${r};
578
581
  border: ${o.brutalism.borderWidth} solid ${n};
579
582
  box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
580
583
  0 ${n};
581
- `,Ar=s(_r)`
582
- ${({$variant:o,theme:r})=>r.brutalism?{success:R(r,r.colors.success[50],r.colors.success[500]),error:R(r,r.colors.error[50],r.colors.error[500]),warning:R(r,r.colors.warning[50],r.colors.warning[500]),info:R(r,r.colors.info[50],r.colors.info[500])}[o]:{success:s.css`
584
+ `,Rr=s(_r)`
585
+ ${({$variant:o,theme:r})=>r.brutalism?{success:A(r,r.colors.success[50],r.colors.success[500]),error:A(r,r.colors.error[50],r.colors.error[500]),warning:A(r,r.colors.warning[50],r.colors.warning[500]),info:A(r,r.colors.info[50],r.colors.info[500])}[o]:{success:s.css`
583
586
  background: ${r.colors.success[50]};
584
587
  border-left: 4px solid ${r.colors.success[500]};
585
588
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
@@ -596,7 +599,7 @@
596
599
  border-left: 4px solid ${r.colors.info[500]};
597
600
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
598
601
  `}[o]}
599
- `,Rr=s.p`
602
+ `,Ar=s.p`
600
603
  flex: 1;
601
604
  margin: 0;
602
605
  font-size: ${({theme:o})=>o.fontSizes.sm};
@@ -625,7 +628,7 @@
625
628
  outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
626
629
  outline-offset: 2px;
627
630
  }
628
- `;function so({open:o,onClose:r,message:n,variant:e="info",duration:a=4e3,position:i="bottom-right"}){const[c,d]=l.useState(o),[f,$]=l.useState(!1);return l.useEffect(()=>{if(o)d(!0),$(!1);else if(c){$(!0);const b=setTimeout(()=>{d(!1),$(!1)},200);return()=>{clearTimeout(b)}}},[o,c]),l.useEffect(()=>{if(!o||a===0)return;const b=setTimeout(r,a);return()=>{clearTimeout(b)}},[o,a,r]),c?bo.createPortal(t.jsxs(Ar,{$position:i,$variant:e,$closing:f,role:"alert","aria-live":"polite",children:[t.jsx(Rr,{children:n}),t.jsx(Yr,{onClick:r,"aria-label":"Close notification",children:t.jsx(Q,{size:14,strokeWidth:2.5})})]}),document.body):null}so.displayName="Toast";const So=l.createContext(null);function Hr({children:o}){const[r,n]=l.useState(null),e=l.useCallback(i=>{n({...i,id:Date.now()})},[]),a=l.useMemo(()=>Object.assign(i=>e(i),{success:(i,c)=>e({...c,message:i,variant:"success"}),error:(i,c)=>e({...c,message:i,variant:"error"}),warning:(i,c)=>e({...c,message:i,variant:"warning"}),info:(i,c)=>e({...c,message:i,variant:"info"})}),[e]);return t.jsxs(So.Provider,{value:{toast:a},children:[o,r&&t.jsx(so,{open:!0,onClose:()=>n(null),message:r.message,variant:r.variant,duration:r.duration,position:r.position},r.id)]})}function qr(){const o=l.useContext(So);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}const Ur=s.form`
631
+ `;function so({open:o,onClose:r,message:n,variant:e="info",duration:l=4e3,position:i="bottom-right"}){const[c,d]=a.useState(o),[p,b]=a.useState(!1);return a.useEffect(()=>{if(o)d(!0),b(!1);else if(c){b(!0);const g=setTimeout(()=>{d(!1),b(!1)},200);return()=>{clearTimeout(g)}}},[o,c]),a.useEffect(()=>{if(!o||l===0)return;const g=setTimeout(r,l);return()=>{clearTimeout(g)}},[o,l,r]),c?bo.createPortal(t.jsxs(Rr,{$position:i,$variant:e,$closing:p,role:"alert","aria-live":"polite",children:[t.jsx(Ar,{children:n}),t.jsx(Yr,{onClick:r,"aria-label":"Close notification",children:t.jsx(Q,{size:14,strokeWidth:2.5})})]}),document.body):null}so.displayName="Toast";const So=a.createContext(null);function Hr({children:o}){const[r,n]=a.useState(null),e=a.useCallback(i=>{n({...i,id:Date.now()})},[]),l=a.useMemo(()=>Object.assign(i=>e(i),{success:(i,c)=>e({...c,message:i,variant:"success"}),error:(i,c)=>e({...c,message:i,variant:"error"}),warning:(i,c)=>e({...c,message:i,variant:"warning"}),info:(i,c)=>e({...c,message:i,variant:"info"})}),[e]);return t.jsxs(So.Provider,{value:{toast:l},children:[o,r&&t.jsx(so,{open:!0,onClose:()=>n(null),message:r.message,variant:r.variant,duration:r.duration,position:r.position},r.id)]})}function qr(){const o=a.useContext(So);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}const Ur=s.form`
629
632
  display: flex;
630
633
  flex-direction: column;
631
634
  gap: ${({theme:o})=>o.spacing[4]};
@@ -643,7 +646,7 @@
643
646
  `,Xr=s.span`
644
647
  font-size: ${({theme:o})=>o.fontSizes.xs};
645
648
  color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
646
- `;function jo({onSubmit:o,children:r,...n}){return t.jsx(Ur,{onSubmit:e=>{e.preventDefault(),o?.(e)},noValidate:!0,...n,children:r})}jo.displayName="Form";function Co({label:o,error:r,helperText:n,required:e,children:a}){const i=l.useId(),c=`${i}-hint`,d=!!(r||n),f=typeof r=="string"?r:void 0,$=l.isValidElement(a)?l.cloneElement(a,{id:i,...d&&{"aria-describedby":c},...r&&{"aria-invalid":!0}}):a;return t.jsxs(Kr,{children:[o&&t.jsxs(Gr,{htmlFor:i,children:[o,e&&t.jsx(Jr,{"aria-hidden":"true",children:" *"})]}),$,d&&t.jsx(Xr,{id:c,$error:!!r,children:f??n})]})}Co.displayName="FormField";function Zr({initialValues:o,validate:r,onSubmit:n,onError:e}){const[a,i]=l.useState(o),[c,d]=l.useState({}),[f,$]=l.useState({}),[b,y]=l.useState(!1),g=l.useRef(a);g.current=a;const p=l.useCallback(w=>{if(!r)return{};const v=r(w);return Object.fromEntries(Object.entries(v).filter(([,T])=>T!==void 0))},[r]),x=l.useRef(f);x.current=f;const m=l.useCallback(w=>{const{name:v,value:T}=w.target;process.env.NODE_ENV!=="production"&&!v&&console.warn("[useForm] handleChange: field is missing a `name` attribute — value will not be tracked.");const I={...g.current,[v]:T};i(I),x.current[v]&&d(p(I))},[p]),S=l.useCallback(w=>{const{name:v}=w.target;process.env.NODE_ENV!=="production"&&!v&&console.warn("[useForm] handleBlur: field is missing a `name` attribute — touched state will not be tracked."),$(T=>({...T,[v]:!0})),d(p(g.current))},[p]),C=l.useCallback(w=>{w?.preventDefault();const v=Object.keys(g.current).reduce((W,M)=>({...W,[M]:!0}),{});$(v);const T=p(g.current);if(d(T),Object.keys(T).length>0){e?.(T);return}(async()=>{y(!0);try{await n?.(g.current)}finally{y(!1)}})()},[p,n,e]),j=l.useCallback((w,v)=>{i(T=>({...T,[w]:v}))},[]),z=l.useCallback(w=>{i(w??o),d({}),$({}),y(!1)},[o]),k=Object.fromEntries(Object.entries(c).filter(([w])=>f[w]));return{values:a,errors:k,touched:f,handleChange:m,handleBlur:S,handleSubmit:C,setFieldValue:j,reset:z,isSubmitting:b}}const Qr=s.div`
649
+ `;function jo({onSubmit:o,children:r,...n}){return t.jsx(Ur,{onSubmit:e=>{e.preventDefault(),o?.(e)},noValidate:!0,...n,children:r})}jo.displayName="Form";function Co({label:o,error:r,helperText:n,required:e,children:l}){const i=a.useId(),c=`${i}-hint`,d=!!(r||n),p=typeof r=="string"?r:void 0,b=a.isValidElement(l)?a.cloneElement(l,{id:i,...d&&{"aria-describedby":c},...r&&{"aria-invalid":!0}}):l;return t.jsxs(Kr,{children:[o&&t.jsxs(Gr,{htmlFor:i,children:[o,e&&t.jsx(Jr,{"aria-hidden":"true",children:" *"})]}),b,d&&t.jsx(Xr,{id:c,$error:!!r,children:p??n})]})}Co.displayName="FormField";function Zr({initialValues:o,validate:r,onSubmit:n,onError:e}){const[l,i]=a.useState(o),[c,d]=a.useState({}),[p,b]=a.useState({}),[g,h]=a.useState(!1),y=a.useRef(l);y.current=l;const f=a.useCallback(j=>{if(!r)return{};const w=r(j);return Object.fromEntries(Object.entries(w).filter(([,z])=>z!==void 0))},[r]),x=a.useRef(p);x.current=p;const v=a.useCallback(j=>{const{name:w,value:z}=j.target;process.env.NODE_ENV!=="production"&&!w&&console.warn("[useForm] handleChange: field is missing a `name` attribute — value will not be tracked.");const I={...y.current,[w]:z};i(I),x.current[w]&&d(f(I))},[f]),k=a.useCallback(j=>{const{name:w}=j.target;process.env.NODE_ENV!=="production"&&!w&&console.warn("[useForm] handleBlur: field is missing a `name` attribute — touched state will not be tracked."),b(z=>({...z,[w]:!0})),d(f(y.current))},[f]),T=a.useCallback(j=>{j?.preventDefault();const w=Object.keys(y.current).reduce((M,D)=>({...M,[D]:!0}),{});b(w);const z=f(y.current);if(d(z),Object.keys(z).length>0){e?.(z);return}(async()=>{h(!0);try{await n?.(y.current)}finally{h(!1)}})()},[f,n,e]),$=a.useCallback((j,w)=>{i(z=>({...z,[j]:w}))},[]),C=a.useCallback(j=>{i(j??o),d({}),b({}),h(!1)},[o]),S=Object.fromEntries(Object.entries(c).filter(([j])=>p[j]));return{values:l,errors:S,touched:p,handleChange:v,handleBlur:k,handleSubmit:T,setFieldValue:$,reset:C,isSubmitting:g}}const Qr=s.div`
647
650
  border-radius: ${({theme:o})=>o.radius.md};
648
651
  background: ${({theme:o})=>o.colors.neutral[0]};
649
652
  overflow: hidden;
@@ -723,20 +726,20 @@
723
726
  `,cs=s.div`
724
727
  padding: ${({theme:o})=>o.spacing[4]};
725
728
  border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
726
- `;function zo({title:o,children:r,defaultOpen:n=!1,open:e,onToggle:a,subtitle:i,headerActions:c,accentColor:d}){const[f,$]=l.useState(n),b=l.useId(),y=e!==void 0,g=y?e:f,p=()=>{const x=!g;y||$(x),a?.(x)};return t.jsxs(Qr,{$accentColor:d,children:[t.jsxs(os,{type:"button",$open:g,$accentColor:d,"aria-expanded":g,"aria-controls":b,onClick:p,children:[t.jsxs(rs,{children:[t.jsx(ss,{children:o}),(i||c)&&t.jsxs(ts,{children:[i&&t.jsx(ns,{children:i}),c&&t.jsx(es,{onClick:x=>x.stopPropagation(),children:c})]})]}),t.jsx(is,{$open:g,$accentColor:d,"aria-hidden":"true",children:t.jsx(mo,{size:18,strokeWidth:2.5})})]}),t.jsx(as,{$open:g,children:t.jsx(ls,{id:b,role:"region","aria-label":o,children:t.jsx(cs,{children:r})})})]})}zo.displayName="CollapsibleCard";const ds=s.keyframes`
729
+ `;function zo({title:o,children:r,defaultOpen:n=!1,open:e,onToggle:l,subtitle:i,headerActions:c,accentColor:d}){const[p,b]=a.useState(n),g=a.useId(),h=e!==void 0,y=h?e:p,f=()=>{const x=!y;h||b(x),l?.(x)};return t.jsxs(Qr,{$accentColor:d,children:[t.jsxs(os,{type:"button",$open:y,$accentColor:d,"aria-expanded":y,"aria-controls":g,onClick:f,children:[t.jsxs(rs,{children:[t.jsx(ss,{children:o}),(i||c)&&t.jsxs(ts,{children:[i&&t.jsx(ns,{children:i}),c&&t.jsx(es,{onClick:x=>x.stopPropagation(),children:c})]})]}),t.jsx(is,{$open:y,$accentColor:d,"aria-hidden":"true",children:t.jsx(wo,{size:18,strokeWidth:2.5})})]}),t.jsx(as,{$open:y,children:t.jsx(ls,{id:g,role:"region","aria-label":o,children:t.jsx(cs,{children:r})})})]})}zo.displayName="CollapsibleCard";const ds=s.keyframes`
727
730
  to { transform: rotate(360deg); }
728
731
  `,us={sm:"16px",md:"24px",lg:"40px"},ps={thin:"2px",normal:"3px",bold:"5px"},fs=s.span`
729
732
  display: inline-block;
730
733
  border-radius: 50%;
731
734
  animation: ${ds} 0.7s linear infinite;
732
735
 
733
- ${({$size:o="md",$weight:r="normal",$color:n,theme:e})=>{const a=us[o],i=ps[r],c=e.colors.neutral[200],d=n??e.colors.primary[500];return s.css`
734
- width: ${a};
735
- height: ${a};
736
+ ${({$size:o="md",$weight:r="normal",$color:n,theme:e})=>{const l=us[o],i=ps[r],c=e.colors.neutral[200],d=n??e.colors.primary[500];return s.css`
737
+ width: ${l};
738
+ height: ${l};
736
739
  border: ${i} solid ${c};
737
740
  border-top-color: ${d};
738
741
  `}}
739
- `;function To({size:o="md",weight:r="normal",color:n,label:e="Loading..."}){return t.jsx(fs,{$size:o,$weight:r,$color:n,role:"status","aria-label":e})}To.displayName="Spinner";function $s(o,r){return o?.key!==r?{key:r,direction:"asc"}:o.direction==="asc"?{key:r,direction:"desc"}:null}function bs({data:o,sort:r,defaultSort:n,onSortChange:e}){const a=r!==void 0,[i,c]=l.useState(n??null),d=a?r??null:i,f=b=>{const y=$s(d,b);return a||c(y),e?.(y),y},$=l.useMemo(()=>a||!d?o:[...o].sort((b,y)=>{const g=b[d.key],p=y[d.key],x=g<p?-1:g>p?1:0;return d.direction==="asc"?x:-x}),[o,d,a]);return{activeSort:d,sortedData:$,handleSort:f}}const gs=7,lo=3,co=1;function xs(o,r){if(r<=gs)return Array.from({length:r},(e,a)=>a+1);const n=[1];o>lo&&n.push("...");for(let e=Math.max(2,o-co);e<=Math.min(r-1,o+co);e++)n.push(e);return o<r-lo+1&&n.push("..."),n.push(r),n}function ys({data:o,pageSize:r,page:n,defaultPage:e,totalRows:a,onPageChange:i}){const c=n!==void 0,[d,f]=l.useState(e??1),$=c?n:d,b=m=>{c||f(m),i?.(m)},y=c||a!==void 0,g=a??o.length,p=r?Math.max(1,Math.ceil(g/r)):1,x=l.useMemo(()=>{if(!r||y)return o;const m=($-1)*r;return o.slice(m,m+r)},[o,r,$,y]);return{activePage:$,totalPages:p,displayData:x,handlePageChange:b}}const Io=(o,r)=>o==="sm"?`${r.spacing[1]} ${r.spacing[2]}`:o==="lg"?`${r.spacing[3]} ${r.spacing[4]}`:`${r.spacing[2]} ${r.spacing[3]}`,hs=s.div`
742
+ `;function To({size:o="md",weight:r="normal",color:n,label:e="Loading..."}){return t.jsx(fs,{$size:o,$weight:r,$color:n,role:"status","aria-label":e})}To.displayName="Spinner";function $s(o,r){return o?.key!==r?{key:r,direction:"asc"}:o.direction==="asc"?{key:r,direction:"desc"}:null}function bs({data:o,sort:r,defaultSort:n,onSortChange:e}){const l=r!==void 0,[i,c]=a.useState(n??null),d=l?r??null:i,p=g=>{const h=$s(d,g);return l||c(h),e?.(h),h},b=a.useMemo(()=>l||!d?o:[...o].sort((g,h)=>{const y=g[d.key],f=h[d.key],x=y<f?-1:y>f?1:0;return d.direction==="asc"?x:-x}),[o,d,l]);return{activeSort:d,sortedData:b,handleSort:p}}const gs=7,lo=3,co=1;function xs(o,r){if(r<=gs)return Array.from({length:r},(e,l)=>l+1);const n=[1];o>lo&&n.push("...");for(let e=Math.max(2,o-co);e<=Math.min(r-1,o+co);e++)n.push(e);return o<r-lo+1&&n.push("..."),n.push(r),n}function ys({data:o,pageSize:r,page:n,defaultPage:e,totalRows:l,onPageChange:i}){const c=n!==void 0,[d,p]=a.useState(e??1),b=c?n:d,g=v=>{c||p(v),i?.(v)},h=c||l!==void 0,y=l??o.length,f=r?Math.max(1,Math.ceil(y/r)):1,x=a.useMemo(()=>{if(!r||h)return o;const v=(b-1)*r;return o.slice(v,v+r)},[o,r,b,h]);return{activePage:b,totalPages:f,displayData:x,handlePageChange:g}}const Io=(o,r)=>o==="sm"?`${r.spacing[1]} ${r.spacing[2]}`:o==="lg"?`${r.spacing[3]} ${r.spacing[4]}`:`${r.spacing[2]} ${r.spacing[3]}`,hs=s.div`
740
743
  width: 100%;
741
744
 
742
745
  ${({theme:o,$borderColor:r})=>o.brutalism?s.css`
@@ -755,7 +758,7 @@
755
758
  ${({$stickyHeader:o})=>o&&s.css`
756
759
  overflow-y: auto;
757
760
  `}
758
- `,ms=s.table`
761
+ `,ws=s.table`
759
762
  width: 100%;
760
763
  border-collapse: collapse;
761
764
  font-size: ${({$size:o,theme:r})=>({sm:r.fontSizes.sm,md:r.fontSizes.md,lg:r.fontSizes.lg})[o]};
@@ -763,7 +766,7 @@
763
766
  caption {
764
767
  padding: 8px 0;
765
768
  }
766
- `,ws=s.thead`
769
+ `,ms=s.thead`
767
770
  ${({$stickyHeader:o})=>o&&s.css`
768
771
  position: sticky;
769
772
  top: 0;
@@ -956,7 +959,7 @@
956
959
  outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
957
960
  outline-offset: 2px;
958
961
  }
959
- `,Es=4;function Ps(o,r){return o?.key!==r?t.jsx(nr,{size:14}):o.direction==="asc"?t.jsx(er,{size:14}):t.jsx(rr,{size:14})}function Do({columns:o,data:r,rowKey:n,size:e="md",striped:a,bordered:i,stickyHeader:c,caption:d,emptyMessage:f="No data",loading:$,sort:b,defaultSort:y,onSortChange:g,pageSize:p,page:x,defaultPage:m,totalRows:S,onPageChange:C,onChange:j,onRowClick:z,borderColor:k,headerColor:w,rowColor:v,stripeColor:T,className:I,style:W}){const{activeSort:M,sortedData:V,handleSort:D}=bs({data:r,sort:b,defaultSort:y,onSortChange:g}),{activePage:E,totalPages:_,displayData:u,handlePageChange:O}=ys({data:V,pageSize:p,page:x,defaultPage:m,totalRows:S,onPageChange:C}),F=h=>{const P=D(h);j?.({sort:P,page:E})},L=h=>{O(h),j?.({sort:M,page:h})},U=(h,P)=>String(n?h[n]:P),K=!$&&u.length===0,Wo=p??Es;return t.jsxs(hs,{$borderColor:k,$stickyHeader:c,className:I,style:W,children:[t.jsxs(ms,{$size:e,children:[d&&t.jsx("caption",{children:d}),t.jsx(ws,{$headerColor:w,$borderColor:k,$stickyHeader:c,children:t.jsx(Y,{children:o.map(h=>t.jsx(Ss,{$size:e,$bordered:i,scope:"col",style:h.width?{width:h.width}:void 0,children:h.sortable?t.jsxs(js,{type:"button",onClick:()=>F(h.key),"aria-label":`Sort by ${h.header}${M?.key===h.key?`, ${M.direction}ending`:""}`,children:[h.header,t.jsx(Cs,{"aria-hidden":"true",children:Ps(M,h.key)})]}):h.header},h.key))})}),t.jsx(vs,{$striped:a,$rowColor:v,$stripeColor:T,children:$?Array.from({length:Wo}).map((h,P)=>t.jsx(Y,{children:o.map(G=>t.jsx(Is,{$size:e,$bordered:i,$borderColor:k,children:t.jsx(Ms,{})},G.key))},P)):K?t.jsx("tr",{children:t.jsx(zs,{colSpan:o.length,children:f})}):u.map((h,P)=>{const G=z?ks:Y;return t.jsx(G,{onClick:z?()=>z(h):void 0,$accentColor:z?k:void 0,children:o.map(A=>t.jsx(Mo,{$size:e,$bordered:i,$borderColor:k,children:A.render?A.render(h[A.key],h,P):String(h[A.key]??"")||" "},A.key))},U(h,P))})})]}),p&&_>1&&t.jsxs(Ds,{children:[t.jsx(Z,{type:"button",onClick:()=>L(E-1),disabled:E<=1,"aria-label":"Previous page",children:"←"}),xs(E,_).map((h,P)=>h==="..."?t.jsx("span",{"aria-hidden":"true",style:{padding:"0 4px"},children:"…"},`e${P}`):t.jsx(Z,{type:"button",$active:h===E,onClick:()=>L(h),"aria-label":`Page ${h}`,"aria-current":h===E?"page":void 0,children:h},h)),t.jsx(Z,{type:"button",onClick:()=>L(E+1),disabled:E>=_,"aria-label":"Next page",children:"→"})]})]})}Do.displayName="Table";function Ws({defaultSort:o,defaultPage:r=1}={}){const[n,e]=l.useState(o??null),[a,i]=l.useState(r);return{sort:n,page:a,onSortChange:f=>{e(f),i(1)},onPageChange:f=>{i(f)}}}const Os=s.p`
962
+ `,Es=4;function Ps(o,r){return o?.key!==r?t.jsx(nr,{size:14}):o.direction==="asc"?t.jsx(er,{size:14}):t.jsx(rr,{size:14})}function Do({columns:o,data:r,rowKey:n,size:e="md",striped:l,bordered:i,stickyHeader:c,caption:d,emptyMessage:p="No data",loading:b,sort:g,defaultSort:h,onSortChange:y,pageSize:f,page:x,defaultPage:v,totalRows:k,onPageChange:T,onChange:$,onRowClick:C,borderColor:S,headerColor:j,rowColor:w,stripeColor:z,className:I,style:M}){const{activeSort:D,sortedData:V,handleSort:E}=bs({data:r,sort:g,defaultSort:h,onSortChange:y}),{activePage:P,totalPages:_,displayData:u,handlePageChange:O}=ys({data:V,pageSize:f,page:x,defaultPage:v,totalRows:k,onPageChange:T}),F=m=>{const W=E(m);$?.({sort:W,page:P})},L=m=>{O(m),$?.({sort:D,page:m})},U=(m,W)=>String(n?m[n]:W),K=!b&&u.length===0,Wo=f??Es;return t.jsxs(hs,{$borderColor:S,$stickyHeader:c,className:I,style:M,children:[t.jsxs(ws,{$size:e,children:[d&&t.jsx("caption",{children:d}),t.jsx(ms,{$headerColor:j,$borderColor:S,$stickyHeader:c,children:t.jsx(Y,{children:o.map(m=>t.jsx(Ss,{$size:e,$bordered:i,scope:"col",style:m.width?{width:m.width}:void 0,children:m.sortable?t.jsxs(js,{type:"button",onClick:()=>F(m.key),"aria-label":`Sort by ${m.header}${D?.key===m.key?`, ${D.direction}ending`:""}`,children:[m.header,t.jsx(Cs,{"aria-hidden":"true",children:Ps(D,m.key)})]}):m.header},m.key))})}),t.jsx(vs,{$striped:l,$rowColor:w,$stripeColor:z,children:b?Array.from({length:Wo}).map((m,W)=>t.jsx(Y,{children:o.map(G=>t.jsx(Is,{$size:e,$bordered:i,$borderColor:S,children:t.jsx(Ms,{})},G.key))},W)):K?t.jsx("tr",{children:t.jsx(zs,{colSpan:o.length,children:p})}):u.map((m,W)=>{const G=C?ks:Y;return t.jsx(G,{onClick:C?()=>C(m):void 0,$accentColor:C?S:void 0,children:o.map(R=>t.jsx(Mo,{$size:e,$bordered:i,$borderColor:S,children:R.render?R.render(m[R.key],m,W):String(m[R.key]??"")||" "},R.key))},U(m,W))})})]}),f&&_>1&&t.jsxs(Ds,{children:[t.jsx(Z,{type:"button",onClick:()=>L(P-1),disabled:P<=1,"aria-label":"Previous page",children:"←"}),xs(P,_).map((m,W)=>m==="..."?t.jsx("span",{"aria-hidden":"true",style:{padding:"0 4px"},children:"…"},`e${W}`):t.jsx(Z,{type:"button",$active:m===P,onClick:()=>L(m),"aria-label":`Page ${m}`,"aria-current":m===P?"page":void 0,children:m},m)),t.jsx(Z,{type:"button",onClick:()=>L(P+1),disabled:P>=_,"aria-label":"Next page",children:"→"})]})]})}Do.displayName="Table";function Ws({defaultSort:o,defaultPage:r=1}={}){const[n,e]=a.useState(o??null),[l,i]=a.useState(r);return{sort:n,page:l,onSortChange:p=>{e(p),i(1)},onPageChange:p=>{i(p)}}}const Os=s.p`
960
963
  margin: 0;
961
964
  font-size: ${({theme:o})=>o.fontSizes.md};
962
965
  color: ${({theme:o})=>o.colors.neutral[600]};
@@ -1001,7 +1004,7 @@
1001
1004
  box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
1002
1005
  }
1003
1006
  `}
1004
- `;function no({open:o,title:r="Are you sure?",message:n,confirmLabel:e="Confirm",cancelLabel:a="Cancel",variant:i="default",size:c="sm",onConfirm:d,onCancel:f}){return t.jsx(ro,{open:o,onClose:f,title:r,size:c,closeOnBackdrop:!1,footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"outline",onClick:f,children:a}),i==="danger"?t.jsx(Ns,{type:"button",onClick:d,children:e}):t.jsx(H,{variant:"primary",onClick:d,children:e})]}),children:t.jsx(Os,{children:n})})}no.displayName="ConfirmDialog";const Eo=l.createContext(null);function Fs({children:o}){const[r,n]=l.useState(null),e=l.useCallback(c=>new Promise(d=>{n({...c,resolve:d})}),[]),a=()=>{r?.resolve(!0),n(null)},i=()=>{r?.resolve(!1),n(null)};return t.jsxs(Eo.Provider,{value:{confirm:e},children:[o,r&&t.jsx(no,{open:!0,title:r.title,message:r.message,confirmLabel:r.confirmLabel,cancelLabel:r.cancelLabel,variant:r.variant,size:r.size,onConfirm:a,onCancel:i})]})}function Ls(){const o=l.useContext(Eo);if(!o)throw new Error("useConfirm must be used within a ConfirmProvider");return o.confirm}const Bs=s.div`
1007
+ `;function no({open:o,title:r="Are you sure?",message:n,confirmLabel:e="Confirm",cancelLabel:l="Cancel",variant:i="default",size:c="sm",onConfirm:d,onCancel:p}){return t.jsx(ro,{open:o,onClose:p,title:r,size:c,closeOnBackdrop:!1,footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"outline",onClick:p,children:l}),i==="danger"?t.jsx(Ns,{type:"button",onClick:d,children:e}):t.jsx(H,{variant:"primary",onClick:d,children:e})]}),children:t.jsx(Os,{children:n})})}no.displayName="ConfirmDialog";const Eo=a.createContext(null);function Fs({children:o}){const[r,n]=a.useState(null),e=a.useCallback(c=>new Promise(d=>{n({...c,resolve:d})}),[]),l=()=>{r?.resolve(!0),n(null)},i=()=>{r?.resolve(!1),n(null)};return t.jsxs(Eo.Provider,{value:{confirm:e},children:[o,r&&t.jsx(no,{open:!0,title:r.title,message:r.message,confirmLabel:r.confirmLabel,cancelLabel:r.cancelLabel,variant:r.variant,size:r.size,onConfirm:l,onCancel:i})]})}function Ls(){const o=a.useContext(Eo);if(!o)throw new Error("useConfirm must be used within a ConfirmProvider");return o.confirm}const Bs=s.div`
1005
1008
  position: relative;
1006
1009
  display: inline-flex;
1007
1010
  flex-direction: column;
@@ -1057,13 +1060,13 @@
1057
1060
  white-space: nowrap;
1058
1061
  overflow: hidden;
1059
1062
  text-overflow: ellipsis;
1060
- `,As=s.span`
1063
+ `,Rs=s.span`
1061
1064
  display: inline-flex;
1062
1065
  align-items: center;
1063
1066
  margin-left: ${({theme:o})=>o.spacing[2]};
1064
1067
  color: ${({theme:o})=>o.colors.neutral[500]};
1065
1068
  flex-shrink: 0;
1066
- `,Rs=s.button`
1069
+ `,As=s.button`
1067
1070
  display: inline-flex;
1068
1071
  align-items: center;
1069
1072
  margin-left: ${({theme:o})=>o.spacing[2]};
@@ -1195,7 +1198,7 @@
1195
1198
  box-shadow: 2px 2px 0 ${n.colors.neutral[900]};
1196
1199
  `}
1197
1200
  `}
1198
- `,Js=["January","February","March","April","May","June","July","August","September","October","November","December"],Xs=["Su","Mo","Tu","We","Th","Fr","Sa"];function fo(o,r){return new Date(o,r+1,0).getDate()}function Zs(o,r){return new Date(o,r,1).getDay()}function $o(o,r){return o.getFullYear()===r.getFullYear()&&o.getMonth()===r.getMonth()&&o.getDate()===r.getDate()}function Qs(o,r,n){if(r){const e=new Date(r.getFullYear(),r.getMonth(),r.getDate());if(o<e)return!0}if(n){const e=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(o>e)return!0}return!1}function on(o){return o.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function rn(o){return o.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}function Po({value:o=null,onChange:r,placeholder:n="Select date...",size:e="md",disabled:a=!1,clearable:i=!1,minDate:c,maxDate:d,formatDate:f,id:$,error:b}){const y=l.useId(),g=$??y,p=new Date,[x,m]=l.useState(!1),[S,C]=l.useState(()=>(o??p).getFullYear()),[j,z]=l.useState(()=>(o??p).getMonth()),k=l.useRef(null);l.useEffect(()=>{if(!x)return;const u=O=>{k.current&&!k.current.contains(O.target)&&m(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[x]),l.useEffect(()=>{o&&(C(o.getFullYear()),z(o.getMonth()))},[o]);const w=o?f?f(o):on(o):"",v=u=>{r?.(new Date(S,j,u)),m(!1)},T=u=>{u.stopPropagation(),r?.(null)},I=()=>{j===0?(z(11),C(u=>u-1)):z(u=>u-1)},W=()=>{j===11?(z(0),C(u=>u+1)):z(u=>u+1)},M=fo(S,j),V=Zs(S,j),D=[],E=fo(j===0?S-1:S,j===0?11:j-1);for(let u=V-1;u>=0;u--)D.push({day:E-u,currentMonth:!1});for(let u=1;u<=M;u++)D.push({day:u,currentMonth:!0});const _=42-D.length;for(let u=1;u<=_;u++)D.push({day:u,currentMonth:!1});return t.jsxs(Bs,{ref:k,children:[t.jsxs(Vs,{id:g,$size:e,$error:!!b,$disabled:a,role:"combobox","aria-haspopup":"true","aria-expanded":x,tabIndex:a?-1:0,onClick:()=>{a||m(u=>!u)},onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&!a&&(u.preventDefault(),m(O=>!O)),u.key==="Escape"&&m(!1)},children:[t.jsx(_s,{$hasValue:!!o,children:w||n}),i&&o?t.jsx(Rs,{type:"button",onClick:T,"aria-label":"Clear date",children:t.jsx(Q,{size:14})}):t.jsx(As,{"aria-hidden":"true",children:t.jsx(ar,{size:14})})]}),typeof b=="string"&&t.jsx(Ys,{$error:!0,children:b}),x&&t.jsxs(Hs,{role:"dialog","aria-label":"Calendar",children:[t.jsxs(qs,{children:[t.jsx(uo,{type:"button",onClick:I,"aria-label":"Previous month",children:t.jsx(dr,{size:16})}),t.jsxs(Us,{children:[Js[j]," ",S]}),t.jsx(uo,{type:"button",onClick:W,"aria-label":"Next month",children:t.jsx(pr,{size:16})})]}),t.jsxs(Ks,{children:[Xs.map(u=>t.jsx(Gs,{children:u},u)),D.map((u,O)=>{if(!u.currentMonth)return t.jsx(po,{type:"button",$currentMonth:!1,$selected:!1,$today:!1,disabled:!0,tabIndex:-1,children:u.day},O);const F=new Date(S,j,u.day),L=o?$o(F,o):!1,U=$o(F,p),K=Qs(F,c,d);return t.jsx(po,{type:"button",$currentMonth:!0,$selected:L,$today:U,disabled:K,"aria-label":rn(F),"aria-pressed":L,onClick:()=>v(u.day),children:u.day},O)})]})]})]})}Po.displayName="DatePicker";function sn(o){const r=parseInt(o.slice(1,3),16)/255,n=parseInt(o.slice(3,5),16)/255,e=parseInt(o.slice(5,7),16)/255,a=c=>c<=.03928?c/12.92:((c+.055)/1.055)**2.4;return .2126*a(r)+.7152*a(n)+.0722*a(e)>.179?"#111111":"#ffffff"}const q={colors:{primary:{50:"#fffde6",500:"#ffd000",700:"#ffd000",contrast:"#111111"},neutral:{0:"#ffffff",100:"#f5f0e8",200:"#e8e3db",300:"#ccc8c0",400:"#a8a49c",500:"#706c64",600:"#3c3830",900:"#111111"},error:{50:"#fff0f0",500:"#ff3333"},success:{50:"#f0fff4",500:"#00cc44"},warning:{50:"#fffbe6",500:"#ff9900"},info:{50:"#f0f0ff",500:"#3333ff"}},spacing:{1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px"},radius:{md:"2px"},zIndex:{modal:1e3,toast:1100},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px"},shadows:{focusRing:"3px 3px 0 #111111"},brutalism:{borderWidth:"2px",shadowOffset:"4px"}};function nn(o){return{...q,colors:{...q.colors,primary:{50:"#fffff0",500:o,700:o,contrast:sn(o)}}}}function tn({theme:o=q,children:r}){return t.jsx(s.ThemeProvider,{theme:o,children:r})}const en=s.createGlobalStyle`
1201
+ `,Js=["January","February","March","April","May","June","July","August","September","October","November","December"],Xs=["Su","Mo","Tu","We","Th","Fr","Sa"];function fo(o,r){return new Date(o,r+1,0).getDate()}function Zs(o,r){return new Date(o,r,1).getDay()}function $o(o,r){return o.getFullYear()===r.getFullYear()&&o.getMonth()===r.getMonth()&&o.getDate()===r.getDate()}function Qs(o,r,n){if(r){const e=new Date(r.getFullYear(),r.getMonth(),r.getDate());if(o<e)return!0}if(n){const e=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(o>e)return!0}return!1}function on(o){return o.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function rn(o){return o.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}function Po({value:o=null,onChange:r,placeholder:n="Select date...",size:e="md",disabled:l=!1,clearable:i=!1,minDate:c,maxDate:d,formatDate:p,id:b,error:g}){const h=a.useId(),y=b??h,f=new Date,[x,v]=a.useState(!1),[k,T]=a.useState(()=>(o??f).getFullYear()),[$,C]=a.useState(()=>(o??f).getMonth()),S=a.useRef(null);a.useEffect(()=>{if(!x)return;const u=O=>{S.current&&!S.current.contains(O.target)&&v(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[x]),a.useEffect(()=>{o&&(T(o.getFullYear()),C(o.getMonth()))},[o]);const j=o?p?p(o):on(o):"",w=u=>{r?.(new Date(k,$,u)),v(!1)},z=u=>{u.stopPropagation(),r?.(null)},I=()=>{$===0?(C(11),T(u=>u-1)):C(u=>u-1)},M=()=>{$===11?(C(0),T(u=>u+1)):C(u=>u+1)},D=fo(k,$),V=Zs(k,$),E=[],P=fo($===0?k-1:k,$===0?11:$-1);for(let u=V-1;u>=0;u--)E.push({day:P-u,currentMonth:!1});for(let u=1;u<=D;u++)E.push({day:u,currentMonth:!0});const _=42-E.length;for(let u=1;u<=_;u++)E.push({day:u,currentMonth:!1});return t.jsxs(Bs,{ref:S,children:[t.jsxs(Vs,{id:y,$size:e,$error:!!g,$disabled:l,role:"combobox","aria-haspopup":"true","aria-expanded":x,tabIndex:l?-1:0,onClick:()=>{l||v(u=>!u)},onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&!l&&(u.preventDefault(),v(O=>!O)),u.key==="Escape"&&v(!1)},children:[t.jsx(_s,{$hasValue:!!o,children:j||n}),i&&o?t.jsx(As,{type:"button",onClick:z,"aria-label":"Clear date",children:t.jsx(Q,{size:14})}):t.jsx(Rs,{"aria-hidden":"true",children:t.jsx(ar,{size:14})})]}),typeof g=="string"&&t.jsx(Ys,{$error:!0,children:g}),x&&t.jsxs(Hs,{role:"dialog","aria-label":"Calendar",children:[t.jsxs(qs,{children:[t.jsx(uo,{type:"button",onClick:I,"aria-label":"Previous month",children:t.jsx(dr,{size:16})}),t.jsxs(Us,{children:[Js[$]," ",k]}),t.jsx(uo,{type:"button",onClick:M,"aria-label":"Next month",children:t.jsx(pr,{size:16})})]}),t.jsxs(Ks,{children:[Xs.map(u=>t.jsx(Gs,{children:u},u)),E.map((u,O)=>{if(!u.currentMonth)return t.jsx(po,{type:"button",$currentMonth:!1,$selected:!1,$today:!1,disabled:!0,tabIndex:-1,children:u.day},O);const F=new Date(k,$,u.day),L=o?$o(F,o):!1,U=$o(F,f),K=Qs(F,c,d);return t.jsx(po,{type:"button",$currentMonth:!0,$selected:L,$today:U,disabled:K,"aria-label":rn(F),"aria-pressed":L,onClick:()=>w(u.day),children:u.day},O)})]})]})]})}Po.displayName="DatePicker";function sn(o){const r=parseInt(o.slice(1,3),16)/255,n=parseInt(o.slice(3,5),16)/255,e=parseInt(o.slice(5,7),16)/255,l=c=>c<=.03928?c/12.92:((c+.055)/1.055)**2.4;return .2126*l(r)+.7152*l(n)+.0722*l(e)>.179?"#111111":"#ffffff"}const q={colors:{primary:{50:"#fffde6",500:"#ffd000",700:"#ffd000",contrast:"#111111"},neutral:{0:"#ffffff",100:"#f5f0e8",200:"#e8e3db",300:"#ccc8c0",400:"#a8a49c",500:"#706c64",600:"#3c3830",900:"#111111"},error:{50:"#fff0f0",500:"#ff3333"},success:{50:"#f0fff4",500:"#00cc44"},warning:{50:"#fffbe6",500:"#ff9900"},info:{50:"#f0f0ff",500:"#3333ff"}},spacing:{1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px"},radius:{md:"2px"},zIndex:{modal:1e3,toast:1100},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px"},shadows:{focusRing:"3px 3px 0 #111111"},brutalism:{borderWidth:"2px",shadowOffset:"4px"}};function nn(o){return{...q,colors:{...q.colors,primary:{50:"#fffff0",500:o,700:o,contrast:sn(o)}}}}function tn({theme:o=q,children:r}){return t.jsx(s.ThemeProvider,{theme:o,children:r})}const en=s.createGlobalStyle`
1199
1202
  *, *::before, *::after {
1200
1203
  box-sizing: border-box;
1201
1204
  margin: 0;
@@ -1212,4 +1215,4 @@
1212
1215
  button, input, select, textarea {
1213
1216
  font-family: inherit;
1214
1217
  }
1215
- `;exports.Badge=go;exports.Button=H;exports.CollapsibleCard=zo;exports.ConfirmDialog=no;exports.ConfirmProvider=Fs;exports.DatePicker=Po;exports.Editable=vo;exports.Field=ko;exports.Form=jo;exports.FormField=Co;exports.GlobalStyles=en;exports.Input=xo;exports.Link=oo;exports.Modal=ro;exports.Select=wo;exports.Spinner=To;exports.Table=Do;exports.Textarea=yo;exports.ThemeProvider=tn;exports.Toast=so;exports.ToastProvider=Hr;exports.createNeoBrutalTheme=nn;exports.neoBrutalTheme=q;exports.useConfirm=Ls;exports.useForm=Zr;exports.useTable=Ws;exports.useToast=qr;
1218
+ `;exports.Badge=go;exports.Button=H;exports.CollapsibleCard=zo;exports.ConfirmDialog=no;exports.ConfirmProvider=Fs;exports.DatePicker=Po;exports.Editable=vo;exports.Field=ko;exports.Form=jo;exports.FormField=Co;exports.GlobalStyles=en;exports.Input=xo;exports.Link=oo;exports.Modal=ro;exports.Select=mo;exports.Spinner=To;exports.Table=Do;exports.Textarea=yo;exports.ThemeProvider=tn;exports.Toast=so;exports.ToastProvider=Hr;exports.createNeoBrutalTheme=nn;exports.neoBrutalTheme=q;exports.useConfirm=Ls;exports.useForm=Zr;exports.useTable=Ws;exports.useToast=qr;