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