@krak-stack/registry 0.1.56 → 0.1.58

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.
@@ -1,11 +1,13 @@
1
1
  // ../../src/components/ui/data-table.tsx
2
2
  import { useAtom, useAtomSet } from "@effect/atom-react";
3
3
  import { BrowserKeyValueStore } from "@effect/platform-browser";
4
- import { DateTime, Option, Schema } from "effect";
4
+ import { DateTime as DateTime2, Effect as Effect2, Option as Option2, Schema as Schema2, Stream } from "effect";
5
+ import { Csv } from "effect/encoding";
5
6
  import { AsyncResult, Atom } from "effect/reactivity";
6
7
  import {
7
8
  ArrowDown,
8
9
  ArrowUp,
10
+ Check,
9
11
  ChevronDown,
10
12
  ChevronRight as ChevronRight2,
11
13
  ChevronsUpDown,
@@ -15,6 +17,7 @@ import {
15
17
  FileText,
16
18
  GripVertical,
17
19
  LayoutGrid,
20
+ ListFilter,
18
21
  MoreHorizontal,
19
22
  Plus,
20
23
  RefreshCw,
@@ -29,8 +32,9 @@ import {
29
32
  isValidElement,
30
33
  useCallback,
31
34
  useContext,
35
+ useId as useId2,
32
36
  useLayoutEffect,
33
- useMemo,
37
+ useMemo as useMemo2,
34
38
  useRef,
35
39
  useState
36
40
  } from "react";
@@ -312,10 +316,196 @@ function Input({ className, type, ...props }) {
312
316
  });
313
317
  }
314
318
 
319
+ // ../../src/components/ui/field.tsx
320
+ import { useMemo } from "react";
321
+ import { cva as cva3 } from "class-variance-authority";
322
+
323
+ // ../../src/components/ui/label.tsx
324
+ import { jsx as jsx6 } from "react/jsx-runtime";
325
+ "use client";
326
+ function Label({ className, ...props }) {
327
+ return /* @__PURE__ */ jsx6("label", {
328
+ "data-slot": "label",
329
+ className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
330
+ ...props
331
+ });
332
+ }
333
+
334
+ // ../../src/components/ui/separator.tsx
335
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
336
+
337
+ // ../../src/components/ui/field.tsx
338
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
339
+ function FieldGroup({ className, ...props }) {
340
+ return /* @__PURE__ */ jsx7("div", {
341
+ "data-slot": "field-group",
342
+ className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", className),
343
+ ...props
344
+ });
345
+ }
346
+ var fieldVariants = cva3("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
347
+ variants: {
348
+ orientation: {
349
+ vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
350
+ horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
351
+ responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
352
+ }
353
+ },
354
+ defaultVariants: {
355
+ orientation: "vertical"
356
+ }
357
+ });
358
+ function Field({
359
+ className,
360
+ orientation = "vertical",
361
+ ...props
362
+ }) {
363
+ return /* @__PURE__ */ jsx7("div", {
364
+ role: "group",
365
+ "data-slot": "field",
366
+ "data-orientation": orientation,
367
+ className: cn(fieldVariants({ orientation }), className),
368
+ ...props
369
+ });
370
+ }
371
+ function FieldLabel({
372
+ className,
373
+ ...props
374
+ }) {
375
+ return /* @__PURE__ */ jsx7(Label, {
376
+ "data-slot": "field-label",
377
+ className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
378
+ ...props
379
+ });
380
+ }
381
+
382
+ // ../../src/components/ui/select.tsx
383
+ import { Select as SelectPrimitive } from "@base-ui/react/select";
384
+ import { ChevronDownIcon, CheckIcon as CheckIcon3, ChevronUpIcon } from "lucide-react";
385
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
386
+ "use client";
387
+ var Select = SelectPrimitive.Root;
388
+ function SelectGroup({ className, ...props }) {
389
+ return /* @__PURE__ */ jsx8(SelectPrimitive.Group, {
390
+ "data-slot": "select-group",
391
+ className: cn("scroll-my-1 p-1", className),
392
+ ...props
393
+ });
394
+ }
395
+ function SelectValue({ className, ...props }) {
396
+ return /* @__PURE__ */ jsx8(SelectPrimitive.Value, {
397
+ "data-slot": "select-value",
398
+ className: cn("flex flex-1 text-left", className),
399
+ ...props
400
+ });
401
+ }
402
+ function SelectTrigger({
403
+ className,
404
+ size = "default",
405
+ children,
406
+ ...props
407
+ }) {
408
+ return /* @__PURE__ */ jsxs3(SelectPrimitive.Trigger, {
409
+ "data-slot": "select-trigger",
410
+ "data-size": size,
411
+ className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
412
+ ...props,
413
+ children: [
414
+ children,
415
+ /* @__PURE__ */ jsx8(SelectPrimitive.Icon, {
416
+ render: /* @__PURE__ */ jsx8(ChevronDownIcon, {
417
+ className: "text-muted-foreground pointer-events-none size-4"
418
+ })
419
+ })
420
+ ]
421
+ });
422
+ }
423
+ function SelectContent({
424
+ className,
425
+ children,
426
+ side = "bottom",
427
+ sideOffset = 4,
428
+ align = "center",
429
+ alignOffset = 0,
430
+ alignItemWithTrigger = true,
431
+ ...props
432
+ }) {
433
+ return /* @__PURE__ */ jsx8(SelectPrimitive.Portal, {
434
+ children: /* @__PURE__ */ jsx8(SelectPrimitive.Positioner, {
435
+ side,
436
+ sideOffset,
437
+ align,
438
+ alignOffset,
439
+ alignItemWithTrigger,
440
+ className: "isolate z-50",
441
+ children: /* @__PURE__ */ jsxs3(SelectPrimitive.Popup, {
442
+ "data-slot": "select-content",
443
+ "data-align-trigger": alignItemWithTrigger,
444
+ className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
445
+ ...props,
446
+ children: [
447
+ /* @__PURE__ */ jsx8(SelectScrollUpButton, {}),
448
+ /* @__PURE__ */ jsx8(SelectPrimitive.List, {
449
+ children
450
+ }),
451
+ /* @__PURE__ */ jsx8(SelectScrollDownButton, {})
452
+ ]
453
+ })
454
+ })
455
+ });
456
+ }
457
+ function SelectItem({
458
+ className,
459
+ children,
460
+ ...props
461
+ }) {
462
+ return /* @__PURE__ */ jsxs3(SelectPrimitive.Item, {
463
+ "data-slot": "select-item",
464
+ className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
465
+ ...props,
466
+ children: [
467
+ /* @__PURE__ */ jsx8(SelectPrimitive.ItemText, {
468
+ className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
469
+ children
470
+ }),
471
+ /* @__PURE__ */ jsx8(SelectPrimitive.ItemIndicator, {
472
+ render: /* @__PURE__ */ jsx8("span", {
473
+ className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
474
+ }),
475
+ children: /* @__PURE__ */ jsx8(CheckIcon3, {
476
+ className: "pointer-events-none"
477
+ })
478
+ })
479
+ ]
480
+ });
481
+ }
482
+ function SelectScrollUpButton({
483
+ className,
484
+ ...props
485
+ }) {
486
+ return /* @__PURE__ */ jsx8(SelectPrimitive.ScrollUpArrow, {
487
+ "data-slot": "select-scroll-up-button",
488
+ className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
489
+ ...props,
490
+ children: /* @__PURE__ */ jsx8(ChevronUpIcon, {})
491
+ });
492
+ }
493
+ function SelectScrollDownButton({
494
+ className,
495
+ ...props
496
+ }) {
497
+ return /* @__PURE__ */ jsx8(SelectPrimitive.ScrollDownArrow, {
498
+ "data-slot": "select-scroll-down-button",
499
+ className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
500
+ ...props,
501
+ children: /* @__PURE__ */ jsx8(ChevronDownIcon, {})
502
+ });
503
+ }
504
+
315
505
  // ../../src/components/ui/loading.tsx
316
506
  import { Loader2 } from "lucide-react";
317
507
  import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
