@krak-stack/registry 0.1.28 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/components/ui/code-block.js +1 -5
  2. package/dist/components/ui/copy-button.js +1 -5
  3. package/dist/components/ui/data-table.d.ts +149 -45
  4. package/dist/components/ui/data-table.js +808 -768
  5. package/dist/components/ui/editing-locale-switcher.js +1 -5
  6. package/dist/components/ui/effect-form.js +1 -5
  7. package/dist/components/ui/error-component.d.ts +30 -0
  8. package/dist/components/ui/error-component.js +811 -0
  9. package/dist/components/ui/file-picker.js +1 -5
  10. package/dist/components/ui/form.js +1 -5
  11. package/dist/components/ui/google-map.js +1 -5
  12. package/dist/components/ui/icon-input.js +1 -5
  13. package/dist/components/ui/loading.js +1 -5
  14. package/dist/components/ui/locale-switcher.js +1 -5
  15. package/dist/components/ui/pagination.js +1 -5
  16. package/dist/components/ui/search-menu.js +1 -5
  17. package/dist/components/ui/sidebar-layout.js +1 -5
  18. package/dist/components/ui/stats-card.js +1 -5
  19. package/dist/components/ui/theme-switcher.js +1 -5
  20. package/dist/components/ui/virtualized-combobox.js +1 -5
  21. package/dist/lib/docs.js +1 -5
  22. package/dist/lib/docs.server.js +1 -2
  23. package/dist/lib/documentation-toolkit.js +1 -2
  24. package/dist/lib/utils.d.ts +1 -2
  25. package/dist/services/agent/client/index.js +3 -5
  26. package/dist/services/agent/index.d.ts +4 -0
  27. package/dist/services/agent/index.js +1 -1
  28. package/dist/services/agent/schema.d.ts +6 -0
  29. package/dist/services/agent/schema.js +1 -0
  30. package/dist/services/notification/client/index.js +1 -5
  31. package/dist/services/notification/public.js +1 -5
  32. package/package.json +7 -4
@@ -1,14 +1,14 @@
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 { Schema } from "effect";
4
+ import { DateTime, Option, Schema } from "effect";
5
5
  import { AsyncResult, Atom } from "effect/unstable/reactivity";
6
6
  import {
7
7
  ArrowDown,
8
8
  ArrowUp,
9
9
  ChevronDown,
10
10
  ChevronRight as ChevronRight2,
11
- ChevronsUpDown as ChevronsUpDown2,
11
+ ChevronsUpDown,
12
12
  Download,
13
13
  EyeOff,
14
14
  FileJson,
@@ -16,20 +16,22 @@ import {
16
16
  GripVertical,
17
17
  LayoutGrid,
18
18
  MoreHorizontal,
19
+ Plus,
19
20
  RefreshCw,
20
21
  Rows3,
21
22
  Search,
22
23
  Settings2,
23
- X as X2
24
+ Trash2,
25
+ X
24
26
  } from "lucide-react";
25
27
  import {
26
28
  createContext,
27
29
  isValidElement,
28
- useCallback as useCallback2,
30
+ useCallback,
29
31
  useContext,
30
32
  useLayoutEffect,
31
33
  useMemo,
32
- useRef as useRef2,
34
+ useRef,
33
35
  useState
34
36
  } from "react";
35
37
  import { createPortal } from "react-dom";
@@ -40,11 +42,7 @@ import { useRender } from "@base-ui/react/use-render";
40
42
  import { cva } from "class-variance-authority";
41
43
 
42
44
  // ../../src/lib/utils.ts
43
- import { clsx } from "clsx";
44
- import { twMerge } from "tailwind-merge";
45
- function cn(...inputs) {
46
- return twMerge(clsx(inputs));
47
- }
45
+ import { cn } from "cn";
48
46
 
49
47
  // ../../src/components/ui/badge.tsx
50
48
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
@@ -1258,48 +1256,9 @@ function Pagination({
1258
1256
  });
1259
1257
  }
1260
1258
 
1261
- // ../../src/components/ui/popover.tsx
1262
- import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
1263
- import { jsx as jsx11 } from "react/jsx-runtime";
1264
- function Popover({ ...props }) {
1265
- return /* @__PURE__ */ jsx11(PopoverPrimitive.Root, {
1266
- "data-slot": "popover",
1267
- ...props
1268
- });
1269
- }
1270
- function PopoverTrigger({ ...props }) {
1271
- return /* @__PURE__ */ jsx11(PopoverPrimitive.Trigger, {
1272
- "data-slot": "popover-trigger",
1273
- ...props
1274
- });
1275
- }
1276
- function PopoverContent({
1277
- className,
1278
- align = "center",
1279
- alignOffset = 0,
1280
- side = "bottom",
1281
- sideOffset = 4,
1282
- ...props
1283
- }) {
1284
- return /* @__PURE__ */ jsx11(PopoverPrimitive.Portal, {
1285
- children: /* @__PURE__ */ jsx11(PopoverPrimitive.Positioner, {
1286
- align,
1287
- alignOffset,
1288
- side,
1289
- sideOffset,
1290
- className: "isolate z-50",
1291
- children: /* @__PURE__ */ jsx11(PopoverPrimitive.Popup, {
1292
- "data-slot": "popover-content",
1293
- className: cn("z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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),
1294
- ...props
1295
- })
1296
- })
1297
- });
1298
- }
1299
-
1300
1259
  // ../../src/components/ui/scroll-area.tsx
1301
1260
  import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
1302
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1261
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1303
1262
  function ScrollArea({
1304
1263
  className,
1305
1264
  children,
@@ -1310,13 +1269,13 @@ function ScrollArea({
1310
1269
  className: cn("relative", className),
1311
1270
  ...props,
1312
1271
  children: [
1313
- /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Viewport, {
1272
+ /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Viewport, {
1314
1273
  "data-slot": "scroll-area-viewport",
1315
1274
  className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
1316
1275
  children
1317
1276
  }),
1318
- /* @__PURE__ */ jsx12(ScrollBar, {}),
1319
- /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Corner, {})
1277
+ /* @__PURE__ */ jsx11(ScrollBar, {}),
1278
+ /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Corner, {})
1320
1279
  ]
1321
1280
  });
1322
1281
  }
