@skiddph/prui 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,581 @@
1
+ import { jsx as e, jsxs as n, Fragment as $ } from "react/jsx-runtime";
2
+ import * as g from "react";
3
+ import { ArrowUp as z, ArrowDown as M, ArrowUpDown as I, Inbox as L, ChevronLeft as A, ChevronRight as B, Check as Y, PlusCircle as q, Search as E } from "lucide-react";
4
+ import { cn as S } from "../core/cn.js";
5
+ import { Button as w } from "../core/button.js";
6
+ import { Select as G, SelectTrigger as H, SelectValue as J, SelectContent as Q, SelectItem as W } from "../core/select.js";
7
+ import { Input as y } from "../core/input.js";
8
+ import { Badge as X } from "../core/card.js";
9
+ import { Dropdown as Z } from "../core/dropdown.js";
10
+ import { Label as k } from "../core/label.js";
11
+ function ce({
12
+ columns: r,
13
+ rows: u,
14
+ rowKey: x,
15
+ sort: o,
16
+ onSortChange: s,
17
+ defaultSort: l = null,
18
+ loading: f = !1,
19
+ emptyMessage: v = "No results.",
20
+ onRowClick: a,
21
+ className: i
22
+ }) {
23
+ const [d, m] = g.useState(l), t = o !== void 0, c = t ? o : d, b = r.filter((p) => !p.hidden), U = g.useMemo(() => {
24
+ if (!c) return u;
25
+ const p = r.find((N) => N.key === c.key);
26
+ if (!(p != null && p.sortable)) return u;
27
+ const h = c.direction === "asc" ? 1 : -1;
28
+ return [...u].sort((N, R) => {
29
+ const T = N[c.key], D = R[c.key];
30
+ return T == null && D == null ? 0 : T == null ? 1 : D == null ? -1 : typeof T == "number" && typeof D == "number" ? (T - D) * h : String(T).localeCompare(String(D)) * h;
31
+ });
32
+ }, [u, c, r]), j = (p) => {
33
+ const h = r.find((R) => R.key === p);
34
+ if (!(h != null && h.sortable)) return;
35
+ const N = (c == null ? void 0 : c.key) === p ? c.direction === "asc" ? { key: p, direction: "desc" } : null : { key: p, direction: "asc" };
36
+ t || m(N), s == null || s(N);
37
+ };
38
+ return /* @__PURE__ */ e("div", { className: S("prui-data-table w-full overflow-x-auto rounded-[var(--prui-radius)] border border-[var(--prui-line)]", i), children: /* @__PURE__ */ n("table", { className: "w-full text-sm", children: [
39
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "border-b border-[var(--prui-line)] bg-[var(--prui-raise)]", children: b.map((p) => {
40
+ const h = (c == null ? void 0 : c.key) === p.key, N = h ? (c == null ? void 0 : c.direction) === "asc" ? z : M : I;
41
+ return /* @__PURE__ */ e(
42
+ "th",
43
+ {
44
+ scope: "col",
45
+ "aria-sort": h ? (c == null ? void 0 : c.direction) === "asc" ? "ascending" : "descending" : p.sortable ? "none" : void 0,
46
+ style: p.width !== void 0 ? { width: p.width } : void 0,
47
+ className: S(
48
+ "px-3 py-2 text-xs font-medium uppercase tracking-wide text-[var(--prui-dim)]",
49
+ p.align === "right" && "text-right",
50
+ p.align === "center" && "text-center"
51
+ ),
52
+ children: p.sortable ? /* @__PURE__ */ n(
53
+ "button",
54
+ {
55
+ type: "button",
56
+ onClick: () => j(p.key),
57
+ className: S(
58
+ "inline-flex items-center gap-1 hover:text-[var(--prui-fg)] cursor-pointer uppercase",
59
+ h && "text-[var(--prui-fg)]"
60
+ ),
61
+ children: [
62
+ p.label,
63
+ /* @__PURE__ */ e(N, { className: "h-3 w-3", "aria-hidden": !0 })
64
+ ]
65
+ }
66
+ ) : p.label
67
+ },
68
+ p.key
69
+ );
70
+ }) }) }),
71
+ /* @__PURE__ */ e("tbody", { children: f ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: b.length, className: "px-3 py-8 text-center text-[var(--prui-dim)]", "data-testid": "data-table-loading", children: "Loading..." }) }) : U.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: b.length, className: "px-3 py-8 text-center text-[var(--prui-dim)]", "data-testid": "data-table-empty", children: /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-2", children: [
72
+ /* @__PURE__ */ e(L, { className: "h-4 w-4", "aria-hidden": !0 }),
73
+ v
74
+ ] }) }) }) : U.map((p, h) => /* @__PURE__ */ e(
75
+ "tr",
76
+ {
77
+ onClick: a ? () => a(p, h) : void 0,
78
+ className: S(
79
+ "border-b border-[var(--prui-line)] last:border-b-0 text-[var(--prui-fg)]",
80
+ a && "cursor-pointer hover:bg-[var(--prui-raise)]"
81
+ ),
82
+ children: b.map((N) => /* @__PURE__ */ e(
83
+ "td",
84
+ {
85
+ className: S(
86
+ "px-3 py-2",
87
+ N.align === "right" && "text-right",
88
+ N.align === "center" && "text-center",
89
+ N.className
90
+ ),
91
+ children: N.render ? N.render(p) : _(p[N.key])
92
+ },
93
+ N.key
94
+ ))
95
+ },
96
+ x ? x(p, h) : h
97
+ )) })
98
+ ] }) });
99
+ }
100
+ function _(r) {
101
+ return r == null || r === "" ? /* @__PURE__ */ e("span", { className: "text-[var(--prui-dim)]", children: "-" }) : r instanceof Date ? r.toLocaleDateString() : typeof r == "boolean" ? r ? "Yes" : "No" : String(r);
102
+ }
103
+ const oe = {
104
+ name: "DataTable",
105
+ props: [
106
+ { name: "columns", type: "Column<T>[]", default: null, control: "object" },
107
+ { name: "rows", type: "T[]", default: "[]", control: "object" },
108
+ { name: "sort", type: "{ key, direction } | null", default: "undefined", control: "none" },
109
+ { name: "onSortChange", type: "(sort) => void", default: null, control: "none" },
110
+ { name: "loading", type: "boolean", default: "false", control: "boolean" },
111
+ { name: "emptyMessage", type: "ReactNode", default: "'No results.'", control: "text" },
112
+ { name: "onRowClick", type: "(row, index) => void", default: null, control: "none" }
113
+ ]
114
+ };
115
+ function ue({
116
+ page: r,
117
+ pageSize: u = 20,
118
+ hasNextPage: x,
119
+ hasPreviousPage: o,
120
+ onPageChange: s,
121
+ onPageSizeChange: l,
122
+ pageSizeOptions: f = [10, 20, 50, 100],
123
+ className: v
124
+ }) {
125
+ return /* @__PURE__ */ n("div", { className: v ?? "flex items-center justify-between gap-2 py-2", children: [
126
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2 text-sm text-[var(--prui-dim)]", children: [
127
+ /* @__PURE__ */ e("span", { children: "Rows per page" }),
128
+ /* @__PURE__ */ e("div", { className: "w-20", children: /* @__PURE__ */ n(
129
+ G,
130
+ {
131
+ value: String(u),
132
+ onChange: (a) => l == null ? void 0 : l(Number(a)),
133
+ options: f.map((a) => ({ label: String(a), value: String(a) })),
134
+ children: [
135
+ /* @__PURE__ */ e(H, { "aria-label": "Rows per page", className: "h-7", children: /* @__PURE__ */ e(J, {}) }),
136
+ /* @__PURE__ */ e(Q, { children: f.map((a) => /* @__PURE__ */ e(W, { value: String(a), children: a }, a)) })
137
+ ]
138
+ }
139
+ ) })
140
+ ] }),
141
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
142
+ /* @__PURE__ */ n("span", { className: "text-sm text-[var(--prui-dim)]", "data-testid": "pagination-page", children: [
143
+ "Page ",
144
+ r
145
+ ] }),
146
+ /* @__PURE__ */ e(
147
+ w,
148
+ {
149
+ variant: "default",
150
+ size: "icon",
151
+ "aria-label": "Previous page",
152
+ disabled: !o,
153
+ onClick: () => s == null ? void 0 : s(r - 1, "prev"),
154
+ children: /* @__PURE__ */ e(A, { className: "h-4 w-4", "aria-hidden": !0 })
155
+ }
156
+ ),
157
+ /* @__PURE__ */ e(
158
+ w,
159
+ {
160
+ variant: "default",
161
+ size: "icon",
162
+ "aria-label": "Next page",
163
+ disabled: !x,
164
+ onClick: () => s == null ? void 0 : s(r + 1, "next"),
165
+ children: /* @__PURE__ */ e(B, { className: "h-4 w-4", "aria-hidden": !0 })
166
+ }
167
+ )
168
+ ] })
169
+ ] });
170
+ }
171
+ const me = {
172
+ name: "DataTablePagination",
173
+ props: [
174
+ { name: "page", type: "number", default: null, control: "number" },
175
+ { name: "pageSize", type: "number", default: "20", control: "select", options: ["10", "20", "50", "100"] },
176
+ { name: "hasNextPage", type: "boolean", default: null, control: "boolean" },
177
+ { name: "hasPreviousPage", type: "boolean", default: null, control: "boolean" },
178
+ { name: "onPageChange", type: "(page, direction) => void", default: null, control: "none" },
179
+ { name: "onPageSizeChange", type: "(size) => void", default: null, control: "none" }
180
+ ]
181
+ };
182
+ function K({
183
+ label: r,
184
+ options: u,
185
+ value: x,
186
+ defaultValue: o,
187
+ onChange: s,
188
+ className: l
189
+ }) {
190
+ const [f, v] = g.useState(o ?? []), a = x !== void 0, i = a ? x : f, d = (m) => {
191
+ const t = i.includes(m) ? i.filter((c) => c !== m) : [...i, m];
192
+ a || v(t), s == null || s(t);
193
+ };
194
+ return /* @__PURE__ */ e(
195
+ Z,
196
+ {
197
+ className: l,
198
+ trigger: /* @__PURE__ */ n(
199
+ "button",
200
+ {
201
+ type: "button",
202
+ className: "prui-faceted-filter inline-flex h-8 items-center gap-1.5 rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-background)] px-2.5 text-sm cursor-pointer hover:border-[var(--prui-dim)]",
203
+ "data-testid": "faceted-filter",
204
+ children: [
205
+ /* @__PURE__ */ e(q, { className: "h-3.5 w-3.5 text-[var(--prui-dim)]", "aria-hidden": !0 }),
206
+ r,
207
+ i.length > 0 ? /* @__PURE__ */ e($, { children: /* @__PURE__ */ e("span", { className: "ml-1 rounded-[var(--prui-radius-full)] bg-[var(--prui-raise)] px-1.5 text-xs", children: i.length }) }) : null
208
+ ]
209
+ }
210
+ ),
211
+ children: /* @__PURE__ */ n("div", { role: "menu", className: "min-w-44", children: [
212
+ u.length === 0 ? /* @__PURE__ */ e("div", { className: "px-2 py-1.5 text-sm text-[var(--prui-dim)]", children: "No options" }) : u.map((m) => {
213
+ const t = i.includes(m.value);
214
+ return /* @__PURE__ */ n(
215
+ "button",
216
+ {
217
+ type: "button",
218
+ role: "menuitemcheckbox",
219
+ "aria-checked": t,
220
+ onClick: () => d(m.value),
221
+ "data-selected": t || void 0,
222
+ className: "flex w-full cursor-pointer items-center gap-2 rounded-[calc(var(--prui-radius)-1px)] px-2 py-1.5 text-left text-sm text-[var(--prui-fg)] hover:bg-[var(--prui-raise)]",
223
+ children: [
224
+ /* @__PURE__ */ e(
225
+ "span",
226
+ {
227
+ className: "flex h-4 w-4 items-center justify-center rounded-[var(--prui-radius-1)] border border-[var(--prui-line)]",
228
+ style: t ? { backgroundColor: "var(--prui-brand)", borderColor: "var(--prui-brand)" } : void 0,
229
+ children: t ? /* @__PURE__ */ e(Y, { className: "h-3 w-3 text-white", "aria-hidden": !0 }) : null
230
+ }
231
+ ),
232
+ m.label,
233
+ m.count !== void 0 ? /* @__PURE__ */ e(X, { variant: "outline", className: "ml-auto", children: m.count }) : null
234
+ ]
235
+ },
236
+ m.value
237
+ );
238
+ }),
239
+ i.length > 0 ? /* @__PURE__ */ n(
240
+ "button",
241
+ {
242
+ type: "button",
243
+ onClick: () => {
244
+ a || v([]), s == null || s([]);
245
+ },
246
+ className: "mt-1 w-full cursor-pointer rounded-[calc(var(--prui-radius)-1px)] border-t border-[var(--prui-line)] px-2 py-1.5 text-left text-xs text-[var(--prui-dim)] hover:text-[var(--prui-fg)]",
247
+ children: [
248
+ "Clear (",
249
+ i.length,
250
+ ")"
251
+ ]
252
+ }
253
+ ) : null
254
+ ] })
255
+ }
256
+ );
257
+ }
258
+ function O({
259
+ label: r = "Date range",
260
+ value: u,
261
+ defaultValue: x,
262
+ onChange: o,
263
+ className: s
264
+ }) {
265
+ const [l, f] = g.useState(x ?? {}), v = u !== void 0, a = v ? u : l, i = (d) => {
266
+ v || f(d), o == null || o(d);
267
+ };
268
+ return /* @__PURE__ */ n("div", { className: s ?? "flex items-end gap-2", "data-testid": "daterange-filter", children: [
269
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
270
+ /* @__PURE__ */ n(k, { className: "text-xs text-[var(--prui-dim)]", children: [
271
+ r,
272
+ " from"
273
+ ] }),
274
+ /* @__PURE__ */ e(
275
+ y,
276
+ {
277
+ type: "date",
278
+ "aria-label": `${r} from`,
279
+ className: "h-8 w-36",
280
+ value: a.from ?? "",
281
+ onChange: (d) => i({ ...a, from: d.target.value || void 0 })
282
+ }
283
+ )
284
+ ] }),
285
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
286
+ /* @__PURE__ */ e(k, { className: "text-xs text-[var(--prui-dim)]", children: "to" }),
287
+ /* @__PURE__ */ e(
288
+ y,
289
+ {
290
+ type: "date",
291
+ "aria-label": `${r} to`,
292
+ className: "h-8 w-36",
293
+ value: a.to ?? "",
294
+ onChange: (d) => i({ ...a, to: d.target.value || void 0 })
295
+ }
296
+ )
297
+ ] }),
298
+ a.from || a.to ? /* @__PURE__ */ e(w, { variant: "ghost", size: "sm", onClick: () => i({}), children: "Clear" }) : null
299
+ ] });
300
+ }
301
+ function V({
302
+ label: r = "Date",
303
+ value: u,
304
+ defaultValue: x,
305
+ onChange: o,
306
+ className: s
307
+ }) {
308
+ const [l, f] = g.useState(x ?? {}), v = u !== void 0, a = v ? u : l, i = (d) => {
309
+ v || f(d), o == null || o(d);
310
+ };
311
+ return /* @__PURE__ */ n("div", { className: s ?? "flex items-end gap-2", "data-testid": "date-filter", children: [
312
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
313
+ /* @__PURE__ */ e(k, { className: "text-xs text-[var(--prui-dim)]", children: r }),
314
+ /* @__PURE__ */ e(
315
+ y,
316
+ {
317
+ type: "date",
318
+ "aria-label": r,
319
+ className: "h-8 w-36",
320
+ value: a.date ?? "",
321
+ onChange: (d) => i({ date: d.target.value || void 0 })
322
+ }
323
+ )
324
+ ] }),
325
+ a.date ? /* @__PURE__ */ e(w, { variant: "ghost", size: "sm", onClick: () => i({}), children: "Clear" }) : null
326
+ ] });
327
+ }
328
+ function P({
329
+ label: r = "Range",
330
+ value: u,
331
+ defaultValue: x,
332
+ onChange: o,
333
+ className: s
334
+ }) {
335
+ const [l, f] = g.useState(x ?? {}), v = u !== void 0, a = v ? u : l, i = (m) => {
336
+ v || f(m), o == null || o(m);
337
+ }, d = (m) => {
338
+ if (m === "") return;
339
+ const t = Number(m);
340
+ return Number.isNaN(t) ? void 0 : t;
341
+ };
342
+ return /* @__PURE__ */ n("div", { className: s ?? "flex items-end gap-2", "data-testid": "numberrange-filter", children: [
343
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
344
+ /* @__PURE__ */ n(k, { className: "text-xs text-[var(--prui-dim)]", children: [
345
+ r,
346
+ " min"
347
+ ] }),
348
+ /* @__PURE__ */ e(
349
+ y,
350
+ {
351
+ type: "number",
352
+ "aria-label": `${r} min`,
353
+ className: "h-8 w-24",
354
+ value: a.min ?? "",
355
+ onChange: (m) => i({ ...a, min: d(m.target.value) })
356
+ }
357
+ )
358
+ ] }),
359
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
360
+ /* @__PURE__ */ e(k, { className: "text-xs text-[var(--prui-dim)]", children: "max" }),
361
+ /* @__PURE__ */ e(
362
+ y,
363
+ {
364
+ type: "number",
365
+ "aria-label": `${r} max`,
366
+ className: "h-8 w-24",
367
+ value: a.max ?? "",
368
+ onChange: (m) => i({ ...a, max: d(m.target.value) })
369
+ }
370
+ )
371
+ ] }),
372
+ a.min !== void 0 || a.max !== void 0 ? /* @__PURE__ */ e(w, { variant: "ghost", size: "sm", onClick: () => i({}), children: "Clear" }) : null
373
+ ] });
374
+ }
375
+ function F({
376
+ label: r = "Price",
377
+ value: u,
378
+ defaultValue: x,
379
+ onChange: o,
380
+ currency: s = "₱",
381
+ className: l
382
+ }) {
383
+ const [f, v] = g.useState(x ?? {}), a = u !== void 0, i = a ? u : f, d = (t) => {
384
+ a || v(t), o == null || o(t);
385
+ }, m = (t) => {
386
+ if (t === "") return;
387
+ const c = Number(t);
388
+ return Number.isNaN(c) ? void 0 : c;
389
+ };
390
+ return /* @__PURE__ */ n("div", { className: l ?? "flex items-end gap-2", "data-testid": "price-filter", children: [
391
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
392
+ /* @__PURE__ */ n(k, { className: "text-xs text-[var(--prui-dim)]", children: [
393
+ r,
394
+ " min"
395
+ ] }),
396
+ /* @__PURE__ */ n("div", { className: "relative", children: [
397
+ /* @__PURE__ */ e("span", { className: "pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-xs text-[var(--prui-dim)]", "aria-hidden": !0, children: s }),
398
+ /* @__PURE__ */ e(
399
+ y,
400
+ {
401
+ type: "number",
402
+ "aria-label": `${r} min`,
403
+ className: "h-8 w-24 pl-6",
404
+ value: i.min ?? "",
405
+ onChange: (t) => d({ ...i, min: m(t.target.value) })
406
+ }
407
+ )
408
+ ] })
409
+ ] }),
410
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
411
+ /* @__PURE__ */ e(k, { className: "text-xs text-[var(--prui-dim)]", children: "max" }),
412
+ /* @__PURE__ */ n("div", { className: "relative", children: [
413
+ /* @__PURE__ */ e("span", { className: "pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-xs text-[var(--prui-dim)]", "aria-hidden": !0, children: s }),
414
+ /* @__PURE__ */ e(
415
+ y,
416
+ {
417
+ type: "number",
418
+ "aria-label": `${r} max`,
419
+ className: "h-8 w-24 pl-6",
420
+ value: i.max ?? "",
421
+ onChange: (t) => d({ ...i, max: m(t.target.value) })
422
+ }
423
+ )
424
+ ] })
425
+ ] }),
426
+ i.min !== void 0 || i.max !== void 0 ? /* @__PURE__ */ e(w, { variant: "ghost", size: "sm", onClick: () => d({}), children: "Clear" }) : null
427
+ ] });
428
+ }
429
+ function C({
430
+ label: r = "Time",
431
+ value: u,
432
+ defaultValue: x,
433
+ onChange: o,
434
+ className: s
435
+ }) {
436
+ const [l, f] = g.useState(x ?? {}), v = u !== void 0, a = v ? u : l, i = (d) => {
437
+ v || f(d), o == null || o(d);
438
+ };
439
+ return /* @__PURE__ */ n("div", { className: s ?? "flex items-end gap-2", "data-testid": "time-filter", children: [
440
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
441
+ /* @__PURE__ */ n(k, { className: "text-xs text-[var(--prui-dim)]", children: [
442
+ r,
443
+ " from"
444
+ ] }),
445
+ /* @__PURE__ */ e(
446
+ y,
447
+ {
448
+ type: "time",
449
+ "aria-label": `${r} from`,
450
+ className: "h-8 w-28",
451
+ value: a.from ?? "",
452
+ onChange: (d) => i({ ...a, from: d.target.value || void 0 })
453
+ }
454
+ )
455
+ ] }),
456
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
457
+ /* @__PURE__ */ e(k, { className: "text-xs text-[var(--prui-dim)]", children: "to" }),
458
+ /* @__PURE__ */ e(
459
+ y,
460
+ {
461
+ type: "time",
462
+ "aria-label": `${r} to`,
463
+ className: "h-8 w-28",
464
+ value: a.to ?? "",
465
+ onChange: (d) => i({ ...a, to: d.target.value || void 0 })
466
+ }
467
+ )
468
+ ] }),
469
+ a.from || a.to ? /* @__PURE__ */ e(w, { variant: "ghost", size: "sm", onClick: () => i({}), children: "Clear" }) : null
470
+ ] });
471
+ }
472
+ function pe({
473
+ searchPlaceholder: r = "Search...",
474
+ searchValue: u,
475
+ onSearchChange: x,
476
+ filters: o = [],
477
+ filterValues: s,
478
+ onFilterChange: l,
479
+ actions: f,
480
+ className: v
481
+ }) {
482
+ const [a, i] = g.useState(""), d = u !== void 0, m = d ? u : a;
483
+ return /* @__PURE__ */ n("div", { className: S("prui-toolbar flex flex-wrap items-center gap-2 py-2", v), children: [
484
+ /* @__PURE__ */ n("div", { className: "relative", children: [
485
+ /* @__PURE__ */ e(E, { className: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--prui-dim)]", "aria-hidden": !0 }),
486
+ /* @__PURE__ */ e(
487
+ y,
488
+ {
489
+ type: "search",
490
+ "aria-label": "Search",
491
+ placeholder: r,
492
+ className: "h-8 w-56 pl-8",
493
+ value: m,
494
+ onChange: (t) => {
495
+ d || i(t.target.value), x == null || x(t.target.value);
496
+ }
497
+ }
498
+ )
499
+ ] }),
500
+ o.map((t) => {
501
+ const c = s == null ? void 0 : s[t.key];
502
+ return t.type === "select" ? /* @__PURE__ */ e(
503
+ K,
504
+ {
505
+ label: t.label,
506
+ options: t.options ?? [],
507
+ value: c ?? [],
508
+ onChange: (b) => l == null ? void 0 : l(t.key, b)
509
+ },
510
+ t.key
511
+ ) : t.type === "daterange" ? /* @__PURE__ */ e(
512
+ O,
513
+ {
514
+ label: t.label,
515
+ value: c ?? {},
516
+ onChange: (b) => l == null ? void 0 : l(t.key, b)
517
+ },
518
+ t.key
519
+ ) : t.type === "date" ? /* @__PURE__ */ e(
520
+ V,
521
+ {
522
+ label: t.label,
523
+ value: c ?? {},
524
+ onChange: (b) => l == null ? void 0 : l(t.key, b)
525
+ },
526
+ t.key
527
+ ) : t.type === "price" ? /* @__PURE__ */ e(
528
+ F,
529
+ {
530
+ label: t.label,
531
+ value: c ?? {},
532
+ onChange: (b) => l == null ? void 0 : l(t.key, b)
533
+ },
534
+ t.key
535
+ ) : t.type === "time" ? /* @__PURE__ */ e(
536
+ C,
537
+ {
538
+ label: t.label,
539
+ value: c ?? {},
540
+ onChange: (b) => l == null ? void 0 : l(t.key, b)
541
+ },
542
+ t.key
543
+ ) : /* @__PURE__ */ e(
544
+ P,
545
+ {
546
+ label: t.label,
547
+ value: c ?? {},
548
+ onChange: (b) => l == null ? void 0 : l(t.key, b)
549
+ },
550
+ t.key
551
+ );
552
+ }),
553
+ f ? /* @__PURE__ */ e("div", { className: "ml-auto flex items-center gap-2", children: f }) : null
554
+ ] });
555
+ }
556
+ const ve = {
557
+ name: "DataTableToolbar",
558
+ props: [
559
+ { name: "searchPlaceholder", type: "string", default: "'Search...'", control: "text" },
560
+ { name: "searchValue", type: "string", default: "undefined", control: "text" },
561
+ { name: "onSearchChange", type: "(value: string) => void", default: null, control: "none" },
562
+ { name: "filters", type: "ToolbarFilterConfig[]", default: "[]", control: "object" },
563
+ { name: "filterValues", type: "ToolbarFilterValues", default: "{}", control: "object" },
564
+ { name: "onFilterChange", type: "(key, value) => void", default: null, control: "none" },
565
+ { name: "actions", type: "ReactNode", default: null, control: "none" }
566
+ ]
567
+ };
568
+ export {
569
+ ce as D,
570
+ K as F,
571
+ P as N,
572
+ F as P,
573
+ C as T,
574
+ ue as a,
575
+ pe as b,
576
+ V as c,
577
+ O as d,
578
+ me as e,
579
+ oe as f,
580
+ ve as g
581
+ };
@@ -173,7 +173,13 @@ function G(n) {
173
173
  M(!0), k(!0), document.body.classList.add("modal-open");
174
174
  }, 10);
