next-data-kit 9.4.0 → 9.5.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 (40) hide show
  1. package/dist/chunk-5WNOUBGK.js +358 -0
  2. package/dist/chunk-5WNOUBGK.js.map +1 -0
  3. package/dist/chunk-CGB4WIAS.cjs +2657 -0
  4. package/dist/chunk-CGB4WIAS.cjs.map +1 -0
  5. package/dist/chunk-FDSJZI3C.cjs +369 -0
  6. package/dist/chunk-FDSJZI3C.cjs.map +1 -0
  7. package/dist/chunk-WYWJGLGD.js +2613 -0
  8. package/dist/chunk-WYWJGLGD.js.map +1 -0
  9. package/dist/client/components/data-kit-infinity.d.ts +1 -0
  10. package/dist/client/components/data-kit-infinity.d.ts.map +1 -1
  11. package/dist/client/components/data-kit-table.d.ts +1 -0
  12. package/dist/client/components/data-kit-table.d.ts.map +1 -1
  13. package/dist/client/components/data-kit.d.ts +1 -0
  14. package/dist/client/components/data-kit.d.ts.map +1 -1
  15. package/dist/client.cjs +75 -2941
  16. package/dist/client.cjs.map +1 -1
  17. package/dist/client.d.cts +4 -2
  18. package/dist/client.d.ts +0 -1
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +2 -2906
  21. package/dist/client.js.map +1 -1
  22. package/dist/index-DUVfK8q6.d.ts +284 -0
  23. package/dist/index-qXbjvUTB.d.cts +284 -0
  24. package/dist/index.cjs +97 -2898
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +3 -2
  27. package/dist/index.d.ts +3 -2
  28. package/dist/index.js +4 -2841
  29. package/dist/index.js.map +1 -1
  30. package/dist/internal/hooks.cjs +12 -0
  31. package/dist/internal/hooks.cjs.map +1 -0
  32. package/dist/internal/hooks.d.cts +1 -0
  33. package/dist/internal/hooks.d.ts +1 -0
  34. package/dist/internal/hooks.js +3 -0
  35. package/dist/internal/hooks.js.map +1 -0
  36. package/dist/useDataKit-XFp3_mUc.d.cts +276 -0
  37. package/dist/useDataKit-XFp3_mUc.d.ts +276 -0
  38. package/package.json +4 -1
  39. package/dist/index-CzDzNX62.d.cts +0 -558
  40. package/dist/index-CzDzNX62.d.ts +0 -558