@@ -1325,13 +1284,13 @@ function ScrollBar({
1325
1284
  orientation = "vertical",
1326
1285
  ...props
1327
1286
  }) {
1328
- return /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Scrollbar, {
1287
+ return /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Scrollbar, {
1329
1288
  "data-slot": "scroll-area-scrollbar",
1330
1289
  "data-orientation": orientation,
1331
1290
  orientation,
1332
1291
  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),
1333
1292
  ...props,
1334
- children: /* @__PURE__ */ jsx12(ScrollAreaPrimitive.Thumb, {
1293
+ children: /* @__PURE__ */ jsx11(ScrollAreaPrimitive.Thumb, {
1335
1294
  "data-slot": "scroll-area-thumb",
1336
1295
  className: "bg-border relative flex-1 rounded-full"
1337
1296
  })
@@ -1339,12 +1298,12 @@ function ScrollBar({
1339
1298
  }
1340
1299
 
1341
1300
  // ../../src/components/ui/table.tsx
1342
- import { jsx as jsx13 } from "react/jsx-runtime";
1301
+ import { jsx as jsx12 } from "react/jsx-runtime";
1343
1302
  function Table({ className, ...props }) {
1344
- return /* @__PURE__ */ jsx13("div", {
1303
+ return /* @__PURE__ */ jsx12("div", {
1345
1304
  "data-slot": "table-container",
1346
1305
  className: "relative w-full overflow-x-auto",
1347
- children: /* @__PURE__ */ jsx13("table", {
1306
+ children: /* @__PURE__ */ jsx12("table", {
1348
1307
  "data-slot": "table",
1349
1308
  className: cn("w-full caption-bottom text-sm", className),
1350
1309
  ...props
@@ -1352,35 +1311,35 @@ function Table({ className, ...props }) {
1352
1311
  });
1353
1312
  }
1354
1313
  function TableHeader({ className, ...props }) {
1355
- return /* @__PURE__ */ jsx13("thead", {
1314
+ return /* @__PURE__ */ jsx12("thead", {
1356
1315
  "data-slot": "table-header",
1357
1316
  className: cn("[&_tr]:border-b", className),
1358
1317
  ...props
1359
1318
  });
1360
1319
  }
1361
1320
  function TableBody({ className, ...props }) {
1362
- return /* @__PURE__ */ jsx13("tbody", {
1321
+ return /* @__PURE__ */ jsx12("tbody", {
1363
1322
  "data-slot": "table-body",
1364
1323
  className: cn("[&_tr:last-child]:border-0", className),
1365
1324
  ...props
1366
1325
  });
1367
1326
  }
1368
1327
  function TableRow({ className, ...props }) {
1369
- return /* @__PURE__ */ jsx13("tr", {
1328
+ return /* @__PURE__ */ jsx12("tr", {
1370
1329
  "data-slot": "table-row",
1371
1330
  className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
1372
1331
  ...props
1373
1332
  });
1374
1333
  }
1375
1334
  function TableHead({ className, ...props }) {
1376
- return /* @__PURE__ */ jsx13("th", {
1335
+ return /* @__PURE__ */ jsx12("th", {
1377
1336
  "data-slot": "table-head",
1378
1337
  className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0", className),
1379
1338
  ...props
1380
1339
  });
1381
1340
  }
1382
1341
  function TableCell({ className, ...props }) {
1383
- return /* @__PURE__ */ jsx13("td", {
1342
+ return /* @__PURE__ */ jsx12("td", {
1384
1343
  "data-slot": "table-cell",
1385
1344
  className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
1386
1345
  ...props
@@ -1389,26 +1348,26 @@ function TableCell({ className, ...props }) {
1389
1348
 
1390
1349
  // ../../src/components/ui/tooltip.tsx
1391
1350
  import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
1392
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
1351
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1393
1352
  "use client";
1394
1353
  function TooltipProvider({
1395
1354
  delay = 0,
1396
1355
  ...props
1397
1356
  }) {
1398
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Provider, {
1357
+ return /* @__PURE__ */ jsx13(TooltipPrimitive.Provider, {
1399
1358
  "data-slot": "tooltip-provider",
1400
1359
  delay,
1401
1360
  ...props
1402
1361
  });
1403
1362
  }
1404
1363
  function Tooltip({ ...props }) {
1405
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Root, {
1364
+ return /* @__PURE__ */ jsx13(TooltipPrimitive.Root, {
1406
1365
  "data-slot": "tooltip",
1407
1366
  ...props
1408
1367
  });
1409
1368
  }
1410
1369
  function TooltipTrigger({ ...props }) {
1411
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Trigger, {
1370
+ return /* @__PURE__ */ jsx13(TooltipPrimitive.Trigger, {
1412
1371
  "data-slot": "tooltip-trigger",
1413
1372
  ...props
1414
1373
  });
@@ -1422,8 +1381,8 @@ function TooltipContent({
1422
1381
  children,
1423
1382
  ...props
1424
1383
  }) {
1425
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Portal, {
1426
- children: /* @__PURE__ */ jsx14(TooltipPrimitive.Positioner, {
1384
+ return /* @__PURE__ */ jsx13(TooltipPrimitive.Portal, {
1385
+ children: /* @__PURE__ */ jsx13(TooltipPrimitive.Positioner, {
1427
1386
  align,
1428
1387
  alignOffset,
1429
1388
  side,
@@ -1435,7 +1394,7 @@ function TooltipContent({
1435
1394
  ...props,
1436
1395
  children: [
1437
1396
  children,
1438
- /* @__PURE__ */ jsx14(TooltipPrimitive.Arrow, {
1397
+ /* @__PURE__ */ jsx13(TooltipPrimitive.Arrow, {
1439
1398
  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"
1440
1399
  })
1441
1400
  ]
@@ -1444,381 +1403,19 @@ function TooltipContent({
1444
1403
  });
1445
1404
  }
1446
1405
 
1447
- // ../../src/components/ui/virtualized-combobox.tsx
1448
- import { Combobox as ComboboxPrimitive } from "@base-ui/react";
1449
- import { useVirtualizer } from "@tanstack/react-virtual";
1450
- import { Check, ChevronsUpDown, X } from "lucide-react";
1451
- import {
1452
- useCallback,
1453
- useEffect,
1454
- useImperativeHandle,
1455
- useRef
1456
- } from "react";
1457
-
1458
- // ../../src/components/ui/input-group.tsx
1459
- import { cva as cva3 } from "class-variance-authority";
1460
- import { jsx as jsx15 } from "react/jsx-runtime";
1461
- function InputGroup({ className, ...props }) {
1462
- return /* @__PURE__ */ jsx15("div", {
1463
- "data-slot": "input-group",
1464
- role: "group",
1465
- className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className),
1466
- ...props
1467
- });
1468
- }
1469
- var inputGroupAddonVariants = cva3("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
1470
- variants: {
1471
- align: {
1472
- "inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
1473
- "inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
1474
- "block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
1475
- "block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
1476
- }
1477
- },
1478
- defaultVariants: { align: "inline-start" }
1479
- });
1480
- var inputGroupButtonVariants = cva3("flex items-center gap-2 text-sm shadow-none", {
1481
- variants: {
1482
- size: {
1483
- xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
1484
- sm: "",
1485
- "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
1486
- "icon-sm": "size-8 p-0 has-[>svg]:p-0"
1487
- }
1488
- },
1489
- defaultVariants: { size: "xs" }
1490
- });
1491
- function InputGroupInput({
1492
- className,
1493
- ...props
1494
- }) {
1495
- return /* @__PURE__ */ jsx15(Input, {
1496
- "data-slot": "input-group-control",
1497
- className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className),
1498
- ...props
1499
- });
1500
- }
1501
-
1502
- // ../../src/components/ui/virtualized-combobox.tsx
1503
- import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
1504
- "use client";
1505
- var messages2 = {
1506
- en: {
1507
- clear: "Clear selection",
1508
- search: "Search...",
1509
- selected: (count) => `${count} selected`,
1510
- selectMore: "Select more"
1511
- },
1512
- fr: {
1513
- clear: "Effacer la sélection",
1514
- search: "Rechercher...",
1515
- selected: (count) => `${count} sélectionnés`,
1516
- selectMore: "Sélectionner davantage"
1517
- }
1518
- };
1519
- var virtualizedComboboxMessages = (overrides) => ({
1520
- ...getLocale().startsWith("fr") ? messages2.fr : messages2.en,
1521
- ...overrides
1522
- });
1523
- var optionEquals = (item, selected) => item.value === selected.value;
1524
- var VirtualizedComboboxList = ({
1525
- emptyLabel,
1526
- groupSelections,
1527
- itemIndexRef,
1528
- messages: messageOverrides,
1529
- renderItem,
1530
- selectedValues,
1531
- virtualizerRef
1532
- }) => {
1533
- const filteredItems = ComboboxPrimitive.useFilteredItems();
1534
- const labels2 = virtualizedComboboxMessages(messageOverrides);
1535
- const itemEntries = filteredItems.map((item, index) => ({
1536
- kind: "item",
1537
- item,
1538
- index
1539
- }));
1540
- const selectedEntries = itemEntries.filter(({ item }) => selectedValues.has(item.value));
1541
- const availableEntries = itemEntries.filter(({ item }) => !selectedValues.has(item.value));
1542
- const entries = groupSelections ? [
1543
- ...selectedEntries.length > 0 ? [
1544
- {
1545
- kind: "group",
1546
- key: "selected",
1547
- label: labels2.selected(selectedValues.size)
1548
- },
1549
- ...selectedEntries
1550
- ] : [],
1551
- {
1552
- kind: "group",
1553
- key: "available",
1554
- label: labels2.selectMore
1555
- },
1556
- ...availableEntries
1557
- ] : itemEntries;
1558
- const scrollRef = useRef(null);
1559
- const virtualizer = useVirtualizer({
1560
- count: entries.length,
1561
- getScrollElement: () => scrollRef.current,
1562
- getItemKey: (index) => {
1563
- const entry = entries[index];
1564
- return entry?.kind === "group" ? `group-${entry.key}` : entry?.item.value ?? index;
1565
- },
1566
- estimateSize: () => 36,
1567
- overscan: 8
1568
- });
1569
- useEffect(() => {
1570
- itemIndexRef.current = new Map(entries.flatMap((entry, index) => entry.kind === "item" ? [[entry.index, index]] : []));
1571
- });
1572
- useImperativeHandle(virtualizerRef, () => virtualizer, [virtualizer]);
1573
- const handleScrollElementRef = useCallback((element) => {
1574
- scrollRef.current = element;
1575
- if (element)
1576
- virtualizer.measure();
1577
- }, [virtualizer]);
1578
- if (filteredItems.length === 0) {
1579
- return /* @__PURE__ */ jsx16("div", {
1580
- className: "text-muted-foreground py-6 text-center text-sm",
1581
- children: emptyLabel
1582
- });
1583
- }
1584
- return /* @__PURE__ */ jsx16(ComboboxPrimitive.List, {
1585
- className: "scroll-py-1 overflow-auto overscroll-contain p-1",
1586
- ref: handleScrollElementRef,
1587
- style: {
1588
- height: Math.min(virtualizer.getTotalSize() + 8, 288),
1589
- maxHeight: "var(--available-height)"
1590
- },
1591
- children: /* @__PURE__ */ jsx16("div", {
1592
- className: "relative w-full",
1593
- role: "presentation",
1594
- style: { height: virtualizer.getTotalSize() },
1595
- children: virtualizer.getVirtualItems().map((virtualItem) => {
1596
- const entry = entries[virtualItem.index];
1597
- if (!entry)
1598
- return null;
1599
- const style = {
1600
- height: virtualItem.size,
1601
- transform: `translateY(${virtualItem.start}px)`
1602
- };
1603
- if (entry.kind === "group") {
1604
- return /* @__PURE__ */ jsx16(ComboboxPrimitive.Group, {
1605
- className: "contents",
1606
- children: /* @__PURE__ */ jsx16(ComboboxPrimitive.GroupLabel, {
1607
- className: "text-muted-foreground absolute top-0 left-0 w-full px-2 pt-3 pb-1 text-xs",
1608
- "data-index": virtualItem.index,
1609
- ref: virtualizer.measureElement,
1610
- style,
1611
- children: entry.label
1612
- })
1613
- }, entry.key);
1614
- }
1615
- return /* @__PURE__ */ jsxs8(ComboboxPrimitive.Item, {
1616
- "aria-posinset": entry.index + 1,
1617
- "aria-setsize": filteredItems.length,
1618
- className: "data-highlighted:bg-accent data-highlighted:text-accent-foreground absolute top-0 left-0 flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50",
1619
- "data-index": virtualItem.index,
1620
- index: entry.index,
1621
- ref: virtualizer.measureElement,
1622
- style,
1623
- value: entry.item,
1624
- children: [
1625
- renderItem?.(entry.item) ?? /* @__PURE__ */ jsx16("span", {
1626
- className: "min-w-0 truncate",
1627
- children: entry.item.label
1628
- }),
1629
- /* @__PURE__ */ jsx16(ComboboxPrimitive.ItemIndicator, {
1630
- className: "absolute right-2 flex size-4 items-center justify-center",
1631
- children: /* @__PURE__ */ jsx16(Check, {})
1632
- })
1633
- ]
1634
- }, entry.item.value);
1635
- })
1636
- })
1637
- });
1638
- };
1639
- var VirtualizedComboboxContent = ({
1640
- contentClassName,
1641
- emptyLabel,
1642
- groupSelections,
1643
- itemIndexRef,
1644
- messages: messageOverrides,
1645
- renderItem,
1646
- selectedValues,
1647
- virtualizerRef
1648
- }) => {
1649
- const labels2 = virtualizedComboboxMessages(messageOverrides);
1650
- return /* @__PURE__ */ jsx16(ComboboxPrimitive.Portal, {
1651
- children: /* @__PURE__ */ jsx16(ComboboxPrimitive.Positioner, {
1652
- align: "start",
1653
- className: "isolate z-50",
1654
- side: "bottom",
1655
- sideOffset: 6,
1656
- children: /* @__PURE__ */ jsxs8(ComboboxPrimitive.Popup, {
1657
- className: cn("relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-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-in-95", contentClassName),
1658
- children: [
1659
- /* @__PURE__ */ jsx16("div", {
1660
- className: "min-w-0 p-1 pb-0",
1661
- children: /* @__PURE__ */ jsx16(InputGroup, {
1662
- className: "border-input/30 bg-input/30 h-8 w-full min-w-0 shadow-none",
1663
- children: /* @__PURE__ */ jsx16(ComboboxPrimitive.Input, {
1664
- placeholder: labels2.search,
1665
- render: /* @__PURE__ */ jsx16(InputGroupInput, {})
1666
- })
1667
- })
1668
- }),
1669
- /* @__PURE__ */ jsx16(VirtualizedComboboxList, {
1670
- emptyLabel,
1671
- groupSelections,
1672
- itemIndexRef,
1673
- messages: messageOverrides,
1674
- renderItem,
1675
- selectedValues,
1676
- virtualizerRef
1677
- })
1678
- ]
1679
- })
1680
- })
1681
- });
1682
- };
1683
- var defaultTrigger = (ariaLabel, ariaInvalid, disabled, label, triggerId) => /* @__PURE__ */ jsxs8(Button, {
1684
- "aria-label": ariaLabel,
1685
- "aria-invalid": ariaInvalid,
1686
- className: "w-full max-w-full min-w-0 justify-between overflow-hidden",
1687
- disabled,
1688
- id: triggerId,
1689
- type: "button",
1690
- variant: "outline",
1691
- children: [
1692
- /* @__PURE__ */ jsx16("span", {
1693
- className: "min-w-0 flex-1 truncate pr-7 text-left",
1694
- children: label
1695
- }),
1696
- /* @__PURE__ */ jsx16(ChevronsUpDown, {
1697
- className: "text-muted-foreground shrink-0 opacity-70"
1698
- })
1699
- ]
1700
- });
1701
- var defaultClear = (label) => /* @__PURE__ */ jsx16(ComboboxPrimitive.Clear, {
1702
- "aria-label": label,
1703
- className: "text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute top-1/2 right-7 z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-sm outline-none focus-visible:border focus-visible:ring-3",
1704
- type: "button",
1705
- children: /* @__PURE__ */ jsx16(X, {
1706
- className: "size-3.5"
1707
- })
1708
- });
1709
- var selectedLabel = (value, placeholder) => {
1710
- if (Array.isArray(value)) {
1711
- return value.length > 0 ? value.map(({ label }) => label).join(", ") : placeholder;
1712
- }
1713
- return value && "label" in value ? value.label : placeholder;
1714
- };
1715
- var useComboboxVirtualizerRef = (providedRef) => {
1716
- const localRef = useRef(null);
1717
- return providedRef ?? localRef;
1718
- };
1719
- var VirtualizedComboboxSingle = (props) => {
1720
- const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
1721
- const itemIndexRef = useRef(new Map);
1722
- const labels2 = virtualizedComboboxMessages(props.messages);
1723
- return /* @__PURE__ */ jsxs8(ComboboxPrimitive.Root, {
1724
- disabled: props.disabled,
1725
- inputValue: props.searchValue,
1726
- items: [...props.items],
1727
- itemToStringLabel: (item) => item.label,
1728
- isItemEqualToValue: optionEquals,
1729
- onInputValueChange: (value) => props.onSearchValueChange?.(value),
1730
- onItemHighlighted: (_, { index, reason }) => {
1731
- if (reason === "keyboard" && index >= 0) {
1732
- virtualizerRef.current?.scrollToIndex(itemIndexRef.current.get(index) ?? index, { align: "auto" });
1733
- }
1734
- },
1735
- onOpenChange: (open) => props.onOpenChange?.(open),
1736
- onValueChange: (value) => props.onValueChange(value),
1737
- open: props.open,
1738
- value: props.value,
1739
- virtualized: true,
1740
- children: [
1741
- /* @__PURE__ */ jsxs8("div", {
1742
- className: "relative",
1743
- children: [
1744
- /* @__PURE__ */ jsx16(ComboboxPrimitive.Trigger, {
1745
- render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
1746
- }),
1747
- props.trigger ? null : defaultClear(labels2.clear)
1748
- ]
1749
- }),
1750
- /* @__PURE__ */ jsx16(VirtualizedComboboxContent, {
1751
- ...props,
1752
- groupSelections: false,
1753
- itemIndexRef,
1754
- selectedValues: new Set(props.value ? [props.value.value] : []),
1755
- virtualizerRef
1756
- })
1757
- ]
1758
- });
1759
- };
1760
- var VirtualizedComboboxMultiple = (props) => {
1761
- const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
1762
- const itemIndexRef = useRef(new Map);
1763
- const labels2 = virtualizedComboboxMessages(props.messages);
1764
- return /* @__PURE__ */ jsxs8(ComboboxPrimitive.Root, {
1765
- disabled: props.disabled,
1766
- inputValue: props.searchValue,
1767
- items: [...props.items],
1768
- itemToStringLabel: (item) => item.label,
1769
- isItemEqualToValue: optionEquals,
1770
- multiple: true,
1771
- onInputValueChange: (value) => props.onSearchValueChange?.(value),
1772
- onItemHighlighted: (_, { index, reason }) => {
1773
- if (reason === "keyboard" && index >= 0) {
1774
- virtualizerRef.current?.scrollToIndex(itemIndexRef.current.get(index) ?? index, { align: "auto" });
1775
- }
1776
- },
1777
- onOpenChange: (open) => props.onOpenChange?.(open),
1778
- onValueChange: (value) => props.onValueChange(value),
1779
- open: props.open,
1780
- value: [...props.value],
1781
- virtualized: true,
1782
- children: [
1783
- /* @__PURE__ */ jsxs8("div", {
1784
- className: "relative",
1785
- children: [
1786
- /* @__PURE__ */ jsx16(ComboboxPrimitive.Trigger, {
1787
- render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
1788
- }),
1789
- props.trigger ? null : defaultClear(labels2.clear)
1790
- ]
1791
- }),
1792
- /* @__PURE__ */ jsx16(VirtualizedComboboxContent, {
1793
- ...props,
1794
- groupSelections: true,
1795
- itemIndexRef,
1796
- selectedValues: new Set(props.value.map(({ value }) => value)),
1797
- virtualizerRef
1798
- })
1799
- ]
1800
- });
1801
- };
1802
- function VirtualizedCombobox(props) {
1803
- return props.multiple ? /* @__PURE__ */ jsx16(VirtualizedComboboxMultiple, {
1804
- ...props
1805
- }) : /* @__PURE__ */ jsx16(VirtualizedComboboxSingle, {
1806
- ...props
1807
- });
1808
- }
1809
-
1810
1406
  // ../../src/components/ui/data-table.tsx
1811
- import { jsx as jsx17, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
1407
+ import { jsx as jsx14, jsxs as jsxs8, Fragment } from "react/jsx-runtime";
1812
1408
  var DataTablePersistedUiStateSchema = Schema.Struct({
1813
1409
  columnVisibility: Schema.Record(Schema.String, Schema.Boolean),
1814
1410
  columnSizing: Schema.Record(Schema.String, Schema.Number),
1815
1411
  view: Schema.Literals(["table", "gallery"])
1816
1412
  }).annotate({ identifier: "DataTablePersistedUiState" });
1817
1413
  var dataTableStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
1818
- var messages3 = {
1414
+ var messages2 = {
1819
1415
  en: {
1820
1416
  ...paginationMessages("en"),
1821
1417
  actions: "Actions",
1418
+ addItem: "Add item...",
1822
1419
  empty: "No results.",
1823
1420
  loading: "Loading...",
1824
1421
  filter: "Filter results...",
@@ -1837,10 +1434,11 @@ var messages3 = {
1837
1434
  sortBy: "Sort by",
1838
1435
  hideColumn: "Hide column",
1839
1436
  reorder: "Drag to reorder",
1437
+ removeItem: "Remove",
1840
1438
  moveUp: "Move up",
1841
1439
  moveDown: "Move down",
1842
1440
  resizeColumn: (column) => `Resize ${column} column`,
1843
- listOthers: (count) => count === 1 ? "and 1 other" : `and ${count} others`,
1441
+ listDetails: "View all items",
1844
1442
  selectAllRows: "Select all rows on this page",
1845
1443
  selectRow: "Select row",
1846
1444
  selected: "Selected"
@@ -1848,6 +1446,7 @@ var messages3 = {
1848
1446
  fr: {
1849
1447
  ...paginationMessages("fr"),
1850
1448
  actions: "Actions",
1449
+ addItem: "Ajouter un élément...",
1851
1450
  empty: "Aucun résultat.",
1852
1451
  loading: "Chargement...",
1853
1452
  filter: "Filtrer les résultats...",
@@ -1866,17 +1465,18 @@ var messages3 = {
1866
1465
  sortBy: "Trier par",
1867
1466
  hideColumn: "Masquer la colonne",
1868
1467
  reorder: "Glisser pour réordonner",
1468
+ removeItem: "Retirer",
1869
1469
  moveUp: "Déplacer vers le haut",
1870
1470
  moveDown: "Déplacer vers le bas",
1871
1471
  resizeColumn: (column) => `Redimensionner la colonne ${column}`,
1872
- listOthers: (count) => count === 1 ? "et 1 autre" : `et ${count} autres`,
1472
+ listDetails: "Afficher tous les éléments",
1873
1473
  selectAllRows: "Sélectionner toutes les lignes de cette page",
1874
1474
  selectRow: "Sélectionner la ligne",
1875
1475
  selected: "Sélectionnés"
1876
1476
  }
1877
1477
  };
1878
1478
  var dataTableMessages = (overrides) => ({
1879
- ...getLocale().startsWith("fr") ? messages3.fr : messages3.en,
1479
+ ...getLocale().startsWith("fr") ? messages2.fr : messages2.en,
1880
1480
  ...overrides
1881
1481
  });
1882
1482
  var DEFAULT_MIN_WIDTH = 96;
@@ -1937,18 +1537,100 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
1937
1537
  index,
1938
1538
  values: new Map(columns.map((column) => {
1939
1539
  const { colDef } = column;
1940
- const value = colDef.valueGetter ? colDef.valueGetter({ data, rowId: id, rowIndex: index, colDef }) : colDef.field ? data[colDef.field] : undefined;
1540
+ 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.field ? data[colDef.field] : undefined;
1941
1541
  return [column.id, value];
1942
1542
  }))
1943
1543
  };
1944
1544
  });
1945
1545
  };
1546
+ 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" });
1547
+ 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" });
1548
+ var DateInput = Schema.Union([
1549
+ Schema.Date,
1550
+ Schema.Int,
1551
+ CalendarDate,
1552
+ InstantString
1553
+ ]).annotate({ identifier: "DataTableDateInput" });
1554
+ var decodeDateInput = Schema.decodeUnknownOption(DateInput);
1555
+ var resolveDate = (value, type) => Option.getOrUndefined(Option.flatMap(decodeDateInput(value), (input) => {
1556
+ const calendarOnly = Schema.is(CalendarDate)(input);
1557
+ if (calendarOnly && type === "dateTime")
1558
+ return Option.none();
1559
+ return Option.map(DateTime.make(input), (instant) => ({
1560
+ instant,
1561
+ calendarOnly
1562
+ }));
1563
+ }));
1564
+ var formatDateValue = (date, column) => DateTime.format(date.instant, {
1565
+ locale: column.typeOptions?.locale ?? getLocale(),
1566
+ timeZone: date.calendarOnly ? "UTC" : column.typeOptions?.timeZone ?? "UTC",
1567
+ dateStyle: column.typeOptions?.dateStyle ?? "medium",
1568
+ timeStyle: column.type === "dateTime" ? column.typeOptions?.timeStyle ?? "short" : undefined,
1569
+ hour12: column.type === "dateTime" ? column.typeOptions?.hour12 : undefined
1570
+ });
1571
+ var dateIsoValue = (date) => date.calendarOnly ? DateTime.formatIsoDateUtc(date.instant) : DateTime.formatIso(date.instant);
1572
+ var NumberValue = Schema.Finite.annotate({
1573
+ identifier: "DataTableNumberValue"
1574
+ });
1575
+ var BooleanValue = Schema.Boolean.annotate({
1576
+ identifier: "DataTableBooleanValue"
1577
+ });
1578
+ var decodeNumberValue = Schema.decodeUnknownOption(NumberValue);
1579
+ var decodeBooleanValue = Schema.decodeUnknownOption(BooleanValue);
1580
+ var formatNumberValue = (value, options = {}) => {
1581
+ const {
1582
+ locale,
1583
+ emptyLabel: _emptyLabel,
1584
+ nulls: _nulls,
1585
+ exportFormat: _exportFormat,
1586
+ ...format
1587
+ } = options;
1588
+ return new Intl.NumberFormat(locale ?? getLocale(), format).format(value);
1589
+ };
1590
+ var booleanLabel = (value, options) => value ? options?.trueLabel : options?.falseLabel;
1591
+ var getDataTableExportValue = (row, column) => {
1592
+ const value = row.values.get(column.id);
1593
+ const colDef = column.colDef;
1594
+ if (colDef.type === "number") {
1595
+ const number = Option.getOrUndefined(decodeNumberValue(value));
1596
+ if (number === undefined)
1597
+ return null;
1598
+ return colDef.typeOptions?.exportFormat === "formatted" ? formatNumberValue(number, colDef.typeOptions) : number;
1599
+ }
1600
+ if (colDef.type === "boolean") {
1601
+ const boolean = Option.getOrUndefined(decodeBooleanValue(value));
1602
+ if (boolean === undefined)
1603
+ return null;
1604
+ return colDef.typeOptions?.exportFormat === "formatted" ? booleanLabel(boolean, colDef.typeOptions) ?? String(boolean) : boolean;
1605
+ }
1606
+ if (colDef.type !== "date" && colDef.type !== "dateTime")
1607
+ return value;
1608
+ const date = resolveDate(value, colDef.type);
1609
+ if (!date)
1610
+ return null;
1611
+ return colDef.typeOptions?.exportFormat === "formatted" ? formatDateValue(date, colDef) : dateIsoValue(date);
1612
+ };
1946
1613
  var filterDataTableRows = (rows, columns, globalFilter) => {
1947
1614
  const query = globalFilter.trim().toLocaleLowerCase();
1948
1615
  if (!query)
1949
1616
  return [...rows];
1950
1617
  const searchable = columns.filter(({ colDef }) => colDef.searchable !== false);
1951
- return rows.filter((row) => searchable.some((column) => String(row.values.get(column.id) ?? "").toLocaleLowerCase().includes(query)));
1618
+ return rows.filter((row) => searchable.some((column) => {
1619
+ const value = row.values.get(column.id);
1620
+ const colDef = column.colDef;
1621
+ let text = String(value ?? "");
1622
+ if (colDef.type === "date" || colDef.type === "dateTime") {
1623
+ const date = resolveDate(value, colDef.type);
1624
+ text = date ? `${formatDateValue(date, colDef)} ${dateIsoValue(date)}` : "";
1625
+ } else if (colDef.type === "number") {
1626
+ const number = Option.getOrUndefined(decodeNumberValue(value));
1627
+ text = number === undefined ? "" : `${formatNumberValue(number, colDef.typeOptions)} ${number}`;
1628
+ } else if (colDef.type === "boolean") {
1629
+ const boolean = Option.getOrUndefined(decodeBooleanValue(value));
1630
+ text = boolean === undefined ? "" : `${booleanLabel(boolean, colDef.typeOptions) ?? ""} ${boolean}`;
1631
+ }
1632
+ return text.toLocaleLowerCase().includes(query);
1633
+ }));
1952
1634
  };
1953
1635
  var sortDataTableRows = (rows, columns, sorting) => {
1954
1636
  const byId = new Map(columns.map((column) => [column.id, column]));
@@ -1959,6 +1641,35 @@ var sortDataTableRows = (rows, columns, sorting) => {
1959
1641
  continue;
1960
1642
  const leftValue = left.row.values.get(sort.id);
1961
1643
  const rightValue = right.row.values.get(sort.id);
1644
+ const colDef = column.colDef;
1645
+ if (!colDef.comparator && (colDef.type === "number" || colDef.type === "boolean")) {
1646
+ const leftScalar = colDef.type === "number" ? Option.getOrUndefined(decodeNumberValue(leftValue)) : Option.getOrUndefined(Option.map(decodeBooleanValue(leftValue), Number));
1647
+ const rightScalar = colDef.type === "number" ? Option.getOrUndefined(decodeNumberValue(rightValue)) : Option.getOrUndefined(Option.map(decodeBooleanValue(rightValue), Number));
1648
+ if (leftScalar === undefined || rightScalar === undefined) {
1649
+ if (leftScalar === undefined && rightScalar === undefined)
1650
+ continue;
1651
+ const nullOrder = colDef.typeOptions?.nulls === "first" ? -1 : 1;
1652
+ return leftScalar === undefined ? nullOrder : -nullOrder;
1653
+ }
1654
+ const comparison2 = leftScalar - rightScalar;
1655
+ if (comparison2 !== 0)
1656
+ return sort.direction === "desc" ? -comparison2 : comparison2;
1657
+ continue;
1658
+ }
1659
+ if (!colDef.comparator && (colDef.type === "date" || colDef.type === "dateTime")) {
1660
+ const leftDate = resolveDate(leftValue, colDef.type);
1661
+ const rightDate = resolveDate(rightValue, colDef.type);
1662
+ if (!leftDate || !rightDate) {
1663
+ if (!leftDate && !rightDate)
1664
+ continue;
1665
+ const nullOrder = colDef.typeOptions?.nulls === "first" ? -1 : 1;
1666
+ return !leftDate ? nullOrder : -nullOrder;
1667
+ }
1668
+ const comparison2 = DateTime.toEpochMillis(leftDate.instant) - DateTime.toEpochMillis(rightDate.instant);
1669
+ if (comparison2 !== 0)
1670
+ return sort.direction === "desc" ? -comparison2 : comparison2;
1671
+ continue;
1672
+ }
1962
1673
  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" });
1963
1674
  if (comparison !== 0)
1964
1675
  return sort.direction === "desc" ? -comparison : comparison;
@@ -2154,9 +1865,76 @@ var renderCell = (row, column) => {
2154
1865
  };
2155
1866
  const CellRenderer = column.colDef.cellRenderer;
2156
1867
  if (CellRenderer)
2157
- return /* @__PURE__ */ jsx17(CellRenderer, {
1868
+ return /* @__PURE__ */ jsx14(CellRenderer, {
2158
1869
  ...params
2159
1870
  });
1871
+ const colDef = column.colDef;
1872
+ if (colDef.type === "number") {
1873
+ if (colDef.valueFormatter)
1874
+ return colDef.valueFormatter(params);
1875
+ const number = Option.getOrUndefined(decodeNumberValue(value));
1876
+ return /* @__PURE__ */ jsx14("span", {
1877
+ className: "block text-left tabular-nums",
1878
+ children: number === undefined ? colDef.typeOptions?.emptyLabel ?? "—" : formatNumberValue(number, colDef.typeOptions)
1879
+ });
1880
+ }
1881
+ if (colDef.type === "boolean") {
1882
+ if (colDef.valueFormatter)
1883
+ return colDef.valueFormatter(params);
1884
+ const boolean = Option.getOrUndefined(decodeBooleanValue(value));
1885
+ if (boolean === undefined)
1886
+ return colDef.typeOptions?.emptyLabel ?? "—";
1887
+ const options = colDef.typeOptions;
1888
+ return /* @__PURE__ */ jsx14("label", {
1889
+ "data-slot": "data-table-boolean-cell",
1890
+ 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"),
1891
+ onClick: (event) => event.stopPropagation(),
1892
+ onPointerDown: (event) => event.stopPropagation(),
1893
+ children: /* @__PURE__ */ jsx14(Checkbox, {
1894
+ "aria-label": options?.getAriaLabel?.(row.data) ?? columnLabel(column),
1895
+ className: "focus-visible:ring-0 focus-visible:outline-none",
1896
+ checked: boolean,
1897
+ readOnly: !options?.onChange,
1898
+ disabled: options?.disabled?.(row.data),
1899
+ onCheckedChange: (checked) => options?.onChange?.({ value: checked, row: row.data })
1900
+ })
1901
+ });
1902
+ }
1903
+ if (colDef.type === "date" || colDef.type === "dateTime") {
1904
+ if (colDef.valueFormatter)
1905
+ return colDef.valueFormatter(params);
1906
+ const date = resolveDate(value, colDef.type);
1907
+ return date ? /* @__PURE__ */ jsx14("time", {
1908
+ dateTime: dateIsoValue(date),
1909
+ children: formatDateValue(date, colDef)
1910
+ }) : colDef.typeOptions?.emptyLabel ?? "—";
1911
+ }
1912
+ if (colDef.type === "list") {
1913
+ const config = colDef.typeOptions;
1914
+ const itemActions = config.itemActions?.map((action) => ({
1915
+ ...action,
1916
+ onClick: (item) => action.onClick({ item, row: row.data }),
1917
+ visible: (item) => action.visible?.({ item, row: row.data }) ?? true,
1918
+ disabled: (item) => action.disabled?.({ item, row: row.data }) ?? false
1919
+ }));
1920
+ if (config.getOptions) {
1921
+ return /* @__PURE__ */ jsx14(DataTableListCell, {
1922
+ ...config,
1923
+ itemActions,
1924
+ items: config.getItems(row.data),
1925
+ options: config.getOptions(row.data),
1926
+ totalCount: config.getTotalCount?.(row.data),
1927
+ onAdd: config.onAdd ? (value2) => config.onAdd?.({ value: value2, row: row.data }) : undefined,
1928
+ onRemove: config.onRemove ? (value2) => config.onRemove?.({ value: value2, row: row.data }) : undefined
1929
+ });
1930
+ }
1931
+ return /* @__PURE__ */ jsx14(DataTableListCell, {
1932
+ ...config,
1933
+ itemActions,
1934
+ items: config.getItems(row.data),
1935
+ totalCount: config.getTotalCount?.(row.data)
1936
+ });
1937
+ }
2160
1938
  return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : String(value));
2161
1939
  };
2162
1940
  var nodeText = (node) => {
@@ -2200,33 +1978,33 @@ var DataTableRowActions = ({
2200
1978
  const visible = actions.filter((action) => !action.visible || action.visible(row));
2201
1979
  if (!visible.length)
2202
1980
  return null;
2203
- return /* @__PURE__ */ jsxs9(DropdownMenu, {
1981
+ return /* @__PURE__ */ jsxs8(DropdownMenu, {
2204
1982
  children: [
2205
- /* @__PURE__ */ jsx17(DropdownMenuTrigger, {
1983
+ /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
2206
1984
  onClick: (event) => event.stopPropagation(),
2207
- render: /* @__PURE__ */ jsxs9(Button, {
1985
+ render: /* @__PURE__ */ jsxs8(Button, {
2208
1986
  className: "size-8 focus-visible:ring-inset [&_svg:not([class*='size-'])]:size-4",
2209
1987
  size: "icon",
2210
1988
  variant: "ghost",
2211
1989
  children: [
2212
- /* @__PURE__ */ jsx17("span", {
1990
+ /* @__PURE__ */ jsx14("span", {
2213
1991
  className: "sr-only",
2214
1992
  children: title
2215
1993
  }),
2216
- /* @__PURE__ */ jsx17(MoreHorizontal, {})
1994
+ /* @__PURE__ */ jsx14(MoreHorizontal, {})
2217
1995
  ]
2218
1996
  })
2219
1997
  }),
2220
- /* @__PURE__ */ jsx17(DropdownMenuContent, {
1998
+ /* @__PURE__ */ jsx14(DropdownMenuContent, {
2221
1999
  align: "end",
2222
2000
  className: "w-max",
2223
- children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
2001
+ children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
2224
2002
  children: [
2225
- /* @__PURE__ */ jsx17(DropdownMenuLabel, {
2003
+ /* @__PURE__ */ jsx14(DropdownMenuLabel, {
2226
2004
  children: title
2227
2005
  }),
2228
- /* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
2229
- visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2006
+ /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}),
2007
+ visible.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
2230
2008
  onClick: (event) => {
2231
2009
  event.stopPropagation();
2232
2010
  action.onClick(row);
@@ -2263,7 +2041,7 @@ var DataTableRowActionMenu = ({
2263
2041
  reorderActions.push({
2264
2042
  id: "data-table-move-up",
2265
2043
  name: store.config.labels.moveUp,
2266
- icon: /* @__PURE__ */ jsx17(ArrowUp, {}),
2044
+ icon: /* @__PURE__ */ jsx14(ArrowUp, {}),
2267
2045
  onClick: () => move(rowIndex - 1)
2268
2046
  });
2269
2047
  }
@@ -2271,12 +2049,12 @@ var DataTableRowActionMenu = ({
2271
2049
  reorderActions.push({
2272
2050
  id: "data-table-move-down",
2273
2051
  name: store.config.labels.moveDown,
2274
- icon: /* @__PURE__ */ jsx17(ArrowDown, {}),
2052
+ icon: /* @__PURE__ */ jsx14(ArrowDown, {}),
2275
2053
  onClick: () => move(rowIndex + 1)
2276
2054
  });
2277
2055
  }
2278
2056
  }
2279
- return /* @__PURE__ */ jsx17(DataTableRowActions, {
2057
+ return /* @__PURE__ */ jsx14(DataTableRowActions, {
2280
2058
  actions: [...reorderActions, ...rowActions ? rowActions.items : []],
2281
2059
  row: row.data,
2282
2060
  title: rowActions?.label ?? store.config.labels.actions
@@ -2297,16 +2075,16 @@ var DataTableToolbar = ({
2297
2075
  const update = (next) => changeState(setStore, next);
2298
2076
  const visibleBulkActions = bulkActions ? bulkActions.items.filter((action) => !action.visible || action.visible(selectedRows)) : [];
2299
2077
  const exportRows = features.export && features.export.scope === "filteredRows" ? model.filteredRows : model.pageRows;
2300
- return /* @__PURE__ */ jsxs9("div", {
2078
+ return /* @__PURE__ */ jsxs8("div", {
2301
2079
  className: "flex flex-col gap-2 pb-4",
2302
2080
  children: [
2303
- features.search !== false ? /* @__PURE__ */ jsxs9("div", {
2081
+ features.search !== false ? /* @__PURE__ */ jsxs8("div", {
2304
2082
  className: "relative min-w-0",
2305
2083
  children: [
2306
- /* @__PURE__ */ jsx17(Search, {
2084
+ /* @__PURE__ */ jsx14(Search, {
2307
2085
  className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
2308
2086
  }),
2309
- /* @__PURE__ */ jsx17(Input, {
2087
+ /* @__PURE__ */ jsx14(Input, {
2310
2088
  className: "px-9",
2311
2089
  onChange: (event) => update((state) => ({
2312
2090
  ...state,
@@ -2316,7 +2094,7 @@ var DataTableToolbar = ({
2316
2094
  placeholder: labels2.filter,
2317
2095
  value: store.state.globalFilter ?? ""
2318
2096
  }),
2319
- store.state.globalFilter ? /* @__PURE__ */ jsx17(Button, {
2097
+ store.state.globalFilter ? /* @__PURE__ */ jsx14(Button, {
2320
2098
  "aria-label": labels2.filter,
2321
2099
  className: "absolute top-1/2 right-1 size-7 -translate-y-1/2",
2322
2100
  onClick: () => update((state) => ({
@@ -2326,38 +2104,38 @@ var DataTableToolbar = ({
2326
2104
  })),
2327
2105
  size: "icon",
2328
2106
  variant: "ghost",
2329
- children: /* @__PURE__ */ jsx17(X2, {})
2107
+ children: /* @__PURE__ */ jsx14(X, {})
2330
2108
  }) : null
2331
2109
  ]
2332
2110
  }) : null,
2333
- /* @__PURE__ */ jsx17("div", {
2111
+ /* @__PURE__ */ jsx14("div", {
2334
2112
  className: "-m-1 flex overflow-x-auto p-1",
2335
- children: /* @__PURE__ */ jsxs9(Menubar, {
2113
+ children: /* @__PURE__ */ jsxs8(Menubar, {
2336
2114
  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",
2337
2115
  children: [
2338
- visibleBulkActions.length ? /* @__PURE__ */ jsxs9(MenubarMenu, {
2116
+ visibleBulkActions.length ? /* @__PURE__ */ jsxs8(MenubarMenu, {
2339
2117
  children: [
2340
- /* @__PURE__ */ jsxs9(MenubarTrigger, {
2118
+ /* @__PURE__ */ jsxs8(MenubarTrigger, {
2341
2119
  className: "bg-primary text-primary-foreground hover:bg-primary/90 aria-expanded:bg-primary/90",
2342
2120
  children: [
2343
2121
  labels2.selected,
2344
- /* @__PURE__ */ jsx17(Badge, {
2122
+ /* @__PURE__ */ jsx14(Badge, {
2345
2123
  variant: "secondary",
2346
2124
  children: selectedRows.length
2347
2125
  }),
2348
- /* @__PURE__ */ jsx17(ChevronDown, {})
2126
+ /* @__PURE__ */ jsx14(ChevronDown, {})
2349
2127
  ]
2350
2128
  }),
2351
- /* @__PURE__ */ jsx17(MenubarContent, {
2129
+ /* @__PURE__ */ jsx14(MenubarContent, {
2352
2130
  align: "end",
2353
2131
  className: "w-max",
2354
- children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2132
+ children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2355
2133
  children: [
2356
- /* @__PURE__ */ jsx17(MenubarLabel, {
2134
+ /* @__PURE__ */ jsx14(MenubarLabel, {
2357
2135
  children: bulkActions && bulkActions.label ? bulkActions.label : labels2.actions
2358
2136
  }),
2359
- /* @__PURE__ */ jsx17(MenubarSeparator, {}),
2360
- visibleBulkActions.map((action) => /* @__PURE__ */ jsxs9(MenubarItem, {
2137
+ /* @__PURE__ */ jsx14(MenubarSeparator, {}),
2138
+ visibleBulkActions.map((action) => /* @__PURE__ */ jsxs8(MenubarItem, {
2361
2139
  onClick: () => action.onClick(selectedRows),
2362
2140
  variant: action.variant,
2363
2141
  children: [
@@ -2370,27 +2148,27 @@ var DataTableToolbar = ({
2370
2148
  })
2371
2149
  ]
2372
2150
  }) : null,
2373
- grouping ? /* @__PURE__ */ jsxs9(MenubarMenu, {
2151
+ grouping ? /* @__PURE__ */ jsxs8(MenubarMenu, {
2374
2152
  children: [
2375
- /* @__PURE__ */ jsxs9(MenubarTrigger, {
2153
+ /* @__PURE__ */ jsxs8(MenubarTrigger, {
2376
2154
  "aria-label": labels2.groupBy,
2377
2155
  children: [
2378
- /* @__PURE__ */ jsx17(Rows3, {}),
2379
- /* @__PURE__ */ jsx17("span", {
2156
+ /* @__PURE__ */ jsx14(Rows3, {}),
2157
+ /* @__PURE__ */ jsx14("span", {
2380
2158
  className: "hidden sm:inline",
2381
2159
  children: labels2.groupBy
2382
2160
  })
2383
2161
  ]
2384
2162
  }),
2385
- /* @__PURE__ */ jsx17(MenubarContent, {
2163
+ /* @__PURE__ */ jsx14(MenubarContent, {
2386
2164
  align: "end",
2387
- children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2165
+ children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2388
2166
  children: [
2389
- /* @__PURE__ */ jsx17(MenubarLabel, {
2167
+ /* @__PURE__ */ jsx14(MenubarLabel, {
2390
2168
  children: labels2.groupBy
2391
2169
  }),
2392
- /* @__PURE__ */ jsx17(MenubarSeparator, {}),
2393
- grouping.fields.map((field) => /* @__PURE__ */ jsx17(MenubarCheckboxItem, {
2170
+ /* @__PURE__ */ jsx14(MenubarSeparator, {}),
2171
+ grouping.fields.map((field) => /* @__PURE__ */ jsx14(MenubarCheckboxItem, {
2394
2172
  checked: store.state.grouping.includes(field.id),
2395
2173
  onCheckedChange: (checked) => update((state) => ({
2396
2174
  ...state,
@@ -2403,63 +2181,63 @@ var DataTableToolbar = ({
2403
2181
  })
2404
2182
  ]
2405
2183
  }) : null,
2406
- features.sorting !== false ? /* @__PURE__ */ jsx17(SortMenu, {
2184
+ features.sorting !== false ? /* @__PURE__ */ jsx14(SortMenu, {
2407
2185
  tableAtom
2408
2186
  }) : null,
2409
- features.gallery ? /* @__PURE__ */ jsx17(ViewMenu, {
2187
+ features.gallery ? /* @__PURE__ */ jsx14(ViewMenu, {
2410
2188
  tableAtom
2411
2189
  }) : null,
2412
- features.columnVisibility !== false ? /* @__PURE__ */ jsx17(ColumnMenu, {
2190
+ features.columnVisibility !== false ? /* @__PURE__ */ jsx14(ColumnMenu, {
2413
2191
  tableAtom
2414
2192
  }) : null,
2415
- features.refresh ? /* @__PURE__ */ jsx17(MenubarMenu, {
2416
- children: /* @__PURE__ */ jsxs9(MenubarTrigger, {
2193
+ features.refresh ? /* @__PURE__ */ jsx14(MenubarMenu, {
2194
+ children: /* @__PURE__ */ jsxs8(MenubarTrigger, {
2417
2195
  "aria-label": labels2.refresh,
2418
2196
  onClick: features.refresh,
2419
2197
  children: [
2420
- /* @__PURE__ */ jsx17(RefreshCw, {}),
2421
- /* @__PURE__ */ jsx17("span", {
2198
+ /* @__PURE__ */ jsx14(RefreshCw, {}),
2199
+ /* @__PURE__ */ jsx14("span", {
2422
2200
  className: "hidden sm:inline",
2423
2201
  children: labels2.refresh
2424
2202
  })
2425
2203
  ]
2426
2204
  })
2427
2205
  }) : null,
2428
- features.export ? /* @__PURE__ */ jsxs9(MenubarMenu, {
2206
+ features.export ? /* @__PURE__ */ jsxs8(MenubarMenu, {
2429
2207
  children: [
2430
- /* @__PURE__ */ jsxs9(MenubarTrigger, {
2208
+ /* @__PURE__ */ jsxs8(MenubarTrigger, {
2431
2209
  "aria-label": labels2.export,
2432
2210
  disabled: !exportRows.length,
2433
2211
  children: [
2434
- /* @__PURE__ */ jsx17(Download, {}),
2435
- /* @__PURE__ */ jsx17("span", {
2212
+ /* @__PURE__ */ jsx14(Download, {}),
2213
+ /* @__PURE__ */ jsx14("span", {
2436
2214
  className: "hidden sm:inline",
2437
2215
  children: labels2.export
2438
2216
  })
2439
2217
  ]
2440
2218
  }),
2441
- /* @__PURE__ */ jsx17(MenubarContent, {
2219
+ /* @__PURE__ */ jsx14(MenubarContent, {
2442
2220
  align: "end",
2443
- children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2221
+ children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2444
2222
  children: [
2445
- /* @__PURE__ */ jsx17(MenubarLabel, {
2223
+ /* @__PURE__ */ jsx14(MenubarLabel, {
2446
2224
  children: labels2.export
2447
2225
  }),
2448
- /* @__PURE__ */ jsx17(MenubarSeparator, {}),
2449
- /* @__PURE__ */ jsxs9(MenubarItem, {
2450
- onClick: () => downloadCsv(model.visibleColumns.map(columnLabel), exportRows.map((row) => model.visibleColumns.map((column) => String(row.values.get(column.id) ?? ""))), features.export ? features.export.baseName : "table"),
2226
+ /* @__PURE__ */ jsx14(MenubarSeparator, {}),
2227
+ /* @__PURE__ */ jsxs8(MenubarItem, {
2228
+ onClick: () => downloadCsv(model.visibleColumns.map(columnLabel), exportRows.map((row) => model.visibleColumns.map((column) => String(getDataTableExportValue(row, column) ?? ""))), features.export ? features.export.baseName : "table"),
2451
2229
  children: [
2452
- /* @__PURE__ */ jsx17(FileText, {}),
2230
+ /* @__PURE__ */ jsx14(FileText, {}),
2453
2231
  labels2.exportCsv
2454
2232
  ]
2455
2233
  }),
2456
- /* @__PURE__ */ jsxs9(MenubarItem, {
2234
+ /* @__PURE__ */ jsxs8(MenubarItem, {
2457
2235
  onClick: () => downloadJson(exportRows.map((row) => Object.fromEntries(model.visibleColumns.map((column) => [
2458
2236
  column.id,
2459
- row.values.get(column.id)
2237
+ getDataTableExportValue(row, column)
2460
2238
  ]))), features.export ? features.export.baseName : "table"),
2461
2239
  children: [
2462
- /* @__PURE__ */ jsx17(FileJson, {}),
2240
+ /* @__PURE__ */ jsx14(FileJson, {}),
2463
2241
  labels2.exportJson
2464
2242
  ]
2465
2243
  })
@@ -2487,59 +2265,59 @@ var SortMenu = ({
2487
2265
  sort: [{ id, direction }],
2488
2266
  page: 0
2489
2267
  }));
2490
- return /* @__PURE__ */ jsxs9(MenubarMenu, {
2268
+ return /* @__PURE__ */ jsxs8(MenubarMenu, {
2491
2269
  children: [
2492
- /* @__PURE__ */ jsxs9(MenubarTrigger, {
2270
+ /* @__PURE__ */ jsxs8(MenubarTrigger, {
2493
2271
  "aria-label": store.config.labels.sortBy,
2494
2272
  children: [
2495
- current ? current.direction === "desc" ? /* @__PURE__ */ jsx17(ArrowDown, {}) : /* @__PURE__ */ jsx17(ArrowUp, {}) : /* @__PURE__ */ jsx17(ChevronsUpDown2, {}),
2496
- /* @__PURE__ */ jsx17("span", {
2273
+ current ? current.direction === "desc" ? /* @__PURE__ */ jsx14(ArrowDown, {}) : /* @__PURE__ */ jsx14(ArrowUp, {}) : /* @__PURE__ */ jsx14(ChevronsUpDown, {}),
2274
+ /* @__PURE__ */ jsx14("span", {
2497
2275
  className: "hidden sm:inline",
2498
2276
  children: store.config.labels.sortBy
2499
2277
  })
2500
2278
  ]
2501
2279
  }),
2502
- /* @__PURE__ */ jsx17(MenubarContent, {
2280
+ /* @__PURE__ */ jsx14(MenubarContent, {
2503
2281
  align: "end",
2504
2282
  className: "w-52",
2505
2283
  children: columns.map((column) => {
2506
2284
  const sortState = store.state.sort?.find(({ id }) => id === column.id);
2507
- return /* @__PURE__ */ jsxs9(MenubarSub, {
2285
+ return /* @__PURE__ */ jsxs8(MenubarSub, {
2508
2286
  children: [
2509
- /* @__PURE__ */ jsxs9(MenubarSubTrigger, {
2287
+ /* @__PURE__ */ jsxs8(MenubarSubTrigger, {
2510
2288
  children: [
2511
- sortState ? sortState.direction === "desc" ? /* @__PURE__ */ jsx17(ArrowDown, {}) : /* @__PURE__ */ jsx17(ArrowUp, {}) : null,
2289
+ sortState ? sortState.direction === "desc" ? /* @__PURE__ */ jsx14(ArrowDown, {}) : /* @__PURE__ */ jsx14(ArrowUp, {}) : null,
2512
2290
  columnLabel(column)
2513
2291
  ]
2514
2292
  }),
2515
- /* @__PURE__ */ jsxs9(MenubarSubContent, {
2293
+ /* @__PURE__ */ jsxs8(MenubarSubContent, {
2516
2294
  children: [
2517
- /* @__PURE__ */ jsxs9(MenubarItem, {
2295
+ /* @__PURE__ */ jsxs8(MenubarItem, {
2518
2296
  onClick: () => sort(column.id, "asc"),
2519
2297
  children: [
2520
- /* @__PURE__ */ jsx17(ArrowUp, {}),
2298
+ /* @__PURE__ */ jsx14(ArrowUp, {}),
2521
2299
  " ",
2522
2300
  store.config.labels.sortAsc
2523
2301
  ]
2524
2302
  }),
2525
- /* @__PURE__ */ jsxs9(MenubarItem, {
2303
+ /* @__PURE__ */ jsxs8(MenubarItem, {
2526
2304
  onClick: () => sort(column.id, "desc"),
2527
2305
  children: [
2528
- /* @__PURE__ */ jsx17(ArrowDown, {}),
2306
+ /* @__PURE__ */ jsx14(ArrowDown, {}),
2529
2307
  " ",
2530
2308
  store.config.labels.sortDesc
2531
2309
  ]
2532
2310
  }),
2533
- sortState ? /* @__PURE__ */ jsxs9(Fragment, {
2311
+ sortState ? /* @__PURE__ */ jsxs8(Fragment, {
2534
2312
  children: [
2535
- /* @__PURE__ */ jsx17(MenubarSeparator, {}),
2536
- /* @__PURE__ */ jsxs9(MenubarItem, {
2313
+ /* @__PURE__ */ jsx14(MenubarSeparator, {}),
2314
+ /* @__PURE__ */ jsxs8(MenubarItem, {
2537
2315
  onClick: () => changeState(setStore, (state) => ({
2538
2316
  ...state,
2539
2317
  sort: state.sort?.filter(({ id }) => id !== column.id)
2540
2318
  })),
2541
2319
  children: [
2542
- /* @__PURE__ */ jsx17(X2, {}),
2320
+ /* @__PURE__ */ jsx14(X, {}),
2543
2321
  " ",
2544
2322
  store.config.labels.sortClear
2545
2323
  ]
@@ -2559,21 +2337,21 @@ var ViewMenu = ({
2559
2337
  tableAtom
2560
2338
  }) => {
2561
2339
  const [store, setStore] = useTableAtom(tableAtom);
2562
- return /* @__PURE__ */ jsxs9(MenubarMenu, {
2340
+ return /* @__PURE__ */ jsxs8(MenubarMenu, {
2563
2341
  children: [
2564
- /* @__PURE__ */ jsxs9(MenubarTrigger, {
2342
+ /* @__PURE__ */ jsxs8(MenubarTrigger, {
2565
2343
  "aria-label": store.config.labels.view,
2566
2344
  children: [
2567
- store.state.view === "gallery" ? /* @__PURE__ */ jsx17(LayoutGrid, {}) : /* @__PURE__ */ jsx17(Rows3, {}),
2568
- /* @__PURE__ */ jsx17("span", {
2345
+ store.state.view === "gallery" ? /* @__PURE__ */ jsx14(LayoutGrid, {}) : /* @__PURE__ */ jsx14(Rows3, {}),
2346
+ /* @__PURE__ */ jsx14("span", {
2569
2347
  className: "hidden sm:inline",
2570
2348
  children: store.config.labels.view
2571
2349
  })
2572
2350
  ]
2573
2351
  }),
2574
- /* @__PURE__ */ jsx17(MenubarContent, {
2352
+ /* @__PURE__ */ jsx14(MenubarContent, {
2575
2353
  align: "end",
2576
- children: /* @__PURE__ */ jsxs9(MenubarRadioGroup, {
2354
+ children: /* @__PURE__ */ jsxs8(MenubarRadioGroup, {
2577
2355
  onValueChange: (view) => {
2578
2356
  if (view === "table" || view === "gallery") {
2579
2357
  changeState(setStore, (state) => ({ ...state, view }));
@@ -2581,18 +2359,18 @@ var ViewMenu = ({
2581
2359
  },
2582
2360
  value: store.state.view,
2583
2361
  children: [
2584
- /* @__PURE__ */ jsxs9(MenubarRadioItem, {
2362
+ /* @__PURE__ */ jsxs8(MenubarRadioItem, {
2585
2363
  value: "table",
2586
2364
  children: [
2587
- /* @__PURE__ */ jsx17(Rows3, {}),
2365
+ /* @__PURE__ */ jsx14(Rows3, {}),
2588
2366
  " ",
2589
2367
  store.config.labels.tableView
2590
2368
  ]
2591
2369
  }),
2592
- /* @__PURE__ */ jsxs9(MenubarRadioItem, {
2370
+ /* @__PURE__ */ jsxs8(MenubarRadioItem, {
2593
2371
  value: "gallery",
2594
2372
  children: [
2595
- /* @__PURE__ */ jsx17(LayoutGrid, {}),
2373
+ /* @__PURE__ */ jsx14(LayoutGrid, {}),
2596
2374
  " ",
2597
2375
  store.config.labels.galleryView
2598
2376
  ]
@@ -2610,27 +2388,27 @@ var ColumnMenu = ({
2610
2388
  const columns = deriveModel(store).columns.filter(({ colDef }) => colDef.hideable !== false);
2611
2389
  if (!columns.length)
2612
2390
  return null;
2613
- return /* @__PURE__ */ jsxs9(MenubarMenu, {
2391
+ return /* @__PURE__ */ jsxs8(MenubarMenu, {
2614
2392
  children: [
2615
- /* @__PURE__ */ jsxs9(MenubarTrigger, {
2393
+ /* @__PURE__ */ jsxs8(MenubarTrigger, {
2616
2394
  "aria-label": store.config.labels.columns,
2617
2395
  children: [
2618
- /* @__PURE__ */ jsx17(Settings2, {}),
2619
- /* @__PURE__ */ jsx17("span", {
2396
+ /* @__PURE__ */ jsx14(Settings2, {}),
2397
+ /* @__PURE__ */ jsx14("span", {
2620
2398
  className: "hidden sm:inline",
2621
2399
  children: store.config.labels.columns
2622
2400
  })
2623
2401
  ]
2624
2402
  }),
2625
- /* @__PURE__ */ jsx17(MenubarContent, {
2403
+ /* @__PURE__ */ jsx14(MenubarContent, {
2626
2404
  align: "end",
2627
- children: /* @__PURE__ */ jsxs9(MenubarGroup, {
2405
+ children: /* @__PURE__ */ jsxs8(MenubarGroup, {
2628
2406
  children: [
2629
- /* @__PURE__ */ jsx17(MenubarLabel, {
2407
+ /* @__PURE__ */ jsx14(MenubarLabel, {
2630
2408
  children: store.config.labels.columns
2631
2409
  }),
2632
- /* @__PURE__ */ jsx17(MenubarSeparator, {}),
2633
- columns.map((column) => /* @__PURE__ */ jsx17(MenubarCheckboxItem, {
2410
+ /* @__PURE__ */ jsx14(MenubarSeparator, {}),
2411
+ columns.map((column) => /* @__PURE__ */ jsx14(MenubarCheckboxItem, {
2634
2412
  checked: store.state.columnVisibility[column.id] !== false,
2635
2413
  onCheckedChange: (visible) => changeState(setStore, (state) => ({
2636
2414
  ...state,
@@ -2652,6 +2430,7 @@ var ResizeHandle = ({
2652
2430
  }) => {
2653
2431
  const [store, setStore] = useTableAtom(tableAtom);
2654
2432
  const columnId = useRequiredId(ColumnIdContext);
2433
+ const resizeRef = useRef(null);
2655
2434
  const column = deriveModel(store).columns.find(({ id }) => id === columnId);
2656
2435
  if (!column || column.colDef.resizable === false)
2657
2436
  return null;
@@ -2663,25 +2442,32 @@ var ResizeHandle = ({
2663
2442
  }
2664
2443
  }));
2665
2444
  const onPointerDown = (event) => {
2445
+ if (event.button !== 0)
2446
+ return;
2666
2447
  event.preventDefault();
2667
2448
  event.currentTarget.setPointerCapture(event.pointerId);
2668
- event.currentTarget.dataset.startX = String(event.clientX);
2669
- event.currentTarget.dataset.startWidth = String(column.width);
2449
+ resizeRef.current = {
2450
+ pointerId: event.pointerId,
2451
+ startX: event.clientX,
2452
+ startWidth: column.width
2453
+ };
2670
2454
  };
2671
2455
  const onPointerMove = (event) => {
2672
- if (!event.currentTarget.hasPointerCapture(event.pointerId))
2456
+ const drag = resizeRef.current;
2457
+ if (!drag || drag.pointerId !== event.pointerId)
2673
2458
  return;
2674
- const startX = Number(event.currentTarget.dataset.startX);
2675
- const startWidth = Number(event.currentTarget.dataset.startWidth);
2676
- resize(startWidth + event.clientX - startX);
2459
+ resize(drag.startWidth + event.clientX - drag.startX);
2677
2460
  };
2678
- return /* @__PURE__ */ jsx17("button", {
2461
+ const reset = () => {
2462
+ resizeRef.current = null;
2463
+ };
2464
+ return /* @__PURE__ */ jsx14("button", {
2679
2465
  "aria-label": store.config.labels.resizeColumn(columnLabel(column)),
2680
2466
  "aria-orientation": "vertical",
2681
2467
  "aria-valuemax": column.colDef.maxWidth ?? DEFAULT_MAX_WIDTH,
2682
2468
  "aria-valuemin": column.colDef.minWidth ?? DEFAULT_MIN_WIDTH,
2683
2469
  "aria-valuenow": column.width,
2684
- className: "hover:bg-primary/60 absolute inset-y-0 right-0 z-10 w-1 cursor-col-resize touch-none",
2470
+ className: "after:bg-border hover:after:bg-primary/60 focus-visible:after:bg-ring absolute inset-y-0 right-0 z-10 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-3 after:right-0 after:w-px hover:after:w-0.5 focus-visible:after:w-0.5",
2685
2471
  onDoubleClick: () => resize(column.colDef.width ?? DEFAULT_WIDTH),
2686
2472
  onKeyDown: (event) => {
2687
2473
  const delta = event.key === "ArrowLeft" ? -8 : event.key === "ArrowRight" ? 8 : 0;
@@ -2692,6 +2478,9 @@ var ResizeHandle = ({
2692
2478
  },
2693
2479
  onPointerDown,
2694
2480
  onPointerMove,
2481
+ onPointerUp: reset,
2482
+ onPointerCancel: reset,
2483
+ onLostPointerCapture: reset,
2695
2484
  role: "separator",
2696
2485
  type: "button"
2697
2486
  });
@@ -2701,7 +2490,7 @@ var DragHandle = ({
2701
2490
  }) => {
2702
2491
  const [store, setStore] = useTableAtom(tableAtom);
2703
2492
  const rowId = useRequiredId(RowIdContext);
2704
- const dragRef = useRef2(null);
2493
+ const dragRef = useRef(null);
2705
2494
  const [overlay, setOverlay] = useState(null);
2706
2495
  const reset = (element) => {
2707
2496
  clearDragPresentation(element.closest("[data-table-root]"));
@@ -2794,9 +2583,9 @@ var DragHandle = ({
2794
2583
  reordering.onReorder(reorderDataTableRows(model.rows, rowId, target.id));
2795
2584
  }
2796
2585
  };
2797
- return /* @__PURE__ */ jsxs9(Fragment, {
2586
+ return /* @__PURE__ */ jsxs8(Fragment, {
2798
2587
  children: [
2799
- /* @__PURE__ */ jsx17(Button, {
2588
+ /* @__PURE__ */ jsx14(Button, {
2800
2589
  "aria-label": store.config.features.reordering && store.config.features.reordering.handleLabel ? store.config.features.reordering.handleLabel : store.config.labels.reorder,
2801
2590
  className: "size-8 cursor-grab touch-none active:cursor-grabbing",
2802
2591
  onClick: (event) => event.stopPropagation(),
@@ -2814,9 +2603,9 @@ var DragHandle = ({
2814
2603
  onPointerUp: finish,
2815
2604
  size: "icon",
2816
2605
  variant: "ghost",
2817
- children: /* @__PURE__ */ jsx17(GripVertical, {})
2606
+ children: /* @__PURE__ */ jsx14(GripVertical, {})
2818
2607
  }),
2819
- overlay ? createPortal(/* @__PURE__ */ jsx17("div", {
2608
+ overlay ? createPortal(/* @__PURE__ */ jsx14("div", {
2820
2609
  "aria-hidden": "true",
2821
2610
  className: "bg-background pointer-events-none fixed z-[100] rounded-md border px-3 py-2 text-sm shadow-lg",
2822
2611
  style: { left: overlay.x + 12, top: overlay.y + 12 },
@@ -2846,7 +2635,7 @@ var TableDataRow = ({
2846
2635
  const selection = store.config.features.selection;
2847
2636
  const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
2848
2637
  const draggable = canDragRows(store);
2849
- return /* @__PURE__ */ jsxs9(TableRow, {
2638
+ return /* @__PURE__ */ jsxs8(TableRow, {
2850
2639
  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"),
2851
2640
  "data-state": store.state.rowSelection[row.id] && "selected",
2852
2641
  "data-table-row": row.id,
@@ -2859,36 +2648,36 @@ var TableDataRow = ({
2859
2648
  },
2860
2649
  tabIndex: store.config.onRowClicked ? 0 : undefined,
2861
2650
  children: [
2862
- selection ? /* @__PURE__ */ jsx17(TableCell, {
2651
+ selection ? /* @__PURE__ */ jsx14(TableCell, {
2863
2652
  className: "w-10 pr-0",
2864
2653
  onClick: (event) => event.stopPropagation(),
2865
- children: /* @__PURE__ */ jsx17(Checkbox, {
2654
+ children: /* @__PURE__ */ jsx14(Checkbox, {
2866
2655
  "aria-label": store.config.labels.selectRow,
2867
2656
  checked: !!store.state.rowSelection[row.id],
2868
2657
  disabled: !selectable,
2869
2658
  onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked)
2870
2659
  })
2871
2660
  }) : null,
2872
- draggable ? /* @__PURE__ */ jsx17(TableCell, {
2661
+ draggable ? /* @__PURE__ */ jsx14(TableCell, {
2873
2662
  className: "w-10 pr-0",
2874
- children: /* @__PURE__ */ jsx17(DragHandle, {
2663
+ children: /* @__PURE__ */ jsx14(DragHandle, {
2875
2664
  tableAtom
2876
2665
  })
2877
2666
  }) : null,
2878
- model.visibleColumns.map((column) => /* @__PURE__ */ jsx17(TableCell, {
2879
- className: cn("min-w-24 overflow-hidden has-[[data-slot=data-table-relationship-cell]]:relative has-[[data-slot=data-table-relationship-cell]]:p-0", column.colDef.truncate ? "whitespace-nowrap" : "whitespace-normal"),
2667
+ model.visibleColumns.map((column) => /* @__PURE__ */ jsx14(TableCell, {
2668
+ 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"),
2880
2669
  style: { width: column.width },
2881
- children: /* @__PURE__ */ jsx17("div", {
2670
+ children: /* @__PURE__ */ jsx14("div", {
2882
2671
  className: cn("min-w-0", column.colDef.truncate && "truncate"),
2883
2672
  children: renderCell(row, column)
2884
2673
  })
2885
2674
  }, column.id)),
2886
- hasRowActionMenu(store) ? /* @__PURE__ */ jsx17(TableCell, {
2675
+ hasRowActionMenu(store) ? /* @__PURE__ */ jsx14(TableCell, {
2887
2676
  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))]",
2888
2677
  onClick: (event) => event.stopPropagation(),
2889
- children: /* @__PURE__ */ jsx17("div", {
2678
+ children: /* @__PURE__ */ jsx14("div", {
2890
2679
  className: "flex h-16 items-center justify-center",
2891
- children: /* @__PURE__ */ jsx17(DataTableRowActionMenu, {
2680
+ children: /* @__PURE__ */ jsx14(DataTableRowActionMenu, {
2892
2681
  tableAtom
2893
2682
  })
2894
2683
  })
@@ -2904,26 +2693,26 @@ var GroupActions = ({
2904
2693
  const visible = actions?.filter((action) => !action.visible || action.visible(groupId));
2905
2694
  if (!visible?.length)
2906
2695
  return null;
2907
- return /* @__PURE__ */ jsxs9(DropdownMenu, {
2696
+ return /* @__PURE__ */ jsxs8(DropdownMenu, {
2908
2697
  children: [
2909
- /* @__PURE__ */ jsx17(DropdownMenuTrigger, {
2698
+ /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
2910
2699
  onClick: (event) => event.stopPropagation(),
2911
- render: /* @__PURE__ */ jsxs9(Button, {
2700
+ render: /* @__PURE__ */ jsxs8(Button, {
2912
2701
  size: "icon",
2913
2702
  variant: "ghost",
2914
2703
  children: [
2915
- /* @__PURE__ */ jsx17("span", {
2704
+ /* @__PURE__ */ jsx14("span", {
2916
2705
  className: "sr-only",
2917
2706
  children: title
2918
2707
  }),
2919
- /* @__PURE__ */ jsx17(MoreHorizontal, {})
2708
+ /* @__PURE__ */ jsx14(MoreHorizontal, {})
2920
2709
  ]
2921
2710
  })
2922
2711
  }),
2923
- /* @__PURE__ */ jsx17(DropdownMenuContent, {
2712
+ /* @__PURE__ */ jsx14(DropdownMenuContent, {
2924
2713
  align: "end",
2925
- children: /* @__PURE__ */ jsx17(DropdownMenuGroup, {
2926
- children: visible.map((action) => /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2714
+ children: /* @__PURE__ */ jsx14(DropdownMenuGroup, {
2715
+ children: visible.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
2927
2716
  onClick: () => action.onClick(groupId),
2928
2717
  variant: action.variant,
2929
2718
  children: [
@@ -2954,40 +2743,40 @@ var GroupedTable = ({
2954
2743
  [section.key]: !collapsed
2955
2744
  }
2956
2745
  }));
2957
- const body = /* @__PURE__ */ jsxs9(TableBody, {
2746
+ const body = /* @__PURE__ */ jsxs8(TableBody, {
2958
2747
  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",
2959
2748
  "data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
2960
2749
  children: [
2961
- /* @__PURE__ */ jsx17(TableRow, {
2750
+ /* @__PURE__ */ jsx14(TableRow, {
2962
2751
  className: "bg-muted/40 hover:bg-accent! cursor-pointer",
2963
2752
  onClick: toggleCollapsed,
2964
- children: /* @__PURE__ */ jsx17(TableCell, {
2753
+ children: /* @__PURE__ */ jsx14(TableCell, {
2965
2754
  colSpan: model.visibleColumns.length + extra,
2966
- children: /* @__PURE__ */ jsxs9("div", {
2755
+ children: /* @__PURE__ */ jsxs8("div", {
2967
2756
  className: "flex items-center gap-2",
2968
2757
  style: { paddingLeft: section.depth * 20 },
2969
2758
  children: [
2970
- /* @__PURE__ */ jsxs9("button", {
2759
+ /* @__PURE__ */ jsxs8("button", {
2971
2760
  "aria-expanded": !collapsed,
2972
2761
  className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
2973
2762
  type: "button",
2974
2763
  children: [
2975
- collapsed ? /* @__PURE__ */ jsx17(ChevronRight2, {
2764
+ collapsed ? /* @__PURE__ */ jsx14(ChevronRight2, {
2976
2765
  className: "size-4"
2977
- }) : /* @__PURE__ */ jsx17(ChevronDown, {
2766
+ }) : /* @__PURE__ */ jsx14(ChevronDown, {
2978
2767
  className: "size-4"
2979
2768
  }),
2980
- /* @__PURE__ */ jsx17("span", {
2769
+ /* @__PURE__ */ jsx14("span", {
2981
2770
  className: "flex-1",
2982
2771
  children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
2983
2772
  })
2984
2773
  ]
2985
2774
  }),
2986
- /* @__PURE__ */ jsx17(Badge, {
2775
+ /* @__PURE__ */ jsx14(Badge, {
2987
2776
  variant: "secondary",
2988
2777
  children: section.rows.length
2989
2778
  }),
2990
- /* @__PURE__ */ jsx17(GroupActions, {
2779
+ /* @__PURE__ */ jsx14(GroupActions, {
2991
2780
  actions: section.field.actions,
2992
2781
  groupId: section.groupId,
2993
2782
  title: section.field.actionsLabel ?? store.config.labels.actions
@@ -2996,14 +2785,14 @@ var GroupedTable = ({
2996
2785
  })
2997
2786
  })
2998
2787
  }),
2999
- !collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */ jsx17(RowIdContext.Provider, {
2788
+ !collapsed && !section.children.length ? section.rows.length ? section.rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3000
2789
  value: row.id,
3001
- children: /* @__PURE__ */ jsx17(TableDataRow, {
2790
+ children: /* @__PURE__ */ jsx14(TableDataRow, {
3002
2791
  tableAtom
3003
2792
  })
3004
2793
  }, `${section.key}:${row.id}`)) : [
3005
- /* @__PURE__ */ jsx17(TableRow, {
3006
- children: /* @__PURE__ */ jsx17(TableCell, {
2794
+ /* @__PURE__ */ jsx14(TableRow, {
2795
+ children: /* @__PURE__ */ jsx14(TableCell, {
3007
2796
  className: "text-muted-foreground h-16",
3008
2797
  colSpan: model.visibleColumns.length + extra,
3009
2798
  children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
@@ -3014,7 +2803,7 @@ var GroupedTable = ({
3014
2803
  }, section.key);
3015
2804
  return !collapsed && section.children.length ? [body, renderSections(section.children)] : [body];
3016
2805
  });
3017
- return /* @__PURE__ */ jsx17(Fragment, {
2806
+ return /* @__PURE__ */ jsx14(Fragment, {
3018
2807
  children: renderSections(sections)
3019
2808
  });
3020
2809
  };
@@ -3037,66 +2826,65 @@ var ColumnHeaderMenu = ({
3037
2826
  }));
3038
2827
  const label = columnLabel(column);
3039
2828
  if (!sortingEnabled && !hidingEnabled) {
3040
- return /* @__PURE__ */ jsx17("div", {
3041
- className: "truncate",
2829
+ return /* @__PURE__ */ jsx14("div", {
2830
+ className: "truncate px-2",
3042
2831
  children: column.colDef.headerName
3043
2832
  });
3044
2833
  }
3045
- return /* @__PURE__ */ jsxs9(DropdownMenu, {
2834
+ return /* @__PURE__ */ jsxs8(DropdownMenu, {
3046
2835
  children: [
3047
- /* @__PURE__ */ jsx17(DropdownMenuTrigger, {
3048
- render: /* @__PURE__ */ jsxs9(Button, {
2836
+ /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
2837
+ render: /* @__PURE__ */ jsxs8(Button, {
3049
2838
  "aria-label": label,
3050
- className: "h-8 max-w-full justify-start px-2",
3051
- size: "sm",
2839
+ className: "absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pr-4 focus-visible:ring-inset",
3052
2840
  variant: "ghost",
3053
2841
  children: [
3054
- /* @__PURE__ */ jsx17("span", {
2842
+ /* @__PURE__ */ jsx14("span", {
3055
2843
  className: "truncate",
3056
2844
  children: column.colDef.headerName
3057
2845
  }),
3058
- sort ? sort.direction === "desc" ? /* @__PURE__ */ jsx17(ArrowDown, {}) : /* @__PURE__ */ jsx17(ArrowUp, {}) : sortingEnabled ? /* @__PURE__ */ jsx17(ChevronsUpDown2, {}) : null
2846
+ sort ? sort.direction === "desc" ? /* @__PURE__ */ jsx14(ArrowDown, {}) : /* @__PURE__ */ jsx14(ArrowUp, {}) : null
3059
2847
  ]
3060
2848
  })
3061
2849
  }),
3062
- /* @__PURE__ */ jsx17(DropdownMenuContent, {
2850
+ /* @__PURE__ */ jsx14(DropdownMenuContent, {
3063
2851
  align: "start",
3064
2852
  className: "w-48",
3065
- children: /* @__PURE__ */ jsxs9(DropdownMenuGroup, {
2853
+ children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
3066
2854
  children: [
3067
- sortingEnabled ? /* @__PURE__ */ jsxs9(Fragment, {
2855
+ sortingEnabled ? /* @__PURE__ */ jsxs8(Fragment, {
3068
2856
  children: [
3069
- /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2857
+ /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3070
2858
  onClick: () => setSort("asc"),
3071
2859
  children: [
3072
- /* @__PURE__ */ jsx17(ArrowUp, {}),
2860
+ /* @__PURE__ */ jsx14(ArrowUp, {}),
3073
2861
  " ",
3074
2862
  store.config.labels.sortAsc
3075
2863
  ]
3076
2864
  }),
3077
- /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2865
+ /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3078
2866
  onClick: () => setSort("desc"),
3079
2867
  children: [
3080
- /* @__PURE__ */ jsx17(ArrowDown, {}),
2868
+ /* @__PURE__ */ jsx14(ArrowDown, {}),
3081
2869
  " ",
3082
2870
  store.config.labels.sortDesc
3083
2871
  ]
3084
2872
  }),
3085
- sort ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2873
+ sort ? /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3086
2874
  onClick: () => update((state) => ({
3087
2875
  ...state,
3088
2876
  sort: state.sort?.filter(({ id }) => id !== column.id)
3089
2877
  })),
3090
2878
  children: [
3091
- /* @__PURE__ */ jsx17(X2, {}),
2879
+ /* @__PURE__ */ jsx14(X, {}),
3092
2880
  " ",
3093
2881
  store.config.labels.sortClear
3094
2882
  ]
3095
2883
  }) : null
3096
2884
  ]
3097
2885
  }) : null,
3098
- sortingEnabled && hidingEnabled ? /* @__PURE__ */ jsx17(DropdownMenuSeparator, {}) : null,
3099
- hidingEnabled ? /* @__PURE__ */ jsxs9(DropdownMenuItem, {
2886
+ sortingEnabled && hidingEnabled ? /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}) : null,
2887
+ hidingEnabled ? /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3100
2888
  onClick: () => update((state) => ({
3101
2889
  ...state,
3102
2890
  columnVisibility: {
@@ -3105,7 +2893,7 @@ var ColumnHeaderMenu = ({
3105
2893
  }
3106
2894
  })),
3107
2895
  children: [
3108
- /* @__PURE__ */ jsx17(EyeOff, {}),
2896
+ /* @__PURE__ */ jsx14(EyeOff, {}),
3109
2897
  " ",
3110
2898
  store.config.labels.hideColumn
3111
2899
  ]
@@ -3127,12 +2915,12 @@ var DataTableHeader = ({
3127
2915
  const selectableRows = getDataTableSelectableRows(model, grouped, selection ? selection.isRowSelectable : undefined);
3128
2916
  const allSelected = selectableRows.length > 0 && selectableRows.every((row) => store.state.rowSelection[row.id]);
3129
2917
  const someSelected = selectableRows.some((row) => store.state.rowSelection[row.id]);
3130
- return /* @__PURE__ */ jsx17(TableHeader, {
3131
- children: /* @__PURE__ */ jsxs9(TableRow, {
2918
+ return /* @__PURE__ */ jsx14(TableHeader, {
2919
+ children: /* @__PURE__ */ jsxs8(TableRow, {
3132
2920
  children: [
3133
- selection ? /* @__PURE__ */ jsx17(TableHead, {
2921
+ selection ? /* @__PURE__ */ jsx14(TableHead, {
3134
2922
  className: "w-10 pr-0",
3135
- children: /* @__PURE__ */ jsx17(Checkbox, {
2923
+ children: /* @__PURE__ */ jsx14(Checkbox, {
3136
2924
  "aria-label": store.config.labels.selectAllRows,
3137
2925
  checked: allSelected,
3138
2926
  indeterminate: someSelected && !allSelected,
@@ -3146,27 +2934,30 @@ var DataTableHeader = ({
3146
2934
  }
3147
2935
  })
3148
2936
  }) : null,
3149
- draggable ? /* @__PURE__ */ jsx17(TableHead, {
2937
+ draggable ? /* @__PURE__ */ jsx14(TableHead, {
3150
2938
  className: "w-10"
3151
2939
  }) : null,
3152
2940
  model.visibleColumns.map((column) => {
3153
- return /* @__PURE__ */ jsx17(TableHead, {
3154
- className: "relative h-12",
2941
+ const direction = store.state.sort?.find(({ id }) => id === column.id)?.direction;
2942
+ return /* @__PURE__ */ jsx14(TableHead, {
2943
+ "aria-sort": direction === "asc" ? "ascending" : direction === "desc" ? "descending" : undefined,
2944
+ className: "relative h-12 p-0",
2945
+ scope: "col",
3155
2946
  style: { width: column.width },
3156
- children: /* @__PURE__ */ jsxs9(ColumnIdContext.Provider, {
2947
+ children: /* @__PURE__ */ jsxs8(ColumnIdContext.Provider, {
3157
2948
  value: column.id,
3158
2949
  children: [
3159
- /* @__PURE__ */ jsx17(ColumnHeaderMenu, {
2950
+ /* @__PURE__ */ jsx14(ColumnHeaderMenu, {
3160
2951
  tableAtom
3161
2952
  }),
3162
- /* @__PURE__ */ jsx17(ResizeHandle, {
2953
+ /* @__PURE__ */ jsx14(ResizeHandle, {
3163
2954
  tableAtom
3164
2955
  })
3165
2956
  ]
3166
2957
  })
3167
2958
  }, column.id);
3168
2959
  }),
3169
- hasRowActionMenu(store) ? /* @__PURE__ */ jsx17(TableHead, {
2960
+ hasRowActionMenu(store) ? /* @__PURE__ */ jsx14(TableHead, {
3170
2961
  className: "w-10"
3171
2962
  }) : null
3172
2963
  ]
@@ -3182,28 +2973,28 @@ var DataTableBody = ({
3182
2973
  const rows = grouped ? model.sortedRows : model.pageRows;
3183
2974
  const colSpan = model.visibleColumns.length + (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0);
3184
2975
  if (grouped && rows.length && !store.config.status.error) {
3185
- return /* @__PURE__ */ jsx17(GroupedTable, {
2976
+ return /* @__PURE__ */ jsx14(GroupedTable, {
3186
2977
  tableAtom
3187
2978
  });
3188
2979
  }
3189
- return /* @__PURE__ */ jsx17(TableBody, {
3190
- children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */ jsx17(TableRow, {
3191
- children: /* @__PURE__ */ jsx17(TableCell, {
2980
+ return /* @__PURE__ */ jsx14(TableBody, {
2981
+ children: store.config.status.error || !rows.length && !store.config.status.loading ? /* @__PURE__ */ jsx14(TableRow, {
2982
+ children: /* @__PURE__ */ jsx14(TableCell, {
3192
2983
  className: "h-24 text-center",
3193
2984
  colSpan: Math.max(colSpan, 1),
3194
2985
  children: store.config.status.error ?? store.config.status.empty ?? store.config.labels.empty
3195
2986
  })
3196
- }) : store.config.status.loading && !rows.length ? /* @__PURE__ */ jsx17(TableRow, {
3197
- children: /* @__PURE__ */ jsx17(TableCell, {
2987
+ }) : store.config.status.loading && !rows.length ? /* @__PURE__ */ jsx14(TableRow, {
2988
+ children: /* @__PURE__ */ jsx14(TableCell, {
3198
2989
  className: "h-24 text-center",
3199
2990
  colSpan: Math.max(colSpan, 1),
3200
- children: /* @__PURE__ */ jsx17(Loading, {
2991
+ children: /* @__PURE__ */ jsx14(Loading, {
3201
2992
  label: store.config.labels.loading
3202
2993
  })
3203
2994
  })
3204
- }) : rows.map((row) => /* @__PURE__ */ jsx17(RowIdContext.Provider, {
2995
+ }) : rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3205
2996
  value: row.id,
3206
- children: /* @__PURE__ */ jsx17(TableDataRow, {
2997
+ children: /* @__PURE__ */ jsx14(TableDataRow, {
3207
2998
  tableAtom
3208
2999
  })
3209
3000
  }, row.id))
@@ -3226,7 +3017,7 @@ var GalleryCard = ({
3226
3017
  const selection = store.config.features.selection;
3227
3018
  const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
3228
3019
  const draggable = canDragRows(store);
3229
- return /* @__PURE__ */ jsx17(Card, {
3020
+ return /* @__PURE__ */ jsx14(Card, {
3230
3021
  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"),
3231
3022
  "data-table-row": row.id,
3232
3023
  onClick: () => store.config.onRowClicked?.(row.data),
@@ -3237,23 +3028,23 @@ var GalleryCard = ({
3237
3028
  }
3238
3029
  },
3239
3030
  tabIndex: store.config.onRowClicked ? 0 : undefined,
3240
- children: /* @__PURE__ */ jsxs9(CardHeader, {
3031
+ children: /* @__PURE__ */ jsxs8(CardHeader, {
3241
3032
  className: "pr-12",
3242
3033
  children: [
3243
- /* @__PURE__ */ jsxs9("div", {
3034
+ /* @__PURE__ */ jsxs8("div", {
3244
3035
  className: "flex items-center gap-2",
3245
3036
  children: [
3246
- selection ? /* @__PURE__ */ jsx17(Checkbox, {
3037
+ selection ? /* @__PURE__ */ jsx14(Checkbox, {
3247
3038
  "aria-label": store.config.labels.selectRow,
3248
3039
  checked: !!store.state.rowSelection[row.id],
3249
3040
  disabled: !selectable,
3250
3041
  onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked),
3251
3042
  onClick: (event) => event.stopPropagation()
3252
3043
  }) : null,
3253
- draggable ? /* @__PURE__ */ jsx17(DragHandle, {
3044
+ draggable ? /* @__PURE__ */ jsx14(DragHandle, {
3254
3045
  tableAtom
3255
3046
  }) : null,
3256
- tag ? /* @__PURE__ */ jsxs9(Badge, {
3047
+ tag ? /* @__PURE__ */ jsxs8(Badge, {
3257
3048
  variant: "secondary",
3258
3049
  children: [
3259
3050
  gallery.tagIcon,
@@ -3262,17 +3053,17 @@ var GalleryCard = ({
3262
3053
  }) : null
3263
3054
  ]
3264
3055
  }),
3265
- /* @__PURE__ */ jsx17(CardTitle, {
3056
+ /* @__PURE__ */ jsx14(CardTitle, {
3266
3057
  children: name ? renderCell(row, name) : row.id
3267
3058
  }),
3268
- description ? /* @__PURE__ */ jsx17("div", {
3059
+ description ? /* @__PURE__ */ jsx14("div", {
3269
3060
  className: "text-muted-foreground line-clamp-3 text-sm",
3270
3061
  children: renderCell(row, description)
3271
3062
  }) : null,
3272
- hasRowActionMenu(store) ? /* @__PURE__ */ jsx17("div", {
3063
+ hasRowActionMenu(store) ? /* @__PURE__ */ jsx14("div", {
3273
3064
  className: "absolute top-4 right-4",
3274
3065
  onClick: (event) => event.stopPropagation(),
3275
- children: /* @__PURE__ */ jsx17(DataTableRowActionMenu, {
3066
+ children: /* @__PURE__ */ jsx14(DataTableRowActionMenu, {
3276
3067
  tableAtom
3277
3068
  })
3278
3069
  }) : null
@@ -3288,31 +3079,31 @@ var DataTableGallery = ({
3288
3079
  const fields = getActiveGrouping(store);
3289
3080
  const rows = fields.length ? model.sortedRows : model.pageRows;
3290
3081
  if (store.config.status.error) {
3291
- return /* @__PURE__ */ jsx17("div", {
3082
+ return /* @__PURE__ */ jsx14("div", {
3292
3083
  className: "text-destructive rounded-lg border border-dashed p-10 text-center",
3293
3084
  children: store.config.status.error
3294
3085
  });
3295
3086
  }
3296
3087
  if (store.config.status.loading && !rows.length) {
3297
- return /* @__PURE__ */ jsx17("div", {
3088
+ return /* @__PURE__ */ jsx14("div", {
3298
3089
  className: "rounded-lg border border-dashed p-10 text-center",
3299
- children: /* @__PURE__ */ jsx17(Loading, {
3090
+ children: /* @__PURE__ */ jsx14(Loading, {
3300
3091
  label: store.config.labels.loading
3301
3092
  })
3302
3093
  });
3303
3094
  }
3304
3095
  if (!rows.length) {
3305
- return /* @__PURE__ */ jsx17("div", {
3096
+ return /* @__PURE__ */ jsx14("div", {
3306
3097
  className: "text-muted-foreground rounded-lg border border-dashed p-10 text-center",
3307
3098
  children: store.config.status.empty ?? store.config.labels.empty
3308
3099
  });
3309
3100
  }
3310
3101
  if (!fields.length) {
3311
- return /* @__PURE__ */ jsx17("div", {
3102
+ return /* @__PURE__ */ jsx14("div", {
3312
3103
  className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
3313
- children: rows.map((row) => /* @__PURE__ */ jsx17(RowIdContext.Provider, {
3104
+ children: rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3314
3105
  value: row.id,
3315
- children: /* @__PURE__ */ jsx17(GalleryCard, {
3106
+ children: /* @__PURE__ */ jsx14(GalleryCard, {
3316
3107
  tableAtom
3317
3108
  })
3318
3109
  }, row.id))
@@ -3328,57 +3119,57 @@ var DataTableGallery = ({
3328
3119
  [section.key]: !collapsed
3329
3120
  }
3330
3121
  }));
3331
- return /* @__PURE__ */ jsxs9("section", {
3122
+ return /* @__PURE__ */ jsxs8("section", {
3332
3123
  className: "data-[drop-target=true]:ring-primary space-y-3 rounded-lg transition-shadow data-[drop-target=true]:ring-2",
3333
3124
  "data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
3334
3125
  children: [
3335
- /* @__PURE__ */ jsxs9("div", {
3126
+ /* @__PURE__ */ jsxs8("div", {
3336
3127
  className: "hover:bg-accent flex cursor-pointer items-center gap-2 rounded-lg border p-3 transition-colors",
3337
3128
  onClick: toggleCollapsed,
3338
3129
  children: [
3339
- /* @__PURE__ */ jsxs9("button", {
3130
+ /* @__PURE__ */ jsxs8("button", {
3340
3131
  "aria-expanded": !collapsed,
3341
3132
  className: "flex flex-1 cursor-pointer items-center gap-2 text-left font-medium",
3342
3133
  type: "button",
3343
3134
  children: [
3344
- collapsed ? /* @__PURE__ */ jsx17(ChevronRight2, {
3135
+ collapsed ? /* @__PURE__ */ jsx14(ChevronRight2, {
3345
3136
  className: "size-4"
3346
- }) : /* @__PURE__ */ jsx17(ChevronDown, {
3137
+ }) : /* @__PURE__ */ jsx14(ChevronDown, {
3347
3138
  className: "size-4"
3348
3139
  }),
3349
- /* @__PURE__ */ jsx17("span", {
3140
+ /* @__PURE__ */ jsx14("span", {
3350
3141
  className: "flex-1",
3351
3142
  children: section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.data)) ?? section.groupId
3352
3143
  }),
3353
- /* @__PURE__ */ jsx17(Badge, {
3144
+ /* @__PURE__ */ jsx14(Badge, {
3354
3145
  variant: "secondary",
3355
3146
  children: section.rows.length
3356
3147
  })
3357
3148
  ]
3358
3149
  }),
3359
- /* @__PURE__ */ jsx17(GroupActions, {
3150
+ /* @__PURE__ */ jsx14(GroupActions, {
3360
3151
  actions: section.field.actions,
3361
3152
  groupId: section.groupId,
3362
3153
  title: section.field.actionsLabel ?? store.config.labels.actions
3363
3154
  })
3364
3155
  ]
3365
3156
  }),
3366
- !collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */ jsx17("div", {
3157
+ !collapsed ? section.children.length ? renderSections(section.children) : section.rows.length ? /* @__PURE__ */ jsx14("div", {
3367
3158
  className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
3368
- children: section.rows.map((row) => /* @__PURE__ */ jsx17(RowIdContext.Provider, {
3159
+ children: section.rows.map((row) => /* @__PURE__ */ jsx14(RowIdContext.Provider, {
3369
3160
  value: row.id,
3370
- children: /* @__PURE__ */ jsx17(GalleryCard, {
3161
+ children: /* @__PURE__ */ jsx14(GalleryCard, {
3371
3162
  tableAtom
3372
3163
  })
3373
3164
  }, `${section.key}:${row.id}`))
3374
- }) : /* @__PURE__ */ jsx17("div", {
3165
+ }) : /* @__PURE__ */ jsx14("div", {
3375
3166
  className: "text-muted-foreground rounded-lg border border-dashed p-8 text-center",
3376
3167
  children: section.field.renderEmptyGroup?.(section.groupId) ?? store.config.labels.empty
3377
3168
  }) : null
3378
3169
  ]
3379
3170
  }, section.key);
3380
3171
  });
3381
- return /* @__PURE__ */ jsx17("div", {
3172
+ return /* @__PURE__ */ jsx14("div", {
3382
3173
  className: "space-y-4",
3383
3174
  children: renderSections(groupDataTableRows(rows, fields))
3384
3175
  });
@@ -3405,9 +3196,9 @@ var DataTablePagination = ({
3405
3196
  return null;
3406
3197
  const selected = model.rows.filter((row) => store.state.rowSelection[row.id]).length;
3407
3198
  const setPagination = (next) => changeState(setStore, (state) => ({ ...state, ...next }));
3408
- return /* @__PURE__ */ jsx17("div", {
3199
+ return /* @__PURE__ */ jsx14("div", {
3409
3200
  className: "pt-4",
3410
- children: /* @__PURE__ */ jsx17(Pagination, {
3201
+ children: /* @__PURE__ */ jsx14(Pagination, {
3411
3202
  messages: store.config.labels,
3412
3203
  onPageChange: (page) => setPagination({ page, pageSize: store.state.pageSize }),
3413
3204
  onPageSizeChange: (pageSize) => setPagination({ page: 0, pageSize }),
@@ -3425,7 +3216,7 @@ var HydratedDataTable = ({
3425
3216
  setPersistedUiState,
3426
3217
  ...props
3427
3218
  }) => {
3428
- const transientUiAtomRef = useRef2(null);
3219
+ const transientUiAtomRef = useRef(null);
3429
3220
  if (!transientUiAtomRef.current) {
3430
3221
  const grouping = props.features?.grouping;
3431
3222
  transientUiAtomRef.current = Atom.make({
@@ -3435,12 +3226,12 @@ var HydratedDataTable = ({
3435
3226
  }
3436
3227
  const [transientUiState, setTransientUiState] = useAtom(transientUiAtomRef.current);
3437
3228
  const uiState = useMemo(() => ({ ...persistedUiState, ...transientUiState }), [persistedUiState, transientUiState]);
3438
- const setUiState = useCallback2((state) => {
3229
+ const setUiState = useCallback((state) => {
3439
3230
  setPersistedUiState(persistedUiFromState(state));
3440
3231
  setTransientUiState(transientUiFromState(state));
3441
3232
  }, [setPersistedUiState, setTransientUiState]);
3442
3233
  const validatedConfig = resolveConfig(props, (state) => setUiState(state));
3443
- const atomRef = useRef2(null);
3234
+ const atomRef = useRef(null);
3444
3235
  if (!atomRef.current) {
3445
3236
  const initial = {
3446
3237
  rowData: props.rowData,
@@ -3495,24 +3286,24 @@ var HydratedDataTable = ({
3495
3286
  setUiState,
3496
3287
  uiState
3497
3288
  ]);
3498
- return /* @__PURE__ */ jsxs9("div", {
3289
+ return /* @__PURE__ */ jsxs8("div", {
3499
3290
  className: "w-full max-w-full min-w-0 rounded-md",
3500
3291
  "data-table-root": "",
3501
3292
  children: [
3502
- /* @__PURE__ */ jsx17(DataTableToolbar, {
3293
+ /* @__PURE__ */ jsx14(DataTableToolbar, {
3503
3294
  tableAtom
3504
3295
  }),
3505
- /* @__PURE__ */ jsx17(DataTableContent, {
3296
+ /* @__PURE__ */ jsx14(DataTableContent, {
3506
3297
  tableAtom
3507
3298
  }),
3508
- /* @__PURE__ */ jsx17(DataTablePagination, {
3299
+ /* @__PURE__ */ jsx14(DataTablePagination, {
3509
3300
  tableAtom
3510
3301
  })
3511
3302
  ]
3512
3303
  });
3513
3304
  };
3514
3305
  var DataTable = (props) => {
3515
- const persistedUiAtomRef = useRef2(null);
3306
+ const persistedUiAtomRef = useRef(null);
3516
3307
  if (!persistedUiAtomRef.current) {
3517
3308
  const pathname = globalThis.window?.location.pathname ?? "/";
3518
3309
  const columnIds = normalizeDataTableColumns(props.columnDefs).map(({ id }) => id).join(",");
@@ -3527,13 +3318,13 @@ var DataTable = (props) => {
3527
3318
  }
3528
3319
  const [persistedUiResult, setPersistedUiState] = useAtom(persistedUiAtomRef.current);
3529
3320
  if (!AsyncResult.isSuccess(persistedUiResult) || AsyncResult.isWaiting(persistedUiResult)) {
3530
- return /* @__PURE__ */ jsx17("div", {
3321
+ return /* @__PURE__ */ jsx14("div", {
3531
3322
  "aria-busy": "true",
3532
3323
  className: "invisible w-full max-w-full min-w-0 rounded-md",
3533
3324
  "data-table-root": ""
3534
3325
  });
3535
3326
  }
3536
- return /* @__PURE__ */ jsx17(HydratedDataTable, {
3327
+ return /* @__PURE__ */ jsx14(HydratedDataTable, {
3537
3328
  ...props,
3538
3329
  persistedUiState: persistedUiResult.value,
3539
3330
  setPersistedUiState
@@ -3544,185 +3335,434 @@ var DataTableContent = ({
3544
3335
  }) => {
3545
3336
  const [store] = useTableAtom(tableAtom);
3546
3337
  if (store.config.features.gallery && store.state.view === "gallery") {
3547
- return /* @__PURE__ */ jsx17(DataTableGallery, {
3338
+ return /* @__PURE__ */ jsx14(DataTableGallery, {
3548
3339
  tableAtom
3549
3340
  });
3550
3341
  }
3551
3342
  const model = deriveModel(store);
3552
3343
  const width = getDataTableWidth(model.visibleColumns, (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0));
3553
- return /* @__PURE__ */ jsxs9(ScrollArea, {
3344
+ return /* @__PURE__ */ jsxs8(ScrollArea, {
3554
3345
  className: "max-w-full min-w-0",
3555
3346
  children: [
3556
- /* @__PURE__ */ jsxs9(Table, {
3347
+ /* @__PURE__ */ jsxs8(Table, {
3557
3348
  className: "table-fixed",
3558
3349
  style: { width: `max(100%, ${width}px)` },
3559
3350
  children: [
3560
- /* @__PURE__ */ jsx17(DataTableHeader, {
3351
+ /* @__PURE__ */ jsx14(DataTableHeader, {
3561
3352
  tableAtom
3562
3353
  }),
3563
- /* @__PURE__ */ jsx17(DataTableBody, {
3354
+ /* @__PURE__ */ jsx14(DataTableBody, {
3564
3355
  tableAtom
3565
3356
  })
3566
3357
  ]
3567
3358
  }),
3568
- /* @__PURE__ */ jsx17(ScrollBar, {
3359
+ /* @__PURE__ */ jsx14(ScrollBar, {
3569
3360
  orientation: "horizontal"
3570
3361
  })
3571
3362
  ]
3572
3363
  });
3573
3364
  };
3574
- var DataTableRelationshipCell = ({
3365
+ var DataTableListCell = (props) => {
3366
+ if (props.options && (props.onAdd || props.onRemove)) {
3367
+ return /* @__PURE__ */ jsx14(EditableDataTableListCell, {
3368
+ ...props
3369
+ });
3370
+ }
3371
+ const { actionsLabel, itemActions, ...summaryProps } = props;
3372
+ const totalCount = props.totalCount ?? props.items.length;
3373
+ const overflow = totalCount > Math.min(props.items.length, props.visibleCount ?? 3);
3374
+ if (!itemActions?.length && !overflow) {
3375
+ return /* @__PURE__ */ jsx14(DataTableListSummary, {
3376
+ ...summaryProps
3377
+ });
3378
+ }
3379
+ const menuLabel = actionsLabel ?? (itemActions?.length ? dataTableMessages().actions : dataTableMessages().listDetails);
3380
+ return /* @__PURE__ */ jsx14("div", {
3381
+ 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",
3382
+ "data-slot": "data-table-list-cell",
3383
+ onClick: (event) => event.stopPropagation(),
3384
+ onPointerDown: (event) => event.stopPropagation(),
3385
+ children: /* @__PURE__ */ jsx14(DataTableListMenu, {
3386
+ actions: itemActions ?? [],
3387
+ display: props.display,
3388
+ force: overflow,
3389
+ label: menuLabel,
3390
+ items: props.items,
3391
+ trigger: /* @__PURE__ */ jsxs8(Button, {
3392
+ "aria-label": menuLabel,
3393
+ className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
3394
+ variant: "ghost",
3395
+ children: [
3396
+ /* @__PURE__ */ jsx14(DataTableListSummaryContent, {
3397
+ ...summaryProps,
3398
+ showMenu: false
3399
+ }),
3400
+ /* @__PURE__ */ jsx14(ChevronDown, {})
3401
+ ]
3402
+ })
3403
+ })
3404
+ });
3405
+ };
3406
+ var EditableDataTableListCell = ({
3575
3407
  emptyLabel,
3576
3408
  manageLabel,
3577
3409
  onAdd,
3578
3410
  onRemove,
3579
3411
  options,
3580
- value
3412
+ items,
3413
+ display,
3414
+ visibleCount,
3415
+ totalCount,
3416
+ actionsLabel,
3417
+ itemActions
3581
3418
  }) => {
3582
- const [selected, setSelected] = useState([...value]);
3583
- useLayoutEffect(() => setSelected([...value]), [value]);
3419
+ const [selected, setSelected] = useState([...items]);
3420
+ useLayoutEffect(() => setSelected([...items]), [items]);
3584
3421
  const selectedValues = new Set(selected.map((item) => item.value));
3585
- return /* @__PURE__ */ jsx17("div", {
3586
- "data-slot": "data-table-relationship-cell",
3587
- className: "h-full in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0",
3422
+ const available = options.filter((item) => !selectedValues.has(item.value));
3423
+ const canAdd = !!onAdd && available.length > 0;
3424
+ const selectedTotal = totalCount === undefined ? selected.length : totalCount + selected.length - items.length;
3425
+ const labels2 = dataTableMessages();
3426
+ const actions = [
3427
+ ...itemActions ?? [],
3428
+ ...onRemove ? [
3429
+ {
3430
+ id: "data-table-list-remove",
3431
+ closeOnClick: false,
3432
+ name: labels2.removeItem,
3433
+ icon: /* @__PURE__ */ jsx14(Trash2, {}),
3434
+ variant: "destructive",
3435
+ onClick: (item) => {
3436
+ if (item.value === undefined)
3437
+ return;
3438
+ onRemove(item.value);
3439
+ setSelected((current) => current.filter((candidate) => candidate.value !== item.value));
3440
+ }
3441
+ }
3442
+ ] : []
3443
+ ];
3444
+ return /* @__PURE__ */ jsx14("div", {
3445
+ "data-slot": "data-table-list-cell",
3446
+ 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",
3588
3447
  onClick: (event) => event.stopPropagation(),
3589
3448
  onPointerDown: (event) => event.stopPropagation(),
3590
- children: /* @__PURE__ */ jsx17(VirtualizedCombobox, {
3591
- ariaLabel: manageLabel,
3592
- emptyLabel,
3593
- items: [...options].sort((left, right) => Number(selectedValues.has(right.value)) - Number(selectedValues.has(left.value))),
3594
- messages: { search: manageLabel },
3595
- multiple: true,
3596
- onValueChange: (next) => {
3597
- const nextValues = new Set(next.map((item) => item.value));
3598
- selected.forEach((item) => !nextValues.has(item.value) && onRemove?.(item.value));
3599
- next.forEach((item) => !selectedValues.has(item.value) && onAdd?.(item.value));
3600
- setSelected(next);
3601
- },
3602
- placeholder: emptyLabel,
3603
- trigger: /* @__PURE__ */ jsxs9(Button, {
3604
- className: "h-full min-h-16 w-full justify-between rounded-none",
3449
+ children: /* @__PURE__ */ jsx14(DataTableListMenu, {
3450
+ actions,
3451
+ addEmptyLabel: emptyLabel,
3452
+ addLabel: labels2.addItem,
3453
+ addOptions: canAdd ? available : undefined,
3454
+ addSearchLabel: manageLabel,
3455
+ display,
3456
+ force: true,
3457
+ items: selected,
3458
+ label: actionsLabel ?? manageLabel,
3459
+ onAdd: canAdd ? (item) => {
3460
+ onAdd(item.value);
3461
+ setSelected((current) => [...current, item]);
3462
+ } : undefined,
3463
+ trigger: /* @__PURE__ */ jsxs8(Button, {
3464
+ "aria-label": manageLabel,
3465
+ className: "h-full w-full min-w-0 justify-between rounded-none px-2 focus-visible:ring-inset",
3605
3466
  variant: "ghost",
3606
3467
  children: [
3607
- /* @__PURE__ */ jsx17(DataTableListSummary, {
3468
+ /* @__PURE__ */ jsx14(DataTableListSummaryContent, {
3608
3469
  emptyLabel,
3609
- expandable: false,
3610
3470
  items: selected,
3611
- variant: selected.some((item) => item.icon) ? "icon" : "text"
3471
+ display,
3472
+ showMenu: false,
3473
+ visibleCount,
3474
+ totalCount: selectedTotal
3612
3475
  }),
3613
- /* @__PURE__ */ jsx17(ChevronDown, {})
3476
+ /* @__PURE__ */ jsx14(ChevronDown, {})
3614
3477
  ]
3615
- }),
3616
- value: selected
3478
+ })
3617
3479
  })
3618
3480
  });
3619
3481
  };
3620
- var DataTableListSummary = ({
3482
+ var DataTableListMenu = ({
3483
+ actions,
3484
+ addEmptyLabel,
3485
+ addLabel,
3486
+ addOptions,
3487
+ addSearchLabel,
3488
+ className,
3489
+ display = "list",
3490
+ force = false,
3491
+ items,
3492
+ label,
3493
+ onAdd,
3494
+ trigger
3495
+ }) => {
3496
+ const entries = items.map((item) => {
3497
+ const normalized = Schema.is(Schema.String)(item) ? { label: item } : item;
3498
+ const visibleActions = actions.filter((action) => action.visible?.(normalized) ?? true);
3499
+ return { item: normalized, visibleActions };
3500
+ });
3501
+ const hasActions = entries.some(({ visibleActions }) => visibleActions.length);
3502
+ if (!force && !hasActions && !onAdd)
3503
+ return null;
3504
+ const resolvedLabel = label ?? (hasActions ? dataTableMessages().actions : dataTableMessages().listDetails);
3505
+ return /* @__PURE__ */ jsxs8(DropdownMenu, {
3506
+ children: [
3507
+ /* @__PURE__ */ jsx14(DropdownMenuTrigger, {
3508
+ onClick: (event) => event.stopPropagation(),
3509
+ onPointerDown: (event) => event.stopPropagation(),
3510
+ render: trigger ?? /* @__PURE__ */ jsx14(Button, {
3511
+ "aria-label": resolvedLabel,
3512
+ className: cn("size-8 shrink-0", className),
3513
+ size: "icon",
3514
+ variant: "ghost",
3515
+ children: /* @__PURE__ */ jsx14(MoreHorizontal, {})
3516
+ })
3517
+ }),
3518
+ /* @__PURE__ */ jsx14(DropdownMenuContent, {
3519
+ align: "end",
3520
+ className: "max-h-72 w-72",
3521
+ onClick: (event) => event.stopPropagation(),
3522
+ onPointerDown: (event) => event.stopPropagation(),
3523
+ children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
3524
+ children: [
3525
+ /* @__PURE__ */ jsx14(DropdownMenuLabel, {
3526
+ children: resolvedLabel
3527
+ }),
3528
+ /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}),
3529
+ entries.map(({ item, visibleActions }, index) => visibleActions.length ? /* @__PURE__ */ jsxs8(DropdownMenuSub, {
3530
+ children: [
3531
+ /* @__PURE__ */ jsx14(DropdownMenuSubTrigger, {
3532
+ children: /* @__PURE__ */ jsx14(DataTableListEntry, {
3533
+ item,
3534
+ appearance: display === "icon" ? "detail" : "list"
3535
+ })
3536
+ }),
3537
+ /* @__PURE__ */ jsx14(DropdownMenuSubContent, {
3538
+ className: "w-max",
3539
+ children: visibleActions.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
3540
+ closeOnClick: action.closeOnClick,
3541
+ disabled: action.disabled?.(item),
3542
+ onClick: (event) => {
3543
+ event.stopPropagation();
3544
+ action.onClick(item);
3545
+ },
3546
+ variant: action.variant,
3547
+ children: [
3548
+ action.icon,
3549
+ action.name
3550
+ ]
3551
+ }, action.id ?? action.name))
3552
+ })
3553
+ ]
3554
+ }, item.value ?? `${item.label}-${index}`) : /* @__PURE__ */ jsx14("div", {
3555
+ className: "px-2 py-1.5",
3556
+ children: /* @__PURE__ */ jsx14(DataTableListEntry, {
3557
+ item,
3558
+ appearance: display === "icon" ? "detail" : "list"
3559
+ })
3560
+ }, item.value ?? `${item.label}-${index}`)),
3561
+ onAdd && addOptions?.length ? /* @__PURE__ */ jsxs8(Fragment, {
3562
+ children: [
3563
+ entries.length ? /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}) : null,
3564
+ /* @__PURE__ */ jsx14(DataTableListAddMenu, {
3565
+ emptyLabel: addEmptyLabel,
3566
+ label: addLabel ?? dataTableMessages().addItem,
3567
+ onAdd,
3568
+ options: addOptions,
3569
+ searchLabel: addSearchLabel ?? dataTableMessages().filter,
3570
+ display
3571
+ })
3572
+ ]
3573
+ }) : null
3574
+ ]
3575
+ })
3576
+ })
3577
+ ]
3578
+ });
3579
+ };
3580
+ var DataTableListAddMenu = ({
3581
+ emptyLabel,
3582
+ display,
3583
+ label,
3584
+ onAdd,
3585
+ options,
3586
+ searchLabel
3587
+ }) => {
3588
+ const [search, setSearch] = useState("");
3589
+ const focusSearch = useCallback((input) => {
3590
+ input?.focus({ preventScroll: true });
3591
+ }, []);
3592
+ const locale = getLocale();
3593
+ const normalizedSearch = search.trim().toLocaleLowerCase(locale);
3594
+ const filtered = normalizedSearch ? options.filter((item) => item.label.toLocaleLowerCase(locale).includes(normalizedSearch)) : options;
3595
+ return /* @__PURE__ */ jsxs8(DropdownMenuSub, {
3596
+ onOpenChange: (open) => {
3597
+ if (!open)
3598
+ setSearch("");
3599
+ },
3600
+ children: [
3601
+ /* @__PURE__ */ jsxs8(DropdownMenuSubTrigger, {
3602
+ children: [
3603
+ /* @__PURE__ */ jsx14(Plus, {}),
3604
+ label
3605
+ ]
3606
+ }),
3607
+ /* @__PURE__ */ jsxs8(DropdownMenuSubContent, {
3608
+ className: "w-64",
3609
+ children: [
3610
+ /* @__PURE__ */ jsxs8("div", {
3611
+ className: "relative p-1",
3612
+ children: [
3613
+ /* @__PURE__ */ jsx14(Search, {
3614
+ className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
3615
+ }),
3616
+ /* @__PURE__ */ jsx14(Input, {
3617
+ "aria-label": searchLabel,
3618
+ className: "h-8 pl-8",
3619
+ onChange: (event) => setSearch(event.target.value),
3620
+ onKeyDown: (event) => {
3621
+ if (event.key !== "Escape")
3622
+ event.stopPropagation();
3623
+ },
3624
+ placeholder: dataTableMessages().filter,
3625
+ ref: focusSearch,
3626
+ value: search
3627
+ })
3628
+ ]
3629
+ }),
3630
+ /* @__PURE__ */ jsx14(DropdownMenuSeparator, {}),
3631
+ filtered.length ? filtered.map((item) => /* @__PURE__ */ jsx14(DropdownMenuItem, {
3632
+ closeOnClick: false,
3633
+ onClick: () => onAdd(item),
3634
+ children: /* @__PURE__ */ jsx14(DataTableListEntry, {
3635
+ item,
3636
+ appearance: display === "icon" ? "detail" : "list"
3637
+ })
3638
+ }, item.value)) : /* @__PURE__ */ jsx14("div", {
3639
+ className: "text-muted-foreground px-2 py-1.5 text-sm",
3640
+ children: emptyLabel
3641
+ })
3642
+ ]
3643
+ })
3644
+ ]
3645
+ });
3646
+ };
3647
+ var DataTableListSummaryContent = ({
3621
3648
  emptyLabel,
3622
- expandable = true,
3623
3649
  items,
3624
- overflowLabel,
3625
3650
  totalCount = items.length,
3626
- variant = "text",
3651
+ display = "list",
3652
+ showMenu,
3627
3653
  visibleCount = 3
3628
3654
  }) => {
3629
- const labels2 = dataTableMessages();
3630
3655
  const normalized = items.map((item) => Schema.is(Schema.String)(item) ? { label: item } : item);
3631
3656
  if (!normalized.length)
3632
- return /* @__PURE__ */ jsx17("span", {
3657
+ return /* @__PURE__ */ jsx14("span", {
3633
3658
  className: "text-muted-foreground",
3634
3659
  children: emptyLabel
3635
3660
  });
3636
- const visible = normalized.slice(0, visibleCount);
3661
+ const visible = normalized.slice(0, Math.max(0, visibleCount));
3637
3662
  const remaining = Math.max(totalCount - visible.length, 0);
3638
- const details = /* @__PURE__ */ jsx17(PopoverContent, {
3639
- align: "start",
3640
- className: "max-h-72 w-72 overflow-y-auto p-2",
3641
- children: normalized.map((item, index) => /* @__PURE__ */ jsxs9("div", {
3642
- className: "flex items-center gap-2 p-2",
3643
- children: [
3644
- item.icon,
3645
- item.label
3646
- ]
3647
- }, item.value ?? `${item.label}-${index}`))
3648
- });
3649
- if (variant === "icon") {
3650
- return /* @__PURE__ */ jsx17(TooltipProvider, {
3651
- children: /* @__PURE__ */ jsxs9("span", {
3663
+ if (display === "icon") {
3664
+ return /* @__PURE__ */ jsx14(TooltipProvider, {
3665
+ children: /* @__PURE__ */ jsxs8("span", {
3652
3666
  className: "flex items-center",
3653
3667
  children: [
3654
- visible.map((item) => /* @__PURE__ */ jsxs9(Tooltip, {
3655
- children: [
3656
- /* @__PURE__ */ jsx17(TooltipTrigger, {
3657
- render: /* @__PURE__ */ jsx17("span", {
3658
- "aria-label": item.label,
3659
- className: "bg-muted -ml-1 flex size-8 items-center justify-center rounded-full",
3660
- children: item.icon ?? item.label.slice(0, 2).toUpperCase()
3661
- })
3662
- }),
3663
- /* @__PURE__ */ jsx17(TooltipContent, {
3664
- children: item.label
3665
- })
3666
- ]
3667
- }, item.value ?? item.label)),
3668
- remaining && expandable ? /* @__PURE__ */ jsxs9(Popover, {
3669
- children: [
3670
- /* @__PURE__ */ jsx17(PopoverTrigger, {
3671
- render: /* @__PURE__ */ jsxs9("button", {
3672
- "aria-label": labels2.listOthers(remaining),
3673
- className: "bg-muted -ml-1 flex size-8 items-center justify-center rounded-full",
3674
- type: "button",
3675
- children: [
3676
- "+",
3677
- remaining
3678
- ]
3679
- })
3680
- }),
3681
- details
3682
- ]
3683
- }) : remaining ? /* @__PURE__ */ jsxs9("span", {
3684
- className: "bg-muted -ml-1 flex size-8 items-center justify-center rounded-full",
3668
+ visible.map((item, index) => /* @__PURE__ */ jsx14(DataTableListEntry, {
3669
+ item,
3670
+ appearance: "icon"
3671
+ }, item.value ?? `${item.label}-${index}`)),
3672
+ remaining ? /* @__PURE__ */ jsxs8("span", {
3673
+ className: "bg-secondary text-secondary-foreground -ml-1 flex size-8 items-center justify-center rounded-full",
3685
3674
  children: [
3686
3675
  "+",
3687
3676
  remaining
3688
3677
  ]
3678
+ }) : null,
3679
+ remaining && showMenu ? /* @__PURE__ */ jsx14(DataTableListMenu, {
3680
+ actions: [],
3681
+ display,
3682
+ force: true,
3683
+ items: normalized
3689
3684
  }) : null
3690
3685
  ]
3691
3686
  })
3692
3687
  });
3693
3688
  }
3694
- const summary = /* @__PURE__ */ jsxs9(Fragment, {
3689
+ return /* @__PURE__ */ jsxs8("span", {
3690
+ className: "inline-flex min-w-0 items-center gap-2 text-sm",
3695
3691
  children: [
3696
- visible.map((item) => item.label).join(", "),
3697
- remaining ? ` ${overflowLabel?.(remaining) ?? labels2.listOthers(remaining)}` : ""
3692
+ /* @__PURE__ */ jsxs8("span", {
3693
+ className: "truncate",
3694
+ children: [
3695
+ visible.map((item) => item.label).join(", "),
3696
+ remaining ? ` +${remaining}` : ""
3697
+ ]
3698
+ }),
3699
+ remaining && showMenu ? /* @__PURE__ */ jsx14(DataTableListMenu, {
3700
+ actions: [],
3701
+ display,
3702
+ force: true,
3703
+ items: normalized
3704
+ }) : null
3698
3705
  ]
3699
3706
  });
3700
- return remaining && expandable ? /* @__PURE__ */ jsxs9(Popover, {
3707
+ };
3708
+ var DataTableListSummary = (props) => /* @__PURE__ */ jsx14(DataTableListSummaryContent, {
3709
+ ...props,
3710
+ showMenu: true
3711
+ });
3712
+ var DataTableListEntry = ({
3713
+ item,
3714
+ appearance
3715
+ }) => {
3716
+ const icon = /* @__PURE__ */ jsx14("span", {
3717
+ "aria-hidden": "true",
3718
+ className: "bg-secondary text-secondary-foreground flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full",
3719
+ children: item.imageSrc ? /* @__PURE__ */ jsx14("img", {
3720
+ alt: "",
3721
+ src: item.imageSrc,
3722
+ className: "size-full object-cover"
3723
+ }) : item.icon ?? item.label.slice(0, 2).toUpperCase()
3724
+ });
3725
+ if (appearance === "list") {
3726
+ return /* @__PURE__ */ jsx14("span", {
3727
+ className: "truncate",
3728
+ children: item.label
3729
+ });
3730
+ }
3731
+ return appearance === "icon" ? /* @__PURE__ */ jsxs8(Tooltip, {
3701
3732
  children: [
3702
- /* @__PURE__ */ jsx17(PopoverTrigger, {
3703
- render: /* @__PURE__ */ jsx17("button", {
3704
- className: "text-left text-sm",
3705
- type: "button",
3706
- children: summary
3707
- })
3733
+ /* @__PURE__ */ jsx14(TooltipTrigger, {
3734
+ render: /* @__PURE__ */ jsx14("span", {
3735
+ className: "-ml-1 inline-flex rounded-full",
3736
+ "aria-label": item.label
3737
+ }),
3738
+ children: icon
3708
3739
  }),
3709
- details
3740
+ /* @__PURE__ */ jsx14(TooltipContent, {
3741
+ children: item.label
3742
+ })
3743
+ ]
3744
+ }) : /* @__PURE__ */ jsxs8("span", {
3745
+ className: "flex min-w-0 flex-1 items-center gap-2 text-left",
3746
+ children: [
3747
+ icon,
3748
+ /* @__PURE__ */ jsx14("span", {
3749
+ className: "truncate",
3750
+ children: item.label
3751
+ })
3710
3752
  ]
3711
- }) : /* @__PURE__ */ jsx17("span", {
3712
- className: "text-sm",
3713
- children: summary
3714
3753
  });
3715
3754
  };
3716
3755
  export {
3717
3756
  DataTable,
3757
+ DataTableListCell,
3718
3758
  DataTableListSummary,
3719
- DataTableRelationshipCell,
3720
3759
  DataTableRowActions,
3721
3760
  buildDataTableRows,
3722
3761
  dataTableMessages,
3723
3762
  downloadCsv,
3724
3763
  downloadJson,
3725
3764
  filterDataTableRows,
3765
+ getDataTableExportValue,
3726
3766
  getDataTableSelectableRows,
3727
3767
  getDataTableWidth,
3728
3768
  groupDataTableRows,