blunt-ui 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("styled-components"),a=require("react"),co=require("react-dom"),Q=(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"),fo=require("react-dom"),to=(o,r,n)=>s.css`
2
2
  background: ${r};
3
3
  color: ${n};
4
4
  border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
5
5
  box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
6
- `,fr=s.span`
6
+ `,pr=s.span`
7
7
  display: inline-flex;
8
8
  align-items: center;
9
9
  font-weight: ${({theme:o})=>o.fontWeights.bold};
@@ -23,7 +23,7 @@
23
23
  font-size: ${r.fontSizes.sm};
24
24
  `})[o]}
25
25
 
26
- ${({$variant:o,theme:r})=>r.brutalism?{primary:Q(r,r.colors.primary[500],r.colors.primary.contrast),neutral:Q(r,r.colors.neutral[200],r.colors.neutral[900]),success:Q(r,r.colors.success[50],r.colors.success[500]),error:Q(r,r.colors.error[50],r.colors.error[500]),warning:Q(r,r.colors.warning[50],r.colors.warning[500]),info:Q(r,r.colors.info[50],r.colors.info[500])}[o]:{primary:s.css`
26
+ ${({$variant:o,theme:r})=>r.brutalism?{primary:to(r,r.colors.primary[500],r.colors.primary.contrast),neutral:to(r,r.colors.neutral[200],r.colors.neutral[900]),success:to(r,r.colors.success[50],r.colors.success[500]),error:to(r,r.colors.error[50],r.colors.error[500]),warning:to(r,r.colors.warning[50],r.colors.warning[500]),info:to(r,r.colors.info[50],r.colors.info[500])}[o]:{primary:s.css`
27
27
  background: ${r.colors.primary[50]};
28
28
  color: ${r.colors.primary[500]};
29
29
  `,neutral:s.css`
@@ -42,7 +42,7 @@
42
42
  background: ${r.colors.info[50]};
43
43
  color: ${r.colors.info[500]};
44
44
  `}[o]}
45
- `;function No({variant:o="primary",size:r="md",children:n,...e}){return t.jsx(fr,{$variant:o,$size:r,...e,children:n})}No.displayName="Badge";const $o=(o,r,n)=>s.css`
45
+ `;function No({variant:o="primary",size:r="md",children:n,...e}){return t.jsx(pr,{$variant:o,$size:r,...e,children:n})}No.displayName="Badge";const $o=(o,r,n)=>s.css`
46
46
  background-color: ${r};
47
47
  color: ${n};
48
48
  border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
@@ -55,7 +55,7 @@
55
55
  transform: translate(2px, 2px);
56
56
  box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
57
57
  }
58
- `,pr=s.button`
58
+ `,fr=s.button`
59
59
  display: inline-flex;
60
60
  align-items: center;
61
61
  justify-content: center;
@@ -63,6 +63,7 @@
63
63
  font-weight: ${({theme:o})=>o.fontWeights.semibold};
64
64
  cursor: pointer;
65
65
  text-decoration: none;
66
+ touch-action: manipulation;
66
67
 
