next-data-kit 9.4.0 → 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/chunk-4GSA6NBE.js +372 -0
  2. package/dist/chunk-4GSA6NBE.js.map +1 -0
  3. package/dist/chunk-A45O6PCJ.cjs +383 -0
  4. package/dist/chunk-A45O6PCJ.cjs.map +1 -0
  5. package/dist/chunk-PSMWD5AA.js +2613 -0
  6. package/dist/chunk-PSMWD5AA.js.map +1 -0
  7. package/dist/chunk-YNII2J6V.cjs +2657 -0
  8. package/dist/chunk-YNII2J6V.cjs.map +1 -0
  9. package/dist/client/components/data-kit-infinity.d.ts +1 -0
  10. package/dist/client/components/data-kit-infinity.d.ts.map +1 -1
  11. package/dist/client/components/data-kit-table.d.ts +1 -0
  12. package/dist/client/components/data-kit-table.d.ts.map +1 -1
  13. package/dist/client/components/data-kit.d.ts +1 -0
  14. package/dist/client/components/data-kit.d.ts.map +1 -1
  15. package/dist/client/hooks/useDataKit.d.ts.map +1 -1
  16. package/dist/client.cjs +75 -2941
  17. package/dist/client.cjs.map +1 -1
  18. package/dist/client.d.cts +4 -2
  19. package/dist/client.d.ts +0 -1
  20. package/dist/client.d.ts.map +1 -1
  21. package/dist/client.js +2 -2906
  22. package/dist/client.js.map +1 -1
  23. package/dist/index-DUVfK8q6.d.ts +284 -0
  24. package/dist/index-qXbjvUTB.d.cts +284 -0
  25. package/dist/index.cjs +97 -2898
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +3 -2
  28. package/dist/index.d.ts +3 -2
  29. package/dist/index.js +4 -2841
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal/hooks.cjs +12 -0
  32. package/dist/internal/hooks.cjs.map +1 -0
  33. package/dist/internal/hooks.d.cts +1 -0
  34. package/dist/internal/hooks.d.ts +1 -0
  35. package/dist/internal/hooks.js +3 -0
  36. package/dist/internal/hooks.js.map +1 -0
  37. package/dist/useDataKit-XFp3_mUc.d.cts +276 -0
  38. package/dist/useDataKit-XFp3_mUc.d.ts +276 -0
  39. package/package.json +4 -1
  40. package/dist/index-CzDzNX62.d.cts +0 -558
  41. package/dist/index-CzDzNX62.d.ts +0 -558
