blunt-ui 0.3.0 → 0.3.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.js CHANGED
@@ -1,13 +1,13 @@
1
- import { jsx as i, jsxs as m } from "react/jsx-runtime";
2
- import t, { css as n, keyframes as R, ThemeProvider as yo } from "styled-components";
3
- import G, { useId as M, useState as W, useRef as Y, useEffect as V, useContext as no, createContext as so, forwardRef as to, createElement as q, useCallback as j, useMemo as wo } from "react";
4
- import { createPortal as io } from "react-dom";
5
- const N = (o, r, s) => n`
1
+ import { jsx as s, jsxs as C } from "react/jsx-runtime";
2
+ import i, { css as t, keyframes as M, ThemeProvider as Ao } from "styled-components";
3
+ import bo, { useId as G, useState as D, useRef as oo, useEffect as K, useContext as ko, createContext as mo, forwardRef as So, createElement as lo, useCallback as R, useMemo as uo } from "react";
4
+ import { createPortal as Co } from "react-dom";
5
+ const F = (o, r, n) => t`
6
6
  background: ${r};
7
- color: ${s};
7
+ color: ${n};
8
8
  border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
9
9
  box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
10
- `, vo = t.span`
10
+ `, jo = i.span`
11
11
  display: inline-flex;
12
12
  align-items: center;
13
13
  font-weight: 700;
@@ -20,82 +20,82 @@ const N = (o, r, s) => n`
20
20
  max-width: 20ch;
21
21
 
22
22
  ${({ $size: o, theme: r }) => ({
23
- sm: n`
23
+ sm: t`
24
24
  padding: 2px 8px;
25
25
  font-size: ${r.fontSizes.xs};
26
26
  `,
27
- md: n`
27
+ md: t`
28
28
  padding: 4px 10px;
29
29
  font-size: ${r.fontSizes.sm};
30
30
  `
31
31
  })[o]}
32
32
 
33
33
  ${({ $variant: o, theme: r }) => r.brutalism ? {
34
- primary: N(
34
+ primary: F(
35
35
  r,
36
36
  r.colors.primary[500],
37
37
  r.colors.primary.contrast
38
38
  ),
39
- neutral: N(
39
+ neutral: F(
40
40
  r,
41
41
  r.colors.neutral[200],
42
42
  r.colors.neutral[900]
43
43
  ),
44
- success: N(
44
+ success: F(
45
45
  r,
46
46
  r.colors.success[50],
47
47
  r.colors.success[500]
48
48
  ),
49
- error: N(
49
+ error: F(
50
50
  r,
51
51
  r.colors.error[50],
52
52
  r.colors.error[500]
53
53
  ),
54
- warning: N(
54
+ warning: F(
55
55
  r,
56
56
  r.colors.warning[50],
57
57
  r.colors.warning[500]
58
58
  ),
59
- info: N(r, r.colors.info[50], r.colors.info[500])
59
+ info: F(r, r.colors.info[50], r.colors.info[500])
60
60
  }[o] : {
61
- primary: n`
61
+ primary: t`
62
62
  background: ${r.colors.primary[50]};
63
63
  color: ${r.colors.primary[500]};
64
64
  `,
65
- neutral: n`
65
+ neutral: t`
66
66
  background: ${r.colors.neutral[200]};
67
67
  color: ${r.colors.neutral[600]};
68
68
  `,
69
- success: n`
69
+ success: t`
70
70
  background: ${r.colors.success[50]};
71
71
  color: ${r.colors.success[500]};
72
72
  `,
73
- error: n`
73
+ error: t`
74
74
  background: ${r.colors.error[50]};
75
75
  color: ${r.colors.error[500]};
76
76
  `,
77
- warning: n`
77
+ warning: t`
78
78
  background: ${r.colors.warning[50]};
79
79
  color: ${r.colors.warning[500]};
80
80
  `,
81
- info: n`
81
+ info: t`
82
82
  background: ${r.colors.info[50]};
83
83
  color: ${r.colors.info[500]};
84
84
  `
85
85
  }[o]}
86
86
  `;