67
68
  &:focus-visible {
68
69
  outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
@@ -107,12 +108,12 @@
107
108
  padding: ${r.spacing[3]} ${r.spacing[6]};
108
109
  font-size: ${r.fontSizes.lg};
109
110
  `})[o]}
110
- `;function ao({ref:o,as:r,href:n,variant:e="primary",size:i="md",isLoading:l,disabled:d,children:f,...u}){const p=r??(n?"a":"button");return t.jsx(pr,{ref:o,as:p,href:n,$variant:e,$size:i,disabled:l||d,...u,children:l?"Loading...":f})}ao.displayName="Button";const $r=s.div`
111
+ `;function uo({ref:o,as:r,href:n,variant:e="primary",size:i="md",isLoading:l,disabled:d,children:p,...u}){const f=r??(n?"a":"button");return t.jsx(fr,{ref:o,as:f,href:n,$variant:e,$size:i,disabled:l||d,...u,children:l?"Loading...":p})}uo.displayName="Button";const gr=s.div`
111
112
  display: flex;
112
113
  flex-direction: column;
113
114
  gap: ${({theme:o})=>o.spacing[1]};
114
115
  width: ${({$fullWidth:o})=>o?"100%":"auto"};
115
- `,gr=s.label`
116
+ `,$r=s.label`
116
117
  font-size: ${({theme:o})=>o.fontSizes.sm};
117
118
  font-weight: ${({theme:o})=>o.brutalism?o.fontWeights.bold:o.fontWeights.medium};
118
119
  `,br=s.span`
@@ -188,7 +189,7 @@
188
189
  &:hover {
189
190
  opacity: 0.8;
190
191
  }
191
- `;function Po({ref:o,type:r="text",size:n="md",variant:e="default",label:i,helperText:l,error:d,leftElement:f,rightElement:u,clearable:p,onClear:$,fullWidth:m,id:w,value:y,defaultValue:v,onChange:S,...W}){const L=a.useId(),E=w??L,g=`${E}-hint`,[j,h]=a.useState(v??""),x=y!==void 0,C=x?y:j,I=typeof d=="string"?d:void 0,z=!!(l||d),D=F=>{x||h(F.target.value),S?.(F)},P=()=>{x||h(""),$?.()};return t.jsxs($r,{$fullWidth:m,children:[i&&t.jsx(gr,{htmlFor:E,children:i}),t.jsxs(xr,{$size:n,$variant:e,$error:!!d,children:[f&&t.jsx(Co,{children:f}),t.jsx(yr,{id:E,ref:o,type:r,value:C,onChange:D,...W,"aria-invalid":!!d,"aria-describedby":z?g:void 0}),p&&C&&t.jsx(hr,{type:"button",onClick:P,"aria-label":"Clear input",children:"✕"}),u&&t.jsx(Co,{children:u})]}),z&&t.jsx(br,{id:g,$error:!!d,children:I??l})]})}Po.displayName="Input";const mr=s.div`
192
+ `;function Fo({ref:o,type:r="text",size:n="md",variant:e="default",label:i,helperText:l,error:d,leftElement:p,rightElement:u,clearable:f,onClear:$,fullWidth:w,id:v,value:y,defaultValue:k,onChange:j,...W}){const O=a.useId(),E=v??O,x=`${E}-hint`,[z,m]=a.useState(k??""),b=y!==void 0,S=b?y:z,T=typeof d=="string"?d:void 0,I=!!(l||d),M=P=>{b||m(P.target.value),j?.(P)},N=()=>{b||m(""),$?.()};return t.jsxs(gr,{$fullWidth:w,children:[i&&t.jsx($r,{htmlFor:E,children:i}),t.jsxs(xr,{$size:n,$variant:e,$error:!!d,children:[p&&t.jsx(Co,{children:p}),t.jsx(yr,{id:E,ref:o,type:r,value:S,onChange:M,...W,"aria-invalid":!!d,"aria-describedby":I?x:void 0}),f&&S&&t.jsx(hr,{type:"button",onClick:N,"aria-label":"Clear input",children:"✕"}),u&&t.jsx(Co,{children:u})]}),I&&t.jsx(br,{id:x,$error:!!d,children:T??l})]})}Fo.displayName="Input";const mr=s.div`
192
193
  display: flex;
193
194
  flex-direction: column;
194
195
  gap: ${({theme:o})=>o.spacing[1]};
@@ -253,14 +254,14 @@
253
254
  cursor: not-allowed;
254
255
  opacity: 0.6;
255
256
  }
256
- `;function Fo({ref:o,size:r="md",variant:n="default",label:e,helperText:i,error:l,fullWidth:d,id:f,value:u,defaultValue:p,onChange:$,...m}){const w=a.useId(),y=f??w,v=`${y}-hint`,[S,W]=a.useState(p??""),L=u!==void 0,E=L?u:S,g=typeof l=="string"?l:void 0,j=!!(i||l),h=x=>{L||W(x.target.value),$?.(x)};return t.jsxs(mr,{$fullWidth:d,children:[e&&t.jsx(wr,{htmlFor:y,children:e}),t.jsx(kr,{$size:r,$variant:n,$error:!!l,children:t.jsx(Sr,{id:y,ref:o,value:E,onChange:h,...m,"aria-invalid":!!l,"aria-describedby":j?v:void 0})}),j&&t.jsx(vr,{id:v,$error:!!l,children:g??i})]})}Fo.displayName="Textarea";const Vo=(...o)=>o.filter((r,n,e)=>!!r&&r.trim()!==""&&e.indexOf(r)===n).join(" ").trim();const jr=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Cr=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,e)=>e?e.toUpperCase():n.toLowerCase());const zo=o=>{const r=Cr(o);return r.charAt(0).toUpperCase()+r.slice(1)};var go={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 zr=o=>{for(const r in o)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},Ir=a.createContext({}),Tr=()=>a.useContext(Ir),Dr=a.forwardRef(({color:o,size:r,strokeWidth:n,absoluteStrokeWidth:e,className:i="",children:l,iconNode:d,...f},u)=>{const{size:p=24,strokeWidth:$=2,absoluteStrokeWidth:m=!1,color:w="currentColor",className:y=""}=Tr()??{},v=e??m?Number(n??$)*24/Number(r??p):n??$;return a.createElement("svg",{ref:u,...go,width:r??p??go.width,height:r??p??go.height,stroke:o??w,strokeWidth:v,className:Vo("lucide",y,i),...!l&&!zr(f)&&{"aria-hidden":"true"},...f},[...d.map(([S,W])=>a.createElement(S,W)),...Array.isArray(l)?l:[l]])});const U=(o,r)=>{const n=a.forwardRef(({className:e,...i},l)=>a.createElement(Dr,{ref:l,iconNode:r,className:Vo(`lucide-${jr(zo(o))}`,`lucide-${o}`,e),...i}));return n.displayName=zo(o),n};const Wr=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Er=U("arrow-down",Wr);const Mr=[["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"}]],Or=U("arrow-up-down",Mr);const Lr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Rr=U("arrow-up",Lr);const Nr=[["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"}]],Pr=U("calendar",Nr);const Fr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bo=U("chevron-down",Fr);const Vr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Br=U("chevron-left",Vr);const Ar=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_r=U("chevron-right",Ar);const Hr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],uo=U("x",Hr),Yr=s.div`
257
+ `;function Bo({ref:o,size:r="md",variant:n="default",label:e,helperText:i,error:l,fullWidth:d,id:p,value:u,defaultValue:f,onChange:$,...w}){const v=a.useId(),y=p??v,k=`${y}-hint`,[j,W]=a.useState(f??""),O=u!==void 0,E=O?u:j,x=typeof l=="string"?l:void 0,z=!!(i||l),m=b=>{O||W(b.target.value),$?.(b)};return t.jsxs(mr,{$fullWidth:d,children:[e&&t.jsx(wr,{htmlFor:y,children:e}),t.jsx(kr,{$size:r,$variant:n,$error:!!l,children:t.jsx(Sr,{id:y,ref:o,value:E,onChange:m,...w,"aria-invalid":!!l,"aria-describedby":z?k:void 0})}),z&&t.jsx(vr,{id:k,$error:!!l,children:x??i})]})}Bo.displayName="Textarea";const Vo=(...o)=>o.filter((r,n,e)=>!!r&&r.trim()!==""&&e.indexOf(r)===n).join(" ").trim();const jr=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const zr=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,e)=>e?e.toUpperCase():n.toLowerCase());const Io=o=>{const r=zr(o);return r.charAt(0).toUpperCase()+r.slice(1)};var bo={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 Cr=o=>{for(const r in o)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},Ir=a.createContext({}),Tr=()=>a.useContext(Ir),Dr=a.forwardRef(({color:o,size:r,strokeWidth:n,absoluteStrokeWidth:e,className:i="",children:l,iconNode:d,...p},u)=>{const{size:f=24,strokeWidth:$=2,absoluteStrokeWidth:w=!1,color:v="currentColor",className:y=""}=Tr()??{},k=e??w?Number(n??$)*24/Number(r??f):n??$;return a.createElement("svg",{ref:u,...bo,width:r??f??bo.width,height:r??f??bo.height,stroke:o??v,strokeWidth:k,className:Vo("lucide",y,i),...!l&&!Cr(p)&&{"aria-hidden":"true"},...p},[...d.map(([j,W])=>a.createElement(j,W)),...Array.isArray(l)?l:[l]])});const X=(o,r)=>{const n=a.forwardRef(({className:e,...i},l)=>a.createElement(Dr,{ref:l,iconNode:r,className:Vo(`lucide-${jr(Io(o))}`,`lucide-${o}`,e),...i}));return n.displayName=Io(o),n};const Wr=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Er=X("arrow-down",Wr);const Mr=[["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"}]],Or=X("arrow-up-down",Mr);const Rr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Lr=X("arrow-up",Rr);const Pr=[["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"}]],Nr=X("calendar",Pr);const Fr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ao=X("chevron-down",Fr);const Br=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Vr=X("chevron-left",Br);const Ar=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_r=X("chevron-right",Ar);const Hr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],go=X("x",Hr),Ur=s.div`
257
258
  display: inline-flex;
258
259
  flex-direction: column;
259
260
  gap: ${({theme:o})=>o.spacing[1]};
260
261
  width: ${({$fullWidth:o})=>o?"100%":"auto"};
261
262
  position: relative;
262
263
  min-width: 0;
263
- `,Ur=s.div`
264
+ `,Yr=s.div`
264
265
  height: 0;
265
266
  overflow: hidden;
266
267
  visibility: hidden;
@@ -319,7 +320,7 @@
319
320
  outline: none;
320
321
  box-shadow: ${({theme:o})=>o.shadows.focusRing};
321
322
  }
322
- `,bo=s.span`
323
+ `,xo=s.span`
323
324
  flex: 1;
324
325
  overflow: hidden;
325
326
  white-space: nowrap;
@@ -426,7 +427,7 @@
426
427
  outline-offset: 2px;
427
428
  border-radius: 2px;
428
429
  }
429
- `;function Ao({options:o,placeholder:r,size:n="md",variant:e="default",error:i,fullWidth:l,clearable:d,onClear:f,id:u,name:p,value:$,defaultValue:m,onChange:w,disabled:y,searchable:v,"aria-label":S,"aria-describedby":W}){const L=a.useId(),E=u??L,g=`${E}-list`,j=`${E}-search`,h=typeof i=="string"?i:void 0,[x,C]=a.useState(!1),[I,z]=a.useState(-1),[D,P]=a.useState(""),[F,O]=a.useState({top:0,left:0,width:0}),[V,q]=a.useState(m??""),N=$!==void 0,_=N?$:V,K=a.useRef(null),H=a.useRef(null),G=a.useRef(null),X=a.useRef(null),k=o.find(c=>c.value===_),M=v&&D?o.filter(c=>c.label.toLowerCase().includes(D.toLowerCase())):o,B=a.useCallback(()=>{if(!H.current)return;const c=H.current.getBoundingClientRect();O({top:c.bottom+4,left:c.left,width:c.width})},[]);a.useEffect(()=>{if(x)return B(),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B)}},[x,B]),a.useEffect(()=>{if(!x)return;const c=T=>{const Y=K.current?.contains(T.target),to=G.current?.contains(T.target);!Y&&!to&&C(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[x]),a.useEffect(()=>{x&&v&&setTimeout(()=>X.current?.focus(),0),x||(P(""),z(-1))},[x,v]),a.useEffect(()=>{z(-1)},[D]),a.useEffect(()=>{if(I<0)return;const c=document.getElementById(`${g}-option-${I}`);c&&typeof c.scrollIntoView=="function"&&c.scrollIntoView({block:"nearest"})},[I,g]);function A(c,T){let Y=c+T;for(;Y>=0&&Y<M.length;){if(!M[Y].disabled)return Y;Y+=T}return c}function oo(){return M.findIndex(c=>!c.disabled)}function no(){for(let c=M.length-1;c>=0;c--)if(!M[c].disabled)return c;return-1}function ro(c){if(c.disabled)return;N||q(c.value);const T={target:{name:p??"",value:c.value},currentTarget:{name:p??"",value:c.value}};w?.(T),C(!1),H.current?.focus()}function J(c){c.stopPropagation(),N||q(""),w?.({target:{name:p??"",value:""},currentTarget:{name:p??"",value:""}}),f?.(),H.current?.focus()}function fo(c){if(!y){if(!x){["ArrowDown","ArrowUp","Enter"," "].includes(c.key)&&(c.preventDefault(),C(!0),v||z(oo()));return}if(c.key==="Escape"){c.preventDefault(),C(!1);return}if(!v){if(c.key==="ArrowDown"){c.preventDefault(),z(T=>A(T,1));return}if(c.key==="ArrowUp"){c.preventDefault(),z(T=>A(T,-1));return}if(c.key==="Home"){c.preventDefault(),z(oo());return}if(c.key==="End"){c.preventDefault(),z(no());return}(c.key==="Enter"||c.key===" ")&&I>=0&&(c.preventDefault(),ro(M[I]))}}}function po(c){if(c.key==="Escape"){C(!1),H.current?.focus();return}if(c.key==="ArrowDown"){c.preventDefault(),z(T=>T<0?oo():A(T,1));return}if(c.key==="ArrowUp"){c.preventDefault(),z(T=>T<0?no():A(T,-1));return}c.key==="Enter"&&I>=0&&(c.preventDefault(),ro(M[I]))}const b=d&&!!_&&!y,R=I>=0?`${g}-option-${I}`:void 0;return t.jsxs(Yr,{ref:K,$fullWidth:l,children:[t.jsxs(Ur,{"aria-hidden":"true",children:[r&&t.jsx(bo,{children:r}),o.map(c=>t.jsx(bo,{children:c.label},c.value))]}),t.jsxs(qr,{ref:H,id:E,type:"button",role:"combobox","aria-expanded":x,"aria-haspopup":"listbox","aria-controls":x?g:void 0,"aria-activedescendant":x&&!v?R:void 0,"aria-invalid":!!i,"aria-label":S,"aria-describedby":W,$size:n,$variant:e,$error:!!i,$disabled:y,$open:x,disabled:y,onClick:()=>!y&&C(c=>!c),onKeyDown:fo,children:[t.jsx(bo,{$placeholder:!k,children:k?.label??r??"Select..."}),t.jsxs(Kr,{children:[b&&t.jsx(ss,{type:"button",onClick:J,"aria-label":"Clear selection",children:t.jsx(uo,{size:14})}),t.jsx(Gr,{$open:x,"aria-hidden":"true",children:t.jsx(Bo,{size:14})})]})]}),x&&co.createPortal(t.jsxs(Xr,{ref:G,id:g,role:"listbox","aria-label":r??"Options",style:{position:"fixed",top:F.top,left:F.left,width:F.width},children:[v&&t.jsx(Jr,{children:t.jsx(Qr,{ref:X,id:j,type:"text",placeholder:"Search...",value:D,onChange:c=>P(c.target.value),onKeyDown:po,"aria-label":"Search options","aria-controls":g,"aria-activedescendant":R})}),M.length===0&&t.jsx(Zr,{children:"No options found"}),M.map((c,T)=>t.jsx(os,{id:`${g}-option-${T}`,role:"option","aria-selected":c.value===_,"aria-disabled":c.disabled,$selected:c.value===_,$focused:T===I,$disabled:c.disabled,onClick:()=>ro(c),onMouseEnter:()=>!c.disabled&&z(T),children:c.label},c.value))]}),document.body),h&&t.jsx(rs,{$error:!0,children:h})]})}Ao.displayName="Select";const Io=s.span`
430
+ `;function wo({options:o,placeholder:r,size:n="md",variant:e="default",error:i,fullWidth:l,clearable:d,onClear:p,id:u,name:f,value:$,defaultValue:w,onChange:v,disabled:y,searchable:k,"aria-label":j,"aria-describedby":W}){const O=a.useId(),E=u??O,x=`${E}-list`,z=`${E}-search`,m=typeof i=="string"?i:void 0,[b,S]=a.useState(!1),[T,I]=a.useState(-1),[M,N]=a.useState(""),[P,L]=a.useState({top:0,bottom:0,left:0,width:0,openUpward:!1}),[H,ro]=a.useState(w??""),D=$!==void 0,V=D?$:H,so=a.useRef(null),U=a.useRef(null),G=a.useRef(null),Y=a.useRef(null),no=o.find(c=>c.value===V),B=k&&M?o.filter(c=>c.label.toLowerCase().includes(M.toLowerCase())):o,A=a.useCallback(()=>{if(!U.current)return;const c=U.current.getBoundingClientRect(),C=window.innerHeight,_=G.current?.getBoundingClientRect().height??200,oo=C-c.bottom,ao=oo<_+4&&c.top>oo;L({top:c.bottom+4,bottom:C-c.top+4,left:c.left,width:c.width,openUpward:ao})},[]);a.useEffect(()=>{if(b)return A(),window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[b,A]),a.useLayoutEffect(()=>{b&&A()},[b,A]),a.useEffect(()=>{if(!b)return;const c=C=>{const _=so.current?.contains(C.target),oo=G.current?.contains(C.target);!_&&!oo&&S(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[b]),a.useEffect(()=>{b&&k&&setTimeout(()=>Y.current?.focus(),0),b||(N(""),I(-1))},[b,k]),a.useEffect(()=>{I(-1)},[M]),a.useEffect(()=>{if(T<0)return;const c=document.getElementById(`${x}-option-${T}`);c&&typeof c.scrollIntoView=="function"&&c.scrollIntoView({block:"nearest"})},[T,x]);function q(c,C){let _=c+C;for(;_>=0&&_<B.length;){if(!B[_].disabled)return _;_+=C}return c}function K(){return B.findIndex(c=>!c.disabled)}function J(){for(let c=B.length-1;c>=0;c--)if(!B[c].disabled)return c;return-1}function Q(c){if(c.disabled)return;D||ro(c.value);const C={target:{name:f??"",value:c.value},currentTarget:{name:f??"",value:c.value}};v?.(C),S(!1),U.current?.focus()}function h(c){c.stopPropagation(),D||ro(""),v?.({target:{name:f??"",value:""},currentTarget:{name:f??"",value:""}}),p?.(),U.current?.focus()}function F(c){if(!y){if(!b){["ArrowDown","ArrowUp","Enter"," "].includes(c.key)&&(c.preventDefault(),S(!0),k||I(K()));return}if(c.key==="Escape"){c.preventDefault(),S(!1);return}if(!k){if(c.key==="ArrowDown"){c.preventDefault(),I(C=>q(C,1));return}if(c.key==="ArrowUp"){c.preventDefault(),I(C=>q(C,-1));return}if(c.key==="Home"){c.preventDefault(),I(K());return}if(c.key==="End"){c.preventDefault(),I(J());return}(c.key==="Enter"||c.key===" ")&&T>=0&&(c.preventDefault(),Q(B[T]))}}}function Z(c){if(c.key==="Escape"){S(!1),U.current?.focus();return}if(c.key==="ArrowDown"){c.preventDefault(),I(C=>C<0?K():q(C,1));return}if(c.key==="ArrowUp"){c.preventDefault(),I(C=>C<0?J():q(C,-1));return}c.key==="Enter"&&T>=0&&(c.preventDefault(),Q(B[T]))}const g=d&&!!V&&!y,R=T>=0?`${x}-option-${T}`:void 0;return t.jsxs(Ur,{ref:so,$fullWidth:l,children:[t.jsxs(Yr,{"aria-hidden":"true",children:[r&&t.jsx(xo,{children:r}),o.map(c=>t.jsx(xo,{children:c.label},c.value))]}),t.jsxs(qr,{ref:U,id:E,type:"button",role:"combobox","aria-expanded":b,"aria-haspopup":"listbox","aria-controls":b?x:void 0,"aria-activedescendant":b&&!k?R:void 0,"aria-invalid":!!i,"aria-label":j,"aria-describedby":W,$size:n,$variant:e,$error:!!i,$disabled:y,$open:b,disabled:y,onClick:()=>!y&&S(c=>!c),onKeyDown:F,children:[t.jsx(xo,{$placeholder:!no,children:no?.label??r??"Select..."}),t.jsxs(Kr,{children:[g&&t.jsx(ss,{type:"button",onClick:h,"aria-label":"Clear selection",children:t.jsx(go,{size:14})}),t.jsx(Gr,{$open:b,"aria-hidden":"true",children:t.jsx(Ao,{size:14})})]})]}),b&&fo.createPortal(t.jsxs(Xr,{ref:G,id:x,role:"listbox","aria-label":r??"Options",style:{position:"fixed",top:P.openUpward?"auto":P.top,bottom:P.openUpward?P.bottom:"auto",left:P.left,width:P.width},children:[k&&t.jsx(Jr,{children:t.jsx(Qr,{ref:Y,id:z,type:"text",placeholder:"Search...",value:M,onChange:c=>N(c.target.value),onKeyDown:Z,"aria-label":"Search options","aria-controls":x,"aria-activedescendant":R})}),B.length===0&&t.jsx(Zr,{children:"No options found"}),B.map((c,C)=>t.jsx(os,{id:`${x}-option-${C}`,role:"option","aria-selected":c.value===V,"aria-disabled":c.disabled,$selected:c.value===V,$focused:C===T,$disabled:c.disabled,onClick:()=>Q(c),onMouseEnter:()=>!c.disabled&&I(C),children:c.label},c.value))]}),document.body),m&&t.jsx(rs,{$error:!0,children:m})]})}wo.displayName="Select";const To=s.span`
430
431
  display: inline-block;
431
432
  `,ns=s.span`
432
433
  display: inline-block;
@@ -485,7 +486,7 @@
485
486
  border: 1px solid ${o.colors.primary[500]};
486
487
  box-shadow: ${o.shadows.focusRing};
487
488
  `}
488
- `;function _o({value:o,defaultValue:r="",onChange:n,onSubmit:e,onCancel:i,placeholder:l="Click to edit",disabled:d=!1}){const f=o!==void 0,[u,p]=a.useState(r),$=f?o:u,[m,w]=a.useState(!1),[y,v]=a.useState(""),S=a.useRef(null),W=()=>{d||(v($),w(!0),setTimeout(()=>{S.current?.focus(),S.current?.select()},0))},L=()=>{f||p(y),n?.(y),e?.(y),w(!1)},E=()=>{i?.($),w(!1)},g=j=>{j.key==="Enter"?L():j.key==="Escape"&&E()};return m?t.jsx(Io,{children:t.jsx(ts,{ref:S,value:y,size:Math.max(y.length,l.length,10),onChange:j=>v(j.target.value),onBlur:L,onKeyDown:g,"aria-label":"Edit value"})}):t.jsx(Io,{children:t.jsx(ns,{role:d?void 0:"button",tabIndex:d?void 0:0,$disabled:d,$empty:!$,onClick:W,onKeyDown:j=>j.key==="Enter"&&W(),children:$||l})})}_o.displayName="Editable";const es=s.a`
489
+ `;function _o({value:o,defaultValue:r="",onChange:n,onSubmit:e,onCancel:i,placeholder:l="Click to edit",disabled:d=!1}){const p=o!==void 0,[u,f]=a.useState(r),$=p?o:u,[w,v]=a.useState(!1),[y,k]=a.useState(""),j=a.useRef(null),W=()=>{d||(k($),v(!0),setTimeout(()=>{j.current?.focus(),j.current?.select()},0))},O=()=>{p||f(y),n?.(y),e?.(y),v(!1)},E=()=>{i?.($),v(!1)},x=z=>{z.key==="Enter"?O():z.key==="Escape"&&E()};return w?t.jsx(To,{children:t.jsx(ts,{ref:j,value:y,size:Math.max(y.length,l.length,10),onChange:z=>k(z.target.value),onBlur:O,onKeyDown:x,"aria-label":"Edit value"})}):t.jsx(To,{children:t.jsx(ns,{role:d?void 0:"button",tabIndex:d?void 0:0,$disabled:d,$empty:!$,onClick:W,onKeyDown:z=>z.key==="Enter"&&W(),children:$||l})})}_o.displayName="Editable";const es=s.a`
489
490
  text-decoration: underline;
490
491
  text-underline-offset: 2px;
491
492
  transition: color 0.15s;
@@ -507,7 +508,7 @@
507
508
  color: ${r.colors.neutral[900]};
508
509
  }
509
510
  `})[o]}
510
- `;function mo({variant:o="default",external:r,children:n,...e}){return t.jsx(es,{$variant:o,...r&&{target:"_blank",rel:"noreferrer"},...e,children:n})}mo.displayName="Link";const is=s.div`
511
+ `;function vo({variant:o="default",external:r,children:n,...e}){return t.jsx(es,{$variant:o,...r&&{target:"_blank",rel:"noreferrer"},...e,children:n})}vo.displayName="Link";const is=s.div`
511
512
  display: flex;
512
513
  flex-direction: column;
513
514
  gap: ${({theme:o})=>o.spacing[1]};
@@ -518,7 +519,7 @@
518
519
  `,ls=s.span`
519
520
  font-size: ${({theme:o})=>o.fontSizes.md};
520
521
  color: ${({theme:o})=>o.colors.neutral[900]};
521
- `;function Ho({label:o,value:r,href:n}){return t.jsxs(is,{children:[t.jsx(as,{children:o}),n?t.jsx(mo,{href:n,external:!0,children:r}):t.jsx(ls,{children:r??"—"})]})}Ho.displayName="Field";const cs=s.keyframes`
522
+ `;function Ho({label:o,value:r,href:n}){return t.jsxs(is,{children:[t.jsx(as,{children:o}),n?t.jsx(vo,{href:n,external:!0,children:r}):t.jsx(ls,{children:r??"—"})]})}Ho.displayName="Field";const cs=s.keyframes`
522
523
  from { opacity: 0; }
523
524
  to { opacity: 1; }
524
525
  `,ds=s.keyframes`
@@ -527,10 +528,10 @@
527
528
  `,us=s.keyframes`
528
529
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
529
530
  to { opacity: 1; transform: scale(1) translateY(0); }
530
- `,fs=s.keyframes`
531
+ `,ps=s.keyframes`
531
532
  from { opacity: 1; transform: scale(1) translateY(0); }
532
533
  to { opacity: 0; transform: scale(0.95) translateY(-8px); }
533
- `,ps=s.div`
534
+ `,fs=s.div`
534
535
  position: fixed;
535
536
  inset: 0;
536
537
  background-color: rgba(0, 0, 0, 0.5);
@@ -540,7 +541,7 @@
540
541
  z-index: ${({theme:o})=>o.zIndex.modal};
541
542
  animation: ${({$closing:o})=>o?ds:cs} 0.15s ease
542
543
  forwards;
543
- `,$s=s.div`
544
+ `,gs=s.div`
544
545
  position: relative;
545
546
  background: ${({theme:o})=>o.colors.neutral[0]};
546
547
  border-radius: ${({theme:o})=>o.radius.md};
@@ -549,7 +550,7 @@
549
550
  display: flex;
550
551
  flex-direction: column;
551
552
  max-height: 90vh;
552
- animation: ${({$closing:o})=>o?fs:us} 0.15s ease
553
+ animation: ${({$closing:o})=>o?ps:us} 0.15s ease
553
554
  forwards;
554
555
 
555
556
  ${({$size:o})=>o==="sm"&&s.css`
@@ -567,7 +568,7 @@
567
568
  max-height: 100vh;
568
569
  border-radius: 0;
569
570
  `}
570
- `,gs=s.div`
571
+ `,$s=s.div`
571
572
  display: flex;
572
573
  align-items: center;
573
574
  gap: ${({theme:o})=>o.spacing[2]};
@@ -616,21 +617,21 @@
616
617
  padding: ${({theme:o})=>o.spacing[4]};
617
618
  border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
618
619
  flex-shrink: 0;
619
- `,ms=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");function To(o){return Array.from(o.querySelectorAll(ms))}function wo({open:o,onClose:r,title:n,children:e,footer:i,size:l="md",closeOnBackdrop:d=!0,closeOnEscape:f=!0,ariaLabelledBy:u,ariaDescribedBy:p}){const $=a.useRef(null),m=a.useRef(null),w=a.useRef(r);w.current=r;const y=a.useId(),v=u??(n?y:void 0),[S,W]=a.useState(o),[L,E]=a.useState(!1);return a.useEffect(()=>{if(o)W(!0),E(!1);else if(S){E(!0);const g=setTimeout(()=>{W(!1),E(!1)},150);return()=>clearTimeout(g)}},[o,S]),a.useEffect(()=>{if(!o)return;const g=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=g}},[o]),a.useEffect(()=>{if(!o||!$.current)return;const g=$.current,j=document.activeElement;(To(g)[0]??g).focus();const x=C=>{if(C.key==="Escape"&&f){w.current();return}if(C.key!=="Tab")return;const I=To(g);if(I.length===0){C.preventDefault();return}const z=I[0],D=I[I.length-1];C.shiftKey?document.activeElement===z&&(C.preventDefault(),D.focus()):document.activeElement===D&&(C.preventDefault(),z.focus())};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x),j?.focus()}},[o,f,S]),S?co.createPortal(t.jsx(ps,{$closing:L,onMouseDown:g=>{m.current=g.target},onClick:g=>{d&&m.current===g.currentTarget&&r()},children:t.jsxs($s,{ref:$,role:"dialog","aria-modal":"true","aria-labelledby":v,"aria-describedby":p,$size:l,$closing:L,tabIndex:-1,onClick:g=>g.stopPropagation(),children:[t.jsxs(gs,{children:[n&&t.jsx(bs,{id:y,children:n}),t.jsx(xs,{onClick:r,"aria-label":"Close modal",children:"×"})]}),t.jsx(ys,{children:e}),i&&t.jsx(hs,{children:i})]})}),document.body):null}wo.displayName="Modal";const Yo=s.keyframes`
620
+ `,ms=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");function Do(o){return Array.from(o.querySelectorAll(ms))}function ko({open:o,onClose:r,title:n,children:e,footer:i,size:l="md",closeOnBackdrop:d=!0,closeOnEscape:p=!0,ariaLabelledBy:u,ariaDescribedBy:f}){const $=a.useRef(null),w=a.useRef(null),v=a.useRef(r);v.current=r;const y=a.useId(),k=u??(n?y:void 0),[j,W]=a.useState(o),[O,E]=a.useState(!1);return a.useEffect(()=>{if(o)W(!0),E(!1);else if(j){E(!0);const x=setTimeout(()=>{W(!1),E(!1)},150);return()=>clearTimeout(x)}},[o,j]),a.useEffect(()=>{if(!o)return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[o]),a.useEffect(()=>{if(!o||!$.current)return;const x=$.current,z=document.activeElement;(Do(x)[0]??x).focus();const b=S=>{if(S.key==="Escape"&&p){v.current();return}if(S.key!=="Tab")return;const T=Do(x);if(T.length===0){S.preventDefault();return}const I=T[0],M=T[T.length-1];S.shiftKey?document.activeElement===I&&(S.preventDefault(),M.focus()):document.activeElement===M&&(S.preventDefault(),I.focus())};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),z?.focus()}},[o,p,j]),j?fo.createPortal(t.jsx(fs,{$closing:O,onMouseDown:x=>{w.current=x.target},onClick:x=>{d&&w.current===x.currentTarget&&r()},children:t.jsxs(gs,{ref:$,role:"dialog","aria-modal":"true","aria-labelledby":k,"aria-describedby":f,$size:l,$closing:O,tabIndex:-1,onClick:x=>x.stopPropagation(),children:[t.jsxs($s,{children:[n&&t.jsx(bs,{id:y,children:n}),t.jsx(xs,{onClick:r,"aria-label":"Close modal",children:"×"})]}),t.jsx(ys,{children:e}),i&&t.jsx(hs,{children:i})]})}),document.body):null}ko.displayName="Modal";const Uo=s.keyframes`
620
621
  from { opacity: 0; transform: translateY(12px); }
621
622
  to { opacity: 1; transform: translateY(0); }
622
- `,Uo=s.keyframes`
623
+ `,Yo=s.keyframes`
623
624
  from { opacity: 0; transform: translateY(-12px); }
624
625
  to { opacity: 1; transform: translateY(0); }
625
626
  `,qo=s.keyframes`
626
627
  from { opacity: 1; }
627
628
  to { opacity: 0; }
628
- `,eo=(o,r,n)=>s.css`
629
+ `,lo=(o,r,n)=>s.css`
629
630
  background: ${r};
630
631
  border: ${o.brutalism.borderWidth} solid ${n};
631
632
  box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
632
633
  0 ${n};
633
- `;function Ko(o,r){return r.brutalism?{success:eo(r,r.colors.success[50],r.colors.success[500]),error:eo(r,r.colors.error[50],r.colors.error[500]),warning:eo(r,r.colors.warning[50],r.colors.warning[500]),info:eo(r,r.colors.info[50],r.colors.info[500])}[o]:{success:s.css`
634
+ `;function Ko(o,r){return r.brutalism?{success:lo(r,r.colors.success[50],r.colors.success[500]),error:lo(r,r.colors.error[50],r.colors.error[500]),warning:lo(r,r.colors.warning[50],r.colors.warning[500]),info:lo(r,r.colors.info[50],r.colors.info[500])}[o]:{success:s.css`
634
635
  background: ${r.colors.success[50]};
635
636
  border-left: ${r.spacing[1]} solid ${r.colors.success[500]};
636
637
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
@@ -654,6 +655,12 @@
654
655
  max-width: 400px;
655
656
  padding: ${({theme:o})=>`${o.spacing[3]} ${o.spacing[4]}`};
656
657
  border-radius: ${({theme:o})=>o.radius.md};
658
+
659
+ @media (max-width: 640px) {
660
+ min-width: unset;
661
+ max-width: unset;
662
+ width: 100%;
663
+ }
657
664
  `,ws={"bottom-right":s.css`
658
665
  bottom: 24px;
659
666
  right: 24px;
@@ -674,9 +681,9 @@
674
681
  animation: ${({$closing:o,$position:r})=>o?s.css`
675
682
  ${qo} 0.2s ease forwards
676
683
  `:r.startsWith("top")?s.css`
677
- ${Uo} 0.2s ease forwards
678
- `:s.css`
679
684
  ${Yo} 0.2s ease forwards
685
+ `:s.css`
686
+ ${Uo} 0.2s ease forwards
680
687
  `};
681
688
 
682
689
  ${({$position:o})=>ws[o]}
@@ -688,9 +695,9 @@
688
695
  animation: ${({$closing:o,$isTop:r})=>o?s.css`
689
696
  ${qo} 0.2s ease forwards
690
697
  `:r?s.css`
691
- ${Uo} 0.2s ease forwards
692
- `:s.css`
693
698
  ${Yo} 0.2s ease forwards
699
+ `:s.css`
700
+ ${Uo} 0.2s ease forwards
694
701
  `};
695
702
 
696
703
  ${({$variant:o,theme:r})=>Ko(o,r)}
@@ -719,6 +726,14 @@
719
726
  left: ${r.spacing[6]};
720
727
  align-items: flex-start;
721
728
  `})[o]}
729
+
730
+ @media (max-width: 640px) {
731
+ top: ${({theme:o})=>o.spacing[4]};
732
+ left: ${({theme:o})=>o.spacing[3]};
733
+ right: ${({theme:o})=>o.spacing[3]};
734
+ bottom: auto;
735
+ align-items: stretch;
736
+ }
722
737
  `,Xo=s.p`
723
738
  flex: 1;
724
739
  margin: 0;
@@ -748,7 +763,7 @@
748
763
  outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
749
764
  outline-offset: 2px;
750
765
  }
751
- `;function Qo({open:o,onClose:r,message:n,variant:e="info",duration:i=4e3,position:l="bottom-right"}){const[d,f]=a.useState(o),[u,p]=a.useState(!1);return a.useEffect(()=>{if(o)f(!0),p(!1);else if(d){p(!0);const $=setTimeout(()=>{f(!1),p(!1)},200);return()=>{clearTimeout($)}}},[o,d]),a.useEffect(()=>{if(!o||i===0)return;const $=setTimeout(r,i);return()=>{clearTimeout($)}},[o,i,r]),d?co.createPortal(t.jsxs(vs,{$position:l,$variant:e,$closing:u,role:"alert","aria-live":"polite",children:[t.jsx(Xo,{children:n}),t.jsx(Jo,{onClick:r,"aria-label":"Close notification",children:t.jsx(uo,{size:14,strokeWidth:2.5})})]}),document.body):null}Qo.displayName="Toast";const Zo=a.createContext(null),Do=5,js="bottom-right";function Cs({toast:o,isTop:r,onClose:n}){return a.useEffect(()=>{const e=o.duration??4e3;if(e===0)return;const i=setTimeout(()=>n(o.id),e);return()=>clearTimeout(i)},[o.id,o.duration,n]),t.jsxs(ks,{$variant:o.variant??"info",$closing:o.closing,$isTop:r,role:"alert","aria-live":"polite",children:[t.jsx(Xo,{children:o.message}),t.jsx(Jo,{onClick:()=>n(o.id),"aria-label":"Close notification",children:t.jsx(uo,{size:14,strokeWidth:2.5})})]})}function zs({children:o}){const[r,n]=a.useState([]),e=a.useCallback(u=>{n(p=>p.map($=>$.id===u?{...$,closing:!0}:$)),setTimeout(()=>{n(p=>p.filter($=>$.id!==u))},200)},[]),i=a.useCallback(u=>{const p=Date.now();n($=>{const m=[...$,{...u,id:p,closing:!1}];return m.length>Do?m.slice(m.length-Do):m})},[]),l=a.useMemo(()=>Object.assign(u=>i(u),{success:(u,p)=>i({...p,message:u,variant:"success"}),error:(u,p)=>i({...p,message:u,variant:"error"}),warning:(u,p)=>i({...p,message:u,variant:"warning"}),info:(u,p)=>i({...p,message:u,variant:"info"})}),[i]),d=r[r.length-1]?.position??js,f=d.startsWith("top");return t.jsxs(Zo.Provider,{value:{toast:l},children:[o,r.length>0&&co.createPortal(t.jsx(Ss,{$position:d,children:r.map(u=>t.jsx(Cs,{toast:u,isTop:f,onClose:e},u.id))}),document.body)]})}function Is(){const o=a.useContext(Zo);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}const Ts=s.form`
766
+ `;function Qo({open:o,onClose:r,message:n,variant:e="info",duration:i=4e3,position:l="bottom-right"}){const[d,p]=a.useState(o),[u,f]=a.useState(!1);return a.useEffect(()=>{if(o)p(!0),f(!1);else if(d){f(!0);const $=setTimeout(()=>{p(!1),f(!1)},200);return()=>{clearTimeout($)}}},[o,d]),a.useEffect(()=>{if(!o||i===0)return;const $=setTimeout(r,i);return()=>{clearTimeout($)}},[o,i,r]),d?fo.createPortal(t.jsxs(vs,{$position:l,$variant:e,$closing:u,role:"alert","aria-live":"polite",children:[t.jsx(Xo,{children:n}),t.jsx(Jo,{onClick:r,"aria-label":"Close notification",children:t.jsx(go,{size:14,strokeWidth:2.5})})]}),document.body):null}Qo.displayName="Toast";const Zo=a.createContext(null),Wo=5,js="bottom-right";function zs({toast:o,isTop:r,onClose:n}){return a.useEffect(()=>{const e=o.duration??4e3;if(e===0)return;const i=setTimeout(()=>n(o.id),e);return()=>clearTimeout(i)},[o.id,o.duration,n]),t.jsxs(ks,{$variant:o.variant??"info",$closing:o.closing,$isTop:r,role:"alert","aria-live":"polite",children:[t.jsx(Xo,{children:o.message}),t.jsx(Jo,{onClick:()=>n(o.id),"aria-label":"Close notification",children:t.jsx(go,{size:14,strokeWidth:2.5})})]})}function Cs({children:o}){const[r,n]=a.useState([]),e=a.useCallback(u=>{n(f=>f.map($=>$.id===u?{...$,closing:!0}:$)),setTimeout(()=>{n(f=>f.filter($=>$.id!==u))},200)},[]),i=a.useCallback(u=>{const f=Date.now();n($=>{const w=[...$,{...u,id:f,closing:!1}];return w.length>Wo?w.slice(w.length-Wo):w})},[]),l=a.useMemo(()=>Object.assign(u=>i(u),{success:(u,f)=>i({...f,message:u,variant:"success"}),error:(u,f)=>i({...f,message:u,variant:"error"}),warning:(u,f)=>i({...f,message:u,variant:"warning"}),info:(u,f)=>i({...f,message:u,variant:"info"})}),[i]),d=r[r.length-1]?.position??js,p=d.startsWith("top");return t.jsxs(Zo.Provider,{value:{toast:l},children:[o,r.length>0&&fo.createPortal(t.jsx(Ss,{$position:d,children:r.map(u=>t.jsx(zs,{toast:u,isTop:p,onClose:e},u.id))}),document.body)]})}function Is(){const o=a.useContext(Zo);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}const Ts=s.form`
752
767
  display: flex;
753
768
  flex-direction: column;
754
769
  gap: ${({theme:o})=>o.spacing[4]};
@@ -766,7 +781,7 @@
766
781
  `,Ms=s.span`
767
782
  font-size: ${({theme:o})=>o.fontSizes.xs};
768
783
  color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
769
- `;function vo({label:o,error:r,helperText:n,required:e,children:i}){const l=a.useId(),d=`${l}-hint`,f=!!(r||n),u=typeof r=="string"?r:void 0,p=a.isValidElement(i)?a.cloneElement(i,{id:l,...f&&{"aria-describedby":d},...r&&{"aria-invalid":!0}}):i;return t.jsxs(Ds,{children:[o&&t.jsxs(Ws,{htmlFor:l,children:[o,e&&t.jsx(Es,{"aria-hidden":"true",children:" *"})]}),p,f&&t.jsx(Ms,{id:d,$error:!!r,children:u??n})]})}vo.displayName="FormField";function Os({initialValues:o,validate:r,onSubmit:n,onError:e}){const[i,l]=a.useState(o),[d,f]=a.useState({}),[u,p]=a.useState({}),[$,m]=a.useState(!1),w=a.useRef(i);w.current=i;const y=a.useCallback(h=>{if(!r)return{};const x=r(h);return Object.fromEntries(Object.entries(x).filter(([,C])=>C!==void 0))},[r]),v=a.useRef(u);v.current=u;const S=a.useCallback(h=>{const{name:x,value:C}=h.target;process.env.NODE_ENV!=="production"&&!x&&console.warn("[useForm] handleChange: field is missing a `name` attribute — value will not be tracked.");const I={...w.current,[x]:C};l(I),v.current[x]&&f(y(I))},[y]),W=a.useCallback(h=>{const{name:x}=h.target;process.env.NODE_ENV!=="production"&&!x&&console.warn("[useForm] handleBlur: field is missing a `name` attribute — touched state will not be tracked."),p(C=>({...C,[x]:!0})),f(y(w.current))},[y]),L=a.useCallback(h=>{h?.preventDefault();const x=Object.keys(w.current).reduce((z,D)=>({...z,[D]:!0}),{});p(x);const C=y(w.current);if(f(C),Object.keys(C).length>0){e?.(C);return}(async()=>{m(!0);try{await n?.(w.current)}finally{m(!1)}})()},[y,n,e]),E=a.useCallback((h,x)=>{l(C=>({...C,[h]:x}))},[]),g=a.useCallback(h=>{l(h??o),f({}),p({}),m(!1)},[o]),j=Object.fromEntries(Object.entries(d).filter(([h])=>u[h]));return{values:i,errors:j,touched:u,handleChange:S,handleBlur:W,handleSubmit:L,setFieldValue:E,reset:g,isSubmitting:$}}const Ls=(o="Required")=>r=>{if(!r.trim())return o},Rs=(o,r)=>n=>{if(n.length<o)return r??`Must be at least ${o} characters`},Ns=(o,r)=>n=>{if(n.length>o)return r??`Must be at most ${o} characters`},Ps=(o="Enter a valid email")=>r=>{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))return o},Fs=(o="Enter a valid URL")=>r=>{try{new URL(r);return}catch{return o}},Vs=(o,r)=>n=>{if(!o.test(n))return r};function Bs(...o){return r=>{for(const n of o){const e=n(r);if(e!==void 0)return e}}}const As=s.div`
784
+ `;function So({label:o,error:r,helperText:n,required:e,children:i}){const l=a.useId(),d=`${l}-hint`,p=!!(r||n),u=typeof r=="string"?r:void 0,f=a.isValidElement(i)?a.cloneElement(i,{id:l,...p&&{"aria-describedby":d},...r&&{"aria-invalid":!0}}):i;return t.jsxs(Ds,{children:[o&&t.jsxs(Ws,{htmlFor:l,children:[o,e&&t.jsx(Es,{"aria-hidden":"true",children:" *"})]}),f,p&&t.jsx(Ms,{id:d,$error:!!r,children:u??n})]})}So.displayName="FormField";function Os({initialValues:o,validate:r,onSubmit:n,onError:e}){const[i,l]=a.useState(o),[d,p]=a.useState({}),[u,f]=a.useState({}),[$,w]=a.useState(!1),v=a.useRef(i);v.current=i;const y=a.useCallback(m=>{if(!r)return{};const b=r(m);return Object.fromEntries(Object.entries(b).filter(([,S])=>S!==void 0))},[r]),k=a.useRef(u);k.current=u;const j=a.useCallback(m=>{const{name:b,value:S}=m.target;process.env.NODE_ENV!=="production"&&!b&&console.warn("[useForm] handleChange: field is missing a `name` attribute — value will not be tracked.");const T={...v.current,[b]:S};l(T),k.current[b]&&p(y(T))},[y]),W=a.useCallback(m=>{const{name:b}=m.target;process.env.NODE_ENV!=="production"&&!b&&console.warn("[useForm] handleBlur: field is missing a `name` attribute — touched state will not be tracked."),f(S=>({...S,[b]:!0})),p(y(v.current))},[y]),O=a.useCallback(m=>{m?.preventDefault();const b=Object.keys(v.current).reduce((I,M)=>({...I,[M]:!0}),{});f(b);const S=y(v.current);if(p(S),Object.keys(S).length>0){e?.(S);return}(async()=>{w(!0);try{await n?.(v.current)}finally{w(!1)}})()},[y,n,e]),E=a.useCallback((m,b)=>{l(S=>({...S,[m]:b}))},[]),x=a.useCallback(m=>{l(m??o),p({}),f({}),w(!1)},[o]),z=Object.fromEntries(Object.entries(d).filter(([m])=>u[m]));return{values:i,errors:z,touched:u,handleChange:j,handleBlur:W,handleSubmit:O,setFieldValue:E,reset:x,isSubmitting:$}}const Rs=(o="Required")=>r=>{if(!r.trim())return o},Ls=(o,r)=>n=>{if(n.length<o)return r??`Must be at least ${o} characters`},Ps=(o,r)=>n=>{if(n.length>o)return r??`Must be at most ${o} characters`},Ns=(o="Enter a valid email")=>r=>{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))return o},Fs=(o="Enter a valid URL")=>r=>{try{new URL(r);return}catch{return o}},Bs=(o,r)=>n=>{if(!o.test(n))return r};function Vs(...o){return r=>{for(const n of o){const e=n(r);if(e!==void 0)return e}}}const As=s.div`
770
785
  display: flex;
771
786
  flex-direction: column;
772
787
  gap: ${({theme:o})=>o.spacing[1]};
@@ -787,7 +802,7 @@
787
802
  &:focus-visible + div {
788
803
  box-shadow: ${({theme:o})=>o.shadows.focusRing};
789
804
  }
790
- `,Ys=s.div`
805
+ `,Us=s.div`
791
806
  position: relative;
792
807
  display: flex;
793
808
  align-items: center;
@@ -821,13 +836,13 @@
821
836
  transform: rotate(45deg) translate(-1px, -1px);
822
837
  }
823
838
  `}