@@ -0,0 +1,2613 @@
1
+ import { cn, useDataKit } from './chunk-4GSA6NBE.js';
2
+ import * as React2 from 'react';
3
+ import React2__default, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo } from 'react';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import { Filter, Loader2, MoreHorizontal, ArrowUp, ArrowDown, ChevronLeft, ChevronRight, ChevronDownIcon, CheckIcon, ChevronUpIcon } from 'lucide-react';
6
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
7
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
8
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
9
+ import { Slot } from '@radix-ui/react-slot';
10
+ import { cva } from 'class-variance-authority';
11
+ import * as SelectPrimitive from '@radix-ui/react-select';
12
+ import { useInView } from 'react-intersection-observer';
13
+
14
+ // src/server/utils.ts
15
+ var isProvided = (value) => value !== void 0 && value !== null && value !== "";
16
+ var getValueByPath = (obj, path) => {
17
+ if (!path) return void 0;
18
+ const parts = path.split(".");
19
+ let current = obj;
20
+ for (const part of parts) {
21
+ if (current && typeof current === "object" && part in current) {
22
+ current = current[part];
23
+ } else {
24
+ return void 0;
25
+ }
26
+ }
27
+ return current;
28
+ };
29
+ var matchesExact = (rowValue, needle) => {
30
+ if (Array.isArray(needle)) return needle.includes(rowValue);
31
+ return rowValue === needle;
32
+ };
33
+ var matchesRegexLike = (rowValue, needle) => {
34
+ if (!isProvided(needle)) return true;
35
+ if (rowValue === void 0 || rowValue === null) return false;
36
+ const hay = String(rowValue);
37
+ if (needle instanceof RegExp) return needle.test(hay);
38
+ const n = String(needle);
39
+ return hay.toLowerCase().includes(n.toLowerCase());
40
+ };
41
+ var compareValues = (a, b) => {
42
+ if (a === b) return 0;
43
+ if (a === void 0 || a === null) return -1;
44
+ if (b === void 0 || b === null) return 1;
45
+ if (typeof a === "number" && typeof b === "number") return a - b;
46
+ if (typeof a === "bigint" && typeof b === "bigint") return a < b ? -1 : 1;
47
+ const as = String(a);
48
+ const bs = String(b);
49
+ return as.localeCompare(bs);
50
+ };
51
+ var normalizeSorts = (sorts) => Array.isArray(sorts) ? sorts.filter((s) => !!s?.path && (s.value === 1 || s.value === -1)) : [];
52
+ var isSafeKey = (key) => {
53
+ const unsafeKeys = ["__proto__", "constructor", "prototype"];
54
+ return !unsafeKeys.includes(key);
55
+ };
56
+ var escapeRegex = (str) => {
57
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
58
+ };
59
+ var createSearchFilter = (fields) => {
60
+ return (value) => {
61
+ if (!value || typeof value !== "string") {
62
+ return {};
63
+ }
64
+ const escapedValue = escapeRegex(value);
65
+ return {
66
+ $or: fields.map((field) => ({
67
+ [field]: { $regex: escapedValue, $options: "i" }
68
+ }))
69
+ };
70
+ };
71
+ };
72
+ var calculatePagination = (page, limit, total) => ({
73
+ currentPage: page,
74
+ totalPages: Math.ceil(total / limit),
75
+ totalItems: total,
76
+ itemsPerPage: limit,
77
+ hasNextPage: page * limit < total,
78
+ hasPrevPage: page > 1
79
+ });
80
+ var useSelection = (initialSelected = []) => {
81
+ const [selectedIds, setSelectedIds] = useState(new Set(initialSelected));
82
+ const select = useCallback((id) => {
83
+ setSelectedIds((prev) => new Set(prev).add(id));
84
+ }, []);
85
+ const deselect = useCallback((id) => {
86
+ setSelectedIds((prev) => {
87
+ const next = new Set(prev);
88
+ next.delete(id);
89
+ return next;
90
+ });
91
+ }, []);
92
+ const toggle = useCallback((id) => {
93
+ setSelectedIds((prev) => {
94
+ const next = new Set(prev);
95
+ if (next.has(id)) next.delete(id);
96
+ else next.add(id);
97
+ return next;
98
+ });
99
+ }, []);
100
+ const selectAll = useCallback((ids) => {
101
+ setSelectedIds(new Set(ids));
102
+ }, []);
103
+ const deselectAll = useCallback(() => {
104
+ setSelectedIds(/* @__PURE__ */ new Set());
105
+ }, []);
106
+ const toggleAll = useCallback((ids) => {
107
+ setSelectedIds((prev) => {
108
+ if (ids.every((id) => prev.has(id))) return /* @__PURE__ */ new Set();
109
+ return new Set(ids);
110
+ });
111
+ }, []);
112
+ const isSelected = useCallback((id) => selectedIds.has(id), [selectedIds]);
113
+ const getSelectedArray = useCallback(() => Array.from(selectedIds), [selectedIds]);
114
+ const isAllSelected = useMemo(() => selectedIds.size > 0, [selectedIds.size]);
115
+ const isIndeterminate = useMemo(() => false, []);
116
+ return {
117
+ selectedIds,
118
+ isAllSelected,
119
+ isIndeterminate,
120
+ select,
121
+ deselect,
122
+ toggle,
123
+ selectAll,
124
+ deselectAll,
125
+ toggleAll,
126
+ isSelected,
127
+ getSelectedArray
128
+ };
129
+ };
130
+ var useSelectionWithTotal = (totalItems, initialSelected = []) => {
131
+ const selection = useSelection(initialSelected);
132
+ const isAllSelected = useMemo(
133
+ () => totalItems.length > 0 && totalItems.every((id) => selection.selectedIds.has(id)),
134
+ [totalItems, selection.selectedIds]
135
+ );
136
+ const isIndeterminate = useMemo(
137
+ () => selection.selectedIds.size > 0 && selection.selectedIds.size < totalItems.length,
138
+ [totalItems.length, selection.selectedIds.size]
139
+ );
140
+ const toggleAll = useCallback(() => {
141
+ if (isAllSelected) selection.deselectAll();
142
+ else selection.selectAll(totalItems);
143
+ }, [isAllSelected, selection, totalItems]);
144
+ return {
145
+ ...selection,
146
+ isAllSelected,
147
+ isIndeterminate,
148
+ toggleAll
149
+ };
150
+ };
151
+ var range = (start, end) => Array.from({ length: end - start + 1 }, (_, idx) => idx + start);
152
+ var usePagination = (props) => {
153
+ const { page, limit, total, siblingCount = 1 } = props;
154
+ const paginationInfo = useMemo(() => calculatePagination(page, limit, total), [page, limit, total]);
155
+ const pages = useMemo(() => {
156
+ const { totalPages } = paginationInfo;
157
+ const totalPageNumbers = siblingCount * 2 + 5;
158
+ if (totalPageNumbers >= totalPages) return range(1, totalPages);
159
+ const leftSiblingIndex = Math.max(page - siblingCount, 1);
160
+ const rightSiblingIndex = Math.min(page + siblingCount, totalPages);
161
+ const shouldShowLeftEllipsis = leftSiblingIndex > 2;
162
+ const shouldShowRightEllipsis = rightSiblingIndex < totalPages - 1;
163
+ if (!shouldShowLeftEllipsis && shouldShowRightEllipsis) {
164
+ const leftRange = range(1, 3 + 2 * siblingCount);
165
+ return [...leftRange, "ellipsis", totalPages];
166
+ }
167
+ if (shouldShowLeftEllipsis && !shouldShowRightEllipsis) {
168
+ const rightRange = range(totalPages - (3 + 2 * siblingCount) + 1, totalPages);
169
+ return [1, "ellipsis", ...rightRange];
170
+ }
171
+ if (shouldShowLeftEllipsis && shouldShowRightEllipsis) {
172
+ const middleRange = range(leftSiblingIndex, rightSiblingIndex);
173
+ return [1, "ellipsis", ...middleRange, "ellipsis", totalPages];
174
+ }
175
+ return range(1, totalPages);
176
+ }, [paginationInfo, page, siblingCount]);
177
+ return {
178
+ ...paginationInfo,
179
+ pages,
180
+ firstPage: 1,
181
+ lastPage: paginationInfo.totalPages
182
+ };
183
+ };
184
+ var createDataKitContext = () => {
185
+ const Context = createContext(null);
186
+ const DataKitProvider = (props) => {
187
+ const { value, children } = props;
188
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
189
+ };
190
+ const useDataKitContext = () => {
191
+ const context = useContext(Context);
192
+ if (!context) {
193
+ throw new Error("useDataKitContext must be used within a DataKitProvider");
194
+ }
195
+ return context;
196
+ };
197
+ return { DataKitProvider, useDataKitContext, Context };
198
+ };
199
+ var {
200
+ DataKitProvider: DefaultDataKitProvider,
201
+ useDataKitContext: useDefaultDataKitContext,
202
+ Context: DefaultDataKitContext
203
+ } = createDataKitContext();
204
+
205
+ // #style-inject:#style-inject
206
+ function styleInject(css, { insertAt } = {}) {
207
+ if (typeof document === "undefined") return;
208
+ const head = document.head || document.getElementsByTagName("head")[0];
209
+ const style = document.createElement("style");
210
+ style.type = "text/css";
211
+ if (insertAt === "top") {
212
+ if (head.firstChild) {
213
+ head.insertBefore(style, head.firstChild);
214
+ } else {
215
+ head.appendChild(style);
216
+ }
217
+ } else {
218
+ head.appendChild(style);
219
+ }
220
+ if (style.styleSheet) {
221
+ style.styleSheet.cssText = css;
222
+ } else {
223
+ style.appendChild(document.createTextNode(css));
224
+ }
225
+ }
226
+
227
+ // dist/styles.css
228
+ styleInject(`/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
229
+ @layer properties {
230
+ @supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))) {
231
+ *,
232
+ :before,
233
+ :after,
234
+ ::backdrop {
235
+ --tw-space-y-reverse:0;
236
+ --tw-border-style:solid;
237
+ --tw-font-weight:initial;
238
+ --tw-tracking:initial;
239
+ --tw-shadow:0 0 #0000;
240
+ --tw-shadow-color:initial;
241
+ --tw-shadow-alpha:100%;
242
+ --tw-inset-shadow:0 0 #0000;
243
+ --tw-inset-shadow-color:initial;
244
+ --tw-inset-shadow-alpha:100%;
245
+ --tw-ring-color:initial;
246
+ --tw-ring-shadow:0 0 #0000;
247
+ --tw-inset-ring-color:initial;
248
+ --tw-inset-ring-shadow:0 0 #0000;
249
+ --tw-ring-inset:initial;
250
+ --tw-ring-offset-width:0px;
251
+ --tw-ring-offset-color:#fff;
252
+ --tw-ring-offset-shadow:0 0 #0000;
253
+ --tw-translate-x:0;
254
+ --tw-translate-y:0;
255
+ --tw-translate-z:0;
256
+ }
257
+ }
258
+ }
259
+ @layer theme {
260
+ :root,
261
+ :host {
262
+ --ndk-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
263
+ --ndk-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
264
+ --ndk-color-red-400:oklch(70.4% .191 22.216);
265
+ --ndk-color-red-500:oklch(63.7% .237 25.331);
266
+ --ndk-color-red-600:oklch(57.7% .245 27.325);
267
+ --ndk-color-red-700:oklch(50.5% .213 27.518);
268
+ --ndk-color-gray-50:oklch(98.5% .002 247.839);
269
+ --ndk-color-gray-100:oklch(96.7% .003 264.542);
270
+ --ndk-color-gray-200:oklch(92.8% .006 264.531);
271
+ --ndk-color-gray-400:oklch(70.7% .022 261.325);
272
+ --ndk-color-gray-500:oklch(55.1% .027 264.364);
273
+ --ndk-color-gray-800:oklch(27.8% .033 256.848);
274
+ --ndk-color-gray-900:oklch(21% .034 264.665);
275
+ --ndk-color-gray-950:oklch(13% .028 261.692);
276
+ --ndk-color-black:#000;
277
+ --ndk-color-white:#fff;
278
+ --ndk-spacing:.25rem;
279
+ --ndk-text-xs:.75rem;
280
+ --ndk-text-xs--line-height:calc(1/.75);
281
+ --ndk-text-sm:.875rem;
282
+ --ndk-text-sm--line-height:calc(1.25/.875);
283
+ --ndk-font-weight-medium:500;
284
+ --ndk-tracking-widest:.1em;
285
+ --ndk-radius-sm:.25rem;
286
+ --ndk-radius-md:.375rem;
287
+ --ndk-radius-lg:.5rem;
288
+ --ndk-animate-spin:spin 1s linear infinite;
289
+ --ndk-default-transition-duration:.15s;
290
+ --ndk-default-transition-timing-function:cubic-bezier(.4,0,.2,1);
291
+ --ndk-default-font-family:var(--ndk-font-sans);
292
+ --ndk-default-mono-font-family:var(--ndk-font-mono);
293
+ --ndk-animate-in:animate-in;
294
+ --ndk-animate-out:animate-out;
295
+ }
296
+ }
297
+ @layer base {
298
+ *,
299
+ :after,
300
+ :before,
301
+ ::backdrop {
302
+ box-sizing: border-box;
303
+ border: 0 solid;
304
+ margin: 0;
305
+ padding: 0;
306
+ }
307
+ ::file-selector-button {
308
+ box-sizing: border-box;
309
+ border: 0 solid;
310
+ margin: 0;
311
+ padding: 0;
312
+ }
313
+ html,
314
+ :host {
315
+ -webkit-text-size-adjust: 100%;
316
+ tab-size: 4;
317
+ line-height: 1.5;
318
+ font-family: var(--ndk-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");
319
+ font-feature-settings: var(--ndk-default-font-feature-settings,normal);
320
+ font-variation-settings: var(--ndk-default-font-variation-settings,normal);
321
+ -webkit-tap-highlight-color: transparent;
322
+ }
323
+ hr {
324
+ height: 0;
325
+ color: inherit;
326
+ border-top-width: 1px;
327
+ }
328
+ abbr:where([title]) {
329
+ -webkit-text-decoration: underline dotted;
330
+ text-decoration: underline dotted;
331
+ }
332
+ h1,
333
+ h2,
334
+ h3,
335
+ h4,
336
+ h5,
337
+ h6 {
338
+ font-size: inherit;
339
+ font-weight: inherit;
340
+ }
341
+ a {
342
+ color: inherit;
343
+ -webkit-text-decoration: inherit;
344
+ -webkit-text-decoration: inherit;
345
+ -webkit-text-decoration: inherit;
346
+ text-decoration: inherit;
347
+ }
348
+ b,
349
+ strong {
350
+ font-weight: bolder;
351
+ }
352
+ code,
353
+ kbd,
354
+ samp,
355
+ pre {
356
+ font-family: var(--ndk-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);
357
+ font-feature-settings: var(--ndk-default-mono-font-feature-settings,normal);
358
+ font-variation-settings: var(--ndk-default-mono-font-variation-settings,normal);
359
+ font-size: 1em;
360
+ }
361
+ small {
362
+ font-size: 80%;
363
+ }
364
+ sub,
365
+ sup {
366
+ vertical-align: baseline;
367
+ font-size: 75%;
368
+ line-height: 0;
369
+ position: relative;
370
+ }
371
+ sub {
372
+ bottom: -.25em;
373
+ }
374
+ sup {
375
+ top: -.5em;
376
+ }
377
+ table {
378
+ text-indent: 0;
379
+ border-color: inherit;
380
+ border-collapse: collapse;
381
+ }
382
+ :-moz-focusring {
383
+ outline: auto;
384
+ }
385
+ progress {
386
+ vertical-align: baseline;
387
+ }
388
+ summary {
389
+ display: list-item;
390
+ }
391
+ ol,
392
+ ul,
393
+ menu {
394
+ list-style: none;
395
+ }
396
+ img,
397
+ svg,
398
+ video,
399
+ canvas,
400
+ audio,
401
+ iframe,
402
+ embed,
403
+ object {
404
+ vertical-align: middle;
405
+ display: block;
406
+ }
407
+ img,
408
+ video {
409
+ max-width: 100%;
410
+ height: auto;
411
+ }
412
+ button,
413
+ input,
414
+ select,
415
+ optgroup,
416
+ textarea {
417
+ font: inherit;
418
+ font-feature-settings: inherit;
419
+ font-variation-settings: inherit;
420
+ letter-spacing: inherit;
421
+ color: inherit;
422
+ opacity: 1;
423
+ background-color: #0000;
424
+ border-radius: 0;
425
+ }
426
+ ::file-selector-button {
427
+ font: inherit;
428
+ font-feature-settings: inherit;
429
+ font-variation-settings: inherit;
430
+ letter-spacing: inherit;
431
+ color: inherit;
432
+ opacity: 1;
433
+ background-color: #0000;
434
+ border-radius: 0;
435
+ }
436
+ :where(select:is([multiple], [size])) optgroup {
437
+ font-weight: bolder;
438
+ }
439
+ :where(select:is([multiple], [size])) optgroup option {
440
+ padding-inline-start: 20px;
441
+ }
442
+ ::file-selector-button {
443
+ margin-inline-end: 4px;
444
+ }
445
+ ::placeholder {
446
+ opacity: 1;
447
+ }
448
+ @supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px) {
449
+ ::placeholder {
450
+ color: currentColor;
451
+ }
452
+ @supports (color:color-mix(in lab, red, red)) {
453
+ ::placeholder {
454
+ color: color-mix(in oklab, currentcolor 50%, transparent);
455
+ }
456
+ }
457
+ }
458
+ textarea {
459
+ resize: vertical;
460
+ }
461
+ ::-webkit-search-decoration {
462
+ -webkit-appearance: none;
463
+ }
464
+ ::-webkit-date-and-time-value {
465
+ min-height: 1lh;
466
+ text-align: inherit;
467
+ }
468
+ ::-webkit-datetime-edit {
469
+ display: inline-flex;
470
+ }
471
+ ::-webkit-datetime-edit-fields-wrapper {
472
+ padding: 0;
473
+ }
474
+ ::-webkit-datetime-edit {
475
+ padding-block: 0;
476
+ }
477
+ ::-webkit-datetime-edit-year-field {
478
+ padding-block: 0;
479
+ }
480
+ ::-webkit-datetime-edit-month-field {
481
+ padding-block: 0;
482
+ }
483
+ ::-webkit-datetime-edit-day-field {
484
+ padding-block: 0;
485
+ }
486
+ ::-webkit-datetime-edit-hour-field {
487
+ padding-block: 0;
488
+ }
489
+ ::-webkit-datetime-edit-minute-field {
490
+ padding-block: 0;
491
+ }
492
+ ::-webkit-datetime-edit-second-field {
493
+ padding-block: 0;
494
+ }
495
+ ::-webkit-datetime-edit-millisecond-field {
496
+ padding-block: 0;
497
+ }
498
+ ::-webkit-datetime-edit-meridiem-field {
499
+ padding-block: 0;
500
+ }
501
+ ::-webkit-calendar-picker-indicator {
502
+ line-height: 1;
503
+ }
504
+ :-moz-ui-invalid {
505
+ box-shadow: none;
506
+ }
507
+ button,
508
+ input:where([type=button], [type=reset], [type=submit]) {
509
+ appearance: button;
510
+ }
511
+ ::file-selector-button {
512
+ appearance: button;
513
+ }
514
+ ::-webkit-inner-spin-button {
515
+ height: auto;
516
+ }
517
+ ::-webkit-outer-spin-button {
518
+ height: auto;
519
+ }
520
+ [hidden]:where(:not([hidden=until-found])) {
521
+ display: none !important;
522
+ }
523
+ }
524
+ @layer components;
525
+ @layer utilities {
526
+ .ndk\\:pointer-events-none {
527
+ pointer-events: none;
528
+ }
529
+ .ndk\\:sr-only {
530
+ clip-path: inset(50%);
531
+ white-space: nowrap;
532
+ border-width: 0;
533
+ width: 1px;
534
+ height: 1px;
535
+ margin: -1px;
536
+ padding: 0;
537
+ position: absolute;
538
+ overflow: hidden;
539
+ }
540
+ .ndk\\:absolute {
541
+ position: absolute;
542
+ }
543
+ .ndk\\:relative {
544
+ position: relative;
545
+ }
546
+ .ndk\\:right-2 {
547
+ right: calc(var(--ndk-spacing)*2);
548
+ }
549
+ .ndk\\:left-2 {
550
+ left: calc(var(--ndk-spacing)*2);
551
+ }
552
+ .ndk\\:z-50 {
553
+ z-index: 50;
554
+ }
555
+ .ndk\\:-mx-1 {
556
+ margin-inline: calc(var(--ndk-spacing)*-1);
557
+ }
558
+ .ndk\\:mx-0 {
559
+ margin-inline: calc(var(--ndk-spacing)*0);
560
+ }
561
+ .ndk\\:mx-auto {
562
+ margin-inline: auto;
563
+ }
564
+ .ndk\\:my-1 {
565
+ margin-block: calc(var(--ndk-spacing)*1);
566
+ }
567
+ .ndk\\:mt-4 {
568
+ margin-top: calc(var(--ndk-spacing)*4);
569
+ }
570
+ .ndk\\:mr-1\\.5 {
571
+ margin-right: calc(var(--ndk-spacing)*1.5);
572
+ }
573
+ .ndk\\:mr-2 {
574
+ margin-right: calc(var(--ndk-spacing)*2);
575
+ }
576
+ .ndk\\:-ml-4 {
577
+ margin-left: calc(var(--ndk-spacing)*-4);
578
+ }
579
+ .ndk\\:ml-1 {
580
+ margin-left: calc(var(--ndk-spacing)*1);
581
+ }
582
+ .ndk\\:ml-auto {
583
+ margin-left: auto;
584
+ }
585
+ .ndk\\:flex {
586
+ display: flex;
587
+ }
588
+ .ndk\\:grid {
589
+ display: grid;
590
+ }
591
+ .ndk\\:hidden {
592
+ display: none;
593
+ }
594
+ .ndk\\:inline-flex {
595
+ display: inline-flex;
596
+ }
597
+ .ndk\\:size-2 {
598
+ width: calc(var(--ndk-spacing)*2);
599
+ height: calc(var(--ndk-spacing)*2);
600
+ }
601
+ .ndk\\:size-3\\.5 {
602
+ width: calc(var(--ndk-spacing)*3.5);
603
+ height: calc(var(--ndk-spacing)*3.5);
604
+ }
605
+ .ndk\\:size-4 {
606
+ width: calc(var(--ndk-spacing)*4);
607
+ height: calc(var(--ndk-spacing)*4);
608
+ }
609
+ .ndk\\:size-5 {
610
+ width: calc(var(--ndk-spacing)*5);
611
+ height: calc(var(--ndk-spacing)*5);
612
+ }
613
+ .ndk\\:size-6 {
614
+ width: calc(var(--ndk-spacing)*6);
615
+ height: calc(var(--ndk-spacing)*6);
616
+ }
617
+ .ndk\\:size-8 {
618
+ width: calc(var(--ndk-spacing)*8);
619
+ height: calc(var(--ndk-spacing)*8);
620
+ }
621
+ .ndk\\:size-9 {
622
+ width: calc(var(--ndk-spacing)*9);
623
+ height: calc(var(--ndk-spacing)*9);
624
+ }
625
+ .ndk\\:size-10 {
626
+ width: calc(var(--ndk-spacing)*10);
627
+ height: calc(var(--ndk-spacing)*10);
628
+ }
629
+ .ndk\\:h-8 {
630
+ height: calc(var(--ndk-spacing)*8);
631
+ }
632
+ .ndk\\:h-9 {
633
+ height: calc(var(--ndk-spacing)*9);
634
+ }
635
+ .ndk\\:h-10 {
636
+ height: calc(var(--ndk-spacing)*10);
637
+ }
638
+ .ndk\\:h-24 {
639
+ height: calc(var(--ndk-spacing)*24);
640
+ }
641
+ .ndk\\:h-48 {
642
+ height: calc(var(--ndk-spacing)*48);
643
+ }
644
+ .ndk\\:h-\\[var\\(--radix-select-trigger-height\\)\\] {
645
+ height: var(--radix-select-trigger-height);
646
+ }
647
+ .ndk\\:h-auto {
648
+ height: auto;
649
+ }
650
+ .ndk\\:h-full {
651
+ height: 100%;
652
+ }
653
+ .ndk\\:h-px {
654
+ height: 1px;
655
+ }
656
+ .ndk\\:max-h-\\(--radix-dropdown-menu-content-available-height\\) {
657
+ max-height: var(--radix-dropdown-menu-content-available-height);
658
+ }
659
+ .ndk\\:max-h-\\(--radix-select-content-available-height\\) {
660
+ max-height: var(--radix-select-content-available-height);
661
+ }
662
+ .ndk\\:min-h-0 {
663
+ min-height: calc(var(--ndk-spacing)*0);
664
+ }
665
+ .ndk\\:min-h-\\[200px\\] {
666
+ min-height: 200px;
667
+ }
668
+ .ndk\\:w-12 {
669
+ width: calc(var(--ndk-spacing)*12);
670
+ }
671
+ .ndk\\:w-16 {
672
+ width: calc(var(--ndk-spacing)*16);
673
+ }
674
+ .ndk\\:w-72 {
675
+ width: calc(var(--ndk-spacing)*72);
676
+ }
677
+ .ndk\\:w-80 {
678
+ width: calc(var(--ndk-spacing)*80);
679
+ }
680
+ .ndk\\:w-auto {
681
+ width: auto;
682
+ }
683
+ .ndk\\:w-fit {
684
+ width: fit-content;
685
+ }
686
+ .ndk\\:w-full {
687
+ width: 100%;
688
+ }
689
+ .ndk\\:min-w-\\[8rem\\] {
690
+ min-width: 8rem;
691
+ }
692
+ .ndk\\:min-w-\\[var\\(--radix-select-trigger-width\\)\\] {
693
+ min-width: var(--radix-select-trigger-width);
694
+ }
695
+ .ndk\\:flex-1 {
696
+ flex: 1;
697
+ }
698
+ .ndk\\:shrink-0 {
699
+ flex-shrink: 0;
700
+ }
701
+ .ndk\\:caption-bottom {
702
+ caption-side: bottom;
703
+ }
704
+ .ndk\\:origin-\\(--radix-dropdown-menu-content-transform-origin\\) {
705
+ transform-origin: var(--radix-dropdown-menu-content-transform-origin);
706
+ }
707
+ .ndk\\:origin-\\(--radix-popover-content-transform-origin\\) {
708
+ transform-origin: var(--radix-popover-content-transform-origin);
709
+ }
710
+ .ndk\\:origin-\\(--radix-select-content-transform-origin\\) {
711
+ transform-origin: var(--radix-select-content-transform-origin);
712
+ }
713
+ .ndk\\:animate-spin {
714
+ animation: var(--ndk-animate-spin);
715
+ }
716
+ .ndk\\:cursor-default {
717
+ cursor: default;
718
+ }
719
+ .ndk\\:scroll-my-1 {
720
+ scroll-margin-block: calc(var(--ndk-spacing)*1);
721
+ }
722
+ .ndk\\:flex-col {
723
+ flex-direction: column;
724
+ }
725
+ .ndk\\:flex-row {
726
+ flex-direction: row;
727
+ }
728
+ .ndk\\:place-content-center {
729
+ place-content: center;
730
+ }
731
+ .ndk\\:items-center {
732
+ align-items: center;
733
+ }
734
+ .ndk\\:justify-between {
735
+ justify-content: space-between;
736
+ }
737
+ .ndk\\:justify-center {
738
+ justify-content: center;
739
+ }
740
+ .ndk\\:justify-end {
741
+ justify-content: flex-end;
742
+ }
743
+ .ndk\\:gap-1 {
744
+ gap: calc(var(--ndk-spacing)*1);
745
+ }
746
+ .ndk\\:gap-1\\.5 {
747
+ gap: calc(var(--ndk-spacing)*1.5);
748
+ }
749
+ .ndk\\:gap-2 {
750
+ gap: calc(var(--ndk-spacing)*2);
751
+ }
752
+ .ndk\\:gap-3 {
753
+ gap: calc(var(--ndk-spacing)*3);
754
+ }
755
+ .ndk\\:gap-4 {
756
+ gap: calc(var(--ndk-spacing)*4);
757
+ }
758
+ :where(.ndk\\:space-y-3 > :not(:last-child)) {
759
+ --tw-space-y-reverse:0;
760
+ margin-block-start: calc(calc(var(--ndk-spacing)*3)*var(--tw-space-y-reverse));
761
+ margin-block-end: calc(calc(var(--ndk-spacing)*3)*calc(1 - var(--tw-space-y-reverse)));
762
+ }
763
+ .ndk\\:overflow-hidden {
764
+ overflow: hidden;
765
+ }
766
+ .ndk\\:overflow-x-auto {
767
+ overflow-x: auto;
768
+ }
769
+ .ndk\\:overflow-x-hidden {
770
+ overflow-x: hidden;
771
+ }
772
+ .ndk\\:overflow-y-auto {
773
+ overflow-y: auto;
774
+ }
775
+ .ndk\\:rounded-\\[4px\\] {
776
+ border-radius: 4px;
777
+ }
778
+ .ndk\\:rounded-lg {
779
+ border-radius: var(--ndk-radius-lg);
780
+ }
781
+ .ndk\\:rounded-md {
782
+ border-radius: var(--ndk-radius-md);
783
+ }
784
+ .ndk\\:rounded-sm {
785
+ border-radius: var(--ndk-radius-sm);
786
+ }
787
+ .ndk\\:border {
788
+ border-style: var(--tw-border-style);
789
+ border-width: 1px;
790
+ }
791
+ .ndk\\:border-t {
792
+ border-top-style: var(--tw-border-style);
793
+ border-top-width: 1px;
794
+ }
795
+ .ndk\\:border-b {
796
+ border-bottom-style: var(--tw-border-style);
797
+ border-bottom-width: 1px;
798
+ }
799
+ .ndk\\:border-gray-100 {
800
+ border-color: var(--ndk-color-gray-100);
801
+ }
802
+ .ndk\\:border-gray-200 {
803
+ border-color: var(--ndk-color-gray-200);
804
+ }
805
+ .ndk\\:bg-gray-50\\/70 {
806
+ background-color: var(--ndk-color-gray-50);
807
+ }
808
+ @supports (color:color-mix(in lab, red, red)) {
809
+ .ndk\\:bg-gray-50\\/70 {
810
+ background-color: color-mix(in oklab, var(--ndk-color-gray-50)70%, transparent);
811
+ }
812
+ }
813
+ .ndk\\:bg-gray-100 {
814
+ background-color: var(--ndk-color-gray-100);
815
+ }
816
+ .ndk\\:bg-gray-900 {
817
+ background-color: var(--ndk-color-gray-900);
818
+ }
819
+ .ndk\\:bg-red-600 {
820
+ background-color: var(--ndk-color-red-600);
821
+ }
822
+ .ndk\\:bg-transparent {
823
+ background-color: #0000;
824
+ }
825
+ .ndk\\:bg-white {
826
+ background-color: var(--ndk-color-white);
827
+ }
828
+ .ndk\\:fill-current {
829
+ fill: currentColor;
830
+ }
831
+ .ndk\\:p-1 {
832
+ padding: calc(var(--ndk-spacing)*1);
833
+ }
834
+ .ndk\\:p-2 {
835
+ padding: calc(var(--ndk-spacing)*2);
836
+ }
837
+ .ndk\\:p-4 {
838
+ padding: calc(var(--ndk-spacing)*4);
839
+ }
840
+ .ndk\\:px-2 {
841
+ padding-inline: calc(var(--ndk-spacing)*2);
842
+ }
843
+ .ndk\\:px-2\\.5 {
844
+ padding-inline: calc(var(--ndk-spacing)*2.5);
845
+ }
846
+ .ndk\\:px-3 {
847
+ padding-inline: calc(var(--ndk-spacing)*3);
848
+ }
849
+ .ndk\\:px-4 {
850
+ padding-inline: calc(var(--ndk-spacing)*4);
851
+ }
852
+ .ndk\\:px-6 {
853
+ padding-inline: calc(var(--ndk-spacing)*6);
854
+ }
855
+ .ndk\\:py-0 {
856
+ padding-block: calc(var(--ndk-spacing)*0);
857
+ }
858
+ .ndk\\:py-1 {
859
+ padding-block: calc(var(--ndk-spacing)*1);
860
+ }
861
+ .ndk\\:py-1\\.5 {
862
+ padding-block: calc(var(--ndk-spacing)*1.5);
863
+ }
864
+ .ndk\\:py-2 {
865
+ padding-block: calc(var(--ndk-spacing)*2);
866
+ }
867
+ .ndk\\:py-4 {
868
+ padding-block: calc(var(--ndk-spacing)*4);
869
+ }
870
+ .ndk\\:pt-3 {
871
+ padding-top: calc(var(--ndk-spacing)*3);
872
+ }
873
+ .ndk\\:pt-4 {
874
+ padding-top: calc(var(--ndk-spacing)*4);
875
+ }
876
+ .ndk\\:pr-2 {
877
+ padding-right: calc(var(--ndk-spacing)*2);
878
+ }
879
+ .ndk\\:pr-8 {
880
+ padding-right: calc(var(--ndk-spacing)*8);
881
+ }
882
+ .ndk\\:pb-3 {
883
+ padding-bottom: calc(var(--ndk-spacing)*3);
884
+ }
885
+ .ndk\\:pl-2 {
886
+ padding-left: calc(var(--ndk-spacing)*2);
887
+ }
888
+ .ndk\\:pl-8 {
889
+ padding-left: calc(var(--ndk-spacing)*8);
890
+ }
891
+ .ndk\\:text-center {
892
+ text-align: center;
893
+ }
894
+ .ndk\\:text-left {
895
+ text-align: left;
896
+ }
897
+ .ndk\\:align-middle {
898
+ vertical-align: middle;
899
+ }
900
+ .ndk\\:text-sm {
901
+ font-size: var(--ndk-text-sm);
902
+ line-height: var(--tw-leading,var(--ndk-text-sm--line-height));
903
+ }
904
+ .ndk\\:text-xs {
905
+ font-size: var(--ndk-text-xs);
906
+ line-height: var(--tw-leading,var(--ndk-text-xs--line-height));
907
+ }
908
+ .ndk\\:font-medium {
909
+ --tw-font-weight:var(--ndk-font-weight-medium);
910
+ font-weight: var(--ndk-font-weight-medium);
911
+ }
912
+ .ndk\\:tracking-widest {
913
+ --tw-tracking:var(--ndk-tracking-widest);
914
+ letter-spacing: var(--ndk-tracking-widest);
915
+ }
916
+ .ndk\\:whitespace-nowrap {
917
+ white-space: nowrap;
918
+ }
919
+ .ndk\\:text-current {
920
+ color: currentColor;
921
+ }
922
+ .ndk\\:text-gray-500 {
923
+ color: var(--ndk-color-gray-500);
924
+ }
925
+ .ndk\\:text-gray-900 {
926
+ color: var(--ndk-color-gray-900);
927
+ }
928
+ .ndk\\:text-red-500 {
929
+ color: var(--ndk-color-red-500);
930
+ }
931
+ .ndk\\:text-white {
932
+ color: var(--ndk-color-white);
933
+ }
934
+ .ndk\\:underline-offset-4 {
935
+ text-underline-offset: 4px;
936
+ }
937
+ .ndk\\:opacity-50 {
938
+ opacity: .5;
939
+ }
940
+ .ndk\\:shadow-lg {
941
+ --tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);
942
+ box-shadow:
943
+ var(--tw-inset-shadow),
944
+ var(--tw-inset-ring-shadow),
945
+ var(--tw-ring-offset-shadow),
946
+ var(--tw-ring-shadow),
947
+ var(--tw-shadow);
948
+ }
949
+ .ndk\\:shadow-md {
950
+ --tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);
951
+ box-shadow:
952
+ var(--tw-inset-shadow),
953
+ var(--tw-inset-ring-shadow),
954
+ var(--tw-ring-offset-shadow),
955
+ var(--tw-ring-shadow),
956
+ var(--tw-shadow);
957
+ }
958
+ .ndk\\:shadow-xs {
959
+ --tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);
960
+ box-shadow:
961
+ var(--tw-inset-shadow),
962
+ var(--tw-inset-ring-shadow),
963
+ var(--tw-ring-offset-shadow),
964
+ var(--tw-ring-shadow),
965
+ var(--tw-shadow);
966
+ }
967
+ .ndk\\:outline-hidden {
968
+ --tw-outline-style:none;
969
+ outline-style: none;
970
+ }
971
+ @media (forced-colors: active) {
972
+ .ndk\\:outline-hidden {
973
+ outline-offset: 2px;
974
+ outline: 2px solid #0000;
975
+ }
976
+ }
977
+ .ndk\\:transition-\\[color\\,box-shadow\\] {
978
+ transition-property: color, box-shadow;
979
+ transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
980
+ transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
981
+ }
982
+ .ndk\\:transition-all {
983
+ transition-property: all;
984
+ transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
985
+ transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
986
+ }
987
+ .ndk\\:transition-colors {
988
+ transition-property:
989
+ color,
990
+ background-color,
991
+ border-color,
992
+ outline-color,
993
+ text-decoration-color,
994
+ fill,
995
+ stroke,
996
+ --tw-gradient-from,
997
+ --tw-gradient-via,
998
+ --tw-gradient-to;
999
+ transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
1000
+ transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
1001
+ }
1002
+ .ndk\\:transition-shadow {
1003
+ transition-property: box-shadow;
1004
+ transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
1005
+ transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
1006
+ }
1007
+ .ndk\\:transition-none {
1008
+ transition-property: none;
1009
+ }
1010
+ .ndk\\:outline-none {
1011
+ --tw-outline-style:none;
1012
+ outline-style: none;
1013
+ }
1014
+ .ndk\\:select-none {
1015
+ -webkit-user-select: none;
1016
+ user-select: none;
1017
+ }
1018
+ @media (hover: hover) {
1019
+ .ndk\\:hover\\:bg-gray-50:hover {
1020
+ background-color: var(--ndk-color-gray-50);
1021
+ }
1022
+ .ndk\\:hover\\:bg-gray-100:hover {
1023
+ background-color: var(--ndk-color-gray-100);
1024
+ }
1025
+ .ndk\\:hover\\:bg-gray-200:hover {
1026
+ background-color: var(--ndk-color-gray-200);
1027
+ }
1028
+ .ndk\\:hover\\:bg-gray-800:hover {
1029
+ background-color: var(--ndk-color-gray-800);
1030
+ }
1031
+ .ndk\\:hover\\:bg-red-700:hover {
1032
+ background-color: var(--ndk-color-red-700);
1033
+ }
1034
+ .ndk\\:hover\\:text-gray-900:hover {
1035
+ color: var(--ndk-color-gray-900);
1036
+ }
1037
+ .ndk\\:hover\\:underline:hover {
1038
+ text-decoration-line: underline;
1039
+ }
1040
+ }
1041
+ .ndk\\:focus\\:bg-gray-50:focus {
1042
+ background-color: var(--ndk-color-gray-50);
1043
+ }
1044
+ .ndk\\:focus\\:text-gray-900:focus {
1045
+ color: var(--ndk-color-gray-900);
1046
+ }
1047
+ .ndk\\:focus\\:ring-2:focus {
1048
+ --tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);
1049
+ box-shadow:
1050
+ var(--tw-inset-shadow),
1051
+ var(--tw-inset-ring-shadow),
1052
+ var(--tw-ring-offset-shadow),
1053
+ var(--tw-ring-shadow),
1054
+ var(--tw-shadow);
1055
+ }
1056
+ .ndk\\:focus-visible\\:border-gray-900:focus-visible {
1057
+ border-color: var(--ndk-color-gray-900);
1058
+ }
1059
+ .ndk\\:focus-visible\\:ring-\\[3px\\]:focus-visible {
1060
+ --tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);
1061
+ box-shadow:
1062
+ var(--tw-inset-shadow),
1063
+ var(--tw-inset-ring-shadow),
1064
+ var(--tw-ring-offset-shadow),
1065
+ var(--tw-ring-shadow),
1066
+ var(--tw-shadow);
1067
+ }
1068
+ .ndk\\:focus-visible\\:ring-black\\/20:focus-visible {
1069
+ --tw-ring-color:var(--ndk-color-black);
1070
+ }
1071
+ @supports (color:color-mix(in lab, red, red)) {
1072
+ .ndk\\:focus-visible\\:ring-black\\/20:focus-visible {
1073
+ --tw-ring-color:color-mix(in oklab,var(--ndk-color-black)20%,transparent);
1074
+ }
1075
+ }
1076
+ .ndk\\:disabled\\:pointer-events-none:disabled {
1077
+ pointer-events: none;
1078
+ }
1079
+ .ndk\\:disabled\\:cursor-not-allowed:disabled {
1080
+ cursor: not-allowed;
1081
+ }
1082
+ .ndk\\:disabled\\:opacity-50:disabled {
1083
+ opacity: .5;
1084
+ }
1085
+ .ndk\\:has-\\[\\>svg\\]\\:px-2\\.5:has(> svg) {
1086
+ padding-inline: calc(var(--ndk-spacing)*2.5);
1087
+ }
1088
+ .ndk\\:has-\\[\\>svg\\]\\:px-3:has(> svg) {
1089
+ padding-inline: calc(var(--ndk-spacing)*3);
1090
+ }
1091
+ .ndk\\:has-\\[\\>svg\\]\\:px-4:has(> svg) {
1092
+ padding-inline: calc(var(--ndk-spacing)*4);
1093
+ }
1094
+ .ndk\\:aria-invalid\\:border-red-500[aria-invalid=true] {
1095
+ border-color: var(--ndk-color-red-500);
1096
+ }
1097
+ .ndk\\:aria-invalid\\:ring-red-500\\/20[aria-invalid=true] {
1098
+ --tw-ring-color:var(--ndk-color-red-500);
1099
+ }
1100
+ @supports (color:color-mix(in lab, red, red)) {
1101
+ .ndk\\:aria-invalid\\:ring-red-500\\/20[aria-invalid=true] {
1102
+ --tw-ring-color:color-mix(in oklab,var(--ndk-color-red-500)20%,transparent);
1103
+ }
1104
+ }
1105
+ .ndk\\:data-\\[disabled\\]\\:pointer-events-none[data-disabled] {
1106
+ pointer-events: none;
1107
+ }
1108
+ .ndk\\:data-\\[disabled\\]\\:opacity-50[data-disabled] {
1109
+ opacity: .5;
1110
+ }
1111
+ .ndk\\:data-\\[inset\\]\\:pl-8[data-inset] {
1112
+ padding-left: calc(var(--ndk-spacing)*8);
1113
+ }
1114
+ .ndk\\:data-\\[placeholder\\]\\:text-gray-500[data-placeholder] {
1115
+ color: var(--ndk-color-gray-500);
1116
+ }
1117
+ .ndk\\:data-\\[side\\=bottom\\]\\:translate-y-1[data-side=bottom] {
1118
+ --tw-translate-y:calc(var(--ndk-spacing)*1);
1119
+ translate: var(--tw-translate-x)var(--tw-translate-y);
1120
+ }
1121
+ .ndk\\:data-\\[side\\=left\\]\\:-translate-x-1[data-side=left] {
1122
+ --tw-translate-x:calc(var(--ndk-spacing)*-1);
1123
+ translate: var(--tw-translate-x)var(--tw-translate-y);
1124
+ }
1125
+ .ndk\\:data-\\[side\\=right\\]\\:translate-x-1[data-side=right] {
1126
+ --tw-translate-x:calc(var(--ndk-spacing)*1);
1127
+ translate: var(--tw-translate-x)var(--tw-translate-y);
1128
+ }
1129
+ .ndk\\:data-\\[side\\=top\\]\\:-translate-y-1[data-side=top] {
1130
+ --tw-translate-y:calc(var(--ndk-spacing)*-1);
1131
+ translate: var(--tw-translate-x)var(--tw-translate-y);
1132
+ }
1133
+ .ndk\\:data-\\[size\\=default\\]\\:h-9[data-size=default] {
1134
+ height: calc(var(--ndk-spacing)*9);
1135
+ }
1136
+ .ndk\\:data-\\[size\\=sm\\]\\:h-8[data-size=sm] {
1137
+ height: calc(var(--ndk-spacing)*8);
1138
+ }
1139
+ :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:line-clamp-1 > *)[data-slot=select-value] {
1140
+ -webkit-line-clamp: 1;
1141
+ -webkit-box-orient: vertical;
1142
+ display: -webkit-box;
1143
+ overflow: hidden;
1144
+ }
1145
+ :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:flex > *)[data-slot=select-value] {
1146
+ display: flex;
1147
+ }
1148
+ :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:items-center > *)[data-slot=select-value] {
1149
+ align-items: center;
1150
+ }
1151
+ :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:gap-2 > *)[data-slot=select-value] {
1152
+ gap: calc(var(--ndk-spacing)*2);
1153
+ }
1154
+ .ndk\\:data-\\[state\\=checked\\]\\:border-gray-900[data-state=checked] {
1155
+ border-color: var(--ndk-color-gray-900);
1156
+ }
1157
+ .ndk\\:data-\\[state\\=checked\\]\\:bg-gray-900[data-state=checked] {
1158
+ background-color: var(--ndk-color-gray-900);
1159
+ }
1160
+ .ndk\\:data-\\[state\\=checked\\]\\:text-white[data-state=checked] {
1161
+ color: var(--ndk-color-white);
1162
+ }
1163
+ .ndk\\:data-\\[state\\=closed\\]\\:animate-out[data-state=closed] {
1164
+ animation: var(--ndk-animate-out);
1165
+ }
1166
+ .ndk\\:data-\\[state\\=open\\]\\:animate-in[data-state=open] {
1167
+ animation: var(--ndk-animate-in);
1168
+ }
1169
+ .ndk\\:data-\\[state\\=open\\]\\:bg-gray-50[data-state=open] {
1170
+ background-color: var(--ndk-color-gray-50);
1171
+ }
1172
+ .ndk\\:data-\\[state\\=open\\]\\:text-gray-900[data-state=open] {
1173
+ color: var(--ndk-color-gray-900);
1174
+ }
1175
+ .ndk\\:data-\\[state\\=selected\\]\\:bg-gray-50[data-state=selected] {
1176
+ background-color: var(--ndk-color-gray-50);
1177
+ }
1178
+ .ndk\\:data-\\[variant\\=destructive\\]\\:text-red-600[data-variant=destructive] {
1179
+ color: var(--ndk-color-red-600);
1180
+ }
1181
+ .ndk\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/10[data-variant=destructive]:focus {
1182
+ background-color: var(--ndk-color-red-500);
1183
+ }
1184
+ @supports (color:color-mix(in lab, red, red)) {
1185
+ .ndk\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/10[data-variant=destructive]:focus {
1186
+ background-color: color-mix(in oklab, var(--ndk-color-red-500)10%, transparent);
1187
+ }
1188
+ }
1189
+ .ndk\\:data-\\[variant\\=destructive\\]\\:focus\\:text-red-700[data-variant=destructive]:focus {
1190
+ color: var(--ndk-color-red-700);
1191
+ }
1192
+ @media (min-width: 40rem) {
1193
+ .ndk\\:sm\\:block {
1194
+ display: block;
1195
+ }
1196
+ .ndk\\:sm\\:hidden {
1197
+ display: none;
1198
+ }
1199
+ .ndk\\:sm\\:pr-2\\.5 {
1200
+ padding-right: calc(var(--ndk-spacing)*2.5);
1201
+ }
1202
+ .ndk\\:sm\\:pl-2\\.5 {
1203
+ padding-left: calc(var(--ndk-spacing)*2.5);
1204
+ }
1205
+ }
1206
+ .ndk\\:dark\\:border-gray-800:where(.dark, .dark *) {
1207
+ border-color: var(--ndk-color-gray-800);
1208
+ }
1209
+ .ndk\\:dark\\:bg-gray-100:where(.dark, .dark *) {
1210
+ background-color: var(--ndk-color-gray-100);
1211
+ }
1212
+ .ndk\\:dark\\:bg-gray-900:where(.dark, .dark *),
1213
+ .ndk\\:dark\\:bg-gray-900\\/40:where(.dark, .dark *) {
1214
+ background-color: var(--ndk-color-gray-900);
1215
+ }
1216
+ @supports (color:color-mix(in lab, red, red)) {
1217
+ .ndk\\:dark\\:bg-gray-900\\/40:where(.dark, .dark *) {
1218
+ background-color: color-mix(in oklab, var(--ndk-color-gray-900)40%, transparent);
1219
+ }
1220
+ }
1221
+ .ndk\\:dark\\:bg-gray-950:where(.dark, .dark *) {
1222
+ background-color: var(--ndk-color-gray-950);
1223
+ }
1224
+ .ndk\\:dark\\:bg-red-600:where(.dark, .dark *) {
1225
+ background-color: var(--ndk-color-red-600);
1226
+ }
1227
+ .ndk\\:dark\\:text-gray-100:where(.dark, .dark *) {
1228
+ color: var(--ndk-color-gray-100);
1229
+ }
1230
+ .ndk\\:dark\\:text-gray-400:where(.dark, .dark *) {
1231
+ color: var(--ndk-color-gray-400);
1232
+ }
1233
+ .ndk\\:dark\\:text-gray-900:where(.dark, .dark *) {
1234
+ color: var(--ndk-color-gray-900);
1235
+ }
1236
+ @media (hover: hover) {
1237
+ .ndk\\:dark\\:hover\\:bg-gray-200:where(.dark, .dark *):hover {
1238
+ background-color: var(--ndk-color-gray-200);
1239
+ }
1240
+ .ndk\\:dark\\:hover\\:bg-gray-800:where(.dark, .dark *):hover {
1241
+ background-color: var(--ndk-color-gray-800);
1242
+ }
1243
+ .ndk\\:dark\\:hover\\:bg-gray-900:where(.dark, .dark *):hover {
1244
+ background-color: var(--ndk-color-gray-900);
1245
+ }
1246
+ .ndk\\:dark\\:hover\\:bg-red-500:where(.dark, .dark *):hover {
1247
+ background-color: var(--ndk-color-red-500);
1248
+ }
1249
+ .ndk\\:dark\\:hover\\:text-gray-100:where(.dark, .dark *):hover {
1250
+ color: var(--ndk-color-gray-100);
1251
+ }
1252
+ }
1253
+ .ndk\\:dark\\:focus\\:bg-gray-900:where(.dark, .dark *):focus {
1254
+ background-color: var(--ndk-color-gray-900);
1255
+ }
1256
+ .ndk\\:dark\\:focus\\:text-gray-100:where(.dark, .dark *):focus {
1257
+ color: var(--ndk-color-gray-100);
1258
+ }
1259
+ .ndk\\:dark\\:focus-visible\\:border-gray-200:where(.dark, .dark *):focus-visible {
1260
+ border-color: var(--ndk-color-gray-200);
1261
+ }
1262
+ .ndk\\:dark\\:focus-visible\\:ring-white\\/20:where(.dark, .dark *):focus-visible {
1263
+ --tw-ring-color:var(--ndk-color-white);
1264
+ }
1265
+ @supports (color:color-mix(in lab, red, red)) {
1266
+ .ndk\\:dark\\:focus-visible\\:ring-white\\/20:where(.dark, .dark *):focus-visible {
1267
+ --tw-ring-color:color-mix(in oklab,var(--ndk-color-white)20%,transparent);
1268
+ }
1269
+ }
1270
+ .ndk\\:dark\\:aria-invalid\\:ring-red-500\\/30:where(.dark, .dark *)[aria-invalid=true] {
1271
+ --tw-ring-color:var(--ndk-color-red-500);
1272
+ }
1273
+ @supports (color:color-mix(in lab, red, red)) {
1274
+ .ndk\\:dark\\:aria-invalid\\:ring-red-500\\/30:where(.dark, .dark *)[aria-invalid=true] {
1275
+ --tw-ring-color:color-mix(in oklab,var(--ndk-color-red-500)30%,transparent);
1276
+ }
1277
+ }
1278
+ .ndk\\:dark\\:data-\\[placeholder\\]\\:text-gray-400:where(.dark, .dark *)[data-placeholder] {
1279
+ color: var(--ndk-color-gray-400);
1280
+ }
1281
+ .ndk\\:dark\\:data-\\[state\\=checked\\]\\:border-gray-100:where(.dark, .dark *)[data-state=checked] {
1282
+ border-color: var(--ndk-color-gray-100);
1283
+ }
1284
+ .ndk\\:dark\\:data-\\[state\\=checked\\]\\:bg-gray-100:where(.dark, .dark *)[data-state=checked] {
1285
+ background-color: var(--ndk-color-gray-100);
1286
+ }
1287
+ .ndk\\:dark\\:data-\\[state\\=checked\\]\\:text-gray-900:where(.dark, .dark *)[data-state=checked] {
1288
+ color: var(--ndk-color-gray-900);
1289
+ }
1290
+ .ndk\\:dark\\:data-\\[state\\=open\\]\\:bg-gray-900:where(.dark, .dark *)[data-state=open] {
1291
+ background-color: var(--ndk-color-gray-900);
1292
+ }
1293
+ .ndk\\:dark\\:data-\\[state\\=open\\]\\:text-gray-100:where(.dark, .dark *)[data-state=open] {
1294
+ color: var(--ndk-color-gray-100);
1295
+ }
1296
+ .ndk\\:dark\\:data-\\[state\\=selected\\]\\:bg-gray-900:where(.dark, .dark *)[data-state=selected] {
1297
+ background-color: var(--ndk-color-gray-900);
1298
+ }
1299
+ .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:text-red-500:where(.dark, .dark *)[data-variant=destructive] {
1300
+ color: var(--ndk-color-red-500);
1301
+ }
1302
+ .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/15:where(.dark, .dark *)[data-variant=destructive]:focus {
1303
+ background-color: var(--ndk-color-red-500);
1304
+ }
1305
+ @supports (color:color-mix(in lab, red, red)) {
1306
+ .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/15:where(.dark, .dark *)[data-variant=destructive]:focus {
1307
+ background-color: color-mix(in oklab, var(--ndk-color-red-500)15%, transparent);
1308
+ }
1309
+ }
1310
+ .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:focus\\:text-red-400:where(.dark, .dark *)[data-variant=destructive]:focus {
1311
+ color: var(--ndk-color-red-400);
1312
+ }
1313
+ .ndk\\:\\[\\&_svg\\]\\:pointer-events-none svg {
1314
+ pointer-events: none;
1315
+ }
1316
+ .ndk\\:\\[\\&_svg\\]\\:shrink-0 svg {
1317
+ flex-shrink: 0;
1318
+ }
1319
+ .ndk\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]) {
1320
+ width: calc(var(--ndk-spacing)*4);
1321
+ height: calc(var(--ndk-spacing)*4);
1322
+ }
1323
+ .ndk\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'text-\\'\\]\\)\\]\\:text-gray-500 svg:not([class*=text-]) {
1324
+ color: var(--ndk-color-gray-500);
1325
+ }
1326
+ .ndk\\:dark\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'text-\\'\\]\\)\\]\\:text-gray-400:where(.dark, .dark *) svg:not([class*=text-]) {
1327
+ color: var(--ndk-color-gray-400);
1328
+ }
1329
+ .ndk\\:\\[\\&_tr\\]\\:border-b tr {
1330
+ border-bottom-style: var(--tw-border-style);
1331
+ border-bottom-width: 1px;
1332
+ }
1333
+ .ndk\\:\\[\\&_tr\\:last-child\\]\\:border-0 tr:last-child {
1334
+ border-style: var(--tw-border-style);
1335
+ border-width: 0;
1336
+ }
1337
+ .ndk\\:\\[\\&\\:has\\(\\[role\\=checkbox\\]\\)\\]\\:pr-0:has([role=checkbox]) {
1338
+ padding-right: calc(var(--ndk-spacing)*0);
1339
+ }
1340
+ :is(.ndk\\:\\*\\:\\[span\\]\\:last\\:flex > *):is(span):last-child {
1341
+ display: flex;
1342
+ }
1343
+ :is(.ndk\\:\\*\\:\\[span\\]\\:last\\:items-center > *):is(span):last-child {
1344
+ align-items: center;
1345
+ }
1346
+ :is(.ndk\\:\\*\\:\\[span\\]\\:last\\:gap-2 > *):is(span):last-child {
1347
+ gap: calc(var(--ndk-spacing)*2);
1348
+ }
1349
+ :is(.ndk\\:data-\\[variant\\=destructive\\]\\:\\*\\:\\[svg\\]\\:\\!text-red-600[data-variant=destructive] > *):is(svg) {
1350
+ color: var(--ndk-color-red-600) !important;
1351
+ }
1352
+ :is(.ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:\\*\\:\\[svg\\]\\:\\!text-red-500:where(.dark, .dark *)[data-variant=destructive] > *):is(svg) {
1353
+ color: var(--ndk-color-red-500) !important;
1354
+ }
1355
+ .ndk\\:\\[\\&\\>\\[role\\=checkbox\\]\\]\\:translate-y-\\[2px\\] > [role=checkbox] {
1356
+ --tw-translate-y:2px;
1357
+ translate: var(--tw-translate-x)var(--tw-translate-y);
1358
+ }
1359
+ .ndk\\:\\[\\&\\>tr\\]\\:last\\:border-b-0 > tr:last-child {
1360
+ border-bottom-style: var(--tw-border-style);
1361
+ border-bottom-width: 0;
1362
+ }
1363
+ }
1364
+ @keyframes animate-in {
1365
+ 0% {
1366
+ opacity: 0;
1367
+ transform: scale(.95);
1368
+ }
1369
+ to {
1370
+ opacity: 1;
1371
+ transform: scale(1);
1372
+ }
1373
+ }
1374
+ @keyframes animate-out {
1375
+ 0% {
1376
+ opacity: 1;
1377
+ transform: scale(1);
1378
+ }
1379
+ to {
1380
+ opacity: 0;
1381
+ transform: scale(.95);
1382
+ }
1383
+ }
1384
+ @property --tw-space-y-reverse { syntax:"*";inherits:false;initial-value:0 }
1385
+ @property --tw-border-style { syntax:"*";inherits:false;initial-value:solid }
1386
+ @property --tw-font-weight { syntax:"*";inherits:false }
1387
+ @property --tw-tracking { syntax:"*";inherits:false }
1388
+ @property --tw-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1389
+ @property --tw-shadow-color { syntax:"*";inherits:false }
1390
+ @property --tw-shadow-alpha { syntax:"<percentage>";inherits:false;initial-value:100% }
1391
+ @property --tw-inset-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1392
+ @property --tw-inset-shadow-color { syntax:"*";inherits:false }
1393
+ @property --tw-inset-shadow-alpha { syntax:"<percentage>";inherits:false;initial-value:100% }
1394
+ @property --tw-ring-color { syntax:"*";inherits:false }
1395
+ @property --tw-ring-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1396
+ @property --tw-inset-ring-color { syntax:"*";inherits:false }
1397
+ @property --tw-inset-ring-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1398
+ @property --tw-ring-inset { syntax:"*";inherits:false }
1399
+ @property --tw-ring-offset-width { syntax:"<length>";inherits:false;initial-value:0 }
1400
+ @property --tw-ring-offset-color { syntax:"*";inherits:false;initial-value:#fff }
1401
+ @property --tw-ring-offset-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1402
+ @property --tw-translate-x { syntax:"*";inherits:false;initial-value:0 }
1403
+ @property --tw-translate-y { syntax:"*";inherits:false;initial-value:0 }
1404
+ @property --tw-translate-z { syntax:"*";inherits:false;initial-value:0 }
1405
+ @keyframes spin {
1406
+ to {
1407
+ transform: rotate(360deg);
1408
+ }
1409
+ }
1410
+ `);
1411
+ function Table({ className, ...props }) {
1412
+ return /* @__PURE__ */ jsx("div", { "data-slot": "table-container", className: "ndk:relative ndk:w-full ndk:overflow-x-auto", children: /* @__PURE__ */ jsx(
1413
+ "table",
1414
+ {
1415
+ "data-slot": "table",
1416
+ className: cn("ndk:w-full ndk:caption-bottom ndk:text-sm", className),
1417
+ ...props
1418
+ }
1419
+ ) });
1420
+ }
1421
+ function TableHeader({ className, ...props }) {
1422
+ return /* @__PURE__ */ jsx(
1423
+ "thead",
1424
+ {
1425
+ "data-slot": "table-header",
1426
+ className: cn("ndk:[&_tr]:border-b", className),
1427
+ ...props
1428
+ }
1429
+ );
1430
+ }
1431
+ function TableBody({ className, ...props }) {
1432
+ return /* @__PURE__ */ jsx(
1433
+ "tbody",
1434
+ {
1435
+ "data-slot": "table-body",
1436
+ className: cn("ndk:[&_tr:last-child]:border-0", className),
1437
+ ...props
1438
+ }
1439
+ );
1440
+ }
1441
+ function TableRow({ className, ...props }) {
1442
+ return /* @__PURE__ */ jsx(
1443
+ "tr",
1444
+ {
1445
+ "data-slot": "table-row",
1446
+ className: cn(
1447
+ "ndk:hover:bg-gray-50 ndk:dark:hover:bg-gray-900 ndk:data-[state=selected]:bg-gray-50 ndk:dark:data-[state=selected]:bg-gray-900 ndk:border-b ndk:border-gray-100 ndk:dark:border-gray-800 ndk:transition-colors",
1448
+ className
1449
+ ),
1450
+ ...props
1451
+ }
1452
+ );
1453
+ }
1454
+ function TableHead({ className, ...props }) {
1455
+ return /* @__PURE__ */ jsx(
1456
+ "th",
1457
+ {
1458
+ "data-slot": "table-head",
1459
+ className: cn(
1460
+ "ndk:text-gray-900 ndk:dark:text-gray-100 ndk:h-10 ndk:px-2 ndk:text-left ndk:align-middle ndk:font-medium ndk:whitespace-nowrap ndk:[&:has([role=checkbox])]:pr-0 ndk:[&>[role=checkbox]]:translate-y-[2px]",
1461
+ className
1462
+ ),
1463
+ ...props
1464
+ }
1465
+ );
1466
+ }
1467
+ function TableCell({ className, ...props }) {
1468
+ return /* @__PURE__ */ jsx(
1469
+ "td",
1470
+ {
1471
+ "data-slot": "table-cell",
1472
+ className: cn(
1473
+ "ndk:p-2 ndk:align-middle ndk:whitespace-nowrap ndk:[&:has([role=checkbox])]:pr-0 ndk:[&>[role=checkbox]]:translate-y-[2px]",
1474
+ className
1475
+ ),
1476
+ ...props
1477
+ }
1478
+ );
1479
+ }
1480
+ function Checkbox({
1481
+ className,
1482
+ ...props
1483
+ }) {
1484
+ return /* @__PURE__ */ jsx(
1485
+ CheckboxPrimitive.Root,
1486
+ {
1487
+ "data-slot": "checkbox",
1488
+ className: cn(
1489
+ "ndk:peer ndk:border-gray-200 ndk:bg-white ndk:text-gray-900 ndk:dark:border-gray-800 ndk:dark:bg-gray-950 ndk:dark:text-gray-100 ndk:data-[state=checked]:bg-gray-900 ndk:data-[state=checked]:text-white ndk:dark:data-[state=checked]:bg-gray-100 ndk:dark:data-[state=checked]:text-gray-900 ndk:data-[state=checked]:border-gray-900 ndk:dark:data-[state=checked]:border-gray-100 ndk:focus-visible:border-gray-900 ndk:dark:focus-visible:border-gray-200 ndk:focus-visible:ring-black/20 ndk:dark:focus-visible:ring-white/20 ndk:aria-invalid:ring-red-500/20 ndk:dark:aria-invalid:ring-red-500/30 ndk:aria-invalid:border-red-500 ndk:size-4 ndk:shrink-0 ndk:rounded-[4px] ndk:border ndk:shadow-xs ndk:transition-shadow ndk:outline-none ndk:focus-visible:ring-[3px] ndk:disabled:cursor-not-allowed ndk:disabled:opacity-50",
1490
+ className
1491
+ ),
1492
+ ...props,
1493
+ children: /* @__PURE__ */ jsx(
1494
+ CheckboxPrimitive.Indicator,
1495
+ {
1496
+ "data-slot": "checkbox-indicator",
1497
+ className: "ndk:grid ndk:place-content-center ndk:text-current ndk:transition-none",
1498
+ children: /* @__PURE__ */ jsx(CheckIcon, { className: "ndk:size-3.5" })
1499
+ }
1500
+ )
1501
+ }
1502
+ );
1503
+ }
1504
+ function Popover(props) {
1505
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
1506
+ }
1507
+ function PopoverTrigger(props) {
1508
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
1509
+ }
1510
+ function PopoverContent({
1511
+ className,
1512
+ align = "center",
1513
+ sideOffset = 4,
1514
+ container,
1515
+ ...props
1516
+ }) {
1517
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
1518
+ PopoverPrimitive.Content,
1519
+ {
1520
+ "data-slot": "popover-content",
1521
+ align,
1522
+ sideOffset,
1523
+ className: cn(
1524
+ "ndk:bg-white ndk:text-gray-900 ndk:dark:bg-gray-950 ndk:dark:text-gray-100 ndk:data-[state=open]:animate-in ndk:data-[state=closed]:animate-out ndk:data-[state=closed]:fade-out-0 ndk:data-[state=open]:fade-in-0 ndk:data-[state=closed]:zoom-out-95 ndk:data-[state=open]:zoom-in-95 ndk:data-[side=bottom]:slide-in-from-top-2 ndk:data-[side=left]:slide-in-from-right-2 ndk:data-[side=right]:slide-in-from-left-2 ndk:data-[side=top]:slide-in-from-bottom-2 ndk:z-50 ndk:w-72 ndk:origin-(--radix-popover-content-transform-origin) ndk:rounded-md ndk:border ndk:border-gray-200 ndk:dark:border-gray-800 ndk:p-4 ndk:shadow-md ndk:outline-hidden",
1525
+ className
1526
+ ),
1527
+ ...props
1528
+ }
1529
+ ) });
1530
+ }
1531
+ function DropdownMenu({
1532
+ ...props
1533
+ }) {
1534
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
1535
+ }
1536
+ function DropdownMenuTrigger({
1537
+ ...props
1538
+ }) {
1539
+ return /* @__PURE__ */ jsx(
1540
+ DropdownMenuPrimitive.Trigger,
1541
+ {
1542
+ "data-slot": "dropdown-menu-trigger",
1543
+ ...props
1544
+ }
1545
+ );
1546
+ }
1547
+ function DropdownMenuContent({
1548
+ className,
1549
+ sideOffset = 4,
1550
+ container,
1551
+ ...props
1552
+ }) {
1553
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
1554
+ DropdownMenuPrimitive.Content,
1555
+ {
1556
+ "data-slot": "dropdown-menu-content",
1557
+ sideOffset,
1558
+ className: cn(
1559
+ "ndk:bg-white ndk:text-gray-900 ndk:dark:bg-gray-950 ndk:dark:text-gray-100 ndk:data-[state=open]:animate-in ndk:data-[state=closed]:animate-out ndk:data-[state=closed]:fade-out-0 ndk:data-[state=open]:fade-in-0 ndk:data-[state=closed]:zoom-out-95 ndk:data-[state=open]:zoom-in-95 ndk:data-[side=bottom]:slide-in-from-top-2 ndk:data-[side=left]:slide-in-from-right-2 ndk:data-[side=right]:slide-in-from-left-2 ndk:data-[side=top]:slide-in-from-bottom-2 ndk:z-50 ndk:max-h-(--radix-dropdown-menu-content-available-height) ndk:min-w-[8rem] ndk:origin-(--radix-dropdown-menu-content-transform-origin) ndk:overflow-x-hidden ndk:overflow-y-auto ndk:rounded-md ndk:border ndk:border-gray-200 ndk:dark:border-gray-800 ndk:p-1 ndk:shadow-md",
1560
+ className
1561
+ ),
1562
+ ...props
1563
+ }
1564
+ ) });
1565
+ }
1566
+ function DropdownMenuItem({
1567
+ className,
1568
+ inset,
1569
+ variant = "default",
1570
+ ...props
1571
+ }) {
1572
+ return /* @__PURE__ */ jsx(
1573
+ DropdownMenuPrimitive.Item,
1574
+ {
1575
+ "data-slot": "dropdown-menu-item",
1576
+ "data-inset": inset,
1577
+ "data-variant": variant,
1578
+ className: cn(
1579
+ "ndk:focus:bg-gray-50 ndk:dark:focus:bg-gray-900 ndk:focus:text-gray-900 ndk:dark:focus:text-gray-100 ndk:data-[variant=destructive]:text-red-600 ndk:dark:data-[variant=destructive]:text-red-500 ndk:data-[variant=destructive]:focus:bg-red-500/10 ndk:dark:data-[variant=destructive]:focus:bg-red-500/15 ndk:data-[variant=destructive]:focus:text-red-700 ndk:dark:data-[variant=destructive]:focus:text-red-400 ndk:data-[variant=destructive]:*:[svg]:!text-red-600 ndk:dark:data-[variant=destructive]:*:[svg]:!text-red-500 ndk:[&_svg:not([class*='text-'])]:text-gray-500 ndk:dark:[&_svg:not([class*='text-'])]:text-gray-400 ndk:relative ndk:flex ndk:cursor-default ndk:items-center ndk:gap-2 ndk:rounded-sm ndk:px-2 ndk:py-1.5 ndk:text-sm ndk:outline-hidden ndk:select-none ndk:data-[disabled]:pointer-events-none ndk:data-[disabled]:opacity-50 ndk:data-[inset]:pl-8 ndk:[&_svg]:pointer-events-none ndk:[&_svg]:shrink-0 ndk:[&_svg:not([class*='size-'])]:size-4",
1580
+ className
1581
+ ),
1582
+ ...props
1583
+ }
1584
+ );
1585
+ }
1586
+ function DropdownMenuSeparator({
1587
+ className,
1588
+ ...props
1589
+ }) {
1590
+ return /* @__PURE__ */ jsx(
1591
+ DropdownMenuPrimitive.Separator,
1592
+ {
1593
+ "data-slot": "dropdown-menu-separator",
1594
+ className: cn("ndk:bg-gray-100 ndk:dark:bg-gray-900 ndk:-mx-1 ndk:my-1 ndk:h-px", className),
1595
+ ...props
1596
+ }
1597
+ );
1598
+ }
1599
+ var buttonVariants = cva(
1600
+ "ndk:inline-flex ndk:items-center ndk:justify-center ndk:gap-2 ndk:whitespace-nowrap ndk:rounded-md ndk:text-sm ndk:font-medium ndk:transition-all ndk:disabled:pointer-events-none ndk:disabled:opacity-50 ndk:[&_svg]:pointer-events-none ndk:[&_svg:not([class*='size-'])]:size-4 ndk:shrink-0 ndk:[&_svg]:shrink-0 ndk:outline-none ndk:focus-visible:ring-black/20 ndk:dark:focus-visible:ring-white/20 ndk:focus-visible:ring-[3px] ndk:aria-invalid:ring-red-500/20 ndk:dark:aria-invalid:ring-red-500/30 ndk:aria-invalid:border-red-500",
1601
+ {
1602
+ variants: {
1603
+ variant: {
1604
+ default: "ndk:bg-gray-900 ndk:text-white ndk:hover:bg-gray-800 ndk:dark:bg-gray-100 ndk:dark:text-gray-900 ndk:dark:hover:bg-gray-200",
1605
+ destructive: "ndk:bg-red-600 ndk:text-white ndk:hover:bg-red-700 ndk:dark:bg-red-600 ndk:dark:hover:bg-red-500",
1606
+ outline: "ndk:border ndk:border-gray-200 ndk:bg-white ndk:text-gray-900 ndk:shadow-xs ndk:hover:bg-gray-50 ndk:dark:border-gray-800 ndk:dark:bg-gray-950 ndk:dark:text-gray-100 ndk:dark:hover:bg-gray-900",
1607
+ secondary: "ndk:bg-gray-100 ndk:text-gray-900 ndk:hover:bg-gray-200 ndk:dark:bg-gray-900 ndk:dark:text-gray-100 ndk:dark:hover:bg-gray-800",
1608
+ ghost: "ndk:hover:bg-gray-100 ndk:hover:text-gray-900 ndk:dark:hover:bg-gray-900 ndk:dark:hover:text-gray-100",
1609
+ link: "ndk:text-gray-900 ndk:underline-offset-4 ndk:hover:underline ndk:dark:text-gray-100"
1610
+ },
1611
+ size: {
1612
+ default: "ndk:h-9 ndk:px-4 ndk:py-2 ndk:has-[>svg]:px-3",
1613
+ sm: "ndk:h-8 ndk:rounded-md ndk:gap-1.5 ndk:px-3 ndk:has-[>svg]:px-2.5",
1614
+ lg: "ndk:h-10 ndk:rounded-md ndk:px-6 ndk:has-[>svg]:px-4",
1615
+ icon: "ndk:size-9",
1616
+ "icon-sm": "ndk:size-8",
1617
+ "icon-lg": "ndk:size-10"
1618
+ }
1619
+ },
1620
+ defaultVariants: {
1621
+ variant: "default",
1622
+ size: "default"
1623
+ }
1624
+ }
1625
+ );
1626
+ var Button = React2.forwardRef(function Button2({
1627
+ className,
1628
+ variant = "default",
1629
+ size = "default",
1630
+ asChild = false,
1631
+ ...props
1632
+ }, ref) {
1633
+ const Comp = asChild ? Slot : "button";
1634
+ return /* @__PURE__ */ jsx(
1635
+ Comp,
1636
+ {
1637
+ ref,
1638
+ "data-slot": "button",
1639
+ "data-variant": variant,
1640
+ "data-size": size,
1641
+ className: cn(buttonVariants({ variant, size, className })),
1642
+ ...props
1643
+ }
1644
+ );
1645
+ });
1646
+ Button.displayName = "Button";
1647
+ function Pagination({ className, ...props }) {
1648
+ return /* @__PURE__ */ jsx(
1649
+ "nav",
1650
+ {
1651
+ role: "navigation",
1652
+ "aria-label": "pagination",
1653
+ "data-slot": "pagination",
1654
+ className: cn("ndk:flex", className),
1655
+ ...props
1656
+ }
1657
+ );
1658
+ }
1659
+ function PaginationContent({
1660
+ className,
1661
+ ...props
1662
+ }) {
1663
+ return /* @__PURE__ */ jsx(
1664
+ "ul",
1665
+ {
1666
+ "data-slot": "pagination-content",
1667
+ className: cn("ndk:flex ndk:flex-row ndk:items-center ndk:gap-1", className),
1668
+ ...props
1669
+ }
1670
+ );
1671
+ }
1672
+ function PaginationItem({ ...props }) {
1673
+ return /* @__PURE__ */ jsx("li", { "data-slot": "pagination-item", ...props });
1674
+ }
1675
+ function PaginationLink({
1676
+ className,
1677
+ isActive,
1678
+ size = "icon",
1679
+ type = "button",
1680
+ ...props
1681
+ }) {
1682
+ return /* @__PURE__ */ jsx(
1683
+ "button",
1684
+ {
1685
+ "aria-current": isActive ? "page" : void 0,
1686
+ "data-slot": "pagination-link",
1687
+ "data-active": isActive ? "true" : "false",
1688
+ className: cn(
1689
+ buttonVariants({
1690
+ variant: isActive ? "outline" : "ghost",
1691
+ size
1692
+ }),
1693
+ className
1694
+ ),
1695
+ type,
1696
+ ...props
1697
+ }
1698
+ );
1699
+ }
1700
+ function PaginationPrevious({
1701
+ className,
1702
+ ...props
1703
+ }) {
1704
+ return /* @__PURE__ */ jsxs(
1705
+ PaginationLink,
1706
+ {
1707
+ "aria-label": "Go to previous page",
1708
+ size: "default",
1709
+ className: cn("ndk:gap-1 ndk:px-2.5 ndk:sm:pl-2.5", className),
1710
+ ...props,
1711
+ children: [
1712
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "ndk:size-4", "aria-hidden": "true" }),
1713
+ /* @__PURE__ */ jsx("span", { className: "ndk:hidden ndk:sm:block", children: "Previous" })
1714
+ ]
1715
+ }
1716
+ );
1717
+ }
1718
+ function PaginationNext({
1719
+ className,
1720
+ ...props
1721
+ }) {
1722
+ return /* @__PURE__ */ jsxs(
1723
+ PaginationLink,
1724
+ {
1725
+ "aria-label": "Go to next page",
1726
+ size: "default",
1727
+ className: cn("ndk:gap-1 ndk:px-2.5 ndk:sm:pr-2.5", className),
1728
+ ...props,
1729
+ children: [
1730
+ /* @__PURE__ */ jsx("span", { className: "ndk:hidden ndk:sm:block", children: "Next" }),
1731
+ /* @__PURE__ */ jsx(ChevronRight, { className: "ndk:size-4", "aria-hidden": "true" })
1732
+ ]
1733
+ }
1734
+ );
1735
+ }
1736
+ function PaginationEllipsis({
1737
+ className,
1738
+ ...props
1739
+ }) {
1740
+ return /* @__PURE__ */ jsxs(
1741
+ "span",
1742
+ {
1743
+ "aria-hidden": "true",
1744
+ "data-slot": "pagination-ellipsis",
1745
+ className: cn("ndk:flex ndk:size-9 ndk:items-center ndk:justify-center", className),
1746
+ ...props,
1747
+ children: [
1748
+ /* @__PURE__ */ jsx(MoreHorizontal, { className: "ndk:size-4", "aria-hidden": "true" }),
1749
+ /* @__PURE__ */ jsx("span", { className: "ndk:sr-only", children: "More pages" })
1750
+ ]
1751
+ }
1752
+ );
1753
+ }
1754
+ function Select({
1755
+ ...props
1756
+ }) {
1757
+ return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
1758
+ }
1759
+ function SelectValue({
1760
+ ...props
1761
+ }) {
1762
+ return /* @__PURE__ */ jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
1763
+ }
1764
+ function SelectTrigger({
1765
+ className,
1766
+ size = "default",
1767
+ children,
1768
+ ...props
1769
+ }) {
1770
+ return /* @__PURE__ */ jsxs(
1771
+ SelectPrimitive.Trigger,
1772
+ {
1773
+ "data-slot": "select-trigger",
1774
+ "data-size": size,
1775
+ className: cn(
1776
+ "ndk:border-gray-200 ndk:dark:border-gray-800 ndk:data-[placeholder]:text-gray-500 ndk:dark:data-[placeholder]:text-gray-400 ndk:[&_svg:not([class*='text-'])]:text-gray-500 ndk:dark:[&_svg:not([class*='text-'])]:text-gray-400 ndk:focus-visible:border-gray-900 ndk:dark:focus-visible:border-gray-200 ndk:focus-visible:ring-black/20 ndk:dark:focus-visible:ring-white/20 ndk:aria-invalid:ring-red-500/20 ndk:dark:aria-invalid:ring-red-500/30 ndk:aria-invalid:border-red-500 ndk:bg-white ndk:dark:bg-gray-950 ndk:hover:bg-gray-50 ndk:dark:hover:bg-gray-900 ndk:flex ndk:w-fit ndk:items-center ndk:justify-between ndk:gap-2 ndk:rounded-md ndk:border ndk:px-3 ndk:py-2 ndk:text-sm ndk:whitespace-nowrap ndk:shadow-xs ndk:transition-[color,box-shadow] ndk:outline-none ndk:focus-visible:ring-[3px] ndk:disabled:cursor-not-allowed ndk:disabled:opacity-50 ndk:data-[size=default]:h-9 ndk:data-[size=sm]:h-8 ndk:*:data-[slot=select-value]:line-clamp-1 ndk:*:data-[slot=select-value]:flex ndk:*:data-[slot=select-value]:items-center ndk:*:data-[slot=select-value]:gap-2 ndk:[&_svg]:pointer-events-none ndk:[&_svg]:shrink-0 ndk:[&_svg:not([class*='size-'])]:size-4",
1777
+ className
1778
+ ),
1779
+ ...props,
1780
+ children: [
1781
+ children,
1782
+ /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "ndk:size-4 ndk:opacity-50" }) })
1783
+ ]
1784
+ }
1785
+ );
1786
+ }
1787
+ function SelectContent({
1788
+ className,
1789
+ children,
1790
+ position = "item-aligned",
1791
+ align = "center",
1792
+ container,
1793
+ ...props
1794
+ }) {
1795
+ return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsxs(
1796
+ SelectPrimitive.Content,
1797
+ {
1798
+ "data-slot": "select-content",
1799
+ className: cn(
1800
+ "ndk:bg-white ndk:text-gray-900 ndk:dark:bg-gray-950 ndk:dark:text-gray-100 ndk:data-[state=open]:animate-in ndk:data-[state=closed]:animate-out ndk:data-[state=closed]:fade-out-0 ndk:data-[state=open]:fade-in-0 ndk:data-[state=closed]:zoom-out-95 ndk:data-[state=open]:zoom-in-95 ndk:data-[side=bottom]:slide-in-from-top-2 ndk:data-[side=left]:slide-in-from-right-2 ndk:data-[side=right]:slide-in-from-left-2 ndk:data-[side=top]:slide-in-from-bottom-2 ndk:relative ndk:z-50 ndk:max-h-(--radix-select-content-available-height) ndk:min-w-[8rem] ndk:origin-(--radix-select-content-transform-origin) ndk:overflow-x-hidden ndk:overflow-y-auto ndk:rounded-md ndk:border ndk:border-gray-200 ndk:dark:border-gray-800 ndk:shadow-md",
1801
+ position === "popper" && "ndk:data-[side=bottom]:translate-y-1 ndk:data-[side=left]:-translate-x-1 ndk:data-[side=right]:translate-x-1 ndk:data-[side=top]:-translate-y-1",
1802
+ className
1803
+ ),
1804
+ position,
1805
+ align,
1806
+ ...props,
1807
+ children: [
1808
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
1809
+ /* @__PURE__ */ jsx(
1810
+ SelectPrimitive.Viewport,
1811
+ {
1812
+ className: cn(
1813
+ "ndk:p-1",
1814
+ position === "popper" && "ndk:h-[var(--radix-select-trigger-height)] ndk:w-full ndk:min-w-[var(--radix-select-trigger-width)] ndk:scroll-my-1"
1815
+ ),
1816
+ children
1817
+ }
1818
+ ),
1819
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
1820
+ ]
1821
+ }
1822
+ ) });
1823
+ }
1824
+ function SelectItem({
1825
+ className,
1826
+ children,
1827
+ ...props
1828
+ }) {
1829
+ return /* @__PURE__ */ jsxs(
1830
+ SelectPrimitive.Item,
1831
+ {
1832
+ "data-slot": "select-item",
1833
+ className: cn(
1834
+ "ndk:focus:bg-gray-50 ndk:dark:focus:bg-gray-900 ndk:focus:text-gray-900 ndk:dark:focus:text-gray-100 ndk:[&_svg:not([class*='text-'])]:text-gray-500 ndk:dark:[&_svg:not([class*='text-'])]:text-gray-400 ndk:relative ndk:flex ndk:w-full ndk:cursor-default ndk:items-center ndk:gap-2 ndk:rounded-sm ndk:py-1.5 ndk:pr-8 ndk:pl-2 ndk:text-sm ndk:outline-hidden ndk:select-none ndk:data-[disabled]:pointer-events-none ndk:data-[disabled]:opacity-50 ndk:[&_svg]:pointer-events-none ndk:[&_svg]:shrink-0 ndk:[&_svg:not([class*='size-'])]:size-4 ndk:*:[span]:last:flex ndk:*:[span]:last:items-center ndk:*:[span]:last:gap-2",
1835
+ className
1836
+ ),
1837
+ ...props,
1838
+ children: [
1839
+ /* @__PURE__ */ jsx(
1840
+ "span",
1841
+ {
1842
+ "data-slot": "select-item-indicator",
1843
+ className: "ndk:absolute ndk:right-2 ndk:flex ndk:size-3.5 ndk:items-center ndk:justify-center",
1844
+ children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "ndk:size-4" }) })
1845
+ }
1846
+ ),
1847
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
1848
+ ]
1849
+ }
1850
+ );
1851
+ }
1852
+ function SelectScrollUpButton({
1853
+ className,
1854
+ ...props
1855
+ }) {
1856
+ return /* @__PURE__ */ jsx(
1857
+ SelectPrimitive.ScrollUpButton,
1858
+ {
1859
+ "data-slot": "select-scroll-up-button",
1860
+ className: cn(
1861
+ "ndk:flex ndk:cursor-default ndk:items-center ndk:justify-center ndk:py-1",
1862
+ className
1863
+ ),
1864
+ ...props,
1865
+ children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "ndk:size-4" })
1866
+ }
1867
+ );
1868
+ }
1869
+ function SelectScrollDownButton({
1870
+ className,
1871
+ ...props
1872
+ }) {
1873
+ return /* @__PURE__ */ jsx(
1874
+ SelectPrimitive.ScrollDownButton,
1875
+ {
1876
+ "data-slot": "select-scroll-down-button",
1877
+ className: cn(
1878
+ "ndk:flex ndk:cursor-default ndk:items-center ndk:justify-center ndk:py-1",
1879
+ className
1880
+ ),
1881
+ ...props,
1882
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "ndk:size-4" })
1883
+ }
1884
+ );
1885
+ }
1886
+ var DataKitRoot = (props) => {
1887
+ const {
1888
+ action,
1889
+ query,
1890
+ table: columns,
1891
+ filters = [],
1892
+ selectable,
1893
+ state: initialState,
1894
+ limit: limitConfig,
1895
+ className,
1896
+ autoFetch = true,
1897
+ debounce: debounce2 = 300,
1898
+ bordered,
1899
+ refetchInterval,
1900
+ memory: memoryMode = "memory",
1901
+ pagination: paginationType = "NUMBER",
1902
+ controller,
1903
+ sorts: defaultSorts = []
1904
+ } = props;
1905
+ const tableRef = useRef(null);
1906
+ const intervalRef = useRef(null);
1907
+ const [isVisible, setIsVisible] = useState(false);
1908
+ const [isFilterOpen, setIsFilterOpen] = useState(false);
1909
+ const [actionLoading, setActionLoading] = useState(null);
1910
+ const [actionsMenuOpen, setActionsMenuOpen] = useState(false);
1911
+ const [rowStates, setRowStates] = useState(/* @__PURE__ */ new Map());
1912
+ const [lastSelectedIndex, setLastSelectedIndex] = useState(null);
1913
+ const overlayContainer = tableRef.current;
1914
+ const getRowState = useCallback((rowId) => {
1915
+ return rowStates.get(rowId) ?? initialState;
1916
+ }, [rowStates, initialState]);
1917
+ const setRowState = useCallback((rowId, updater) => {
1918
+ setRowStates((prev) => {
1919
+ const current = prev.get(rowId) ?? initialState;
1920
+ const newState = typeof updater === "function" ? updater(current) : updater;
1921
+ const newMap = new Map(prev);
1922
+ newMap.set(rowId, newState);
1923
+ return newMap;
1924
+ });
1925
+ }, [initialState]);
1926
+ const dataKit = useDataKit({
1927
+ action,
1928
+ filters,
1929
+ autoFetch,
1930
+ debounce: debounce2,
1931
+ memory: memoryMode,
1932
+ initial: {
1933
+ limit: limitConfig?.default ?? 10,
1934
+ query: query ?? {},
1935
+ sorts: (() => {
1936
+ const columnSorts = columns.reduce((acc, col) => {
1937
+ if (col.sortable && col.sortable.default !== 0) {
1938
+ acc.push({ path: col.sortable.path, value: col.sortable.default });
1939
+ }
1940
+ return acc;
1941
+ }, []);
1942
+ const columnPaths = new Set(columnSorts.map((s) => s.path));
1943
+ const additionalSorts = defaultSorts.filter((s) => !columnPaths.has(s.path));
1944
+ return [...columnSorts, ...additionalSorts];
1945
+ })(),
1946
+ filter: filters.reduce((acc, f) => {
1947
+ if (f.defaultValue !== void 0) acc[f.id] = f.defaultValue;
1948
+ return acc;
1949
+ }, {})
1950
+ }
1951
+ });
1952
+ const pagination = usePagination({ page: dataKit.page, limit: dataKit.limit, total: dataKit.total, siblingCount: 1 });
1953
+ const selection = useSelectionWithTotal(dataKit.items.map((item) => item.id));
1954
+ const selectedCount = selection.selectedIds.size;
1955
+ const colSpan = columns.length + (selectable?.enabled ? 1 : 0);
1956
+ const limitOptions = React2__default.useMemo(() => {
1957
+ const standardOptions = [10, 25, 50, 100];
1958
+ const currentLimit = dataKit.limit;
1959
+ if (!standardOptions.includes(currentLimit)) {
1960
+ return [...standardOptions, currentLimit].sort((a, b) => a - b);
1961
+ }
1962
+ return standardOptions;
1963
+ }, [dataKit.limit]);
1964
+ const handleSort = useCallback((path) => {
1965
+ const currentSort = dataKit.sorts.find((s) => s.path === path);
1966
+ const nextValue = currentSort?.value === 1 ? -1 : currentSort?.value === -1 ? null : 1;
1967
+ dataKit.actions.setSort(path, nextValue);
1968
+ }, [dataKit.sorts, dataKit.actions]);
1969
+ const handleSelectionAction = useCallback(async (actionKey) => {
1970
+ const action2 = selectable?.actions?.[actionKey];
1971
+ if (!action2 || action2.type === "SEPARATOR" || actionLoading) return;
1972
+ setActionLoading(actionKey);
1973
+ setActionsMenuOpen(false);
1974
+ try {
1975
+ const selectedItems = dataKit.items.filter((item) => selection.isSelected(item.id));
1976
+ const result = await action2.function(selectedItems);
1977
+ if (result[0]) {
1978
+ const data = result[1];
1979
+ if (data.deselectAll) selection.deselectAll();
1980
+ await dataKit.actions.refresh();
1981
+ }
1982
+ } catch (error) {
1983
+ console.error("Selection action failed:", error);
1984
+ } finally {
1985
+ setActionLoading(null);
1986
+ }
1987
+ }, [selectable?.actions, actionLoading, dataKit.items, selection, dataKit.actions]);
1988
+ const handleResetFilters = useCallback(() => {
1989
+ filters.forEach((f) => {
1990
+ dataKit.actions.setFilter(f.id, f.defaultValue ?? (f.type === "BOOLEAN" ? false : ""));
1991
+ });
1992
+ }, [filters, dataKit.actions]);
1993
+ const getSortFor = useCallback((path) => dataKit.sorts.find((s) => s.path === path)?.value ?? null, [dataKit.sorts]);
1994
+ const handleRowSelection = useCallback((rowIndex, event) => {
1995
+ if (event.shiftKey && lastSelectedIndex !== null) {
1996
+ const start = Math.min(lastSelectedIndex, rowIndex);
1997
+ const end = Math.max(lastSelectedIndex, rowIndex);
1998
+ for (let i = start; i <= end; i++) {
1999
+ const item = dataKit.items[i];
2000
+ if (item && item.id !== void 0 && !selection.isSelected(item.id)) {
2001
+ selection.select(item.id);
2002
+ }
2003
+ }
2004
+ } else {
2005
+ const item = dataKit.items[rowIndex];
2006
+ if (item && item.id !== void 0) {
2007
+ selection.toggle(item.id);
2008
+ }
2009
+ }
2010
+ setLastSelectedIndex(rowIndex);
2011
+ }, [lastSelectedIndex, dataKit.items, selection]);
2012
+ useEffect(() => {
2013
+ if (controller) {
2014
+ controller.current = {
2015
+ itemPush: dataKit.actions.itemPush,
2016
+ itemUpdate: dataKit.actions.itemUpdate,
2017
+ itemDelete: dataKit.actions.itemDelete,
2018
+ refetchData: dataKit.actions.refresh,
2019
+ deleteBulk: dataKit.actions.deleteBulk,
2020
+ getSelectedItems: () => dataKit.items.filter((item) => selection.isSelected(item.id)),
2021
+ clearSelection: () => selection.deselectAll()
2022
+ };
2023
+ }
2024
+ }, [controller, dataKit.actions, dataKit.items, selection]);
2025
+ useEffect(() => {
2026
+ if (!tableRef.current || !refetchInterval) return;
2027
+ const observer = new IntersectionObserver(
2028
+ (entries) => entries[0] && setIsVisible(entries[0].isIntersecting),
2029
+ { threshold: 0.1 }
2030
+ );
2031
+ const currentRef = tableRef.current;
2032
+ observer.observe(currentRef);
2033
+ return () => {
2034
+ if (currentRef) observer.unobserve(currentRef);
2035
+ };
2036
+ }, [refetchInterval]);
2037
+ useEffect(() => {
2038
+ if (intervalRef.current) {
2039
+ clearInterval(intervalRef.current);
2040
+ intervalRef.current = null;
2041
+ }
2042
+ if (refetchInterval && isVisible) {
2043
+ intervalRef.current = setInterval(dataKit.actions.refresh, refetchInterval);
2044
+ }
2045
+ return () => {
2046
+ if (intervalRef.current) clearInterval(intervalRef.current);
2047
+ };
2048
+ }, [refetchInterval, isVisible, dataKit.actions]);
2049
+ useEffect(() => {
2050
+ selection.deselectAll();
2051
+ }, [dataKit.items.length]);
2052
+ return /* @__PURE__ */ jsxs("div", { ref: tableRef, className: `ndk:space-y-3 ${className ?? ""}`, children: [
2053
+ /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:items-center ndk:justify-between ndk:gap-2", children: /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:items-center ndk:gap-2", children: filters.length > 0 && /* @__PURE__ */ jsxs(Popover, { open: isFilterOpen, onOpenChange: setIsFilterOpen, children: [
2054
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", children: [
2055
+ /* @__PURE__ */ jsx(Filter, { className: "ndk:mr-1.5 ndk:size-4" }),
2056
+ "Filters"
2057
+ ] }) }),
2058
+ /* @__PURE__ */ jsxs(PopoverContent, { align: "start", className: "ndk:w-80", container: overlayContainer, children: [
2059
+ /* @__PURE__ */ jsx("div", { className: "ndk:grid ndk:gap-3", children: filters.map((f) => /* @__PURE__ */ jsxs("div", { className: "ndk:grid ndk:gap-1.5", children: [
2060
+ /* @__PURE__ */ jsx("label", { className: "ndk:text-sm ndk:font-medium", children: f.label }),
2061
+ f.type === "TEXT" && /* @__PURE__ */ jsx(
2062
+ "input",
2063
+ {
2064
+ type: "text",
2065
+ className: "ndk:h-9 ndk:w-full ndk:rounded-md ndk:border ndk:bg-transparent ndk:px-3 ndk:text-sm ndk:outline-none ndk:focus:ring-2 ndk:focus:ring-ring",
2066
+ placeholder: f.placeholder,
2067
+ value: dataKit.filter[f.id] ?? "",
2068
+ onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
2069
+ }
2070
+ ),
2071
+ f.type === "SELECT" && /* @__PURE__ */ jsxs(
2072
+ Select,
2073
+ {
2074
+ value: String(dataKit.filter[f.id] || "__all__"),
2075
+ onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
2076
+ children: [
2077
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
2078
+ /* @__PURE__ */ jsxs(SelectContent, { container: overlayContainer, children: [
2079
+ /* @__PURE__ */ jsx(SelectItem, { value: "__all__", children: "All" }),
2080
+ f.dataset?.map((d) => /* @__PURE__ */ jsx(SelectItem, { value: d.id, children: d.label }, d.id))
2081
+ ] })
2082
+ ]
2083
+ }
2084
+ ),
2085
+ f.type === "BOOLEAN" && /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:items-center ndk:justify-between", children: /* @__PURE__ */ jsx(
2086
+ Checkbox,
2087
+ {
2088
+ checked: Boolean(dataKit.filter[f.id]),
2089
+ onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
2090
+ }
2091
+ ) })
2092
+ ] }, f.id)) }),
2093
+ /* @__PURE__ */ jsxs("div", { className: "ndk:mt-4 ndk:flex ndk:justify-between ndk:border-t ndk:pt-3", children: [
2094
+ /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
2095
+ /* @__PURE__ */ jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
2096
+ ] })
2097
+ ] })
2098
+ ] }) }) }),
2099
+ /* @__PURE__ */ jsx("div", { className: `ndk:overflow-hidden ndk:border ndk:border-gray-200 ndk:dark:border-gray-800 ${bordered === "rounded" ? "ndk:rounded-lg" : bordered ? "" : "ndk:rounded-lg"}`, children: /* @__PURE__ */ jsxs(Table, { children: [
2100
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
2101
+ selectable?.enabled && /* @__PURE__ */ jsx(TableHead, { className: "ndk:w-12", children: /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-2", children: [
2102
+ /* @__PURE__ */ jsx(
2103
+ Checkbox,
2104
+ {
2105
+ checked: selection.isIndeterminate ? "indeterminate" : selection.isAllSelected,
2106
+ onCheckedChange: () => selection.toggleAll()
2107
+ }
2108
+ ),
2109
+ selectable.actions && Object.keys(selectable.actions).length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { open: actionsMenuOpen, onOpenChange: setActionsMenuOpen, children: [
2110
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
2111
+ Button,
2112
+ {
2113
+ variant: "ghost",
2114
+ size: "icon",
2115
+ className: "ndk:size-6",
2116
+ disabled: selectedCount === 0 || !!actionLoading,
2117
+ children: actionLoading ? /* @__PURE__ */ jsx(Loader2, { className: "ndk:size-4 ndk:animate-spin" }) : /* @__PURE__ */ jsx(MoreHorizontal, { className: "ndk:size-4" })
2118
+ }
2119
+ ) }),
2120
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", container: overlayContainer, children: Object.entries(selectable.actions).map(
2121
+ ([key, action2]) => action2.type === "SEPARATOR" ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, key) : /* @__PURE__ */ jsx(DropdownMenuItem, { disabled: !!actionLoading, onSelect: () => handleSelectionAction(key), children: actionLoading === key ? "Working\u2026" : /* @__PURE__ */ jsxs(Fragment, { children: [
2122
+ action2.icon,
2123
+ action2.name
2124
+ ] }) }, key)
2125
+ ) })
2126
+ ] })
2127
+ ] }) }),
2128
+ columns.map((col, idx) => /* @__PURE__ */ jsx(React2__default.Fragment, { children: col.sortable ? /* @__PURE__ */ jsx(TableHead, { ...React2__default.isValidElement(col.head) ? col.head.props : {}, children: /* @__PURE__ */ jsxs(
2129
+ Button,
2130
+ {
2131
+ variant: "ghost",
2132
+ size: "sm",
2133
+ className: "ndk:-ml-4 ndk:h-auto ndk:py-0",
2134
+ onClick: () => handleSort(col.sortable.path),
2135
+ children: [
2136
+ React2__default.isValidElement(col.head) ? col.head.props.children : col.head,
2137
+ getSortFor(col.sortable.path) === 1 && /* @__PURE__ */ jsx(ArrowUp, { className: "ndk:ml-1 ndk:size-4" }),
2138
+ getSortFor(col.sortable.path) === -1 && /* @__PURE__ */ jsx(ArrowDown, { className: "ndk:ml-1 ndk:size-4" })
2139
+ ]
2140
+ }
2141
+ ) }) : col.head }, idx))
2142
+ ] }) }),
2143
+ /* @__PURE__ */ jsx(TableBody, { children: dataKit.state.isLoading ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan, className: "ndk:h-24 ndk:text-center", children: /* @__PURE__ */ jsx(Loader2, { className: "ndk:mx-auto ndk:size-5 ndk:animate-spin" }) }) }) : dataKit.state.error ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs(TableCell, { colSpan, className: "ndk:h-24 ndk:text-center ndk:text-red-500", children: [
2144
+ "Error: ",
2145
+ dataKit.state.error.message
2146
+ ] }) }) : dataKit.items.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan, className: "ndk:h-24 ndk:text-center ndk:text-muted-foreground", children: "No results found." }) }) : dataKit.items.map((item, idx) => {
2147
+ const rowId = item.id ?? idx;
2148
+ return /* @__PURE__ */ jsxs(TableRow, { children: [
2149
+ selectable?.enabled && /* @__PURE__ */ jsx(TableCell, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
2150
+ Checkbox,
2151
+ {
2152
+ checked: selection.isSelected(item.id),
2153
+ onCheckedChange: () => {
2154
+ },
2155
+ onClick: (e) => handleRowSelection(idx, e)
2156
+ }
2157
+ ) }),
2158
+ columns.map((col, colIdx) => /* @__PURE__ */ jsx(React2__default.Fragment, { children: col.body({
2159
+ item,
2160
+ index: idx,
2161
+ state: getRowState(rowId),
2162
+ setState: (updater) => setRowState(rowId, updater),
2163
+ setItem: (updatedItem) => dataKit.actions.setItemAt(idx, updatedItem),
2164
+ deleteItem: () => dataKit.actions.deleteItemAt(idx)
2165
+ }) }, colIdx))
2166
+ ] }, rowId);
2167
+ }) })
2168
+ ] }) }),
2169
+ /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-4 ndk:justify-between", children: [
2170
+ /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-3", children: [
2171
+ /* @__PURE__ */ jsxs(Select, { value: String(dataKit.limit), onValueChange: (v) => dataKit.actions.setLimit(Number(v)), disabled: dataKit.state.isLoading, children: [
2172
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "ndk:w-16", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
2173
+ /* @__PURE__ */ jsx(SelectContent, { container: overlayContainer, children: limitOptions.map((v) => /* @__PURE__ */ jsx(SelectItem, { value: String(v), children: v }, v)) })
2174
+ ] }),
2175
+ /* @__PURE__ */ jsxs("p", { className: "ndk:text-sm ndk:text-muted-foreground ndk:whitespace-nowrap", children: [
2176
+ "Page ",
2177
+ dataKit.page,
2178
+ " of ",
2179
+ pagination.totalPages
2180
+ ] }),
2181
+ selectable?.enabled && selectedCount > 0 && /* @__PURE__ */ jsxs("p", { className: "ndk:text-sm ndk:text-foreground", children: [
2182
+ selectedCount,
2183
+ " selected"
2184
+ ] })
2185
+ ] }),
2186
+ /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:justify-end", children: paginationType === "SIMPLE" ? /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-1", children: [
2187
+ /* @__PURE__ */ jsx(
2188
+ Button,
2189
+ {
2190
+ variant: "outline",
2191
+ size: "icon",
2192
+ disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2193
+ onClick: () => dataKit.actions.setPage(dataKit.page - 1),
2194
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "ndk:size-4" })
2195
+ }
2196
+ ),
2197
+ /* @__PURE__ */ jsx(
2198
+ Button,
2199
+ {
2200
+ variant: "outline",
2201
+ size: "icon",
2202
+ disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2203
+ onClick: () => dataKit.actions.setPage(dataKit.page + 1),
2204
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "ndk:size-4" })
2205
+ }
2206
+ )
2207
+ ] }) : /* @__PURE__ */ jsx(Pagination, { className: "ndk:w-auto", children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
2208
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsx(
2209
+ PaginationPrevious,
2210
+ {
2211
+ disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2212
+ onClick: () => dataKit.actions.setPage(dataKit.page - 1)
2213
+ }
2214
+ ) }),
2215
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsx(
2216
+ PaginationLink,
2217
+ {
2218
+ disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2219
+ onClick: () => dataKit.actions.setPage(dataKit.page - 1),
2220
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "ndk:size-4" })
2221
+ }
2222
+ ) }),
2223
+ pagination.pages.map((pageNum, idx) => /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: pageNum === "ellipsis" ? /* @__PURE__ */ jsx(PaginationEllipsis, {}) : /* @__PURE__ */ jsx(
2224
+ PaginationLink,
2225
+ {
2226
+ isActive: pageNum === dataKit.page,
2227
+ disabled: dataKit.state.isLoading,
2228
+ onClick: () => dataKit.actions.setPage(pageNum),
2229
+ children: pageNum
2230
+ }
2231
+ ) }, idx)),
2232
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsx("span", { className: "ndk:flex ndk:size-9 ndk:items-center ndk:justify-center ndk:text-sm", children: dataKit.page }) }),
2233
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsx(
2234
+ PaginationNext,
2235
+ {
2236
+ disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2237
+ onClick: () => dataKit.actions.setPage(dataKit.page + 1)
2238
+ }
2239
+ ) }),
2240
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsx(
2241
+ PaginationLink,
2242
+ {
2243
+ disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2244
+ onClick: () => dataKit.actions.setPage(dataKit.page + 1),
2245
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "ndk:size-4" })
2246
+ }
2247
+ ) })
2248
+ ] }) }) })
2249
+ ] })
2250
+ ] });
2251
+ };
2252
+ var DataKitTable = Object.assign(DataKitRoot, {
2253
+ Cell: TableCell,
2254
+ Head: TableHead
2255
+ });
2256
+ var DataKitInner = (props, ref) => {
2257
+ const {
2258
+ action,
2259
+ query,
2260
+ filters = [],
2261
+ limit: limitConfig,
2262
+ defaultSort = [],
2263
+ className,
2264
+ autoFetch = true,
2265
+ debounce: debounce2 = 300,
2266
+ refetchInterval,
2267
+ memory: memoryMode = "memory",
2268
+ manual = false,
2269
+ pagination: paginationType = "NUMBER",
2270
+ children
2271
+ } = props;
2272
+ const containerRef = useRef(null);
2273
+ const intervalRef = useRef(null);
2274
+ const [isVisible, setIsVisible] = useState(false);
2275
+ const [isFilterOpen, setIsFilterOpen] = useState(false);
2276
+ const overlayContainer = containerRef.current;
2277
+ const dataKit = useDataKit({
2278
+ action,
2279
+ filters,
2280
+ autoFetch,
2281
+ debounce: debounce2,
2282
+ memory: memoryMode,
2283
+ initial: {
2284
+ limit: limitConfig?.default ?? 10,
2285
+ query: query ?? {},
2286
+ sorts: defaultSort,
2287
+ filter: filters.reduce((acc, f) => {
2288
+ if (f.defaultValue !== void 0) acc[f.id] = f.defaultValue;
2289
+ return acc;
2290
+ }, {})
2291
+ }
2292
+ });
2293
+ const pagination = usePagination({ page: dataKit.page, limit: dataKit.limit, total: dataKit.total, siblingCount: 1 });
2294
+ const limitOptions = React2__default.useMemo(() => {
2295
+ const standardOptions = [10, 25, 50, 100];
2296
+ const currentLimit = dataKit.limit;
2297
+ if (!standardOptions.includes(currentLimit)) {
2298
+ return [...standardOptions, currentLimit].sort((a, b) => a - b);
2299
+ }
2300
+ return standardOptions;
2301
+ }, [dataKit.limit]);
2302
+ React2__default.useImperativeHandle(ref, () => dataKit, [dataKit]);
2303
+ const handleResetFilters = useCallback(() => {
2304
+ filters.forEach((f) => {
2305
+ dataKit.actions.setFilter(f.id, f.defaultValue ?? (f.type === "BOOLEAN" ? false : ""));
2306
+ });
2307
+ }, [filters, dataKit.actions]);
2308
+ useEffect(() => {
2309
+ if (!containerRef.current || !refetchInterval) return;
2310
+ const observer = new IntersectionObserver(
2311
+ (entries) => entries[0] && setIsVisible(entries[0].isIntersecting),
2312
+ { threshold: 0.1 }
2313
+ );
2314
+ const currentRef = containerRef.current;
2315
+ observer.observe(currentRef);
2316
+ return () => {
2317
+ if (currentRef) observer.unobserve(currentRef);
2318
+ };
2319
+ }, [refetchInterval]);
2320
+ useEffect(() => {
2321
+ if (intervalRef.current) {
2322
+ clearInterval(intervalRef.current);
2323
+ intervalRef.current = null;
2324
+ }
2325
+ if (refetchInterval && isVisible) {
2326
+ intervalRef.current = setInterval(dataKit.actions.refresh, refetchInterval);
2327
+ }
2328
+ return () => {
2329
+ if (intervalRef.current) clearInterval(intervalRef.current);
2330
+ };
2331
+ }, [refetchInterval, isVisible, dataKit.actions]);
2332
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `ndk:space-y-3 ${className ?? ""}`, children: [
2333
+ /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:justify-between ndk:gap-2", children: [
2334
+ /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:items-center ndk:gap-2", children: filters.length > 0 && /* @__PURE__ */ jsxs(Popover, { open: isFilterOpen, onOpenChange: setIsFilterOpen, children: [
2335
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", children: [
2336
+ /* @__PURE__ */ jsx(Filter, { className: "ndk:mr-1.5 ndk:size-4" }),
2337
+ "Filters"
2338
+ ] }) }),
2339
+ /* @__PURE__ */ jsxs(PopoverContent, { align: "start", className: "ndk:w-80", container: overlayContainer, children: [
2340
+ /* @__PURE__ */ jsx("div", { className: "ndk:grid ndk:gap-3", children: filters.map((f) => /* @__PURE__ */ jsxs("div", { className: "ndk:grid ndk:gap-1.5", children: [
2341
+ /* @__PURE__ */ jsx("label", { className: "ndk:text-sm ndk:font-medium", children: f.label }),
2342
+ f.type === "TEXT" && /* @__PURE__ */ jsx(
2343
+ "input",
2344
+ {
2345
+ type: "text",
2346
+ className: "ndk:h-9 ndk:w-full ndk:rounded-md ndk:border ndk:bg-transparent ndk:px-3 ndk:text-sm ndk:outline-none ndk:focus:ring-2 ndk:focus:ring-ring",
2347
+ placeholder: f.placeholder,
2348
+ value: dataKit.filter[f.id] ?? "",
2349
+ onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
2350
+ }
2351
+ ),
2352
+ f.type === "SELECT" && /* @__PURE__ */ jsxs(
2353
+ Select,
2354
+ {
2355
+ value: String(dataKit.filter[f.id] || "__all__"),
2356
+ onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
2357
+ children: [
2358
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
2359
+ /* @__PURE__ */ jsxs(SelectContent, { container: overlayContainer, children: [
2360
+ /* @__PURE__ */ jsx(SelectItem, { value: "__all__", children: "All" }),
2361
+ f.dataset?.map((d) => /* @__PURE__ */ jsx(SelectItem, { value: d.id, children: d.label }, d.id))
2362
+ ] })
2363
+ ]
2364
+ }
2365
+ ),
2366
+ f.type === "BOOLEAN" && /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:items-center ndk:justify-between", children: /* @__PURE__ */ jsx(
2367
+ Checkbox,
2368
+ {
2369
+ checked: Boolean(dataKit.filter[f.id]),
2370
+ onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
2371
+ }
2372
+ ) })
2373
+ ] }, f.id)) }),
2374
+ /* @__PURE__ */ jsxs("div", { className: "ndk:mt-4 ndk:flex ndk:justify-between ndk:border-t ndk:pt-3", children: [
2375
+ /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
2376
+ /* @__PURE__ */ jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
2377
+ ] })
2378
+ ] })
2379
+ ] }) }),
2380
+ /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-1", children: [
2381
+ /* @__PURE__ */ jsxs("span", { className: "ndk:mr-2 ndk:text-sm ndk:text-muted-foreground", children: [
2382
+ dataKit.items.length,
2383
+ " of ",
2384
+ dataKit.total
2385
+ ] }),
2386
+ /* @__PURE__ */ jsxs(Select, { value: String(dataKit.limit), onValueChange: (v) => dataKit.actions.setLimit(Number(v)), disabled: dataKit.state.isLoading, children: [
2387
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "ndk:w-16", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
2388
+ /* @__PURE__ */ jsx(SelectContent, { container: overlayContainer, children: limitOptions.map((v) => /* @__PURE__ */ jsx(SelectItem, { value: String(v), children: v }, v)) })
2389
+ ] })
2390
+ ] })
2391
+ ] }),
2392
+ manual ? children(dataKit) : /* @__PURE__ */ jsx("div", { className: "ndk:min-h-[200px]", children: dataKit.state.isLoading ? /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:h-48 ndk:items-center ndk:justify-center", children: /* @__PURE__ */ jsx(Loader2, { className: "ndk:size-6 ndk:animate-spin ndk:text-muted-foreground" }) }) : dataKit.items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:h-48 ndk:items-center ndk:justify-center ndk:text-muted-foreground", children: "No results found." }) : children(dataKit) }),
2393
+ /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:justify-between", children: [
2394
+ /* @__PURE__ */ jsxs("p", { className: "ndk:text-sm ndk:text-muted-foreground", children: [
2395
+ "Page ",
2396
+ dataKit.page,
2397
+ " of ",
2398
+ pagination.totalPages
2399
+ ] }),
2400
+ paginationType === "SIMPLE" ? /* @__PURE__ */ jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-1", children: [
2401
+ /* @__PURE__ */ jsx(
2402
+ Button,
2403
+ {
2404
+ variant: "outline",
2405
+ size: "icon",
2406
+ disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2407
+ onClick: () => dataKit.actions.setPage(dataKit.page - 1),
2408
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "ndk:size-4" })
2409
+ }
2410
+ ),
2411
+ /* @__PURE__ */ jsx(
2412
+ Button,
2413
+ {
2414
+ variant: "outline",
2415
+ size: "icon",
2416
+ disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2417
+ onClick: () => dataKit.actions.setPage(dataKit.page + 1),
2418
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "ndk:size-4" })
2419
+ }
2420
+ )
2421
+ ] }) : /* @__PURE__ */ jsx(Pagination, { className: "ndk:mx-0 ndk:w-auto", children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
2422
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsx(
2423
+ PaginationPrevious,
2424
+ {
2425
+ disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2426
+ onClick: () => dataKit.actions.setPage(dataKit.page - 1)
2427
+ }
2428
+ ) }),
2429
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsx(
2430
+ PaginationLink,
2431
+ {
2432
+ disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2433
+ onClick: () => dataKit.actions.setPage(dataKit.page - 1),
2434
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "ndk:size-4" })
2435
+ }
2436
+ ) }),
2437
+ pagination.pages.map((pageNum, idx) => /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: pageNum === "ellipsis" ? /* @__PURE__ */ jsx(PaginationEllipsis, {}) : /* @__PURE__ */ jsx(
2438
+ PaginationLink,
2439
+ {
2440
+ isActive: pageNum === dataKit.page,
2441
+ disabled: dataKit.state.isLoading,
2442
+ onClick: () => dataKit.actions.setPage(pageNum),
2443
+ children: pageNum
2444
+ }
2445
+ ) }, idx)),
2446
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsx("span", { className: "ndk:flex ndk:size-9 ndk:items-center ndk:justify-center ndk:text-sm", children: dataKit.page }) }),
2447
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsx(
2448
+ PaginationNext,
2449
+ {
2450
+ disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2451
+ onClick: () => dataKit.actions.setPage(dataKit.page + 1)
2452
+ }
2453
+ ) }),
2454
+ /* @__PURE__ */ jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsx(
2455
+ PaginationLink,
2456
+ {
2457
+ disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2458
+ onClick: () => dataKit.actions.setPage(dataKit.page + 1),
2459
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "ndk:size-4" })
2460
+ }
2461
+ ) })
2462
+ ] }) })
2463
+ ] })
2464
+ ] });
2465
+ };
2466
+ var DataKit = React2__default.forwardRef(DataKitInner);
2467
+ var DataKitInfinityInner = (props) => {
2468
+ const {
2469
+ action,
2470
+ query,
2471
+ filters = [],
2472
+ limit: limitConfig,
2473
+ defaultSort = [],
2474
+ className,
2475
+ autoFetch = true,
2476
+ debounce: debounce2 = 300,
2477
+ memory: memoryMode = "memory",
2478
+ manual = false,
2479
+ fullHeight = true,
2480
+ children
2481
+ } = props;
2482
+ const containerRef = useRef(null);
2483
+ const scrollContainerRef = useRef(null);
2484
+ const [allItems, setAllItems] = useState([]);
2485
+ const [isFilterOpen, setIsFilterOpen] = useState(false);
2486
+ const overlayContainer = containerRef.current;
2487
+ const dataKit = useDataKit({
2488
+ action,
2489
+ filters,
2490
+ autoFetch: false,
2491
+ // We'll control fetching manually
2492
+ debounce: debounce2,
2493
+ memory: memoryMode,
2494
+ initial: {
2495
+ limit: limitConfig?.default ?? 10,
2496
+ query: query ?? {},
2497
+ sorts: defaultSort,
2498
+ filter: filters.reduce((acc, f) => {
2499
+ if (f.defaultValue !== void 0) acc[f.id] = f.defaultValue;
2500
+ return acc;
2501
+ }, {})
2502
+ }
2503
+ });
2504
+ const { ref: loadMoreBottomRef, inView: inViewBottom } = useInView({
2505
+ threshold: 0,
2506
+ rootMargin: "100px"
2507
+ });
2508
+ const handleResetFilters = useCallback(() => {
2509
+ filters.forEach((f) => {
2510
+ dataKit.actions.setFilter(f.id, f.defaultValue ?? (f.type === "BOOLEAN" ? false : ""));
2511
+ });
2512
+ }, [filters, dataKit.actions]);
2513
+ const loadMore = useCallback(() => {
2514
+ if (dataKit.state.isLoading || !dataKit.state.hasNextPage) return;
2515
+ dataKit.actions.setPage(dataKit.page + 1);
2516
+ }, [dataKit.state.isLoading, dataKit.state.hasNextPage, dataKit.page, dataKit.actions]);
2517
+ useEffect(() => {
2518
+ if (autoFetch) dataKit.actions.refresh();
2519
+ }, [autoFetch]);
2520
+ useEffect(() => {
2521
+ if (dataKit.items.length > 0) {
2522
+ setAllItems((prev) => {
2523
+ if (dataKit.page === 1) return dataKit.items;
2524
+ return [...prev, ...dataKit.items];
2525
+ });
2526
+ } else if (dataKit.page === 1) {
2527
+ setAllItems([]);
2528
+ }
2529
+ }, [dataKit.items, dataKit.page]);
2530
+ useEffect(() => {
2531
+ if (inViewBottom && !dataKit.state.isLoading && dataKit.state.hasNextPage) {
2532
+ loadMore();
2533
+ }
2534
+ }, [inViewBottom, dataKit.state.isLoading, dataKit.state.hasNextPage]);
2535
+ const enhancedDataKit = {
2536
+ ...dataKit,
2537
+ items: allItems
2538
+ };
2539
+ return /* @__PURE__ */ jsxs(
2540
+ "div",
2541
+ {
2542
+ ref: containerRef,
2543
+ className: `ndk:flex ndk:flex-col ${fullHeight ? "ndk:h-full" : ""}`,
2544
+ children: [
2545
+ filters.length > 0 && /* @__PURE__ */ jsx("div", { className: "ndk:shrink-0 ndk:px-4 ndk:pt-4 ndk:pb-3", children: /* @__PURE__ */ jsxs(Popover, { open: isFilterOpen, onOpenChange: setIsFilterOpen, children: [
2546
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", children: [
2547
+ /* @__PURE__ */ jsx(Filter, { className: "ndk:mr-1.5 ndk:size-4" }),
2548
+ "Filters"
2549
+ ] }) }),
2550
+ /* @__PURE__ */ jsxs(PopoverContent, { align: "start", className: "ndk:w-80", container: overlayContainer, children: [
2551
+ /* @__PURE__ */ jsx("div", { className: "ndk:grid ndk:gap-3", children: filters.map((f) => /* @__PURE__ */ jsxs("div", { className: "ndk:grid ndk:gap-1.5", children: [
2552
+ /* @__PURE__ */ jsx("label", { className: "ndk:text-sm ndk:font-medium", children: f.label }),
2553
+ f.type === "TEXT" && /* @__PURE__ */ jsx(
2554
+ "input",
2555
+ {
2556
+ type: "text",
2557
+ className: "ndk:h-9 ndk:w-full ndk:rounded-md ndk:border ndk:bg-transparent ndk:px-3 ndk:text-sm ndk:outline-none ndk:focus:ring-2 ndk:focus:ring-ring",
2558
+ placeholder: f.placeholder,
2559
+ value: dataKit.filter[f.id] ?? "",
2560
+ onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
2561
+ }
2562
+ ),
2563
+ f.type === "SELECT" && /* @__PURE__ */ jsxs(
2564
+ Select,
2565
+ {
2566
+ value: String(dataKit.filter[f.id] || "__all__"),
2567
+ onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
2568
+ children: [
2569
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
2570
+ /* @__PURE__ */ jsxs(SelectContent, { container: overlayContainer, children: [
2571
+ /* @__PURE__ */ jsx(SelectItem, { value: "__all__", children: "All" }),
2572
+ f.dataset?.map((d) => /* @__PURE__ */ jsx(SelectItem, { value: d.id, children: d.label }, d.id))
2573
+ ] })
2574
+ ]
2575
+ }
2576
+ ),
2577
+ f.type === "BOOLEAN" && /* @__PURE__ */ jsx("div", { className: "ndk:flex ndk:items-center ndk:justify-between", children: /* @__PURE__ */ jsx(
2578
+ Checkbox,
2579
+ {
2580
+ checked: Boolean(dataKit.filter[f.id]),
2581
+ onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
2582
+ }
2583
+ ) })
2584
+ ] }, f.id)) }),
2585
+ /* @__PURE__ */ jsxs("div", { className: "ndk:mt-4 ndk:flex ndk:justify-between ndk:border-t ndk:pt-3", children: [
2586
+ /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
2587
+ /* @__PURE__ */ jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
2588
+ ] })
2589
+ ] })
2590
+ ] }) }),
2591
+ /* @__PURE__ */ jsxs(
2592
+ "div",
2593
+ {
2594
+ ref: scrollContainerRef,
2595
+ className: `ndk:relative ndk:flex-1 ${fullHeight ? "ndk:min-h-0" : ""} ndk:overflow-y-auto ndk:overflow-x-hidden ${className ?? ""}`,
2596
+ children: [
2597
+ children(enhancedDataKit),
2598
+ /* @__PURE__ */ jsx("div", { ref: loadMoreBottomRef, className: manual ? "" : "ndk:flex ndk:items-center ndk:justify-center ndk:py-4", children: !manual && /* @__PURE__ */ jsxs(Fragment, { children: [
2599
+ dataKit.state.isLoading && /* @__PURE__ */ jsx(Loader2, { className: "ndk:size-6 ndk:animate-spin ndk:text-muted-foreground" }),
2600
+ !dataKit.state.isLoading && !dataKit.state.hasNextPage && allItems.length > 0 && /* @__PURE__ */ jsx("p", { className: "ndk:text-sm ndk:text-muted-foreground", children: "You're all set" })
2601
+ ] }) })
2602
+ ]
2603
+ }
2604
+ )
2605
+ ]
2606
+ }
2607
+ );
2608
+ };
2609
+ var DataKitInfinity = DataKitInfinityInner;
2610
+
2611
+ export { DataKit, DataKitInfinity, DataKitTable, DefaultDataKitContext, DefaultDataKitProvider, calculatePagination, compareValues, createDataKitContext, createSearchFilter, escapeRegex, getValueByPath, isProvided, isSafeKey, matchesExact, matchesRegexLike, normalizeSorts, useDefaultDataKitContext, usePagination, useSelection, useSelectionWithTotal };
2612
+ //# sourceMappingURL=chunk-PSMWD5AA.js.map
2613
+ //# sourceMappingURL=chunk-PSMWD5AA.js.map