87
- function mo({
87
+ function Ro({
88
88
  variant: o = "primary",
89
89
  size: r = "md",
90
- children: s,
91
- ...a
90
+ children: n,
91
+ ...e
92
92
  }) {
93
- return /* @__PURE__ */ i(vo, { $variant: o, $size: r, ...a, children: s });
93
+ return /* @__PURE__ */ s(jo, { $variant: o, $size: r, ...e, children: n });
94
94
  }
95
- mo.displayName = "Badge";
96
- const _ = (o, r, s) => n`
95
+ Ro.displayName = "Badge";
96
+ const so = (o, r, n) => t`
97
97
  background-color: ${r};
98
- color: ${s};
98
+ color: ${n};
99
99
  border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
100
100
  box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
101
101
  0 ${o.colors.neutral[900]};
@@ -106,7 +106,7 @@ const _ = (o, r, s) => n`
106
106
  transform: translate(2px, 2px);
107
107
  box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
108
108
  }
109
- `, ho = t.button`
109
+ `, _o = i.button`
110
110
  display: inline-flex;
111
111
  align-items: center;
112
112
  justify-content: center;
@@ -126,23 +126,23 @@ const _ = (o, r, s) => n`
126
126
  }
127
127
 
128
128
  ${({ $variant: o, theme: r }) => r.brutalism ? {
129
- primary: _(
129
+ primary: so(
130
130
  r,
131
131
  r.colors.primary[500],
132
132
  r.colors.primary.contrast
133
133
  ),
134
- secondary: _(
134
+ secondary: so(
135
135
  r,
136
136
  r.colors.neutral[100],
137
137
  r.colors.neutral[900]
138
138
  ),
139
- outline: _(
139
+ outline: so(
140
140
  r,
141
141
  r.colors.neutral[0],
142
142
  r.colors.neutral[900]
143
143
  )
144
144
  }[o] : {
145
- primary: n`
145
+ primary: t`
146
146
  background-color: ${r.colors.primary[500]};
147
147
  color: ${r.colors.neutral[0]};
148
148
  border: none;
@@ -150,7 +150,7 @@ const _ = (o, r, s) => n`
150
150
  background-color: ${r.colors.primary[700]};
151
151
  }
152
152
  `,
153
- secondary: n`
153
+ secondary: t`
154
154
  background-color: ${r.colors.neutral[200]};
155
155
  color: ${r.colors.neutral[600]};
156
156
  border: none;
@@ -158,7 +158,7 @@ const _ = (o, r, s) => n`
158
158
  background-color: ${r.colors.neutral[300]};
159
159
  }
160
160
  `,
161
- outline: n`
161
+ outline: t`
162
162
  background-color: transparent;
163
163
  color: ${r.colors.primary[500]};
164
164
  border: 2px solid ${r.colors.primary[500]};
@@ -169,58 +169,58 @@ const _ = (o, r, s) => n`
169
169
  }[o]}
170
170
 
171
171
  ${({ $size: o, theme: r }) => ({
172
- sm: n`
172
+ sm: t`
173
173
  padding: ${r.spacing[1]} ${r.spacing[3]};
174
174
  font-size: ${r.fontSizes.sm};
175
175
  `,
176
- md: n`
176
+ md: t`
177
177
  padding: ${r.spacing[2]} ${r.spacing[4]};
178
178
  font-size: ${r.fontSizes.md};
179
179
  `,
180
- lg: n`
180
+ lg: t`
181
181
  padding: ${r.spacing[3]} ${r.spacing[6]};
182
182
  font-size: ${r.fontSizes.lg};
183
183
  `
184
184
  })[o]}
185
185
  `;
186
- function ko({
186
+ function Mo({
187
187
  ref: o,
188
188
  as: r,
189
- href: s,
190
- variant: a = "primary",
191
- size: l = "md",
192
- isLoading: d,
193
- disabled: c,
194
- children: e,
195
- ...p
189
+ href: n,
190
+ variant: e = "primary",
191
+ size: c = "md",
192
+ isLoading: a,
193
+ disabled: l,
194
+ children: u,
195
+ ...x
196
196
  }) {
197
- return /* @__PURE__ */ i(
198
- ho,
197
+ return /* @__PURE__ */ s(
198
+ _o,
199
199
  {
200
200
  ref: o,
201
- as: r ?? (s ? "a" : "button"),
202
- href: s,
203
- $variant: a,
204
- $size: l,
205
- disabled: d || c,
206
- ...p,
207
- children: d ? "Loading..." : e
201
+ as: r ?? (n ? "a" : "button"),
202
+ href: n,
203
+ $variant: e,
204
+ $size: c,
205
+ disabled: a || l,
206
+ ...x,
207
+ children: a ? "Loading..." : u
208
208
  }
209
209
  );
210
210
  }
211
- ko.displayName = "Button";
212
- const Co = t.div`
211
+ Mo.displayName = "Button";
212
+ const Vo = i.div`
213
213
  display: flex;
214
214
  flex-direction: column;
215
215
  gap: ${({ theme: o }) => o.spacing[1]};
216
216
  width: ${({ $fullWidth: o }) => o ? "100%" : "auto"};
217
- `, zo = t.label`
217
+ `, Fo = i.label`
218
218
  font-size: ${({ theme: o }) => o.fontSizes.sm};
219
219
  font-weight: ${({ theme: o }) => o.brutalism ? "700" : "500"};
220
- `, So = t.span`
220
+ `, Ko = i.span`
221
221
  font-size: ${({ theme: o }) => o.fontSizes.xs};
222
222
  color: ${({ $error: o, theme: r }) => o ? r.colors.error[500] : r.colors.neutral[500]};
223
- `, To = t.div`
223
+ `, Ho = i.div`
224
224
  display: flex;
225
225
  align-items: center;
226
226
  border-radius: ${({ theme: o }) => o.radius.md};
@@ -229,43 +229,43 @@ const Co = t.div`
229
229
  box-shadow 0.2s;
230
230
 
231
231
  ${({ $size: o = "md", theme: r }) => ({
232
- sm: n`
232
+ sm: t`
233
233
  padding: ${r.spacing[1]} ${r.spacing[2]};
234
234
  font-size: ${r.fontSizes.sm};
235
235
  `,
236
- md: n`
236
+ md: t`
237
237
  padding: ${r.spacing[2]} ${r.spacing[3]};
238
238
  font-size: ${r.fontSizes.md};
239
239
  `,
240
- lg: n`
240
+ lg: t`
241
241
  padding: ${r.spacing[3]} ${r.spacing[4]};
242
242
  font-size: ${r.fontSizes.lg};
243
243
  `
244
244
  })[o]}
245
245
 
246
- ${({ $variant: o = "default", theme: r }) => r.brutalism ? n`
246
+ ${({ $variant: o = "default", theme: r }) => r.brutalism ? t`
247
247
  border: ${r.brutalism.borderWidth} solid
248
248
  ${r.colors.neutral[900]};
249
249
  background-color: ${r.colors.neutral[0]};
250
250
  box-shadow: 3px 3px 0 ${r.colors.neutral[900]};
251
251
  ` : {
252
- default: n`
252
+ default: t`
253
253
  border: 1px solid ${r.colors.neutral[400]};
254
254
  background-color: ${r.colors.neutral[0]};
255
255
  `,
256
- outlined: n`
256
+ outlined: t`
257
257
  border: 2px solid ${r.colors.primary[500]};
258
258
  background-color: ${r.colors.neutral[0]};
259
259
  `,
260
- filled: n`
260
+ filled: t`
261
261
  border: 1px solid transparent;
262
262
  background-color: ${r.colors.neutral[100]};
263
263
  `
264
264
  }[o]}
265
265
 
266
- ${({ $error: o, theme: r }) => o && n`
266
+ ${({ $error: o, theme: r }) => o && t`
267
267
  border-color: ${r.colors.error[500]};
268
- ${r.brutalism && n`
268
+ ${r.brutalism && t`
269
269
  box-shadow: 3px 3px 0 ${r.colors.error[500]};
270
270
  `}
271
271
  `}
@@ -273,7 +273,7 @@ const Co = t.div`
273
273
  &:focus-within {
274
274
  box-shadow: ${({ theme: o }) => o.shadows.focusRing};
275
275
  }
276
- `, Io = t.input`
276
+ `, Yo = i.input`
277
277
  flex: 1;
278
278
  border: none;
279
279
  outline: none;
@@ -284,11 +284,11 @@ const Co = t.div`
284
284
  cursor: not-allowed;
285
285
  opacity: 0.6;
286
286
  }
287
- `, J = t.div`
287
+ `, $o = i.div`
288
288
  display: inline-flex;
289
289
  align-items: center;
290
290
  margin: 0 ${({ theme: o }) => o.spacing[1]};
291
- `, Wo = t.button`
291
+ `, Uo = i.button`
292
292
  display: inline-flex;
293
293
  align-items: center;
294
294
  margin: 0 ${({ theme: o }) => o.spacing[1]};
@@ -302,75 +302,75 @@ const Co = t.div`
302
302
  opacity: 0.8;
303
303
  }
304
304
  `;
305
- function Eo({
305
+ function qo({
306
306
  ref: o,
307
307
  type: r = "text",
308
- size: s = "md",
309
- variant: a = "default",
310
- label: l,
311
- helperText: d,
312
- error: c,
313
- leftElement: e,
314
- rightElement: p,
315
- clearable: u,
316
- onClear: x,
317
- fullWidth: C,
318
- id: w,
319
- value: b,
320
- defaultValue: f,
321
- onChange: S,
308
+ size: n = "md",
309
+ variant: e = "default",
310
+ label: c,
311
+ helperText: a,
312
+ error: l,
313
+ leftElement: u,
314
+ rightElement: x,
315
+ clearable: p,
316
+ onClear: b,
317
+ fullWidth: w,
318
+ id: y,
319
+ value: g,
320
+ defaultValue: k,
321
+ onChange: T,
322
322
  ...z
323
323
  }) {
324
- const h = M(), E = w ?? h, B = `${E}-hint`, [O, $] = W(f ?? ""), y = b !== void 0, v = y ? b : O, k = typeof c == "string" ? c : void 0, A = !!(d || c), D = (T) => {
325
- y || $(T.target.value), S?.(T);
326
- }, g = () => {
327
- y || $(""), x?.();
324
+ const v = G(), I = y ?? v, P = `${I}-hint`, [B, h] = D(k ?? ""), $ = g !== void 0, m = $ ? g : B, O = typeof l == "string" ? l : void 0, j = !!(a || l), _ = (N) => {
325
+ $ || h(N.target.value), T?.(N);
326
+ }, H = () => {
327
+ $ || h(""), b?.();
328
328
  };
329
- return /* @__PURE__ */ m(Co, { $fullWidth: C, children: [
330
- l && /* @__PURE__ */ i(zo, { htmlFor: E, children: l }),
331
- /* @__PURE__ */ m(To, { $size: s, $variant: a, $error: !!c, children: [
332
- e && /* @__PURE__ */ i(J, { children: e }),
333
- /* @__PURE__ */ i(
334
- Io,
329
+ return /* @__PURE__ */ C(Vo, { $fullWidth: w, children: [
330
+ c && /* @__PURE__ */ s(Fo, { htmlFor: I, children: c }),
331
+ /* @__PURE__ */ C(Ho, { $size: n, $variant: e, $error: !!l, children: [
332
+ u && /* @__PURE__ */ s($o, { children: u }),
333
+ /* @__PURE__ */ s(
334
+ Yo,
335
335
  {
336
- id: E,
336
+ id: I,
337
337
  ref: o,
338
338
  type: r,
339
- value: v,
340
- onChange: D,
339
+ value: m,
340
+ onChange: _,
341
341
  ...z,
342
- "aria-invalid": !!c,
343
- "aria-describedby": A ? B : void 0
342
+ "aria-invalid": !!l,
343
+ "aria-describedby": j ? P : void 0
344
344
  }
345
345
  ),
346
- u && v && /* @__PURE__ */ i(
347
- Wo,
346
+ p && m && /* @__PURE__ */ s(
347
+ Uo,
348
348
  {
349
349
  type: "button",
350
- onClick: g,
350
+ onClick: H,
351
351
  "aria-label": "Clear input",
352
352
  children: "✕"
353
353
  }
354
354
  ),
355
- p && /* @__PURE__ */ i(J, { children: p })
355
+ x && /* @__PURE__ */ s($o, { children: x })
356
356
  ] }),
357
- A && /* @__PURE__ */ i(So, { id: B, $error: !!c, children: k ?? d })
357
+ j && /* @__PURE__ */ s(Ko, { id: P, $error: !!l, children: O ?? a })
358
358
  ] });
359
359
  }
360
- Eo.displayName = "Input";
361
- const Bo = R`
360
+ qo.displayName = "Input";
361
+ const Go = M`
362
362
  from { opacity: 0; }
363
363
  to { opacity: 1; }
364
- `, Oo = R`
364
+ `, Xo = M`
365
365
  from { opacity: 1; }
366
366
  to { opacity: 0; }
367
- `, jo = R`
367
+ `, Zo = M`
368
368
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
369
369
  to { opacity: 1; transform: scale(1) translateY(0); }
370
- `, Ro = R`
370
+ `, Jo = M`
371
371
  from { opacity: 1; transform: scale(1) translateY(0); }
372
372
  to { opacity: 0; transform: scale(0.95) translateY(-8px); }
373
- `, Ao = t.div`
373
+ `, Qo = i.div`
374
374
  position: fixed;
375
375
  inset: 0;
376
376
  background-color: rgba(0, 0, 0, 0.5);
@@ -378,9 +378,9 @@ const Bo = R`
378
378
  align-items: center;
379
379
  justify-content: center;
380
380
  z-index: ${({ theme: o }) => o.zIndex.modal};
381
- animation: ${({ $closing: o }) => o ? Oo : Bo} 0.15s ease
381
+ animation: ${({ $closing: o }) => o ? Xo : Go} 0.15s ease
382
382
  forwards;
383
- `, Lo = t.div`
383
+ `, or = i.div`
384
384
  position: relative;
385
385
  background: ${({ theme: o }) => o.colors.neutral[0]};
386
386
  border-radius: ${({ theme: o }) => o.radius.md};
@@ -389,37 +389,37 @@ const Bo = R`
389
389
  display: flex;
390
390
  flex-direction: column;
391
391
  max-height: 90vh;
392
- animation: ${({ $closing: o }) => o ? Ro : jo} 0.15s ease
392
+ animation: ${({ $closing: o }) => o ? Jo : Zo} 0.15s ease
393
393
  forwards;
394
394
 
395
- ${({ $size: o }) => o === "sm" && n`
395
+ ${({ $size: o }) => o === "sm" && t`
396
396
  width: min(400px, 90vw);
397
397
  `}
398
- ${({ $size: o }) => o === "md" && n`
398
+ ${({ $size: o }) => o === "md" && t`
399
399
  width: min(560px, 90vw);
400
400
  `}
401
- ${({ $size: o }) => o === "lg" && n`
401
+ ${({ $size: o }) => o === "lg" && t`
402
402
  width: min(720px, 90vw);
403
403
  `}
404
- ${({ $size: o }) => o === "fullscreen" && n`
404
+ ${({ $size: o }) => o === "fullscreen" && t`
405
405
  width: 100vw;
406
406
  height: 100vh;
407
407
  max-height: 100vh;
408
408
  border-radius: 0;
409
409
  `}
410
- `, No = t.div`
410
+ `, rr = i.div`
411
411
  display: flex;
412
412
  align-items: center;
413
413
  gap: ${({ theme: o }) => o.spacing[2]};
414
414
  padding: ${({ theme: o }) => o.spacing[4]};
415
415
  border-bottom: 1px solid ${({ theme: o }) => o.colors.neutral[200]};
416
416
  flex-shrink: 0;
417
- `, Vo = t.h2`
417
+ `, nr = i.h2`
418
418
  flex: 1;
419
419
  font-size: ${({ theme: o }) => o.fontSizes.lg};
420
420
  font-weight: 600;
421
421
  margin: 0;
422
- `, Do = t.button`
422
+ `, tr = i.button`
423
423
  display: inline-flex;
424
424
  align-items: center;
425
425
  justify-content: center;
@@ -444,11 +444,11 @@ const Bo = R`
444
444
  outline: 2px solid ${({ theme: o }) => o.colors.primary[500]};
445
445
  outline-offset: 2px;
446
446
  }
447
- `, Fo = t.div`
447
+ `, sr = i.div`
448
448
  padding: ${({ theme: o }) => o.spacing[4]};
449
449
  overflow-y: auto;
450
450
  flex: 1;
451
- `, Mo = t.div`
451
+ `, ir = i.div`
452
452
  display: flex;
453
453
  align-items: center;
454
454
  justify-content: flex-end;
@@ -456,7 +456,7 @@ const Bo = R`
456
456
  padding: ${({ theme: o }) => o.spacing[4]};
457
457
  border-top: 1px solid ${({ theme: o }) => o.colors.neutral[200]};
458
458
  flex-shrink: 0;
459
- `, Po = [
459
+ `, er = [
460
460
  "button:not([disabled])",
461
461
  "input:not([disabled])",
462
462
  "select:not([disabled])",
@@ -464,89 +464,89 @@ const Bo = R`
464
464
  "a[href]",
465
465
  '[tabindex]:not([tabindex="-1"])'
466
466
  ].join(", ");
467
- function Q(o) {
467
+ function xo(o) {
468
468
  return Array.from(
469
- o.querySelectorAll(Po)
469
+ o.querySelectorAll(er)
470
470
  );
471
471
  }
472
- function Yo({
472
+ function ar({
473
473
  open: o,
474
474
  onClose: r,
475
- title: s,
476
- children: a,
477
- footer: l,
478
- size: d = "md",
479
- closeOnBackdrop: c = !0,
480
- closeOnEscape: e = !0,
481
- ariaLabelledBy: p,
482
- ariaDescribedBy: u
475
+ title: n,
476
+ children: e,
477
+ footer: c,
478
+ size: a = "md",
479
+ closeOnBackdrop: l = !0,
480
+ closeOnEscape: u = !0,
481
+ ariaLabelledBy: x,
482
+ ariaDescribedBy: p
483
483
  }) {
484
- const x = Y(null), C = M(), w = p ?? (s ? C : void 0), [b, f] = W(o), [S, z] = W(!1);
485
- return V(() => {
484
+ const b = oo(null), w = G(), y = x ?? (n ? w : void 0), [g, k] = D(o), [T, z] = D(!1);
485
+ return K(() => {
486
486
  if (o)
487
- f(!0), z(!1);
488
- else if (b) {
487
+ k(!0), z(!1);
488
+ else if (g) {
489
489
  z(!0);
490
- const h = setTimeout(() => {
491
- f(!1), z(!1);
490
+ const v = setTimeout(() => {
491
+ k(!1), z(!1);
492
492
  }, 150);
493
- return () => clearTimeout(h);
493
+ return () => clearTimeout(v);
494
494
  }
495
- }, [o, b]), V(() => {
495
+ }, [o, g]), K(() => {
496
496
  if (!o)
497
497
  return;
498
- const h = document.body.style.overflow;
498
+ const v = document.body.style.overflow;
499
499
  return document.body.style.overflow = "hidden", () => {
500
- document.body.style.overflow = h;
500
+ document.body.style.overflow = v;
501
501
  };
502
- }, [o]), V(() => {
503
- if (!o || !x.current)
502
+ }, [o]), K(() => {
503
+ if (!o || !b.current)
504
504
  return;
505
- const h = x.current, E = document.activeElement;
506
- (Q(h)[0] ?? h).focus();
507
- const O = ($) => {
508
- if ($.key === "Escape" && e) {
505
+ const v = b.current, I = document.activeElement;
506
+ (xo(v)[0] ?? v).focus();
507
+ const B = (h) => {
508
+ if (h.key === "Escape" && u) {
509
509
  r();
510
510
  return;
511
511
  }
512
- if ($.key !== "Tab")
512
+ if (h.key !== "Tab")
513
513
  return;
514
- const y = Q(h);
515
- if (y.length === 0) {
516
- $.preventDefault();
514
+ const $ = xo(v);
515
+ if ($.length === 0) {
516
+ h.preventDefault();
517
517
  return;
518
518
  }
519
- const v = y[0], k = y[y.length - 1];
520
- $.shiftKey ? document.activeElement === v && ($.preventDefault(), k.focus()) : document.activeElement === k && ($.preventDefault(), v.focus());
519
+ const m = $[0], O = $[$.length - 1];
520
+ h.shiftKey ? document.activeElement === m && (h.preventDefault(), O.focus()) : document.activeElement === O && (h.preventDefault(), m.focus());
521
521
  };
522
- return document.addEventListener("keydown", O), () => {
523
- document.removeEventListener("keydown", O), E?.focus();
522
+ return document.addEventListener("keydown", B), () => {
523
+ document.removeEventListener("keydown", B), I?.focus();
524
524
  };
525
- }, [o, e, r, b]), b ? io(
526
- /* @__PURE__ */ i(
527
- Ao,
525
+ }, [o, u, r, g]), g ? Co(
526
+ /* @__PURE__ */ s(
527
+ Qo,
528
528
  {
529
- $closing: S,
530
- onClick: c ? r : void 0,
531
- children: /* @__PURE__ */ m(
532
- Lo,
529
+ $closing: T,
530
+ onClick: l ? r : void 0,
531
+ children: /* @__PURE__ */ C(
532
+ or,
533
533
  {
534
- ref: x,
534
+ ref: b,
535
535
  role: "dialog",
536
536
  "aria-modal": "true",
537
- "aria-labelledby": w,
538
- "aria-describedby": u,
539
- $size: d,
540
- $closing: S,
537
+ "aria-labelledby": y,
538
+ "aria-describedby": p,
539
+ $size: a,
540
+ $closing: T,
541
541
  tabIndex: -1,
542
- onClick: (h) => h.stopPropagation(),
542
+ onClick: (v) => v.stopPropagation(),
543
543
  children: [
544
- /* @__PURE__ */ m(No, { children: [
545
- s && /* @__PURE__ */ i(Vo, { id: C, children: s }),
546
- /* @__PURE__ */ i(Do, { onClick: r, "aria-label": "Close modal", children: "×" })
544
+ /* @__PURE__ */ C(rr, { children: [
545
+ n && /* @__PURE__ */ s(nr, { id: w, children: n }),
546
+ /* @__PURE__ */ s(tr, { onClick: r, "aria-label": "Close modal", children: "×" })
547
547
  ] }),
548
- /* @__PURE__ */ i(Fo, { children: a }),
549
- l && /* @__PURE__ */ i(Mo, { children: l })
548
+ /* @__PURE__ */ s(sr, { children: e }),
549
+ c && /* @__PURE__ */ s(ir, { children: c })
550
550
  ]
551
551
  }
552
552
  )
@@ -555,18 +555,18 @@ function Yo({
555
555
  document.body
556
556
  ) : null;
557
557
  }
558
- Yo.displayName = "Modal";
559
- const ao = (...o) => o.filter((r, s, a) => !!r && r.trim() !== "" && a.indexOf(r) === s).join(" ").trim();
560
- const Ho = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
561
- const _o = (o) => o.replace(
558
+ ar.displayName = "Modal";
559
+ const zo = (...o) => o.filter((r, n, e) => !!r && r.trim() !== "" && e.indexOf(r) === n).join(" ").trim();
560
+ const lr = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
561
+ const cr = (o) => o.replace(
562
562
  /^([A-Z])|[\s-_]+(\w)/g,
563
- (r, s, a) => a ? a.toUpperCase() : s.toLowerCase()
563
+ (r, n, e) => e ? e.toUpperCase() : n.toLowerCase()
564
564
  );
565
- const oo = (o) => {
566
- const r = _o(o);
565
+ const yo = (o) => {
566
+ const r = cr(o);
567
567
  return r.charAt(0).toUpperCase() + r.slice(1);
568
568
  };
569
- var K = {
569
+ var io = {
570
570
  xmlns: "http://www.w3.org/2000/svg",
571
571
  width: 24,
572
572
  height: 24,
@@ -577,69 +577,83 @@ var K = {
577
577
  strokeLinecap: "round",
578
578
  strokeLinejoin: "round"
579
579
  };
580
- const Ko = (o) => {
580
+ const dr = (o) => {
581
581
  for (const r in o)
582
582
  if (r.startsWith("aria-") || r === "role" || r === "title")
583
583
  return !0;
584
584
  return !1;
585
- }, qo = so({}), Uo = () => no(qo), Zo = to(
586
- ({ color: o, size: r, strokeWidth: s, absoluteStrokeWidth: a, className: l = "", children: d, iconNode: c, ...e }, p) => {
585
+ }, ur = mo({}), pr = () => ko(ur), fr = So(
586
+ ({ color: o, size: r, strokeWidth: n, absoluteStrokeWidth: e, className: c = "", children: a, iconNode: l, ...u }, x) => {
587
587
  const {
588
- size: u = 24,
589
- strokeWidth: x = 2,
590
- absoluteStrokeWidth: C = !1,
591
- color: w = "currentColor",
592
- className: b = ""
593
- } = Uo() ?? {}, f = a ?? C ? Number(s ?? x) * 24 / Number(r ?? u) : s ?? x;
594
- return q(
588
+ size: p = 24,
589
+ strokeWidth: b = 2,
590
+ absoluteStrokeWidth: w = !1,
591
+ color: y = "currentColor",
592
+ className: g = ""
593
+ } = pr() ?? {}, k = e ?? w ? Number(n ?? b) * 24 / Number(r ?? p) : n ?? b;
594
+ return lo(
595
595
  "svg",
596
596
  {
597
- ref: p,
598
- ...K,
599
- width: r ?? u ?? K.width,
600
- height: r ?? u ?? K.height,
601
- stroke: o ?? w,
602
- strokeWidth: f,
603
- className: ao("lucide", b, l),
604
- ...!d && !Ko(e) && { "aria-hidden": "true" },
605
- ...e
597
+ ref: x,
598
+ ...io,
599
+ width: r ?? p ?? io.width,
600
+ height: r ?? p ?? io.height,
601
+ stroke: o ?? y,
602
+ strokeWidth: k,
603
+ className: zo("lucide", g, c),
604
+ ...!a && !dr(u) && { "aria-hidden": "true" },
605
+ ...u
606
606
  },
607
607
  [
608
- ...c.map(([S, z]) => q(S, z)),
609
- ...Array.isArray(d) ? d : [d]
608
+ ...l.map(([T, z]) => lo(T, z)),
609
+ ...Array.isArray(a) ? a : [a]
610
610
  ]
611
611
  );
612
612
  }
613
613
  );
614
- const eo = (o, r) => {
615
- const s = to(
616
- ({ className: a, ...l }, d) => q(Zo, {
617
- ref: d,
614
+ const X = (o, r) => {
615
+ const n = So(
616
+ ({ className: e, ...c }, a) => lo(fr, {
617
+ ref: a,
618
618
  iconNode: r,
619
- className: ao(
620
- `lucide-${Ho(oo(o))}`,
619
+ className: zo(
620
+ `lucide-${lr(yo(o))}`,
621
621
  `lucide-${o}`,
622
- a
622
+ e
623
623
  ),
624
- ...l
624
+ ...c
625
625
  })
626
626
  );
627
- return s.displayName = oo(o), s;
627
+ return n.displayName = yo(o), n;
628
628
  };
629
- const Xo = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], lo = eo("chevron-down", Xo);
630
- const Go = [
629
+ const gr = [
630
+ ["path", { d: "M12 5v14", key: "s699le" }],
631
+ ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
632
+ ], br = X("arrow-down", gr);
633
+ const $r = [
634
+ ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
635
+ ["path", { d: "M17 20V4", key: "1ejh1v" }],
636
+ ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
637
+ ["path", { d: "M7 4v16", key: "1glfcx" }]
638
+ ], xr = X("arrow-up-down", $r);
639
+ const yr = [
640
+ ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
641
+ ["path", { d: "M12 19V5", key: "x0mq9r" }]
642
+ ], hr = X("arrow-up", yr);
643
+ const wr = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], To = X("chevron-down", wr);
644
+ const vr = [
631
645
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
632
646
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
633
- ], co = eo("x", Go), Jo = R`
647
+ ], Io = X("x", vr), kr = M`
634
648
  from { opacity: 0; transform: translateY(12px); }
635
649
  to { opacity: 1; transform: translateY(0); }
636
- `, Qo = R`
650
+ `, mr = M`
637
651
  from { opacity: 0; transform: translateY(-12px); }
638
652
  to { opacity: 1; transform: translateY(0); }
639
- `, or = R`
653
+ `, Sr = M`
640
654
  from { opacity: 1; }
641
655
  to { opacity: 0; }
642
- `, rr = t.div`
656
+ `, Cr = i.div`
643
657
  position: fixed;
644
658
  z-index: ${({ theme: o }) => o.zIndex.toast};
645
659
  display: flex;
@@ -649,85 +663,85 @@ const Go = [
649
663
  max-width: 400px;
650
664
  padding: ${({ theme: o }) => `${o.spacing[3]} ${o.spacing[4]}`};
651
665
  border-radius: ${({ theme: o }) => o.radius.md};
652
- animation: ${({ $closing: o, $position: r }) => o ? n`
653
- ${or} 0.2s ease forwards
654
- ` : r.startsWith("top") ? n`
655
- ${Qo} 0.2s ease forwards
656
- ` : n`
657
- ${Jo} 0.2s ease forwards
666
+ animation: ${({ $closing: o, $position: r }) => o ? t`
667
+ ${Sr} 0.2s ease forwards
668
+ ` : r.startsWith("top") ? t`
669
+ ${mr} 0.2s ease forwards
670
+ ` : t`
671
+ ${kr} 0.2s ease forwards
658
672
  `};
659
673
 
660
674
  ${({ $position: o, theme: r }) => ({
661
- "bottom-right": n`
675
+ "bottom-right": t`
662
676
  bottom: ${r.spacing[6]};
663
677
  right: ${r.spacing[6]};
664
678
  `,
665
- "bottom-left": n`
679
+ "bottom-left": t`
666
680
  bottom: ${r.spacing[6]};
667
681
  left: ${r.spacing[6]};
668
682
  `,
669
- "top-right": n`
683
+ "top-right": t`
670
684
  top: ${r.spacing[6]};
671
685
  right: ${r.spacing[6]};
672
686
  `,
673
- "top-left": n`
687
+ "top-left": t`
674
688
  top: ${r.spacing[6]};
675
689
  left: ${r.spacing[6]};
676
690
  `
677
691
  })[o]}
678
- `, P = (o, r, s) => n`
692
+ `, Q = (o, r, n) => t`
679
693
  background: ${r};
680
- border: ${o.brutalism.borderWidth} solid ${s};
694
+ border: ${o.brutalism.borderWidth} solid ${n};
681
695
  box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
682
- 0 ${s};
683
- `, nr = t(rr)`
696
+ 0 ${n};
697
+ `, zr = i(Cr)`
684
698
  ${({ $variant: o, theme: r }) => r.brutalism ? {
685
- success: P(
699
+ success: Q(
686
700
  r,
687
701
  r.colors.success[50],
688
702
  r.colors.success[500]
689
703
  ),
690
- error: P(
704
+ error: Q(
691
705
  r,
692
706
  r.colors.error[50],
693
707
  r.colors.error[500]
694
708
  ),
695
- warning: P(
709
+ warning: Q(
696
710
  r,
697
711
  r.colors.warning[50],
698
712
  r.colors.warning[500]
699
713
  ),
700
- info: P(r, r.colors.info[50], r.colors.info[500])
714
+ info: Q(r, r.colors.info[50], r.colors.info[500])
701
715
  }[o] : {
702
- success: n`
716
+ success: t`
703
717
  background: ${r.colors.success[50]};
704
718
  border-left: 4px solid ${r.colors.success[500]};
705
719
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
706
720
  `,
707
- error: n`
721
+ error: t`
708
722
  background: ${r.colors.error[50]};
709
723
  border-left: 4px solid ${r.colors.error[500]};
710
724
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
711
725
  `,
712
- warning: n`
726
+ warning: t`
713
727
  background: ${r.colors.warning[50]};
714
728
  border-left: 4px solid ${r.colors.warning[500]};
715
729
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
716
730
  `,
717
- info: n`
731
+ info: t`
718
732
  background: ${r.colors.info[50]};
719
733
  border-left: 4px solid ${r.colors.info[500]};
720
734
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
721
735
  `
722
736
  }[o]}
723
- `, sr = t.p`
737
+ `, Tr = i.p`
724
738
  flex: 1;
725
739
  margin: 0;
726
740
  font-size: ${({ theme: o }) => o.fontSizes.sm};
727
741
  font-weight: ${({ theme: o }) => o.brutalism ? 600 : 400};
728
742
  line-height: 1.5;
729
743
  color: ${({ theme: o }) => o.colors.neutral[900]};
730
- `, tr = t.button`
744
+ `, Ir = i.button`
731
745
  flex-shrink: 0;
732
746
  display: inline-flex;
733
747
  align-items: center;
@@ -750,121 +764,124 @@ const Go = [
750
764
  outline-offset: 2px;
751
765
  }
752
766
  `;
753
- function uo({
767
+ function Eo({
754
768
  open: o,
755
769
  onClose: r,
756
- message: s,
757
- variant: a = "info",
758
- duration: l = 4e3,
759
- position: d = "bottom-right"
770
+ message: n,
771
+ variant: e = "info",
772
+ duration: c = 4e3,
773
+ position: a = "bottom-right"
760
774
  }) {
761
- const [c, e] = W(o), [p, u] = W(!1);
762
- return V(() => {
775
+ const [l, u] = D(o), [x, p] = D(!1);
776
+ return K(() => {
763
777
  if (o)
764
- e(!0), u(!1);
765
- else if (c) {
766
- u(!0);
767
- const x = setTimeout(() => {
768
- e(!1), u(!1);
778
+ u(!0), p(!1);
779
+ else if (l) {
780
+ p(!0);
781
+ const b = setTimeout(() => {
782
+ u(!1), p(!1);
769
783
  }, 200);
770
- return () => clearTimeout(x);
784
+ return () => {
785
+ clearTimeout(b);
786
+ };
771
787
  }
772
- }, [o, c]), V(() => {
773
- if (!o || l === 0)
788
+ }, [o, l]), K(() => {
789
+ if (!o || c === 0)
774
790
  return;
775
- const x = setTimeout(r, l);
776
- return () => clearTimeout(x);
777
- }, [o, l, r]), c ? io(
778
- /* @__PURE__ */ m(
779
- nr,
791
+ const b = setTimeout(r, c);
792
+ return () => {
793
+ clearTimeout(b);
794
+ };
795
+ }, [o, c, r]), l ? Co(
796
+ /* @__PURE__ */ C(
797
+ zr,
780
798
  {
781
- $position: d,
782
- $variant: a,
783
- $closing: p,
799
+ $position: a,
800
+ $variant: e,
801
+ $closing: x,
784
802
  role: "alert",
785
803
  "aria-live": "polite",
786
804
  children: [
787
- /* @__PURE__ */ i(sr, { children: s }),
788
- /* @__PURE__ */ i(tr, { onClick: r, "aria-label": "Close notification", children: /* @__PURE__ */ i(co, { size: 14, strokeWidth: 2.5 }) })
805
+ /* @__PURE__ */ s(Tr, { children: n }),
806
+ /* @__PURE__ */ s(Ir, { onClick: r, "aria-label": "Close notification", children: /* @__PURE__ */ s(Io, { size: 14, strokeWidth: 2.5 }) })
789
807
  ]
790
808
  }
791
809
  ),
792
810
  document.body
793
811
  ) : null;
794
812
  }
795
- uo.displayName = "Toast";
796
- const ir = t.form`
813
+ Eo.displayName = "Toast";
814
+ const Er = i.form`
797
815
  display: flex;
798
816
  flex-direction: column;
799
817
  gap: ${({ theme: o }) => o.spacing[4]};
800
- `, ar = t.div`
818
+ `, Wr = i.div`
801
819
  display: flex;
802
820
  flex-direction: column;
803
821
  gap: ${({ theme: o }) => o.spacing[1]};
804
- `, er = t.label`
822
+ `, Or = i.label`
805
823
  font-size: ${({ theme: o }) => o.fontSizes.sm};
806
824
  font-weight: 500;
807
825
  color: ${({ theme: o }) => o.colors.neutral[900]};
808
- `, lr = t.span`
826
+ `, Pr = i.span`
809
827
  color: ${({ theme: o }) => o.colors.error[500]};
810
828
  margin-left: 2px;
811
- aria-hidden: true;
812
- `, cr = t.span`
829
+ `, Br = i.span`
813
830
  font-size: ${({ theme: o }) => o.fontSizes.xs};
814
831
  color: ${({ $error: o, theme: r }) => o ? r.colors.error[500] : r.colors.neutral[500]};
815
832
  `;
816
- function dr({ onSubmit: o, children: r, ...s }) {
817
- return /* @__PURE__ */ i(
818
- ir,
833
+ function Dr({ onSubmit: o, children: r, ...n }) {
834
+ return /* @__PURE__ */ s(
835
+ Er,
819
836
  {
820
- onSubmit: (a) => {
821
- a.preventDefault(), o?.(a);
837
+ onSubmit: (e) => {
838
+ e.preventDefault(), o?.(e);
822
839
  },
823
840
  noValidate: !0,
824
- ...s,
841
+ ...n,
825
842
  children: r
826
843
  }
827
844
  );
828
845
  }
829
- dr.displayName = "Form";
830
- function ur({
846
+ Dr.displayName = "Form";
847
+ function Nr({
831
848
  label: o,
832
849
  error: r,
833
- helperText: s,
834
- required: a,
835
- children: l
850
+ helperText: n,
851
+ required: e,
852
+ children: c
836
853
  }) {
837
- const d = M(), c = `${d}-hint`, e = !!(r || s), p = typeof r == "string" ? r : void 0, u = G.isValidElement(l) ? G.cloneElement(
838
- l,
854
+ const a = G(), l = `${a}-hint`, u = !!(r || n), x = typeof r == "string" ? r : void 0, p = bo.isValidElement(c) ? bo.cloneElement(
855
+ c,
839
856
  {
840
- id: d,
841
- ...e && { "aria-describedby": c },
857
+ id: a,
858
+ ...u && { "aria-describedby": l },
842
859
  ...r && { "aria-invalid": !0 }
843
860
  }
844
- ) : l;
845
- return /* @__PURE__ */ m(ar, { children: [
846
- o && /* @__PURE__ */ m(er, { htmlFor: d, children: [
861
+ ) : c;
862
+ return /* @__PURE__ */ C(Wr, { children: [
863
+ o && /* @__PURE__ */ C(Or, { htmlFor: a, children: [
847
864
  o,
848
- a && /* @__PURE__ */ i(lr, { "aria-hidden": "true", children: " *" })
865
+ e && /* @__PURE__ */ s(Pr, { "aria-hidden": "true", children: " *" })
849
866
  ] }),
850
- u,
851
- e && /* @__PURE__ */ i(cr, { id: c, $error: !!r, children: p ?? s })
867
+ p,
868
+ u && /* @__PURE__ */ s(Br, { id: l, $error: !!r, children: x ?? n })
852
869
  ] });
853
870
  }
854
- ur.displayName = "FormField";
855
- const pr = t.div`
871
+ Nr.displayName = "FormField";
872
+ const Lr = i.div`
856
873
  display: inline-flex;
857
874
  flex-direction: column;
858
875
  gap: ${({ theme: o }) => o.spacing[1]};
859
876
  width: ${({ $fullWidth: o }) => o ? "100%" : "auto"};
860
- `, fr = t.div`
877
+ `, Ar = i.div`
861
878
  position: relative;
862
879
  display: flex;
863
880
  width: 100%;
864
- `, $r = t.span`
881
+ `, jr = i.span`
865
882
  font-size: ${({ theme: o }) => o.fontSizes.xs};
866
883
  color: ${({ $error: o, theme: r }) => o ? r.colors.error[500] : r.colors.neutral[500]};
867
- `, br = t.select`
884
+ `, Rr = i.select`
868
885
  appearance: none;
869
886
  width: 100%;
870
887
  border-radius: ${({ theme: o }) => o.radius.md};
@@ -876,15 +893,15 @@ const pr = t.div`
876
893
  box-shadow 0.2s;
877
894
 
878
895
  ${({ $size: o, theme: r }) => ({
879
- sm: n`
896
+ sm: t`
880
897
  padding: ${r.spacing[1]} ${r.spacing[2]};
881
898
  font-size: ${r.fontSizes.sm};
882
899
  `,
883
- md: n`
900
+ md: t`
884
901
  padding: ${r.spacing[2]} ${r.spacing[3]};
885
902
  font-size: ${r.fontSizes.md};
886
903
  `,
887
- lg: n`
904
+ lg: t`
888
905
  padding: ${r.spacing[3]} ${r.spacing[4]};
889
906
  font-size: ${r.fontSizes.lg};
890
907
  `
@@ -892,27 +909,27 @@ const pr = t.div`
892
909
 
893
910
  padding-right: 2.5rem;
894
911
 
895
- ${({ $variant: o, theme: r }) => r.brutalism ? n`
912
+ ${({ $variant: o, theme: r }) => r.brutalism ? t`
896
913
  border: ${r.brutalism.borderWidth} solid
897
914
  ${r.colors.neutral[900]};
898
915
  background-color: ${r.colors.neutral[0]};
899
916
  box-shadow: 3px 3px 0 ${r.colors.neutral[900]};
900
917
  ` : {
901
- default: n`
918
+ default: t`
902
919
  border: 1px solid ${r.colors.neutral[400]};
903
920
  background-color: ${r.colors.neutral[0]};
904
921
  `,
905
- outlined: n`
922
+ outlined: t`
906
923
  border: 2px solid ${r.colors.primary[500]};
907
924
  background-color: ${r.colors.neutral[0]};
908
925
  `,
909
- filled: n`
926
+ filled: t`
910
927
  border: 1px solid transparent;
911
928
  background-color: ${r.colors.neutral[100]};
912
929
  `
913
930
  }[o]}
914
931
 
915
- ${({ $error: o, theme: r }) => o && n`
932
+ ${({ $error: o, theme: r }) => o && t`
916
933
  border-color: ${r.colors.error[500]};
917
934
  `}
918
935
 
@@ -925,7 +942,7 @@ const pr = t.div`
925
942
  cursor: not-allowed;
926
943
  opacity: 0.6;
927
944
  }
928
- `, gr = t.button`
945
+ `, _r = i.button`
929
946
  position: absolute;
930
947
  right: ${({ theme: o }) => o.spacing[3]};
931
948
  top: 50%;
@@ -947,7 +964,7 @@ const pr = t.div`
947
964
  outline-offset: 2px;
948
965
  border-radius: 2px;
949
966
  }
950
- `, xr = t.span`
967
+ `, Mr = i.span`
951
968
  position: absolute;
952
969
  right: ${({ theme: o }) => o.spacing[3]};
953
970
  top: 50%;
@@ -957,63 +974,63 @@ const pr = t.div`
957
974
  align-items: center;
958
975
  color: ${({ theme: o }) => o.colors.neutral[500]};
959
976
  `;
960
- function yr({
977
+ function Vr({
961
978
  options: o,
962
979
  placeholder: r,
963
- size: s = "md",
964
- variant: a = "default",
965
- error: l,
966
- fullWidth: d,
967
- clearable: c,
968
- onClear: e,
969
- id: p,
970
- value: u,
971
- defaultValue: x,
972
- onChange: C,
973
- ...w
980
+ size: n = "md",
981
+ variant: e = "default",
982
+ error: c,
983
+ fullWidth: a,
984
+ clearable: l,
985
+ onClear: u,
986
+ id: x,
987
+ value: p,
988
+ defaultValue: b,
989
+ onChange: w,
990
+ ...y
974
991
  }) {
975
- const b = M(), f = p ?? b, S = `${f}-hint`, z = typeof l == "string" ? l : void 0, [h, E] = W(
976
- x ?? ""
977
- ), B = u !== void 0, O = B ? u : h, $ = (k) => {
978
- B || E(k.target.value), C?.(k);
979
- }, y = () => {
980
- B || E(""), e?.();
981
- }, v = c && !!O;
982
- return /* @__PURE__ */ m(pr, { $fullWidth: d, children: [
983
- /* @__PURE__ */ m(fr, { children: [
984
- /* @__PURE__ */ m(
985
- br,
992
+ const g = G(), k = x ?? g, T = `${k}-hint`, z = typeof c == "string" ? c : void 0, [v, I] = D(
993
+ b ?? ""
994
+ ), P = p !== void 0, B = P ? p : v, h = (O) => {
995
+ P || I(O.target.value), w?.(O);
996
+ }, $ = () => {
997
+ P || I(""), u?.();
998
+ }, m = l && !!B;
999
+ return /* @__PURE__ */ C(Lr, { $fullWidth: a, children: [
1000
+ /* @__PURE__ */ C(Ar, { children: [
1001
+ /* @__PURE__ */ C(
1002
+ Rr,
986
1003
  {
987
- id: f,
988
- $size: s,
989
- $variant: a,
990
- $error: !!l,
991
- "aria-invalid": !!l,
992
- "aria-describedby": z ? S : void 0,
993
- value: O,
994
- onChange: $,
995
- ...w,
1004
+ id: k,
1005
+ $size: n,
1006
+ $variant: e,
1007
+ $error: !!c,
1008
+ "aria-invalid": !!c,
1009
+ "aria-describedby": z ? T : void 0,
1010
+ value: B,
1011
+ onChange: h,
1012
+ ...y,
996
1013
  children: [
997
- r && /* @__PURE__ */ i("option", { value: "", disabled: !0, children: r }),
998
- o.map((k) => /* @__PURE__ */ i("option", { value: k.value, disabled: k.disabled, children: k.label }, k.value))
1014
+ r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
1015
+ o.map((O) => /* @__PURE__ */ s("option", { value: O.value, disabled: O.disabled, children: O.label }, O.value))
999
1016
  ]
1000
1017
  }
1001
1018
  ),
1002
- v ? /* @__PURE__ */ i(
1003
- gr,
1019
+ m ? /* @__PURE__ */ s(
1020
+ _r,
1004
1021
  {
1005
1022
  type: "button",
1006
- onClick: y,
1023
+ onClick: $,
1007
1024
  "aria-label": "Clear selection",
1008
- children: /* @__PURE__ */ i(co, { size: 14 })
1025
+ children: /* @__PURE__ */ s(Io, { size: 14 })
1009
1026
  }
1010
- ) : /* @__PURE__ */ i(xr, { "aria-hidden": "true", children: /* @__PURE__ */ i(lo, { size: 14 }) })
1027
+ ) : /* @__PURE__ */ s(Mr, { "aria-hidden": "true", children: /* @__PURE__ */ s(To, { size: 14 }) })
1011
1028
  ] }),
1012
- z && /* @__PURE__ */ i($r, { id: S, $error: !0, children: z })
1029
+ z && /* @__PURE__ */ s(jr, { id: T, $error: !0, children: z })
1013
1030
  ] });
1014
1031
  }
1015
- yr.displayName = "Select";
1016
- const wr = t.a`
1032
+ Vr.displayName = "Select";
1033
+ const Fr = i.a`
1017
1034
  text-decoration: underline;
1018
1035
  text-underline-offset: 2px;
1019
1036
  transition: color 0.15s;
@@ -1025,13 +1042,13 @@ const wr = t.a`
1025
1042
  }
1026
1043
 
1027
1044
  ${({ $variant: o, theme: r }) => ({
1028
- default: n`
1045
+ default: t`
1029
1046
  color: ${r.colors.primary[500]};
1030
1047
  &:hover {
1031
1048
  color: ${r.colors.primary[700]};
1032
1049
  }
1033
1050
  `,
1034
- subtle: n`
1051
+ subtle: t`
1035
1052
  color: ${r.colors.neutral[500]};
1036
1053
  &:hover {
1037
1054
  color: ${r.colors.neutral[900]};
@@ -1039,39 +1056,39 @@ const wr = t.a`
1039
1056
  `
1040
1057
  })[o]}
1041
1058
  `;
1042
- function vr({
1059
+ function Kr({
1043
1060
  variant: o = "default",
1044
1061
  external: r,
1045
- children: s,
1046
- ...a
1062
+ children: n,
1063
+ ...e
1047
1064
  }) {
1048
- return /* @__PURE__ */ i(
1049
- wr,
1065
+ return /* @__PURE__ */ s(
1066
+ Fr,
1050
1067
  {
1051
1068
  $variant: o,
1052
1069
  ...r && { target: "_blank", rel: "noreferrer" },
1053
- ...a,
1054
- children: s
1070
+ ...e,
1071
+ children: n
1055
1072
  }
1056
1073
  );
1057
1074
  }
1058
- vr.displayName = "Link";
1059
- const mr = t.div`
1075
+ Kr.displayName = "Link";
1076
+ const Hr = i.div`
1060
1077
  border-radius: ${({ theme: o }) => o.radius.md};
1061
1078
  background: ${({ theme: o }) => o.colors.neutral[0]};
1062
1079
  overflow: hidden;
1063
1080
 
1064
- ${({ theme: o, $accentColor: r }) => o.brutalism ? n`
1081
+ ${({ theme: o, $accentColor: r }) => o.brutalism ? t`
1065
1082
  border: ${o.brutalism.borderWidth} solid
1066
1083
  ${r ?? o.colors.neutral[900]};
1067
1084
  box-shadow: ${o.brutalism.shadowOffset}
1068
1085
  ${o.brutalism.shadowOffset} 0
1069
1086
  ${r ?? o.colors.neutral[900]};
1070
- ` : n`
1087
+ ` : t`
1071
1088
  border: 1px solid ${r ?? o.colors.neutral[200]};
1072
1089
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
1073
1090
  `}
1074
- `, hr = t.button`
1091
+ `, Yr = i.button`
1075
1092
  width: 100%;
1076
1093
  display: flex;
1077
1094
  align-items: flex-start;
@@ -1091,19 +1108,19 @@ const mr = t.div`
1091
1108
  ${({ theme: o, $accentColor: r }) => r ?? o.colors.primary[500]};
1092
1109
  outline-offset: -2px;
1093
1110
  }
1094
- `, kr = t.div`
1111
+ `, Ur = i.div`
1095
1112
  flex: 1;
1096
1113
  min-width: 0;
1097
- `, Cr = t.span`
1114
+ `, qr = i.span`
1098
1115
  display: block;
1099
1116
  font-size: ${({ theme: o }) => o.fontSizes.md};
1100
1117
  font-weight: 600;
1101
1118
  color: ${({ theme: o }) => o.colors.neutral[900]};
1102
- `, zr = t.span`
1119
+ `, Gr = i.span`
1103
1120
  display: block;
1104
1121
  font-size: ${({ theme: o }) => o.fontSizes.sm};
1105
1122
  color: ${({ theme: o }) => o.colors.neutral[500]};
1106
- `, Sr = t.div`
1123
+ `, Xr = i.div`
1107
1124
  display: flex;
1108
1125
  flex-direction: row;
1109
1126
  align-items: center;
@@ -1115,11 +1132,11 @@ const mr = t.div`
1115
1132
  align-items: flex-start;
1116
1133
  gap: ${({ theme: o }) => o.spacing[2]};
1117
1134
  }
1118
- `, Tr = t.div`
1135
+ `, Zr = i.div`
1119
1136
  display: flex;
1120
1137
  align-items: center;
1121
1138
  gap: ${({ theme: o }) => o.spacing[2]};
1122
- `, Ir = t.span`
1139
+ `, Jr = i.span`
1123
1140
  display: inline-flex;
1124
1141
  align-items: center;
1125
1142
  justify-content: center;
@@ -1127,79 +1144,81 @@ const mr = t.div`
1127
1144
  transition: transform 0.2s ease;
1128
1145
  transform: ${({ $open: o }) => o ? "rotate(180deg)" : "rotate(0deg)"};
1129
1146
  color: ${({ theme: o, $accentColor: r }) => r ?? o.colors.neutral[500]};
1130
- `, Wr = t.div`
1147
+ `, Qr = i.div`
1131
1148
  display: grid;
1132
1149
  grid-template-rows: ${({ $open: o }) => o ? "1fr" : "0fr"};
1133
1150
  transition: grid-template-rows 0.2s ease;
1134
- `, Er = t.div`
1151
+ `, on = i.div`
1135
1152
  overflow: hidden;
1136
- `, Br = t.div`
1153
+ `, rn = i.div`
1137
1154
  padding: ${({ theme: o }) => o.spacing[4]};
1138
1155
  border-top: 1px solid ${({ theme: o }) => o.colors.neutral[200]};
1139
1156
  `;
1140
- function Or({
1157
+ function nn({
1141
1158
  title: o,
1142
1159
  children: r,
1143
- defaultOpen: s = !1,
1144
- open: a,
1145
- onToggle: l,
1146
- subtitle: d,
1147
- headerActions: c,
1148
- accentColor: e
1160
+ defaultOpen: n = !1,
1161
+ open: e,
1162
+ onToggle: c,
1163
+ subtitle: a,
1164
+ headerActions: l,
1165
+ accentColor: u
1149
1166
  }) {
1150
- const [p, u] = W(s), x = M(), C = a !== void 0, w = C ? a : p;
1151
- return /* @__PURE__ */ m(mr, { $accentColor: e, children: [
1152
- /* @__PURE__ */ m(
1153
- hr,
1167
+ const [x, p] = D(n), b = G(), w = e !== void 0, y = w ? e : x;
1168
+ return /* @__PURE__ */ C(Hr, { $accentColor: u, children: [
1169
+ /* @__PURE__ */ C(
1170
+ Yr,
1154
1171
  {
1155
1172
  type: "button",
1156
- $open: w,
1157
- $accentColor: e,
1158
- "aria-expanded": w,
1159
- "aria-controls": x,
1173
+ $open: y,
1174
+ $accentColor: u,
1175
+ "aria-expanded": y,
1176
+ "aria-controls": b,
1160
1177
  onClick: () => {
1161
- const f = !w;
1162
- C || u(f), l?.(f);
1178
+ const k = !y;
1179
+ w || p(k), c?.(k);
1163
1180
  },
1164
1181
  children: [
1165
- /* @__PURE__ */ m(kr, { children: [
1166
- /* @__PURE__ */ i(Cr, { children: o }),
1167
- (d || c) && /* @__PURE__ */ m(Sr, { children: [
1168
- d && /* @__PURE__ */ i(zr, { children: d }),
1169
- c && /* @__PURE__ */ i(Tr, { onClick: (f) => f.stopPropagation(), children: c })
1182
+ /* @__PURE__ */ C(Ur, { children: [
1183
+ /* @__PURE__ */ s(qr, { children: o }),
1184
+ (a || l) && /* @__PURE__ */ C(Xr, { children: [
1185
+ a && /* @__PURE__ */ s(Gr, { children: a }),
1186
+ l && /* @__PURE__ */ s(Zr, { onClick: (k) => k.stopPropagation(), children: l })
1170
1187
  ] })
1171
1188
  ] }),
1172
- /* @__PURE__ */ i(
1173
- Ir,
1189
+ /* @__PURE__ */ s(
1190
+ Jr,
1174
1191
  {
1175
- $open: w,
1176
- $accentColor: e,
1192
+ $open: y,
1193
+ $accentColor: u,
1177
1194
  "aria-hidden": "true",
1178
- children: /* @__PURE__ */ i(lo, { size: 18, strokeWidth: 2.5 })
1195
+ children: /* @__PURE__ */ s(To, { size: 18, strokeWidth: 2.5 })
1179
1196
  }
1180
1197
  )
1181
1198
  ]
1182
1199
  }
1183
1200
  ),
1184
- /* @__PURE__ */ i(Wr, { $open: w, children: /* @__PURE__ */ i(Er, { id: x, role: "region", "aria-label": o, children: /* @__PURE__ */ i(Br, { children: r }) }) })
1201
+ /* @__PURE__ */ s(Qr, { $open: y, children: /* @__PURE__ */ s(on, { id: b, role: "region", "aria-label": o, children: /* @__PURE__ */ s(rn, { children: r }) }) })
1185
1202
  ] });
1186
1203
  }
1187
- Or.displayName = "CollapsibleCard";
1188
- const po = so(null);
1189
- function Gr({ children: o }) {
1190
- const [r, s] = W(null), a = j((d) => {
1191
- s({ ...d, id: Date.now() });
1192
- }, []), l = wo(() => {
1193
- const d = (c) => a(c);
1194
- return d.success = (c, e) => a({ ...e, message: c, variant: "success" }), d.error = (c, e) => a({ ...e, message: c, variant: "error" }), d.warning = (c, e) => a({ ...e, message: c, variant: "warning" }), d.info = (c, e) => a({ ...e, message: c, variant: "info" }), d;
1195
- }, [a]);
1196
- return /* @__PURE__ */ m(po.Provider, { value: { toast: l }, children: [
1204
+ nn.displayName = "CollapsibleCard";
1205
+ const Wo = mo(null);
1206
+ function An({ children: o }) {
1207
+ const [r, n] = D(null), e = R((a) => {
1208
+ n({ ...a, id: Date.now() });
1209
+ }, []), c = uo(() => Object.assign((a) => e(a), {
1210
+ success: (a, l) => e({ ...l, message: a, variant: "success" }),
1211
+ error: (a, l) => e({ ...l, message: a, variant: "error" }),
1212
+ warning: (a, l) => e({ ...l, message: a, variant: "warning" }),
1213
+ info: (a, l) => e({ ...l, message: a, variant: "info" })
1214
+ }), [e]);
1215
+ return /* @__PURE__ */ C(Wo.Provider, { value: { toast: c }, children: [
1197
1216
  o,
1198
- r && /* @__PURE__ */ i(
1199
- uo,
1217
+ r && /* @__PURE__ */ s(
1218
+ Eo,
1200
1219
  {
1201
1220
  open: !0,
1202
- onClose: () => s(null),
1221
+ onClose: () => n(null),
1203
1222
  message: r.message,
1204
1223
  variant: r.variant,
1205
1224
  duration: r.duration,
@@ -1209,102 +1228,156 @@ function Gr({ children: o }) {
1209
1228
  )
1210
1229
  ] });
1211
1230
  }
1212
- function Jr() {
1213
- const o = no(po);
1231
+ function jn() {
1232
+ const o = ko(Wo);
1214
1233
  if (!o)
1215
1234
  throw new Error("useToast must be used within a ToastProvider");
1216
1235
  return o;
1217
1236
  }
1218
- function Qr({
1237
+ function Rn({
1219
1238
  initialValues: o,
1220
1239
  validate: r,
1221
- onSubmit: s,
1222
- onError: a
1240
+ onSubmit: n,
1241
+ onError: e
1223
1242
  }) {
1224
- const [l, d] = W(o), [c, e] = W(
1243
+ const [c, a] = D(o), [l, u] = D(
1225
1244
  {}
1226
- ), [p, u] = W({}), [x, C] = W(!1), w = Y(l);
1227
- w.current = l;
1228
- const b = j(
1229
- ($) => {
1245
+ ), [x, p] = D({}), [b, w] = D(!1), y = oo(c);
1246
+ y.current = c;
1247
+ const g = R(
1248
+ (h) => {
1230
1249
  if (!r)
1231
1250
  return {};
1232
- const y = r($);
1251
+ const $ = r(h);
1233
1252
  return Object.fromEntries(
1234
- Object.entries(y).filter(([, v]) => v !== void 0)
1253
+ Object.entries($).filter(([, m]) => m !== void 0)
1235
1254
  );
1236
1255
  },
1237
1256
  [r]
1238
- ), f = Y(p);
1239
- f.current = p;
1240
- const S = j(
1241
- ($) => {
1242
- const { name: y, value: v } = $.target, k = { ...w.current, [y]: v };
1243
- d(k), f.current[y] && e(b(k));
1257
+ ), k = oo(x);
1258
+ k.current = x;
1259
+ const T = R(
1260
+ (h) => {
1261
+ const { name: $, value: m } = h.target, O = { ...y.current, [$]: m };
1262
+ a(O), k.current[$] && u(g(O));
1244
1263
  },
1245
- [b]
1246
- ), z = j(
1247
- ($) => {
1248
- const { name: y } = $.target;
1249
- u((v) => ({ ...v, [y]: !0 })), e(b(w.current));
1264
+ [g]
1265
+ ), z = R(
1266
+ (h) => {
1267
+ const { name: $ } = h.target;
1268
+ p((m) => ({ ...m, [$]: !0 })), u(g(y.current));
1250
1269
  },
1251
- [b]
1252
- ), h = j(
1253
- ($) => {
1254
- $?.preventDefault();
1255
- const y = Object.keys(w.current).reduce(
1256
- (A, D) => ({ ...A, [D]: !0 }),
1270
+ [g]
1271
+ ), v = R(
1272
+ (h) => {
1273
+ h?.preventDefault();
1274
+ const $ = Object.keys(y.current).reduce(
1275
+ (j, _) => ({ ...j, [_]: !0 }),
1257
1276
  {}
1258
1277
  );
1259
- u(y);
1260
- const v = b(w.current);
1261
- if (e(v), Object.keys(v).length > 0) {
1262
- a?.(v);
1278
+ p($);
1279
+ const m = g(y.current);
1280
+ if (u(m), Object.keys(m).length > 0) {
1281
+ e?.(m);
1263
1282
  return;
1264
1283
  }
1265
1284
  (async () => {
1266
- C(!0);
1285
+ w(!0);
1267
1286
  try {
1268
- await s?.(w.current);
1287
+ await n?.(y.current);
1269
1288
  } finally {
1270
- C(!1);
1289
+ w(!1);
1271
1290
  }
1272
1291
  })();
1273
1292
  },
1274
- [b, s, a]
1275
- ), E = j(($, y) => {
1276
- d((v) => ({ ...v, [$]: y }));
1277
- }, []), B = j(() => {
1278
- d(o), e({}), u({}), C(!1);
1279
- }, [o]), O = Object.fromEntries(
1280
- Object.entries(c).filter(([$]) => p[$])
1293
+ [g, n, e]
1294
+ ), I = R((h, $) => {
1295
+ a((m) => ({ ...m, [h]: $ }));
1296
+ }, []), P = R(() => {
1297
+ a(o), u({}), p({}), w(!1);
1298
+ }, [o]), B = Object.fromEntries(
1299
+ Object.entries(l).filter(([h]) => x[h])
1281
1300
  );
1282
1301
  return {
1283
- values: l,
1284
- errors: O,
1285
- touched: p,
1286
- handleChange: S,
1302
+ values: c,
1303
+ errors: B,
1304
+ touched: x,
1305
+ handleChange: T,
1287
1306
  handleBlur: z,
1288
- handleSubmit: h,
1289
- setFieldValue: E,
1290
- reset: B,
1291
- isSubmitting: x
1307
+ handleSubmit: v,
1308
+ setFieldValue: I,
1309
+ reset: P,
1310
+ isSubmitting: b
1292
1311
  };
1293
1312
  }
1294
- const fo = t.div`
1295
- overflow-x: auto;
1313
+ function tn(o, r) {
1314
+ return o?.key !== r ? { key: r, direction: "asc" } : o.direction === "asc" ? { key: r, direction: "desc" } : null;
1315
+ }
1316
+ function sn({
1317
+ data: o,
1318
+ sort: r,
1319
+ defaultSort: n,
1320
+ onSortChange: e
1321
+ }) {
1322
+ const c = r !== void 0, [a, l] = D(
1323
+ n ?? null
1324
+ ), u = c ? r ?? null : a, x = (b) => {
1325
+ const w = tn(u, b);
1326
+ return c || l(w), e?.(w), w;
1327
+ }, p = uo(() => c || !u ? o : [...o].sort((b, w) => {
1328
+ const y = b[u.key], g = w[u.key], k = y < g ? -1 : y > g ? 1 : 0;
1329
+ return u.direction === "asc" ? k : -k;
1330
+ }), [o, u, c]);
1331
+ return { activeSort: u, sortedData: p, handleSort: x };
1332
+ }
1333
+ const en = 7, ho = 3, wo = 1;
1334
+ function an(o, r) {
1335
+ if (r <= en)
1336
+ return Array.from({ length: r }, (e, c) => c + 1);
1337
+ const n = [1];
1338
+ o > ho && n.push("...");
1339
+ for (let e = Math.max(2, o - wo); e <= Math.min(r - 1, o + wo); e++)
1340
+ n.push(e);
1341
+ return o < r - ho + 1 && n.push("..."), n.push(r), n;
1342
+ }
1343
+ function ln({
1344
+ data: o,
1345
+ pageSize: r,
1346
+ page: n,
1347
+ defaultPage: e,
1348
+ totalRows: c,
1349
+ onPageChange: a
1350
+ }) {
1351
+ const l = n !== void 0, [u, x] = D(e ?? 1), p = l ? n : u, b = (T) => {
1352
+ l || x(T), a?.(T);
1353
+ }, w = l || c !== void 0, y = c ?? o.length, g = r ? Math.max(1, Math.ceil(y / r)) : 1, k = uo(() => {
1354
+ if (!r || w)
1355
+ return o;
1356
+ const T = (p - 1) * r;
1357
+ return o.slice(T, T + r);
1358
+ }, [o, r, p, w]);
1359
+ return { activePage: p, totalPages: g, displayData: k, handlePageChange: b };
1360
+ }
1361
+ const Oo = (o, r) => o === "sm" ? `${r.spacing[1]} ${r.spacing[2]}` : o === "lg" ? `${r.spacing[3]} ${r.spacing[4]}` : `${r.spacing[2]} ${r.spacing[3]}`, Po = i.div`
1296
1362
  width: 100%;
1297
1363
 
1298
- ${({ theme: o }) => o.brutalism ? n`
1299
- border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
1300
- box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
1301
- 0 ${o.colors.neutral[900]};
1302
- ` : n`
1303
- border: 1px solid ${o.colors.neutral[300]};
1364
+ ${({ theme: o, $borderColor: r }) => o.brutalism ? t`
1365
+ border: ${o.brutalism.borderWidth} solid
1366
+ ${r ?? o.colors.neutral[900]};
1367
+ box-shadow: ${o.brutalism.shadowOffset}
1368
+ ${o.brutalism.shadowOffset} 0
1369
+ ${r ?? o.colors.neutral[900]};
1370
+ ` : t`
1371
+ border: 1px solid ${r ?? o.colors.neutral[300]};
1304
1372
  border-radius: ${o.radius.md};
1305
1373
  overflow: hidden;
1306
1374
  `}
1307
- `, $o = t.table`
1375
+
1376
+ overflow-x: auto;
1377
+ ${({ $stickyHeader: o }) => o && t`
1378
+ overflow-y: auto;
1379
+ `}
1380
+ `, Bo = i.table`
1308
1381
  width: 100%;
1309
1382
  border-collapse: collapse;
1310
1383
  font-size: ${({ $size: o, theme: r }) => ({
@@ -1312,108 +1385,366 @@ const fo = t.div`
1312
1385
  md: r.fontSizes.md,
1313
1386
  lg: r.fontSizes.lg
1314
1387
  })[o]};
1315
- `, bo = t.thead`
1316
- ${({ theme: o }) => o.brutalism ? n`
1317
- background-color: ${o.colors.neutral[900]};
1318
- color: ${o.colors.neutral[0]};
1319
- ` : n`
1320
- background-color: ${o.colors.neutral[100]};
1321
- color: ${o.colors.neutral[600]};
1322
- `}
1323
- `, go = t.tbody`
1324
- ${({ $variant: o, theme: r }) => o === "striped" && n`
1388
+
1389
+ caption {
1390
+ padding: 8px 0;
1391
+ }
1392
+ `, Do = i.thead`
1393
+ ${({ $stickyHeader: o }) => o && t`
1394
+ position: sticky;
1395
+ top: 0;
1396
+ z-index: 1;
1397
+ `}
1398
+
1399
+ ${({ theme: o, $headerColor: r, $borderColor: n }) => r ? t`
1400
+ --th-bg: ${r};
1401
+ --th-text: ${o.colors.neutral[0]};
1402
+ --th-sep: rgba(255, 255, 255, 0.25);
1403
+ ` : o.brutalism ? t`
1404
+ --th-bg: ${o.colors.neutral[900]};
1405
+ --th-text: ${o.colors.neutral[0]};
1406
+ --th-sep: ${n ?? o.colors.neutral[600]};
1407
+ ` : t`
1408
+ --th-bg: ${o.colors.neutral[100]};
1409
+ --th-text: ${o.colors.neutral[600]};
1410
+ --th-sep: ${n ?? o.colors.neutral[300]};
1411
+ `}
1412
+ `, No = i.tbody`
1413
+ ${({ $rowColor: o }) => o && t`
1414
+ tr {
1415
+ background-color: ${o};
1416
+ }
1417
+ `}
1418
+
1419
+ ${({ $striped: o, theme: r, $stripeColor: n }) => o && t`
1325
1420
  tr:nth-child(even) {
1326
- background-color: ${r.colors.neutral[100]};
1421
+ background-color: ${n ?? r.colors.neutral[100]};
1327
1422
  }
1328
1423
  `}
1329
1424
 
1330
1425
  tr:last-child td {
1331
1426
  border-bottom: none;
1332
1427
  }
1333
- `, H = t.tr``, Z = t.th`
1428
+ `, q = i.tr``, po = i.th`
1429
+ background-color: var(--th-bg);
1430
+ color: var(--th-text);
1334
1431
  text-align: left;
1335
1432
  font-weight: 700;
1336
1433
  white-space: nowrap;
1337
1434
 
1338
- ${({ $size: o, theme: r }) => ({
1339
- sm: n`
1340
- padding: ${r.spacing[1]} ${r.spacing[2]};
1341
- `,
1342
- md: n`
1343
- padding: ${r.spacing[2]} ${r.spacing[3]};
1344
- `,
1345
- lg: n`
1346
- padding: ${r.spacing[3]} ${r.spacing[4]};
1347
- `
1348
- })[o]}
1435
+ padding: ${({ $size: o, theme: r }) => Oo(o, r)};
1349
1436
 
1350
- ${({ theme: o }) => o.brutalism ? n`
1351
- border-right: 1px solid ${o.colors.neutral[600]};
1352
- &:last-child {
1353
- border-right: none;
1354
- }
1355
- ` : n`
1356
- border-bottom: 2px solid ${o.colors.neutral[300]};
1357
- border-right: 1px solid ${o.colors.neutral[200]};
1437
+ ${({ theme: o, $bordered: r }) => o.brutalism ? t`
1438
+ border-right: 1px solid var(--th-sep);
1358
1439
  &:last-child {
1359
1440
  border-right: none;
1360
1441
  }
1442
+ ` : t`
1443
+ border-bottom: 2px solid var(--th-sep);
1444
+ ${r && t`
1445
+ border-right: 1px solid var(--th-sep);
1446
+ &:last-child {
1447
+ border-right: none;
1448
+ }
1449
+ `}
1361
1450
  `}
1362
- `, X = t.td`
1363
- ${({ $size: o, theme: r }) => ({
1364
- sm: n`
1365
- padding: ${r.spacing[1]} ${r.spacing[2]};
1366
- `,
1367
- md: n`
1368
- padding: ${r.spacing[2]} ${r.spacing[3]};
1369
- `,
1370
- lg: n`
1371
- padding: ${r.spacing[3]} ${r.spacing[4]};
1372
- `
1373
- })[o]}
1451
+ `, cn = i.button`
1452
+ display: inline-flex;
1453
+ align-items: center;
1454
+ gap: ${({ theme: o }) => o.spacing[1]};
1455
+ background: none;
1456
+ border: none;
1457
+ cursor: pointer;
1458
+ font: inherit;
1459
+ color: inherit;
1460
+ font-weight: 700;
1461
+ padding: 0;
1462
+ width: 100%;
1463
+ text-align: left;
1374
1464
 
1375
- ${({ $variant: o, theme: r }) => r.brutalism ? n`
1376
- border-bottom: ${r.brutalism.borderWidth} solid
1377
- ${r.colors.neutral[900]};
1378
- ${o === "bordered" && n`
1379
- border-right: ${r.brutalism.borderWidth} solid
1380
- ${r.colors.neutral[900]};
1465
+ &:focus-visible {
1466
+ outline: 2px solid currentColor;
1467
+ outline-offset: 2px;
1468
+ border-radius: 2px;
1469
+ }
1470
+ `, dn = i.span`
1471
+ opacity: 0.5;
1472
+ display: inline-flex;
1473
+ align-items: center;
1474
+ `, ro = i.td`
1475
+ padding: ${({ $size: o, theme: r }) => Oo(o, r)};
1476
+
1477
+ ${({ $bordered: o, $borderColor: r, theme: n }) => n.brutalism ? t`
1478
+ border-bottom: ${n.brutalism.borderWidth} solid
1479
+ ${r ?? n.colors.neutral[900]};
1480
+ ${o && t`
1481
+ border-right: ${n.brutalism.borderWidth} solid
1482
+ ${r ?? n.colors.neutral[900]};
1381
1483
  &:last-child {
1382
1484
  border-right: none;
1383
1485
  }
1384
1486
  `}
1385
- ` : o === "bordered" ? n`
1386
- border: 1px solid ${r.colors.neutral[300]};
1387
- ` : n`
1388
- border-bottom: 1px solid ${r.colors.neutral[200]};
1487
+ ` : o ? t`
1488
+ border: 1px solid ${r ?? n.colors.neutral[300]};
1489
+ ` : t`
1490
+ border-bottom: 1px solid
1491
+ ${r ?? n.colors.neutral[200]};
1389
1492
  `}
1390
- `;
1391
- function jr({
1493
+ `, un = i.td`
1494
+ text-align: center;
1495
+ color: ${({ theme: o }) => o.colors.neutral[400]};
1496
+ padding: ${({ theme: o }) => `${o.spacing[4]} ${o.spacing[3]}`};
1497
+ font-size: ${({ theme: o }) => o.fontSizes.sm};
1498
+ border-bottom: none;
1499
+ `, pn = M`
1500
+ 0% { background-position: -400px 0; }
1501
+ 100% { background-position: 400px 0; }
1502
+ `, fn = i(ro)``, gn = i.div`
1503
+ height: 14px;
1504
+ border-radius: 4px;
1505
+ background: linear-gradient(
1506
+ 90deg,
1507
+ ${({ theme: o }) => o.colors.neutral[200]} 25%,
1508
+ ${({ theme: o }) => o.colors.neutral[100]} 50%,
1509
+ ${({ theme: o }) => o.colors.neutral[200]} 75%
1510
+ );
1511
+ background-size: 800px 100%;
1512
+ animation: ${pn} 1.6s ease-in-out infinite;
1513
+ `, bn = i.div`
1514
+ display: flex;
1515
+ align-items: center;
1516
+ justify-content: center;
1517
+ gap: ${({ theme: o }) => o.spacing[1]};
1518
+ padding: ${({ theme: o }) => `${o.spacing[2]} ${o.spacing[3]}`};
1519
+
1520
+ ${({ theme: o }) => o.brutalism ? t`
1521
+ border-top: ${o.brutalism.borderWidth} solid
1522
+ ${o.colors.neutral[900]};
1523
+ ` : t`
1524
+ border-top: 1px solid ${o.colors.neutral[200]};
1525
+ `}
1526
+ `, eo = i.button`
1527
+ display: inline-flex;
1528
+ align-items: center;
1529
+ justify-content: center;
1530
+ min-width: 32px;
1531
+ height: 32px;
1532
+ padding: 0 ${({ theme: o }) => o.spacing[2]};
1533
+ font: inherit;
1534
+ font-size: ${({ theme: o }) => o.fontSizes.sm};
1535
+ cursor: pointer;
1536
+
1537
+ ${({ $active: o, theme: r }) => r.brutalism ? t`
1538
+ border: ${r.brutalism.borderWidth} solid
1539
+ ${r.colors.neutral[900]};
1540
+ background: ${o ? r.colors.neutral[900] : "transparent"};
1541
+ color: ${o ? r.colors.neutral[0] : r.colors.neutral[900]};
1542
+ box-shadow: ${o ? "none" : `2px 2px 0 ${r.colors.neutral[900]}`};
1543
+
1544
+ &:hover:not(:disabled) {
1545
+ background: ${o ? r.colors.neutral[600] : r.colors.neutral[100]};
1546
+ }
1547
+ ` : t`
1548
+ border: 1px solid
1549
+ ${o ? r.colors.primary[500] : "transparent"};
1550
+ border-radius: ${r.radius.md};
1551
+ background: ${o ? r.colors.primary[500] : "transparent"};
1552
+ color: ${o ? r.colors.neutral[0] : r.colors.neutral[600]};
1553
+
1554
+ &:hover:not(:disabled) {
1555
+ background: ${o ? r.colors.primary[700] : r.colors.neutral[100]};
1556
+ border-color: ${o ? r.colors.primary[700] : r.colors.neutral[200]};
1557
+ }
1558
+ `}
1559
+
1560
+ &:disabled {
1561
+ opacity: 0.4;
1562
+ cursor: not-allowed;
1563
+ }
1564
+
1565
+ &:focus-visible {
1566
+ outline: 2px solid ${({ theme: o }) => o.colors.primary[500]};
1567
+ outline-offset: 2px;
1568
+ }
1569
+ `, $n = 4;
1570
+ function xn(o, r) {
1571
+ return o?.key !== r ? /* @__PURE__ */ s(xr, { size: 14 }) : o.direction === "asc" ? /* @__PURE__ */ s(hr, { size: 14 }) : /* @__PURE__ */ s(br, { size: 14 });
1572
+ }
1573
+ function yn({
1392
1574
  columns: o,
1393
1575
  data: r,
1394
- size: s = "md",
1395
- variant: a = "default",
1396
- caption: l,
1397
- className: d,
1398
- style: c
1576
+ rowKey: n,
1577
+ size: e = "md",
1578
+ striped: c,
1579
+ bordered: a,
1580
+ stickyHeader: l,
1581
+ caption: u,
1582
+ emptyMessage: x = "No data",
1583
+ loading: p,
1584
+ sort: b,
1585
+ defaultSort: w,
1586
+ onSortChange: y,
1587
+ pageSize: g,
1588
+ page: k,
1589
+ defaultPage: T,
1590
+ totalRows: z,
1591
+ onPageChange: v,
1592
+ onChange: I,
1593
+ borderColor: P,
1594
+ headerColor: B,
1595
+ rowColor: h,
1596
+ stripeColor: $,
1597
+ className: m,
1598
+ style: O
1399
1599
  }) {
1400
- return /* @__PURE__ */ i(fo, { className: d, style: c, children: /* @__PURE__ */ m($o, { $size: s, children: [
1401
- l && /* @__PURE__ */ i("caption", { children: l }),
1402
- /* @__PURE__ */ i(bo, { children: /* @__PURE__ */ i(H, { children: o.map((e) => /* @__PURE__ */ i(
1403
- Z,
1404
- {
1405
- $size: s,
1406
- style: e.width ? { width: e.width } : void 0,
1407
- children: e.header
1408
- },
1409
- e.key
1410
- )) }) }),
1411
- /* @__PURE__ */ i(go, { $variant: a, children: r.map((e, p) => /* @__PURE__ */ i(H, { children: o.map((u) => /* @__PURE__ */ i(X, { $size: s, $variant: a, children: u.render ? u.render(e[u.key], e, p) : String(e[u.key] ?? "") }, u.key)) }, p)) })
1412
- ] }) });
1600
+ const {
1601
+ activeSort: j,
1602
+ sortedData: _,
1603
+ handleSort: H
1604
+ } = sn({
1605
+ data: r,
1606
+ sort: b,
1607
+ defaultSort: w,
1608
+ onSortChange: y
1609
+ }), {
1610
+ activePage: N,
1611
+ totalPages: Y,
1612
+ displayData: Z,
1613
+ handlePageChange: no
1614
+ } = ln({
1615
+ data: _,
1616
+ pageSize: g,
1617
+ page: k,
1618
+ defaultPage: T,
1619
+ totalRows: z,
1620
+ onPageChange: v
1621
+ }), to = (d) => {
1622
+ const S = H(d);
1623
+ I?.({ sort: S, page: N });
1624
+ }, U = (d) => {
1625
+ no(d), I?.({ sort: j, page: d });
1626
+ }, f = (d, S) => String(n ? d[n] : S), E = !p && Z.length === 0, W = g ?? $n;
1627
+ return /* @__PURE__ */ C(
1628
+ Po,
1629
+ {
1630
+ $borderColor: P,
1631
+ $stickyHeader: l,
1632
+ className: m,
1633
+ style: O,
1634
+ children: [
1635
+ /* @__PURE__ */ C(Bo, { $size: e, children: [
1636
+ u && /* @__PURE__ */ s("caption", { children: u }),
1637
+ /* @__PURE__ */ s(
1638
+ Do,
1639
+ {
1640
+ $headerColor: B,
1641
+ $borderColor: P,
1642
+ $stickyHeader: l,
1643
+ children: /* @__PURE__ */ s(q, { children: o.map((d) => /* @__PURE__ */ s(
1644
+ po,
1645
+ {
1646
+ $size: e,
1647
+ $bordered: a,
1648
+ scope: "col",
1649
+ style: d.width ? { width: d.width } : void 0,
1650
+ children: d.sortable ? /* @__PURE__ */ C(
1651
+ cn,
1652
+ {
1653
+ type: "button",
1654
+ onClick: () => to(d.key),
1655
+ "aria-label": `Sort by ${d.header}${j?.key === d.key ? `, ${j.direction}ending` : ""}`,
1656
+ children: [
1657
+ d.header,
1658
+ /* @__PURE__ */ s(dn, { "aria-hidden": "true", children: xn(j, d.key) })
1659
+ ]
1660
+ }
1661
+ ) : d.header
1662
+ },
1663
+ d.key
1664
+ )) })
1665
+ }
1666
+ ),
1667
+ /* @__PURE__ */ s(
1668
+ No,
1669
+ {
1670
+ $striped: c,
1671
+ $rowColor: h,
1672
+ $stripeColor: $,
1673
+ children: p ? Array.from({ length: W }).map((d, S) => /* @__PURE__ */ s(q, { children: o.map((L) => /* @__PURE__ */ s(
1674
+ fn,
1675
+ {
1676
+ $size: e,
1677
+ $bordered: a,
1678
+ $borderColor: P,
1679
+ children: /* @__PURE__ */ s(gn, {})
1680
+ },
1681
+ L.key
1682
+ )) }, S)) : E ? /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s(un, { colSpan: o.length, children: x }) }) : Z.map((d, S) => /* @__PURE__ */ s(q, { children: o.map((L) => /* @__PURE__ */ s(
1683
+ ro,
1684
+ {
1685
+ $size: e,
1686
+ $bordered: a,
1687
+ $borderColor: P,
1688
+ children: L.render ? L.render(d[L.key], d, S) : String(d[L.key] ?? "") || " "
1689
+ },
1690
+ L.key
1691
+ )) }, f(d, S)))
1692
+ }
1693
+ )
1694
+ ] }),
1695
+ g && Y > 1 && /* @__PURE__ */ C(bn, { children: [
1696
+ /* @__PURE__ */ s(
1697
+ eo,
1698
+ {
1699
+ type: "button",
1700
+ onClick: () => U(N - 1),
1701
+ disabled: N <= 1,
1702
+ "aria-label": "Previous page",
1703
+ children: "←"
1704
+ }
1705
+ ),
1706
+ an(N, Y).map(
1707
+ (d, S) => d === "..." ? /* @__PURE__ */ s(
1708
+ "span",
1709
+ {
1710
+ "aria-hidden": "true",
1711
+ style: { padding: "0 4px" },
1712
+ children: "…"
1713
+ },
1714
+ `e${S}`
1715
+ ) : /* @__PURE__ */ s(
1716
+ eo,
1717
+ {
1718
+ type: "button",
1719
+ $active: d === N,
1720
+ onClick: () => U(d),
1721
+ "aria-label": `Page ${d}`,
1722
+ "aria-current": d === N ? "page" : void 0,
1723
+ children: d
1724
+ },
1725
+ d
1726
+ )
1727
+ ),
1728
+ /* @__PURE__ */ s(
1729
+ eo,
1730
+ {
1731
+ type: "button",
1732
+ onClick: () => U(N + 1),
1733
+ disabled: N >= Y,
1734
+ "aria-label": "Next page",
1735
+ children: "→"
1736
+ }
1737
+ )
1738
+ ] })
1739
+ ]
1740
+ }
1741
+ );
1413
1742
  }
1414
- jr.displayName = "Table";
1415
- const Rr = t(X)`
1416
- ${({ $editable: o, theme: r }) => o && n`
1743
+ yn.displayName = "Table";
1744
+ const hn = i(Bo)`
1745
+ table-layout: fixed;
1746
+ `, wn = i(ro)`
1747
+ ${({ $editable: o, theme: r }) => o && t`
1417
1748
  cursor: pointer;
1418
1749
  position: relative;
1419
1750
 
@@ -1421,8 +1752,11 @@ const Rr = t(X)`
1421
1752
  background-color: ${r.brutalism ? r.colors.neutral[100] : r.colors.primary[50]};
1422
1753
  }
1423
1754
  `}
1424
- `, Ar = t.input`
1755
+ `, vn = i.input`
1756
+ display: block;
1425
1757
  width: 100%;
1758
+ min-width: 0;
1759
+ box-sizing: border-box;
1426
1760
  border: none;
1427
1761
  outline: none;
1428
1762
  background: transparent;
@@ -1431,24 +1765,24 @@ const Rr = t(X)`
1431
1765
  padding: 0;
1432
1766
  margin: 0;
1433
1767
 
1434
- ${({ theme: o }) => o.brutalism ? n`
1768
+ ${({ theme: o }) => o.brutalism ? t`
1435
1769
  &:focus {
1436
1770
  outline: 2px solid ${o.colors.neutral[900]};
1437
1771
  outline-offset: 1px;
1438
1772
  }
1439
- ` : n`
1773
+ ` : t`
1440
1774
  &:focus {
1441
1775
  box-shadow: ${o.shadows.focusRing};
1442
1776
  }
1443
1777
  `}
1444
- `, Lr = t(Z)`
1778
+ `, kn = i(po)`
1445
1779
  width: 40px;
1446
- `, Nr = t(X)`
1780
+ `, mn = i(ro)`
1447
1781
  width: 40px;
1448
1782
  text-align: center;
1449
1783
  padding-left: 0;
1450
1784
  padding-right: 0;
1451
- `, Vr = t.button`
1785
+ `, Sn = i.button`
1452
1786
  display: inline-flex;
1453
1787
  align-items: center;
1454
1788
  justify-content: center;
@@ -1466,18 +1800,18 @@ const Rr = t(X)`
1466
1800
  &:hover {
1467
1801
  color: ${({ theme: o }) => o.colors.error[500]};
1468
1802
 
1469
- ${({ theme: o }) => o.brutalism && n`
1803
+ ${({ theme: o }) => o.brutalism && t`
1470
1804
  background-color: ${o.colors.error[50]};
1471
1805
  `}
1472
1806
  }
1473
- `, Dr = t.tr`
1474
- ${({ theme: o }) => o.brutalism ? n`
1807
+ `, Cn = i.tr`
1808
+ ${({ theme: o }) => o.brutalism ? t`
1475
1809
  border-top: ${o.brutalism.borderWidth} solid
1476
1810
  ${o.colors.neutral[900]};
1477
- ` : n`
1811
+ ` : t`
1478
1812
  border-top: 1px solid ${o.colors.neutral[200]};
1479
1813
  `}
1480
- `, Fr = t.button`
1814
+ `, zn = i.button`
1481
1815
  display: inline-flex;
1482
1816
  align-items: center;
1483
1817
  gap: ${({ theme: o }) => o.spacing[1]};
@@ -1500,104 +1834,166 @@ const Rr = t(X)`
1500
1834
  outline-offset: 2px;
1501
1835
  }
1502
1836
  `;
1503
- function Mr({
1837
+ function ao(o, r, n) {
1838
+ return typeof o.editable == "function" ? o.editable(r, n) : !!o.editable;
1839
+ }
1840
+ function Tn({
1504
1841
  columns: o,
1505
1842
  defaultData: r,
1506
- data: s,
1507
- onChange: a,
1508
- size: l = "md",
1509
- addRowLabel: d = "Add row",
1510
- newRowFactory: c,
1511
- deletable: e = !1,
1512
- className: p,
1513
- style: u
1843
+ data: n,
1844
+ rowKey: e,
1845
+ onChange: c,
1846
+ size: a = "md",
1847
+ borderColor: l,
1848
+ headerColor: u,
1849
+ addRowLabel: x = "Add row",
1850
+ newRowFactory: p,
1851
+ deletable: b = !1,
1852
+ className: w,
1853
+ style: y
1514
1854
  }) {
1515
- const x = s !== void 0, [C, w] = W(r ?? []), b = x ? s : C, [f, S] = W(null), [z, h] = W(""), E = Y(null);
1516
- V(() => {
1517
- f && (E.current?.focus(), E.current?.select());
1518
- }, [f]);
1519
- const B = j(
1520
- (g) => {
1521
- x || w(g), a?.(g);
1855
+ const g = n !== void 0, [k, T] = D(r ?? []), z = g ? n : k, [v, I] = D(null), [P, B] = D(""), h = oo(null);
1856
+ K(() => {
1857
+ v && (h.current?.focus(), h.current?.select());
1858
+ }, [v]);
1859
+ const $ = R(
1860
+ (f) => {
1861
+ g || T(f), c?.(f);
1862
+ },
1863
+ [g, c]
1864
+ ), m = R(
1865
+ () => p ? p() : Object.fromEntries(o.map((f) => [f.key, ""])),
1866
+ [p, o]
1867
+ ), O = R(
1868
+ (f) => {
1869
+ const E = [];
1870
+ return f.forEach((W, d) => {
1871
+ o.forEach((S) => {
1872
+ ao(S, W, d) && E.push({ rowIndex: d, colKey: S.key });
1873
+ });
1874
+ }), E;
1522
1875
  },
1523
- [x, a]
1524
- ), O = (g, T, I) => {
1525
- S({ rowIndex: g, colKey: T }), h(String(I ?? ""));
1526
- }, $ = j(() => {
1527
- if (!f) return;
1528
- const { rowIndex: g, colKey: T } = f, I = b.map(
1529
- (L, F) => F === g ? { ...L, [T]: z } : L
1876
+ [o]
1877
+ ), j = (f, E, W) => {
1878
+ I({ rowIndex: f, colKey: E }), B(String(W ?? ""));
1879
+ }, _ = R(() => {
1880
+ if (!v)
1881
+ return;
1882
+ const { rowIndex: f, colKey: E } = v, W = z.map(
1883
+ (d, S) => S === f ? { ...d, [E]: P } : d
1530
1884
  );
1531
- B(I), S(null);
1532
- }, [f, b, z, B]), y = () => {
1533
- S(null), h("");
1534
- }, v = (g) => {
1535
- g.key === "Enter" && $(), g.key === "Escape" && y();
1536
- }, k = () => {
1537
- const g = c ? c() : Object.fromEntries(o.map((T) => [T.key, ""]));
1538
- B([...b, g]);
1539
- }, A = (g) => {
1540
- f?.rowIndex === g && S(null), B(b.filter((T, I) => I !== g));
1541
- }, D = e ? o.length + 1 : o.length;
1542
- return /* @__PURE__ */ i(fo, { className: p, style: u, children: /* @__PURE__ */ m($o, { $size: l, children: [
1543
- /* @__PURE__ */ i(bo, { children: /* @__PURE__ */ m(H, { children: [
1544
- o.map((g) => /* @__PURE__ */ i(
1545
- Z,
1546
- {
1547
- $size: l,
1548
- style: g.width ? { width: g.width } : void 0,
1549
- children: g.header
1550
- },
1551
- g.key
1552
- )),
1553
- e && /* @__PURE__ */ i(Lr, { $size: l, "aria-label": "Actions" })
1554
- ] }) }),
1555
- /* @__PURE__ */ m(go, { $variant: "default", children: [
1556
- b.map((g, T) => /* @__PURE__ */ m(H, { children: [
1557
- o.map((I) => {
1558
- const L = f?.rowIndex === T && f.colKey === I.key, F = g[I.key];
1559
- return /* @__PURE__ */ i(
1560
- Rr,
1885
+ $(W), I(null);
1886
+ }, [v, z, P, $]), H = () => {
1887
+ I(null), B("");
1888
+ }, N = (f) => {
1889
+ if (!v)
1890
+ return;
1891
+ f.preventDefault();
1892
+ const { rowIndex: E, colKey: W } = v, d = z.map(
1893
+ (A, J) => J === E ? { ...A, [W]: P } : A
1894
+ );
1895
+ $(d);
1896
+ const S = O(d), L = S.findIndex(
1897
+ (A) => A.rowIndex === E && A.colKey === W
1898
+ ), V = f.shiftKey ? L - 1 : L + 1;
1899
+ if (V >= 0 && V < S.length) {
1900
+ const A = S[V];
1901
+ I(A), B(String(d[A.rowIndex][A.colKey] ?? ""));
1902
+ return;
1903
+ }
1904
+ if (!f.shiftKey && V >= S.length) {
1905
+ const A = m(), J = [...d, A];
1906
+ $(J);
1907
+ const fo = J.length - 1, go = o.find(
1908
+ (Lo) => ao(Lo, A, fo)
1909
+ );
1910
+ I(
1911
+ go ? { rowIndex: fo, colKey: go.key } : null
1912
+ ), B("");
1913
+ return;
1914
+ }
1915
+ I(null), B("");
1916
+ }, Y = (f) => {
1917
+ if (f.key === "Enter") {
1918
+ _();
1919
+ return;
1920
+ }
1921
+ if (f.key === "Escape") {
1922
+ H();
1923
+ return;
1924
+ }
1925
+ f.key === "Tab" && N(f);
1926
+ }, Z = () => $([...z, m()]), no = (f) => {
1927
+ v?.rowIndex === f && I(null), $(z.filter((E, W) => W !== f));
1928
+ }, to = (f, E) => String(e ? f[e] : E), U = b ? o.length + 1 : o.length;
1929
+ return /* @__PURE__ */ s(
1930
+ Po,
1931
+ {
1932
+ $borderColor: l,
1933
+ className: w,
1934
+ style: y,
1935
+ children: /* @__PURE__ */ C(hn, { $size: a, children: [
1936
+ /* @__PURE__ */ s(Do, { $headerColor: u, $borderColor: l, children: /* @__PURE__ */ C(q, { children: [
1937
+ o.map((f) => /* @__PURE__ */ s(
1938
+ po,
1561
1939
  {
1562
- $size: l,
1563
- $variant: "default",
1564
- $editable: I.editable && !L,
1565
- onClick: I.editable && !L ? () => O(T, I.key, F) : void 0,
1566
- children: L ? /* @__PURE__ */ i(
1567
- Ar,
1568
- {
1569
- ref: E,
1570
- $size: l,
1571
- value: z,
1572
- onChange: (xo) => h(xo.target.value),
1573
- onBlur: $,
1574
- onKeyDown: v,
1575
- "aria-label": `Edit ${I.header}`
1576
- }
1577
- ) : I.render ? I.render(F, g, T) : String(F ?? "")
1940
+ $size: a,
1941
+ scope: "col",
1942
+ style: f.width ? { width: f.width } : void 0,
1943
+ children: f.header
1578
1944
  },
1579
- I.key
1580
- );
1581
- }),
1582
- e && /* @__PURE__ */ i(Nr, { $size: l, $variant: "default", children: /* @__PURE__ */ i(
1583
- Vr,
1584
- {
1585
- type: "button",
1586
- onClick: () => A(T),
1587
- "aria-label": "Delete row",
1588
- children: "✕"
1589
- }
1590
- ) })
1591
- ] }, T)),
1592
- /* @__PURE__ */ i(Dr, { children: /* @__PURE__ */ i("td", { colSpan: D, children: /* @__PURE__ */ m(Fr, { type: "button", onClick: k, children: [
1593
- "+ ",
1594
- d
1595
- ] }) }) })
1596
- ] })
1597
- ] }) });
1945
+ f.key
1946
+ )),
1947
+ b && /* @__PURE__ */ s(kn, { $size: a, "aria-label": "Actions" })
1948
+ ] }) }),
1949
+ /* @__PURE__ */ C(No, { children: [
1950
+ z.map((f, E) => /* @__PURE__ */ C(q, { children: [
1951
+ o.map((W) => {
1952
+ const d = v?.rowIndex === E && v.colKey === W.key, S = f[W.key], L = ao(W, f, E);
1953
+ return /* @__PURE__ */ s(
1954
+ wn,
1955
+ {
1956
+ $size: a,
1957
+ $borderColor: l,
1958
+ $editable: L && !d,
1959
+ onClick: L && !d ? () => j(E, W.key, S) : void 0,
1960
+ children: d ? /* @__PURE__ */ s(
1961
+ vn,
1962
+ {
1963
+ ref: h,
1964
+ $size: a,
1965
+ value: P,
1966
+ onChange: (V) => B(V.target.value),
1967
+ onBlur: _,
1968
+ onKeyDown: Y,
1969
+ "aria-label": `Edit ${W.header}`
1970
+ }
1971
+ ) : W.render ? W.render(S, f, E) : String(S ?? "") || " "
1972
+ },
1973
+ W.key
1974
+ );
1975
+ }),
1976
+ b && /* @__PURE__ */ s(mn, { $size: a, $borderColor: l, children: /* @__PURE__ */ s(
1977
+ Sn,
1978
+ {
1979
+ type: "button",
1980
+ onClick: () => no(E),
1981
+ "aria-label": "Delete row",
1982
+ children: "✕"
1983
+ }
1984
+ ) })
1985
+ ] }, to(f, E))),
1986
+ /* @__PURE__ */ s(Cn, { children: /* @__PURE__ */ s("td", { colSpan: U, children: /* @__PURE__ */ C(zn, { type: "button", onClick: Z, children: [
1987
+ "+ ",
1988
+ x
1989
+ ] }) }) })
1990
+ ] })
1991
+ ] })
1992
+ }
1993
+ );
1598
1994
  }
1599
- Mr.displayName = "EditableTable";
1600
- const ro = {
1995
+ Tn.displayName = "DataTable";
1996
+ const vo = {
1601
1997
  primary: {
1602
1998
  50: "#f0f8ff",
1603
1999
  500: "#0070f3",
@@ -1629,38 +2025,38 @@ const ro = {
1629
2025
  50: "#eff6ff",
1630
2026
  500: "#2563eb"
1631
2027
  }
1632
- }, Pr = {
2028
+ }, In = {
1633
2029
  1: "4px",
1634
2030
  2: "8px",
1635
2031
  3: "12px",
1636
2032
  4: "16px",
1637
2033
  5: "20px",
1638
2034
  6: "24px"
1639
- }, Yr = {
2035
+ }, En = {
1640
2036
  md: "6px"
1641
- }, Hr = {
2037
+ }, Wn = {
1642
2038
  modal: 1e3,
1643
2039
  toast: 1100
1644
- }, _r = {
2040
+ }, On = {
1645
2041
  xs: "12px",
1646
2042
  sm: "14px",
1647
2043
  md: "16px",
1648
2044
  lg: "18px"
1649
- }, on = {
1650
- colors: { ...ro, primary: { ...ro.primary, contrast: "#ffffff" } },
1651
- spacing: Pr,
1652
- fontSizes: _r,
1653
- radius: Yr,
1654
- zIndex: Hr,
2045
+ }, _n = {
2046
+ colors: { ...vo, primary: { ...vo.primary, contrast: "#ffffff" } },
2047
+ spacing: In,
2048
+ fontSizes: On,
2049
+ radius: En,
2050
+ zIndex: Wn,
1655
2051
  shadows: {
1656
2052
  focusRing: "0 0 0 2px rgba(0, 112, 243, 0.25)"
1657
2053
  }
1658
2054
  };
1659
- function Kr(o) {
1660
- const r = parseInt(o.slice(1, 3), 16) / 255, s = parseInt(o.slice(3, 5), 16) / 255, a = parseInt(o.slice(5, 7), 16) / 255, l = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
1661
- return 0.2126 * l(r) + 0.7152 * l(s) + 0.0722 * l(a) > 0.179 ? "#111111" : "#ffffff";
2055
+ function Pn(o) {
2056
+ 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, c = (l) => l <= 0.03928 ? l / 12.92 : ((l + 0.055) / 1.055) ** 2.4;
2057
+ return 0.2126 * c(r) + 0.7152 * c(n) + 0.0722 * c(e) > 0.179 ? "#111111" : "#ffffff";
1662
2058
  }
1663
- const U = {
2059
+ const co = {
1664
2060
  colors: {
1665
2061
  primary: {
1666
2062
  50: "#fffde6",
@@ -1690,44 +2086,44 @@ const U = {
1690
2086
  shadows: { focusRing: "3px 3px 0 #111111" },
1691
2087
  brutalism: { borderWidth: "2px", shadowOffset: "4px" }
1692
2088
  };
1693
- function rn(o) {
2089
+ function Mn(o) {
1694
2090
  return {
1695
- ...U,
2091
+ ...co,
1696
2092
  colors: {
1697
- ...U.colors,
2093
+ ...co.colors,
1698
2094
  primary: {
1699
2095
  50: "#fffff0",
1700
2096
  500: o,
1701
2097
  700: o,
1702
- contrast: Kr(o)
2098
+ contrast: Pn(o)
1703
2099
  }
1704
2100
  }
1705
2101
  };
1706
2102
  }
1707
- function nn({
1708
- theme: o = U,
2103
+ function Vn({
2104
+ theme: o = co,
1709
2105
  children: r
1710
2106
  }) {
1711
- return /* @__PURE__ */ i(yo, { theme: o, children: r });
2107
+ return /* @__PURE__ */ s(Ao, { theme: o, children: r });
1712
2108
  }
1713
2109
  export {
1714
- mo as Badge,
1715
- ko as Button,
1716
- Or as CollapsibleCard,
1717
- Mr as EditableTable,
1718
- dr as Form,
1719
- ur as FormField,
1720
- Eo as Input,
1721
- vr as Link,
1722
- Yo as Modal,
1723
- yr as Select,
1724
- jr as Table,
1725
- nn as ThemeProvider,
1726
- uo as Toast,
1727
- Gr as ToastProvider,
1728
- rn as createNeoBrutalTheme,
1729
- on as defaultTheme,
1730
- U as neoBrutalTheme,
1731
- Qr as useForm,
1732
- Jr as useToast
2110
+ Ro as Badge,
2111
+ Mo as Button,
2112
+ nn as CollapsibleCard,
2113
+ Tn as DataTable,
2114
+ Dr as Form,
2115
+ Nr as FormField,
2116
+ qo as Input,
2117
+ Kr as Link,
2118
+ ar as Modal,
2119
+ Vr as Select,
2120
+ yn as Table,
2121
+ Vn as ThemeProvider,
2122
+ Eo as Toast,
2123
+ An as ToastProvider,
2124
+ Mn as createNeoBrutalTheme,
2125
+ _n as defaultTheme,
2126
+ co as neoBrutalTheme,
2127
+ Rn as useForm,
2128
+ jn as useToast
1733
2129
  };