824
- `,Us=s.span`
839
+ `,Ys=s.span`
825
840
  font-size: ${({$size:o="md",theme:r})=>o==="sm"?r.fontSizes.sm:r.fontSizes.md};
826
841
  font-weight: ${({theme:o})=>o.fontWeights.medium};
827
842
  `,qs=s.span`
828
843
  font-size: ${({theme:o})=>o.fontSizes.xs};
829
844
  color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
830
- `;function rr({ref:o,label:r,size:n="md",error:e,helperText:i,disabled:l,checked:d,id:f,color:u,borderColor:p,checkColor:$,...m}){const w=a.useId(),y=f??w,v=typeof e=="string"?e:void 0,S=!!(i||e);return t.jsxs(As,{children:[t.jsxs(_s,{htmlFor:y,$disabled:l,children:[t.jsx(Hs,{id:y,ref:o,type:"checkbox",checked:d,disabled:l,"aria-invalid":!!e,...m}),t.jsx(Ys,{$checked:d,$error:!!e,$disabled:l,$size:n,$color:u,$borderColor:p,$checkColor:$}),r&&t.jsx(Us,{$size:n,children:r})]}),S&&t.jsx(qs,{$error:!!e,children:v??i})]})}rr.displayName="Checkbox";const Ks=s.div`
845
+ `;function rr({ref:o,label:r,size:n="md",error:e,helperText:i,disabled:l,checked:d,id:p,color:u,borderColor:f,checkColor:$,...w}){const v=a.useId(),y=p??v,k=typeof e=="string"?e:void 0,j=!!(i||e);return t.jsxs(As,{children:[t.jsxs(_s,{htmlFor:y,$disabled:l,children:[t.jsx(Hs,{id:y,ref:o,type:"checkbox",checked:d,disabled:l,"aria-invalid":!!e,...w}),t.jsx(Us,{$checked:d,$error:!!e,$disabled:l,$size:n,$color:u,$borderColor:f,$checkColor:$}),r&&t.jsx(Ys,{$size:n,children:r})]}),j&&t.jsx(qs,{$error:!!e,children:k??i})]})}rr.displayName="Checkbox";const Ks=s.div`
831
846
  display: flex;