175
175
  return () => clearTimeout(i);
176
- }, []), r.useEffect(() => {
176
+ }, []);
177
+ const m = (i) => {
178
+ R(!0), k(!1), document.body.classList.remove("modal-open"), setTimeout(() => {
179
+ E(), z(i);
180
+ }, 300);
181
+ };
182
+ if (r.useEffect(() => {
177
183
  var C;
178
184
  if (!h || l) return;
179
185
  (C = c.current) == null || C.focus();
@@ -190,13 +196,7 @@ function G(n) {
190
196
  !p || !s.some((j) => j === p) ? (a.preventDefault(), b.focus()) : a.shiftKey && p === b ? (a.preventDefault(), t.focus()) : !a.shiftKey && p === t && (a.preventDefault(), b.focus());
191
197
  };
192
198
  return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
193
- }, [h, l]);
194
- const m = (i) => {
195
- R(!0), k(!1), document.body.classList.remove("modal-open"), setTimeout(() => {
196
- E(), z(i);
197
- }, 300);
198
- };
199
- if (!h) return null;
199
+ }, [h, l]), !h) return null;
200
200
  const w = P[T];
201
201
  return /* @__PURE__ */ e(
202
202
  "div",
@@ -16,7 +16,7 @@ export interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
16
16
  onOpenChange?: (open: boolean) => void;
17
17
  }
18
18
  export declare const Select: {
19
- ({ options, value: valueProp, defaultValue, placeholder, disabled, name, onChange, onOpenChange, children, }: SelectProps): React.JSX.Element;
19
+ ({ options, value: valueProp, defaultValue, placeholder, disabled, name, id, onChange, onOpenChange, children, ...rest }: SelectProps): React.JSX.Element;
20
20
  displayName: string;
21
21
  };
22
22
  export type SelectTriggerProps = React.ButtonHTMLAttributes<HTMLButtonElement>;