package/dist/index.cjs CHANGED
@@ -1,1314 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var zod = require('zod');
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
- 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
- // #style-inject:#style-inject
40
- function styleInject(css, { insertAt } = {}) {
41
- if (typeof document === "undefined") return;
42
- const head = document.head || document.getElementsByTagName("head")[0];
43
- const style = document.createElement("style");
44
- style.type = "text/css";
45
- if (insertAt === "top") {
46
- if (head.firstChild) {
47
- head.insertBefore(style, head.firstChild);
48
- } else {
49
- head.appendChild(style);
50
- }
51
- } else {
52
- head.appendChild(style);
53
- }
54
- if (style.styleSheet) {
55
- style.styleSheet.cssText = css;
56
- } else {
57
- style.appendChild(document.createTextNode(css));
58
- }
59
- }
60
-
61
- // dist/styles.css
62
- styleInject(`/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
63
- @layer properties {
64
- @supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))) {
65
- *,
66
- :before,
67
- :after,
68
- ::backdrop {
69
- --tw-space-y-reverse:0;
70
- --tw-border-style:solid;
71
- --tw-font-weight:initial;
72
- --tw-tracking:initial;
73
- --tw-shadow:0 0 #0000;
74
- --tw-shadow-color:initial;
75
- --tw-shadow-alpha:100%;
76
- --tw-inset-shadow:0 0 #0000;
77
- --tw-inset-shadow-color:initial;
78
- --tw-inset-shadow-alpha:100%;
79
- --tw-ring-color:initial;
80
- --tw-ring-shadow:0 0 #0000;
81
- --tw-inset-ring-color:initial;
82
- --tw-inset-ring-shadow:0 0 #0000;
83
- --tw-ring-inset:initial;
84
- --tw-ring-offset-width:0px;
85
- --tw-ring-offset-color:#fff;
86
- --tw-ring-offset-shadow:0 0 #0000;
87
- --tw-translate-x:0;
88
- --tw-translate-y:0;
89
- --tw-translate-z:0;
90
- }
91
- }
92
- }
93
- @layer theme {
94
- :root,
95
- :host {
96
- --ndk-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
97
- --ndk-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
98
- --ndk-color-red-400:oklch(70.4% .191 22.216);
99
- --ndk-color-red-500:oklch(63.7% .237 25.331);
100
- --ndk-color-red-600:oklch(57.7% .245 27.325);
101
- --ndk-color-red-700:oklch(50.5% .213 27.518);
102
- --ndk-color-gray-50:oklch(98.5% .002 247.839);
103
- --ndk-color-gray-100:oklch(96.7% .003 264.542);
104
- --ndk-color-gray-200:oklch(92.8% .006 264.531);
105
- --ndk-color-gray-400:oklch(70.7% .022 261.325);
106
- --ndk-color-gray-500:oklch(55.1% .027 264.364);
107
- --ndk-color-gray-800:oklch(27.8% .033 256.848);
108
- --ndk-color-gray-900:oklch(21% .034 264.665);
109
- --ndk-color-gray-950:oklch(13% .028 261.692);
110
- --ndk-color-black:#000;
111
- --ndk-color-white:#fff;
112
- --ndk-spacing:.25rem;
113
- --ndk-text-xs:.75rem;
114
- --ndk-text-xs--line-height:calc(1/.75);
115
- --ndk-text-sm:.875rem;
116
- --ndk-text-sm--line-height:calc(1.25/.875);
117
- --ndk-font-weight-medium:500;
118
- --ndk-tracking-widest:.1em;
119
- --ndk-radius-sm:.25rem;
120
- --ndk-radius-md:.375rem;
121
- --ndk-radius-lg:.5rem;
122
- --ndk-animate-spin:spin 1s linear infinite;
123
- --ndk-default-transition-duration:.15s;
124
- --ndk-default-transition-timing-function:cubic-bezier(.4,0,.2,1);
125
- --ndk-default-font-family:var(--ndk-font-sans);
126
- --ndk-default-mono-font-family:var(--ndk-font-mono);
127
- --ndk-animate-in:animate-in;
128
- --ndk-animate-out:animate-out;
129
- }
130
- }
131
- @layer base {
132
- *,
133
- :after,
134
- :before,
135
- ::backdrop {
136
- box-sizing: border-box;
137
- border: 0 solid;
138
- margin: 0;
139
- padding: 0;
140
- }
141
- ::file-selector-button {
142
- box-sizing: border-box;
143
- border: 0 solid;
144
- margin: 0;
145
- padding: 0;
146
- }
147
- html,
148
- :host {
149
- -webkit-text-size-adjust: 100%;
150
- tab-size: 4;
151
- line-height: 1.5;
152
- font-family: var(--ndk-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");
153
- font-feature-settings: var(--ndk-default-font-feature-settings,normal);
154
- font-variation-settings: var(--ndk-default-font-variation-settings,normal);
155
- -webkit-tap-highlight-color: transparent;
156
- }
157
- hr {
158
- height: 0;
159
- color: inherit;
160
- border-top-width: 1px;
161
- }
162
- abbr:where([title]) {
163
- -webkit-text-decoration: underline dotted;
164
- text-decoration: underline dotted;
165
- }
166
- h1,
167
- h2,
168
- h3,
169
- h4,
170
- h5,
171
- h6 {
172
- font-size: inherit;
173
- font-weight: inherit;
174
- }
175
- a {
176
- color: inherit;
177
- -webkit-text-decoration: inherit;
178
- -webkit-text-decoration: inherit;
179
- -webkit-text-decoration: inherit;
180
- text-decoration: inherit;
181
- }
182
- b,
183
- strong {
184
- font-weight: bolder;
185
- }
186
- code,
187
- kbd,
188
- samp,
189
- pre {
190
- font-family: var(--ndk-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);
191
- font-feature-settings: var(--ndk-default-mono-font-feature-settings,normal);
192
- font-variation-settings: var(--ndk-default-mono-font-variation-settings,normal);
193
- font-size: 1em;
194
- }
195
- small {
196
- font-size: 80%;
197
- }
198
- sub,
199
- sup {
200
- vertical-align: baseline;
201
- font-size: 75%;
202
- line-height: 0;
203
- position: relative;
204
- }
205
- sub {
206
- bottom: -.25em;
207
- }
208
- sup {
209
- top: -.5em;
210
- }
211
- table {
212
- text-indent: 0;
213
- border-color: inherit;
214
- border-collapse: collapse;
215
- }
216
- :-moz-focusring {
217
- outline: auto;
218
- }
219
- progress {
220
- vertical-align: baseline;
221
- }
222
- summary {
223
- display: list-item;
224
- }
225
- ol,
226
- ul,
227
- menu {
228
- list-style: none;
229
- }
230
- img,
231
- svg,
232
- video,
233
- canvas,
234
- audio,
235
- iframe,
236
- embed,
237
- object {
238
- vertical-align: middle;
239
- display: block;
240
- }
241
- img,
242
- video {
243
- max-width: 100%;
244
- height: auto;
245
- }
246
- button,
247
- input,
248
- select,
249
- optgroup,
250
- textarea {
251
- font: inherit;
252
- font-feature-settings: inherit;
253
- font-variation-settings: inherit;
254
- letter-spacing: inherit;
255
- color: inherit;
256
- opacity: 1;
257
- background-color: #0000;
258
- border-radius: 0;
259
- }
260
- ::file-selector-button {
261
- font: inherit;
262
- font-feature-settings: inherit;
263
- font-variation-settings: inherit;
264
- letter-spacing: inherit;
265
- color: inherit;
266
- opacity: 1;
267
- background-color: #0000;
268
- border-radius: 0;
269
- }
270
- :where(select:is([multiple], [size])) optgroup {
271
- font-weight: bolder;
272
- }
273
- :where(select:is([multiple], [size])) optgroup option {
274
- padding-inline-start: 20px;
275
- }
276
- ::file-selector-button {
277
- margin-inline-end: 4px;
278
- }
279
- ::placeholder {
280
- opacity: 1;
281
- }
282
- @supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px) {
283
- ::placeholder {
284
- color: currentColor;
285
- }
286
- @supports (color:color-mix(in lab, red, red)) {
287
- ::placeholder {
288
- color: color-mix(in oklab, currentcolor 50%, transparent);
289
- }
290
- }
291
- }
292
- textarea {
293
- resize: vertical;
294
- }
295
- ::-webkit-search-decoration {
296
- -webkit-appearance: none;
297
- }
298
- ::-webkit-date-and-time-value {
299
- min-height: 1lh;
300
- text-align: inherit;
301
- }
302
- ::-webkit-datetime-edit {
303
- display: inline-flex;
304
- }
305
- ::-webkit-datetime-edit-fields-wrapper {
306
- padding: 0;
307
- }
308
- ::-webkit-datetime-edit {
309
- padding-block: 0;
310
- }
311
- ::-webkit-datetime-edit-year-field {
312
- padding-block: 0;
313
- }
314
- ::-webkit-datetime-edit-month-field {
315
- padding-block: 0;
316
- }
317
- ::-webkit-datetime-edit-day-field {
318
- padding-block: 0;
319
- }
320
- ::-webkit-datetime-edit-hour-field {
321
- padding-block: 0;
322
- }
323
- ::-webkit-datetime-edit-minute-field {
324
- padding-block: 0;
325
- }
326
- ::-webkit-datetime-edit-second-field {
327
- padding-block: 0;
328
- }
329
- ::-webkit-datetime-edit-millisecond-field {
330
- padding-block: 0;
331
- }
332
- ::-webkit-datetime-edit-meridiem-field {
333
- padding-block: 0;
334
- }
335
- ::-webkit-calendar-picker-indicator {
336
- line-height: 1;
337
- }
338
- :-moz-ui-invalid {
339
- box-shadow: none;
340
- }
341
- button,
342
- input:where([type=button], [type=reset], [type=submit]) {
343
- appearance: button;
344
- }
345
- ::file-selector-button {
346
- appearance: button;
347
- }
348
- ::-webkit-inner-spin-button {
349
- height: auto;
350
- }
351
- ::-webkit-outer-spin-button {
352
- height: auto;
353
- }
354
- [hidden]:where(:not([hidden=until-found])) {
355
- display: none !important;
356
- }
357
- }
358
- @layer components;
359
- @layer utilities {
360
- .ndk\\:pointer-events-none {
361
- pointer-events: none;
362
- }
363
- .ndk\\:sr-only {
364
- clip-path: inset(50%);
365
- white-space: nowrap;
366
- border-width: 0;
367
- width: 1px;
368
- height: 1px;
369
- margin: -1px;
370
- padding: 0;
371
- position: absolute;
372
- overflow: hidden;
373
- }
374
- .ndk\\:absolute {
375
- position: absolute;
376
- }
377
- .ndk\\:relative {
378
- position: relative;
379
- }
380
- .ndk\\:right-2 {
381
- right: calc(var(--ndk-spacing)*2);
382
- }
383
- .ndk\\:left-2 {
384
- left: calc(var(--ndk-spacing)*2);
385
- }
386
- .ndk\\:z-50 {
387
- z-index: 50;
388
- }
389
- .ndk\\:-mx-1 {
390
- margin-inline: calc(var(--ndk-spacing)*-1);
391
- }
392
- .ndk\\:mx-0 {
393
- margin-inline: calc(var(--ndk-spacing)*0);
394
- }
395
- .ndk\\:mx-auto {
396
- margin-inline: auto;
397
- }
398
- .ndk\\:my-1 {
399
- margin-block: calc(var(--ndk-spacing)*1);
400
- }
401
- .ndk\\:mt-4 {
402
- margin-top: calc(var(--ndk-spacing)*4);
403
- }
404
- .ndk\\:mr-1\\.5 {
405
- margin-right: calc(var(--ndk-spacing)*1.5);
406
- }
407
- .ndk\\:mr-2 {
408
- margin-right: calc(var(--ndk-spacing)*2);
409
- }
410
- .ndk\\:-ml-4 {
411
- margin-left: calc(var(--ndk-spacing)*-4);
412
- }
413
- .ndk\\:ml-1 {
414
- margin-left: calc(var(--ndk-spacing)*1);
415
- }
416
- .ndk\\:ml-auto {
417
- margin-left: auto;
418
- }
419
- .ndk\\:flex {
420
- display: flex;
421
- }
422
- .ndk\\:grid {
423
- display: grid;
424
- }
425
- .ndk\\:hidden {
426
- display: none;
427
- }
428
- .ndk\\:inline-flex {
429
- display: inline-flex;
430
- }
431
- .ndk\\:size-2 {
432
- width: calc(var(--ndk-spacing)*2);
433
- height: calc(var(--ndk-spacing)*2);
434
- }
435
- .ndk\\:size-3\\.5 {
436
- width: calc(var(--ndk-spacing)*3.5);
437
- height: calc(var(--ndk-spacing)*3.5);
438
- }
439
- .ndk\\:size-4 {
440
- width: calc(var(--ndk-spacing)*4);
441
- height: calc(var(--ndk-spacing)*4);
442
- }
443
- .ndk\\:size-5 {
444
- width: calc(var(--ndk-spacing)*5);
445
- height: calc(var(--ndk-spacing)*5);
446
- }
447
- .ndk\\:size-6 {
448
- width: calc(var(--ndk-spacing)*6);
449
- height: calc(var(--ndk-spacing)*6);
450
- }
451
- .ndk\\:size-8 {
452
- width: calc(var(--ndk-spacing)*8);
453
- height: calc(var(--ndk-spacing)*8);
454
- }
455
- .ndk\\:size-9 {
456
- width: calc(var(--ndk-spacing)*9);
457
- height: calc(var(--ndk-spacing)*9);
458
- }
459
- .ndk\\:size-10 {
460
- width: calc(var(--ndk-spacing)*10);
461
- height: calc(var(--ndk-spacing)*10);
462
- }
463
- .ndk\\:h-8 {
464
- height: calc(var(--ndk-spacing)*8);
465
- }
466
- .ndk\\:h-9 {
467
- height: calc(var(--ndk-spacing)*9);
468
- }
469
- .ndk\\:h-10 {
470
- height: calc(var(--ndk-spacing)*10);
471
- }
472
- .ndk\\:h-24 {
473
- height: calc(var(--ndk-spacing)*24);
474
- }
475
- .ndk\\:h-48 {
476
- height: calc(var(--ndk-spacing)*48);
477
- }
478
- .ndk\\:h-\\[var\\(--radix-select-trigger-height\\)\\] {
479
- height: var(--radix-select-trigger-height);
480
- }
481
- .ndk\\:h-auto {
482
- height: auto;
483
- }
484
- .ndk\\:h-full {
485
- height: 100%;
486
- }
487
- .ndk\\:h-px {
488
- height: 1px;
489
- }
490
- .ndk\\:max-h-\\(--radix-dropdown-menu-content-available-height\\) {
491
- max-height: var(--radix-dropdown-menu-content-available-height);
492
- }
493
- .ndk\\:max-h-\\(--radix-select-content-available-height\\) {
494
- max-height: var(--radix-select-content-available-height);
495
- }
496
- .ndk\\:min-h-0 {
497
- min-height: calc(var(--ndk-spacing)*0);
498
- }
499
- .ndk\\:min-h-\\[200px\\] {
500
- min-height: 200px;
501
- }
502
- .ndk\\:w-12 {
503
- width: calc(var(--ndk-spacing)*12);
504
- }
505
- .ndk\\:w-16 {
506
- width: calc(var(--ndk-spacing)*16);
507
- }
508
- .ndk\\:w-72 {
509
- width: calc(var(--ndk-spacing)*72);
510
- }
511
- .ndk\\:w-80 {
512
- width: calc(var(--ndk-spacing)*80);
513
- }
514
- .ndk\\:w-auto {
515
- width: auto;
516
- }
517
- .ndk\\:w-fit {
518
- width: fit-content;
519
- }
520
- .ndk\\:w-full {
521
- width: 100%;
522
- }
523
- .ndk\\:min-w-\\[8rem\\] {
524
- min-width: 8rem;
525
- }
526
- .ndk\\:min-w-\\[var\\(--radix-select-trigger-width\\)\\] {
527
- min-width: var(--radix-select-trigger-width);
528
- }
529
- .ndk\\:flex-1 {
530
- flex: 1;
531
- }
532
- .ndk\\:shrink-0 {
533
- flex-shrink: 0;
534
- }
535
- .ndk\\:caption-bottom {
536
- caption-side: bottom;
537
- }
538
- .ndk\\:origin-\\(--radix-dropdown-menu-content-transform-origin\\) {
539
- transform-origin: var(--radix-dropdown-menu-content-transform-origin);
540
- }
541
- .ndk\\:origin-\\(--radix-popover-content-transform-origin\\) {
542
- transform-origin: var(--radix-popover-content-transform-origin);
543
- }
544
- .ndk\\:origin-\\(--radix-select-content-transform-origin\\) {
545
- transform-origin: var(--radix-select-content-transform-origin);
546
- }
547
- .ndk\\:animate-spin {
548
- animation: var(--ndk-animate-spin);
549
- }
550
- .ndk\\:cursor-default {
551
- cursor: default;
552
- }
553
- .ndk\\:scroll-my-1 {
554
- scroll-margin-block: calc(var(--ndk-spacing)*1);
555
- }
556
- .ndk\\:flex-col {
557
- flex-direction: column;
558
- }
559
- .ndk\\:flex-row {
560
- flex-direction: row;
561
- }
562
- .ndk\\:place-content-center {
563
- place-content: center;
564
- }
565
- .ndk\\:items-center {
566
- align-items: center;
567
- }
568
- .ndk\\:justify-between {
569
- justify-content: space-between;
570
- }
571
- .ndk\\:justify-center {
572
- justify-content: center;
573
- }
574
- .ndk\\:justify-end {
575
- justify-content: flex-end;
576
- }
577
- .ndk\\:gap-1 {
578
- gap: calc(var(--ndk-spacing)*1);
579
- }
580
- .ndk\\:gap-1\\.5 {
581
- gap: calc(var(--ndk-spacing)*1.5);
582
- }
583
- .ndk\\:gap-2 {
584
- gap: calc(var(--ndk-spacing)*2);
585
- }
586
- .ndk\\:gap-3 {
587
- gap: calc(var(--ndk-spacing)*3);
588
- }
589
- .ndk\\:gap-4 {
590
- gap: calc(var(--ndk-spacing)*4);
591
- }
592
- :where(.ndk\\:space-y-3 > :not(:last-child)) {
593
- --tw-space-y-reverse:0;
594
- margin-block-start: calc(calc(var(--ndk-spacing)*3)*var(--tw-space-y-reverse));
595
- margin-block-end: calc(calc(var(--ndk-spacing)*3)*calc(1 - var(--tw-space-y-reverse)));
596
- }
597
- .ndk\\:overflow-hidden {
598
- overflow: hidden;
599
- }
600
- .ndk\\:overflow-x-auto {
601
- overflow-x: auto;
602
- }
603
- .ndk\\:overflow-x-hidden {
604
- overflow-x: hidden;
605
- }
606
- .ndk\\:overflow-y-auto {
607
- overflow-y: auto;
608
- }
609
- .ndk\\:rounded-\\[4px\\] {
610
- border-radius: 4px;
611
- }
612
- .ndk\\:rounded-lg {
613
- border-radius: var(--ndk-radius-lg);
614
- }
615
- .ndk\\:rounded-md {
616
- border-radius: var(--ndk-radius-md);
617
- }
618
- .ndk\\:rounded-sm {
619
- border-radius: var(--ndk-radius-sm);
620
- }
621
- .ndk\\:border {
622
- border-style: var(--tw-border-style);
623
- border-width: 1px;
624
- }
625
- .ndk\\:border-t {
626
- border-top-style: var(--tw-border-style);
627
- border-top-width: 1px;
628
- }
629
- .ndk\\:border-b {
630
- border-bottom-style: var(--tw-border-style);
631
- border-bottom-width: 1px;
632
- }
633
- .ndk\\:border-gray-100 {
634
- border-color: var(--ndk-color-gray-100);
635
- }
636
- .ndk\\:border-gray-200 {
637
- border-color: var(--ndk-color-gray-200);
638
- }
639
- .ndk\\:bg-gray-50\\/70 {
640
- background-color: var(--ndk-color-gray-50);
641
- }
642
- @supports (color:color-mix(in lab, red, red)) {
643
- .ndk\\:bg-gray-50\\/70 {
644
- background-color: color-mix(in oklab, var(--ndk-color-gray-50)70%, transparent);
645
- }
646
- }
647
- .ndk\\:bg-gray-100 {
648
- background-color: var(--ndk-color-gray-100);
649
- }
650
- .ndk\\:bg-gray-900 {
651
- background-color: var(--ndk-color-gray-900);
652
- }
653
- .ndk\\:bg-red-600 {
654
- background-color: var(--ndk-color-red-600);
655
- }
656
- .ndk\\:bg-transparent {
657
- background-color: #0000;
658
- }
659
- .ndk\\:bg-white {
660
- background-color: var(--ndk-color-white);
661
- }
662
- .ndk\\:fill-current {
663
- fill: currentColor;
664
- }
665
- .ndk\\:p-1 {
666
- padding: calc(var(--ndk-spacing)*1);
667
- }
668
- .ndk\\:p-2 {
669
- padding: calc(var(--ndk-spacing)*2);
670
- }
671
- .ndk\\:p-4 {
672
- padding: calc(var(--ndk-spacing)*4);
673
- }
674
- .ndk\\:px-2 {
675
- padding-inline: calc(var(--ndk-spacing)*2);
676
- }
677
- .ndk\\:px-2\\.5 {
678
- padding-inline: calc(var(--ndk-spacing)*2.5);
679
- }
680
- .ndk\\:px-3 {
681
- padding-inline: calc(var(--ndk-spacing)*3);
682
- }
683
- .ndk\\:px-4 {
684
- padding-inline: calc(var(--ndk-spacing)*4);
685
- }
686
- .ndk\\:px-6 {
687
- padding-inline: calc(var(--ndk-spacing)*6);
688
- }
689
- .ndk\\:py-0 {
690
- padding-block: calc(var(--ndk-spacing)*0);
691
- }
692
- .ndk\\:py-1 {
693
- padding-block: calc(var(--ndk-spacing)*1);
694
- }
695
- .ndk\\:py-1\\.5 {
696
- padding-block: calc(var(--ndk-spacing)*1.5);
697
- }
698
- .ndk\\:py-2 {
699
- padding-block: calc(var(--ndk-spacing)*2);
700
- }
701
- .ndk\\:py-4 {
702
- padding-block: calc(var(--ndk-spacing)*4);
703
- }
704
- .ndk\\:pt-3 {
705
- padding-top: calc(var(--ndk-spacing)*3);
706
- }
707
- .ndk\\:pt-4 {
708
- padding-top: calc(var(--ndk-spacing)*4);
709
- }
710
- .ndk\\:pr-2 {
711
- padding-right: calc(var(--ndk-spacing)*2);
712
- }
713
- .ndk\\:pr-8 {
714
- padding-right: calc(var(--ndk-spacing)*8);
715
- }
716
- .ndk\\:pb-3 {
717
- padding-bottom: calc(var(--ndk-spacing)*3);
718
- }
719
- .ndk\\:pl-2 {
720
- padding-left: calc(var(--ndk-spacing)*2);
721
- }
722
- .ndk\\:pl-8 {
723
- padding-left: calc(var(--ndk-spacing)*8);
724
- }
725
- .ndk\\:text-center {
726
- text-align: center;
727
- }
728
- .ndk\\:text-left {
729
- text-align: left;
730
- }
731
- .ndk\\:align-middle {
732
- vertical-align: middle;
733
- }
734
- .ndk\\:text-sm {
735
- font-size: var(--ndk-text-sm);
736
- line-height: var(--tw-leading,var(--ndk-text-sm--line-height));
737
- }
738
- .ndk\\:text-xs {
739
- font-size: var(--ndk-text-xs);
740
- line-height: var(--tw-leading,var(--ndk-text-xs--line-height));
741
- }
742
- .ndk\\:font-medium {
743
- --tw-font-weight:var(--ndk-font-weight-medium);
744
- font-weight: var(--ndk-font-weight-medium);
745
- }
746
- .ndk\\:tracking-widest {
747
- --tw-tracking:var(--ndk-tracking-widest);
748
- letter-spacing: var(--ndk-tracking-widest);
749
- }
750
- .ndk\\:whitespace-nowrap {
751
- white-space: nowrap;
752
- }
753
- .ndk\\:text-current {
754
- color: currentColor;
755
- }
756
- .ndk\\:text-gray-500 {
757
- color: var(--ndk-color-gray-500);
758
- }
759
- .ndk\\:text-gray-900 {
760
- color: var(--ndk-color-gray-900);
761
- }
762
- .ndk\\:text-red-500 {
763
- color: var(--ndk-color-red-500);
764
- }
765
- .ndk\\:text-white {
766
- color: var(--ndk-color-white);
767
- }
768
- .ndk\\:underline-offset-4 {
769
- text-underline-offset: 4px;
770
- }
771
- .ndk\\:opacity-50 {
772
- opacity: .5;
773
- }
774
- .ndk\\:shadow-lg {
775
- --tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);
776
- box-shadow:
777
- var(--tw-inset-shadow),
778
- var(--tw-inset-ring-shadow),
779
- var(--tw-ring-offset-shadow),
780
- var(--tw-ring-shadow),
781
- var(--tw-shadow);
782
- }
783
- .ndk\\:shadow-md {
784
- --tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);
785
- box-shadow:
786
- var(--tw-inset-shadow),
787
- var(--tw-inset-ring-shadow),
788
- var(--tw-ring-offset-shadow),
789
- var(--tw-ring-shadow),
790
- var(--tw-shadow);
791
- }
792
- .ndk\\:shadow-xs {
793
- --tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);
794
- box-shadow:
795
- var(--tw-inset-shadow),
796
- var(--tw-inset-ring-shadow),
797
- var(--tw-ring-offset-shadow),
798
- var(--tw-ring-shadow),
799
- var(--tw-shadow);
800
- }
801
- .ndk\\:outline-hidden {
802
- --tw-outline-style:none;
803
- outline-style: none;
804
- }
805
- @media (forced-colors: active) {
806
- .ndk\\:outline-hidden {
807
- outline-offset: 2px;
808
- outline: 2px solid #0000;
809
- }
810
- }
811
- .ndk\\:transition-\\[color\\,box-shadow\\] {
812
- transition-property: color, box-shadow;
813
- transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
814
- transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
815
- }
816
- .ndk\\:transition-all {
817
- transition-property: all;
818
- transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
819
- transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
820
- }
821
- .ndk\\:transition-colors {
822
- transition-property:
823
- color,
824
- background-color,
825
- border-color,
826
- outline-color,
827
- text-decoration-color,
828
- fill,
829
- stroke,
830
- --tw-gradient-from,
831
- --tw-gradient-via,
832
- --tw-gradient-to;
833
- transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
834
- transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
835
- }
836
- .ndk\\:transition-shadow {
837
- transition-property: box-shadow;
838
- transition-timing-function: var(--tw-ease,var(--ndk-default-transition-timing-function));
839
- transition-duration: var(--tw-duration,var(--ndk-default-transition-duration));
840
- }
841
- .ndk\\:transition-none {
842
- transition-property: none;
843
- }
844
- .ndk\\:outline-none {
845
- --tw-outline-style:none;
846
- outline-style: none;
847
- }
848
- .ndk\\:select-none {
849
- -webkit-user-select: none;
850
- user-select: none;
851
- }
852
- @media (hover: hover) {
853
- .ndk\\:hover\\:bg-gray-50:hover {
854
- background-color: var(--ndk-color-gray-50);
855
- }
856
- .ndk\\:hover\\:bg-gray-100:hover {
857
- background-color: var(--ndk-color-gray-100);
858
- }
859
- .ndk\\:hover\\:bg-gray-200:hover {
860
- background-color: var(--ndk-color-gray-200);
861
- }
862
- .ndk\\:hover\\:bg-gray-800:hover {
863
- background-color: var(--ndk-color-gray-800);
864
- }
865
- .ndk\\:hover\\:bg-red-700:hover {
866
- background-color: var(--ndk-color-red-700);
867
- }
868
- .ndk\\:hover\\:text-gray-900:hover {
869
- color: var(--ndk-color-gray-900);
870
- }
871
- .ndk\\:hover\\:underline:hover {
872
- text-decoration-line: underline;
873
- }
874
- }
875
- .ndk\\:focus\\:bg-gray-50:focus {
876
- background-color: var(--ndk-color-gray-50);
877
- }
878
- .ndk\\:focus\\:text-gray-900:focus {
879
- color: var(--ndk-color-gray-900);
880
- }
881
- .ndk\\:focus\\:ring-2:focus {
882
- --tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);
883
- box-shadow:
884
- var(--tw-inset-shadow),
885
- var(--tw-inset-ring-shadow),
886
- var(--tw-ring-offset-shadow),
887
- var(--tw-ring-shadow),
888
- var(--tw-shadow);
889
- }
890
- .ndk\\:focus-visible\\:border-gray-900:focus-visible {
891
- border-color: var(--ndk-color-gray-900);
892
- }
893
- .ndk\\:focus-visible\\:ring-\\[3px\\]:focus-visible {
894
- --tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);
895
- box-shadow:
896
- var(--tw-inset-shadow),
897
- var(--tw-inset-ring-shadow),
898
- var(--tw-ring-offset-shadow),
899
- var(--tw-ring-shadow),
900
- var(--tw-shadow);
901
- }
902
- .ndk\\:focus-visible\\:ring-black\\/20:focus-visible {
903
- --tw-ring-color:var(--ndk-color-black);
904
- }
905
- @supports (color:color-mix(in lab, red, red)) {
906
- .ndk\\:focus-visible\\:ring-black\\/20:focus-visible {
907
- --tw-ring-color:color-mix(in oklab,var(--ndk-color-black)20%,transparent);
908
- }
909
- }
910
- .ndk\\:disabled\\:pointer-events-none:disabled {
911
- pointer-events: none;
912
- }
913
- .ndk\\:disabled\\:cursor-not-allowed:disabled {
914
- cursor: not-allowed;
915
- }
916
- .ndk\\:disabled\\:opacity-50:disabled {
917
- opacity: .5;
918
- }
919
- .ndk\\:has-\\[\\>svg\\]\\:px-2\\.5:has(> svg) {
920
- padding-inline: calc(var(--ndk-spacing)*2.5);
921
- }
922
- .ndk\\:has-\\[\\>svg\\]\\:px-3:has(> svg) {
923
- padding-inline: calc(var(--ndk-spacing)*3);
924
- }
925
- .ndk\\:has-\\[\\>svg\\]\\:px-4:has(> svg) {
926
- padding-inline: calc(var(--ndk-spacing)*4);
927
- }
928
- .ndk\\:aria-invalid\\:border-red-500[aria-invalid=true] {
929
- border-color: var(--ndk-color-red-500);
930
- }
931
- .ndk\\:aria-invalid\\:ring-red-500\\/20[aria-invalid=true] {
932
- --tw-ring-color:var(--ndk-color-red-500);
933
- }
934
- @supports (color:color-mix(in lab, red, red)) {
935
- .ndk\\:aria-invalid\\:ring-red-500\\/20[aria-invalid=true] {
936
- --tw-ring-color:color-mix(in oklab,var(--ndk-color-red-500)20%,transparent);
937
- }
938
- }
939
- .ndk\\:data-\\[disabled\\]\\:pointer-events-none[data-disabled] {
940
- pointer-events: none;
941
- }
942
- .ndk\\:data-\\[disabled\\]\\:opacity-50[data-disabled] {
943
- opacity: .5;
944
- }
945
- .ndk\\:data-\\[inset\\]\\:pl-8[data-inset] {
946
- padding-left: calc(var(--ndk-spacing)*8);
947
- }
948
- .ndk\\:data-\\[placeholder\\]\\:text-gray-500[data-placeholder] {
949
- color: var(--ndk-color-gray-500);
950
- }
951
- .ndk\\:data-\\[side\\=bottom\\]\\:translate-y-1[data-side=bottom] {
952
- --tw-translate-y:calc(var(--ndk-spacing)*1);
953
- translate: var(--tw-translate-x)var(--tw-translate-y);
954
- }
955
- .ndk\\:data-\\[side\\=left\\]\\:-translate-x-1[data-side=left] {
956
- --tw-translate-x:calc(var(--ndk-spacing)*-1);
957
- translate: var(--tw-translate-x)var(--tw-translate-y);
958
- }
959
- .ndk\\:data-\\[side\\=right\\]\\:translate-x-1[data-side=right] {
960
- --tw-translate-x:calc(var(--ndk-spacing)*1);
961
- translate: var(--tw-translate-x)var(--tw-translate-y);
962
- }
963
- .ndk\\:data-\\[side\\=top\\]\\:-translate-y-1[data-side=top] {
964
- --tw-translate-y:calc(var(--ndk-spacing)*-1);
965
- translate: var(--tw-translate-x)var(--tw-translate-y);
966
- }
967
- .ndk\\:data-\\[size\\=default\\]\\:h-9[data-size=default] {
968
- height: calc(var(--ndk-spacing)*9);
969
- }
970
- .ndk\\:data-\\[size\\=sm\\]\\:h-8[data-size=sm] {
971
- height: calc(var(--ndk-spacing)*8);
972
- }
973
- :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:line-clamp-1 > *)[data-slot=select-value] {
974
- -webkit-line-clamp: 1;
975
- -webkit-box-orient: vertical;
976
- display: -webkit-box;
977
- overflow: hidden;
978
- }
979
- :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:flex > *)[data-slot=select-value] {
980
- display: flex;
981
- }
982
- :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:items-center > *)[data-slot=select-value] {
983
- align-items: center;
984
- }
985
- :is(.ndk\\:\\*\\:data-\\[slot\\=select-value\\]\\:gap-2 > *)[data-slot=select-value] {
986
- gap: calc(var(--ndk-spacing)*2);
987
- }
988
- .ndk\\:data-\\[state\\=checked\\]\\:border-gray-900[data-state=checked] {
989
- border-color: var(--ndk-color-gray-900);
990
- }
991
- .ndk\\:data-\\[state\\=checked\\]\\:bg-gray-900[data-state=checked] {
992
- background-color: var(--ndk-color-gray-900);
993
- }
994
- .ndk\\:data-\\[state\\=checked\\]\\:text-white[data-state=checked] {
995
- color: var(--ndk-color-white);
996
- }
997
- .ndk\\:data-\\[state\\=closed\\]\\:animate-out[data-state=closed] {
998
- animation: var(--ndk-animate-out);
999
- }
1000
- .ndk\\:data-\\[state\\=open\\]\\:animate-in[data-state=open] {
1001
- animation: var(--ndk-animate-in);
1002
- }
1003
- .ndk\\:data-\\[state\\=open\\]\\:bg-gray-50[data-state=open] {
1004
- background-color: var(--ndk-color-gray-50);
1005
- }
1006
- .ndk\\:data-\\[state\\=open\\]\\:text-gray-900[data-state=open] {
1007
- color: var(--ndk-color-gray-900);
1008
- }
1009
- .ndk\\:data-\\[state\\=selected\\]\\:bg-gray-50[data-state=selected] {
1010
- background-color: var(--ndk-color-gray-50);
1011
- }
1012
- .ndk\\:data-\\[variant\\=destructive\\]\\:text-red-600[data-variant=destructive] {
1013
- color: var(--ndk-color-red-600);
1014
- }
1015
- .ndk\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/10[data-variant=destructive]:focus {
1016
- background-color: var(--ndk-color-red-500);
1017
- }
1018
- @supports (color:color-mix(in lab, red, red)) {
1019
- .ndk\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/10[data-variant=destructive]:focus {
1020
- background-color: color-mix(in oklab, var(--ndk-color-red-500)10%, transparent);
1021
- }
1022
- }
1023
- .ndk\\:data-\\[variant\\=destructive\\]\\:focus\\:text-red-700[data-variant=destructive]:focus {
1024
- color: var(--ndk-color-red-700);
1025
- }
1026
- @media (min-width: 40rem) {
1027
- .ndk\\:sm\\:block {
1028
- display: block;
1029
- }
1030
- .ndk\\:sm\\:hidden {
1031
- display: none;
1032
- }
1033
- .ndk\\:sm\\:pr-2\\.5 {
1034
- padding-right: calc(var(--ndk-spacing)*2.5);
1035
- }
1036
- .ndk\\:sm\\:pl-2\\.5 {
1037
- padding-left: calc(var(--ndk-spacing)*2.5);
1038
- }
1039
- }
1040
- .ndk\\:dark\\:border-gray-800:where(.dark, .dark *) {
1041
- border-color: var(--ndk-color-gray-800);
1042
- }
1043
- .ndk\\:dark\\:bg-gray-100:where(.dark, .dark *) {
1044
- background-color: var(--ndk-color-gray-100);
1045
- }
1046
- .ndk\\:dark\\:bg-gray-900:where(.dark, .dark *),
1047
- .ndk\\:dark\\:bg-gray-900\\/40:where(.dark, .dark *) {
1048
- background-color: var(--ndk-color-gray-900);
1049
- }
1050
- @supports (color:color-mix(in lab, red, red)) {
1051
- .ndk\\:dark\\:bg-gray-900\\/40:where(.dark, .dark *) {
1052
- background-color: color-mix(in oklab, var(--ndk-color-gray-900)40%, transparent);
1053
- }
1054
- }
1055
- .ndk\\:dark\\:bg-gray-950:where(.dark, .dark *) {
1056
- background-color: var(--ndk-color-gray-950);
1057
- }
1058
- .ndk\\:dark\\:bg-red-600:where(.dark, .dark *) {
1059
- background-color: var(--ndk-color-red-600);
1060
- }
1061
- .ndk\\:dark\\:text-gray-100:where(.dark, .dark *) {
1062
- color: var(--ndk-color-gray-100);
1063
- }
1064
- .ndk\\:dark\\:text-gray-400:where(.dark, .dark *) {
1065
- color: var(--ndk-color-gray-400);
1066
- }
1067
- .ndk\\:dark\\:text-gray-900:where(.dark, .dark *) {
1068
- color: var(--ndk-color-gray-900);
1069
- }
1070
- @media (hover: hover) {
1071
- .ndk\\:dark\\:hover\\:bg-gray-200:where(.dark, .dark *):hover {
1072
- background-color: var(--ndk-color-gray-200);
1073
- }
1074
- .ndk\\:dark\\:hover\\:bg-gray-800:where(.dark, .dark *):hover {
1075
- background-color: var(--ndk-color-gray-800);
1076
- }
1077
- .ndk\\:dark\\:hover\\:bg-gray-900:where(.dark, .dark *):hover {
1078
- background-color: var(--ndk-color-gray-900);
1079
- }
1080
- .ndk\\:dark\\:hover\\:bg-red-500:where(.dark, .dark *):hover {
1081
- background-color: var(--ndk-color-red-500);
1082
- }
1083
- .ndk\\:dark\\:hover\\:text-gray-100:where(.dark, .dark *):hover {
1084
- color: var(--ndk-color-gray-100);
1085
- }
1086
- }
1087
- .ndk\\:dark\\:focus\\:bg-gray-900:where(.dark, .dark *):focus {
1088
- background-color: var(--ndk-color-gray-900);
1089
- }
1090
- .ndk\\:dark\\:focus\\:text-gray-100:where(.dark, .dark *):focus {
1091
- color: var(--ndk-color-gray-100);
1092
- }
1093
- .ndk\\:dark\\:focus-visible\\:border-gray-200:where(.dark, .dark *):focus-visible {
1094
- border-color: var(--ndk-color-gray-200);
1095
- }
1096
- .ndk\\:dark\\:focus-visible\\:ring-white\\/20:where(.dark, .dark *):focus-visible {
1097
- --tw-ring-color:var(--ndk-color-white);
1098
- }
1099
- @supports (color:color-mix(in lab, red, red)) {
1100
- .ndk\\:dark\\:focus-visible\\:ring-white\\/20:where(.dark, .dark *):focus-visible {
1101
- --tw-ring-color:color-mix(in oklab,var(--ndk-color-white)20%,transparent);
1102
- }
1103
- }
1104
- .ndk\\:dark\\:aria-invalid\\:ring-red-500\\/30:where(.dark, .dark *)[aria-invalid=true] {
1105
- --tw-ring-color:var(--ndk-color-red-500);
1106
- }
1107
- @supports (color:color-mix(in lab, red, red)) {
1108
- .ndk\\:dark\\:aria-invalid\\:ring-red-500\\/30:where(.dark, .dark *)[aria-invalid=true] {
1109
- --tw-ring-color:color-mix(in oklab,var(--ndk-color-red-500)30%,transparent);
1110
- }
1111
- }
1112
- .ndk\\:dark\\:data-\\[placeholder\\]\\:text-gray-400:where(.dark, .dark *)[data-placeholder] {
1113
- color: var(--ndk-color-gray-400);
1114
- }
1115
- .ndk\\:dark\\:data-\\[state\\=checked\\]\\:border-gray-100:where(.dark, .dark *)[data-state=checked] {
1116
- border-color: var(--ndk-color-gray-100);
1117
- }
1118
- .ndk\\:dark\\:data-\\[state\\=checked\\]\\:bg-gray-100:where(.dark, .dark *)[data-state=checked] {
1119
- background-color: var(--ndk-color-gray-100);
1120
- }
1121
- .ndk\\:dark\\:data-\\[state\\=checked\\]\\:text-gray-900:where(.dark, .dark *)[data-state=checked] {
1122
- color: var(--ndk-color-gray-900);
1123
- }
1124
- .ndk\\:dark\\:data-\\[state\\=open\\]\\:bg-gray-900:where(.dark, .dark *)[data-state=open] {
1125
- background-color: var(--ndk-color-gray-900);
1126
- }
1127
- .ndk\\:dark\\:data-\\[state\\=open\\]\\:text-gray-100:where(.dark, .dark *)[data-state=open] {
1128
- color: var(--ndk-color-gray-100);
1129
- }
1130
- .ndk\\:dark\\:data-\\[state\\=selected\\]\\:bg-gray-900:where(.dark, .dark *)[data-state=selected] {
1131
- background-color: var(--ndk-color-gray-900);
1132
- }
1133
- .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:text-red-500:where(.dark, .dark *)[data-variant=destructive] {
1134
- color: var(--ndk-color-red-500);
1135
- }
1136
- .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/15:where(.dark, .dark *)[data-variant=destructive]:focus {
1137
- background-color: var(--ndk-color-red-500);
1138
- }
1139
- @supports (color:color-mix(in lab, red, red)) {
1140
- .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:focus\\:bg-red-500\\/15:where(.dark, .dark *)[data-variant=destructive]:focus {
1141
- background-color: color-mix(in oklab, var(--ndk-color-red-500)15%, transparent);
1142
- }
1143
- }
1144
- .ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:focus\\:text-red-400:where(.dark, .dark *)[data-variant=destructive]:focus {
1145
- color: var(--ndk-color-red-400);
1146
- }
1147
- .ndk\\:\\[\\&_svg\\]\\:pointer-events-none svg {
1148
- pointer-events: none;
1149
- }
1150
- .ndk\\:\\[\\&_svg\\]\\:shrink-0 svg {
1151
- flex-shrink: 0;
1152
- }
1153
- .ndk\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]) {
1154
- width: calc(var(--ndk-spacing)*4);
1155
- height: calc(var(--ndk-spacing)*4);
1156
- }
1157
- .ndk\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'text-\\'\\]\\)\\]\\:text-gray-500 svg:not([class*=text-]) {
1158
- color: var(--ndk-color-gray-500);
1159
- }
1160
- .ndk\\:dark\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'text-\\'\\]\\)\\]\\:text-gray-400:where(.dark, .dark *) svg:not([class*=text-]) {
1161
- color: var(--ndk-color-gray-400);
1162
- }
1163
- .ndk\\:\\[\\&_tr\\]\\:border-b tr {
1164
- border-bottom-style: var(--tw-border-style);
1165
- border-bottom-width: 1px;
1166
- }
1167
- .ndk\\:\\[\\&_tr\\:last-child\\]\\:border-0 tr:last-child {
1168
- border-style: var(--tw-border-style);
1169
- border-width: 0;
1170
- }
1171
- .ndk\\:\\[\\&\\:has\\(\\[role\\=checkbox\\]\\)\\]\\:pr-0:has([role=checkbox]) {
1172
- padding-right: calc(var(--ndk-spacing)*0);
1173
- }
1174
- :is(.ndk\\:\\*\\:\\[span\\]\\:last\\:flex > *):is(span):last-child {
1175
- display: flex;
1176
- }
1177
- :is(.ndk\\:\\*\\:\\[span\\]\\:last\\:items-center > *):is(span):last-child {
1178
- align-items: center;
1179
- }
1180
- :is(.ndk\\:\\*\\:\\[span\\]\\:last\\:gap-2 > *):is(span):last-child {
1181
- gap: calc(var(--ndk-spacing)*2);
1182
- }
1183
- :is(.ndk\\:data-\\[variant\\=destructive\\]\\:\\*\\:\\[svg\\]\\:\\!text-red-600[data-variant=destructive] > *):is(svg) {
1184
- color: var(--ndk-color-red-600) !important;
1185
- }
1186
- :is(.ndk\\:dark\\:data-\\[variant\\=destructive\\]\\:\\*\\:\\[svg\\]\\:\\!text-red-500:where(.dark, .dark *)[data-variant=destructive] > *):is(svg) {
1187
- color: var(--ndk-color-red-500) !important;
1188
- }
1189
- .ndk\\:\\[\\&\\>\\[role\\=checkbox\\]\\]\\:translate-y-\\[2px\\] > [role=checkbox] {
1190
- --tw-translate-y:2px;
1191
- translate: var(--tw-translate-x)var(--tw-translate-y);
1192
- }
1193
- .ndk\\:\\[\\&\\>tr\\]\\:last\\:border-b-0 > tr:last-child {
1194
- border-bottom-style: var(--tw-border-style);
1195
- border-bottom-width: 0;
1196
- }
1197
- }
1198
- @keyframes animate-in {
1199
- 0% {
1200
- opacity: 0;
1201
- transform: scale(.95);
1202
- }
1203
- to {
1204
- opacity: 1;
1205
- transform: scale(1);
1206
- }
1207
- }
1208
- @keyframes animate-out {
1209
- 0% {
1210
- opacity: 1;
1211
- transform: scale(1);
1212
- }
1213
- to {
1214
- opacity: 0;
1215
- transform: scale(.95);
1216
- }
1217
- }
1218
- @property --tw-space-y-reverse { syntax:"*";inherits:false;initial-value:0 }
1219
- @property --tw-border-style { syntax:"*";inherits:false;initial-value:solid }
1220
- @property --tw-font-weight { syntax:"*";inherits:false }
1221
- @property --tw-tracking { syntax:"*";inherits:false }
1222
- @property --tw-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1223
- @property --tw-shadow-color { syntax:"*";inherits:false }
1224
- @property --tw-shadow-alpha { syntax:"<percentage>";inherits:false;initial-value:100% }
1225
- @property --tw-inset-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1226
- @property --tw-inset-shadow-color { syntax:"*";inherits:false }
1227
- @property --tw-inset-shadow-alpha { syntax:"<percentage>";inherits:false;initial-value:100% }
1228
- @property --tw-ring-color { syntax:"*";inherits:false }
1229
- @property --tw-ring-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1230
- @property --tw-inset-ring-color { syntax:"*";inherits:false }
1231
- @property --tw-inset-ring-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1232
- @property --tw-ring-inset { syntax:"*";inherits:false }
1233
- @property --tw-ring-offset-width { syntax:"<length>";inherits:false;initial-value:0 }
1234
- @property --tw-ring-offset-color { syntax:"*";inherits:false;initial-value:#fff }
1235
- @property --tw-ring-offset-shadow { syntax:"*";inherits:false;initial-value:0 0 #0000 }
1236
- @property --tw-translate-x { syntax:"*";inherits:false;initial-value:0 }
1237
- @property --tw-translate-y { syntax:"*";inherits:false;initial-value:0 }
1238
- @property --tw-translate-z { syntax:"*";inherits:false;initial-value:0 }
1239
- @keyframes spin {
1240
- to {
1241
- transform: rotate(360deg);
1242
- }
1243
- }
1244
- `);
1245
-
1246
- // src/server/utils.ts
1247
- var isProvided = (value) => value !== void 0 && value !== null && value !== "";
1248
- var getValueByPath = (obj, path) => {
1249
- if (!path) return void 0;
1250
- const parts = path.split(".");
1251
- let current = obj;
1252
- for (const part of parts) {
1253
- if (current && typeof current === "object" && part in current) {
1254
- current = current[part];
1255
- } else {
1256
- return void 0;
1257
- }
1258
- }
1259
- return current;
1260
- };
1261
- var matchesExact = (rowValue, needle) => {
1262
- if (Array.isArray(needle)) return needle.includes(rowValue);
1263
- return rowValue === needle;
1264
- };
1265
- var matchesRegexLike = (rowValue, needle) => {
1266
- if (!isProvided(needle)) return true;
1267
- if (rowValue === void 0 || rowValue === null) return false;
1268
- const hay = String(rowValue);
1269
- if (needle instanceof RegExp) return needle.test(hay);
1270
- const n = String(needle);
1271
- return hay.toLowerCase().includes(n.toLowerCase());
1272
- };
1273
- var compareValues = (a, b) => {
1274
- if (a === b) return 0;
1275
- if (a === void 0 || a === null) return -1;
1276
- if (b === void 0 || b === null) return 1;
1277
- if (typeof a === "number" && typeof b === "number") return a - b;
1278
- if (typeof a === "bigint" && typeof b === "bigint") return a < b ? -1 : 1;
1279
- const as = String(a);
1280
- const bs = String(b);
1281
- return as.localeCompare(bs);
1282
- };
1283
- var normalizeSorts = (sorts) => Array.isArray(sorts) ? sorts.filter((s) => !!s?.path && (s.value === 1 || s.value === -1)) : [];
1284
- var isSafeKey = (key) => {
1285
- const unsafeKeys = ["__proto__", "constructor", "prototype"];
1286
- return !unsafeKeys.includes(key);
1287
- };
1288
- var escapeRegex = (str) => {
1289
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1290
- };
1291
- var createSearchFilter = (fields) => {
1292
- return (value) => {
1293
- if (!value || typeof value !== "string") {
1294
- return {};
1295
- }
1296
- const escapedValue = escapeRegex(value);
1297
- return {
1298
- $or: fields.map((field) => ({
1299
- [field]: { $regex: escapedValue, $options: "i" }
1300
- }))
1301
- };
1302
- };
1303
- };
1304
- var calculatePagination = (page, limit, total) => ({
1305
- currentPage: page,
1306
- totalPages: Math.ceil(total / limit),
1307
- totalItems: total,
1308
- itemsPerPage: limit,
1309
- hasNextPage: page * limit < total,
1310
- hasPrevPage: page > 1
1311
- });
3
+ var chunkCGB4WIAS_cjs = require('./chunk-CGB4WIAS.cjs');
4
+ var chunkFDSJZI3C_cjs = require('./chunk-FDSJZI3C.cjs');
1312
5
 