832
847
  flex-direction: column;
833
848
  gap: ${({theme:o})=>o.spacing[1]};
@@ -886,7 +901,7 @@
886
901
  `,Zs=s.span`
887
902
  font-size: ${({theme:o})=>o.fontSizes.xs};
888
903
  color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
889
- `;function sr({ref:o,label:r,size:n="md",error:e,helperText:i,disabled:l,checked:d,id:f,color:u,borderColor:p,...$}){const m=a.useId(),w=f??m,y=!!(i||e);return t.jsxs(Ks,{children:[t.jsxs(Gs,{htmlFor:w,$disabled:l,children:[t.jsx(Xs,{id:w,ref:o,type:"radio",checked:d,disabled:l,"aria-invalid":!!e,...$}),t.jsx(Js,{$checked:d,$error:e,$disabled:l,$size:n,$color:u,$borderColor:p}),r&&t.jsx(Qs,{$size:n,children:r})]}),y&&t.jsx(Zs,{$error:e,children:i})]})}sr.displayName="Radio";const on=s.div`
904
+ `;function sr({ref:o,label:r,size:n="md",error:e,helperText:i,disabled:l,checked:d,id:p,color:u,borderColor:f,...$}){const w=a.useId(),v=p??w,y=!!(i||e);return t.jsxs(Ks,{children:[t.jsxs(Gs,{htmlFor:v,$disabled:l,children:[t.jsx(Xs,{id:v,ref:o,type:"radio",checked:d,disabled:l,"aria-invalid":!!e,...$}),t.jsx(Js,{$checked:d,$error:e,$disabled:l,$size:n,$color:u,$borderColor:f}),r&&t.jsx(Qs,{$size:n,children:r})]}),y&&t.jsx(Zs,{$error:e,children:i})]})}sr.displayName="Radio";const on=s.div`
890
905
  display: flex;
