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