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