891
906
  flex-direction: column;
892
907
  gap: ${({theme:o})=>o.spacing[1]};
@@ -955,7 +970,7 @@
955
970
  `,tn=s.span`
956
971
  font-size: ${({$size:o="md",theme:r})=>o==="sm"?r.fontSizes.sm:r.fontSizes.md};
957
972
  font-weight: ${({theme:o})=>o.fontWeights.medium};
958
- `;function nr({ref:o,label:r,size:n="md",disabled:e,checked:i,id:l,color:d,borderColor:f,...u}){const p=a.useId(),$=l??p;return t.jsx(on,{children:t.jsxs(rn,{htmlFor:$,$disabled:e,children:[t.jsx(sn,{id:$,ref:o,type:"checkbox",role:"switch",checked:i,disabled:e,...u}),t.jsx(nn,{$checked:i,$size:n,$color:d,$borderColor:f}),r&&t.jsx(tn,{$size:n,children:r})]})})}nr.displayName="Switch";const en=s.div`
973
+ `;function nr({ref:o,label:r,size:n="md",disabled:e,checked:i,id:l,color:d,borderColor:p,...u}){const f=a.useId(),$=l??f;return t.jsx(on,{children:t.jsxs(rn,{htmlFor:$,$disabled:e,children:[t.jsx(sn,{id:$,ref:o,type:"checkbox",role:"switch",checked:i,disabled:e,...u}),t.jsx(nn,{$checked:i,$size:n,$color:d,$borderColor:p}),r&&t.jsx(tn,{$size:n,children:r})]})})}nr.displayName="Switch";const en=s.div`
959
974
  border-radius: ${({theme:o})=>o.radius.md};
960
975
  background: ${({theme:o})=>o.colors.neutral[0]};
961
976
  overflow: hidden;
@@ -1014,11 +1029,11 @@
1014
1029
  align-items: flex-start;
1015
1030
  gap: ${({theme:o})=>o.spacing[2]};
1016
1031
  }
1017
- `,fn=s.div`
1032
+ `,pn=s.div`
1018
1033
  display: flex;
1019
1034
  align-items: center;
1020
1035
  gap: ${({theme:o})=>o.spacing[2]};
1021
- `,pn=s.span`
1036
+ `,fn=s.span`
1022
1037
  display: inline-flex;
1023
1038
  align-items: center;
1024
1039
  justify-content: center;
@@ -1026,29 +1041,29 @@
1026
1041
  transition: transform 0.2s ease;
1027
1042
  transform: ${({$open:o})=>o?"rotate(180deg)":"rotate(0deg)"};
1028
1043
  color: ${({theme:o,$accentColor:r})=>r??o.colors.neutral[500]};
1029
- `,$n=s.div`
1044
+ `,gn=s.div`
1030
1045
  display: grid;
1031
1046
  grid-template-rows: ${({$open:o})=>o?"1fr":"0fr"};
1032
1047
  transition: grid-template-rows 0.2s ease;
1033
- `,gn=s.div`
1048
+ `,$n=s.div`
1034
1049
  overflow: hidden;
1035
1050
  `,bn=s.div`
1036
1051
  padding: ${({theme:o})=>o.spacing[4]};
1037
1052
  border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
1038
- `;function tr({title:o,children:r,defaultOpen:n=!1,open:e,onToggle:i,subtitle:l,headerActions:d,accentColor:f}){const[u,p]=a.useState(n),$=a.useId(),m=e!==void 0,w=m?e:u,y=()=>{const v=!w;m||p(v),i?.(v)};return t.jsxs(en,{$accentColor:f,children:[t.jsxs(an,{type:"button",$open:w,$accentColor:f,"aria-expanded":w,"aria-controls":$,onClick:y,children:[t.jsxs(ln,{children:[t.jsx(cn,{children:o}),(l||d)&&t.jsxs(un,{children:[l&&t.jsx(dn,{children:l}),d&&t.jsx(fn,{onClick:v=>v.stopPropagation(),children:d})]})]}),t.jsx(pn,{$open:w,$accentColor:f,"aria-hidden":"true",children:t.jsx(Bo,{size:18,strokeWidth:2.5})})]}),t.jsx($n,{$open:w,children:t.jsx(gn,{id:$,role:"region","aria-label":o,children:t.jsx(bn,{children:r})})})]})}tr.displayName="CollapsibleCard";const xn=s.keyframes`
1053
+ `;function tr({title:o,children:r,defaultOpen:n=!1,open:e,onToggle:i,subtitle:l,headerActions:d,accentColor:p}){const[u,f]=a.useState(n),$=a.useId(),w=e!==void 0,v=w?e:u,y=()=>{const k=!v;w||f(k),i?.(k)};return t.jsxs(en,{$accentColor:p,children:[t.jsxs(an,{type:"button",$open:v,$accentColor:p,"aria-expanded":v,"aria-controls":$,onClick:y,children:[t.jsxs(ln,{children:[t.jsx(cn,{children:o}),(l||d)&&t.jsxs(un,{children:[l&&t.jsx(dn,{children:l}),d&&t.jsx(pn,{onClick:k=>k.stopPropagation(),children:d})]})]}),t.jsx(fn,{$open:v,$accentColor:p,"aria-hidden":"true",children:t.jsx(Ao,{size:18,strokeWidth:2.5})})]}),t.jsx(gn,{$open:v,children:t.jsx($n,{id:$,role:"region","aria-label":o,children:t.jsx(bn,{children:r})})})]})}tr.displayName="CollapsibleCard";const xn=s.keyframes`
1039
1054
  to { transform: rotate(360deg); }
1040
1055
  `,yn={sm:"16px",md:"24px",lg:"40px"},hn={thin:"2px",normal:"3px",bold:"5px"},mn=s.span`
1041
1056
  display: inline-block;
1042
1057
  border-radius: 50%;
1043
1058
  animation: ${xn} 0.7s linear infinite;
1044
1059
 