1313
6
  // src/server/adapters/mongoose.ts
1314
7
  var mongooseAdapter = (model, options = {}) => {
@@ -1330,7 +23,7 @@ var mongooseAdapter = (model, options = {}) => {
1330
23
  let filterQuery = {};
1331
24
  if (input.query) {
1332
25
  Object.entries(input.query).forEach(([key, value]) => {
1333
- if (isProvided(value) && isSafeKey(key)) {
26
+ if (chunkCGB4WIAS_cjs.isProvided(value) && chunkCGB4WIAS_cjs.isSafeKey(key)) {
1334
27
  filterQuery[key] = value;
1335
28
  }
1336
29
  });
@@ -1343,12 +36,12 @@ var mongooseAdapter = (model, options = {}) => {
1343
36
  if (input.filterConfig) {
1344
37
  Object.entries(filter).forEach(([key, value]) => {
1345
38
  if (filterCustom && filterCustom[key]) return;
1346
- if (isProvided(value) && isSafeKey(key) && input.filterConfig?.[key]) {
39
+ if (chunkCGB4WIAS_cjs.isProvided(value) && chunkCGB4WIAS_cjs.isSafeKey(key) && input.filterConfig?.[key]) {
1347
40
  const config = input.filterConfig[key];
1348
41
  const fieldName = config?.field ?? key;
1349
42
  if (config?.type === "REGEX") {
1350
43
  filterQuery[fieldName] = {
1351
- $regex: escapeRegex(String(value)),
44
+ $regex: chunkCGB4WIAS_cjs.escapeRegex(String(value)),
1352
45
  $options: "i"
1353
46
  };
1354
47
  } else if (config?.type === "EXACT") {
@@ -1359,10 +52,10 @@ var mongooseAdapter = (model, options = {}) => {
1359
52
  } else {
1360
53
  Object.entries(filter).forEach(([key, value]) => {
1361
54
  if (filterCustom && filterCustom[key]) return;
1362
- if (isProvided(value) && isSafeKey(key)) {
55
+ if (chunkCGB4WIAS_cjs.isProvided(value) && chunkCGB4WIAS_cjs.isSafeKey(key)) {
1363
56
  if (typeof value === "string") {
1364
57
  filterQuery[key] = {
1365
- $regex: escapeRegex(value),
58
+ $regex: chunkCGB4WIAS_cjs.escapeRegex(value),
1366
59
  $options: "i"
1367
60
  };
1368
61
  } else if (typeof value === "number" || typeof value === "boolean") {
@@ -1374,7 +67,7 @@ var mongooseAdapter = (model, options = {}) => {
1374
67
  }
1375
68
  if (filterCustom && filter) {
1376
69
  Object.entries(filter).forEach(([key, value]) => {
1377
- if (isProvided(value) && isSafeKey(key) && filterCustom[key]) {
70
+ if (chunkCGB4WIAS_cjs.isProvided(value) && chunkCGB4WIAS_cjs.isSafeKey(key) && filterCustom[key]) {
1378
71
  const customFilter2 = filterCustom[key](value);
1379
72
  filterQuery = { ...filterQuery, ...customFilter2 };
1380
73
  }
@@ -1480,35 +173,35 @@ var adapterMemory = (dataset, options = {}) => {
1480
173
  const query = input.query ?? {};
1481
174
  let rows = dataset.filter((row) => {
1482
175
  for (const [key, value] of Object.entries(query)) {
1483
- if (!isProvided(value)) continue;
1484
- const rowValue = getValueByPath(row, key);
1485
- if (!matchesExact(rowValue, value)) return false;
176
+ if (!chunkCGB4WIAS_cjs.isProvided(value)) continue;
177
+ const rowValue = chunkCGB4WIAS_cjs.getValueByPath(row, key);
178
+ if (!chunkCGB4WIAS_cjs.matchesExact(rowValue, value)) return false;
1486
179
  }
1487
180
  return true;
1488
181
  });
1489
182
  const effectiveFilter = filter ?? {};
1490
183
  rows = rows.filter((row) => {
1491
184
  for (const [key, value] of Object.entries(effectiveFilter)) {
1492
- if (!isProvided(value)) continue;
185
+ if (!chunkCGB4WIAS_cjs.isProvided(value)) continue;
1493
186
  const config = filterConfig?.[key];
1494
187
  const field = config?.field ?? key;
1495
- const rowValue = getValueByPath(row, field);
188
+ const rowValue = chunkCGB4WIAS_cjs.getValueByPath(row, field);
1496
189
  const type = config?.type ?? defaultFilterType;
1497
190
  if (type === "regex") {
1498
- if (!matchesRegexLike(rowValue, value)) return false;
191
+ if (!chunkCGB4WIAS_cjs.matchesRegexLike(rowValue, value)) return false;
1499
192
  } else {
1500
- if (!matchesExact(rowValue, value)) return false;
193
+ if (!chunkCGB4WIAS_cjs.matchesExact(rowValue, value)) return false;
1501
194
  }
1502
195
  }
1503
196
  return true;
1504
197
  });
1505
- const normalizedSorts = normalizeSorts(sorts);
198
+ const normalizedSorts = chunkCGB4WIAS_cjs.normalizeSorts(sorts);
1506
199
  if (normalizedSorts.length > 0) {
1507
200
  rows = [...rows].sort((ra, rb) => {
1508
201
  for (const s of normalizedSorts) {
1509
- const av = getValueByPath(ra, s.path);
1510
- const bv = getValueByPath(rb, s.path);
1511
- const cmp = compareValues(av, bv);
202
+ const av = chunkCGB4WIAS_cjs.getValueByPath(ra, s.path);
203
+ const bv = chunkCGB4WIAS_cjs.getValueByPath(rb, s.path);
204
+ const cmp = chunkCGB4WIAS_cjs.compareValues(av, bv);
1512
205
  if (cmp !== 0) return s.value === 1 ? cmp : -cmp;
1513
206
  }
1514
207
  return 0;
@@ -1519,1583 +212,89 @@ var adapterMemory = (dataset, options = {}) => {
1519
212
  return { items, total };
1520
213
  };
1521
214
  };
1522
- zod.z.object({
1523
- action: zod.z.literal("FETCH").optional(),
1524
- page: zod.z.number().int().positive().optional(),
1525
- limit: zod.z.number().int().positive().optional(),
1526
- query: zod.z.record(zod.z.string(), zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()])).optional(),
1527
- filter: zod.z.record(zod.z.string(), zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean(), zod.z.null()])).optional(),
1528
- filterConfig: zod.z.record(
1529
- zod.z.string(),
1530
- zod.z.object({
1531
- type: zod.z.enum(["REGEX", "EXACT"]),
1532
- field: zod.z.string().optional()
1533
- })
1534
- ).optional(),
1535
- sorts: zod.z.array(
1536
- zod.z.object({
1537
- path: zod.z.string().max(100),
1538
- // Limit path length to prevent abuse
1539
- value: zod.z.literal(-1).or(zod.z.literal(1))
1540
- })
1541
- ).max(5).optional(),
1542
- // Limit to 5 sort fields
1543
- sort: zod.z.record(zod.z.string(), zod.z.literal(1).or(zod.z.literal(-1))).optional()
1544
- });
1545
-
1546
- // src/client/utils/cn.ts
1547
- var toClassString = (input) => {
1548
- if (!input) return "";
1549
- if (typeof input === "string" || typeof input === "number") return String(input);
1550
- if (Array.isArray(input)) {
1551
- return input.map(toClassString).filter(Boolean).join(" ");
1552
- }
1553
- if (typeof input === "object") {
1554
- return Object.entries(input).filter(([, value]) => Boolean(value)).map(([key]) => key).join(" ");
1555
- }
1556
- return "";
1557
- };
1558
- var cn = (...inputs) => inputs.map(toClassString).filter(Boolean).join(" ");
1559
-
1560
- // src/client/utils/index.ts
1561
- var getColumnValue = (item, column) => {
1562
- const { accessor } = column;
1563
- return typeof accessor === "function" ? accessor(item) : item[accessor];
1564
- };
1565
- var getSortValue = (sorts, path) => {
1566
- const sort = sorts.find((s) => s.path === path);
1567
- return sort?.value ?? null;
1568
- };
1569
- var getNextSortValue = (current) => {
1570
- if (current === null) return 1;
1571
- if (current === 1) return -1;
1572
- return null;
1573
- };
1574
- var formatNumber = (num) => num.toLocaleString();
1575
- var debounce = (fn, delay) => {
1576
- let timeoutId;
1577
- return (...args) => {
1578
- clearTimeout(timeoutId);
1579
- timeoutId = setTimeout(() => fn(...args), delay);
1580
- };
1581
- };
1582
- var throttle = (fn, limit) => {
1583
- let inThrottle = false;
1584
- return (...args) => {
1585
- if (!inThrottle) {
1586
- fn(...args);
1587
- inThrottle = true;
1588
- setTimeout(() => {
1589
- inThrottle = false;
1590
- }, limit);
1591
- }
1592
- };
1593
- };
1594
- var sortEntriesToKey = (sorts) => sorts.map((s) => `${s.path}:${s.value}`).join(",");
1595
- var keyToSortEntries = (key) => {
1596
- if (!key) return [];
1597
- return key.split(",").map((part) => {
1598
- const [path, value] = part.split(":");
1599
- return { path: path ?? "", value: parseInt(value ?? "1", 10) };
1600
- });
1601
- };
1602
- var parseUrlParams = (search) => {
1603
- const params = new URLSearchParams(search);
1604
- const state = {};
1605
- const page = params.get("page");
1606
- if (page) state.page = parseInt(page, 10);
1607
- const limit = params.get("limit");
1608
- if (limit) state.limit = parseInt(limit, 10);
1609
- const sort = params.get("sort");
1610
- if (sort) state.sorts = keyToSortEntries(sort);
1611
- const filter = {};
1612
- const query = {};
1613
- params.forEach((value, key) => {
1614
- if (key.startsWith("f_")) filter[key.slice(2)] = value;
1615
- else if (key.startsWith("q_")) query[key.slice(2)] = value;
1616
- });
1617
- if (Object.keys(filter).length > 0) state.filter = filter;
1618
- if (Object.keys(query).length > 0) state.query = query;
1619
- return state;
1620
- };
1621
- var stateToUrlParams = (state) => {
1622
- const params = new URLSearchParams();
1623
- if (state.page && state.page > 1) params.set("page", state.page.toString());
1624
- if (state.limit) params.set("limit", state.limit.toString());
1625
- if (state.sorts && state.sorts.length > 0) params.set("sort", sortEntriesToKey(state.sorts));
1626
- if (state.filter) {
1627
- Object.entries(state.filter).forEach(([key, value]) => {
1628
- if (value !== void 0 && value !== null && value !== "") {
1629
- params.set(`f_${key}`, String(value));
1630
- }
1631
- });
1632
- }
1633
- if (state.query) {
1634
- Object.entries(state.query).forEach(([key, value]) => {
1635
- if (value !== void 0 && value !== null && value !== "") {
1636
- params.set(`q_${key}`, String(value));
1637
- }
1638
- });
1639
- }
1640
- return params;
1641
- };
1642
215
 
1643
- // src/client/hooks/useDataKit.ts
1644
- var useDataKit = (props) => {
1645
- const { initial = {}, memory: memoryMode = "memory", filters, action, onSuccess, onError, autoFetch = true, debounce: debounceDelay = 300 } = props;
1646
- const { page: initialPage = 1, limit: initialLimit = 10, sorts: initialSorts = [], filter: initialFilter = {}, query: initialQuery = {} } = initial;
1647
- const [page, setPageState] = React2.useState(initialPage);
1648
- const [limit, setLimitState] = React2.useState(initialLimit);
1649
- const [sorts, setSortsState] = React2.useState(initialSorts);
1650
- const [filter, setFilterState] = React2.useState(initialFilter);
1651
- const [debouncedFilter, setDebouncedFilter] = React2.useState(initialFilter);
1652
- const [query, setQueryState] = React2.useState(initialQuery);
1653
- const [isLoading, setIsLoading] = React2.useState(false);
1654
- const [error, setError] = React2.useState(null);
1655
- const [items, setItems] = React2.useState([]);
1656
- const [total, setTotal] = React2.useState(0);
1657
- const mounted = React2.useRef(true);
1658
- const fetchIdRef = React2.useRef(0);
1659
- const debounceTimerRef = React2.useRef(null);
1660
- const actionRef = React2.useRef(action);
1661
- const onSuccessRef = React2.useRef(onSuccess);
1662
- const onErrorRef = React2.useRef(onError);
1663
- const filtersRef = React2.useRef(filters);
1664
- actionRef.current = action;
1665
- onSuccessRef.current = onSuccess;
1666
- onErrorRef.current = onError;
1667
- filtersRef.current = filters;
1668
- const getInput = React2.useCallback(() => {
1669
- const input = {
1670
- action: "FETCH",
1671
- page,
1672
- limit,
1673
- sorts,
1674
- filter: debouncedFilter,
1675
- query
1676
- };
1677
- if (filtersRef.current) {
1678
- input.filterConfig = filtersRef.current.reduce((acc, f) => {
1679
- if (f.configuration) acc[f.id] = f.configuration;
1680
- return acc;
1681
- }, {});
1682
- }
1683
- return input;
1684
- }, [page, limit, sorts, debouncedFilter, query]);
1685
- const fetchData = React2.useCallback(async () => {
1686
- const fetchId = ++fetchIdRef.current;
1687
- setIsLoading(true);
1688
- setError(null);
1689
- try {
1690
- const input = getInput();
1691
- const result = await actionRef.current(input);
1692
- if (fetchId !== fetchIdRef.current || !mounted.current) return;
1693
- setItems(result.items);
1694
- setTotal(result.documentTotal);
1695
- onSuccessRef.current?.(result);
1696
- } catch (err) {
1697
- if (fetchId !== fetchIdRef.current || !mounted.current) return;
1698
- const fetchError = err instanceof Error ? err : new Error(String(err));
1699
- setError(fetchError);
1700
- onErrorRef.current?.(fetchError);
1701
- } finally {
1702
- if (fetchId === fetchIdRef.current && mounted.current) {
1703
- setIsLoading(false);
1704
- }
1705
- }
1706
- }, [getInput]);
1707
- React2.useEffect(() => {
1708
- if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
1709
- debounceTimerRef.current = setTimeout(() => {
1710
- setDebouncedFilter(filter);
1711
- }, debounceDelay);
1712
- return () => {
1713
- if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
1714
- };
1715
- }, [filter, debounceDelay]);
1716
- const setPage = React2.useCallback((newPage) => setPageState(newPage), []);
1717
- const setLimit = React2.useCallback((newLimit) => {
1718
- setLimitState(newLimit);
1719
- setPageState(1);
1720
- }, []);
1721
- const setSort = React2.useCallback((path, value, append = false) => {
1722
- setSortsState((prev) => {
1723
- if (value === null) return prev.filter((s) => s.path !== path);
1724
- if (!append) return [{ path, value }];
1725
- const existing = prev.find((s) => s.path === path);
1726
- if (existing) return prev.map((s) => s.path === path ? { ...s, value } : s);
1727
- return [...prev, { path, value }];
1728
- });
1729
- }, []);
1730
- const setSorts = React2.useCallback((newSorts) => setSortsState(newSorts), []);
1731
- const setFilter = React2.useCallback((key, value) => {
1732
- setFilterState((prev) => ({ ...prev, [key]: value }));
1733
- setPageState(1);
1734
- }, []);
1735
- const setFilters = React2.useCallback((filters2) => {
1736
- setFilterState((prev) => ({ ...prev, ...filters2 }));
1737
- setPageState(1);
1738
- }, []);
1739
- const clearFilters = React2.useCallback(() => {
1740
- setFilterState({});
1741
- setPageState(1);
1742
- }, []);
1743
- const setQuery = React2.useCallback((key, value) => {
1744
- setQueryState((prev) => ({ ...prev, [key]: value }));
1745
- setPageState(1);
1746
- }, []);
1747
- const refresh = React2.useCallback(async () => {
1748
- await fetchData();
1749
- }, [fetchData]);
1750
- const setItemsAction = React2.useCallback((nextItems) => {
1751
- setItems(nextItems);
1752
- }, []);
1753
- const setItemAt = React2.useCallback((index, item) => {
1754
- setItems((prev) => {
1755
- if (index < 0 || index >= prev.length) return prev;
1756
- const next = [...prev];
1757
- next[index] = item;
1758
- return next;
1759
- });
1760
- }, []);
1761
- const itemUpdate = React2.useCallback((props2) => {
1762
- setItems((prev) => {
1763
- if ("index" in props2) {
1764
- const { index, data } = props2;
1765
- if (index < 0 || index >= prev.length) return prev;
1766
- const next = [...prev];
1767
- next[index] = { ...next[index], ...data };
1768
- return next;
1769
- } else {
1770
- const { id, data } = props2;
1771
- const index = prev.findIndex((item) => {
1772
- const itemWithId = item;
1773
- return itemWithId.id === id;
1774
- });
1775
- if (index === -1) return prev;
1776
- const next = [...prev];
1777
- next[index] = { ...next[index], ...data };
1778
- return next;
1779
- }
1780
- });
1781
- }, []);
1782
- const deleteItemAt = React2.useCallback((index) => {
1783
- setItems((prev) => prev.filter((_, i) => i !== index));
1784
- }, []);
1785
- const itemDelete = React2.useCallback((props2) => {
1786
- setItems((prev) => {
1787
- if ("index" in props2) {
1788
- const { index } = props2;
1789
- if (index < 0 || index >= prev.length) return prev;
1790
- return prev.filter((_, i) => i !== index);
1791
- } else {
1792
- const { id } = props2;
1793
- return prev.filter((item) => {
1794
- const itemWithId = item;
1795
- return itemWithId.id !== id;
1796
- });
1797
- }
1798
- });
1799
- }, []);
1800
- const itemPush = React2.useCallback((item, position = 1) => {
1801
- setItems((prev) => position === 0 ? [item, ...prev] : [...prev, item]);
1802
- }, []);
1803
- const deleteBulk = React2.useCallback((itemsToDelete) => {
1804
- if (itemsToDelete.length === 0) return;
1805
- const toDelete = new Set(itemsToDelete);
1806
- setItems((prev) => prev.filter((it) => !toDelete.has(it)));
1807
- }, []);
1808
- const reset = React2.useCallback(() => {
1809
- setPageState(initialPage);
1810
- setLimitState(initialLimit);
1811
- setSortsState(initialSorts);
1812
- setFilterState(initialFilter);
1813
- setDebouncedFilter(initialFilter);
1814
- setQueryState(initialQuery);
1815
- }, [initialPage, initialLimit, initialSorts, initialFilter, initialQuery]);
1816
- React2.useEffect(() => {
1817
- if (memoryMode !== "search-params" || typeof window === "undefined") return;
1818
- const urlState = parseUrlParams(window.location.search);
1819
- if (Object.keys(urlState).length > 0) {
1820
- if (urlState.page) setPageState(urlState.page);
1821
- if (urlState.limit) setLimitState(urlState.limit);
1822
- if (urlState.sorts) setSortsState(urlState.sorts);
1823
- if (urlState.filter) {
1824
- setFilterState((prev) => ({ ...prev, ...urlState.filter }));
1825
- setDebouncedFilter((prev) => ({ ...prev, ...urlState.filter }));
1826
- }
1827
- if (urlState.query) setQueryState((prev) => ({ ...prev, ...urlState.query }));
1828
- }
1829
- const handlePopState = () => {
1830
- const newUrlState = parseUrlParams(window.location.search);
1831
- setPageState(newUrlState.page ?? initialPage);
1832
- setLimitState(newUrlState.limit ?? initialLimit);
1833
- setSortsState(newUrlState.sorts ?? initialSorts);
1834
- setFilterState({ ...initialFilter, ...newUrlState.filter });
1835
- setDebouncedFilter({ ...initialFilter, ...newUrlState.filter });
1836
- setQueryState({ ...initialQuery, ...newUrlState.query });
1837
- };
1838
- window.addEventListener("popstate", handlePopState);
1839
- return () => window.removeEventListener("popstate", handlePopState);
1840
- }, [memoryMode, initialPage, initialLimit, initialSorts, initialFilter, initialQuery]);
1841
- React2.useEffect(() => {
1842
- if (memoryMode !== "search-params" || typeof window === "undefined") return;
1843
- const params = stateToUrlParams({ page, limit, sorts, filter, query });
1844
- const newSearch = params.toString();
1845
- const currentSearch = window.location.search.slice(1);
1846
- if (newSearch !== currentSearch) {
1847
- const newUrl = newSearch ? `?${newSearch}` : window.location.pathname;
1848
- window.history.pushState(null, "", newUrl);
1849
- }
1850
- }, [page, limit, sorts, filter, query, memoryMode]);
1851
- React2.useEffect(() => {
1852
- if (autoFetch) fetchData();
1853
- }, [page, limit, sorts, debouncedFilter, query, autoFetch, fetchData]);
1854
- React2.useEffect(() => {
1855
- mounted.current = true;
1856
- return () => {
1857
- mounted.current = false;
1858
- };
1859
- }, []);
1860
- const hasNextPage = page * limit < total;
1861
- return {
1862
- page,
1863
- limit,
1864
- sorts,
1865
- filter,
1866
- filterConfig: filters?.reduce((acc, f) => {
1867
- if (f.configuration) acc[f.id] = f.configuration;
1868
- return acc;
1869
- }, {}),
1870
- query,
1871
- items,
1872
- total,
1873
- state: { isLoading, error, hasNextPage },
1874
- actions: {
1875
- setPage,
1876
- setLimit,
1877
- setSort,
1878
- setSorts,
1879
- setFilter,
1880
- setFilters,
1881
- clearFilters,
1882
- setQuery,
1883
- refresh,
1884
- reset,
1885
- getInput,
1886
- setItems: setItemsAction,
1887
- setItemAt,
1888
- itemUpdate,
1889
- deleteItemAt,
1890
- itemDelete,
1891
- itemPush,
1892
- deleteBulk
1893
- }
1894
- };
1895
- };
1896
- var useSelection = (initialSelected = []) => {
1897
- const [selectedIds, setSelectedIds] = React2.useState(new Set(initialSelected));
1898
- const select = React2.useCallback((id) => {
1899
- setSelectedIds((prev) => new Set(prev).add(id));
1900
- }, []);
1901
- const deselect = React2.useCallback((id) => {
1902
- setSelectedIds((prev) => {
1903
- const next = new Set(prev);
1904
- next.delete(id);
1905
- return next;
1906
- });
1907
- }, []);
1908
- const toggle = React2.useCallback((id) => {
1909
- setSelectedIds((prev) => {
1910
- const next = new Set(prev);
1911
- if (next.has(id)) next.delete(id);
1912
- else next.add(id);
1913
- return next;
1914
- });
1915
- }, []);
1916
- const selectAll = React2.useCallback((ids) => {
1917
- setSelectedIds(new Set(ids));
1918
- }, []);
1919
- const deselectAll = React2.useCallback(() => {
1920
- setSelectedIds(/* @__PURE__ */ new Set());
1921
- }, []);
1922
- const toggleAll = React2.useCallback((ids) => {
1923
- setSelectedIds((prev) => {
1924
- if (ids.every((id) => prev.has(id))) return /* @__PURE__ */ new Set();
1925
- return new Set(ids);
1926
- });
1927
- }, []);
1928
- const isSelected = React2.useCallback((id) => selectedIds.has(id), [selectedIds]);
1929
- const getSelectedArray = React2.useCallback(() => Array.from(selectedIds), [selectedIds]);
1930
- const isAllSelected = React2.useMemo(() => selectedIds.size > 0, [selectedIds.size]);
1931
- const isIndeterminate = React2.useMemo(() => false, []);
1932
- return {
1933
- selectedIds,
1934
- isAllSelected,
1935
- isIndeterminate,
1936
- select,
1937
- deselect,
1938
- toggle,
1939
- selectAll,
1940
- deselectAll,
1941
- toggleAll,
1942
- isSelected,
1943
- getSelectedArray
1944
- };
1945
- };
1946
- var useSelectionWithTotal = (totalItems, initialSelected = []) => {
1947
- const selection = useSelection(initialSelected);
1948
- const isAllSelected = React2.useMemo(
1949
- () => totalItems.length > 0 && totalItems.every((id) => selection.selectedIds.has(id)),
1950
- [totalItems, selection.selectedIds]
1951
- );
1952
- const isIndeterminate = React2.useMemo(
1953
- () => selection.selectedIds.size > 0 && selection.selectedIds.size < totalItems.length,
1954
- [totalItems.length, selection.selectedIds.size]
1955
- );
1956
- const toggleAll = React2.useCallback(() => {
1957
- if (isAllSelected) selection.deselectAll();
1958
- else selection.selectAll(totalItems);
1959
- }, [isAllSelected, selection, totalItems]);
1960
- return {
1961
- ...selection,
1962
- isAllSelected,
1963
- isIndeterminate,
1964
- toggleAll
1965
- };
1966
- };
1967
- var range = (start, end) => Array.from({ length: end - start + 1 }, (_, idx) => idx + start);
1968
- var usePagination = (props) => {
1969
- const { page, limit, total, siblingCount = 1 } = props;
1970
- const paginationInfo = React2.useMemo(() => calculatePagination(page, limit, total), [page, limit, total]);
1971
- const pages = React2.useMemo(() => {
1972
- const { totalPages } = paginationInfo;
1973
- const totalPageNumbers = siblingCount * 2 + 5;
1974
- if (totalPageNumbers >= totalPages) return range(1, totalPages);
1975
- const leftSiblingIndex = Math.max(page - siblingCount, 1);
1976
- const rightSiblingIndex = Math.min(page + siblingCount, totalPages);
1977
- const shouldShowLeftEllipsis = leftSiblingIndex > 2;
1978
- const shouldShowRightEllipsis = rightSiblingIndex < totalPages - 1;
1979
- if (!shouldShowLeftEllipsis && shouldShowRightEllipsis) {
1980
- const leftRange = range(1, 3 + 2 * siblingCount);
1981
- return [...leftRange, "ellipsis", totalPages];
1982
- }
1983
- if (shouldShowLeftEllipsis && !shouldShowRightEllipsis) {
1984
- const rightRange = range(totalPages - (3 + 2 * siblingCount) + 1, totalPages);
1985
- return [1, "ellipsis", ...rightRange];
1986
- }
1987
- if (shouldShowLeftEllipsis && shouldShowRightEllipsis) {
1988
- const middleRange = range(leftSiblingIndex, rightSiblingIndex);
1989
- return [1, "ellipsis", ...middleRange, "ellipsis", totalPages];
1990
- }
1991
- return range(1, totalPages);
1992
- }, [paginationInfo, page, siblingCount]);
1993
- return {
1994
- ...paginationInfo,
1995
- pages,
1996
- firstPage: 1,
1997
- lastPage: paginationInfo.totalPages
1998
- };
1999
- };
2000
- var createDataKitContext = () => {
2001
- const Context = React2.createContext(null);
2002
- const DataKitProvider = (props) => {
2003
- const { value, children } = props;
2004
- return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
2005
- };
2006
- const useDataKitContext = () => {
2007
- const context = React2.useContext(Context);
2008
- if (!context) {
2009
- throw new Error("useDataKitContext must be used within a DataKitProvider");
2010
- }
2011
- return context;
2012
- };
2013
- return { DataKitProvider, useDataKitContext, Context };
2014
- };
2015
- var {
2016
- DataKitProvider: DefaultDataKitProvider,
2017
- useDataKitContext: useDefaultDataKitContext,
2018
- Context: DefaultDataKitContext
2019
- } = createDataKitContext();
2020
- function Table({ className, ...props }) {
2021
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "table-container", className: "ndk:relative ndk:w-full ndk:overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
2022
- "table",
2023
- {
2024
- "data-slot": "table",
2025
- className: cn("ndk:w-full ndk:caption-bottom ndk:text-sm", className),
2026
- ...props
2027
- }
2028
- ) });
2029
- }
2030
- function TableHeader({ className, ...props }) {
2031
- return /* @__PURE__ */ jsxRuntime.jsx(
2032
- "thead",
2033
- {
2034
- "data-slot": "table-header",
2035
- className: cn("ndk:[&_tr]:border-b", className),
2036
- ...props
2037
- }
2038
- );
2039
- }
2040
- function TableBody({ className, ...props }) {
2041
- return /* @__PURE__ */ jsxRuntime.jsx(
2042
- "tbody",
2043
- {
2044
- "data-slot": "table-body",
2045
- className: cn("ndk:[&_tr:last-child]:border-0", className),
2046
- ...props
2047
- }
2048
- );
2049
- }
2050
- function TableRow({ className, ...props }) {
2051
- return /* @__PURE__ */ jsxRuntime.jsx(
2052
- "tr",
2053
- {
2054
- "data-slot": "table-row",
2055
- className: cn(
2056
- "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",
2057
- className
2058
- ),
2059
- ...props
2060
- }
2061
- );
2062
- }
2063
- function TableHead({ className, ...props }) {
2064
- return /* @__PURE__ */ jsxRuntime.jsx(
2065
- "th",
2066
- {
2067
- "data-slot": "table-head",
2068
- className: cn(
2069
- "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]",
2070
- className
2071
- ),
2072
- ...props
2073
- }
2074
- );
2075
- }
2076
- function TableCell({ className, ...props }) {
2077
- return /* @__PURE__ */ jsxRuntime.jsx(
2078
- "td",
2079
- {
2080
- "data-slot": "table-cell",
2081
- className: cn(
2082
- "ndk:p-2 ndk:align-middle ndk:whitespace-nowrap ndk:[&:has([role=checkbox])]:pr-0 ndk:[&>[role=checkbox]]:translate-y-[2px]",
2083
- className
2084
- ),
2085
- ...props
2086
- }
2087
- );
2088
- }
2089
- function Checkbox({
2090
- className,
2091
- ...props
2092
- }) {
2093
- return /* @__PURE__ */ jsxRuntime.jsx(
2094
- CheckboxPrimitive__namespace.Root,
2095
- {
2096
- "data-slot": "checkbox",
2097
- className: cn(
2098
- "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",
2099
- className
2100
- ),
2101
- ...props,
2102
- children: /* @__PURE__ */ jsxRuntime.jsx(
2103
- CheckboxPrimitive__namespace.Indicator,
2104
- {
2105
- "data-slot": "checkbox-indicator",
2106
- className: "ndk:grid ndk:place-content-center ndk:text-current ndk:transition-none",
2107
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "ndk:size-3.5" })
2108
- }
2109
- )
2110
- }
2111
- );
2112
- }
2113
- function Popover(props) {
2114
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
2115
- }
2116
- function PopoverTrigger(props) {
2117
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
2118
- }
2119
- function PopoverContent({
2120
- className,
2121
- align = "center",
2122
- sideOffset = 4,
2123
- container,
2124
- ...props
2125
- }) {
2126
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
2127
- PopoverPrimitive__namespace.Content,
2128
- {
2129
- "data-slot": "popover-content",
2130
- align,
2131
- sideOffset,
2132
- className: cn(
2133
- "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",
2134
- className
2135
- ),
2136
- ...props
2137
- }
2138
- ) });
2139
- }
2140
- function DropdownMenu({
2141
- ...props
2142
- }) {
2143
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
2144
- }
2145
- function DropdownMenuTrigger({
2146
- ...props
2147
- }) {
2148
- return /* @__PURE__ */ jsxRuntime.jsx(
2149
- DropdownMenuPrimitive__namespace.Trigger,
2150
- {
2151
- "data-slot": "dropdown-menu-trigger",
2152
- ...props
2153
- }
2154
- );
2155
- }
2156
- function DropdownMenuContent({
2157
- className,
2158
- sideOffset = 4,
2159
- container,
2160
- ...props
2161
- }) {
2162
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
2163
- DropdownMenuPrimitive__namespace.Content,
2164
- {
2165
- "data-slot": "dropdown-menu-content",
2166
- sideOffset,
2167
- className: cn(
2168
- "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",
2169
- className
2170
- ),
2171
- ...props
2172
- }
2173
- ) });
2174
- }
2175
- function DropdownMenuItem({
2176
- className,
2177
- inset,
2178
- variant = "default",
2179
- ...props
2180
- }) {
2181
- return /* @__PURE__ */ jsxRuntime.jsx(
2182
- DropdownMenuPrimitive__namespace.Item,
2183
- {
2184
- "data-slot": "dropdown-menu-item",
2185
- "data-inset": inset,
2186
- "data-variant": variant,
2187
- className: cn(
2188
- "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",
2189
- className
2190
- ),
2191
- ...props
2192
- }
2193
- );
2194
- }
2195
- function DropdownMenuSeparator({
2196
- className,
2197
- ...props
2198
- }) {
2199
- return /* @__PURE__ */ jsxRuntime.jsx(
2200
- DropdownMenuPrimitive__namespace.Separator,
2201
- {
2202
- "data-slot": "dropdown-menu-separator",
2203
- className: cn("ndk:bg-gray-100 ndk:dark:bg-gray-900 ndk:-mx-1 ndk:my-1 ndk:h-px", className),
2204
- ...props
2205
- }
2206
- );
2207
- }
2208
- var buttonVariants = classVarianceAuthority.cva(
2209
- "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",
2210
- {
2211
- variants: {
2212
- variant: {
2213
- 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",
2214
- destructive: "ndk:bg-red-600 ndk:text-white ndk:hover:bg-red-700 ndk:dark:bg-red-600 ndk:dark:hover:bg-red-500",
2215
- 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",
2216
- 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",
2217
- ghost: "ndk:hover:bg-gray-100 ndk:hover:text-gray-900 ndk:dark:hover:bg-gray-900 ndk:dark:hover:text-gray-100",
2218
- link: "ndk:text-gray-900 ndk:underline-offset-4 ndk:hover:underline ndk:dark:text-gray-100"
2219
- },
2220
- size: {
2221
- default: "ndk:h-9 ndk:px-4 ndk:py-2 ndk:has-[>svg]:px-3",
2222
- sm: "ndk:h-8 ndk:rounded-md ndk:gap-1.5 ndk:px-3 ndk:has-[>svg]:px-2.5",
2223
- lg: "ndk:h-10 ndk:rounded-md ndk:px-6 ndk:has-[>svg]:px-4",
2224
- icon: "ndk:size-9",
2225
- "icon-sm": "ndk:size-8",
2226
- "icon-lg": "ndk:size-10"
2227
- }
2228
- },
2229
- defaultVariants: {
2230
- variant: "default",
2231
- size: "default"
2232
- }
2233
- }
2234
- );
2235
- var Button = React2__namespace.forwardRef(function Button2({
2236
- className,
2237
- variant = "default",
2238
- size = "default",
2239
- asChild = false,
2240
- ...props
2241
- }, ref) {
2242
- const Comp = asChild ? reactSlot.Slot : "button";
2243
- return /* @__PURE__ */ jsxRuntime.jsx(
2244
- Comp,
2245
- {
2246
- ref,
2247
- "data-slot": "button",
2248
- "data-variant": variant,
2249
- "data-size": size,
2250
- className: cn(buttonVariants({ variant, size, className })),
2251
- ...props
2252
- }
2253
- );
216
+ Object.defineProperty(exports, "DataKit", {
217
+ enumerable: true,
218
+ get: function () { return chunkCGB4WIAS_cjs.DataKit; }
2254
219
  });
2255
- Button.displayName = "Button";
2256
- function Pagination({ className, ...props }) {
2257
- return /* @__PURE__ */ jsxRuntime.jsx(
2258
- "nav",
2259
- {
2260
- role: "navigation",
2261
- "aria-label": "pagination",
2262
- "data-slot": "pagination",
2263
- className: cn("ndk:flex", className),
2264
- ...props
2265
- }
2266
- );
2267
- }
2268
- function PaginationContent({
2269
- className,
2270
- ...props
2271
- }) {
2272
- return /* @__PURE__ */ jsxRuntime.jsx(
2273
- "ul",
2274
- {
2275
- "data-slot": "pagination-content",
2276
- className: cn("ndk:flex ndk:flex-row ndk:items-center ndk:gap-1", className),
2277
- ...props
2278
- }
2279
- );
2280
- }
2281
- function PaginationItem({ ...props }) {
2282
- return /* @__PURE__ */ jsxRuntime.jsx("li", { "data-slot": "pagination-item", ...props });
2283
- }
2284
- function PaginationLink({
2285
- className,
2286
- isActive,
2287
- size = "icon",
2288
- type = "button",
2289
- ...props
2290
- }) {
2291
- return /* @__PURE__ */ jsxRuntime.jsx(
2292
- "button",
2293
- {
2294
- "aria-current": isActive ? "page" : void 0,
2295
- "data-slot": "pagination-link",
2296
- "data-active": isActive ? "true" : "false",
2297
- className: cn(
2298
- buttonVariants({
2299
- variant: isActive ? "outline" : "ghost",
2300
- size
2301
- }),
2302
- className
2303
- ),
2304
- type,
2305
- ...props
2306
- }
2307
- );
2308
- }
2309
- function PaginationPrevious({
2310
- className,
2311
- ...props
2312
- }) {
2313
- return /* @__PURE__ */ jsxRuntime.jsxs(
2314
- PaginationLink,
2315
- {
2316
- "aria-label": "Go to previous page",
2317
- size: "default",
2318
- className: cn("ndk:gap-1 ndk:px-2.5 ndk:sm:pl-2.5", className),
2319
- ...props,
2320
- children: [
2321
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "ndk:size-4", "aria-hidden": "true" }),
2322
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ndk:hidden ndk:sm:block", children: "Previous" })
2323
- ]
2324
- }
2325
- );
2326
- }
2327
- function PaginationNext({
2328
- className,
2329
- ...props
2330
- }) {
2331
- return /* @__PURE__ */ jsxRuntime.jsxs(
2332
- PaginationLink,
2333
- {
2334
- "aria-label": "Go to next page",
2335
- size: "default",
2336
- className: cn("ndk:gap-1 ndk:px-2.5 ndk:sm:pr-2.5", className),
2337
- ...props,
2338
- children: [
2339
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ndk:hidden ndk:sm:block", children: "Next" }),
2340
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ndk:size-4", "aria-hidden": "true" })
2341
- ]
2342
- }
2343
- );
2344
- }
2345
- function PaginationEllipsis({
2346
- className,
2347
- ...props
2348
- }) {
2349
- return /* @__PURE__ */ jsxRuntime.jsxs(
2350
- "span",
2351
- {
2352
- "aria-hidden": "true",
2353
- "data-slot": "pagination-ellipsis",
2354
- className: cn("ndk:flex ndk:size-9 ndk:items-center ndk:justify-center", className),
2355
- ...props,
2356
- children: [
2357
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "ndk:size-4", "aria-hidden": "true" }),
2358
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ndk:sr-only", children: "More pages" })
2359
- ]
2360
- }
2361
- );
2362
- }
2363
- function Select({
2364
- ...props
2365
- }) {
2366
- return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
2367
- }
2368
- function SelectValue({
2369
- ...props
2370
- }) {
2371
- return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { "data-slot": "select-value", ...props });
2372
- }
2373
- function SelectTrigger({
2374
- className,
2375
- size = "default",
2376
- children,
2377
- ...props
2378
- }) {
2379
- return /* @__PURE__ */ jsxRuntime.jsxs(
2380
- SelectPrimitive__namespace.Trigger,
2381
- {
2382
- "data-slot": "select-trigger",
2383
- "data-size": size,
2384
- className: cn(
2385
- "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",
2386
- className
2387
- ),
2388
- ...props,
2389
- children: [
2390
- children,
2391
- /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "ndk:size-4 ndk:opacity-50" }) })
2392
- ]
2393
- }
2394
- );
2395
- }
2396
- function SelectContent({
2397
- className,
2398
- children,
2399
- position = "item-aligned",
2400
- align = "center",
2401
- container,
2402
- ...props
2403
- }) {
2404
- return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
2405
- SelectPrimitive__namespace.Content,
2406
- {
2407
- "data-slot": "select-content",
2408
- className: cn(
2409
- "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",
2410
- 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",
2411
- className
2412
- ),
2413
- position,
2414
- align,
2415
- ...props,
2416
- children: [
2417
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
2418
- /* @__PURE__ */ jsxRuntime.jsx(
2419
- SelectPrimitive__namespace.Viewport,
2420
- {
2421
- className: cn(
2422
- "ndk:p-1",
2423
- position === "popper" && "ndk:h-[var(--radix-select-trigger-height)] ndk:w-full ndk:min-w-[var(--radix-select-trigger-width)] ndk:scroll-my-1"
2424
- ),
2425
- children
2426
- }
2427
- ),
2428
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
2429
- ]
2430
- }
2431
- ) });
2432
- }
2433
- function SelectItem({
2434
- className,
2435
- children,
2436
- ...props
2437
- }) {
2438
- return /* @__PURE__ */ jsxRuntime.jsxs(
2439
- SelectPrimitive__namespace.Item,
2440
- {
2441
- "data-slot": "select-item",
2442
- className: cn(
2443
- "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",
2444
- className
2445
- ),
2446
- ...props,
2447
- children: [
2448
- /* @__PURE__ */ jsxRuntime.jsx(
2449
- "span",
2450
- {
2451
- "data-slot": "select-item-indicator",
2452
- className: "ndk:absolute ndk:right-2 ndk:flex ndk:size-3.5 ndk:items-center ndk:justify-center",
2453
- children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "ndk:size-4" }) })
2454
- }
2455
- ),
2456
- /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
2457
- ]
2458
- }
2459
- );
2460
- }
2461
- function SelectScrollUpButton({
2462
- className,
2463
- ...props
2464
- }) {
2465
- return /* @__PURE__ */ jsxRuntime.jsx(
2466
- SelectPrimitive__namespace.ScrollUpButton,
2467
- {
2468
- "data-slot": "select-scroll-up-button",
2469
- className: cn(
2470
- "ndk:flex ndk:cursor-default ndk:items-center ndk:justify-center ndk:py-1",
2471
- className
2472
- ),
2473
- ...props,
2474
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: "ndk:size-4" })
2475
- }
2476
- );
2477
- }
2478
- function SelectScrollDownButton({
2479
- className,
2480
- ...props
2481
- }) {
2482
- return /* @__PURE__ */ jsxRuntime.jsx(
2483
- SelectPrimitive__namespace.ScrollDownButton,
2484
- {
2485
- "data-slot": "select-scroll-down-button",
2486
- className: cn(
2487
- "ndk:flex ndk:cursor-default ndk:items-center ndk:justify-center ndk:py-1",
2488
- className
2489
- ),
2490
- ...props,
2491
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "ndk:size-4" })
2492
- }
2493
- );
2494
- }
2495
- var DataKitRoot = (props) => {
2496
- const {
2497
- action,
2498
- query,
2499
- table: columns,
2500
- filters = [],
2501
- selectable,
2502
- state: initialState,
2503
- limit: limitConfig,
2504
- className,
2505
- autoFetch = true,
2506
- debounce: debounce2 = 300,
2507
- bordered,
2508
- refetchInterval,
2509
- memory: memoryMode = "memory",
2510
- pagination: paginationType = "NUMBER",
2511
- controller,
2512
- sorts: defaultSorts = []
2513
- } = props;
2514
- const tableRef = React2.useRef(null);
2515
- const intervalRef = React2.useRef(null);
2516
- const [isVisible, setIsVisible] = React2.useState(false);
2517
- const [isFilterOpen, setIsFilterOpen] = React2.useState(false);
2518
- const [actionLoading, setActionLoading] = React2.useState(null);
2519
- const [actionsMenuOpen, setActionsMenuOpen] = React2.useState(false);
2520
- const [rowStates, setRowStates] = React2.useState(/* @__PURE__ */ new Map());
2521
- const [lastSelectedIndex, setLastSelectedIndex] = React2.useState(null);
2522
- const overlayContainer = tableRef.current;
2523
- const getRowState = React2.useCallback((rowId) => {
2524
- return rowStates.get(rowId) ?? initialState;
2525
- }, [rowStates, initialState]);
2526
- const setRowState = React2.useCallback((rowId, updater) => {
2527
- setRowStates((prev) => {
2528
- const current = prev.get(rowId) ?? initialState;
2529
- const newState = typeof updater === "function" ? updater(current) : updater;
2530
- const newMap = new Map(prev);
2531
- newMap.set(rowId, newState);
2532
- return newMap;
2533
- });
2534
- }, [initialState]);
2535
- const dataKit = useDataKit({
2536
- action,
2537
- filters,
2538
- autoFetch,
2539
- debounce: debounce2,
2540
- memory: memoryMode,
2541
- initial: {
2542
- limit: limitConfig?.default ?? 10,
2543
- query: query ?? {},
2544
- sorts: (() => {
2545
- const columnSorts = columns.reduce((acc, col) => {
2546
- if (col.sortable && col.sortable.default !== 0) {
2547
- acc.push({ path: col.sortable.path, value: col.sortable.default });
2548
- }
2549
- return acc;
2550
- }, []);
2551
- const columnPaths = new Set(columnSorts.map((s) => s.path));
2552
- const additionalSorts = defaultSorts.filter((s) => !columnPaths.has(s.path));
2553
- return [...columnSorts, ...additionalSorts];
2554
- })(),
2555
- filter: filters.reduce((acc, f) => {
2556
- if (f.defaultValue !== void 0) acc[f.id] = f.defaultValue;
2557
- return acc;
2558
- }, {})
2559
- }
2560
- });
2561
- const pagination = usePagination({ page: dataKit.page, limit: dataKit.limit, total: dataKit.total, siblingCount: 1 });
2562
- const selection = useSelectionWithTotal(dataKit.items.map((item) => item.id));
2563
- const selectedCount = selection.selectedIds.size;
2564
- const colSpan = columns.length + (selectable?.enabled ? 1 : 0);
2565
- const limitOptions = React2__namespace.default.useMemo(() => {
2566
- const standardOptions = [10, 25, 50, 100];
2567
- const currentLimit = dataKit.limit;
2568
- if (!standardOptions.includes(currentLimit)) {
2569
- return [...standardOptions, currentLimit].sort((a, b) => a - b);
2570
- }
2571
- return standardOptions;
2572
- }, [dataKit.limit]);
2573
- const handleSort = React2.useCallback((path) => {
2574
- const currentSort = dataKit.sorts.find((s) => s.path === path);
2575
- const nextValue = currentSort?.value === 1 ? -1 : currentSort?.value === -1 ? null : 1;
2576
- dataKit.actions.setSort(path, nextValue);
2577
- }, [dataKit.sorts, dataKit.actions]);
2578
- const handleSelectionAction = React2.useCallback(async (actionKey) => {
2579
- const action2 = selectable?.actions?.[actionKey];
2580
- if (!action2 || action2.type === "SEPARATOR" || actionLoading) return;
2581
- setActionLoading(actionKey);
2582
- setActionsMenuOpen(false);
2583
- try {
2584
- const selectedItems = dataKit.items.filter((item) => selection.isSelected(item.id));
2585
- const result = await action2.function(selectedItems);
2586
- if (result[0]) {
2587
- const data = result[1];
2588
- if (data.deselectAll) selection.deselectAll();
2589
- await dataKit.actions.refresh();
2590
- }
2591
- } catch (error) {
2592
- console.error("Selection action failed:", error);
2593
- } finally {
2594
- setActionLoading(null);
2595
- }
2596
- }, [selectable?.actions, actionLoading, dataKit.items, selection, dataKit.actions]);
2597
- const handleResetFilters = React2.useCallback(() => {
2598
- filters.forEach((f) => {
2599
- dataKit.actions.setFilter(f.id, f.defaultValue ?? (f.type === "BOOLEAN" ? false : ""));
2600
- });
2601
- }, [filters, dataKit.actions]);
2602
- const getSortFor = React2.useCallback((path) => dataKit.sorts.find((s) => s.path === path)?.value ?? null, [dataKit.sorts]);
2603
- const handleRowSelection = React2.useCallback((rowIndex, event) => {
2604
- if (event.shiftKey && lastSelectedIndex !== null) {
2605
- const start = Math.min(lastSelectedIndex, rowIndex);
2606
- const end = Math.max(lastSelectedIndex, rowIndex);
2607
- for (let i = start; i <= end; i++) {
2608
- const item = dataKit.items[i];
2609
- if (item && item.id !== void 0 && !selection.isSelected(item.id)) {
2610
- selection.select(item.id);
2611
- }
2612
- }
2613
- } else {
2614
- const item = dataKit.items[rowIndex];
2615
- if (item && item.id !== void 0) {
2616
- selection.toggle(item.id);
2617
- }
2618
- }
2619
- setLastSelectedIndex(rowIndex);
2620
- }, [lastSelectedIndex, dataKit.items, selection]);
2621
- React2.useEffect(() => {
2622
- if (controller) {
2623
- controller.current = {
2624
- itemPush: dataKit.actions.itemPush,
2625
- itemUpdate: dataKit.actions.itemUpdate,
2626
- itemDelete: dataKit.actions.itemDelete,
2627
- refetchData: dataKit.actions.refresh,
2628
- deleteBulk: dataKit.actions.deleteBulk,
2629
- getSelectedItems: () => dataKit.items.filter((item) => selection.isSelected(item.id)),
2630
- clearSelection: () => selection.deselectAll()
2631
- };
2632
- }
2633
- }, [controller, dataKit.actions, dataKit.items, selection]);
2634
- React2.useEffect(() => {
2635
- if (!tableRef.current || !refetchInterval) return;
2636
- const observer = new IntersectionObserver(
2637
- (entries) => entries[0] && setIsVisible(entries[0].isIntersecting),
2638
- { threshold: 0.1 }
2639
- );
2640
- const currentRef = tableRef.current;
2641
- observer.observe(currentRef);
2642
- return () => {
2643
- if (currentRef) observer.unobserve(currentRef);
2644
- };
2645
- }, [refetchInterval]);
2646
- React2.useEffect(() => {
2647
- if (intervalRef.current) {
2648
- clearInterval(intervalRef.current);
2649
- intervalRef.current = null;
2650
- }
2651
- if (refetchInterval && isVisible) {
2652
- intervalRef.current = setInterval(dataKit.actions.refresh, refetchInterval);
2653
- }
2654
- return () => {
2655
- if (intervalRef.current) clearInterval(intervalRef.current);
2656
- };
2657
- }, [refetchInterval, isVisible, dataKit.actions]);
2658
- React2.useEffect(() => {
2659
- selection.deselectAll();
2660
- }, [dataKit.items.length]);
2661
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: tableRef, className: `ndk:space-y-3 ${className ?? ""}`, children: [
2662
- /* @__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: [
2663
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", children: [
2664
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "ndk:mr-1.5 ndk:size-4" }),
2665
- "Filters"
2666
- ] }) }),
2667
- /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { align: "start", className: "ndk:w-80", container: overlayContainer, children: [
2668
- /* @__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: [
2669
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "ndk:text-sm ndk:font-medium", children: f.label }),
2670
- f.type === "TEXT" && /* @__PURE__ */ jsxRuntime.jsx(
2671
- "input",
2672
- {
2673
- type: "text",
2674
- 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",
2675
- placeholder: f.placeholder,
2676
- value: dataKit.filter[f.id] ?? "",
2677
- onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
2678
- }
2679
- ),
2680
- f.type === "SELECT" && /* @__PURE__ */ jsxRuntime.jsxs(
2681
- Select,
2682
- {
2683
- value: String(dataKit.filter[f.id] || "__all__"),
2684
- onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
2685
- children: [
2686
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
2687
- /* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { container: overlayContainer, children: [
2688
- /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "__all__", children: "All" }),
2689
- f.dataset?.map((d) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: d.id, children: d.label }, d.id))
2690
- ] })
2691
- ]
2692
- }
2693
- ),
2694
- f.type === "BOOLEAN" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ndk:flex ndk:items-center ndk:justify-between", children: /* @__PURE__ */ jsxRuntime.jsx(
2695
- Checkbox,
2696
- {
2697
- checked: Boolean(dataKit.filter[f.id]),
2698
- onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
2699
- }
2700
- ) })
2701
- ] }, f.id)) }),
2702
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:mt-4 ndk:flex ndk:justify-between ndk:border-t ndk:pt-3", children: [
2703
- /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
2704
- /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
2705
- ] })
2706
- ] })
2707
- ] }) }) }),
2708
- /* @__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: [
2709
- /* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
2710
- 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: [
2711
- /* @__PURE__ */ jsxRuntime.jsx(
2712
- Checkbox,
2713
- {
2714
- checked: selection.isIndeterminate ? "indeterminate" : selection.isAllSelected,
2715
- onCheckedChange: () => selection.toggleAll()
2716
- }
2717
- ),
2718
- selectable.actions && Object.keys(selectable.actions).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: actionsMenuOpen, onOpenChange: setActionsMenuOpen, children: [
2719
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2720
- Button,
2721
- {
2722
- variant: "ghost",
2723
- size: "icon",
2724
- className: "ndk:size-6",
2725
- disabled: selectedCount === 0 || !!actionLoading,
2726
- children: actionLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "ndk:size-4 ndk:animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "ndk:size-4" })
2727
- }
2728
- ) }),
2729
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", container: overlayContainer, children: Object.entries(selectable.actions).map(
2730
- ([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: [
2731
- action2.icon,
2732
- action2.name
2733
- ] }) }, key)
2734
- ) })
2735
- ] })
2736
- ] }) }),
2737
- 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(
2738
- Button,
2739
- {
2740
- variant: "ghost",
2741
- size: "sm",
2742
- className: "ndk:-ml-4 ndk:h-auto ndk:py-0",
2743
- onClick: () => handleSort(col.sortable.path),
2744
- children: [
2745
- React2__namespace.default.isValidElement(col.head) ? col.head.props.children : col.head,
2746
- getSortFor(col.sortable.path) === 1 && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "ndk:ml-1 ndk:size-4" }),
2747
- getSortFor(col.sortable.path) === -1 && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "ndk:ml-1 ndk:size-4" })
2748
- ]
2749
- }
2750
- ) }) : col.head }, idx))
2751
- ] }) }),
2752
- /* @__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: [
2753
- "Error: ",
2754
- dataKit.state.error.message
2755
- ] }) }) : 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) => {
2756
- const rowId = item.id ?? idx;
2757
- return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
2758
- selectable?.enabled && /* @__PURE__ */ jsxRuntime.jsx(TableCell, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(
2759
- Checkbox,
2760
- {
2761
- checked: selection.isSelected(item.id),
2762
- onCheckedChange: () => {
2763
- },
2764
- onClick: (e) => handleRowSelection(idx, e)
2765
- }
2766
- ) }),
2767
- columns.map((col, colIdx) => /* @__PURE__ */ jsxRuntime.jsx(React2__namespace.default.Fragment, { children: col.body({
2768
- item,
2769
- index: idx,
2770
- state: getRowState(rowId),
2771
- setState: (updater) => setRowState(rowId, updater),
2772
- setItem: (updatedItem) => dataKit.actions.setItemAt(idx, updatedItem),
2773
- deleteItem: () => dataKit.actions.deleteItemAt(idx)
2774
- }) }, colIdx))
2775
- ] }, rowId);
2776
- }) })
2777
- ] }) }),
2778
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-4 ndk:justify-between", children: [
2779
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-3", children: [
2780
- /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: String(dataKit.limit), onValueChange: (v) => dataKit.actions.setLimit(Number(v)), disabled: dataKit.state.isLoading, children: [
2781
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "ndk:w-16", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
2782
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { container: overlayContainer, children: limitOptions.map((v) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(v), children: v }, v)) })
2783
- ] }),
2784
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "ndk:text-sm ndk:text-muted-foreground ndk:whitespace-nowrap", children: [
2785
- "Page ",
2786
- dataKit.page,
2787
- " of ",
2788
- pagination.totalPages
2789
- ] }),
2790
- selectable?.enabled && selectedCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "ndk:text-sm ndk:text-foreground", children: [
2791
- selectedCount,
2792
- " selected"
2793
- ] })
2794
- ] }),
2795
- /* @__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: [
2796
- /* @__PURE__ */ jsxRuntime.jsx(
2797
- Button,
2798
- {
2799
- variant: "outline",
2800
- size: "icon",
2801
- disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2802
- onClick: () => dataKit.actions.setPage(dataKit.page - 1),
2803
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "ndk:size-4" })
2804
- }
2805
- ),
2806
- /* @__PURE__ */ jsxRuntime.jsx(
2807
- Button,
2808
- {
2809
- variant: "outline",
2810
- size: "icon",
2811
- disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2812
- onClick: () => dataKit.actions.setPage(dataKit.page + 1),
2813
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ndk:size-4" })
2814
- }
2815
- )
2816
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(Pagination, { className: "ndk:w-auto", children: /* @__PURE__ */ jsxRuntime.jsxs(PaginationContent, { children: [
2817
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(
2818
- PaginationPrevious,
2819
- {
2820
- disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2821
- onClick: () => dataKit.actions.setPage(dataKit.page - 1)
2822
- }
2823
- ) }),
2824
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
2825
- PaginationLink,
2826
- {
2827
- disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
2828
- onClick: () => dataKit.actions.setPage(dataKit.page - 1),
2829
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "ndk:size-4" })
2830
- }
2831
- ) }),
2832
- 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(
2833
- PaginationLink,
2834
- {
2835
- isActive: pageNum === dataKit.page,
2836
- disabled: dataKit.state.isLoading,
2837
- onClick: () => dataKit.actions.setPage(pageNum),
2838
- children: pageNum
2839
- }
2840
- ) }, idx)),
2841
- /* @__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 }) }),
2842
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(
2843
- PaginationNext,
2844
- {
2845
- disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2846
- onClick: () => dataKit.actions.setPage(dataKit.page + 1)
2847
- }
2848
- ) }),
2849
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
2850
- PaginationLink,
2851
- {
2852
- disabled: !pagination.hasNextPage || dataKit.state.isLoading,
2853
- onClick: () => dataKit.actions.setPage(dataKit.page + 1),
2854
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ndk:size-4" })
2855
- }
2856
- ) })
2857
- ] }) }) })
2858
- ] })
2859
- ] });
2860
- };
2861
- Object.assign(DataKitRoot, {
2862
- Cell: TableCell,
2863
- Head: TableHead
220
+ Object.defineProperty(exports, "DataKitContext", {
221
+ enumerable: true,
222
+ get: function () { return chunkCGB4WIAS_cjs.DefaultDataKitContext; }
223
+ });
224
+ Object.defineProperty(exports, "DataKitProvider", {
225
+ enumerable: true,
226
+ get: function () { return chunkCGB4WIAS_cjs.DefaultDataKitProvider; }
227
+ });
228
+ Object.defineProperty(exports, "calculatePagination", {
229
+ enumerable: true,
230
+ get: function () { return chunkCGB4WIAS_cjs.calculatePagination; }
231
+ });
232
+ Object.defineProperty(exports, "createDataKitContext", {
233
+ enumerable: true,
234
+ get: function () { return chunkCGB4WIAS_cjs.createDataKitContext; }
235
+ });
236
+ Object.defineProperty(exports, "createSearchFilter", {
237
+ enumerable: true,
238
+ get: function () { return chunkCGB4WIAS_cjs.createSearchFilter; }
239
+ });
240
+ Object.defineProperty(exports, "escapeRegex", {
241
+ enumerable: true,
242
+ get: function () { return chunkCGB4WIAS_cjs.escapeRegex; }
243
+ });
244
+ Object.defineProperty(exports, "useDataKitContext", {
245
+ enumerable: true,
246
+ get: function () { return chunkCGB4WIAS_cjs.useDefaultDataKitContext; }
247
+ });
248
+ Object.defineProperty(exports, "usePagination", {
249
+ enumerable: true,
250
+ get: function () { return chunkCGB4WIAS_cjs.usePagination; }
251
+ });
252
+ Object.defineProperty(exports, "useSelection", {
253
+ enumerable: true,
254
+ get: function () { return chunkCGB4WIAS_cjs.useSelection; }
255
+ });
256
+ Object.defineProperty(exports, "useSelectionWithTotal", {
257
+ enumerable: true,
258
+ get: function () { return chunkCGB4WIAS_cjs.useSelectionWithTotal; }
259
+ });
260
+ Object.defineProperty(exports, "debounce", {
261
+ enumerable: true,
262
+ get: function () { return chunkFDSJZI3C_cjs.debounce; }
263
+ });
264
+ Object.defineProperty(exports, "formatNumber", {
265
+ enumerable: true,
266
+ get: function () { return chunkFDSJZI3C_cjs.formatNumber; }
267
+ });
268
+ Object.defineProperty(exports, "getColumnValue", {
269
+ enumerable: true,
270
+ get: function () { return chunkFDSJZI3C_cjs.getColumnValue; }
271
+ });
272
+ Object.defineProperty(exports, "getNextSortValue", {
273
+ enumerable: true,
274
+ get: function () { return chunkFDSJZI3C_cjs.getNextSortValue; }
275
+ });
276
+ Object.defineProperty(exports, "getSortValue", {
277
+ enumerable: true,
278
+ get: function () { return chunkFDSJZI3C_cjs.getSortValue; }
279
+ });
280
+ Object.defineProperty(exports, "keyToSortEntries", {
281
+ enumerable: true,
282
+ get: function () { return chunkFDSJZI3C_cjs.keyToSortEntries; }
283
+ });
284
+ Object.defineProperty(exports, "sortEntriesToKey", {
285
+ enumerable: true,
286
+ get: function () { return chunkFDSJZI3C_cjs.sortEntriesToKey; }
287
+ });
288
+ Object.defineProperty(exports, "throttle", {
289
+ enumerable: true,
290
+ get: function () { return chunkFDSJZI3C_cjs.throttle; }
291
+ });
292
+ Object.defineProperty(exports, "useDataKit", {
293
+ enumerable: true,
294
+ get: function () { return chunkFDSJZI3C_cjs.useDataKit; }
2864
295
  });
2865
- var DataKitInner = (props, ref) => {
2866
- const {
2867
- action,
2868
- query,
2869
- filters = [],
2870
- limit: limitConfig,
2871
- defaultSort = [],
2872
- className,
2873
- autoFetch = true,
2874
- debounce: debounce2 = 300,
2875
- refetchInterval,
2876
- memory: memoryMode = "memory",
2877
- manual = false,
2878
- pagination: paginationType = "NUMBER",
2879
- children
2880
- } = props;
2881
- const containerRef = React2.useRef(null);
2882
- const intervalRef = React2.useRef(null);
2883
- const [isVisible, setIsVisible] = React2.useState(false);
2884
- const [isFilterOpen, setIsFilterOpen] = React2.useState(false);
2885
- const overlayContainer = containerRef.current;
2886
- const dataKit = useDataKit({
2887
- action,
2888
- filters,
2889
- autoFetch,
2890
- debounce: debounce2,
2891
- memory: memoryMode,
2892
- initial: {
2893
- limit: limitConfig?.default ?? 10,
2894
- query: query ?? {},
2895
- sorts: defaultSort,
2896
- filter: filters.reduce((acc, f) => {
2897
- if (f.defaultValue !== void 0) acc[f.id] = f.defaultValue;
2898
- return acc;
2899
- }, {})
2900
- }
2901
- });
2902
- const pagination = usePagination({ page: dataKit.page, limit: dataKit.limit, total: dataKit.total, siblingCount: 1 });
2903
- const limitOptions = React2__namespace.default.useMemo(() => {
2904
- const standardOptions = [10, 25, 50, 100];
2905
- const currentLimit = dataKit.limit;
2906
- if (!standardOptions.includes(currentLimit)) {
2907
- return [...standardOptions, currentLimit].sort((a, b) => a - b);
2908
- }
2909
- return standardOptions;
2910
- }, [dataKit.limit]);
2911
- React2__namespace.default.useImperativeHandle(ref, () => dataKit, [dataKit]);
2912
- const handleResetFilters = React2.useCallback(() => {
2913
- filters.forEach((f) => {
2914
- dataKit.actions.setFilter(f.id, f.defaultValue ?? (f.type === "BOOLEAN" ? false : ""));
2915
- });
2916
- }, [filters, dataKit.actions]);
2917
- React2.useEffect(() => {
2918
- if (!containerRef.current || !refetchInterval) return;
2919
- const observer = new IntersectionObserver(
2920
- (entries) => entries[0] && setIsVisible(entries[0].isIntersecting),
2921
- { threshold: 0.1 }
2922
- );
2923
- const currentRef = containerRef.current;
2924
- observer.observe(currentRef);
2925
- return () => {
2926
- if (currentRef) observer.unobserve(currentRef);
2927
- };
2928
- }, [refetchInterval]);
2929
- React2.useEffect(() => {
2930
- if (intervalRef.current) {
2931
- clearInterval(intervalRef.current);
2932
- intervalRef.current = null;
2933
- }
2934
- if (refetchInterval && isVisible) {
2935
- intervalRef.current = setInterval(dataKit.actions.refresh, refetchInterval);
2936
- }
2937
- return () => {
2938
- if (intervalRef.current) clearInterval(intervalRef.current);
2939
- };
2940
- }, [refetchInterval, isVisible, dataKit.actions]);
2941
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: `ndk:space-y-3 ${className ?? ""}`, children: [
2942
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:flex ndk:items-center ndk:justify-between ndk:gap-2", children: [
2943
- /* @__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: [
2944
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", children: [
2945
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "ndk:mr-1.5 ndk:size-4" }),
2946
- "Filters"
2947
- ] }) }),
2948
- /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { align: "start", className: "ndk:w-80", container: overlayContainer, children: [
2949
- /* @__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: [
2950
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "ndk:text-sm ndk:font-medium", children: f.label }),
2951
- f.type === "TEXT" && /* @__PURE__ */ jsxRuntime.jsx(
2952
- "input",
2953
- {
2954
- type: "text",
2955
- 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",
2956
- placeholder: f.placeholder,
2957
- value: dataKit.filter[f.id] ?? "",
2958
- onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
2959
- }
2960
- ),
2961
- f.type === "SELECT" && /* @__PURE__ */ jsxRuntime.jsxs(
2962
- Select,
2963
- {
2964
- value: String(dataKit.filter[f.id] || "__all__"),
2965
- onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
2966
- children: [
2967
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
2968
- /* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { container: overlayContainer, children: [
2969
- /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "__all__", children: "All" }),
2970
- f.dataset?.map((d) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: d.id, children: d.label }, d.id))
2971
- ] })
2972
- ]
2973
- }
2974
- ),
2975
- f.type === "BOOLEAN" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ndk:flex ndk:items-center ndk:justify-between", children: /* @__PURE__ */ jsxRuntime.jsx(
2976
- Checkbox,
2977
- {
2978
- checked: Boolean(dataKit.filter[f.id]),
2979
- onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
2980
- }
2981
- ) })
2982
- ] }, f.id)) }),
2983
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:mt-4 ndk:flex ndk:justify-between ndk:border-t ndk:pt-3", children: [
2984
- /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
2985
- /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
2986
- ] })
2987
- ] })
2988
- ] }) }),
2989
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-1", children: [
2990
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ndk:mr-2 ndk:text-sm ndk:text-muted-foreground", children: [
2991
- dataKit.items.length,
2992
- " of ",
2993
- dataKit.total
2994
- ] }),
2995
- /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: String(dataKit.limit), onValueChange: (v) => dataKit.actions.setLimit(Number(v)), disabled: dataKit.state.isLoading, children: [
2996
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "ndk:w-16", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
2997
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { container: overlayContainer, children: limitOptions.map((v) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(v), children: v }, v)) })
2998
- ] })
2999
- ] })
3000
- ] }),
3001
- 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) }),
3002
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:flex ndk:items-center ndk:justify-between", children: [
3003
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "ndk:text-sm ndk:text-muted-foreground", children: [
3004
- "Page ",
3005
- dataKit.page,
3006
- " of ",
3007
- pagination.totalPages
3008
- ] }),
3009
- paginationType === "SIMPLE" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ndk:flex ndk:items-center ndk:gap-1", children: [
3010
- /* @__PURE__ */ jsxRuntime.jsx(
3011
- Button,
3012
- {
3013
- variant: "outline",
3014
- size: "icon",
3015
- disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
3016
- onClick: () => dataKit.actions.setPage(dataKit.page - 1),
3017
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "ndk:size-4" })
3018
- }
3019
- ),
3020
- /* @__PURE__ */ jsxRuntime.jsx(
3021
- Button,
3022
- {
3023
- variant: "outline",
3024
- size: "icon",
3025
- disabled: !pagination.hasNextPage || dataKit.state.isLoading,
3026
- onClick: () => dataKit.actions.setPage(dataKit.page + 1),
3027
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ndk:size-4" })
3028
- }
3029
- )
3030
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(Pagination, { className: "ndk:mx-0 ndk:w-auto", children: /* @__PURE__ */ jsxRuntime.jsxs(PaginationContent, { children: [
3031
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(
3032
- PaginationPrevious,
3033
- {
3034
- disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
3035
- onClick: () => dataKit.actions.setPage(dataKit.page - 1)
3036
- }
3037
- ) }),
3038
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
3039
- PaginationLink,
3040
- {
3041
- disabled: !pagination.hasPrevPage || dataKit.state.isLoading,
3042
- onClick: () => dataKit.actions.setPage(dataKit.page - 1),
3043
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "ndk:size-4" })
3044
- }
3045
- ) }),
3046
- 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(
3047
- PaginationLink,
3048
- {
3049
- isActive: pageNum === dataKit.page,
3050
- disabled: dataKit.state.isLoading,
3051
- onClick: () => dataKit.actions.setPage(pageNum),
3052
- children: pageNum
3053
- }
3054
- ) }, idx)),
3055
- /* @__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 }) }),
3056
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:hidden ndk:sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(
3057
- PaginationNext,
3058
- {
3059
- disabled: !pagination.hasNextPage || dataKit.state.isLoading,
3060
- onClick: () => dataKit.actions.setPage(dataKit.page + 1)
3061
- }
3062
- ) }),
3063
- /* @__PURE__ */ jsxRuntime.jsx(PaginationItem, { className: "ndk:sm:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
3064
- PaginationLink,
3065
- {
3066
- disabled: !pagination.hasNextPage || dataKit.state.isLoading,
3067
- onClick: () => dataKit.actions.setPage(dataKit.page + 1),
3068
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ndk:size-4" })
3069
- }
3070
- ) })
3071
- ] }) })
3072
- ] })
3073
- ] });
3074
- };
3075
- var DataKit = React2__namespace.default.forwardRef(DataKitInner);
3076
-
3077
- exports.DataKit = DataKit;
3078
- exports.DataKitContext = DefaultDataKitContext;
3079
- exports.DataKitProvider = DefaultDataKitProvider;
3080
296
  exports.adapterMemory = adapterMemory;
3081
- exports.calculatePagination = calculatePagination;
3082
- exports.createDataKitContext = createDataKitContext;
3083
- exports.createSearchFilter = createSearchFilter;
3084
297
  exports.dataKitServerAction = dataKitServerAction;
3085
- exports.debounce = debounce;
3086
- exports.escapeRegex = escapeRegex;
3087
- exports.formatNumber = formatNumber;
3088
- exports.getColumnValue = getColumnValue;
3089
- exports.getNextSortValue = getNextSortValue;
3090
- exports.getSortValue = getSortValue;
3091
- exports.keyToSortEntries = keyToSortEntries;
3092
298
  exports.mongooseAdapter = mongooseAdapter;
3093
- exports.sortEntriesToKey = sortEntriesToKey;
3094
- exports.throttle = throttle;
3095
- exports.useDataKit = useDataKit;
3096
- exports.useDataKitContext = useDefaultDataKitContext;
3097
- exports.usePagination = usePagination;
3098
- exports.useSelection = useSelection;
3099
- exports.useSelectionWithTotal = useSelectionWithTotal;
3100
299
  //# sourceMappingURL=index.cjs.map
3101
300
  //# sourceMappingURL=index.cjs.map