318
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
508
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
319
509
  var labels = {
320
510
  en: {
321
511
  loading: "Loading..."
@@ -333,10 +523,10 @@ function Loading({
333
523
  variant = "inline"
334
524
  }) {
335
525
  const locale = useKrakstackLocale(localeOverride);
336
- return /* @__PURE__ */ jsxs2("div", {
526
+ return /* @__PURE__ */ jsxs4("div", {
337
527
  className: cn("text-muted-foreground flex items-center justify-center gap-2 text-sm", variant === "centered" && "min-h-[50svh] w-full", className),
338
528
  children: [
339
- /* @__PURE__ */ jsx6(Loader2, {
529
+ /* @__PURE__ */ jsx9(Loader2, {
340
530
  className: "size-4 animate-spin"
341
531
  }),
342
532
  label ?? loadingLabel(locale, messages)
@@ -347,18 +537,18 @@ function Loading({
347
537
  // ../../src/components/ui/menubar.tsx
348
538
  import { Menu as MenuPrimitive2 } from "@base-ui/react/menu";
349
539
  import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";
350
- import { CheckIcon as CheckIcon3 } from "lucide-react";
351
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
540
+ import { CheckIcon as CheckIcon4 } from "lucide-react";
541
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
352
542
  "use client";
353
543
  function Menubar({ className, ...props }) {
354
- return /* @__PURE__ */ jsx7(MenubarPrimitive, {
544
+ return /* @__PURE__ */ jsx10(MenubarPrimitive, {
355
545
  "data-slot": "menubar",
356
546
  className: cn("flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs", className),
357
547
  ...props
358
548
  });
359
549
  }
360
550
  function MenubarMenu({ ...props }) {
361
- return /* @__PURE__ */ jsx7(DropdownMenu, {
551
+ return /* @__PURE__ */ jsx10(DropdownMenu, {
362
552
  "data-slot": "menubar-menu",
363
553
  ...props
364
554
  });
@@ -366,7 +556,7 @@ function MenubarMenu({ ...props }) {
366
556
  function MenubarGroup({
367
557
  ...props
368
558
  }) {
369
- return /* @__PURE__ */ jsx7(DropdownMenuGroup, {
559
+ return /* @__PURE__ */ jsx10(DropdownMenuGroup, {
370
560
  "data-slot": "menubar-group",
371
561
  ...props
372
562
  });
@@ -375,7 +565,7 @@ function MenubarTrigger({
375
565
  className,
376
566
  ...props
377
567
  }) {
378
- return /* @__PURE__ */ jsx7(DropdownMenuTrigger, {
568
+ return /* @__PURE__ */ jsx10(DropdownMenuTrigger, {
379
569
  "data-slot": "menubar-trigger",
380
570
  className: cn("flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted", className),
381
571
  ...props
@@ -388,7 +578,7 @@ function MenubarContent({
388
578
  sideOffset = 8,
389
579
  ...props
390
580
  }) {
391
- return /* @__PURE__ */ jsx7(DropdownMenuContent, {
581
+ return /* @__PURE__ */ jsx10(DropdownMenuContent, {
392
582
  "data-slot": "menubar-content",
393
583
  align,
394
584
  alignOffset,
@@ -403,7 +593,7 @@ function MenubarItem({
403
593
  variant = "default",
404
594
  ...props
405
595
  }) {
406
- return /* @__PURE__ */ jsx7(DropdownMenuItem, {
596
+ return /* @__PURE__ */ jsx10(DropdownMenuItem, {
407
597
  "data-slot": "menubar-item",
408
598
  "data-inset": inset,
409
599
  "data-variant": variant,
@@ -418,17 +608,17 @@ function MenubarCheckboxItem({
418
608
  inset,
419
609
  ...props
420
610
  }) {
421
- return /* @__PURE__ */ jsxs3(MenuPrimitive2.CheckboxItem, {
611
+ return /* @__PURE__ */ jsxs5(MenuPrimitive2.CheckboxItem, {
422
612
  "data-slot": "menubar-checkbox-item",
423
613
  "data-inset": inset,
424
614
  className: cn("relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
425
615
  checked,
426
616
  ...props,
427
617
  children: [
428
- /* @__PURE__ */ jsx7("span", {
618
+ /* @__PURE__ */ jsx10("span", {
429
619
  className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
430
- children: /* @__PURE__ */ jsx7(MenuPrimitive2.CheckboxItemIndicator, {
431
- children: /* @__PURE__ */ jsx7(CheckIcon3, {})
620
+ children: /* @__PURE__ */ jsx10(MenuPrimitive2.CheckboxItemIndicator, {
621
+ children: /* @__PURE__ */ jsx10(CheckIcon4, {})
432
622
  })
433
623
  }),
434
624
  children
@@ -438,7 +628,7 @@ function MenubarCheckboxItem({
438
628
  function MenubarRadioGroup({
439
629
  ...props
440
630
  }) {
441
- return /* @__PURE__ */ jsx7(DropdownMenuRadioGroup, {
631
+ return /* @__PURE__ */ jsx10(DropdownMenuRadioGroup, {
442
632
  "data-slot": "menubar-radio-group",
443
633
  ...props
444
634
  });
@@ -449,16 +639,16 @@ function MenubarRadioItem({
449
639
  inset,
450
640
  ...props
451
641
  }) {
452
- return /* @__PURE__ */ jsxs3(MenuPrimitive2.RadioItem, {
642
+ return /* @__PURE__ */ jsxs5(MenuPrimitive2.RadioItem, {
453
643
  "data-slot": "menubar-radio-item",
454
644
  "data-inset": inset,
455
645
  className: cn("relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
456
646
  ...props,
457
647
  children: [
458
- /* @__PURE__ */ jsx7("span", {
648
+ /* @__PURE__ */ jsx10("span", {
459
649
  className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
460
- children: /* @__PURE__ */ jsx7(MenuPrimitive2.RadioItemIndicator, {
461
- children: /* @__PURE__ */ jsx7(CheckIcon3, {})
650
+ children: /* @__PURE__ */ jsx10(MenuPrimitive2.RadioItemIndicator, {
651
+ children: /* @__PURE__ */ jsx10(CheckIcon4, {})
462
652
  })
463
653
  }),
464
654
  children
@@ -470,7 +660,7 @@ function MenubarLabel({
470
660
  inset,
471
661
  ...props
472
662
  }) {
473
- return /* @__PURE__ */ jsx7(DropdownMenuLabel, {
663
+ return /* @__PURE__ */ jsx10(DropdownMenuLabel, {
474
664
  "data-slot": "menubar-label",
475
665
  "data-inset": inset,
476
666
  className: cn("px-2 py-1.5 text-sm font-medium data-inset:pl-8", className),
@@ -481,7 +671,7 @@ function MenubarSeparator({
481
671
  className,
482
672
  ...props
483
673
  }) {
484
- return /* @__PURE__ */ jsx7(DropdownMenuSeparator, {
674
+ return /* @__PURE__ */ jsx10(DropdownMenuSeparator, {
485
675
  "data-slot": "menubar-separator",
486
676
  className: cn("-mx-1 my-1 h-px bg-border", className),
487
677
  ...props
@@ -490,7 +680,7 @@ function MenubarSeparator({
490
680
  function MenubarSub({
491
681
  ...props
492
682
  }) {
493
- return /* @__PURE__ */ jsx7(DropdownMenuSub, {
683
+ return /* @__PURE__ */ jsx10(DropdownMenuSub, {
494
684
  "data-slot": "menubar-sub",
495
685
  ...props
496
686
  });
@@ -500,7 +690,7 @@ function MenubarSubTrigger({
500
690
  inset,
501
691
  ...props
502
692
  }) {
503
- return /* @__PURE__ */ jsx7(DropdownMenuSubTrigger, {
693
+ return /* @__PURE__ */ jsx10(DropdownMenuSubTrigger, {
504
694
  "data-slot": "menubar-sub-trigger",
505
695
  "data-inset": inset,
506
696
  className: cn("gap-2 rounded-sm px-2 py-1.5 text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4", className),
@@ -511,7 +701,7 @@ function MenubarSubContent({
511
701
  className,
512
702
  ...props
513
703
  }) {
514
- return /* @__PURE__ */ jsx7(DropdownMenuSubContent, {
704
+ return /* @__PURE__ */ jsx10(DropdownMenuSubContent, {
515
705
  "data-slot": "menubar-sub-content",
516
706
  className: cn("min-w-32 rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
517
707
  ...props
@@ -526,137 +716,8 @@ import {
526
716
  ChevronsRight
527
717
  } from "lucide-react";
528
718
  import { useId } from "react";
529
-
530
- // ../../src/components/ui/label.tsx
531
- import { jsx as jsx8 } from "react/jsx-runtime";
532
- "use client";
533
- function Label({ className, ...props }) {
534
- return /* @__PURE__ */ jsx8("label", {
535
- "data-slot": "label",
536
- className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
537
- ...props
538
- });
539
- }
540
-
541
- // ../../src/components/ui/select.tsx
542
- import { Select as SelectPrimitive } from "@base-ui/react/select";
543
- import { ChevronDownIcon, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
544
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
545
- "use client";
546
- var Select = SelectPrimitive.Root;
547
- function SelectValue({ className, ...props }) {
548
- return /* @__PURE__ */ jsx9(SelectPrimitive.Value, {
549
- "data-slot": "select-value",
550
- className: cn("flex flex-1 text-left", className),
551
- ...props
552
- });
553
- }
554
- function SelectTrigger({
555
- className,
556
- size = "default",
557
- children,
558
- ...props
559
- }) {
560
- return /* @__PURE__ */ jsxs4(SelectPrimitive.Trigger, {
561
- "data-slot": "select-trigger",
562
- "data-size": size,
563
- className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
564
- ...props,
565
- children: [
566
- children,
567
- /* @__PURE__ */ jsx9(SelectPrimitive.Icon, {
568
- render: /* @__PURE__ */ jsx9(ChevronDownIcon, {
569
- className: "text-muted-foreground pointer-events-none size-4"
570
- })
571
- })
572
- ]
573
- });
574
- }
575
- function SelectContent({
576
- className,
577
- children,
578
- side = "bottom",
579
- sideOffset = 4,
580
- align = "center",
581
- alignOffset = 0,
582
- alignItemWithTrigger = true,
583
- ...props
584
- }) {
585
- return /* @__PURE__ */ jsx9(SelectPrimitive.Portal, {
586
- children: /* @__PURE__ */ jsx9(SelectPrimitive.Positioner, {
587
- side,
588
- sideOffset,
589
- align,
590
- alignOffset,
591
- alignItemWithTrigger,
592
- className: "isolate z-50",
593
- children: /* @__PURE__ */ jsxs4(SelectPrimitive.Popup, {
594
- "data-slot": "select-content",
595
- "data-align-trigger": alignItemWithTrigger,
596
- className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
597
- ...props,
598
- children: [
599
- /* @__PURE__ */ jsx9(SelectScrollUpButton, {}),
600
- /* @__PURE__ */ jsx9(SelectPrimitive.List, {
601
- children
602
- }),
603
- /* @__PURE__ */ jsx9(SelectScrollDownButton, {})
604
- ]
605
- })
606
- })
607
- });
608
- }
609
- function SelectItem({
610
- className,
611
- children,
612
- ...props
613
- }) {
614
- return /* @__PURE__ */ jsxs4(SelectPrimitive.Item, {
615
- "data-slot": "select-item",
616
- className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
617
- ...props,
618
- children: [
619
- /* @__PURE__ */ jsx9(SelectPrimitive.ItemText, {
620
- className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
621
- children
622
- }),
623
- /* @__PURE__ */ jsx9(SelectPrimitive.ItemIndicator, {
624
- render: /* @__PURE__ */ jsx9("span", {
625
- className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
626
- }),
627
- children: /* @__PURE__ */ jsx9(CheckIcon4, {
628
- className: "pointer-events-none"
629
- })
630
- })
631
- ]
632
- });
633
- }
634
- function SelectScrollUpButton({
635
- className,
636
- ...props
637
- }) {
638
- return /* @__PURE__ */ jsx9(SelectPrimitive.ScrollUpArrow, {
639
- "data-slot": "select-scroll-up-button",
640
- className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
641
- ...props,
642
- children: /* @__PURE__ */ jsx9(ChevronUpIcon, {})
643
- });
644
- }
645
- function SelectScrollDownButton({
646
- className,
647
- ...props
648
- }) {
649
- return /* @__PURE__ */ jsx9(SelectPrimitive.ScrollDownArrow, {
650
- "data-slot": "select-scroll-down-button",
651
- className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
652
- ...props,
653
- children: /* @__PURE__ */ jsx9(ChevronDownIcon, {})
654
- });
655
- }
656
-
657
- // ../../src/components/ui/pagination.tsx
658
719
  import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
659
- import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
720
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
660
721
  var messages = {
661
722
  en: {
662
723
  pageSize: "Page size",
@@ -703,32 +764,32 @@ function Pagination({
703
764
  const pageSizeId = useId();
704
765
  const canGoBack = page > 0;
705
766
  const canGoForward = page + 1 < pageCount;
706
- return /* @__PURE__ */ jsxs5("div", {
767
+ return /* @__PURE__ */ jsxs6("div", {
707
768
  className: cn("flex flex-col gap-3 px-2 sm:flex-row sm:items-center sm:justify-between", compact && "gap-2 px-0 sm:flex-col sm:items-stretch"),
708
769
  children: [
709
- showResults ? /* @__PURE__ */ jsxs5("div", {
770
+ showResults ? /* @__PURE__ */ jsxs6("div", {
710
771
  className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",
711
772
  children: [
712
- /* @__PURE__ */ jsx10("span", {
773
+ /* @__PURE__ */ jsx11("span", {
713
774
  children: labels.results(totalRows)
714
775
  }),
715
- selectedRows > 0 ? /* @__PURE__ */ jsx10("span", {
776
+ selectedRows > 0 ? /* @__PURE__ */ jsx11("span", {
716
777
  children: labels.selectedOf(selectedRows, totalRows)
717
778
  }) : null
718
779
  ]
719
780
  }) : null,
720
- /* @__PURE__ */ jsxs5("div", {
781
+ /* @__PURE__ */ jsxs6("div", {
721
782
  className: cn("flex items-center gap-4 sm:justify-end", compact && "flex-wrap justify-between gap-2 sm:justify-between"),
722
783
  children: [
723
- /* @__PURE__ */ jsxs5("div", {
784
+ /* @__PURE__ */ jsxs6("div", {
724
785
  className: "flex items-center gap-2",
725
786
  children: [
726
- /* @__PURE__ */ jsx10(Label, {
787
+ /* @__PURE__ */ jsx11(Label, {
727
788
  htmlFor: pageSizeId,
728
789
  className: cn("hidden text-sm sm:block", compact && "block"),
729
790
  children: labels.pageSize
730
791
  }),
731
- /* @__PURE__ */ jsxs5(Select, {
792
+ /* @__PURE__ */ jsxs6(Select, {
732
793
  items: pageSizes.map((size) => ({
733
794
  label: size.toString(),
734
795
  value: size.toString()
@@ -736,16 +797,16 @@ function Pagination({
736
797
  value: `${pageSize}`,
737
798
  onValueChange: (value) => onPageSizeChange(Number(value)),
738
799
  children: [
739
- /* @__PURE__ */ jsx10(SelectTrigger, {
800
+ /* @__PURE__ */ jsx11(SelectTrigger, {
740
801
  className: "h-8 w-[70px]",
741
802
  id: pageSizeId,
742
- children: /* @__PURE__ */ jsx10(SelectValue, {
803
+ children: /* @__PURE__ */ jsx11(SelectValue, {
743
804
  placeholder: pageSize
744
805
  })
745
806
  }),
746
- /* @__PURE__ */ jsx10(SelectContent, {
807
+ /* @__PURE__ */ jsx11(SelectContent, {
747
808
  side: "top",
748
- children: pageSizes.map((size) => /* @__PURE__ */ jsx10(SelectItem, {
809
+ children: pageSizes.map((size) => /* @__PURE__ */ jsx11(SelectItem, {
749
810
  value: `${size}`,
750
811
  children: size
751
812
  }, size))
@@ -754,66 +815,66 @@ function Pagination({
754
815
  })
755
816
  ]
756
817
  }),
757
- /* @__PURE__ */ jsxs5("div", {
818
+ /* @__PURE__ */ jsxs6("div", {
758
819
  className: "flex items-center gap-2",
759
820
  children: [
760
- /* @__PURE__ */ jsx10("div", {
821
+ /* @__PURE__ */ jsx11("div", {
761
822
  className: "flex items-center justify-center text-sm font-medium sm:block",
762
823
  children: labels.pageOf(page + 1, pageCount)
763
824
  }),
764
- /* @__PURE__ */ jsxs5("div", {
825
+ /* @__PURE__ */ jsxs6("div", {
765
826
  className: "flex items-center gap-1",
766
827
  children: [
767
- /* @__PURE__ */ jsxs5(Button, {
828
+ /* @__PURE__ */ jsxs6(Button, {
768
829
  className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
769
830
  disabled: !canGoBack,
770
831
  onClick: () => onPageChange(0),
771
832
  type: "button",
772
833
  children: [
773
- /* @__PURE__ */ jsx10("span", {
834
+ /* @__PURE__ */ jsx11("span", {
774
835
  className: "sr-only",
775
836
  children: labels.goToFirstPage
776
837
  }),
777
- /* @__PURE__ */ jsx10(ChevronsLeft, {})
838
+ /* @__PURE__ */ jsx11(ChevronsLeft, {})
778
839
  ]
779
840
  }),
780
- /* @__PURE__ */ jsxs5(Button, {
841
+ /* @__PURE__ */ jsxs6(Button, {
781
842
  className: "h-8 w-8 p-0",
782
843
  disabled: !canGoBack,
783
844
  onClick: () => onPageChange(page - 1),
784
845
  type: "button",
785
846
  children: [
786
- /* @__PURE__ */ jsx10("span", {
847
+ /* @__PURE__ */ jsx11("span", {
787
848
  className: "sr-only",
788
849
  children: labels.goToPreviousPage
789
850
  }),
790
- /* @__PURE__ */ jsx10(ChevronLeft, {})
851
+ /* @__PURE__ */ jsx11(ChevronLeft, {})
791
852
  ]
792
853
  }),
793
- /* @__PURE__ */ jsxs5(Button, {
854
+ /* @__PURE__ */ jsxs6(Button, {
794
855
  className: "h-8 w-8 p-0",
795
856
  disabled: !canGoForward,
796
857
  onClick: () => onPageChange(page + 1),
797
858
  type: "button",
798
859
  children: [
799
- /* @__PURE__ */ jsx10("span", {
860
+ /* @__PURE__ */ jsx11("span", {
800
861
  className: "sr-only",
801
862
  children: labels.goToNextPage
802
863
  }),
803
- /* @__PURE__ */ jsx10(ChevronRight, {})
864
+ /* @__PURE__ */ jsx11(ChevronRight, {})
804
865
  ]
805
866
  }),
806
- /* @__PURE__ */ jsxs5(Button, {
867
+ /* @__PURE__ */ jsxs6(Button, {
807
868
  className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
808
869
  disabled: !canGoForward,
809
870
  onClick: () => onPageChange(pageCount - 1),
810
871
  type: "button",
811
872
  children: [
812
- /* @__PURE__ */ jsx10("span", {
873
+ /* @__PURE__ */ jsx11("span", {
813
874
  className: "sr-only",
814
875
  children: labels.goToLastPage
815
876
  }),
816
- /* @__PURE__ */ jsx10(ChevronsRight, {})
877
+ /* @__PURE__ */ jsx11(ChevronsRight, {})
817
878
  ]
818
879
  })
819
880
  ]
@@ -828,24 +889,24 @@ function Pagination({
828
889
 
829
890
  // ../../src/components/ui/scroll-area.tsx
830
891
  import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
831
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
892
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
832
893
  function ScrollArea({
833
894
  className,
834
895
  children,
835
896
  ...props
836
897
  }) {
837
- return /* @__PURE__ */ jsxs6(ScrollAreaPrimitive.Root, {
898
+ return /* @__PURE__ */ jsxs7(ScrollAreaPrimitive.Root, {
838
899
  "data-slot": "scroll-area",
839
900
  className: cn("relative", className),
840
901
  ...props,
841
902
  children: [
842
- /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Viewport, {
903
+ /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Viewport, {
843
904
  "data-slot": "scroll-area-viewport",
844
905
  className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
845
906
  children
846
907
  }),
847
- /* @__PURE__ */ jsx11(ScrollBar, {}),
848
- /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Corner, {})
908
+ /* @__PURE__ */ jsx12(ScrollBar, {}),
909
+ /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Corner, {})
849
910
  ]
850
911
  });
851
912
  }
@@ -854,13 +915,13 @@ function ScrollBar({
854
915
  orientation = "vertical",
855
916
  ...props
856
917
  }) {
857
- return /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Scrollbar, {
918
+ return /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Scrollbar, {
858
919
  "data-slot": "scroll-area-scrollbar",
859
920
  "data-orientation": orientation,
860
921
  orientation,
861
922
  className: cn("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent", className),
862
923
  ...props,
863
- children: /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Thumb, {
924
+ children: /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Thumb, {
864
925
  "data-slot": "scroll-area-thumb",
865
926
  className: "bg-border relative flex-1 rounded-full"
866
927
  })
@@ -868,12 +929,12 @@ function ScrollBar({
868
929
  }
869
930
 
870
931
  // ../../src/components/ui/table.tsx
871
- import { jsx as jsx12 } from "react/jsx-runtime";
932
+ import { jsx as jsx13 } from "react/jsx-runtime";
872
933
  function Table({ className, ...props }) {
873
- return /* @__PURE__ */ jsx12("div", {
934
+ return /* @__PURE__ */ jsx13("div", {
874
935
  "data-slot": "table-container",
875
936
  className: "relative w-full overflow-x-auto",
876
- children: /* @__PURE__ */ jsx12("table", {
937
+ children: /* @__PURE__ */ jsx13("table", {
877
938
  "data-slot": "table",
878
939
  className: cn("w-full caption-bottom text-sm", className),
879
940
  ...props
@@ -881,35 +942,35 @@ function Table({ className, ...props }) {
881
942
  });
882
943
  }
883
944
  function TableHeader({ className, ...props }) {
884
- return /* @__PURE__ */ jsx12("thead", {
945
+ return /* @__PURE__ */ jsx13("thead", {
885
946
  "data-slot": "table-header",
886
947
  className: cn("[&_tr]:border-b", className),
887
948
  ...props
888
949
  });
889
950
  }
890
951
  function TableBody({ className, ...props }) {
891
- return /* @__PURE__ */ jsx12("tbody", {
952
+ return /* @__PURE__ */ jsx13("tbody", {
892
953
  "data-slot": "table-body",
893
954
  className: cn("[&_tr:last-child]:border-0", className),
894
955
  ...props
895
956
  });
896
957
  }
897
958
  function TableRow({ className, ...props }) {
898
- return /* @__PURE__ */ jsx12("tr", {
959
+ return /* @__PURE__ */ jsx13("tr", {
899
960
  "data-slot": "table-row",
900
961
  className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
901
962
  ...props
902
963
  });
903
964
  }
904
965
  function TableHead({ className, ...props }) {
905
- return /* @__PURE__ */ jsx12("th", {
966
+ return /* @__PURE__ */ jsx13("th", {
906
967
  "data-slot": "table-head",
907
968
  className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0", className),
908
969
  ...props
909
970
  });
910
971
  }
911
972
  function TableCell({ className, ...props }) {
912
- return /* @__PURE__ */ jsx12("td", {
973
+ return /* @__PURE__ */ jsx13("td", {
913
974
  "data-slot": "table-cell",
914
975
  className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
915
976
  ...props
@@ -918,26 +979,26 @@ function TableCell({ className, ...props }) {
918
979
 
919
980
  // ../../src/components/ui/tooltip.tsx
920
981
  import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
921
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
982
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
922
983
  "use client";
923
984
  function TooltipProvider({
924
985
  delay = 0,
925
986
  ...props
926
987
  }) {
927
- return /* @__PURE__ */ jsx13(TooltipPrimitive.Provider, {
988
+ return /* @__PURE__ */ jsx14(TooltipPrimitive.Provider, {
928
989
  "data-slot": "tooltip-provider",
929
990
  delay,
930
991
  ...props
931
992
  });
932
993
  }
933
994
  function Tooltip({ ...props }) {
934
- return /* @__PURE__ */ jsx13(TooltipPrimitive.Root, {
995
+ return /* @__PURE__ */ jsx14(TooltipPrimitive.Root, {
935
996
  "data-slot": "tooltip",
936
997
  ...props
937
998
  });
938
999
  }
939
1000
  function TooltipTrigger({ ...props }) {
940
- return /* @__PURE__ */ jsx13(TooltipPrimitive.Trigger, {
1001
+ return /* @__PURE__ */ jsx14(TooltipPrimitive.Trigger, {
941
1002
  "data-slot": "tooltip-trigger",
942
1003
  ...props
943
1004
  });
@@ -951,20 +1012,20 @@ function TooltipContent({
951
1012
  children,
952
1013
  ...props
953
1014
  }) {
954
- return /* @__PURE__ */ jsx13(TooltipPrimitive.Portal, {
955
- children: /* @__PURE__ */ jsx13(TooltipPrimitive.Positioner, {
1015
+ return /* @__PURE__ */ jsx14(TooltipPrimitive.Portal, {
1016
+ children: /* @__PURE__ */ jsx14(TooltipPrimitive.Positioner, {
956
1017
  align,
957
1018
  alignOffset,
958
1019
  side,
959
1020
  sideOffset,
960
1021
  className: "isolate z-50",
961
- children: /* @__PURE__ */ jsxs7(TooltipPrimitive.Popup, {
1022
+ children: /* @__PURE__ */ jsxs8(TooltipPrimitive.Popup, {
962
1023
  "data-slot": "tooltip-content",
963
1024
  className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
964
1025
  ...props,
965
1026
  children: [
966
1027
  children,
967
- /* @__PURE__ */ jsx13(TooltipPrimitive.Arrow, {
1028
+ /* @__PURE__ */ jsx14(TooltipPrimitive.Arrow, {
968
1029
  className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"
969
1030
  })
970
1031
  ]
@@ -973,14 +1034,181 @@ function TooltipContent({
973
1034
  });
974
1035
  }
975
1036
 
1037
+ // ../../src/lib/query.ts
1038
+ import {
1039
+ DateTime,
1040
+ Effect,
1041
+ Option,
1042
+ Schema,
1043
+ SchemaGetter,
1044
+ SchemaIssue,
1045
+ SchemaTransformation
1046
+ } from "effect";
1047
+ var parseSortParam = (sort) => {
1048
+ const id = sort.startsWith("-") ? sort.slice(1) : sort;
1049
+ if (!id || id.includes(",") || id.includes(":")) {
1050
+ return null;
1051
+ }
1052
+ return { id, direction: sort.startsWith("-") ? "desc" : "asc" };
1053
+ };
1054
+ var SortDirection = Schema.Union([
1055
+ Schema.Literal("asc"),
1056
+ Schema.Literal("desc")
1057
+ ]).pipe(Schema.annotate({
1058
+ identifier: "SortDirection",
1059
+ title: "Sort Direction",
1060
+ description: "Sort direction for list query results.",
1061
+ examples: ["asc", "desc"]
1062
+ }));
1063
+ var SortParam = Schema.Struct({
1064
+ id: Schema.NonEmptyString,
1065
+ direction: SortDirection
1066
+ }).pipe(Schema.annotate({
1067
+ identifier: "SortParam",
1068
+ title: "Sort Parameter",
1069
+ description: "Decoded sort parameter with a field id and direction.",
1070
+ examples: [{ id: "publicName", direction: "asc" }]
1071
+ }));
1072
+ var SortParamFromString = Schema.String.pipe(Schema.decodeTo(SortParam, SchemaTransformation.transformEffect({
1073
+ decode: (sort) => {
1074
+ const sortParam = parseSortParam(sort);
1075
+ if (!sortParam) {
1076
+ return Effect.fail(new SchemaIssue.InvalidValue({ message: 'Expected sort in the format "field" or "-field"' }, sort));
1077
+ }
1078
+ return Effect.succeed(sortParam);
1079
+ },
1080
+ encode: (sort) => Effect.succeed(sort.direction === "desc" ? `-${sort.id}` : sort.id)
1081
+ })), Schema.annotate({
1082
+ identifier: "SortParamFromString",
1083
+ title: "Sort Parameter From String",
1084
+ description: 'URL encoded single sort parameter where descending fields are prefixed with "-".',
1085
+ examples: [{ id: "publicName", direction: "asc" }]
1086
+ }));
1087
+ var SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortParam), SchemaTransformation.transformEffect({
1088
+ decode: (sort) => {
1089
+ if (sort === "")
1090
+ return Effect.succeed([]);
1091
+ const parts = sort.split(",");
1092
+ const sortParams = [];
1093
+ for (const part of parts) {
1094
+ const sortParam = parseSortParam(part);
1095
+ if (!sortParam) {
1096
+ return Effect.fail(new SchemaIssue.InvalidValue({ message: 'Expected sort in the format "field,-otherField"' }, sort));
1097
+ }
1098
+ sortParams.push(sortParam);
1099
+ }
1100
+ return Effect.succeed(sortParams);
1101
+ },
1102
+ encode: (sort) => Effect.succeed(sort.map((part) => Schema.encodeSync(SortParamFromString)(part)).join(","))
1103
+ })), Schema.annotate({
1104
+ identifier: "SortParamsFromString",
1105
+ title: "Sort Parameters From String",
1106
+ description: 'URL encoded sort parameters where descending fields are prefixed with "-" and multiple fields are comma-separated.',
1107
+ examples: [
1108
+ [
1109
+ { id: "name", direction: "desc" },
1110
+ { id: "age", direction: "asc" }
1111
+ ]
1112
+ ]
1113
+ }));
1114
+ var SortParamsArray = Schema.Array(SortParam);
1115
+ var SortParams = Schema.declare(Schema.is(SortParamsArray), {
1116
+ identifier: "SortParams",
1117
+ toCodec: () => Schema.link()(SortParamsArray, SchemaTransformation.passthrough()),
1118
+ toCodecStringTree: () => Schema.link()(SortParamsFromString, SchemaTransformation.passthrough())
1119
+ });
1120
+ var TextFilterOperator = Schema.Literals([
1121
+ "contains",
1122
+ "equals",
1123
+ "startsWith",
1124
+ "endsWith"
1125
+ ]).annotate({ identifier: "TextFilterOperator" });
1126
+ var FilterCalendarDate = Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema.makeFilter((value) => Option.exists(DateTime.make(value), (date) => DateTime.formatIsoDateUtc(date) === value))).annotate({ identifier: "FilterCalendarDate" });
1127
+ var ColumnFilter = Schema.Union([
1128
+ Schema.Struct({
1129
+ id: Schema.NonEmptyString,
1130
+ kind: Schema.Literal("text"),
1131
+ operator: TextFilterOperator,
1132
+ value: Schema.NonEmptyString
1133
+ }),
1134
+ Schema.Struct({
1135
+ id: Schema.NonEmptyString,
1136
+ kind: Schema.Literal("number"),
1137
+ min: Schema.optional(Schema.Finite),
1138
+ max: Schema.optional(Schema.Finite)
1139
+ }).check(Schema.makeFilter((range) => (range.min !== undefined || range.max !== undefined) && (range.min === undefined || range.max === undefined || range.min <= range.max))),
1140
+ Schema.Struct({
1141
+ id: Schema.NonEmptyString,
1142
+ kind: Schema.Literal("date"),
1143
+ from: Schema.optional(FilterCalendarDate),
1144
+ to: Schema.optional(FilterCalendarDate)
1145
+ }).check(Schema.makeFilter((range) => (range.from !== undefined || range.to !== undefined) && (range.from === undefined || range.to === undefined || range.from <= range.to))),
1146
+ Schema.Struct({
1147
+ id: Schema.NonEmptyString,
1148
+ kind: Schema.Literal("boolean"),
1149
+ value: Schema.Boolean
1150
+ }),
1151
+ Schema.Struct({
1152
+ id: Schema.NonEmptyString,
1153
+ kind: Schema.Literal("values"),
1154
+ values: Schema.NonEmptyArray(Schema.String)
1155
+ })
1156
+ ]).annotate({ identifier: "ColumnFilter" });
1157
+ var ColumnFiltersArray = Schema.Array(ColumnFilter);
1158
+ var ColumnFilters = Schema.declare(Schema.is(ColumnFiltersArray), {
1159
+ identifier: "ColumnFilters",
1160
+ toCodec: () => Schema.link()(ColumnFiltersArray, SchemaTransformation.passthrough()),
1161
+ toCodecStringTree: () => Schema.link()(Schema.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
1162
+ });
1163
+ var Query = Schema.Struct({
1164
+ page: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
1165
+ decode: SchemaGetter.withDefault(Effect.succeed(0)),
1166
+ encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
1167
+ })),
1168
+ pageSize: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })), {
1169
+ decode: SchemaGetter.withDefault(Effect.succeed(20)),
1170
+ encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
1171
+ })),
1172
+ globalFilter: Schema.optional(Schema.String),
1173
+ sort: Schema.optional(SortParams),
1174
+ filters: Schema.optional(ColumnFilters)
1175
+ }).annotate({
1176
+ identifier: "Query",
1177
+ title: "Query",
1178
+ description: "Zero-based page request parameters with optional filtering and sorting for list endpoints.",
1179
+ examples: [
1180
+ {
1181
+ page: 0,
1182
+ pageSize: 20,
1183
+ globalFilter: "housing",
1184
+ sort: [
1185
+ { id: "publicName", direction: "desc" },
1186
+ { id: "createdAt", direction: "asc" }
1187
+ ]
1188
+ }
1189
+ ]
1190
+ });
1191
+ var QueryStandard = Schema.toStandardSchemaV1(Query);
1192
+ var PaginationMeta = Schema.Struct({
1193
+ page: Schema.Int,
1194
+ pageSize: Schema.Int,
1195
+ total: Schema.Int,
1196
+ pageCount: Schema.Int
1197
+ }).pipe(Schema.annotate({
1198
+ identifier: "PaginationMeta",
1199
+ title: "Pagination Metadata",
1200
+ description: "Pagination metadata returned with a paginated list response.",
1201
+ examples: [{ page: 0, pageSize: 20, total: 125, pageCount: 7 }]
1202
+ }));
1203
+
976
1204
  // ../../src/components/ui/data-table.tsx
977
1205
  import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
978
- import { jsx as jsx14, jsxs as jsxs8, Fragment } from "react/jsx-runtime";
979
- var DataTablePersistedUiStateSchema = Schema.Struct({
980
- columnVisibility: Schema.Record(Schema.String, Schema.Boolean),
981
- columnSizing: Schema.Record(Schema.String, Schema.Number),
982
- grouping: Schema.optionalKey(Schema.Array(Schema.String)),
983
- view: Schema.Literals(["table", "gallery"])
1206
+ import { jsx as jsx15, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
1207
+ var DataTablePersistedUiStateSchema = Schema2.Struct({
1208
+ columnVisibility: Schema2.Record(Schema2.String, Schema2.Boolean),
1209
+ columnSizing: Schema2.Record(Schema2.String, Schema2.Number),
1210
+ grouping: Schema2.optionalKey(Schema2.Array(Schema2.String)),
1211
+ view: Schema2.Literals(["table", "gallery"])
984
1212
  }).annotate({ identifier: "DataTablePersistedUiState" });
985
1213
  var dataTableStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
986
1214
  var DataTableReferenceCell = ({
@@ -992,29 +1220,29 @@ var DataTableReferenceCell = ({
992
1220
  if (!item)
993
1221
  return emptyLabel;
994
1222
  const initials = item.label.trim().split(/\s+/).slice(0, 2).map((word) => word.slice(0, 1)).join("").toLocaleUpperCase();
995
- return /* @__PURE__ */ jsxs8("div", {
1223
+ return /* @__PURE__ */ jsxs9("div", {
996
1224
  className: "flex min-w-0 items-center gap-2",
997
1225
  children: [
998
- /* @__PURE__ */ jsx14("div", {
1226
+ /* @__PURE__ */ jsx15("div", {
999
1227
  className: cn("bg-muted flex size-8 shrink-0 items-center justify-center overflow-hidden text-xs font-medium", imageVariant === "circle" ? "rounded-full" : "rounded-md"),
1000
- children: item.imageSrc && item.imageSrc !== failedImage ? /* @__PURE__ */ jsx14("img", {
1228
+ children: item.imageSrc && item.imageSrc !== failedImage ? /* @__PURE__ */ jsx15("img", {
1001
1229
  src: item.imageSrc,
1002
1230
  alt: item.label,
1003
1231
  className: "size-full object-cover",
1004
1232
  onError: () => setFailedImage(item.imageSrc ?? undefined)
1005
- }) : /* @__PURE__ */ jsx14("span", {
1233
+ }) : /* @__PURE__ */ jsx15("span", {
1006
1234
  "aria-hidden": "true",
1007
1235
  children: initials
1008
1236
  })
1009
1237
  }),
1010
- /* @__PURE__ */ jsxs8("div", {
1238
+ /* @__PURE__ */ jsxs9("div", {
1011
1239
  className: "flex min-w-0 flex-col leading-tight",
1012
1240
  children: [
1013
- /* @__PURE__ */ jsx14("span", {
1241
+ /* @__PURE__ */ jsx15("span", {
1014
1242
  className: "truncate font-medium",
1015
1243
  children: item.label
1016
1244
  }),
1017
- item.description ? /* @__PURE__ */ jsx14("span", {
1245
+ item.description ? /* @__PURE__ */ jsx15("span", {
1018
1246
  className: "text-muted-foreground truncate text-xs",
1019
1247
  children: item.description
1020
1248
  }) : null
@@ -1032,6 +1260,23 @@ var messages2 = {
1032
1260
  empty: "No results.",
1033
1261
  loading: "Loading...",
1034
1262
  filter: "Filter results...",
1263
+ filters: "Filters",
1264
+ filtersClear: "Clear all filters",
1265
+ filterClear: "Clear filter",
1266
+ filterApply: "Apply filter",
1267
+ filterValue: "Value",
1268
+ filterOperator: "Operator",
1269
+ filterContains: "Contains",
1270
+ filterEquals: "Equals",
1271
+ filterStartsWith: "Starts with",
1272
+ filterEndsWith: "Ends with",
1273
+ filterMin: "Minimum",
1274
+ filterMax: "Maximum",
1275
+ filterFrom: "From (UTC)",
1276
+ filterTo: "To (UTC)",
1277
+ filterTrue: "True",
1278
+ filterFalse: "False",
1279
+ filterInvalid: "Enter a valid filter. Ranges must be in ascending order.",
1035
1280
  export: "Export",
1036
1281
  exportCsv: "CSV",
1037
1282
  exportJson: "JSON",
@@ -1064,6 +1309,23 @@ var messages2 = {
1064
1309
  empty: "Aucun résultat.",
1065
1310
  loading: "Chargement...",
1066
1311
  filter: "Filtrer les résultats...",
1312
+ filters: "Filtres",
1313
+ filtersClear: "Effacer tous les filtres",
1314
+ filterClear: "Effacer le filtre",
1315
+ filterApply: "Appliquer le filtre",
1316
+ filterValue: "Valeur",
1317
+ filterOperator: "Opérateur",
1318
+ filterContains: "Contient",
1319
+ filterEquals: "Égal à",
1320
+ filterStartsWith: "Commence par",
1321
+ filterEndsWith: "Se termine par",
1322
+ filterMin: "Minimum",
1323
+ filterMax: "Maximum",
1324
+ filterFrom: "Du (UTC)",
1325
+ filterTo: "Au (UTC)",
1326
+ filterTrue: "Vrai",
1327
+ filterFalse: "Faux",
1328
+ filterInvalid: "Saisissez un filtre valide. Les bornes doivent être dans l’ordre croissant.",
1067
1329
  export: "Exporter",
1068
1330
  exportCsv: "CSV",
1069
1331
  exportJson: "JSON",
@@ -1123,7 +1385,7 @@ var transientUiFromState = (state) => ({
1123
1385
  var clampWidth = (column, width) => Math.min(column.maxWidth ?? DEFAULT_MAX_WIDTH, Math.max(column.minWidth ?? DEFAULT_MIN_WIDTH, width));
1124
1386
  var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
1125
1387
  const ids = new Set;
1126
- return columnDefs.map((colDef) => {
1388
+ const columns = columnDefs.map((colDef) => {
1127
1389
  const id = colDef.field ?? colDef.colId;
1128
1390
  if (!id) {
1129
1391
  throw new Error("DataTable columns require a field or colId");
@@ -1138,7 +1400,24 @@ var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
1138
1400
  width: clampWidth(colDef, columnSizing[id] ?? colDef.width ?? DEFAULT_WIDTH)
1139
1401
  };
1140
1402
  });
1403
+ for (const column of columns) {
1404
+ for (const field of column.colDef.fields ?? []) {
1405
+ const id = `${column.id}.${field.id}`;
1406
+ if (!field.id || ids.has(id)) {
1407
+ throw new Error(`DataTable field IDs must be nonempty and unique: ${id}`);
1408
+ }
1409
+ ids.add(id);
1410
+ }
1411
+ }
1412
+ return columns;
1141
1413
  };
1414
+ var getDataTableFieldColumns = (column) => (column.colDef.fields ?? []).map(({ id, export: _export, ...colDef }) => ({
1415
+ id: `${column.id}.${id}`,
1416
+ colDef: { ...colDef, colId: `${column.id}.${id}` },
1417
+ width: column.width
1418
+ }));
1419
+ var getDataTableSortColumns = (columns) => columns.flatMap((column) => column.colDef.sortable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.sortable !== false));
1420
+ var getDataTableExportColumns = (visibleColumns) => visibleColumns.flatMap((column) => column.colDef.fields?.length ? getDataTableFieldColumns(column).filter((_field, index) => column.colDef.fields?.[index]?.export !== false) : [column]);
1142
1421
  var getDataTableWidth = (columns, utilityColumns = 0) => columns.reduce((total, column) => total + column.width, 0) + utilityColumns * 40;
1143
1422
  var buildDataTableRows = (rowData, columns, getRowId) => {
1144
1423
  const ids = new Set;
@@ -1151,7 +1430,7 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
1151
1430
  id,
1152
1431
  data,
1153
1432
  index,
1154
- values: new Map(columns.map((column) => {
1433
+ values: new Map(columns.flatMap((column) => [column, ...getDataTableFieldColumns(column)]).map((column) => {
1155
1434
  const { colDef } = column;
1156
1435
  const value = colDef.valueGetter ? colDef.valueGetter({ data, rowId: id, rowIndex: index, colDef }) : colDef.type === "list" ? colDef.typeOptions.getItems(data).map((item) => item.label).join(", ") : colDef.type === "reference" ? referenceText(colDef.typeOptions.getItem(data)) : colDef.field ? data[colDef.field] : undefined;
1157
1436
  return [column.id, value];
@@ -1159,40 +1438,40 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
1159
1438
  };
1160
1439
  });
1161
1440
  };
1162
- var CalendarDate = Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema.makeFilter((value) => Option.exists(DateTime.make(value), (date) => DateTime.formatIsoDateUtc(date) === value))).annotate({ identifier: "DataTableCalendarDate" });
1163
- var InstantString = Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/), Schema.makeFilter((value) => Schema.is(CalendarDate)(value.slice(0, 10)))).annotate({ identifier: "DataTableInstantString" });
1164
- var DateInput = Schema.Union([
1165
- Schema.Date,
1166
- Schema.Int,
1441
+ var CalendarDate = Schema2.String.check(Schema2.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema2.makeFilter((value) => Option2.exists(DateTime2.make(value), (date) => DateTime2.formatIsoDateUtc(date) === value))).annotate({ identifier: "DataTableCalendarDate" });
1442
+ var InstantString = Schema2.String.check(Schema2.isPattern(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/), Schema2.makeFilter((value) => Schema2.is(CalendarDate)(value.slice(0, 10)))).annotate({ identifier: "DataTableInstantString" });
1443
+ var DateInput = Schema2.Union([
1444
+ Schema2.Date,
1445
+ Schema2.Int,
1167
1446
  CalendarDate,
1168
1447
  InstantString
1169
1448
  ]).annotate({ identifier: "DataTableDateInput" });
1170
- var decodeDateInput = Schema.decodeUnknownOption(DateInput);
1171
- var resolveDate = (value, type) => Option.getOrUndefined(Option.flatMap(decodeDateInput(value), (input) => {
1172
- const calendarOnly = Schema.is(CalendarDate)(input);
1449
+ var decodeDateInput = Schema2.decodeUnknownOption(DateInput);
1450
+ var resolveDate = (value, type) => Option2.getOrUndefined(Option2.flatMap(decodeDateInput(value), (input) => {
1451
+ const calendarOnly = Schema2.is(CalendarDate)(input);
1173
1452
  if (calendarOnly && type === "dateTime")
1174
- return Option.none();
1175
- return Option.map(DateTime.make(input), (instant) => ({
1453
+ return Option2.none();
1454
+ return Option2.map(DateTime2.make(input), (instant) => ({
1176
1455
  instant,
1177
1456
  calendarOnly
1178
1457
  }));
1179
1458
  }));
1180
- var formatDateValue = (date, column, locale = "en") => DateTime.format(date.instant, {
1459
+ var formatDateValue = (date, column, locale = "en") => DateTime2.format(date.instant, {
1181
1460
  locale: column.typeOptions?.locale ?? locale,
1182
1461
  timeZone: date.calendarOnly ? "UTC" : column.typeOptions?.timeZone ?? "UTC",
1183
1462
  dateStyle: column.typeOptions?.dateStyle ?? "medium",
1184
1463
  timeStyle: column.type === "dateTime" ? column.typeOptions?.timeStyle ?? "short" : undefined,
1185
1464
  hour12: column.type === "dateTime" ? column.typeOptions?.hour12 : undefined
1186
1465
  });
1187
- var dateIsoValue = (date) => date.calendarOnly ? DateTime.formatIsoDateUtc(date.instant) : DateTime.formatIso(date.instant);
1188
- var NumberValue = Schema.Finite.annotate({
1466
+ var dateIsoValue = (date) => date.calendarOnly ? DateTime2.formatIsoDateUtc(date.instant) : DateTime2.formatIso(date.instant);
1467
+ var NumberValue = Schema2.Finite.annotate({
1189
1468
  identifier: "DataTableNumberValue"
1190
1469
  });
1191
- var BooleanValue = Schema.Boolean.annotate({
1470
+ var BooleanValue = Schema2.Boolean.annotate({
1192
1471
  identifier: "DataTableBooleanValue"
1193
1472
  });
1194
- var decodeNumberValue = Schema.decodeUnknownOption(NumberValue);
1195
- var decodeBooleanValue = Schema.decodeUnknownOption(BooleanValue);
1473
+ var decodeNumberValue = Schema2.decodeUnknownOption(NumberValue);
1474
+ var decodeBooleanValue = Schema2.decodeUnknownOption(BooleanValue);
1196
1475
  var formatNumberValue = (value, options = {}, defaultLocale = "en") => {
1197
1476
  const {
1198
1477
  locale,
@@ -1208,13 +1487,13 @@ var getDataTableExportValue = (row, column, locale = "en") => {
1208
1487
  const value = row.values.get(column.id);
1209
1488
  const colDef = column.colDef;
1210
1489
  if (colDef.type === "number") {
1211
- const number = Option.getOrUndefined(decodeNumberValue(value));
1490
+ const number = Option2.getOrUndefined(decodeNumberValue(value));
1212
1491
  if (number === undefined)
1213
1492
  return null;
1214
1493
  return colDef.typeOptions?.exportFormat === "formatted" ? formatNumberValue(number, colDef.typeOptions, locale) : number;
1215
1494
  }
1216
1495
  if (colDef.type === "boolean") {
1217
- const boolean = Option.getOrUndefined(decodeBooleanValue(value));
1496
+ const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
1218
1497
  if (boolean === undefined)
1219
1498
  return null;
1220
1499
  return colDef.typeOptions?.exportFormat === "formatted" ? booleanLabel(boolean, colDef.typeOptions) ?? String(boolean) : boolean;
@@ -1230,7 +1509,7 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
1230
1509
  const query = globalFilter.trim().toLocaleLowerCase();
1231
1510
  if (!query)
1232
1511
  return [...rows];
1233
- const searchable = columns.filter(({ colDef }) => colDef.searchable !== false);
1512
+ const searchable = columns.flatMap((column) => column.colDef.searchable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.searchable !== false));
1234
1513
  return rows.filter((row) => searchable.some((column) => {
1235
1514
  const value = row.values.get(column.id);
1236
1515
  const colDef = column.colDef;
@@ -1239,17 +1518,86 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
1239
1518
  const date = resolveDate(value, colDef.type);
1240
1519
  text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
1241
1520
  } else if (colDef.type === "number") {
1242
- const number = Option.getOrUndefined(decodeNumberValue(value));
1521
+ const number = Option2.getOrUndefined(decodeNumberValue(value));
1243
1522
  text = number === undefined ? "" : `${formatNumberValue(number, colDef.typeOptions, locale)} ${number}`;
1244
1523
  } else if (colDef.type === "boolean") {
1245
- const boolean = Option.getOrUndefined(decodeBooleanValue(value));
1524
+ const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
1246
1525
  text = boolean === undefined ? "" : `${booleanLabel(boolean, colDef.typeOptions) ?? ""} ${boolean}`;
1247
1526
  }
1248
1527
  return text.toLocaleLowerCase().includes(query);
1249
1528
  }));
1250
1529
  };
1530
+ var getDataTableFilterColumns = (columns) => columns.flatMap((column) => column.colDef.filterable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.filterable !== false));
1531
+ var getDataTableFilterKind = ({
1532
+ colDef
1533
+ }) => colDef.filterOptions || colDef.type === "list" ? "values" : colDef.type === "number" ? "number" : colDef.type === "date" || colDef.type === "dateTime" ? "date" : colDef.type === "boolean" ? "boolean" : "text";
1534
+ var getDataTableFilterOptions = (rows, column) => {
1535
+ const { colDef } = column;
1536
+ if (colDef.filterOptions)
1537
+ return colDef.filterOptions;
1538
+ const options = new Map;
1539
+ if (colDef.type === "list") {
1540
+ for (const row of rows) {
1541
+ for (const item of colDef.typeOptions.getItems(row.data)) {
1542
+ const value = item.value ?? item.label;
1543
+ options.set(value, { value, label: item.label });
1544
+ }
1545
+ }
1546
+ }
1547
+ return [...options.values()].sort((left, right) => left.label.localeCompare(right.label));
1548
+ };
1549
+ var filterDataTableColumnRows = (rows, columns, filters) => {
1550
+ const byId = new Map(getDataTableFilterColumns(columns).map((column) => [column.id, column]));
1551
+ return rows.filter((row) => filters.every((filter) => {
1552
+ const column = byId.get(filter.id);
1553
+ if (!column || getDataTableFilterKind(column) !== filter.kind)
1554
+ return true;
1555
+ const value = column.colDef.filterValueGetter ? column.colDef.filterValueGetter({
1556
+ data: row.data,
1557
+ rowId: row.id,
1558
+ rowIndex: row.index,
1559
+ colDef: column.colDef
1560
+ }) : row.values.get(column.id);
1561
+ switch (filter.kind) {
1562
+ case "text": {
1563
+ const text = String(value ?? "").toLocaleLowerCase();
1564
+ const query = filter.value.toLocaleLowerCase();
1565
+ switch (filter.operator) {
1566
+ case "contains":
1567
+ return text.includes(query);
1568
+ case "equals":
1569
+ return text === query;
1570
+ case "startsWith":
1571
+ return text.startsWith(query);
1572
+ case "endsWith":
1573
+ return text.endsWith(query);
1574
+ }
1575
+ }
1576
+ case "number": {
1577
+ const number = Option2.getOrUndefined(decodeNumberValue(value));
1578
+ return number !== undefined && (filter.min === undefined || number >= filter.min) && (filter.max === undefined || number <= filter.max);
1579
+ }
1580
+ case "date": {
1581
+ const date = resolveDate(value, column.colDef.type === "dateTime" ? "dateTime" : "date");
1582
+ if (!date)
1583
+ return false;
1584
+ const day = DateTime2.formatIsoDateUtc(date.instant);
1585
+ return (filter.from === undefined || day >= filter.from) && (filter.to === undefined || day <= filter.to);
1586
+ }
1587
+ case "boolean":
1588
+ return Option2.getOrUndefined(decodeBooleanValue(value)) === filter.value;
1589
+ case "values": {
1590
+ const values = column.colDef.type === "list" ? column.colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [String(value ?? "")];
1591
+ return filter.values.some((selected) => values.includes(selected));
1592
+ }
1593
+ }
1594
+ }));
1595
+ };
1251
1596
  var sortDataTableRows = (rows, columns, sorting) => {
1252
- const byId = new Map(columns.map((column) => [column.id, column]));
1597
+ const byId = new Map([...columns, ...getDataTableSortColumns(columns)].map((column) => [
1598
+ column.id,
1599
+ column
1600
+ ]));
1253
1601
  return rows.map((row, stableIndex) => ({ row, stableIndex })).sort((left, right) => {
1254
1602
  for (const sort of sorting) {
1255
1603
  const column = byId.get(sort.id);
@@ -1259,8 +1607,8 @@ var sortDataTableRows = (rows, columns, sorting) => {
1259
1607
  const rightValue = right.row.values.get(sort.id);
1260
1608
  const colDef = column.colDef;
1261
1609
  if (!colDef.comparator && (colDef.type === "number" || colDef.type === "boolean")) {
1262
- const leftScalar = colDef.type === "number" ? Option.getOrUndefined(decodeNumberValue(leftValue)) : Option.getOrUndefined(Option.map(decodeBooleanValue(leftValue), Number));
1263
- const rightScalar = colDef.type === "number" ? Option.getOrUndefined(decodeNumberValue(rightValue)) : Option.getOrUndefined(Option.map(decodeBooleanValue(rightValue), Number));
1610
+ const leftScalar = colDef.type === "number" ? Option2.getOrUndefined(decodeNumberValue(leftValue)) : Option2.getOrUndefined(Option2.map(decodeBooleanValue(leftValue), Number));
1611
+ const rightScalar = colDef.type === "number" ? Option2.getOrUndefined(decodeNumberValue(rightValue)) : Option2.getOrUndefined(Option2.map(decodeBooleanValue(rightValue), Number));
1264
1612
  if (leftScalar === undefined || rightScalar === undefined) {
1265
1613
  if (leftScalar === undefined && rightScalar === undefined)
1266
1614
  continue;
@@ -1281,12 +1629,12 @@ var sortDataTableRows = (rows, columns, sorting) => {
1281
1629
  const nullOrder = colDef.typeOptions?.nulls === "first" ? -1 : 1;
1282
1630
  return !leftDate ? nullOrder : -nullOrder;
1283
1631
  }
1284
- const comparison = DateTime.toEpochMillis(leftDate.instant) - DateTime.toEpochMillis(rightDate.instant);
1632
+ const comparison = DateTime2.toEpochMillis(leftDate.instant) - DateTime2.toEpochMillis(rightDate.instant);
1285
1633
  if (comparison !== 0)
1286
1634
  return sort.direction === "desc" ? -comparison : comparison;
1287
1635
  continue;
1288
1636
  }
1289
- const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema.is(Schema.Number)(leftValue) && Schema.is(Schema.Number)(rightValue) ? leftValue - rightValue : String(leftValue).localeCompare(String(rightValue), undefined, { numeric: true, sensitivity: "base" });
1637
+ const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema2.is(Schema2.Number)(leftValue) && Schema2.is(Schema2.Number)(rightValue) ? leftValue - rightValue : String(leftValue).localeCompare(String(rightValue), undefined, { numeric: true, sensitivity: "base" });
1290
1638
  if (comparison !== 0)
1291
1639
  return sort.direction === "desc" ? -comparison : comparison;
1292
1640
  }
@@ -1300,7 +1648,7 @@ var paginateDataTableRows = (rows, pagination) => {
1300
1648
  const start = pageIndex * pageSize;
1301
1649
  return rows.slice(start, start + pageSize);
1302
1650
  };
1303
- var sameDataTableState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.sort === right.sort && left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
1651
+ var sameDataTableState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.filters === right.filters && left.sort === right.sort && left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
1304
1652
  var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
1305
1653
  const sourceIndex = rows.findIndex((row) => row.id === sourceRowId);
1306
1654
  const targetIndex = rows.findIndex((row) => row.id === targetRowId);
@@ -1368,6 +1716,7 @@ var queryFromState = (state) => ({
1368
1716
  page: state.page,
1369
1717
  pageSize: state.pageSize,
1370
1718
  globalFilter: state.globalFilter,
1719
+ filters: state.filters,
1371
1720
  sort: state.sort
1372
1721
  });
1373
1722
  var uiFromState = (state) => ({
@@ -1379,7 +1728,7 @@ var uiFromState = (state) => ({
1379
1728
  view: state.view
1380
1729
  });
1381
1730
  var sameUiState = (left, right) => left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
1382
- var sameQueryState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.sort === right.sort;
1731
+ var sameQueryState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.filters === right.filters && left.sort === right.sort;
1383
1732
  var initialPublicState = (props, uiState) => ({
1384
1733
  ...queryFromState(props.state ?? { ...DEFAULT_QUERY, ...props.initialState }),
1385
1734
  ...uiState
@@ -1391,7 +1740,7 @@ var buildDataTableModel = (store) => {
1391
1740
  const rows = buildDataTableRows(store.rowData, columns, rowId);
1392
1741
  const pagination = store.config.features.pagination ?? { mode: "client" };
1393
1742
  const server = pagination !== false && pagination.mode === "server";
1394
- const filteredRows = server ? [...rows] : filterDataTableRows(rows, columns, store.state.globalFilter ?? "", store.config.locale);
1743
+ const filteredRows = server ? [...rows] : filterDataTableColumnRows(filterDataTableRows(rows, columns, store.state.globalFilter ?? "", store.config.locale), columns, store.state.filters ?? []);
1395
1744
  const sortedRows = server ? filteredRows : sortDataTableRows(filteredRows, columns, store.state.sort ?? []);
1396
1745
  const pageRows = pagination === false || server ? sortedRows : paginateDataTableRows(sortedRows, store.state);
1397
1746
  const totalRows = server ? pagination.rowCount : sortedRows.length;
@@ -1463,7 +1812,7 @@ var getActiveGrouping = (store) => {
1463
1812
  };
1464
1813
  var canReorderRows = (store) => {
1465
1814
  const pagination = store.config.features.pagination;
1466
- return !!store.config.features.reordering && !getActiveGrouping(store).length && !store.state.globalFilter && !store.state.sort?.length && !(pagination && pagination.mode === "server");
1815
+ return !!store.config.features.reordering && !getActiveGrouping(store).length && !store.state.globalFilter && !store.state.filters?.length && !store.state.sort?.length && !(pagination && pagination.mode === "server");
1467
1816
  };
1468
1817
  var canMoveRowsToGroups = (store) => getActiveGrouping(store).some((field) => !!field.onMoveToGroup);
1469
1818
  var canDragRows = (store) => getActiveGrouping(store).length ? canMoveRowsToGroups(store) : canReorderRows(store);
@@ -1480,14 +1829,14 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1480
1829
  };
1481
1830
  const CellRenderer = column.colDef.cellRenderer;
1482
1831
  if (CellRenderer)
1483
- return /* @__PURE__ */ jsx14(CellRenderer, {
1832
+ return /* @__PURE__ */ jsx15(CellRenderer, {
1484
1833
  ...params
1485
1834
  });
1486
1835
  const colDef = column.colDef;
1487
1836
  if (colDef.type === "reference") {
1488
1837
  if (colDef.valueFormatter)
1489
1838
  return colDef.valueFormatter(params);
1490
- return /* @__PURE__ */ jsx14(DataTableReferenceCell, {
1839
+ return /* @__PURE__ */ jsx15(DataTableReferenceCell, {
1491
1840
  item: colDef.typeOptions.getItem(row.data),
1492
1841
  emptyLabel: colDef.typeOptions.emptyLabel,
1493
1842
  imageVariant: colDef.typeOptions.imageVariant
@@ -1496,8 +1845,8 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1496
1845
  if (colDef.type === "number") {
1497
1846
  if (colDef.valueFormatter)
1498
1847
  return colDef.valueFormatter(params);
1499
- const number = Option.getOrUndefined(decodeNumberValue(value));
1500
- return /* @__PURE__ */ jsx14("span", {
1848
+ const number = Option2.getOrUndefined(decodeNumberValue(value));
1849
+ return /* @__PURE__ */ jsx15("span", {
1501
1850
  className: "block text-left tabular-nums",
1502
1851
  children: number === undefined ? colDef.typeOptions?.emptyLabel ?? "—" : formatNumberValue(number, colDef.typeOptions, locale)
1503
1852
  });
@@ -1505,16 +1854,16 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1505
1854
  if (colDef.type === "boolean") {
1506
1855
  if (colDef.valueFormatter)
1507
1856
  return colDef.valueFormatter(params);
1508
- const boolean = Option.getOrUndefined(decodeBooleanValue(value));
1857
+ const boolean = Option2.getOrUndefined(decodeBooleanValue(value));
1509
1858
  if (boolean === undefined)
1510
1859
  return colDef.typeOptions?.emptyLabel ?? "—";
1511
1860
  const options = colDef.typeOptions;
1512
- return /* @__PURE__ */ jsx14("label", {
1861
+ return /* @__PURE__ */ jsx15("label", {
1513
1862
  "data-slot": "data-table-boolean-cell",
1514
- className: cn("flex min-h-16 w-full items-center justify-start border border-transparent px-2 outline-none focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 focus-within:ring-inset in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0", options?.onChange && !options.disabled?.(row.data) && "cursor-pointer hover:bg-muted/50"),
1863
+ className: cn("focus-within:border-ring focus-within:ring-ring/50 flex min-h-16 w-full items-center justify-start border border-transparent px-2 outline-none focus-within:ring-3 focus-within:ring-inset in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0", options?.onChange && !options.disabled?.(row.data) && "hover:bg-muted/50 cursor-pointer"),
1515
1864
  onClick: (event) => event.stopPropagation(),
1516
1865
  onPointerDown: (event) => event.stopPropagation(),
1517
- children: /* @__PURE__ */ jsx14(Checkbox, {
1866
+ children: /* @__PURE__ */ jsx15(Checkbox, {
1518
1867
  "aria-label": options?.getAriaLabel?.(row.data) ?? columnLabel(column),
1519
1868
  className: "focus-visible:ring-0 focus-visible:outline-none",
1520
1869
  checked: boolean,
@@ -1528,7 +1877,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1528
1877
  if (colDef.valueFormatter)
1529
1878
  return colDef.valueFormatter(params);
1530
1879
  const date = resolveDate(value, colDef.type);
1531
- return date ? /* @__PURE__ */ jsx14("time", {
1880
+ return date ? /* @__PURE__ */ jsx15("time", {
1532
1881
  dateTime: dateIsoValue(date),
1533
1882
  children: formatDateValue(date, colDef, locale)
1534
1883
  }) : colDef.typeOptions?.emptyLabel ?? "—";
@@ -1542,7 +1891,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1542
1891
  disabled: (item) => action.disabled?.({ item, row: row.data }) ?? false
1543
1892
  }));
1544
1893
  if (config.getOptions) {
1545
- return /* @__PURE__ */ jsx14(DataTableListCell, {
1894
+ return /* @__PURE__ */ jsx15(DataTableListCell, {
1546
1895
  ...config,
1547
1896
  itemActions,
1548
1897
  onItemClick: config.onItemClick ? (item) => config.onItemClick?.({ item, row: row.data }) : undefined,
@@ -1555,7 +1904,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1555
1904
  onRemove: config.onRemove ? (value) => config.onRemove?.({ value, row: row.data }) : undefined
1556
1905
  });
1557
1906
  }
1558
- return /* @__PURE__ */ jsx14(DataTableListCell, {
1907
+ return /* @__PURE__ */ jsx15(DataTableListCell, {
1559
1908
  ...config,
1560
1909
  itemActions,
1561
1910
  onItemClick: config.onItemClick ? (item) => config.onItemClick?.({ item, row: row.data }) : undefined,
@@ -1568,25 +1917,19 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1568
1917
  return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : String(value));
1569
1918
  };
1570
1919
  var nodeText = (node) => {
1571
- if (Schema.is(Schema.String)(node) || Schema.is(Schema.Number)(node))
1920
+ if (Schema2.is(Schema2.String)(node) || Schema2.is(Schema2.Number)(node))
1572
1921
  return String(node);
1573
1922
  if (!isValidElement(node))
1574
1923
  return "";
1575
- if (Schema.is(Schema.String)(node.props.title))
1924
+ if (Schema2.is(Schema2.String)(node.props.title))
1576
1925
  return node.props.title;
1577
1926
  return nodeText(node.props.children);
1578
1927
  };
1579
1928
  var columnLabel = (column) => nodeText(column.colDef.headerName) || column.id;
1580
1929
  var withExtension = (fileName, extension) => fileName.includes(".") ? fileName.replace(/\.[^/.]+$/, `.${extension}`) : `${fileName}.${extension}`;
1581
- var escapeCsvValue = (value) => {
1582
- if (value === null || value === undefined)
1583
- return "";
1584
- const text = String(value);
1585
- return /[",\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
1586
- };
1587
1930
  var downloadCsv = (headers, data, fileName = "data.csv") => {
1588
- const content = [headers, ...data].map((row) => row.map(escapeCsvValue).join(",")).join(`
1589
- `);
1931
+ const content = Effect2.runSync(Stream.fromIterable([headers, ...data]).pipe(Stream.map((row) => row.map((value) => value == null ? "" : String(value))), Stream.pipeThroughChannel(Csv.encodeString({ newline: `
1932
+ ` })), Stream.runCollect, Effect2.map((parts) => parts.join("").slice(0, -1))));
1590
1933
  downloadBlob(content, "text/csv;charset=utf-8", withExtension(fileName, "csv"));
1591
1934
  };
1592
1935
  var downloadJson = (data, fileName = "data.json") => downloadBlob(JSON.stringify(data, null, 2), "application/json;charset=utf-8", withExtension(fileName, "json"));
@@ -1608,33 +1951,33 @@ var DataTableRowActions = ({
1608
1951
  const visible = actions.filter((action) => !action.visible || action.visible(row));
1609
1952
  if (!visible.length)
1610
1953
  return null;
1611
- return /* @__PURE__ */ jsxs8(DropdownMenu, {
1954
+ return /* @__PURE__ */ jsxs9(DropdownMenu, {
1612
1955
  children: [
1613
- /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
1956
+ /* @__PURE__ */ jsx15(DropdownMenuTrigger, {
1614
1957
  onClick: (event) => event.stopPropagation(),
1615
- render: /* @__PURE__ */ jsxs8(Button, {
1958
+ render: /* @__PURE__ */ jsxs9(Button, {
1616
1959
  className: "size-8 focus-visible:ring-inset [&_svg:not([class*='size-'])]:size-4",
1617
1960
  size: "icon",
1618
1961
  variant: "ghost",
1619
1962
  children: [
1620
- /* @__PURE__ */ jsx14("span", {
1963
+ /* @__PURE__ */ jsx15("span", {
1621
1964
  className: "sr-only",
1622
1965
  children: title
1623
1966
  }),
1624
- /* @__PURE__ */ jsx14(MoreHorizontal, {})
1967
+ /* @__PURE__ */ jsx15(MoreHorizontal, {})
1625
1968
  ]
1626
1969
  })
1627
1970
  }),
1628
- /* @__PURE__ */ jsx14(DropdownMenuContent, {
1971
+ /* @__PURE__ */ jsx15(DropdownMenuContent, {
1629
1972
  align: "end",
1630
1973
  className: "w-max",
1631
- children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
1974
+ children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
1632
1975
  children: [
1633
- /* @__PURE__ */ jsx14(DropdownMenuLabel, {
1976
+ /* @__PURE__ */ jsx15(DropdownMenuLabel, {
1634
1977
  children: title
1635
1978
  }),
1636
- /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}),
1637
- visible.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
1979
+ /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
1980
+ visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
1638
1981
  onClick: (event) => {
1639
1982
  event.stopPropagation();
1640
1983
  action.onClick(row);
@@ -1671,7 +2014,7 @@ var DataTableRowActionMenu = ({
1671
2014
  reorderActions.push({
1672
2015
  id: "data-table-move-up",
1673
2016
  name: store.config.labels.moveUp,
1674
- icon: /* @__PURE__ */ jsx14(ArrowUp, {}),
2017
+ icon: /* @__PURE__ */ jsx15(ArrowUp, {}),
1675
2018
  onClick: () => move(rowIndex - 1)
1676
2019
  });
1677
2020
  }
@@ -1679,12 +2022,12 @@ var DataTableRowActionMenu = ({
1679
2022
  reorderActions.push({
1680
2023
  id: "data-table-move-down",
1681
2024
  name: store.config.labels.moveDown,
1682
- icon: /* @__PURE__ */ jsx14(ArrowDown, {}),
2025
+ icon: /* @__PURE__ */ jsx15(ArrowDown, {}),
1683
2026
  onClick: () => move(rowIndex + 1)
1684
2027
  });
1685
2028
  }
1686
2029
  }
1687
- return /* @__PURE__ */ jsx14(DataTableRowActions, {
2030
+ return /* @__PURE__ */ jsx15(DataTableRowActions, {
1688
2031
  actions: [...reorderActions, ...rowActions ? rowActions.items : []],
1689
2032
  row: row.data,
1690
2033
  title: rowActions?.label ?? store.config.labels.actions
@@ -1703,12 +2046,13 @@ var DataTableToolbar = ({
1703
2046
  const grouping = features.grouping;
1704
2047
  const toolbar = features.toolbar;
1705
2048
  const bulkActions = features.selection && features.selection.bulkActions;
1706
- const hasToolbar = !!toolbar || features.search !== false || features.sorting !== false || features.columnVisibility !== false || !!features.export || !!features.gallery || !!grouping || !!features.refresh || !!bulkActions && selectedRows.length > 0;
2049
+ const hasToolbar = !!toolbar || features.search !== false || features.filtering !== false || features.sorting !== false || features.columnVisibility !== false || !!features.export || !!features.gallery || !!grouping || !!features.refresh || !!bulkActions && selectedRows.length > 0;
1707
2050
  if (!hasToolbar)
1708
2051
  return null;
1709
2052
  const update = (next) => changeState(setStore, next);
1710
2053
  const visibleBulkActions = bulkActions ? bulkActions.items.filter((action) => !action.visible || action.visible(selectedRows)) : [];
1711
- const exportRows = features.export && features.export.scope === "filteredRows" ? model.filteredRows : model.pageRows;
2054
+ const exportRows = features.export && features.export.scope === "currentPage" ? model.pageRows : model.sortedRows;
2055
+ const exportColumns = getDataTableExportColumns(model.visibleColumns);
1712
2056
  const exportFeature = features.export;
1713
2057
  const exportActions = exportFeature ? exportFeature.actions ?? [] : [];
1714
2058
  const builtInExport = exportFeature && exportFeature.builtIn !== false;
@@ -1730,16 +2074,16 @@ var DataTableToolbar = ({
1730
2074
  setExporting(false);
1731
2075
  }
1732
2076
  };
1733
- return /* @__PURE__ */ jsxs8("div", {
2077
+ return /* @__PURE__ */ jsxs9("div", {
1734
2078
  className: "flex flex-col gap-2 pb-4",
1735
2079
  children: [
1736
- features.search !== false ? /* @__PURE__ */ jsxs8("div", {
2080
+ features.search !== false ? /* @__PURE__ */ jsxs9("div", {
1737
2081
  className: "relative min-w-0",
1738
2082
  children: [
1739
- /* @__PURE__ */ jsx14(Search, {
2083
+ /* @__PURE__ */ jsx15(Search, {
1740
2084
  className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
1741
2085
  }),
1742
- /* @__PURE__ */ jsx14(Input, {
2086
+ /* @__PURE__ */ jsx15(Input, {
1743
2087
  className: "px-9",
1744
2088
  onChange: (event) => update((state) => ({
1745
2089
  ...state,
@@ -1749,7 +2093,7 @@ var DataTableToolbar = ({
1749
2093
  placeholder: labels.filter,
1750
2094
  value: store.state.globalFilter ?? ""
1751
2095
  }),
1752
- store.state.globalFilter ? /* @__PURE__ */ jsx14(Button, {
2096
+ store.state.globalFilter ? /* @__PURE__ */ jsx15(Button, {
1753
2097
  "aria-label": labels.filter,
1754
2098
  className: "absolute top-1/2 right-1 size-7 -translate-y-1/2 active:not-aria-[haspopup]:-translate-y-1/2",
1755
2099
  onClick: () => update((state) => ({
@@ -1759,39 +2103,38 @@ var DataTableToolbar = ({
1759
2103
  })),
1760
2104
  size: "icon",
1761
2105
  variant: "ghost",
1762
- children: /* @__PURE__ */ jsx14(X, {})
2106
+ children: /* @__PURE__ */ jsx15(X, {})
1763
2107
  }) : null
1764
2108
  ]
1765
2109
  }) : null,
1766
- /* @__PURE__ */ jsx14("div", {
2110
+ /* @__PURE__ */ jsx15("div", {
1767
2111
  className: "-m-1 flex overflow-x-auto p-1",
1768
- children: /* @__PURE__ */ jsxs8(Menubar, {
2112
+ children: /* @__PURE__ */ jsxs9(Menubar, {
1769
2113
  className: "h-auto w-max min-w-full justify-start bg-transparent shadow-none [&_[data-slot=menubar-trigger]]:gap-2 [&_[data-slot=menubar-trigger]_svg]:size-4",
1770
2114
  children: [
1771
- toolbar && toolbar.items,
1772
- visibleBulkActions.length ? /* @__PURE__ */ jsxs8(MenubarMenu, {
2115
+ visibleBulkActions.length ? /* @__PURE__ */ jsxs9(MenubarMenu, {
1773
2116
  children: [
1774
- /* @__PURE__ */ jsxs8(MenubarTrigger, {
2117
+ /* @__PURE__ */ jsxs9(MenubarTrigger, {
1775
2118
  className: "bg-primary text-primary-foreground hover:bg-primary/90 aria-expanded:bg-primary/90",
1776
2119
  children: [
1777
2120
  labels.selected,
1778
- /* @__PURE__ */ jsx14(Badge, {
2121
+ /* @__PURE__ */ jsx15(Badge, {
1779
2122
  variant: "secondary",
1780
2123
  children: selectedRows.length
1781
2124
  }),
1782
- /* @__PURE__ */ jsx14(ChevronDown, {})
2125
+ /* @__PURE__ */ jsx15(ChevronDown, {})
1783
2126
  ]
1784
2127
  }),
1785
- /* @__PURE__ */ jsx14(MenubarContent, {
2128
+ /* @__PURE__ */ jsx15(MenubarContent, {
1786
2129
  align: "end",
1787
2130
  className: "w-max",
1788
- children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2131
+ children: /* @__PURE__ */ jsxs9(MenubarGroup, {
1789
2132
  children: [
1790
- /* @__PURE__ */ jsx14(MenubarLabel, {
2133
+ /* @__PURE__ */ jsx15(MenubarLabel, {
1791
2134
  children: bulkActions && bulkActions.label ? bulkActions.label : labels.actions
1792
2135
  }),
1793
- /* @__PURE__ */ jsx14(MenubarSeparator, {}),
1794
- visibleBulkActions.map((action) => /* @__PURE__ */ jsxs8(MenubarItem, {
2136
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2137
+ visibleBulkActions.map((action) => /* @__PURE__ */ jsxs9(MenubarItem, {
1795
2138
  onClick: () => action.onClick(selectedRows),
1796
2139
  variant: action.variant ?? "default",
1797
2140
  children: [
@@ -1804,27 +2147,31 @@ var DataTableToolbar = ({
1804
2147
  })
1805
2148
  ]
1806
2149
  }) : null,
1807
- grouping ? /* @__PURE__ */ jsxs8(MenubarMenu, {
2150
+ toolbar && toolbar.items,
2151
+ features.filtering !== false ? /* @__PURE__ */ jsx15(FilterMenu, {
2152
+ tableAtom
2153
+ }) : null,
2154
+ grouping ? /* @__PURE__ */ jsxs9(MenubarMenu, {
1808
2155
  children: [
1809
- /* @__PURE__ */ jsxs8(MenubarTrigger, {
2156
+ /* @__PURE__ */ jsxs9(MenubarTrigger, {
1810
2157
  "aria-label": labels.groupBy,
1811
2158
  children: [
1812
- /* @__PURE__ */ jsx14(Rows3, {}),
1813
- /* @__PURE__ */ jsx14("span", {
2159
+ /* @__PURE__ */ jsx15(Rows3, {}),
2160
+ /* @__PURE__ */ jsx15("span", {
1814
2161
  className: "hidden sm:inline",
1815
2162
  children: labels.groupBy
1816
2163
  })
1817
2164
  ]
1818
2165
  }),
1819
- /* @__PURE__ */ jsx14(MenubarContent, {
2166
+ /* @__PURE__ */ jsx15(MenubarContent, {
1820
2167
  align: "end",
1821
- children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2168
+ children: /* @__PURE__ */ jsxs9(MenubarGroup, {
1822
2169
  children: [
1823
- /* @__PURE__ */ jsx14(MenubarLabel, {
2170
+ /* @__PURE__ */ jsx15(MenubarLabel, {
1824
2171
  children: labels.groupBy
1825
2172
  }),
1826
- /* @__PURE__ */ jsx14(MenubarSeparator, {}),
1827
- grouping.fields.map((field) => /* @__PURE__ */ jsx14(MenubarCheckboxItem, {
2173
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2174
+ grouping.fields.map((field) => /* @__PURE__ */ jsx15(MenubarCheckboxItem, {
1828
2175
  checked: store.state.grouping.includes(field.id),
1829
2176
  onCheckedChange: (checked) => update((state) => ({
1830
2177
  ...state,
@@ -1837,77 +2184,77 @@ var DataTableToolbar = ({
1837
2184
  })
1838
2185
  ]
1839
2186
  }) : null,
1840
- features.sorting !== false ? /* @__PURE__ */ jsx14(SortMenu, {
2187
+ features.sorting !== false ? /* @__PURE__ */ jsx15(SortMenu, {
1841
2188
  tableAtom
1842
2189
  }) : null,
1843
- features.gallery ? /* @__PURE__ */ jsx14(ViewMenu, {
2190
+ features.gallery ? /* @__PURE__ */ jsx15(ViewMenu, {
1844
2191
  tableAtom
1845
2192
  }) : null,
1846
- features.columnVisibility !== false ? /* @__PURE__ */ jsx14(ColumnMenu, {
2193
+ features.columnVisibility !== false ? /* @__PURE__ */ jsx15(ColumnMenu, {
1847
2194
  tableAtom
1848
2195
  }) : null,
1849
- features.refresh ? /* @__PURE__ */ jsx14(MenubarMenu, {
1850
- children: /* @__PURE__ */ jsxs8(MenubarTrigger, {
2196
+ features.refresh ? /* @__PURE__ */ jsx15(MenubarMenu, {
2197
+ children: /* @__PURE__ */ jsxs9(MenubarTrigger, {
1851
2198
  "aria-label": labels.refresh,
1852
2199
  onClick: features.refresh,
1853
2200
  children: [
1854
- /* @__PURE__ */ jsx14(RefreshCw, {}),
1855
- /* @__PURE__ */ jsx14("span", {
2201
+ /* @__PURE__ */ jsx15(RefreshCw, {}),
2202
+ /* @__PURE__ */ jsx15("span", {
1856
2203
  className: "hidden sm:inline",
1857
2204
  children: labels.refresh
1858
2205
  })
1859
2206
  ]
1860
2207
  })
1861
2208
  }) : null,
1862
- features.export ? /* @__PURE__ */ jsxs8(MenubarMenu, {
2209
+ features.export ? /* @__PURE__ */ jsxs9(MenubarMenu, {
1863
2210
  children: [
1864
- /* @__PURE__ */ jsxs8(MenubarTrigger, {
2211
+ /* @__PURE__ */ jsxs9(MenubarTrigger, {
1865
2212
  "aria-label": labels.export,
1866
2213
  "aria-busy": exporting,
1867
2214
  disabled: exporting || !canExport,
1868
2215
  children: [
1869
- exporting ? /* @__PURE__ */ jsx14(RefreshCw, {
2216
+ exporting ? /* @__PURE__ */ jsx15(RefreshCw, {
1870
2217
  className: "animate-spin"
1871
- }) : /* @__PURE__ */ jsx14(Download, {}),
1872
- /* @__PURE__ */ jsx14("span", {
2218
+ }) : /* @__PURE__ */ jsx15(Download, {}),
2219
+ /* @__PURE__ */ jsx15("span", {
1873
2220
  className: "hidden sm:inline",
1874
2221
  children: exporting ? labels.loading : labels.export
1875
2222
  })
1876
2223
  ]
1877
2224
  }),
1878
- /* @__PURE__ */ jsx14(MenubarContent, {
2225
+ /* @__PURE__ */ jsx15(MenubarContent, {
1879
2226
  align: "end",
1880
- children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2227
+ children: /* @__PURE__ */ jsxs9(MenubarGroup, {
1881
2228
  children: [
1882
- /* @__PURE__ */ jsx14(MenubarLabel, {
2229
+ /* @__PURE__ */ jsx15(MenubarLabel, {
1883
2230
  children: labels.export
1884
2231
  }),
1885
- /* @__PURE__ */ jsx14(MenubarSeparator, {}),
1886
- builtInExport ? /* @__PURE__ */ jsxs8(Fragment, {
2232
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2233
+ builtInExport ? /* @__PURE__ */ jsxs9(Fragment, {
1887
2234
  children: [
1888
- /* @__PURE__ */ jsxs8(MenubarItem, {
2235
+ /* @__PURE__ */ jsxs9(MenubarItem, {
1889
2236
  disabled: exporting || !exportRows.length,
1890
- onClick: () => downloadCsv(model.visibleColumns.map(columnLabel), exportRows.map((row) => model.visibleColumns.map((column) => String(getDataTableExportValue(row, column, store.config.locale) ?? ""))), features.export ? features.export.baseName : "table"),
2237
+ onClick: () => downloadCsv(exportColumns.map(columnLabel), exportRows.map((row) => exportColumns.map((column) => String(getDataTableExportValue(row, column, store.config.locale) ?? ""))), features.export ? features.export.baseName : "table"),
1891
2238
  children: [
1892
- /* @__PURE__ */ jsx14(FileText, {}),
2239
+ /* @__PURE__ */ jsx15(FileText, {}),
1893
2240
  labels.exportCsv
1894
2241
  ]
1895
2242
  }),
1896
- /* @__PURE__ */ jsxs8(MenubarItem, {
2243
+ /* @__PURE__ */ jsxs9(MenubarItem, {
1897
2244
  disabled: exporting || !exportRows.length,
1898
- onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(model.visibleColumns.map((column) => [
2245
+ onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(exportColumns.map((column) => [
1899
2246
  column.id,
1900
2247
  getDataTableExportValue(row, column, store.config.locale)
1901
2248
  ]))), features.export ? features.export.baseName : "table"),
1902
2249
  children: [
1903
- /* @__PURE__ */ jsx14(FileJson, {}),
2250
+ /* @__PURE__ */ jsx15(FileJson, {}),
1904
2251
  labels.exportJson
1905
2252
  ]
1906
2253
  })
1907
2254
  ]
1908
2255
  }) : null,
1909
- builtInExport && exportActions.length ? /* @__PURE__ */ jsx14(MenubarSeparator, {}) : null,
1910
- exportActions.map((action) => /* @__PURE__ */ jsxs8(MenubarItem, {
2256
+ builtInExport && exportActions.length ? /* @__PURE__ */ jsx15(MenubarSeparator, {}) : null,
2257
+ exportActions.map((action) => /* @__PURE__ */ jsxs9(MenubarItem, {
1911
2258
  disabled: exporting || action.disabled,
1912
2259
  onClick: () => void runExport(action),
1913
2260
  children: [
@@ -1923,7 +2270,7 @@ var DataTableToolbar = ({
1923
2270
  ]
1924
2271
  })
1925
2272
  }),
1926
- exportFeature && exportFailed ? /* @__PURE__ */ jsx14("p", {
2273
+ exportFeature && exportFailed ? /* @__PURE__ */ jsx15("p", {
1927
2274
  role: "alert",
1928
2275
  className: "text-destructive text-sm",
1929
2276
  children: labels.exportFailed ?? dataTableMessages(store.config.locale).exportFailed
@@ -1931,11 +2278,349 @@ var DataTableToolbar = ({
1931
2278
  ]
1932
2279
  });
1933
2280
  };
2281
+ var withColumnFilter = (state, id, filter) => {
2282
+ const filters = (state.filters ?? []).filter((current) => current.id !== id);
2283
+ if (filter)
2284
+ filters.push(filter);
2285
+ return { ...state, page: 0, filters: filters.length ? filters : undefined };
2286
+ };
2287
+ var FilterEditor = ({
2288
+ column,
2289
+ rows,
2290
+ current,
2291
+ labels,
2292
+ onChange
2293
+ }) => {
2294
+ const inputId = useId2();
2295
+ const kind = getDataTableFilterKind(column);
2296
+ const [primary, setPrimary] = useState(current?.kind === "text" ? current.value : current?.kind === "number" ? String(current.min ?? "") : current?.kind === "date" ? current.from ?? "" : "");
2297
+ const [secondary, setSecondary] = useState(current?.kind === "number" ? String(current.max ?? "") : current?.kind === "date" ? current.to ?? "" : "");
2298
+ const [operator, setOperator] = useState(current?.kind === "text" ? current.operator : "contains");
2299
+ const operatorOptions = [
2300
+ { value: "contains", label: labels.filterContains },
2301
+ { value: "equals", label: labels.filterEquals },
2302
+ { value: "startsWith", label: labels.filterStartsWith },
2303
+ { value: "endsWith", label: labels.filterEndsWith }
2304
+ ];
2305
+ const [invalid, setInvalid] = useState(false);
2306
+ const [optionSearch, setOptionSearch] = useState("");
2307
+ const apply = (candidate) => {
2308
+ const decoded = Schema2.decodeUnknownOption(ColumnFilter)(candidate);
2309
+ if (Option2.isNone(decoded)) {
2310
+ setInvalid(true);
2311
+ return;
2312
+ }
2313
+ setInvalid(false);
2314
+ onChange(decoded.value);
2315
+ };
2316
+ if (kind === "boolean") {
2317
+ return /* @__PURE__ */ jsxs9(MenubarGroup, {
2318
+ children: [
2319
+ /* @__PURE__ */ jsxs9(MenubarRadioGroup, {
2320
+ value: current?.kind === "boolean" ? String(current.value) : "",
2321
+ onValueChange: (value) => apply({ id: column.id, kind, value: value === "true" }),
2322
+ children: [
2323
+ /* @__PURE__ */ jsx15(MenubarRadioItem, {
2324
+ value: "true",
2325
+ closeOnClick: false,
2326
+ children: column.colDef.type === "boolean" ? column.colDef.typeOptions?.trueLabel ?? labels.filterTrue : labels.filterTrue
2327
+ }),
2328
+ /* @__PURE__ */ jsx15(MenubarRadioItem, {
2329
+ value: "false",
2330
+ closeOnClick: false,
2331
+ children: column.colDef.type === "boolean" ? column.colDef.typeOptions?.falseLabel ?? labels.filterFalse : labels.filterFalse
2332
+ })
2333
+ ]
2334
+ }),
2335
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2336
+ /* @__PURE__ */ jsx15(MenubarItem, {
2337
+ closeOnClick: false,
2338
+ onClick: () => onChange(undefined),
2339
+ children: labels.filterClear
2340
+ })
2341
+ ]
2342
+ });
2343
+ }
2344
+ if (kind === "values") {
2345
+ const selected = current?.kind === "values" ? current.values : [];
2346
+ const options = getDataTableFilterOptions(rows, column);
2347
+ const filteredOptions = options.filter((option) => option.label.toLocaleLowerCase().includes(optionSearch.trim().toLocaleLowerCase()));
2348
+ return /* @__PURE__ */ jsxs9(MenubarGroup, {
2349
+ children: [
2350
+ options.length > 8 ? /* @__PURE__ */ jsx15("div", {
2351
+ className: "p-1",
2352
+ children: /* @__PURE__ */ jsx15(Input, {
2353
+ "aria-label": labels.filter,
2354
+ placeholder: labels.filter,
2355
+ value: optionSearch,
2356
+ onChange: (event) => setOptionSearch(event.target.value),
2357
+ onKeyDown: (event) => {
2358
+ if (event.key !== "Escape")
2359
+ event.stopPropagation();
2360
+ }
2361
+ })
2362
+ }) : null,
2363
+ filteredOptions.map((option) => /* @__PURE__ */ jsxs9(MenubarCheckboxItem, {
2364
+ checked: selected.includes(option.value),
2365
+ closeOnClick: false,
2366
+ onCheckedChange: (checked) => {
2367
+ const values = checked ? [...selected, option.value] : selected.filter((value) => value !== option.value);
2368
+ if (values.length)
2369
+ apply({ id: column.id, kind, values });
2370
+ else
2371
+ onChange(undefined);
2372
+ },
2373
+ children: [
2374
+ /* @__PURE__ */ jsx15("span", {
2375
+ className: "min-w-0 flex-1 truncate",
2376
+ children: option.label
2377
+ }),
2378
+ option.count !== undefined ? /* @__PURE__ */ jsx15(Badge, {
2379
+ variant: "secondary",
2380
+ className: "ml-auto shrink-0",
2381
+ children: option.count
2382
+ }) : null
2383
+ ]
2384
+ }, option.value)),
2385
+ !filteredOptions.length ? /* @__PURE__ */ jsx15("div", {
2386
+ className: "text-muted-foreground px-2 py-1.5 text-sm",
2387
+ children: labels.empty
2388
+ }) : null,
2389
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2390
+ /* @__PURE__ */ jsx15(MenubarItem, {
2391
+ closeOnClick: false,
2392
+ onClick: () => onChange(undefined),
2393
+ children: labels.filterClear
2394
+ })
2395
+ ]
2396
+ });
2397
+ }
2398
+ return /* @__PURE__ */ jsxs9("form", {
2399
+ className: "flex flex-col gap-3 p-2",
2400
+ onKeyDown: (event) => {
2401
+ if (event.key !== "Escape")
2402
+ event.stopPropagation();
2403
+ },
2404
+ onSubmit: (event) => {
2405
+ event.preventDefault();
2406
+ if (kind === "text")
2407
+ apply({ id: column.id, kind, operator, value: primary.trim() });
2408
+ else if (kind === "date")
2409
+ apply({
2410
+ id: column.id,
2411
+ kind,
2412
+ from: primary || undefined,
2413
+ to: secondary || undefined
2414
+ });
2415
+ else {
2416
+ const min = primary ? Schema2.decodeUnknownOption(Schema2.FiniteFromString)(primary) : Option2.some(undefined);
2417
+ const max = secondary ? Schema2.decodeUnknownOption(Schema2.FiniteFromString)(secondary) : Option2.some(undefined);
2418
+ if (Option2.isNone(min) || Option2.isNone(max)) {
2419
+ setInvalid(true);
2420
+ return;
2421
+ }
2422
+ apply({ id: column.id, kind, min: min.value, max: max.value });
2423
+ }
2424
+ },
2425
+ children: [
2426
+ /* @__PURE__ */ jsxs9(FieldGroup, {
2427
+ children: [
2428
+ kind === "text" ? /* @__PURE__ */ jsxs9(Field, {
2429
+ children: [
2430
+ /* @__PURE__ */ jsx15(FieldLabel, {
2431
+ htmlFor: `${inputId}-operator`,
2432
+ children: labels.filterOperator
2433
+ }),
2434
+ /* @__PURE__ */ jsxs9(Select, {
2435
+ items: operatorOptions,
2436
+ value: operator,
2437
+ onValueChange: (value) => {
2438
+ const decoded = Schema2.decodeUnknownOption(TextFilterOperator)(value);
2439
+ if (Option2.isSome(decoded))
2440
+ setOperator(decoded.value);
2441
+ },
2442
+ children: [
2443
+ /* @__PURE__ */ jsx15(SelectTrigger, {
2444
+ id: `${inputId}-operator`,
2445
+ children: /* @__PURE__ */ jsx15(SelectValue, {})
2446
+ }),
2447
+ /* @__PURE__ */ jsx15(SelectContent, {
2448
+ children: /* @__PURE__ */ jsx15(SelectGroup, {
2449
+ children: operatorOptions.map((option) => /* @__PURE__ */ jsx15(SelectItem, {
2450
+ value: option.value,
2451
+ children: option.label
2452
+ }, option.value))
2453
+ })
2454
+ })
2455
+ ]
2456
+ })
2457
+ ]
2458
+ }) : null,
2459
+ /* @__PURE__ */ jsxs9(Field, {
2460
+ "data-invalid": invalid || undefined,
2461
+ children: [
2462
+ /* @__PURE__ */ jsx15(FieldLabel, {
2463
+ htmlFor: `${inputId}-primary`,
2464
+ children: kind === "text" ? labels.filterValue : kind === "date" ? labels.filterFrom : labels.filterMin
2465
+ }),
2466
+ /* @__PURE__ */ jsx15(Input, {
2467
+ id: `${inputId}-primary`,
2468
+ type: kind === "text" ? "text" : kind === "date" ? "date" : "number",
2469
+ step: kind === "number" ? "any" : undefined,
2470
+ value: primary,
2471
+ "aria-invalid": invalid || undefined,
2472
+ onChange: (event) => {
2473
+ setPrimary(event.target.value);
2474
+ setInvalid(false);
2475
+ }
2476
+ })
2477
+ ]
2478
+ }),
2479
+ kind !== "text" ? /* @__PURE__ */ jsxs9(Field, {
2480
+ "data-invalid": invalid || undefined,
2481
+ children: [
2482
+ /* @__PURE__ */ jsx15(FieldLabel, {
2483
+ htmlFor: `${inputId}-secondary`,
2484
+ children: kind === "date" ? labels.filterTo : labels.filterMax
2485
+ }),
2486
+ /* @__PURE__ */ jsx15(Input, {
2487
+ id: `${inputId}-secondary`,
2488
+ type: kind === "date" ? "date" : "number",
2489
+ step: kind === "number" ? "any" : undefined,
2490
+ value: secondary,
2491
+ "aria-invalid": invalid || undefined,
2492
+ onChange: (event) => {
2493
+ setSecondary(event.target.value);
2494
+ setInvalid(false);
2495
+ }
2496
+ })
2497
+ ]
2498
+ }) : null
2499
+ ]
2500
+ }),
2501
+ invalid ? /* @__PURE__ */ jsx15("p", {
2502
+ role: "alert",
2503
+ className: "text-destructive text-sm",
2504
+ children: labels.filterInvalid
2505
+ }) : null,
2506
+ /* @__PURE__ */ jsxs9("div", {
2507
+ className: "flex gap-2",
2508
+ children: [
2509
+ /* @__PURE__ */ jsx15(Button, {
2510
+ type: "submit",
2511
+ size: "sm",
2512
+ children: labels.filterApply
2513
+ }),
2514
+ /* @__PURE__ */ jsx15(Button, {
2515
+ type: "button",
2516
+ size: "sm",
2517
+ variant: "outline",
2518
+ onClick: () => {
2519
+ setPrimary("");
2520
+ setSecondary("");
2521
+ setInvalid(false);
2522
+ onChange(undefined);
2523
+ },
2524
+ children: labels.filterClear
2525
+ })
2526
+ ]
2527
+ })
2528
+ ]
2529
+ });
2530
+ };
2531
+ var FilterMenu = ({
2532
+ tableAtom
2533
+ }) => {
2534
+ const [store, setStore] = useTableAtom(tableAtom);
2535
+ const model = deriveModel(store);
2536
+ const columns = model.columns.flatMap((parent) => getDataTableFilterColumns([parent]).map((column) => ({
2537
+ column,
2538
+ label: column.id === parent.id ? columnLabel(column) : `${columnLabel(parent)} / ${columnLabel(column)}`
2539
+ })));
2540
+ if (!columns.length)
2541
+ return null;
2542
+ const filters = store.state.filters ?? [];
2543
+ const update = (id, filter) => changeState(setStore, (state) => withColumnFilter(state, id, filter));
2544
+ return /* @__PURE__ */ jsxs9(MenubarMenu, {
2545
+ children: [
2546
+ /* @__PURE__ */ jsxs9(MenubarTrigger, {
2547
+ "aria-label": store.config.labels.filters,
2548
+ children: [
2549
+ /* @__PURE__ */ jsx15(ListFilter, {}),
2550
+ /* @__PURE__ */ jsx15("span", {
2551
+ children: store.config.labels.filters
2552
+ }),
2553
+ filters.length ? /* @__PURE__ */ jsx15(Badge, {
2554
+ variant: "secondary",
2555
+ children: filters.length
2556
+ }) : null
2557
+ ]
2558
+ }),
2559
+ /* @__PURE__ */ jsx15(MenubarContent, {
2560
+ align: "end",
2561
+ className: "w-80 max-w-[calc(100vw-2rem)]",
2562
+ children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2563
+ children: [
2564
+ /* @__PURE__ */ jsx15(MenubarLabel, {
2565
+ children: store.config.labels.filters
2566
+ }),
2567
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2568
+ columns.map(({ column, label }) => /* @__PURE__ */ jsxs9(MenubarSub, {
2569
+ children: [
2570
+ /* @__PURE__ */ jsxs9(MenubarSubTrigger, {
2571
+ children: [
2572
+ /* @__PURE__ */ jsx15("span", {
2573
+ className: "min-w-0 flex-1 truncate",
2574
+ children: label
2575
+ }),
2576
+ filters.some((filter) => filter.id === column.id) ? /* @__PURE__ */ jsx15(Check, {}) : null
2577
+ ]
2578
+ }),
2579
+ /* @__PURE__ */ jsx15(MenubarSubContent, {
2580
+ className: "w-80 max-w-[calc(100vw-2rem)]",
2581
+ children: /* @__PURE__ */ jsx15(FilterEditor, {
2582
+ column,
2583
+ rows: model.rows,
2584
+ current: filters.find((filter) => filter.id === column.id),
2585
+ labels: store.config.labels,
2586
+ onChange: (filter) => update(column.id, filter)
2587
+ })
2588
+ })
2589
+ ]
2590
+ }, column.id)),
2591
+ filters.length ? /* @__PURE__ */ jsxs9(Fragment, {
2592
+ children: [
2593
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2594
+ /* @__PURE__ */ jsxs9(MenubarItem, {
2595
+ onClick: () => changeState(setStore, (state) => ({
2596
+ ...state,
2597
+ page: 0,
2598
+ filters: undefined
2599
+ })),
2600
+ children: [
2601
+ /* @__PURE__ */ jsx15(X, {}),
2602
+ store.config.labels.filtersClear
2603
+ ]
2604
+ })
2605
+ ]
2606
+ }) : null
2607
+ ]
2608
+ })
2609
+ })
2610
+ ]
2611
+ });
2612
+ };
1934
2613
  var SortMenu = ({
1935
2614
  tableAtom
1936
2615
  }) => {
1937
2616
  const [store, setStore] = useTableAtom(tableAtom);
1938
- const columns = deriveModel(store).columns.filter(({ colDef }) => colDef.sortable !== false);
2617
+ const columns = deriveModel(store).columns.flatMap((column) => getDataTableSortColumns([column]).map((field) => field.id === column.id ? field : {
2618
+ ...field,
2619
+ colDef: {
2620
+ ...field.colDef,
2621
+ headerName: `${columnLabel(column)} / ${columnLabel(field)}`
2622
+ }
2623
+ }));
1939
2624
  if (!columns.length)
1940
2625
  return null;
1941
2626
  const current = store.state.sort?.[0];
@@ -1944,69 +2629,77 @@ var SortMenu = ({
1944
2629
  sort: [{ id, direction }],
1945
2630
  page: 0
1946
2631
  }));
1947
- return /* @__PURE__ */ jsxs8(MenubarMenu, {
2632
+ return /* @__PURE__ */ jsxs9(MenubarMenu, {
1948
2633
  children: [
1949
- /* @__PURE__ */ jsxs8(MenubarTrigger, {
2634
+ /* @__PURE__ */ jsxs9(MenubarTrigger, {
1950
2635
  "aria-label": store.config.labels.sortBy,
1951
2636
  children: [
1952
- current ? current.direction === "desc" ? /* @__PURE__ */ jsx14(ArrowDown, {}) : /* @__PURE__ */ jsx14(ArrowUp, {}) : /* @__PURE__ */ jsx14(ChevronsUpDown, {}),
1953
- /* @__PURE__ */ jsx14("span", {
2637
+ current ? current.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : /* @__PURE__ */ jsx15(ChevronsUpDown, {}),
2638
+ /* @__PURE__ */ jsx15("span", {
1954
2639
  className: "hidden sm:inline",
1955
2640
  children: store.config.labels.sortBy
1956
2641
  })
1957
2642
  ]
1958
2643
  }),
1959
- /* @__PURE__ */ jsx14(MenubarContent, {
2644
+ /* @__PURE__ */ jsx15(MenubarContent, {
1960
2645
  align: "end",
1961
2646
  className: "w-52",
1962
- children: columns.map((column) => {
1963
- const sortState = store.state.sort?.find(({ id }) => id === column.id);
1964
- return /* @__PURE__ */ jsxs8(MenubarSub, {
1965
- children: [
1966
- /* @__PURE__ */ jsxs8(MenubarSubTrigger, {
1967
- children: [
1968
- sortState ? sortState.direction === "desc" ? /* @__PURE__ */ jsx14(ArrowDown, {}) : /* @__PURE__ */ jsx14(ArrowUp, {}) : null,
1969
- columnLabel(column)
1970
- ]
1971
- }),
1972
- /* @__PURE__ */ jsxs8(MenubarSubContent, {
2647
+ children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2648
+ children: [
2649
+ /* @__PURE__ */ jsx15(MenubarLabel, {
2650
+ children: store.config.labels.sortBy
2651
+ }),
2652
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2653
+ columns.map((column) => {
2654
+ const sortState = store.state.sort?.find(({ id }) => id === column.id);
2655
+ return /* @__PURE__ */ jsxs9(MenubarSub, {
1973
2656
  children: [
1974
- /* @__PURE__ */ jsxs8(MenubarItem, {
1975
- onClick: () => sort(column.id, "asc"),
1976
- children: [
1977
- /* @__PURE__ */ jsx14(ArrowUp, {}),
1978
- " ",
1979
- store.config.labels.sortAsc
1980
- ]
1981
- }),
1982
- /* @__PURE__ */ jsxs8(MenubarItem, {
1983
- onClick: () => sort(column.id, "desc"),
2657
+ /* @__PURE__ */ jsxs9(MenubarSubTrigger, {
1984
2658
  children: [
1985
- /* @__PURE__ */ jsx14(ArrowDown, {}),
1986
- " ",
1987
- store.config.labels.sortDesc
2659
+ sortState ? sortState.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : null,
2660
+ columnLabel(column)
1988
2661
  ]
1989
2662
  }),
1990
- sortState ? /* @__PURE__ */ jsxs8(Fragment, {
2663
+ /* @__PURE__ */ jsxs9(MenubarSubContent, {
1991
2664
  children: [
1992
- /* @__PURE__ */ jsx14(MenubarSeparator, {}),
1993
- /* @__PURE__ */ jsxs8(MenubarItem, {
1994
- onClick: () => changeState(setStore, (state) => ({
1995
- ...state,
1996
- sort: state.sort?.filter(({ id }) => id !== column.id)
1997
- })),
2665
+ /* @__PURE__ */ jsxs9(MenubarItem, {
2666
+ onClick: () => sort(column.id, "asc"),
1998
2667
  children: [
1999
- /* @__PURE__ */ jsx14(X, {}),
2668
+ /* @__PURE__ */ jsx15(ArrowUp, {}),
2000
2669
  " ",
2001
- store.config.labels.sortClear
2670
+ store.config.labels.sortAsc
2002
2671
  ]
2003
- })
2672
+ }),
2673
+ /* @__PURE__ */ jsxs9(MenubarItem, {
2674
+ onClick: () => sort(column.id, "desc"),
2675
+ children: [
2676
+ /* @__PURE__ */ jsx15(ArrowDown, {}),
2677
+ " ",
2678
+ store.config.labels.sortDesc
2679
+ ]
2680
+ }),
2681
+ sortState ? /* @__PURE__ */ jsxs9(Fragment, {
2682
+ children: [
2683
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2684
+ /* @__PURE__ */ jsxs9(MenubarItem, {
2685
+ onClick: () => changeState(setStore, (state) => ({
2686
+ ...state,
2687
+ sort: state.sort?.filter(({ id }) => id !== column.id)
2688
+ })),
2689
+ children: [
2690
+ /* @__PURE__ */ jsx15(X, {}),
2691
+ " ",
2692
+ store.config.labels.sortClear
2693
+ ]
2694
+ })
2695
+ ]
2696
+ }) : null
2004
2697
  ]
2005
- }) : null
2698
+ })
2006
2699
  ]
2007
- })
2008
- ]
2009
- }, column.id);
2700
+ }, column.id);
2701
+ })
2702
+ ]
2010
2703
  })
2011
2704
  })
2012
2705
  ]
@@ -2016,42 +2709,50 @@ var ViewMenu = ({
2016
2709
  tableAtom
2017
2710
  }) => {
2018
2711
  const [store, setStore] = useTableAtom(tableAtom);
2019
- return /* @__PURE__ */ jsxs8(MenubarMenu, {
2712
+ return /* @__PURE__ */ jsxs9(MenubarMenu, {
2020
2713
  children: [
2021
- /* @__PURE__ */ jsxs8(MenubarTrigger, {
2714
+ /* @__PURE__ */ jsxs9(MenubarTrigger, {
2022
2715
  "aria-label": store.config.labels.view,
2023
2716
  children: [
2024
- store.state.view === "gallery" ? /* @__PURE__ */ jsx14(LayoutGrid, {}) : /* @__PURE__ */ jsx14(Rows3, {}),
2025
- /* @__PURE__ */ jsx14("span", {
2717
+ store.state.view === "gallery" ? /* @__PURE__ */ jsx15(LayoutGrid, {}) : /* @__PURE__ */ jsx15(Rows3, {}),
2718
+ /* @__PURE__ */ jsx15("span", {
2026
2719
  className: "hidden sm:inline",
2027
2720
  children: store.config.labels.view
2028
2721
  })
2029
2722
  ]
2030
2723
  }),
2031
- /* @__PURE__ */ jsx14(MenubarContent, {
2724
+ /* @__PURE__ */ jsx15(MenubarContent, {
2032
2725
  align: "end",
2033
- children: /* @__PURE__ */ jsxs8(MenubarRadioGroup, {
2034
- onValueChange: (view) => {
2035
- if (view === "table" || view === "gallery") {
2036
- changeState(setStore, (state) => ({ ...state, view }));
2037
- }
2038
- },
2039
- value: store.state.view,
2726
+ children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2040
2727
  children: [
2041
- /* @__PURE__ */ jsxs8(MenubarRadioItem, {
2042
- value: "table",
2043
- children: [
2044
- /* @__PURE__ */ jsx14(Rows3, {}),
2045
- " ",
2046
- store.config.labels.tableView
2047
- ]
2728
+ /* @__PURE__ */ jsx15(MenubarLabel, {
2729
+ children: store.config.labels.view
2048
2730
  }),
2049
- /* @__PURE__ */ jsxs8(MenubarRadioItem, {
2050
- value: "gallery",
2731
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2732
+ /* @__PURE__ */ jsxs9(MenubarRadioGroup, {
2733
+ onValueChange: (view) => {
2734
+ if (view === "table" || view === "gallery") {
2735
+ changeState(setStore, (state) => ({ ...state, view }));
2736
+ }
2737
+ },
2738
+ value: store.state.view,
2051
2739
  children: [
2052
- /* @__PURE__ */ jsx14(LayoutGrid, {}),
2053
- " ",
2054
- store.config.labels.galleryView
2740
+ /* @__PURE__ */ jsxs9(MenubarRadioItem, {
2741
+ value: "table",
2742
+ children: [
2743
+ /* @__PURE__ */ jsx15(Rows3, {}),
2744
+ " ",
2745
+ store.config.labels.tableView
2746
+ ]
2747
+ }),
2748
+ /* @__PURE__ */ jsxs9(MenubarRadioItem, {
2749
+ value: "gallery",
2750
+ children: [
2751
+ /* @__PURE__ */ jsx15(LayoutGrid, {}),
2752
+ " ",
2753
+ store.config.labels.galleryView
2754
+ ]
2755
+ })
2055
2756
  ]
2056
2757
  })
2057
2758
  ]
@@ -2067,27 +2768,27 @@ var ColumnMenu = ({
2067
2768
  const columns = deriveModel(store).columns.filter(({ colDef }) => colDef.hideable !== false);
2068
2769
  if (!columns.length)
2069
2770
  return null;
2070
- return /* @__PURE__ */ jsxs8(MenubarMenu, {
2771
+ return /* @__PURE__ */ jsxs9(MenubarMenu, {
2071
2772
  children: [
2072
- /* @__PURE__ */ jsxs8(MenubarTrigger, {
2773
+ /* @__PURE__ */ jsxs9(MenubarTrigger, {
2073
2774
  "aria-label": store.config.labels.columns,
2074
2775
  children: [
2075
- /* @__PURE__ */ jsx14(Settings2, {}),
2076
- /* @__PURE__ */ jsx14("span", {
2776
+ /* @__PURE__ */ jsx15(Settings2, {}),
2777
+ /* @__PURE__ */ jsx15("span", {
2077
2778
  className: "hidden sm:inline",
2078
2779
  children: store.config.labels.columns
2079
2780
  })
2080
2781
  ]
2081
2782
  }),
2082
- /* @__PURE__ */ jsx14(MenubarContent, {
2783
+ /* @__PURE__ */ jsx15(MenubarContent, {
2083
2784
  align: "end",
2084
- children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2785
+ children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2085
2786
  children: [
2086
- /* @__PURE__ */ jsx14(MenubarLabel, {
2787
+ /* @__PURE__ */ jsx15(MenubarLabel, {
2087
2788
  children: store.config.labels.columns
2088
2789
  }),
2089
- /* @__PURE__ */ jsx14(MenubarSeparator, {}),
2090
- columns.map((column) => /* @__PURE__ */ jsx14(MenubarCheckboxItem, {
2790
+ /* @__PURE__ */ jsx15(MenubarSeparator, {}),
2791
+ columns.map((column) => /* @__PURE__ */ jsx15(MenubarCheckboxItem, {
2091
2792
  checked: store.state.columnVisibility[column.id] !== false,
2092
2793
  onCheckedChange: (visible) => changeState(setStore, (state) => ({
2093
2794
  ...state,
@@ -2140,7 +2841,7 @@ var ResizeHandle = ({
2140
2841
  const reset = () => {
2141
2842
  resizeRef.current = null;
2142
2843
  };
2143
- return /* @__PURE__ */ jsx14("button", {
2844
+ return /* @__PURE__ */ jsx15("button", {
2144
2845
  "aria-label": store.config.labels.resizeColumn(columnLabel(column)),
2145
2846
  "aria-orientation": "vertical",
2146
2847
  "aria-valuemax": column.colDef.maxWidth ?? DEFAULT_MAX_WIDTH,
@@ -2262,9 +2963,9 @@ var DragHandle = ({
2262
2963
  reordering.onReorder(reorderDataTableRows(model.rows, rowId, target.id));
2263
2964
  }
2264
2965
  };
2265
- return /* @__PURE__ */ jsxs8(Fragment, {
2966
+ return /* @__PURE__ */ jsxs9(Fragment, {
2266
2967
  children: [
2267
- /* @__PURE__ */ jsx14(Button, {
2968
+ /* @__PURE__ */ jsx15(Button, {
2268
2969
  "aria-label": store.config.features.reordering && store.config.features.reordering.handleLabel ? store.config.features.reordering.handleLabel : store.config.labels.reorder,
2269
2970
  className: "size-8 cursor-grab touch-none active:cursor-grabbing",
2270
2971
  onClick: (event) => event.stopPropagation(),
@@ -2282,9 +2983,9 @@ var DragHandle = ({
2282
2983
  onPointerUp: finish,
2283
2984
  size: "icon",
2284
2985
  variant: "ghost",
2285
- children: /* @__PURE__ */ jsx14(GripVertical, {})
2986
+ children: /* @__PURE__ */ jsx15(GripVertical, {})
2286
2987
  }),
2287
- overlay ? createPortal(/* @__PURE__ */ jsx14("div", {
2988
+ overlay ? createPortal(/* @__PURE__ */ jsx15("div", {
2288
2989
  "aria-hidden": "true",
2289
2990
  className: "bg-background pointer-events-none fixed z-[100] rounded-md border px-3 py-2 text-sm shadow-lg",
2290
2991
  style: { left: overlay.x + 12, top: overlay.y + 12 },
@@ -2314,8 +3015,8 @@ var TableDataRow = ({
2314
3015
  const selection = store.config.features.selection;
2315
3016
  const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
2316
3017
  const draggable = canDragRows(store);
2317
- return /* @__PURE__ */ jsxs8(TableRow, {
2318
- className: cn("group/row h-16 data-[drag-source=true]:opacity-40 data-[drop-position=before]:[&>td]:border-t-2 data-[drop-position=before]:[&>td]:border-primary data-[drop-position=after]:[&>td]:border-b-2 data-[drop-position=after]:[&>td]:border-primary", store.config.onRowClicked && "cursor-pointer"),
3018
+ return /* @__PURE__ */ jsxs9(TableRow, {
3019
+ className: cn("group/row data-[drop-position=before]:[&>td]:border-primary data-[drop-position=after]:[&>td]:border-primary h-16 data-[drag-source=true]:opacity-40 data-[drop-position=after]:[&>td]:border-b-2 data-[drop-position=before]:[&>td]:border-t-2", store.config.onRowClicked && "cursor-pointer"),
2319
3020
  "data-state": store.state.rowSelection[row.id] && "selected",
2320
3021
  "data-table-row": row.id,
2321
3022
  onClick: () => store.config.onRowClicked?.(row.data),
@@ -2327,36 +3028,36 @@ var TableDataRow = ({
2327
3028
  },
2328
3029
  tabIndex: store.config.onRowClicked ? 0 : undefined,
2329
3030
  children: [
2330
- selection ? /* @__PURE__ */ jsx14(TableCell, {
3031
+ selection ? /* @__PURE__ */ jsx15(TableCell, {
2331
3032
  className: "w-10 pr-0",
2332
3033
  onClick: (event) => event.stopPropagation(),
2333
- children: /* @__PURE__ */ jsx14(Checkbox, {
3034
+ children: /* @__PURE__ */ jsx15(Checkbox, {
2334
3035
  "aria-label": store.config.labels.selectRow,
2335
3036
  checked: !!store.state.rowSelection[row.id],
2336
3037
  disabled: !selectable,
2337
3038
  onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked)
2338
3039
  })
2339
3040
  }) : null,
2340
- draggable ? /* @__PURE__ */ jsx14(TableCell, {
3041
+ draggable ? /* @__PURE__ */ jsx15(TableCell, {
2341
3042
  className: "w-10 pr-0",
2342
- children: /* @__PURE__ */ jsx14(DragHandle, {
3043
+ children: /* @__PURE__ */ jsx15(DragHandle, {
2343
3044
  tableAtom
2344
3045
  })
2345
3046
  }) : null,
2346
- model.visibleColumns.map((column) => /* @__PURE__ */ jsx14(TableCell, {
2347
- className: cn("min-w-24 overflow-hidden has-[[data-slot=data-table-list-cell]]:relative has-[[data-slot=data-table-list-cell]]:p-0 has-[[data-slot=data-table-boolean-cell]]:relative has-[[data-slot=data-table-boolean-cell]]:p-0", column.colDef.truncate ? "whitespace-nowrap" : "whitespace-normal"),
3047
+ model.visibleColumns.map((column) => /* @__PURE__ */ jsx15(TableCell, {
3048
+ className: cn("min-w-24 overflow-hidden has-[[data-slot=data-table-boolean-cell]]:relative has-[[data-slot=data-table-boolean-cell]]:p-0 has-[[data-slot=data-table-list-cell]]:relative has-[[data-slot=data-table-list-cell]]:p-0", column.colDef.truncate ? "whitespace-nowrap" : "whitespace-normal"),
2348
3049
  style: { width: column.width },
2349
- children: /* @__PURE__ */ jsx14("div", {
3050
+ children: /* @__PURE__ */ jsx15("div", {
2350
3051
  className: cn("min-w-0", column.colDef.truncate && "truncate"),
2351
3052
  children: renderCell(row, column, store.config.locale, store.config.labels)
2352
3053
  })
2353
3054
  }, column.id)),
2354
- hasRowActionMenu(store) ? /* @__PURE__ */ jsx14(TableCell, {
3055
+ hasRowActionMenu(store) ? /* @__PURE__ */ jsx15(TableCell, {
2355
3056
  className: "bg-background group-data-[state=selected]/row:bg-muted sticky right-0 z-20 w-10 min-w-10 cursor-default p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]",
2356
3057
  onClick: (event) => event.stopPropagation(),
2357
- children: /* @__PURE__ */ jsx14("div", {
3058
+ children: /* @__PURE__ */ jsx15("div", {
2358
3059
  className: "flex h-16 items-center justify-center",
2359
- children: /* @__PURE__ */ jsx14(DataTableRowActionMenu, {
3060
+ children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
2360
3061
  tableAtom
2361
3062
  })
2362
3063
  })
@@ -2372,26 +3073,26 @@ var GroupActions = ({
2372
3073
  const visible = actions?.filter((action) => !action.visible || action.visible(groupId));
2373
3074
  if (!visible?.length)
2374
3075
  return null;
2375
- return /* @__PURE__ */ jsxs8(DropdownMenu, {
3076
+ return /* @__PURE__ */ jsxs9(DropdownMenu, {
2376
3077
  children: [
2377
- /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
3078
+ /* @__PURE__ */ jsx15(DropdownMenuTrigger, {
2378
3079
  onClick: (event) => event.stopPropagation(),
2379
- render: /* @__PURE__ */ jsxs8(Button, {
3080
+ render: /* @__PURE__ */ jsxs9(Button, {
2380
3081
  size: "icon",
2381
3082
  variant: "ghost",
2382
3083
  children: [
2383
- /* @__PURE__ */ jsx14("span", {
3084
+ /* @__PURE__ */ jsx15("span", {
2384
3085
  className: "sr-only",
2385
3086
  children: title
2386
3087
  }),
2387
- /* @__PURE__ */ jsx14(MoreHorizontal, {})
3088
+ /* @__PURE__ */ jsx15(MoreHorizontal, {})
2388
3089
  ]
2389
3090
  })
2390
3091
  }),
2391
- /* @__PURE__ */ jsx14(DropdownMenuContent, {
3092
+ /* @__PURE__ */ jsx15(DropdownMenuContent, {
2392
3093
  align: "end",
2393
- children: /* @__PURE__ */ jsx14(DropdownMenuGroup, {
2394
- children: visible.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3094
+ children: /* @__PURE__ */ jsx15(DropdownMenuGroup, {
3095
+ children: visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2395
3096
  onClick: () => action.onClick(groupId),
2396
3097
  variant: action.variant ?? "default",
2397
3098
  children: [
@@ -2422,40 +3123,40 @@ var GroupedTable = ({
2422
3123
  [section.key]: !collapsed
2423
3124
  }
2424
3125
  }));
2425
- const body = /* @__PURE__ */ jsxs8(TableBody, {
3126
+ const body = /* @__PURE__ */ jsxs9(TableBody, {
2426
3127
  className: "data-[drop-target=true]:outline-primary relative data-[drop-target=true]:z-30 data-[drop-target=true]:outline-2 data-[drop-target=true]:-outline-offset-2 data-[drop-target=true]:[&>tr]:border-transparent data-[drop-target=true]:[&>tr>td:last-child]:z-0",
2427
3128
  "data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
2428
3129
  children: [
2429
- /* @__PURE__ */ jsx14(TableRow, {
3130
+ /* @__PURE__ */ jsx15(TableRow, {
2430
3131
  className: "bg-muted/40 hover:bg-accent! cursor-pointer",
2431
3132
  onClick: toggleCollapsed,
2432
- children: /* @__PURE__ */ jsx14(TableCell, {
3133
+ children: /* @__PURE__ */ jsx15(TableCell, {
2433
3134
  colSpan: model.visibleColumns.length + extra,
2434
- children: /* @__PURE__ */ jsxs8("div", {
3135
+ children: /* @__PURE__ */ jsxs9("div", {
2435
3136
  className: "flex items-center gap-2",
2436
3137
  style: { paddingLeft: section.depth * 20 },
2437
3138
  children: [
2438
- /* @__PURE__ */ jsxs8("button", {
3139
+ /* @__PURE__ */ jsxs9("button", {
2439
3140
  "aria-expanded": !collapsed,
2440
3141
  className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
2441
3142
  type: "button",
2442
3143
  children: [
2443
- collapsed ? /* @__PURE__ */ jsx14(ChevronRight2, {
3144
+ collapsed ? /* @__PURE__ */ jsx15(ChevronRight2, {
2444
3145
  className: "size-4"
2445
- }) : /* @__PURE__ */ jsx14(ChevronDown, {
3146
+ }) : /* @__PURE__ */ jsx15(ChevronDown, {
2446
3147
  className: "size-4"
2447
3148
  }),
2448
- /* @__PURE__ */ jsx14("span", {
3149
+ /* @__PURE__ */ jsx15("span", {
2449
3150
  className: "flex-1",
2450
3151
  children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
2451
3152
  })
2452
3153
  ]
2453
3154
  }),
2454
- /* @__PURE__ */ jsx14(Badge, {
3155
+ /* @__PURE__ */ jsx15(Badge, {
2455
3156
  variant: "secondary",
2456
3157
  children: section.rows.length
2457
3158
  }),
2458
- /* @__PURE__ */ jsx14(GroupActions, {
3159
+ /* @__PURE__ */ jsx15(GroupActions, {
2459
3160
  actions: section.field.actions,
2460
3161
  groupId: section.groupId,
2461
3162
  title: section.field.actionsLabel ?? store.config.labels.actions
@@ -2464,14 +3165,14 @@ var GroupedTable = ({
2464
3165
  })
2465
3166
  })
2466
3167
  }),
2467
- !collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3168
+ !collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
2468
3169
  value: row.id,
2469
- children: /* @__PURE__ */ jsx14(TableDataRow, {
3170
+ children: /* @__PURE__ */ jsx15(TableDataRow, {
2470
3171
  tableAtom
2471
3172
  })
2472
3173
  }, `${section.key}:${row.id}`)) : [
2473
- /* @__PURE__ */ jsx14(TableRow, {
2474
- children: /* @__PURE__ */ jsx14(TableCell, {
3174
+ /* @__PURE__ */ jsx15(TableRow, {
3175
+ children: /* @__PURE__ */ jsx15(TableCell, {
2475
3176
  className: "text-muted-foreground h-16",
2476
3177
  colSpan: model.visibleColumns.length + extra,
2477
3178
  children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
@@ -2482,7 +3183,7 @@ var GroupedTable = ({
2482
3183
  }, section.key);
2483
3184
  return !collapsed && section.children.length ? [body, renderSections(section.children)] : [body];
2484
3185
  });
2485
- return /* @__PURE__ */ jsx14(Fragment, {
3186
+ return /* @__PURE__ */ jsx15(Fragment, {
2486
3187
  children: renderSections(sections)
2487
3188
  });
2488
3189
  };
@@ -2491,79 +3192,159 @@ var ColumnHeaderMenu = ({
2491
3192
  }) => {
2492
3193
  const [store, setStore] = useTableAtom(tableAtom);
2493
3194
  const columnId = useRequiredId(ColumnIdContext);
2494
- const column = deriveModel(store).columns.find(({ id }) => id === columnId);
3195
+ const model = deriveModel(store);
3196
+ const column = model.columns.find(({ id }) => id === columnId);
2495
3197
  if (!column)
2496
3198
  return null;
2497
- const sortingEnabled = store.config.features.sorting !== false && column.colDef.sortable !== false;
3199
+ const sortColumns = getDataTableSortColumns([column]);
3200
+ const filterColumns = getDataTableFilterColumns([column]);
3201
+ const filteringEnabled = store.config.features.filtering !== false && filterColumns.length > 0;
3202
+ const ownsFilter = (id) => id === column.id || getDataTableFieldColumns(column).some((field) => field.id === id);
3203
+ const activeFilters = (store.state.filters ?? []).filter(({ id }) => ownsFilter(id));
3204
+ const filterEditor = (field) => /* @__PURE__ */ jsx15(FilterEditor, {
3205
+ column: field,
3206
+ rows: model.rows,
3207
+ current: store.state.filters?.find((filter) => filter.id === field.id),
3208
+ labels: store.config.labels,
3209
+ onChange: (filter) => changeState(setStore, (state) => withColumnFilter(state, field.id, filter))
3210
+ });
3211
+ const sortingEnabled = store.config.features.sorting !== false && sortColumns.length > 0;
2498
3212
  const hidingEnabled = store.config.features.columnVisibility !== false && column.colDef.hideable !== false;
2499
- const sort = store.state.sort?.find(({ id }) => id === column.id);
3213
+ const ownsSort = (id) => id === column.id || sortColumns.some((field) => field.id === id);
3214
+ const sort = store.state.sort?.find(({ id }) => ownsSort(id));
2500
3215
  const update = (next) => changeState(setStore, next);
2501
- const setSort = (direction) => update((state) => ({
3216
+ const setSort = (id, direction) => update((state) => ({
2502
3217
  ...state,
2503
- sort: [{ id: column.id, direction }],
3218
+ sort: [{ id, direction }],
2504
3219
  page: 0
2505
3220
  }));
2506
3221
  const label = columnLabel(column);
2507
- if (!sortingEnabled && !hidingEnabled) {
2508
- return /* @__PURE__ */ jsx14("div", {
3222
+ const sortItems = (field) => /* @__PURE__ */ jsxs9(Fragment, {
3223
+ children: [
3224
+ /* @__PURE__ */ jsxs9(DropdownMenuItem, {
3225
+ onClick: () => setSort(field.id, "asc"),
3226
+ children: [
3227
+ /* @__PURE__ */ jsx15(ArrowUp, {}),
3228
+ " ",
3229
+ store.config.labels.sortAsc
3230
+ ]
3231
+ }),
3232
+ /* @__PURE__ */ jsxs9(DropdownMenuItem, {
3233
+ onClick: () => setSort(field.id, "desc"),
3234
+ children: [
3235
+ /* @__PURE__ */ jsx15(ArrowDown, {}),
3236
+ " ",
3237
+ store.config.labels.sortDesc
3238
+ ]
3239
+ })
3240
+ ]
3241
+ });
3242
+ if (!sortingEnabled && !hidingEnabled && !filteringEnabled) {
3243
+ return /* @__PURE__ */ jsx15("div", {
2509
3244
  className: "truncate px-2",
2510
3245
  children: column.colDef.headerName
2511
3246
  });
2512
3247
  }
2513
- return /* @__PURE__ */ jsxs8(DropdownMenu, {
3248
+ return /* @__PURE__ */ jsxs9(DropdownMenu, {
2514
3249
  children: [
2515
- /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
2516
- render: /* @__PURE__ */ jsxs8(Button, {
3250
+ /* @__PURE__ */ jsx15(DropdownMenuTrigger, {
3251
+ render: /* @__PURE__ */ jsxs9(Button, {
2517
3252
  "aria-label": label,
3253
+ "aria-description": activeFilters.length ? `${store.config.labels.filters}: ${activeFilters.length}` : undefined,
2518
3254
  className: "absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pr-4 focus-visible:ring-inset",
2519
3255
  variant: "ghost",
2520
3256
  children: [
2521
- /* @__PURE__ */ jsx14("span", {
3257
+ /* @__PURE__ */ jsx15("span", {
2522
3258
  className: "truncate",
2523
3259
  children: column.colDef.headerName
2524
3260
  }),
2525
- sort ? sort.direction === "desc" ? /* @__PURE__ */ jsx14(ArrowDown, {}) : /* @__PURE__ */ jsx14(ArrowUp, {}) : null
3261
+ activeFilters.length ? /* @__PURE__ */ jsx15(ListFilter, {}) : null,
3262
+ sort ? sort.direction === "desc" ? /* @__PURE__ */ jsx15(ArrowDown, {}) : /* @__PURE__ */ jsx15(ArrowUp, {}) : null
2526
3263
  ]
2527
3264
  })
2528
3265
  }),
2529
- /* @__PURE__ */ jsx14(DropdownMenuContent, {
3266
+ /* @__PURE__ */ jsx15(DropdownMenuContent, {
2530
3267
  align: "start",
2531
3268
  className: "w-48",
2532
- children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
3269
+ children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
2533
3270
  children: [
2534
- sortingEnabled ? /* @__PURE__ */ jsxs8(Fragment, {
3271
+ sortingEnabled ? /* @__PURE__ */ jsxs9(Fragment, {
2535
3272
  children: [
2536
- /* @__PURE__ */ jsxs8(DropdownMenuItem, {
2537
- onClick: () => setSort("asc"),
3273
+ column.colDef.fields?.length ? sortColumns.map((field) => /* @__PURE__ */ jsxs9(DropdownMenuSub, {
2538
3274
  children: [
2539
- /* @__PURE__ */ jsx14(ArrowUp, {}),
2540
- " ",
2541
- store.config.labels.sortAsc
2542
- ]
2543
- }),
2544
- /* @__PURE__ */ jsxs8(DropdownMenuItem, {
2545
- onClick: () => setSort("desc"),
2546
- children: [
2547
- /* @__PURE__ */ jsx14(ArrowDown, {}),
2548
- " ",
2549
- store.config.labels.sortDesc
3275
+ /* @__PURE__ */ jsx15(DropdownMenuSubTrigger, {
3276
+ children: columnLabel(field)
3277
+ }),
3278
+ /* @__PURE__ */ jsx15(DropdownMenuSubContent, {
3279
+ children: /* @__PURE__ */ jsx15(DropdownMenuGroup, {
3280
+ children: sortItems(field)
3281
+ })
3282
+ })
2550
3283
  ]
2551
- }),
2552
- sort ? /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3284
+ }, field.id)) : sortItems(column),
3285
+ sort ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2553
3286
  onClick: () => update((state) => ({
2554
3287
  ...state,
2555
- sort: state.sort?.filter(({ id }) => id !== column.id)
3288
+ sort: state.sort?.filter(({ id }) => !ownsSort(id))
2556
3289
  })),
2557
3290
  children: [
2558
- /* @__PURE__ */ jsx14(X, {}),
3291
+ /* @__PURE__ */ jsx15(X, {}),
2559
3292
  " ",
2560
3293
  store.config.labels.sortClear
2561
3294
  ]
2562
3295
  }) : null
2563
3296
  ]
2564
3297
  }) : null,
2565
- sortingEnabled && hidingEnabled ? /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}) : null,
2566
- hidingEnabled ? /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3298
+ sortingEnabled && filteringEnabled ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
3299
+ filteringEnabled ? /* @__PURE__ */ jsxs9(Fragment, {
3300
+ children: [
3301
+ /* @__PURE__ */ jsxs9(DropdownMenuSub, {
3302
+ children: [
3303
+ /* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
3304
+ children: [
3305
+ /* @__PURE__ */ jsx15(ListFilter, {}),
3306
+ store.config.labels.filters
3307
+ ]
3308
+ }),
3309
+ /* @__PURE__ */ jsx15(DropdownMenuSubContent, {
3310
+ className: "w-80 max-w-[calc(100vw-2rem)]",
3311
+ children: column.colDef.fields?.length ? /* @__PURE__ */ jsx15(DropdownMenuGroup, {
3312
+ children: filterColumns.map((field) => /* @__PURE__ */ jsxs9(DropdownMenuSub, {
3313
+ children: [
3314
+ /* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
3315
+ children: [
3316
+ columnLabel(field),
3317
+ activeFilters.some((filter) => filter.id === field.id) ? /* @__PURE__ */ jsx15(Check, {}) : null
3318
+ ]
3319
+ }),
3320
+ /* @__PURE__ */ jsx15(DropdownMenuSubContent, {
3321
+ className: "w-80 max-w-[calc(100vw-2rem)]",
3322
+ children: filterEditor(field)
3323
+ })
3324
+ ]
3325
+ }, field.id))
3326
+ }) : filterEditor(column)
3327
+ })
3328
+ ]
3329
+ }),
3330
+ activeFilters.length ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
3331
+ onClick: () => update((state) => {
3332
+ const filters = state.filters?.filter(({ id }) => !ownsFilter(id));
3333
+ return {
3334
+ ...state,
3335
+ page: 0,
3336
+ filters: filters?.length ? filters : undefined
3337
+ };
3338
+ }),
3339
+ children: [
3340
+ /* @__PURE__ */ jsx15(X, {}),
3341
+ store.config.labels.filterClear
3342
+ ]
3343
+ }) : null
3344
+ ]
3345
+ }) : null,
3346
+ (sortingEnabled || filteringEnabled) && hidingEnabled ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
3347
+ hidingEnabled ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2567
3348
  onClick: () => update((state) => ({
2568
3349
  ...state,
2569
3350
  columnVisibility: {
@@ -2572,7 +3353,7 @@ var ColumnHeaderMenu = ({
2572
3353
  }
2573
3354
  })),
2574
3355
  children: [
2575
- /* @__PURE__ */ jsx14(EyeOff, {}),
3356
+ /* @__PURE__ */ jsx15(EyeOff, {}),
2576
3357
  " ",
2577
3358
  store.config.labels.hideColumn
2578
3359
  ]
@@ -2594,12 +3375,12 @@ var DataTableHeader = ({
2594
3375
  const selectableRows = getDataTableSelectableRows(model, grouped, selection ? selection.isRowSelectable : undefined);
2595
3376
  const allSelected = selectableRows.length > 0 && selectableRows.every((row) => store.state.rowSelection[row.id]);
2596
3377
  const someSelected = selectableRows.some((row) => store.state.rowSelection[row.id]);
2597
- return /* @__PURE__ */ jsx14(TableHeader, {
2598
- children: /* @__PURE__ */ jsxs8(TableRow, {
3378
+ return /* @__PURE__ */ jsx15(TableHeader, {
3379
+ children: /* @__PURE__ */ jsxs9(TableRow, {
2599
3380
  children: [
2600
- selection ? /* @__PURE__ */ jsx14(TableHead, {
3381
+ selection ? /* @__PURE__ */ jsx15(TableHead, {
2601
3382
  className: "w-10 pr-0",
2602
- children: /* @__PURE__ */ jsx14(Checkbox, {
3383
+ children: /* @__PURE__ */ jsx15(Checkbox, {
2603
3384
  "aria-label": store.config.labels.selectAllRows,
2604
3385
  checked: allSelected,
2605
3386
  indeterminate: someSelected && !allSelected,
@@ -2613,30 +3394,30 @@ var DataTableHeader = ({
2613
3394
  }
2614
3395
  })
2615
3396
  }) : null,
2616
- draggable ? /* @__PURE__ */ jsx14(TableHead, {
3397
+ draggable ? /* @__PURE__ */ jsx15(TableHead, {
2617
3398
  className: "w-10"
2618
3399
  }) : null,
2619
3400
  model.visibleColumns.map((column) => {
2620
3401
  const direction = store.state.sort?.find(({ id }) => id === column.id)?.direction;
2621
- return /* @__PURE__ */ jsx14(TableHead, {
3402
+ return /* @__PURE__ */ jsx15(TableHead, {
2622
3403
  "aria-sort": direction === "asc" ? "ascending" : direction === "desc" ? "descending" : undefined,
2623
3404
  className: "relative h-12 p-0",
2624
3405
  scope: "col",
2625
3406
  style: { width: column.width },
2626
- children: /* @__PURE__ */ jsxs8(ColumnIdContext.Provider, {
3407
+ children: /* @__PURE__ */ jsxs9(ColumnIdContext.Provider, {
2627
3408
  value: column.id,
2628
3409
  children: [
2629
- /* @__PURE__ */ jsx14(ColumnHeaderMenu, {
3410
+ /* @__PURE__ */ jsx15(ColumnHeaderMenu, {
2630
3411
  tableAtom
2631
3412
  }),
2632
- /* @__PURE__ */ jsx14(ResizeHandle, {
3413
+ /* @__PURE__ */ jsx15(ResizeHandle, {
2633
3414
  tableAtom
2634
3415
  })
2635
3416
  ]
2636
3417
  })
2637
3418
  }, column.id);
2638
3419
  }),
2639
- hasRowActionMenu(store) ? /* @__PURE__ */ jsx14(TableHead, {
3420
+ hasRowActionMenu(store) ? /* @__PURE__ */ jsx15(TableHead, {
2640
3421
  className: "w-10"
2641
3422
  }) : null
2642
3423
  ]
@@ -2654,29 +3435,29 @@ var DataTableBody = ({
2654
3435
  const sections = groupDataTableRows(rows, fields);
2655
3436
  const colSpan = model.visibleColumns.length + (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0);
2656
3437
  if (sections.length && (rows.length || !store.config.status.loading) && !store.config.status.error) {
2657
- return /* @__PURE__ */ jsx14(GroupedTable, {
3438
+ return /* @__PURE__ */ jsx15(GroupedTable, {
2658
3439
  tableAtom,
2659
3440
  sections
2660
3441
  });
2661
3442
  }
2662
- return /* @__PURE__ */ jsx14(TableBody, {
2663
- children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */ jsx14(TableRow, {
2664
- children: /* @__PURE__ */ jsx14(TableCell, {
3443
+ return /* @__PURE__ */ jsx15(TableBody, {
3444
+ children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */ jsx15(TableRow, {
3445
+ children: /* @__PURE__ */ jsx15(TableCell, {
2665
3446
  className: "h-24 text-center",
2666
3447
  colSpan: Math.max(colSpan, 1),
2667
3448
  children: store.config.status.error ?? store.config.status.empty ?? store.config.labels.empty
2668
3449
  })
2669
- }) : store.config.status.loading && !rows.length ? /* @__PURE__ */ jsx14(TableRow, {
2670
- children: /* @__PURE__ */ jsx14(TableCell, {
3450
+ }) : store.config.status.loading && !rows.length ? /* @__PURE__ */ jsx15(TableRow, {
3451
+ children: /* @__PURE__ */ jsx15(TableCell, {
2671
3452
  className: "h-24 text-center",
2672
3453
  colSpan: Math.max(colSpan, 1),
2673
- children: /* @__PURE__ */ jsx14(Loading, {
3454
+ children: /* @__PURE__ */ jsx15(Loading, {
2674
3455
  label: store.config.labels.loading
2675
3456
  })
2676
3457
  })
2677
- }) : rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3458
+ }) : rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
2678
3459
  value: row.id,
2679
- children: /* @__PURE__ */ jsx14(TableDataRow, {
3460
+ children: /* @__PURE__ */ jsx15(TableDataRow, {
2680
3461
  tableAtom
2681
3462
  })
2682
3463
  }, row.id))
@@ -2699,8 +3480,8 @@ var GalleryCard = ({
2699
3480
  const selection = store.config.features.selection;
2700
3481
  const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
2701
3482
  const draggable = canDragRows(store);
2702
- return /* @__PURE__ */ jsx14(Card, {
2703
- className: cn("relative gap-3 data-[drag-source=true]:opacity-40 data-[drop-position=before]:border-t-2 data-[drop-position=before]:border-t-primary data-[drop-position=after]:border-b-2 data-[drop-position=after]:border-b-primary", store.config.onRowClicked && "cursor-pointer"),
3483
+ return /* @__PURE__ */ jsx15(Card, {
3484
+ className: cn("data-[drop-position=before]:border-t-primary data-[drop-position=after]:border-b-primary relative gap-3 data-[drag-source=true]:opacity-40 data-[drop-position=after]:border-b-2 data-[drop-position=before]:border-t-2", store.config.onRowClicked && "cursor-pointer"),
2704
3485
  "data-table-row": row.id,
2705
3486
  onClick: () => store.config.onRowClicked?.(row.data),
2706
3487
  onKeyDown: (event) => {
@@ -2710,23 +3491,23 @@ var GalleryCard = ({
2710
3491
  }
2711
3492
  },
2712
3493
  tabIndex: store.config.onRowClicked ? 0 : undefined,
2713
- children: /* @__PURE__ */ jsxs8(CardHeader, {
3494
+ children: /* @__PURE__ */ jsxs9(CardHeader, {
2714
3495
  className: "pr-12",
2715
3496
  children: [
2716
- /* @__PURE__ */ jsxs8("div", {
3497
+ /* @__PURE__ */ jsxs9("div", {
2717
3498
  className: "flex items-center gap-2",
2718
3499
  children: [
2719
- selection ? /* @__PURE__ */ jsx14(Checkbox, {
3500
+ selection ? /* @__PURE__ */ jsx15(Checkbox, {
2720
3501
  "aria-label": store.config.labels.selectRow,
2721
3502
  checked: !!store.state.rowSelection[row.id],
2722
3503
  disabled: !selectable,
2723
3504
  onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked),
2724
3505
  onClick: (event) => event.stopPropagation()
2725
3506
  }) : null,
2726
- draggable ? /* @__PURE__ */ jsx14(DragHandle, {
3507
+ draggable ? /* @__PURE__ */ jsx15(DragHandle, {
2727
3508
  tableAtom
2728
3509
  }) : null,
2729
- tag ? /* @__PURE__ */ jsxs8(Badge, {
3510
+ tag ? /* @__PURE__ */ jsxs9(Badge, {
2730
3511
  variant: "secondary",
2731
3512
  children: [
2732
3513
  gallery.tagIcon,
@@ -2735,17 +3516,17 @@ var GalleryCard = ({
2735
3516
  }) : null
2736
3517
  ]
2737
3518
  }),
2738
- /* @__PURE__ */ jsx14(CardTitle, {
3519
+ /* @__PURE__ */ jsx15(CardTitle, {
2739
3520
  children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
2740
3521
  }),
2741
- description ? /* @__PURE__ */ jsx14("div", {
3522
+ description ? /* @__PURE__ */ jsx15("div", {
2742
3523
  className: "text-muted-foreground line-clamp-3 text-sm",
2743
3524
  children: renderCell(row, description, store.config.locale, store.config.labels)
2744
3525
  }) : null,
2745
- hasRowActionMenu(store) ? /* @__PURE__ */ jsx14("div", {
3526
+ hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
2746
3527
  className: "absolute top-4 right-4",
2747
3528
  onClick: (event) => event.stopPropagation(),
2748
- children: /* @__PURE__ */ jsx14(DataTableRowActionMenu, {
3529
+ children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
2749
3530
  tableAtom
2750
3531
  })
2751
3532
  }) : null
@@ -2762,31 +3543,31 @@ var DataTableGallery = ({
2762
3543
  const rows = fields.length ? model.sortedRows : model.pageRows;
2763
3544
  const sections = groupDataTableRows(rows, fields);
2764
3545
  if (store.config.status.error) {
2765
- return /* @__PURE__ */ jsx14("div", {
3546
+ return /* @__PURE__ */ jsx15("div", {
2766
3547
  className: "text-destructive rounded-lg border border-dashed p-10 text-center",
2767
3548
  children: store.config.status.error
2768
3549
  });
2769
3550
  }
2770
3551
  if (store.config.status.loading && !rows.length) {
2771
- return /* @__PURE__ */ jsx14("div", {
3552
+ return /* @__PURE__ */ jsx15("div", {
2772
3553
  className: "rounded-lg border border-dashed p-10 text-center",
2773
- children: /* @__PURE__ */ jsx14(Loading, {
3554
+ children: /* @__PURE__ */ jsx15(Loading, {
2774
3555
  label: store.config.labels.loading
2775
3556
  })
2776
3557
  });
2777
3558
  }
2778
3559
  if (!rows.length && !sections.length) {
2779
- return /* @__PURE__ */ jsx14("div", {
3560
+ return /* @__PURE__ */ jsx15("div", {
2780
3561
  className: "text-muted-foreground rounded-lg border border-dashed p-10 text-center",
2781
3562
  children: store.config.status.empty ?? store.config.labels.empty
2782
3563
  });
2783
3564
  }
2784
3565
  if (!fields.length) {
2785
- return /* @__PURE__ */ jsx14("div", {
3566
+ return /* @__PURE__ */ jsx15("div", {
2786
3567
  className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
2787
- children: rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3568
+ children: rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
2788
3569
  value: row.id,
2789
- children: /* @__PURE__ */ jsx14(GalleryCard, {
3570
+ children: /* @__PURE__ */ jsx15(GalleryCard, {
2790
3571
  tableAtom
2791
3572
  })
2792
3573
  }, row.id))
@@ -2802,57 +3583,57 @@ var DataTableGallery = ({
2802
3583
  [section.key]: !collapsed
2803
3584
  }
2804
3585
  }));
2805
- return /* @__PURE__ */ jsxs8("section", {
3586
+ return /* @__PURE__ */ jsxs9("section", {
2806
3587
  className: "data-[drop-target=true]:ring-primary space-y-3 rounded-lg transition-shadow data-[drop-target=true]:ring-2",
2807
3588
  "data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
2808
3589
  children: [
2809
- /* @__PURE__ */ jsxs8("div", {
3590
+ /* @__PURE__ */ jsxs9("div", {
2810
3591
  className: "hover:bg-accent flex cursor-pointer items-center gap-2 rounded-lg border p-3 transition-colors",
2811
3592
  onClick: toggleCollapsed,
2812
3593
  children: [
2813
- /* @__PURE__ */ jsxs8("button", {
3594
+ /* @__PURE__ */ jsxs9("button", {
2814
3595
  "aria-expanded": !collapsed,
2815
3596
  className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
2816
3597
  type: "button",
2817
3598
  children: [
2818
- collapsed ? /* @__PURE__ */ jsx14(ChevronRight2, {
3599
+ collapsed ? /* @__PURE__ */ jsx15(ChevronRight2, {
2819
3600
  className: "size-4"
2820
- }) : /* @__PURE__ */ jsx14(ChevronDown, {
3601
+ }) : /* @__PURE__ */ jsx15(ChevronDown, {
2821
3602
  className: "size-4"
2822
3603
  }),
2823
- /* @__PURE__ */ jsx14("span", {
3604
+ /* @__PURE__ */ jsx15("span", {
2824
3605
  className: "flex-1",
2825
3606
  children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
2826
3607
  }),
2827
- /* @__PURE__ */ jsx14(Badge, {
3608
+ /* @__PURE__ */ jsx15(Badge, {
2828
3609
  variant: "secondary",
2829
3610
  children: section.rows.length
2830
3611
  })
2831
3612
  ]
2832
3613
  }),
2833
- /* @__PURE__ */ jsx14(GroupActions, {
3614
+ /* @__PURE__ */ jsx15(GroupActions, {
2834
3615
  actions: section.field.actions,
2835
3616
  groupId: section.groupId,
2836
3617
  title: section.field.actionsLabel ?? store.config.labels.actions
2837
3618
  })
2838
3619
  ]
2839
3620
  }),
2840
- !collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */ jsx14("div", {
3621
+ !collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */ jsx15("div", {
2841
3622
  className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
2842
- children: section.rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3623
+ children: section.rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
2843
3624
  value: row.id,
2844
- children: /* @__PURE__ */ jsx14(GalleryCard, {
3625
+ children: /* @__PURE__ */ jsx15(GalleryCard, {
2845
3626
  tableAtom
2846
3627
  })
2847
3628
  }, `${section.key}:${row.id}`))
2848
- }) : /* @__PURE__ */ jsx14("div", {
3629
+ }) : /* @__PURE__ */ jsx15("div", {
2849
3630
  className: "text-muted-foreground rounded-lg border border-dashed p-8 text-center",
2850
3631
  children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
2851
3632
  }) : null
2852
3633
  ]
2853
3634
  }, section.key);
2854
3635
  });
2855
- return /* @__PURE__ */ jsx14("div", {
3636
+ return /* @__PURE__ */ jsx15("div", {
2856
3637
  className: "space-y-4",
2857
3638
  children: renderSections(sections)
2858
3639
  });
@@ -2879,9 +3660,9 @@ var DataTablePagination = ({
2879
3660
  return null;
2880
3661
  const selected = model.rows.filter((row) => store.state.rowSelection[row.id]).length;
2881
3662
  const setPagination = (next) => changeState(setStore, (state) => ({ ...state, ...next }));
2882
- return /* @__PURE__ */ jsx14("div", {
3663
+ return /* @__PURE__ */ jsx15("div", {
2883
3664
  className: "pt-4",
2884
- children: /* @__PURE__ */ jsx14(Pagination, {
3665
+ children: /* @__PURE__ */ jsx15(Pagination, {
2885
3666
  locale: store.config.locale,
2886
3667
  messages: { [store.config.locale]: store.config.labels },
2887
3668
  onPageChange: (page) => setPagination({ page, pageSize: store.state.pageSize }),
@@ -2906,7 +3687,7 @@ var HydratedDataTable = ({
2906
3687
  });
2907
3688
  const [transientUiAtom] = useState(() => Atom.make(transientUiFromState(DEFAULT_UI_STATE)));
2908
3689
  const [transientUiState, setTransientUiState] = useAtom(transientUiAtom);
2909
- const uiState = useMemo(() => ({
3690
+ const uiState = useMemo2(() => ({
2910
3691
  ...persistedUiState,
2911
3692
  ...transientUiState,
2912
3693
  grouping: persistedUiState.grouping ?? initialGrouping
@@ -2975,17 +3756,17 @@ var HydratedDataTable = ({
2975
3756
  setUiState,
2976
3757
  uiState
2977
3758
  ]);
2978
- return /* @__PURE__ */ jsxs8("div", {
3759
+ return /* @__PURE__ */ jsxs9("div", {
2979
3760
  className: "w-full max-w-full min-w-0 rounded-md",
2980
3761
  "data-table-root": "",
2981
3762
  children: [
2982
- /* @__PURE__ */ jsx14(DataTableToolbar, {
3763
+ /* @__PURE__ */ jsx15(DataTableToolbar, {
2983
3764
  tableAtom
2984
3765
  }),
2985
- /* @__PURE__ */ jsx14(DataTableContent, {
3766
+ /* @__PURE__ */ jsx15(DataTableContent, {
2986
3767
  tableAtom
2987
3768
  }),
2988
- /* @__PURE__ */ jsx14(DataTablePagination, {
3769
+ /* @__PURE__ */ jsx15(DataTablePagination, {
2989
3770
  tableAtom
2990
3771
  })
2991
3772
  ]
@@ -3010,7 +3791,7 @@ var DataTable = (props) => {
3010
3791
  });
3011
3792
  });
3012
3793
  const [persistedUiResult, setPersistedUiState] = useAtom(persistedUiAtom);
3013
- const persistedUiState = useMemo(() => AsyncResult.isSuccess(persistedUiResult) ? {
3794
+ const persistedUiState = useMemo2(() => AsyncResult.isSuccess(persistedUiResult) ? {
3014
3795
  ...persistedUiResult.value,
3015
3796
  columnVisibility: {
3016
3797
  ...initialColumnVisibility,
@@ -3018,13 +3799,13 @@ var DataTable = (props) => {
3018
3799
  }
3019
3800
  } : undefined, [initialColumnVisibility, persistedUiResult]);
3020
3801
  if (!persistedUiState || AsyncResult.isWaiting(persistedUiResult)) {
3021
- return /* @__PURE__ */ jsx14("div", {
3802
+ return /* @__PURE__ */ jsx15("div", {
3022
3803
  "aria-busy": "true",
3023
3804
  className: "invisible w-full max-w-full min-w-0 rounded-md",
3024
3805
  "data-table-root": ""
3025
3806
  });
3026
3807
  }
3027
- return /* @__PURE__ */ jsx14(HydratedDataTable, {
3808
+ return /* @__PURE__ */ jsx15(HydratedDataTable, {
3028
3809
  ...props,
3029
3810
  locale,
3030
3811
  persistedUiState,
@@ -3036,28 +3817,28 @@ var DataTableContent = ({
3036
3817
  }) => {
3037
3818
  const [store] = useTableAtom(tableAtom);
3038
3819
  if (store.config.features.gallery && store.state.view === "gallery") {
3039
- return /* @__PURE__ */ jsx14(DataTableGallery, {
3820
+ return /* @__PURE__ */ jsx15(DataTableGallery, {
3040
3821
  tableAtom
3041
3822
  });
3042
3823
  }
3043
3824
  const model = deriveModel(store);
3044
3825
  const width = getDataTableWidth(model.visibleColumns, (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0));
3045
- return /* @__PURE__ */ jsxs8(ScrollArea, {
3826
+ return /* @__PURE__ */ jsxs9(ScrollArea, {
3046
3827
  className: "max-w-full min-w-0",
3047
3828
  children: [
3048
- /* @__PURE__ */ jsxs8(Table, {
3829
+ /* @__PURE__ */ jsxs9(Table, {
3049
3830
  className: "table-fixed",
3050
3831
  style: { width: `max(100%, ${width}px)` },
3051
3832
  children: [
3052
- /* @__PURE__ */ jsx14(DataTableHeader, {
3833
+ /* @__PURE__ */ jsx15(DataTableHeader, {
3053
3834
  tableAtom
3054
3835
  }),
3055
- /* @__PURE__ */ jsx14(DataTableBody, {
3836
+ /* @__PURE__ */ jsx15(DataTableBody, {
3056
3837
  tableAtom
3057
3838
  })
3058
3839
  ]
3059
3840
  }),
3060
- /* @__PURE__ */ jsx14(ScrollBar, {
3841
+ /* @__PURE__ */ jsx15(ScrollBar, {
3061
3842
  orientation: "horizontal"
3062
3843
  })
3063
3844
  ]
@@ -3067,7 +3848,7 @@ var DataTableListCell = (props) => {
3067
3848
  const locale = useKrakstackLocale3(props.locale);
3068
3849
  const resolvedProps = { ...props, locale };
3069
3850
  if (resolvedProps.options && (resolvedProps.onAdd || resolvedProps.onRemove)) {
3070
- return /* @__PURE__ */ jsx14(EditableDataTableListCell, {
3851
+ return /* @__PURE__ */ jsx15(EditableDataTableListCell, {
3071
3852
  ...resolvedProps
3072
3853
  });
3073
3854
  }
@@ -3075,17 +3856,17 @@ var DataTableListCell = (props) => {
3075
3856
  const labels = dataTableMessages(locale, resolvedProps.messages);
3076
3857
  const hasItems = resolvedProps.items.length > 0;
3077
3858
  if (!itemActions?.length && !hasItems) {
3078
- return /* @__PURE__ */ jsx14(DataTableListSummary, {
3859
+ return /* @__PURE__ */ jsx15(DataTableListSummary, {
3079
3860
  ...summaryProps
3080
3861
  });
3081
3862
  }
3082
3863
  const menuLabel = actionsLabel ?? (itemActions?.length ? labels.actions : labels.listDetails);
3083
- return /* @__PURE__ */ jsx14("div", {
3864
+ return /* @__PURE__ */ jsx15("div", {
3084
3865
  className: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
3085
3866
  "data-slot": "data-table-list-cell",
3086
3867
  onClick: (event) => event.stopPropagation(),
3087
3868
  onPointerDown: (event) => event.stopPropagation(),
3088
- children: /* @__PURE__ */ jsx14(DataTableListMenu, {
3869
+ children: /* @__PURE__ */ jsx15(DataTableListMenu, {
3089
3870
  actions: itemActions ?? [],
3090
3871
  display: resolvedProps.display,
3091
3872
  force: hasItems,
@@ -3094,16 +3875,16 @@ var DataTableListCell = (props) => {
3094
3875
  locale,
3095
3876
  messages: resolvedProps.messages,
3096
3877
  onItemClick,
3097
- trigger: /* @__PURE__ */ jsxs8(Button, {
3878
+ trigger: /* @__PURE__ */ jsxs9(Button, {
3098
3879
  "aria-label": menuLabel,
3099
3880
  className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
3100
3881
  variant: "ghost",
3101
3882
  children: [
3102
- /* @__PURE__ */ jsx14(DataTableListSummaryContent, {
3883
+ /* @__PURE__ */ jsx15(DataTableListSummaryContent, {
3103
3884
  ...summaryProps,
3104
3885
  showMenu: false
3105
3886
  }),
3106
- /* @__PURE__ */ jsx14(ChevronDown, {})
3887
+ /* @__PURE__ */ jsx15(ChevronDown, {})
3107
3888
  ]
3108
3889
  })
3109
3890
  })
@@ -3139,7 +3920,7 @@ var EditableDataTableListCell = ({
3139
3920
  id: "data-table-list-remove",
3140
3921
  closeOnClick: false,
3141
3922
  name: labels.removeItem,
3142
- icon: /* @__PURE__ */ jsx14(Trash2, {}),
3923
+ icon: /* @__PURE__ */ jsx15(Trash2, {}),
3143
3924
  variant: "destructive",
3144
3925
  onClick: (item) => {
3145
3926
  if (item.value === undefined)
@@ -3150,12 +3931,12 @@ var EditableDataTableListCell = ({
3150
3931
  }
3151
3932
  ] : []
3152
3933
  ];
3153
- return /* @__PURE__ */ jsx14("div", {
3934
+ return /* @__PURE__ */ jsx15("div", {
3154
3935
  "data-slot": "data-table-list-cell",
3155
3936
  className: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
3156
3937
  onClick: (event) => event.stopPropagation(),
3157
3938
  onPointerDown: (event) => event.stopPropagation(),
3158
- children: /* @__PURE__ */ jsx14(DataTableListMenu, {
3939
+ children: /* @__PURE__ */ jsx15(DataTableListMenu, {
3159
3940
  actions,
3160
3941
  addEmptyLabel: emptyLabel,
3161
3942
  addLabel: labels.addItem,
@@ -3172,12 +3953,12 @@ var EditableDataTableListCell = ({
3172
3953
  onAdd(item.value);
3173
3954
  setSelected((current) => [...current, item]);
3174
3955
  } : undefined,
3175
- trigger: /* @__PURE__ */ jsxs8(Button, {
3956
+ trigger: /* @__PURE__ */ jsxs9(Button, {
3176
3957
  "aria-label": manageLabel,
3177
3958
  className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
3178
3959
  variant: "ghost",
3179
3960
  children: [
3180
- /* @__PURE__ */ jsx14(DataTableListSummaryContent, {
3961
+ /* @__PURE__ */ jsx15(DataTableListSummaryContent, {
3181
3962
  emptyLabel,
3182
3963
  items: selected,
3183
3964
  display,
@@ -3185,7 +3966,7 @@ var EditableDataTableListCell = ({
3185
3966
  visibleCount,
3186
3967
  totalCount: selectedTotal
3187
3968
  }),
3188
- /* @__PURE__ */ jsx14(ChevronDown, {})
3969
+ /* @__PURE__ */ jsx15(ChevronDown, {})
3189
3970
  ]
3190
3971
  })
3191
3972
  })
@@ -3209,7 +3990,7 @@ var DataTableListMenu = ({
3209
3990
  trigger
3210
3991
  }) => {
3211
3992
  const entries = items.map((item) => {
3212
- const normalized = Schema.is(Schema.String)(item) ? { label: item } : item;
3993
+ const normalized = Schema2.is(Schema2.String)(item) ? { label: item } : item;
3213
3994
  const visibleActions = actions.filter((action) => action.visible?.(normalized) ?? true);
3214
3995
  return { item: normalized, visibleActions };
3215
3996
  });
@@ -3218,41 +3999,41 @@ var DataTableListMenu = ({
3218
3999
  return null;
3219
4000
  const labels = dataTableMessages(locale, messages);
3220
4001
  const resolvedLabel = label ?? (hasActions ? labels.actions : labels.listDetails);
3221
- return /* @__PURE__ */ jsxs8(DropdownMenu, {
4002
+ return /* @__PURE__ */ jsxs9(DropdownMenu, {
3222
4003
  children: [
3223
- /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
4004
+ /* @__PURE__ */ jsx15(DropdownMenuTrigger, {
3224
4005
  onClick: (event) => event.stopPropagation(),
3225
4006
  onPointerDown: (event) => event.stopPropagation(),
3226
- render: trigger ?? /* @__PURE__ */ jsx14(Button, {
4007
+ render: trigger ?? /* @__PURE__ */ jsx15(Button, {
3227
4008
  "aria-label": resolvedLabel,
3228
4009
  className: cn("size-8 shrink-0", className),
3229
4010
  size: "icon",
3230
4011
  variant: "ghost",
3231
- children: /* @__PURE__ */ jsx14(MoreHorizontal, {})
4012
+ children: /* @__PURE__ */ jsx15(MoreHorizontal, {})
3232
4013
  })
3233
4014
  }),
3234
- /* @__PURE__ */ jsx14(DropdownMenuContent, {
4015
+ /* @__PURE__ */ jsx15(DropdownMenuContent, {
3235
4016
  align: "end",
3236
4017
  className: "max-h-[min(18rem,var(--available-height))] w-72 max-w-[calc(100vw-2rem)]",
3237
4018
  onClick: (event) => event.stopPropagation(),
3238
4019
  onPointerDown: (event) => event.stopPropagation(),
3239
- children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
4020
+ children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
3240
4021
  children: [
3241
- /* @__PURE__ */ jsx14(DropdownMenuLabel, {
4022
+ /* @__PURE__ */ jsx15(DropdownMenuLabel, {
3242
4023
  children: resolvedLabel
3243
4024
  }),
3244
- /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}),
3245
- entries.map(({ item, visibleActions }, index) => visibleActions.length ? /* @__PURE__ */ jsxs8(DropdownMenuSub, {
4025
+ /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
4026
+ entries.map(({ item, visibleActions }, index) => visibleActions.length ? /* @__PURE__ */ jsxs9(DropdownMenuSub, {
3246
4027
  children: [
3247
- /* @__PURE__ */ jsx14(DropdownMenuSubTrigger, {
3248
- children: /* @__PURE__ */ jsx14(DataTableListEntry, {
4028
+ /* @__PURE__ */ jsx15(DropdownMenuSubTrigger, {
4029
+ children: /* @__PURE__ */ jsx15(DataTableListEntry, {
3249
4030
  item,
3250
4031
  appearance: display === "icon" ? "detail" : "list"
3251
4032
  })
3252
4033
  }),
3253
- /* @__PURE__ */ jsx14(DropdownMenuSubContent, {
4034
+ /* @__PURE__ */ jsx15(DropdownMenuSubContent, {
3254
4035
  className: "w-max",
3255
- children: visibleActions.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
4036
+ children: visibleActions.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
3256
4037
  closeOnClick: action.closeOnClick,
3257
4038
  disabled: action.disabled?.(item),
3258
4039
  onClick: (event) => {
@@ -3267,21 +4048,21 @@ var DataTableListMenu = ({
3267
4048
  }, action.id ?? action.name))
3268
4049
  })
3269
4050
  ]
3270
- }, item.value ?? `${item.label}-${index}`) : /* @__PURE__ */ jsx14(DropdownMenuItem, {
4051
+ }, item.value ?? `${item.label}-${index}`) : /* @__PURE__ */ jsx15(DropdownMenuItem, {
3271
4052
  closeOnClick: Boolean(onItemClick),
3272
4053
  onClick: (event) => {
3273
4054
  event.stopPropagation();
3274
4055
  onItemClick?.(item);
3275
4056
  },
3276
- children: /* @__PURE__ */ jsx14(DataTableListEntry, {
4057
+ children: /* @__PURE__ */ jsx15(DataTableListEntry, {
3277
4058
  item,
3278
4059
  appearance: display === "icon" ? "detail" : "list"
3279
4060
  })
3280
4061
  }, item.value ?? `${item.label}-${index}`)),
3281
- onAdd && addOptions?.length ? /* @__PURE__ */ jsxs8(Fragment, {
4062
+ onAdd && addOptions?.length ? /* @__PURE__ */ jsxs9(Fragment, {
3282
4063
  children: [
3283
- entries.length ? /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}) : null,
3284
- /* @__PURE__ */ jsx14(DataTableListAddMenu, {
4064
+ entries.length ? /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}) : null,
4065
+ /* @__PURE__ */ jsx15(DataTableListAddMenu, {
3285
4066
  emptyLabel: addEmptyLabel,
3286
4067
  label: addLabel ?? labels.addItem,
3287
4068
  locale,
@@ -3316,28 +4097,28 @@ var DataTableListAddMenu = ({
3316
4097
  const labels = dataTableMessages(locale, messages);
3317
4098
  const normalizedSearch = search.trim().toLocaleLowerCase(locale);
3318
4099
  const filtered = normalizedSearch ? options.filter((item) => item.label.toLocaleLowerCase(locale).includes(normalizedSearch)) : options;
3319
- return /* @__PURE__ */ jsxs8(DropdownMenuSub, {
4100
+ return /* @__PURE__ */ jsxs9(DropdownMenuSub, {
3320
4101
  onOpenChange: (open) => {
3321
4102
  if (!open)
3322
4103
  setSearch("");
3323
4104
  },
3324
4105
  children: [
3325
- /* @__PURE__ */ jsxs8(DropdownMenuSubTrigger, {
4106
+ /* @__PURE__ */ jsxs9(DropdownMenuSubTrigger, {
3326
4107
  children: [
3327
- /* @__PURE__ */ jsx14(Plus, {}),
4108
+ /* @__PURE__ */ jsx15(Plus, {}),
3328
4109
  label
3329
4110
  ]
3330
4111
  }),
3331
- /* @__PURE__ */ jsxs8(DropdownMenuSubContent, {
4112
+ /* @__PURE__ */ jsxs9(DropdownMenuSubContent, {
3332
4113
  className: "w-64",
3333
4114
  children: [
3334
- /* @__PURE__ */ jsxs8("div", {
4115
+ /* @__PURE__ */ jsxs9("div", {
3335
4116
  className: "relative p-1",
3336
4117
  children: [
3337
- /* @__PURE__ */ jsx14(Search, {
4118
+ /* @__PURE__ */ jsx15(Search, {
3338
4119
  className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
3339
4120
  }),
3340
- /* @__PURE__ */ jsx14(Input, {
4121
+ /* @__PURE__ */ jsx15(Input, {
3341
4122
  "aria-label": searchLabel,
3342
4123
  className: "h-8 pl-8",
3343
4124
  onChange: (event) => setSearch(event.target.value),
@@ -3351,15 +4132,15 @@ var DataTableListAddMenu = ({
3351
4132
  })
3352
4133
  ]
3353
4134
  }),
3354
- /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}),
3355
- filtered.length ? filtered.map((item) => /* @__PURE__ */ jsx14(DropdownMenuItem, {
4135
+ /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
4136
+ filtered.length ? filtered.map((item) => /* @__PURE__ */ jsx15(DropdownMenuItem, {
3356
4137
  closeOnClick: false,
3357
4138
  onClick: () => onAdd(item),
3358
- children: /* @__PURE__ */ jsx14(DataTableListEntry, {
4139
+ children: /* @__PURE__ */ jsx15(DataTableListEntry, {
3359
4140
  item,
3360
4141
  appearance: display === "icon" ? "detail" : "list"
3361
4142
  })
3362
- }, item.value)) : /* @__PURE__ */ jsx14("div", {
4143
+ }, item.value)) : /* @__PURE__ */ jsx15("div", {
3363
4144
  className: "text-muted-foreground px-2 py-1.5 text-sm",
3364
4145
  children: emptyLabel
3365
4146
  })
@@ -3378,31 +4159,31 @@ var DataTableListSummaryContent = ({
3378
4159
  showMenu,
3379
4160
  visibleCount = 3
3380
4161
  }) => {
3381
- const normalized = items.map((item) => Schema.is(Schema.String)(item) ? { label: item } : item);
4162
+ const normalized = items.map((item) => Schema2.is(Schema2.String)(item) ? { label: item } : item);
3382
4163
  if (!normalized.length)
3383
- return /* @__PURE__ */ jsx14("span", {
4164
+ return /* @__PURE__ */ jsx15("span", {
3384
4165
  className: "text-muted-foreground",
3385
4166
  children: emptyLabel
3386
4167
  });
3387
4168
  const visible = normalized.slice(0, Math.max(0, visibleCount));
3388
4169
  const remaining = Math.max(totalCount - visible.length, 0);
3389
4170
  if (display === "icon") {
3390
- return /* @__PURE__ */ jsx14(TooltipProvider, {
3391
- children: /* @__PURE__ */ jsxs8("span", {
4171
+ return /* @__PURE__ */ jsx15(TooltipProvider, {
4172
+ children: /* @__PURE__ */ jsxs9("span", {
3392
4173
  className: "flex items-center",
3393
4174
  children: [
3394
- visible.map((item, index) => /* @__PURE__ */ jsx14(DataTableListEntry, {
4175
+ visible.map((item, index) => /* @__PURE__ */ jsx15(DataTableListEntry, {
3395
4176
  item,
3396
4177
  appearance: "icon"
3397
4178
  }, item.value ?? `${item.label}-${index}`)),
3398
- remaining ? /* @__PURE__ */ jsxs8("span", {
4179
+ remaining ? /* @__PURE__ */ jsxs9("span", {
3399
4180
  className: "bg-secondary text-secondary-foreground -ml-1 flex size-8 items-center justify-center rounded-full",
3400
4181
  children: [
3401
4182
  "+",
3402
4183
  remaining
3403
4184
  ]
3404
4185
  }) : null,
3405
- remaining && showMenu ? /* @__PURE__ */ jsx14(DataTableListMenu, {
4186
+ remaining && showMenu ? /* @__PURE__ */ jsx15(DataTableListMenu, {
3406
4187
  actions: [],
3407
4188
  display,
3408
4189
  force: true,
@@ -3414,17 +4195,17 @@ var DataTableListSummaryContent = ({
3414
4195
  })
3415
4196
  });
3416
4197
  }
3417
- return /* @__PURE__ */ jsxs8("span", {
4198
+ return /* @__PURE__ */ jsxs9("span", {
3418
4199
  className: "inline-flex min-w-0 items-center gap-2 text-sm",
3419
4200
  children: [
3420
- /* @__PURE__ */ jsxs8("span", {
4201
+ /* @__PURE__ */ jsxs9("span", {
3421
4202
  className: "truncate",
3422
4203
  children: [
3423
4204
  visible.map((item) => item.label).join(", "),
3424
4205
  remaining ? ` +${remaining}` : ""
3425
4206
  ]
3426
4207
  }),
3427
- remaining && showMenu ? /* @__PURE__ */ jsx14(DataTableListMenu, {
4208
+ remaining && showMenu ? /* @__PURE__ */ jsx15(DataTableListMenu, {
3428
4209
  actions: [],
3429
4210
  display,
3430
4211
  force: true,
@@ -3435,7 +4216,7 @@ var DataTableListSummaryContent = ({
3435
4216
  ]
3436
4217
  });
3437
4218
  };
3438
- var DataTableListSummary = (props) => /* @__PURE__ */ jsx14(DataTableListSummaryContent, {
4219
+ var DataTableListSummary = (props) => /* @__PURE__ */ jsx15(DataTableListSummaryContent, {
3439
4220
  ...props,
3440
4221
  showMenu: true
3441
4222
  });
@@ -3443,40 +4224,40 @@ var DataTableListEntry = ({
3443
4224
  item,
3444
4225
  appearance
3445
4226
  }) => {
3446
- const icon = /* @__PURE__ */ jsx14("span", {
4227
+ const icon = /* @__PURE__ */ jsx15("span", {
3447
4228
  "aria-hidden": "true",
3448
4229
  className: "bg-secondary text-secondary-foreground flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full",
3449
- children: item.imageSrc ? /* @__PURE__ */ jsx14("img", {
4230
+ children: item.imageSrc ? /* @__PURE__ */ jsx15("img", {
3450
4231
  alt: "",
3451
4232
  src: item.imageSrc,
3452
4233
  className: "size-full object-cover"
3453
4234
  }) : item.icon ?? item.label.slice(0, 2).toUpperCase()
3454
4235
  });
3455
4236
  if (appearance === "list") {
3456
- return /* @__PURE__ */ jsx14("span", {
4237
+ return /* @__PURE__ */ jsx15("span", {
3457
4238
  className: "min-w-0 flex-1 truncate",
3458
4239
  title: item.label,
3459
4240
  children: item.label
3460
4241
  });
3461
4242
  }
3462
- return appearance === "icon" ? /* @__PURE__ */ jsxs8(Tooltip, {
4243
+ return appearance === "icon" ? /* @__PURE__ */ jsxs9(Tooltip, {
3463
4244
  children: [
3464
- /* @__PURE__ */ jsx14(TooltipTrigger, {
3465
- render: /* @__PURE__ */ jsx14("span", {
4245
+ /* @__PURE__ */ jsx15(TooltipTrigger, {
4246
+ render: /* @__PURE__ */ jsx15("span", {
3466
4247
  className: "-ml-1 inline-flex rounded-full",
3467
4248
  "aria-label": item.label
3468
4249
  }),
3469
4250
  children: icon
3470
4251
  }),
3471
- /* @__PURE__ */ jsx14(TooltipContent, {
4252
+ /* @__PURE__ */ jsx15(TooltipContent, {
3472
4253
  children: item.label
3473
4254
  })
3474
4255
  ]
3475
- }) : /* @__PURE__ */ jsxs8("span", {
4256
+ }) : /* @__PURE__ */ jsxs9("span", {
3476
4257
  className: "flex min-w-0 flex-1 items-center gap-2 text-left",
3477
4258
  children: [
3478
4259
  icon,
3479
- /* @__PURE__ */ jsx14("span", {
4260
+ /* @__PURE__ */ jsx15("span", {
3480
4261
  className: "truncate",
3481
4262
  children: item.label
3482
4263
  })
@@ -3493,9 +4274,13 @@ export {
3493
4274
  dataTableMessages,
3494
4275
  downloadCsv,
3495
4276
  downloadJson,
4277
+ filterDataTableColumnRows,
3496
4278
  filterDataTableRows,
4279
+ getDataTableExportColumns,
3497
4280
  getDataTableExportValue,
4281
+ getDataTableFilterColumns,
3498
4282
  getDataTableSelectableRows,
4283
+ getDataTableSortColumns,
3499
4284
  getDataTableWidth,
3500
4285
  groupDataTableRows,
3501
4286
  normalizeDataTableColumns,