1045
- ${({$size:o="md",$weight:r="normal",$color:n,theme:e})=>{const i=yn[o],l=hn[r],d=e.colors.neutral[200],f=n??e.colors.primary[500];return s.css`
1060
+ ${({$size:o="md",$weight:r="normal",$color:n,theme:e})=>{const i=yn[o],l=hn[r],d=e.colors.neutral[200],p=n??e.colors.primary[500];return s.css`
1046
1061
  width: ${i};
1047
1062
  height: ${i};
1048
1063
  border: ${l} solid ${d};
1049
- border-top-color: ${f};
1064
+ border-top-color: ${p};
1050
1065
  `}}
1051
- `;function er({size:o="md",weight:r="normal",color:n,label:e="Loading..."}){return t.jsx(mn,{$size:o,$weight:r,$color:n,role:"status","aria-label":e})}er.displayName="Spinner";const wn=7,Wo=3,Eo=1;function vn({defaultSort:o,defaultPage:r=1}={}){const[n,e]=a.useState(o??null),[i,l]=a.useState(r);return{sort:n,page:i,onSortChange:u=>{e(u),l(1)},onPageChange:u=>{l(u)}}}function kn(o,r){return o?.key!==r?{key:r,direction:"asc"}:o.direction==="asc"?{key:r,direction:"desc"}:null}function Sn({data:o,sort:r,defaultSort:n,onSortChange:e}){const i=r!==void 0,[l,d]=a.useState(n??null),f=i?r??null:l,u=$=>{const m=kn(f,$);return i||d(m),e?.(m),m},p=a.useMemo(()=>i||!f?o:[...o].sort(($,m)=>{const w=$[f.key],y=m[f.key],v=w<y?-1:w>y?1:0;return f.direction==="asc"?v:-v}),[o,f,i]);return{activeSort:f,sortedData:p,handleSort:u}}function jn(o,r){if(r<=wn)return Array.from({length:r},(e,i)=>i+1);const n=[1];o>Wo&&n.push("...");for(let e=Math.max(2,o-Eo);e<=Math.min(r-1,o+Eo);e++)n.push(e);return o<r-Wo+1&&n.push("..."),n.push(r),n}function Cn({data:o,pageSize:r,page:n,defaultPage:e,totalRows:i,onPageChange:l}){const d=n!==void 0,[f,u]=a.useState(e??1),p=d?n:f,$=S=>{d||u(S),l?.(S)},m=d||i!==void 0,w=i??o.length,y=r?Math.max(1,Math.ceil(w/r)):1,v=a.useMemo(()=>{if(!r||m)return o;const S=(p-1)*r;return o.slice(S,S+r)},[o,r,p,m]);return{activePage:p,totalPages:y,displayData:v,handlePageChange:$}}const ir=(o,r)=>o==="sm"?`${r.spacing[1]} ${r.spacing[2]}`:o==="lg"?`${r.spacing[3]} ${r.spacing[4]}`:`${r.spacing[2]} ${r.spacing[3]}`,zn=s.div`
1066
+ `;function er({size:o="md",weight:r="normal",color:n,label:e="Loading..."}){return t.jsx(mn,{$size:o,$weight:r,$color:n,role:"status","aria-label":e})}er.displayName="Spinner";const wn=7,Eo=3,Mo=1;function vn({defaultSort:o,defaultPage:r=1}={}){const[n,e]=a.useState(o??null),[i,l]=a.useState(r);return{sort:n,page:i,onSortChange:u=>{e(u),l(1)},onPageChange:u=>{l(u)}}}function kn(o,r){return o?.key!==r?{key:r,direction:"asc"}:o.direction==="asc"?{key:r,direction:"desc"}:null}function Sn({data:o,sort:r,defaultSort:n,onSortChange:e}){const i=r!==void 0,[l,d]=a.useState(n??null),p=i?r??null:l,u=$=>{const w=kn(p,$);return i||d(w),e?.(w),w},f=a.useMemo(()=>i||!p?o:[...o].sort(($,w)=>{const v=$[p.key],y=w[p.key],k=v<y?-1:v>y?1:0;return p.direction==="asc"?k:-k}),[o,p,i]);return{activeSort:p,sortedData:f,handleSort:u}}function jn(o,r){if(r<=wn)return Array.from({length:r},(e,i)=>i+1);const n=[1];o>Eo&&n.push("...");for(let e=Math.max(2,o-Mo);e<=Math.min(r-1,o+Mo);e++)n.push(e);return o<r-Eo+1&&n.push("..."),n.push(r),n}function zn({data:o,pageSize:r,page:n,defaultPage:e,totalRows:i,onPageChange:l}){const d=n!==void 0,[p,u]=a.useState(e??1),f=d?n:p,$=j=>{d||u(j),l?.(j)},w=i!==void 0,v=i??o.length,y=r?Math.max(1,Math.ceil(v/r)):1,k=a.useMemo(()=>{if(!r||w)return o;const j=(f-1)*r;return o.slice(j,j+r)},[o,r,f,w]);return{activePage:f,totalPages:y,displayData:k,handlePageChange:$}}const ir=(o,r)=>o==="sm"?`${r.spacing[1]} ${r.spacing[2]}`:o==="lg"?`${r.spacing[3]} ${r.spacing[4]}`:`${r.spacing[2]} ${r.spacing[3]}`,Cn=s.div`
1052
1067
  width: 100%;
1053
1068
 
1054
1069
  ${({theme:o,$borderColor:r})=>o.brutalism?s.css`
@@ -1063,19 +1078,25 @@
1063
1078
  overflow: hidden;
1064
1079
  `}
1065
1080
 
1066
- overflow-x: auto;
1067
- ${({$stickyHeader:o})=>o&&s.css`
1068
- overflow-y: auto;
1069
- `}
1070
- `,In=s.table`
1071
- width: 100%;
1081
+ ${({$stickyPagination:o})=>o?s.css`
1082
+ display: flex;
1083
+ flex-direction: column;
1084
+ `:s.css`
1085
+ overflow-x: auto;
1086
+ `}
1087
+ `,In=s.div`
1088
+ overflow: auto;
1089
+ min-height: 0;
1090
+ `,Tn=s.table`
1091
+ width: max-content;
1092
+ min-width: 100%;
1072
1093
  border-collapse: collapse;
1073
1094
  font-size: ${({$size:o,theme:r})=>({sm:r.fontSizes.sm,md:r.fontSizes.md,lg:r.fontSizes.lg})[o]};
1074
1095
 
1075
1096
  caption {
1076
1097
  padding: ${({theme:o})=>o.spacing[2]} 0;
1077
1098
  }
1078
- `,Tn=s.thead`
1099
+ `,Dn=s.thead`
1079
1100
  ${({$stickyHeader:o})=>o&&s.css`
1080
1101
  position: sticky;
1081
1102
  top: 0;
@@ -1095,7 +1116,7 @@
1095
1116
  --th-text: ${o.colors.neutral[600]};
1096
1117
  --th-sep: ${n??o.colors.neutral[300]};
1097
1118
  `}
1098
- `,Dn=s.tbody`
1119
+ `,Wn=s.tbody`
1099
1120
  ${({$rowColor:o})=>o&&s.css`
1100
1121
  tr {
1101
1122
  background-color: ${o};
@@ -1115,7 +1136,7 @@
1115
1136
  tr:hover td {
1116
1137
  background-color: rgba(0, 0, 0, 0.04);
1117
1138
  }
1118
- `,io=s.tr``,Wn=s(io)`
1139
+ `,co=s.tr``,En=s(co)`
1119
1140
  cursor: pointer;
1120
1141
 
1121
1142
  td {
@@ -1132,7 +1153,7 @@
1132
1153
  box-shadow: inset 4px 0 0
1133
1154
  ${({$accentColor:o,theme:r})=>o??r.colors.neutral[900]};
1134
1155
  }
1135
- `,En=s.th`
1156
+ `,Mn=s.th`
1136
1157
  background-color: var(--th-bg);
1137
1158
  color: var(--th-text);
1138
1159
  text-align: left;
@@ -1150,7 +1171,7 @@
1150
1171
  }
1151
1172
  `}
1152
1173
  `}
1153
- `,Mn=s.button`
1174
+ `,On=s.button`
1154
1175
  display: inline-flex;
1155
1176
  align-items: center;
1156
1177
  gap: ${({theme:o})=>o.spacing[1]};
@@ -1169,7 +1190,7 @@
1169
1190
  outline-offset: 2px;
1170
1191
  border-radius: 2px;
1171
1192
  }
1172
- `,On=s.span`
1193
+ `,Rn=s.span`
1173
1194
  opacity: 0.5;
1174
1195
  display: inline-flex;
1175
1196
  align-items: center;
@@ -1198,10 +1219,10 @@
1198
1219
  padding: ${({theme:o})=>`${o.spacing[4]} ${o.spacing[3]}`};
1199
1220
  font-size: ${({theme:o})=>o.fontSizes.sm};
1200
1221
  border-bottom: none;
1201
- `,Rn=s.keyframes`
1222
+ `,Pn=s.keyframes`
1202
1223
  0% { background-position: -400px 0; }
1203
1224
  100% { background-position: 400px 0; }
1204
- `,Nn=s(ar)``,Pn=s.div`
1225
+ `,Nn=s(ar)``,Fn=s.div`
1205
1226
  height: 14px;
1206
1227
  border-radius: 4px;
1207
1228
  background: linear-gradient(
@@ -1211,13 +1232,15 @@
1211
1232
  ${({theme:o})=>o.colors.neutral[200]} 75%
1212
1233
  );
1213
1234
  background-size: 800px 100%;
1214
- animation: ${Rn} 1.6s ease-in-out infinite;
1215
- `,Fn=s.div`
1235
+ animation: ${Pn} 1.6s ease-in-out infinite;
1236
+ `,Bn=s.div`
1216
1237
  display: flex;
1217
1238
  align-items: center;
1218
- justify-content: center;
1239
+ justify-content: ${({$hasPageSizeOptions:o})=>o?"space-between":"center"};
1219
1240
  gap: ${({theme:o})=>o.spacing[1]};
1220
1241
  padding: ${({theme:o})=>`${o.spacing[2]} ${o.spacing[3]}`};
1242
+ flex-shrink: 0;
1243
+ flex-wrap: wrap;
1221
1244
 
1222
1245
  ${({theme:o})=>o.brutalism?s.css`
1223
1246
  border-top: ${o.brutalism.borderWidth} solid
@@ -1225,7 +1248,46 @@
1225
1248
  `:s.css`
1226
1249
  border-top: 1px solid ${o.colors.neutral[200]};
1227
1250
  `}
1228
- `,xo=s.button`
1251
+ `,Vn=s.label`
1252
+ display: flex;
1253
+ align-items: center;
1254
+ gap: ${({theme:o})=>o.spacing[2]};
1255
+ font-size: ${({theme:o})=>o.fontSizes.sm};
1256
+ color: ${({theme:o})=>o.colors.neutral[500]};
1257
+ white-space: nowrap;
1258
+
1259
+ select {
1260
+ padding: ${({theme:o})=>`${o.spacing[1]} ${o.spacing[2]}`};
1261
+ font-size: ${({theme:o})=>o.fontSizes.sm};
1262
+ font-family: inherit;
1263
+ color: ${({theme:o})=>o.colors.neutral[900]};
1264
+ background-color: ${({theme:o})=>o.colors.neutral[0]};
1265
+ cursor: pointer;
1266
+
1267
+ ${({theme:o})=>o.brutalism?s.css`
1268
+ border: ${o.brutalism.borderWidth} solid
1269
+ ${o.colors.neutral[900]};
1270
+ `:s.css`
1271
+ border: 1px solid ${o.colors.neutral[300]};
1272
+ border-radius: ${o.radius.md};
1273
+
1274
+ &:hover {
1275
+ border-color: ${o.colors.neutral[400]};
1276
+ }
1277
+
1278
+ &:focus {
1279
+ outline: 2px solid ${o.colors.primary[500]};
1280
+ outline-offset: 1px;
1281
+ }
1282
+ `}
1283
+ }
1284
+ `,An=s.div`
1285
+ display: flex;
1286
+ align-items: center;
1287
+ gap: ${({theme:o})=>o.spacing[1]};
1288
+ flex-wrap: wrap;
1289
+ justify-content: center;
1290
+ `,yo=s.button`
1229
1291
  display: inline-flex;
1230
1292
  align-items: center;
1231
1293
  justify-content: center;
@@ -1268,12 +1330,12 @@
1268
1330
  outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
1269
1331
  outline-offset: 2px;
1270
1332
  }
1271
- `,Vn=4;function Bn(o,r){return o?.key!==r?t.jsx(Or,{size:14}):o.direction==="asc"?t.jsx(Rr,{size:14}):t.jsx(Er,{size:14})}function lr({columns:o,data:r,rowKey:n,size:e="md",striped:i,bordered:l,stickyHeader:d,caption:f,emptyMessage:u="No data",loading:p,sort:$,defaultSort:m,onSortChange:w,pageSize:y,page:v,defaultPage:S,totalRows:W,onPageChange:L,onChange:E,onRowClick:g,borderColor:j,headerColor:h,rowColor:x,stripeColor:C,className:I,style:z}){const{activeSort:D,sortedData:P,handleSort:F}=Sn({data:r,sort:$,defaultSort:m,onSortChange:w}),{activePage:O,totalPages:V,displayData:q,handlePageChange:N}=Cn({data:P,pageSize:y,page:v,defaultPage:S,totalRows:W,onPageChange:L}),_=k=>{const M=F(k);E?.({sort:M,page:O})},K=k=>{N(k),E?.({sort:D,page:k})},H=(k,M)=>String(n?k[n]:M),G=!p&&q.length===0,X=y??Vn;return t.jsxs(zn,{$borderColor:j,$stickyHeader:d,className:I,style:z,children:[t.jsxs(In,{$size:e,children:[f&&t.jsx("caption",{children:f}),t.jsx(Tn,{$headerColor:h,$borderColor:j,$stickyHeader:d,children:t.jsx(io,{children:o.map(k=>t.jsx(En,{$size:e,$bordered:l,scope:"col",style:k.width?{width:k.width}:void 0,children:k.sortable?t.jsxs(Mn,{type:"button",onClick:()=>_(k.key),"aria-label":`Sort by ${k.header}${D?.key===k.key?`, ${D.direction}ending`:""}`,children:[k.header,t.jsx(On,{"aria-hidden":"true",children:Bn(D,k.key)})]}):k.header},k.key))})}),t.jsx(Dn,{$striped:i,$rowColor:x,$stripeColor:C,children:p?Array.from({length:X}).map((k,M)=>t.jsx(io,{children:o.map(B=>t.jsx(Nn,{$size:e,$bordered:l,$borderColor:j,children:t.jsx(Pn,{})},B.key))},M)):G?t.jsx("tr",{children:t.jsx(Ln,{colSpan:o.length,children:u})}):q.map((k,M)=>{const B=g?Wn:io;return t.jsx(B,{onClick:g?()=>g(k):void 0,$accentColor:g?j:void 0,children:o.map(A=>t.jsx(ar,{$size:e,$bordered:l,$borderColor:j,children:A.render?A.render(k[A.key],k,M):String(k[A.key]??"")||" "},A.key))},H(k,M))})})]}),y&&V>1&&t.jsxs(Fn,{children:[t.jsx(xo,{type:"button",onClick:()=>K(O-1),disabled:O<=1,"aria-label":"Previous page",children:"←"}),jn(O,V).map((k,M)=>k==="..."?t.jsx("span",{"aria-hidden":"true",style:{padding:"0 4px"},children:"…"},`e${M}`):t.jsx(xo,{type:"button",$active:k===O,onClick:()=>K(k),"aria-label":`Page ${k}`,"aria-current":k===O?"page":void 0,children:k},k)),t.jsx(xo,{type:"button",onClick:()=>K(O+1),disabled:O>=V,"aria-label":"Next page",children:"→"})]})]})}lr.displayName="Table";const An=s.p`
1333
+ `,_n=4;function Hn(o,r){return o?.key!==r?t.jsx(Or,{size:14}):o.direction==="asc"?t.jsx(Lr,{size:14}):t.jsx(Er,{size:14})}function lr({columns:o,data:r,rowKey:n,size:e="md",striped:i,bordered:l,stickyHeader:d,stickyPagination:p,caption:u,emptyMessage:f="No data",loading:$,sort:w,defaultSort:v,onSortChange:y,pageSize:k,page:j,defaultPage:W,totalRows:O,onPageChange:E,pageSizeOptions:x,onPageSizeChange:z,onChange:m,onRowClick:b,borderColor:S,headerColor:T,rowColor:I,stripeColor:M,className:N,style:P}){const{activeSort:L,sortedData:H,handleSort:ro}=Sn({data:r,sort:w,defaultSort:v,onSortChange:y}),{activePage:D,totalPages:V,displayData:so,handlePageChange:U}=zn({data:H,pageSize:k,page:j,defaultPage:W,totalRows:O,onPageChange:E}),G=h=>{const F=ro(h);m?.({sort:F,page:D})},Y=h=>{U(h),m?.({sort:L,page:h})},no=(h,F)=>String(n?h[n]:F),B=!$&&so.length===0,A=k??_n,q=!!k&&V>1,K=!!x?.length,J=t.jsxs(Tn,{$size:e,children:[u&&t.jsx("caption",{children:u}),t.jsx(Dn,{$headerColor:T,$borderColor:S,$stickyHeader:d,children:t.jsx(co,{children:o.map(h=>t.jsx(Mn,{$size:e,$bordered:l,scope:"col",style:h.width?{width:h.width}:void 0,children:h.sortable?t.jsxs(On,{type:"button",onClick:()=>G(h.key),"aria-label":`Sort by ${h.header}${L?.key===h.key?`, ${L.direction}ending`:""}`,children:[h.header,t.jsx(Rn,{"aria-hidden":"true",children:Hn(L,h.key)})]}):h.header},h.key))})}),t.jsx(Wn,{$striped:i,$rowColor:I,$stripeColor:M,children:$?Array.from({length:A}).map((h,F)=>t.jsx(co,{children:o.map(Z=>t.jsx(Nn,{$size:e,$bordered:l,$borderColor:S,children:t.jsx(Fn,{})},Z.key))},F)):B?t.jsx("tr",{children:t.jsx(Ln,{colSpan:o.length,children:f})}):so.map((h,F)=>{const Z=b?En:co;return t.jsx(Z,{onClick:b?()=>b(h):void 0,$accentColor:b?S:void 0,children:o.map(g=>t.jsx(ar,{$size:e,$bordered:l,$borderColor:S,children:g.render?g.render(h[g.key],h,F):String(h[g.key]??"")||" "},g.key))},no(h,F))})})]}),Q=(q||K)&&t.jsxs(Bn,{$hasPageSizeOptions:K,children:[K&&t.jsxs(Vn,{children:["Rows per page:",t.jsx(wo,{size:"sm",value:String(k),options:x.map(h=>({value:String(h),label:String(h)})),onChange:h=>z?.(Number(h.target.value)),"aria-label":"Rows per page"})]}),q&&t.jsxs(An,{children:[t.jsx(yo,{type:"button",onClick:()=>Y(D-1),disabled:D<=1,"aria-label":"Previous page",children:"←"}),jn(D,V).map((h,F)=>h==="..."?t.jsx("span",{"aria-hidden":"true",style:{padding:"0 4px"},children:"…"},`e${F}`):t.jsx(yo,{type:"button",$active:h===D,onClick:()=>Y(h),"aria-label":`Page ${h}`,"aria-current":h===D?"page":void 0,children:h},h)),t.jsx(yo,{type:"button",onClick:()=>Y(D+1),disabled:D>=V,"aria-label":"Next page",children:"→"})]})]});return t.jsxs(Cn,{$borderColor:S,$stickyPagination:p,className:N,style:P,children:[p?t.jsx(In,{children:J}):J,Q]})}lr.displayName="Table";const Un=s.p`
1272
1334
  margin: 0;
1273
1335
  font-size: ${({theme:o})=>o.fontSizes.md};
1274
1336
  color: ${({theme:o})=>o.colors.neutral[600]};
1275
1337
  line-height: 1.5;
1276
- `,_n=s.button`
1338
+ `,Yn=s.button`
1277
1339
  display: inline-flex;
1278
1340
  align-items: center;
1279
1341
  justify-content: center;
@@ -1313,12 +1375,12 @@
1313
1375
  box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
1314
1376
  }
1315
1377
  `}
1316
- `;function ko({open:o,title:r="Are you sure?",message:n,confirmLabel:e="Confirm",cancelLabel:i="Cancel",variant:l="default",size:d="sm",onConfirm:f,onCancel:u}){return t.jsx(wo,{open:o,onClose:u,title:r,size:d,closeOnBackdrop:!1,footer:t.jsxs(t.Fragment,{children:[t.jsx(ao,{variant:"outline",onClick:u,children:i}),l==="danger"?t.jsx(_n,{type:"button",onClick:f,children:e}):t.jsx(ao,{variant:"primary",onClick:f,children:e})]}),children:t.jsx(An,{children:n})})}ko.displayName="ConfirmDialog";const cr=a.createContext(null);function Hn({children:o}){const[r,n]=a.useState(null),e=a.useCallback(d=>new Promise(f=>{n({...d,resolve:f})}),[]),i=()=>{r?.resolve(!0),n(null)},l=()=>{r?.resolve(!1),n(null)};return t.jsxs(cr.Provider,{value:{confirm:e},children:[o,r&&t.jsx(ko,{open:!0,title:r.title,message:r.message,confirmLabel:r.confirmLabel,cancelLabel:r.cancelLabel,variant:r.variant,size:r.size,onConfirm:i,onCancel:l})]})}function Yn(){const o=a.useContext(cr);if(!o)throw new Error("useConfirm must be used within a ConfirmProvider");return o.confirm}const Un=s.div`
1378
+ `;function jo({open:o,title:r="Are you sure?",message:n,confirmLabel:e="Confirm",cancelLabel:i="Cancel",variant:l="default",size:d="sm",onConfirm:p,onCancel:u}){return t.jsx(ko,{open:o,onClose:u,title:r,size:d,closeOnBackdrop:!1,footer:t.jsxs(t.Fragment,{children:[t.jsx(uo,{variant:"outline",onClick:u,children:i}),l==="danger"?t.jsx(Yn,{type:"button",onClick:p,children:e}):t.jsx(uo,{variant:"primary",onClick:p,children:e})]}),children:t.jsx(Un,{children:n})})}jo.displayName="ConfirmDialog";const cr=a.createContext(null);function qn({children:o}){const[r,n]=a.useState(null),e=a.useCallback(d=>new Promise(p=>{n({...d,resolve:p})}),[]),i=()=>{r?.resolve(!0),n(null)},l=()=>{r?.resolve(!1),n(null)};return t.jsxs(cr.Provider,{value:{confirm:e},children:[o,r&&t.jsx(jo,{open:!0,title:r.title,message:r.message,confirmLabel:r.confirmLabel,cancelLabel:r.cancelLabel,variant:r.variant,size:r.size,onConfirm:i,onCancel:l})]})}function Kn(){const o=a.useContext(cr);if(!o)throw new Error("useConfirm must be used within a ConfirmProvider");return o.confirm}const Gn=s.div`
1317
1379
  position: relative;
1318
1380
  display: inline-flex;
1319
1381
  flex-direction: column;
1320
1382
  gap: ${({theme:o})=>o.spacing[1]};
1321
- `,qn=s.div`
1383
+ `,Xn=s.div`
1322
1384
  display: flex;
1323
1385
  align-items: center;
1324
1386
  border-radius: ${({theme:o})=>o.radius.md};
@@ -1363,19 +1425,19 @@
1363
1425
  outline: none;
1364
1426
  box-shadow: ${({theme:o})=>o.shadows.focusRing};
1365
1427
  }
1366
- `,Kn=s.span`
1428
+ `,Jn=s.span`
1367
1429
  flex: 1;
1368
1430
  color: ${({$hasValue:o,theme:r})=>o?r.colors.neutral[900]:r.colors.neutral[400]};
1369
1431
  white-space: nowrap;
1370
1432
  overflow: hidden;
1371
1433
  text-overflow: ellipsis;
1372
- `,Gn=s.span`
1434
+ `,Qn=s.span`
1373
1435
  display: inline-flex;
1374
1436
  align-items: center;
1375
1437
  margin-left: ${({theme:o})=>o.spacing[2]};
1376
1438
  color: ${({theme:o})=>o.colors.neutral[500]};
1377
1439
  flex-shrink: 0;
1378
- `,Xn=s.button`
1440
+ `,Zn=s.button`
1379
1441
  display: inline-flex;
1380
1442
  align-items: center;
1381
1443
  margin-left: ${({theme:o})=>o.spacing[2]};
@@ -1398,7 +1460,7 @@
1398
1460
  `;s.span`
1399
1461
  font-size: ${({theme:o})=>o.fontSizes.xs};
1400
1462
  color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
1401
- `;const Jn=s.div`
1463
+ `;const ot=s.div`
1402
1464
  position: absolute;
1403
1465
  top: calc(100% + 4px);
1404
1466
  left: 0;
@@ -1417,12 +1479,12 @@
1417
1479
  border: 1px solid ${o.colors.neutral[200]};
1418
1480
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
1419
1481
  `}
1420
- `,Qn=s.div`
1482
+ `,rt=s.div`
1421
1483
  display: flex;
1422
1484
  align-items: center;
1423
1485
  justify-content: space-between;
1424
1486
  margin-bottom: ${({theme:o})=>o.spacing[3]};
1425
- `,Mo=s.button`
1487
+ `,Oo=s.button`
1426
1488
  display: inline-flex;
1427
1489
  align-items: center;
1428
1490
  justify-content: center;
@@ -1452,15 +1514,15 @@
1452
1514
  transform: translate(1px, 1px);
1453
1515
  }
1454
1516
  `}
1455
- `,Zn=s.span`
1517
+ `,st=s.span`
1456
1518
  font-weight: ${({theme:o})=>o.fontWeights.semibold};
1457
1519
  font-size: ${({theme:o})=>o.fontSizes.md};
1458
1520
  color: ${({theme:o})=>o.colors.neutral[900]};
1459
- `,ot=s.div`
1521
+ `,nt=s.div`
1460
1522
  display: grid;
1461
1523
  grid-template-columns: repeat(7, 1fr);
1462
1524
  gap: ${({theme:o})=>o.spacing[.5]};
1463
- `,rt=s.span`
1525
+ `,tt=s.span`
1464
1526
  display: flex;
1465
1527
  align-items: center;
1466
1528
  justify-content: center;
@@ -1469,7 +1531,7 @@
1469
1531
  color: ${({theme:o})=>o.colors.neutral[500]};
1470
1532
  padding: ${({theme:o})=>o.spacing[1]};
1471
1533
  margin-bottom: ${({theme:o})=>o.spacing[.5]};
1472
- `,yo=s.button`
1534
+ `,ho=s.button`
1473
1535
  display: flex;
1474
1536
  align-items: center;
1475
1537
  justify-content: center;
@@ -1507,7 +1569,7 @@
1507
1569
  box-shadow: 2px 2px 0 ${i.colors.neutral[900]};
1508
1570
  `}
1509
1571
  `}
1510
- `,st=["January","February","March","April","May","June","July","August","September","October","November","December"],nt=["Su","Mo","Tu","We","Th","Fr","Sa"];function Oo(o,r){return new Date(o,r+1,0).getDate()}function tt(o,r){return new Date(o,r,1).getDay()}function so(o,r){return o.getFullYear()===r.getFullYear()&&o.getMonth()===r.getMonth()&&o.getDate()===r.getDate()}function et(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 Lo(o){return o.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Ro(o){return o.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}function ho(o){if(!o)return null;const r=o.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),e=parseInt(r[1],10),i=parseInt(r[2],10);return isNaN(n)||isNaN(e)||isNaN(i)?null:new Date(n,e-1,i)}function Z(o){const r=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),e=String(o.getDate()).padStart(2,"0");return`${r}-${n}-${e}`}function dr({name:o,label:r,value:n,onChange:e,placeholder:i="Select date...",size:l="md",disabled:d=!1,clearable:f=!1,minDate:u,maxDate:p,formatDate:$,error:m,required:w,helperText:y,mode:v="single",nameFrom:S,nameTo:W,valueFrom:L,valueTo:E}){const g=v==="range",j=ho(n??""),h=ho(L??""),x=ho(E??""),C=new Date,I=()=>g?h??x??C:j??C,[z,D]=a.useState(!1),[P,F]=a.useState(()=>I().getFullYear()),[O,V]=a.useState(()=>I().getMonth()),[q,N]=a.useState("from"),_=a.useRef(null);a.useEffect(()=>{if(!z)return;const b=R=>{_.current&&!_.current.contains(R.target)&&(D(!1),g&&N("from"))};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[z,g]),a.useEffect(()=>{!g&&j&&(F(j.getFullYear()),V(j.getMonth()))},[n,g]),a.useEffect(()=>{g&&h&&(F(h.getFullYear()),V(h.getMonth()))},[L,g]);const H=(()=>{if(!g)return j?$?$(j):Lo(j):"";if(!h&&!x)return"";const b=$??Lo;return h&&x?`${b(h)} - ${b(x)}`:h?`${b(h)} - ...`:""})(),G=g?!!(h||x):!!j,X=b=>{const R=new Date(P,O,b);if(!g){e(o??"",Z(R)),D(!1);return}if(q==="from"){e(S??"",Z(R)),N("to");return}if(!h){e(S??"",Z(R)),N("to");return}if(so(R,h)){e(S??"",""),e(W??"",""),N("from");return}if(R>=h){e(W??"",Z(R)),N("from"),D(!1);return}e(W??"",Z(h)),e(S??"",Z(R)),N("from"),D(!1)},k=b=>{b.stopPropagation(),g?(e(S??"",""),e(W??"",""),N("from")):e(o??"","")},M=()=>{if(d)return;const b=!z;D(b),!b&&g&&N("from")},B=b=>{if((b.key==="Enter"||b.key===" ")&&!d){b.preventDefault();const R=!z;D(R),!R&&g&&N("from")}b.key==="Escape"&&(D(!1),g&&N("from"))},A=()=>{O===0?(V(11),F(b=>b-1)):V(b=>b-1)},oo=()=>{O===11?(V(0),F(b=>b+1)):V(b=>b+1)},no=Oo(P,O),ro=tt(P,O),J=[],fo=Oo(O===0?P-1:P,O===0?11:O-1);for(let b=ro-1;b>=0;b--)J.push({day:fo-b,currentMonth:!1});for(let b=1;b<=no;b++)J.push({day:b,currentMonth:!0});const po=42-J.length;for(let b=1;b<=po;b++)J.push({day:b,currentMonth:!1});return t.jsx(vo,{label:r,error:m,helperText:y,required:w,children:t.jsxs(Un,{ref:_,children:[t.jsxs(qn,{$size:l,$error:!!m,$disabled:d,role:"combobox","aria-haspopup":"true","aria-expanded":z,tabIndex:d?-1:0,onClick:M,onKeyDown:B,children:[t.jsx(Kn,{$hasValue:G,children:H||i}),f&&G?t.jsx(Xn,{type:"button",onClick:k,"aria-label":"Clear date",children:t.jsx(uo,{size:14})}):t.jsx(Gn,{"aria-hidden":"true",children:t.jsx(Pr,{size:14})})]}),z&&t.jsxs(Jn,{role:"dialog","aria-label":"Calendar",children:[t.jsxs(Qn,{children:[t.jsx(Mo,{type:"button",onClick:A,"aria-label":"Previous month",children:t.jsx(Br,{size:16})}),t.jsxs(Zn,{children:[st[O]," ",P]}),t.jsx(Mo,{type:"button",onClick:oo,"aria-label":"Next month",children:t.jsx(_r,{size:16})})]}),t.jsxs(ot,{children:[nt.map(b=>t.jsx(rt,{children:b},b)),J.map((b,R)=>{if(!b.currentMonth)return t.jsx(yo,{type:"button",$currentMonth:!1,$selected:!1,$today:!1,disabled:!0,tabIndex:-1,children:b.day},R);const c=new Date(P,O,b.day),T=so(c,C),Y=et(c,u,p);if(g){const So=h?so(c,h):!1,jo=x?so(c,x):!1,ur=h&&x?c>h&&c<x:!1;return t.jsx(yo,{type:"button",$currentMonth:!0,$selected:!1,$today:T,$rangeStart:So,$rangeEnd:jo,$inRange:ur,disabled:Y,"aria-label":Ro(c),"aria-pressed":So||jo,onClick:()=>X(b.day),children:b.day},R)}const to=j?so(c,j):!1;return t.jsx(yo,{type:"button",$currentMonth:!0,$selected:to,$today:T,disabled:Y,"aria-label":Ro(c),"aria-pressed":to,onClick:()=>X(b.day),children:b.day},R)})]})]})]})})}dr.displayName="DatePicker";function it(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,i=d=>d<=.03928?d/12.92:((d+.055)/1.055)**2.4;return .2126*i(r)+.7152*i(n)+.0722*i(e)>.179?"#111111":"#ffffff"}const lo={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:{.5:"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px"},radius:{md:"2px"},zIndex:{modal:1e3,toast:1100},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px"},fontWeights:{normal:"400",medium:"500",semibold:"600",bold:"700"},shadows:{focusRing:"3px 3px 0 #111111"},brutalism:{borderWidth:"2px",shadowOffset:"4px"}};function at(o){return{...lo,colors:{...lo.colors,primary:{50:"#fffff0",500:o,700:o,contrast:it(o)}}}}function lt({theme:o=lo,children:r}){return t.jsx(s.ThemeProvider,{theme:o,children:r})}const ct=s.createGlobalStyle`
1572
+ `,et=["January","February","March","April","May","June","July","August","September","October","November","December"],it=["Su","Mo","Tu","We","Th","Fr","Sa"];function Ro(o,r){return new Date(o,r+1,0).getDate()}function at(o,r){return new Date(o,r,1).getDay()}function io(o,r){return o.getFullYear()===r.getFullYear()&&o.getMonth()===r.getMonth()&&o.getDate()===r.getDate()}function lt(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 Lo(o){return o.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Po(o){return o.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}function mo(o){if(!o)return null;const r=o.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),e=parseInt(r[1],10),i=parseInt(r[2],10);return isNaN(n)||isNaN(e)||isNaN(i)?null:new Date(n,e-1,i)}function eo(o){const r=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),e=String(o.getDate()).padStart(2,"0");return`${r}-${n}-${e}`}function dr({name:o,label:r,value:n,onChange:e,placeholder:i="Select date...",size:l="md",disabled:d=!1,clearable:p=!1,minDate:u,maxDate:f,formatDate:$,error:w,required:v,helperText:y,mode:k="single",nameFrom:j,nameTo:W,valueFrom:O,valueTo:E}){const x=k==="range",z=mo(n??""),m=mo(O??""),b=mo(E??""),S=new Date,T=()=>x?m??b??S:z??S,[I,M]=a.useState(!1),[N,P]=a.useState(()=>T().getFullYear()),[L,H]=a.useState(()=>T().getMonth()),[ro,D]=a.useState("from"),V=a.useRef(null);a.useEffect(()=>{if(!I)return;const g=R=>{V.current&&!V.current.contains(R.target)&&(M(!1),x&&D("from"))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[I,x]),a.useEffect(()=>{!x&&z&&(P(z.getFullYear()),H(z.getMonth()))},[n,x]),a.useEffect(()=>{x&&m&&(P(m.getFullYear()),H(m.getMonth()))},[O,x]);const U=(()=>{if(!x)return z?$?$(z):Lo(z):"";if(!m&&!b)return"";const g=$??Lo;return m&&b?`${g(m)} - ${g(b)}`:m?`${g(m)} - ...`:""})(),G=x?!!(m||b):!!z,Y=g=>{const R=new Date(N,L,g);if(!x){e(o??"",eo(R)),M(!1);return}if(ro==="from"){e(j??"",eo(R)),D("to");return}if(!m){e(j??"",eo(R)),D("to");return}if(io(R,m)){e(j??"",""),e(W??"",""),D("from");return}if(R>=m){e(W??"",eo(R)),D("from"),M(!1);return}e(W??"",eo(m)),e(j??"",eo(R)),D("from"),M(!1)},no=g=>{g.stopPropagation(),x?(e(j??"",""),e(W??"",""),D("from")):e(o??"","")},B=()=>{if(d)return;const g=!I;M(g),!g&&x&&D("from")},A=g=>{if((g.key==="Enter"||g.key===" ")&&!d){g.preventDefault();const R=!I;M(R),!R&&x&&D("from")}g.key==="Escape"&&(M(!1),x&&D("from"))},q=()=>{L===0?(H(11),P(g=>g-1)):H(g=>g-1)},K=()=>{L===11?(H(0),P(g=>g+1)):H(g=>g+1)},J=Ro(N,L),Q=at(N,L),h=[],F=Ro(L===0?N-1:N,L===0?11:L-1);for(let g=Q-1;g>=0;g--)h.push({day:F-g,currentMonth:!1});for(let g=1;g<=J;g++)h.push({day:g,currentMonth:!0});const Z=42-h.length;for(let g=1;g<=Z;g++)h.push({day:g,currentMonth:!1});return t.jsx(So,{label:r,error:w,helperText:y,required:v,children:t.jsxs(Gn,{ref:V,children:[t.jsxs(Xn,{$size:l,$error:!!w,$disabled:d,role:"combobox","aria-haspopup":"true","aria-expanded":I,tabIndex:d?-1:0,onClick:B,onKeyDown:A,children:[t.jsx(Jn,{$hasValue:G,children:U||i}),p&&G?t.jsx(Zn,{type:"button",onClick:no,"aria-label":"Clear date",children:t.jsx(go,{size:14})}):t.jsx(Qn,{"aria-hidden":"true",children:t.jsx(Nr,{size:14})})]}),I&&t.jsxs(ot,{role:"dialog","aria-label":"Calendar",children:[t.jsxs(rt,{children:[t.jsx(Oo,{type:"button",onClick:q,"aria-label":"Previous month",children:t.jsx(Vr,{size:16})}),t.jsxs(st,{children:[et[L]," ",N]}),t.jsx(Oo,{type:"button",onClick:K,"aria-label":"Next month",children:t.jsx(_r,{size:16})})]}),t.jsxs(nt,{children:[it.map(g=>t.jsx(tt,{children:g},g)),h.map((g,R)=>{if(!g.currentMonth)return t.jsx(ho,{type:"button",$currentMonth:!1,$selected:!1,$today:!1,disabled:!0,tabIndex:-1,children:g.day},R);const c=new Date(N,L,g.day),C=io(c,S),_=lt(c,u,f);if(x){const ao=m?io(c,m):!1,zo=b?io(c,b):!1,ur=m&&b?c>m&&c<b:!1;return t.jsx(ho,{type:"button",$currentMonth:!0,$selected:!1,$today:C,$rangeStart:ao,$rangeEnd:zo,$inRange:ur,disabled:_,"aria-label":Po(c),"aria-pressed":ao||zo,onClick:()=>Y(g.day),children:g.day},R)}const oo=z?io(c,z):!1;return t.jsx(ho,{type:"button",$currentMonth:!0,$selected:oo,$today:C,disabled:_,"aria-label":Po(c),"aria-pressed":oo,onClick:()=>Y(g.day),children:g.day},R)})]})]})]})})}dr.displayName="DatePicker";function ct(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,i=d=>d<=.03928?d/12.92:((d+.055)/1.055)**2.4;return .2126*i(r)+.7152*i(n)+.0722*i(e)>.179?"#111111":"#ffffff"}const po={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:{.5:"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px"},radius:{md:"2px"},zIndex:{modal:1e3,toast:1100},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px"},fontWeights:{normal:"400",medium:"500",semibold:"600",bold:"700"},shadows:{focusRing:"3px 3px 0 #111111"},brutalism:{borderWidth:"2px",shadowOffset:"4px"}};function dt(o){return{...po,colors:{...po.colors,primary:{50:"#fffff0",500:o,700:o,contrast:ct(o)}}}}function ut({theme:o=po,children:r}){return t.jsx(s.ThemeProvider,{theme:o,children:r})}const pt=s.createGlobalStyle`
1511
1573
  *, *::before, *::after {
1512
1574
  box-sizing: border-box;
1513
1575
  margin: 0;
@@ -1524,4 +1586,8 @@
1524
1586
  button, input, select, textarea {
1525
1587
  font-family: inherit;
1526
1588
  }
1527
- `;exports.Badge=No;exports.Button=ao;exports.Checkbox=rr;exports.CollapsibleCard=tr;exports.ConfirmDialog=ko;exports.ConfirmProvider=Hn;exports.DatePicker=dr;exports.Editable=_o;exports.Field=Ho;exports.Form=or;exports.FormField=vo;exports.GlobalStyles=ct;exports.Input=Po;exports.Link=mo;exports.Modal=wo;exports.Radio=sr;exports.Select=Ao;exports.Spinner=er;exports.Switch=nr;exports.Table=lr;exports.Textarea=Fo;exports.ThemeProvider=lt;exports.Toast=Qo;exports.ToastProvider=zs;exports.composeValidators=Bs;exports.createNeoBrutalTheme=at;exports.isEmail=Ps;exports.isUrl=Fs;exports.maxLength=Ns;exports.minLength=Rs;exports.neoBrutalTheme=lo;exports.pattern=Vs;exports.required=Ls;exports.useConfirm=Yn;exports.useForm=Os;exports.useTable=vn;exports.useToast=Is;
1589
+
1590
+ button, a, [role="button"] {
1591
+ touch-action: manipulation;
1592
+ }
1593
+ `;exports.Badge=No;exports.Button=uo;exports.Checkbox=rr;exports.CollapsibleCard=tr;exports.ConfirmDialog=jo;exports.ConfirmProvider=qn;exports.DatePicker=dr;exports.Editable=_o;exports.Field=Ho;exports.Form=or;exports.FormField=So;exports.GlobalStyles=pt;exports.Input=Fo;exports.Link=vo;exports.Modal=ko;exports.Radio=sr;exports.Select=wo;exports.Spinner=er;exports.Switch=nr;exports.Table=lr;exports.Textarea=Bo;exports.ThemeProvider=ut;exports.Toast=Qo;exports.ToastProvider=Cs;exports.composeValidators=Vs;exports.createNeoBrutalTheme=dt;exports.isEmail=Ns;exports.isUrl=Fs;exports.maxLength=Ps;exports.minLength=Ls;exports.neoBrutalTheme=po;exports.pattern=Bs;exports.required=Rs;exports.useConfirm=Kn;exports.useForm=Os;exports.useTable=vn;exports.useToast=Is;