@platned/ui 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +30 -7
  2. package/dist/blocks-charts.cjs +1 -0
  3. package/dist/blocks-charts.cjs.map +1 -1
  4. package/dist/blocks-charts.js +2 -0
  5. package/dist/blocks-charts.js.map +1 -1
  6. package/dist/blocks.cjs +282 -186
  7. package/dist/blocks.cjs.map +1 -1
  8. package/dist/blocks.d.cts +85 -5
  9. package/dist/blocks.d.ts +85 -5
  10. package/dist/blocks.js +280 -169
  11. package/dist/blocks.js.map +1 -1
  12. package/dist/chart.cjs +1 -0
  13. package/dist/chart.cjs.map +1 -1
  14. package/dist/chart.d.ts +1 -1
  15. package/dist/chart.js +2 -1
  16. package/dist/chart.js.map +1 -1
  17. package/dist/{chunk-327NSKZW.js → chunk-6BJ3OMUZ.js} +4 -3
  18. package/dist/{chunk-327NSKZW.js.map → chunk-6BJ3OMUZ.js.map} +1 -1
  19. package/dist/{chunk-GJJWRZ4B.js → chunk-7RXFHQL5.js} +4 -3
  20. package/dist/{chunk-GJJWRZ4B.js.map → chunk-7RXFHQL5.js.map} +1 -1
  21. package/dist/{chunk-2L5XAYNK.js → chunk-MJC4A7I4.js} +3 -1
  22. package/dist/{chunk-2L5XAYNK.js.map → chunk-MJC4A7I4.js.map} +1 -1
  23. package/dist/{chunk-WGCAQEZ4.js → chunk-QYFD7KIK.js} +3 -2
  24. package/dist/{chunk-WGCAQEZ4.js.map → chunk-QYFD7KIK.js.map} +1 -1
  25. package/dist/code-block-highlight.cjs +1 -0
  26. package/dist/code-block-highlight.cjs.map +1 -1
  27. package/dist/code-block-highlight.js +4 -3
  28. package/dist/code-block-highlight.js.map +1 -1
  29. package/dist/{data-table-Dec6t8NO.d.ts → data-table-CcIINjPg.d.ts} +30 -3
  30. package/dist/data-table.cjs +200 -124
  31. package/dist/data-table.cjs.map +1 -1
  32. package/dist/data-table.d.ts +1 -1
  33. package/dist/data-table.js +156 -79
  34. package/dist/data-table.js.map +1 -1
  35. package/dist/index.cjs +10632 -7124
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.ts +204 -8
  38. package/dist/index.js +5933 -2507
  39. package/dist/index.js.map +1 -1
  40. package/dist/map.cjs +1 -0
  41. package/dist/map.cjs.map +1 -1
  42. package/dist/map.d.cts +2 -0
  43. package/dist/map.d.ts +2 -0
  44. package/dist/map.js +6 -0
  45. package/dist/map.js.map +1 -1
  46. package/package.json +2 -7
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -51,7 +52,7 @@ __export(data_table_exports, {
51
52
  module.exports = __toCommonJS(data_table_exports);
52
53
 
53
54
  // src/components/lists/data-table.tsx
54
- var import_react31 = require("react");
55
+ var import_react32 = require("react");
55
56
  var import_clsx5 = __toESM(require("clsx"), 1);
56
57
  var import_react_table = require("@tanstack/react-table");
57
58
  var import_lucide_react12 = require("lucide-react");
@@ -1560,28 +1561,60 @@ function createSelectColumn(options = {}) {
1560
1561
  meta: { width: "48px", interactive: true, mobile: "hidden", label: "Select" }
1561
1562
  };
1562
1563
  }
1564
+ function hideableColumns(table) {
1565
+ return table.getAllLeafColumns().filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide() && !column.id.startsWith("__"));
1566
+ }
1563
1567
  function DataTableViewOptions({ table, label = "View" }) {
1564
- const columns = table.getAllLeafColumns().filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide());
1568
+ const columns = hideableColumns(table);
1565
1569
  if (columns.length === 0) return null;
1570
+ const hidden = columns.filter((column) => !column.getIsVisible()).length;
1566
1571
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenu, { children: [
1567
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Button, { variant: "outline", size: "sm", className: "ms-auto hidden h-8 lg:flex", children: [
1568
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.Settings2Icon, {}),
1569
- label
1570
- ] }) }),
1571
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
1572
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1573
+ Button,
1574
+ {
1575
+ variant: "outline",
1576
+ size: "sm",
1577
+ className: "ms-auto h-8",
1578
+ "aria-label": hidden ? `${label}, ${hidden} ${hidden === 1 ? "column" : "columns"} hidden` : void 0,
1579
+ children: [
1580
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.Settings2Icon, {}),
1581
+ label,
1582
+ hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Badge, { variant: "secondary", className: "h-5 min-w-5 rounded-full px-1.5 font-normal tabular-nums", children: hidden })
1583
+ ]
1584
+ }
1585
+ ) }),
1586
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenuContent, { align: "end", className: "min-w-[180px]", children: [
1572
1587
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuLabel, { children: "Toggle columns" }),
1573
1588
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuSeparator, {}),
1574
1589
  columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1575
1590
  DropdownMenuCheckboxItem,
1576
1591
  {
1577
- className: "capitalize",
1578
1592
  checked: column.getIsVisible(),
1579
1593
  onCheckedChange: (visible) => column.toggleVisibility(visible),
1580
1594
  onSelect: (event) => event.preventDefault(),
1581
1595
  children: columnLabel(column)
1582
1596
  },
1583
1597
  column.id
1584
- ))
1598
+ )),
1599
+ hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1600
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuSeparator, {}),
1601
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1602
+ DropdownMenuItem,
1603
+ {
1604
+ onClick: () => (
1605
+ // One update: toggling the columns one by one would each start from the same state.
1606
+ table.setColumnVisibility((visibility) => ({
1607
+ ...visibility,
1608
+ ...Object.fromEntries(columns.map((column) => [column.id, true]))
1609
+ }))
1610
+ ),
1611
+ children: [
1612
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.EyeIcon, {}),
1613
+ "Show all columns"
1614
+ ]
1615
+ }
1616
+ )
1617
+ ] })
1585
1618
  ] })
1586
1619
  ] });
1587
1620
  }
@@ -1678,6 +1711,7 @@ function DataTablePagination({
1678
1711
  }
1679
1712
 
1680
1713
  // src/components/lists/data-table-fields.tsx
1714
+ var import_react28 = require("react");
1681
1715
  var import_lucide_react10 = require("lucide-react");
1682
1716
 
1683
1717
  // src/lib/format.tsx
@@ -2803,6 +2837,7 @@ function fieldToColumn(field, format = {}) {
2803
2837
  options: typeof field.filter === "object" ? field.filter.options : void 0,
2804
2838
  variant: typeof field.filter === "object" && field.filter.variant || "menu",
2805
2839
  allLabel: typeof field.filter === "object" && field.filter.allLabel || "All",
2840
+ disabled: typeof field.filter === "object" ? field.filter.disabled : void 0,
2806
2841
  describe: describeFor(field)
2807
2842
  } : void 0;
2808
2843
  const mobile = field.mobile ?? (field.type === "avatar" ? "title" : field.type === "status" ? "status" : void 0);
@@ -2942,20 +2977,31 @@ var DOT = {
2942
2977
  slate: "bg-badge-dot-slate",
2943
2978
  violet: "bg-badge-dot-violet"
2944
2979
  };
2945
- function facets(column) {
2980
+ var DataTableFacetsContext = (0, import_react28.createContext)({ manual: false });
2981
+ function useFacets(column) {
2982
+ const server = (0, import_react28.useContext)(DataTableFacetsContext);
2946
2983
  const meta = column.columnDef.meta?.filter;
2947
- const counts = /* @__PURE__ */ new Map();
2948
- for (const row of column.getFacetedRowModel().rows) {
2949
- if (row.getIsGrouped()) continue;
2950
- for (const value of filterValues(row.getValue(column.id))) counts.set(value, (counts.get(value) ?? 0) + 1);
2984
+ let counts;
2985
+ let total;
2986
+ if (server.manual) {
2987
+ const own = server.counts?.[column.id];
2988
+ counts = own ? new Map(Object.entries(own)) : null;
2989
+ total = own ? Object.values(own).reduce((sum, n) => sum + n, 0) : void 0;
2990
+ } else {
2991
+ counts = /* @__PURE__ */ new Map();
2992
+ for (const row of column.getFacetedRowModel().rows) {
2993
+ if (row.getIsGrouped()) continue;
2994
+ for (const value of filterValues(row.getValue(column.id))) counts.set(value, (counts.get(value) ?? 0) + 1);
2995
+ }
2996
+ total = column.getFacetedRowModel().rows.filter((row) => !row.getIsGrouped()).length;
2951
2997
  }
2952
- const values = meta?.options ?? [...counts.keys()].sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
2998
+ const known = counts ? [...counts.keys()] : [...new Set(column.getFacetedRowModel().rows.flatMap((row) => filterValues(row.getValue(column.id))))];
2999
+ const values = meta?.options ?? known.sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
2953
3000
  const items = values.map((value) => ({
2954
3001
  value,
2955
3002
  ...meta?.describe(value) ?? { label: value },
2956
3003
  icon: void 0
2957
3004
  }));
2958
- const total = column.getFacetedRowModel().rows.filter((row) => !row.getIsGrouped()).length;
2959
3005
  return { counts, items, total };
2960
3006
  }
2961
3007
  function singleValue(column) {
@@ -2967,10 +3013,10 @@ function singleValue(column) {
2967
3013
  }
2968
3014
  function DataTableButtonFilter({ column, title }) {
2969
3015
  const meta = column.columnDef.meta?.filter;
2970
- const { items } = facets(column);
3016
+ const { items } = useFacets(column);
2971
3017
  const { value, set } = singleValue(column);
2972
3018
  const heading = title ?? meta?.title ?? column.columnDef.meta?.label ?? column.id;
2973
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3019
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DisabledReason, { reason: meta?.disabled, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2974
3020
  ToggleGroup,
2975
3021
  {
2976
3022
  type: "single",
@@ -2978,6 +3024,7 @@ function DataTableButtonFilter({ column, title }) {
2978
3024
  size: "sm",
2979
3025
  spacing: 0,
2980
3026
  "aria-label": heading,
3027
+ disabled: Boolean(meta?.disabled),
2981
3028
  value: value || "__all",
2982
3029
  onValueChange: (next) => set(next === "__all" || !next ? "" : next),
2983
3030
  children: [
@@ -2988,28 +3035,33 @@ function DataTableButtonFilter({ column, title }) {
2988
3035
  ] }, item.value))
2989
3036
  ]
2990
3037
  }
2991
- );
3038
+ ) });
3039
+ }
3040
+ function DisabledReason({ reason, children }) {
3041
+ if (typeof reason !== "string") return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
3042
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { "data-slot": "data-table-disabled", title: reason, className: "inline-flex cursor-not-allowed", children });
2992
3043
  }
2993
3044
  function DataTableTabsFilter({ column, title }) {
2994
3045
  const meta = column.columnDef.meta?.filter;
2995
- const { counts, items, total } = facets(column);
3046
+ const { counts, items, total } = useFacets(column);
2996
3047
  const { value, set } = singleValue(column);
2997
3048
  const heading = title ?? meta?.title ?? column.columnDef.meta?.label ?? column.id;
2998
- const count = (n) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Badge, { variant: "secondary", className: "ms-1 h-5 min-w-5 rounded-full px-1.5 font-normal tabular-nums", children: n ?? 0 });
2999
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Tabs, { value: value || "__all", onValueChange: (next) => set(next === "__all" ? "" : next), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TabsList, { "aria-label": heading, children: [
3000
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TabsTrigger, { value: "__all", children: [
3049
+ const count = (n) => counts && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Badge, { variant: "secondary", className: "ms-1 h-5 min-w-5 rounded-full px-1.5 font-normal tabular-nums", children: n ?? 0 });
3050
+ const disabled = Boolean(meta?.disabled);
3051
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DisabledReason, { reason: meta?.disabled, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Tabs, { value: value || "__all", onValueChange: (next) => set(next === "__all" ? "" : next), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TabsList, { "aria-label": heading, children: [
3052
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TabsTrigger, { value: "__all", disabled, children: [
3001
3053
  meta?.allLabel ?? "All",
3002
3054
  count(total)
3003
3055
  ] }),
3004
- items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TabsTrigger, { value: item.value, children: [
3056
+ items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TabsTrigger, { value: item.value, disabled, children: [
3005
3057
  item.label,
3006
- count(counts.get(item.value))
3058
+ count(counts?.get(item.value))
3007
3059
  ] }, item.value))
3008
- ] }) });
3060
+ ] }) }) });
3009
3061
  }
3010
3062
  function DataTableFacetedFilter({ column, title, options }) {
3011
3063
  const meta = column.columnDef.meta?.filter;
3012
- const { counts, items: facetItems } = facets(column);
3064
+ const { counts, items: facetItems } = useFacets(column);
3013
3065
  const items = options ?? facetItems;
3014
3066
  const selected = new Set(column.getFilterValue() ?? []);
3015
3067
  const heading = title ?? meta?.title ?? column.columnDef.meta?.label ?? column.id;
@@ -3019,8 +3071,8 @@ function DataTableFacetedFilter({ column, title, options }) {
3019
3071
  else next.add(value);
3020
3072
  column.setFilterValue(next.size ? [...next] : void 0);
3021
3073
  };
3022
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Popover, { children: [
3023
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Button, { variant: "outline", size: "sm", className: "h-8 border-dashed", children: [
3074
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DisabledReason, { reason: meta?.disabled, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Popover, { children: [
3075
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Button, { variant: "outline", size: "sm", className: "h-8 border-dashed", disabled: Boolean(meta?.disabled), children: [
3024
3076
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react10.PlusCircleIcon, {}),
3025
3077
  heading,
3026
3078
  selected.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
@@ -3059,9 +3111,9 @@ function DataTableFacetedFilter({ column, title, options }) {
3059
3111
  item.color && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { "aria-hidden": "true", className: cn("size-2 rounded-full", DOT[item.color]) }),
3060
3112
  item.icon,
3061
3113
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: item.label }),
3062
- counts.get(item.value) ? (
3114
+ counts?.get(item.value) ? (
3063
3115
  // A shortcut slot, so it takes the item's end (and the item's own check hides).
3064
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CommandShortcut, { className: "font-mono tracking-normal", children: counts.get(item.value) })
3116
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CommandShortcut, { className: "font-mono tracking-normal", children: counts?.get(item.value) })
3065
3117
  ) : null
3066
3118
  ]
3067
3119
  },
@@ -3074,11 +3126,11 @@ function DataTableFacetedFilter({ column, title, options }) {
3074
3126
  ] })
3075
3127
  ] })
3076
3128
  ] }) })
3077
- ] });
3129
+ ] }) });
3078
3130
  }
3079
3131
 
3080
3132
  // src/components/lists/data-table-features.tsx
3081
- var import_react28 = require("react");
3133
+ var import_react29 = require("react");
3082
3134
  var import_lucide_react11 = require("lucide-react");
3083
3135
  var import_jsx_runtime27 = require("react/jsx-runtime");
3084
3136
  var EXPAND_COLUMN_ID = "expand";
@@ -3118,9 +3170,9 @@ function expandColumn() {
3118
3170
  };
3119
3171
  }
3120
3172
  var detailId = (rowId) => `data-table-detail-${rowId.replace(/[^\w-]/g, "_")}`;
3121
- var RowDragContext = (0, import_react28.createContext)(null);
3173
+ var RowDragContext = (0, import_react29.createContext)(null);
3122
3174
  function DragHandle() {
3123
- const drag = (0, import_react28.useContext)(RowDragContext);
3175
+ const drag = (0, import_react29.useContext)(RowDragContext);
3124
3176
  if (!drag) return null;
3125
3177
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3126
3178
  Button,
@@ -3214,7 +3266,7 @@ var import_sortable = require("@dnd-kit/sortable");
3214
3266
  var import_utilities = require("@dnd-kit/utilities");
3215
3267
 
3216
3268
  // src/components/lists/table.tsx
3217
- var import_react29 = require("react");
3269
+ var import_react30 = require("react");
3218
3270
  var import_jsx_runtime28 = require("react/jsx-runtime");
3219
3271
  function renderShorthand({
3220
3272
  columns,
@@ -3231,16 +3283,16 @@ function renderShorthand({
3231
3283
  footer && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TableFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TableRow, { children: cols.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TableCell, { className: column.className, children: footer[index] }, column.key)) }) })
3232
3284
  ] });
3233
3285
  }
3234
- var TableRoot = (0, import_react29.forwardRef)(function Table({ className, columns, rows, getRowKey, caption, footer, children, ...props }, ref) {
3286
+ var TableRoot = (0, import_react30.forwardRef)(function Table({ className, columns, rows, getRowKey, caption, footer, children, ...props }, ref) {
3235
3287
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "data-slot": "table-container", className: "relative w-full scrollbar-thin overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("table", { ref, "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props, children: columns ? renderShorthand({ columns, rows, getRowKey, caption, footer }) : children }) });
3236
3288
  });
3237
- var TableHeader = (0, import_react29.forwardRef)(function TableHeader2({ className, ...props }, ref) {
3289
+ var TableHeader = (0, import_react30.forwardRef)(function TableHeader2({ className, ...props }, ref) {
3238
3290
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { ref, "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props });
3239
3291
  });
3240
- var TableBody = (0, import_react29.forwardRef)(function TableBody2({ className, ...props }, ref) {
3292
+ var TableBody = (0, import_react30.forwardRef)(function TableBody2({ className, ...props }, ref) {
3241
3293
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { ref, "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props });
3242
3294
  });
3243
- var TableFooter = (0, import_react29.forwardRef)(function TableFooter2({ className, ...props }, ref) {
3295
+ var TableFooter = (0, import_react30.forwardRef)(function TableFooter2({ className, ...props }, ref) {
3244
3296
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3245
3297
  "tfoot",
3246
3298
  {
@@ -3251,7 +3303,7 @@ var TableFooter = (0, import_react29.forwardRef)(function TableFooter2({ classNa
3251
3303
  }
3252
3304
  );
3253
3305
  });
3254
- var TableRow = (0, import_react29.forwardRef)(function TableRow2({ className, ...props }, ref) {
3306
+ var TableRow = (0, import_react30.forwardRef)(function TableRow2({ className, ...props }, ref) {
3255
3307
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3256
3308
  "tr",
3257
3309
  {
@@ -3265,7 +3317,7 @@ var TableRow = (0, import_react29.forwardRef)(function TableRow2({ className, ..
3265
3317
  }
3266
3318
  );
3267
3319
  });
3268
- var TableHead = (0, import_react29.forwardRef)(function TableHead2({ className, ...props }, ref) {
3320
+ var TableHead = (0, import_react30.forwardRef)(function TableHead2({ className, ...props }, ref) {
3269
3321
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3270
3322
  "th",
3271
3323
  {
@@ -3279,7 +3331,7 @@ var TableHead = (0, import_react29.forwardRef)(function TableHead2({ className,
3279
3331
  }
3280
3332
  );
3281
3333
  });
3282
- var TableCell = (0, import_react29.forwardRef)(function TableCell2({ className, ...props }, ref) {
3334
+ var TableCell = (0, import_react30.forwardRef)(function TableCell2({ className, ...props }, ref) {
3283
3335
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3284
3336
  "td",
3285
3337
  {
@@ -3290,7 +3342,7 @@ var TableCell = (0, import_react29.forwardRef)(function TableCell2({ className,
3290
3342
  }
3291
3343
  );
3292
3344
  });
3293
- var TableCaption = (0, import_react29.forwardRef)(function TableCaption2({ className, ...props }, ref) {
3345
+ var TableCaption = (0, import_react30.forwardRef)(function TableCaption2({ className, ...props }, ref) {
3294
3346
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("caption", { ref, "data-slot": "table-caption", className: cn("text-muted-foreground mt-4 text-sm", className), ...props });
3295
3347
  });
3296
3348
 
@@ -3298,7 +3350,7 @@ var TableCaption = (0, import_react29.forwardRef)(function TableCaption2({ class
3298
3350
  var import_clsx4 = __toESM(require("clsx"), 1);
3299
3351
 
3300
3352
  // src/components/feedback/progress.tsx
3301
- var import_react30 = require("react");
3353
+ var import_react31 = require("react");
3302
3354
  var import_radix_ui9 = require("radix-ui");
3303
3355
  var import_jsx_runtime29 = require("react/jsx-runtime");
3304
3356
  var FILL2 = {
@@ -3308,7 +3360,7 @@ var FILL2 = {
3308
3360
  danger: "bg-destructive",
3309
3361
  neutral: "bg-muted-foreground"
3310
3362
  };
3311
- var Progress = (0, import_react30.forwardRef)(function Progress2({ className, value, max = 100, tone = "brand", ...props }, ref) {
3363
+ var Progress = (0, import_react31.forwardRef)(function Progress2({ className, value, max = 100, tone = "brand", ...props }, ref) {
3312
3364
  const clamped = value == null ? value : Math.min(max, Math.max(0, value));
3313
3365
  const percent = clamped == null ? 0 : clamped / max * 100;
3314
3366
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
@@ -3463,14 +3515,14 @@ function resolve(updater, previous) {
3463
3515
  return typeof updater === "function" ? updater(previous) : updater;
3464
3516
  }
3465
3517
  function useTableState(controlled, initial, onChange) {
3466
- const [inner, setInner] = (0, import_react31.useState)(initial);
3518
+ const [inner, setInner] = (0, import_react32.useState)(initial);
3467
3519
  const value = controlled ?? inner;
3468
- const latest = (0, import_react31.useRef)(value);
3520
+ const latest = (0, import_react32.useRef)(value);
3469
3521
  latest.current = value;
3470
3522
  const isControlled = controlled !== void 0;
3471
- const onChangeRef = (0, import_react31.useRef)(onChange);
3523
+ const onChangeRef = (0, import_react32.useRef)(onChange);
3472
3524
  onChangeRef.current = onChange;
3473
- const set = (0, import_react31.useCallback)(
3525
+ const set = (0, import_react32.useCallback)(
3474
3526
  (updater) => {
3475
3527
  const next = resolve(updater, latest.current);
3476
3528
  if (!isControlled) setInner(next);
@@ -3494,9 +3546,9 @@ function CellInteractionGuard({ children }) {
3494
3546
  }
3495
3547
  var HEADER_PADDING_PX = 16;
3496
3548
  function useHeaderWidths(padding, deps) {
3497
- const nodes = (0, import_react31.useRef)(/* @__PURE__ */ new Map());
3498
- const [widths, setWidths] = (0, import_react31.useState)({});
3499
- const measure = (0, import_react31.useCallback)(() => {
3549
+ const nodes = (0, import_react32.useRef)(/* @__PURE__ */ new Map());
3550
+ const [widths, setWidths] = (0, import_react32.useState)({});
3551
+ const measure = (0, import_react32.useCallback)(() => {
3500
3552
  const next = {};
3501
3553
  nodes.current.forEach((node, id) => {
3502
3554
  next[id] = Math.ceil(node.getBoundingClientRect().width) + padding;
@@ -3507,15 +3559,15 @@ function useHeaderWidths(padding, deps) {
3507
3559
  return same ? previous : next;
3508
3560
  });
3509
3561
  }, [padding]);
3510
- (0, import_react31.useLayoutEffect)(measure, [measure, deps]);
3511
- (0, import_react31.useLayoutEffect)(() => {
3562
+ (0, import_react32.useLayoutEffect)(measure, [measure, deps]);
3563
+ (0, import_react32.useLayoutEffect)(() => {
3512
3564
  let live = true;
3513
3565
  void document.fonts?.ready.then(() => live && measure());
3514
3566
  return () => {
3515
3567
  live = false;
3516
3568
  };
3517
3569
  }, [measure]);
3518
- const register = (0, import_react31.useCallback)(
3570
+ const register = (0, import_react32.useCallback)(
3519
3571
  (id) => (node) => {
3520
3572
  if (node) nodes.current.set(id, node);
3521
3573
  else nodes.current.delete(id);
@@ -3525,9 +3577,9 @@ function useHeaderWidths(padding, deps) {
3525
3577
  return { widths, register };
3526
3578
  }
3527
3579
  function useScrollEdges() {
3528
- const [node, setNode] = (0, import_react31.useState)(null);
3529
- const [edges, setEdges] = (0, import_react31.useState)({ overflowing: false, atStart: true, atEnd: true, overflowingY: false, atTop: true });
3530
- const measure = (0, import_react31.useCallback)(() => {
3580
+ const [node, setNode] = (0, import_react32.useState)(null);
3581
+ const [edges, setEdges] = (0, import_react32.useState)({ overflowing: false, atStart: true, atEnd: true, overflowingY: false, atTop: true });
3582
+ const measure = (0, import_react32.useCallback)(() => {
3531
3583
  if (!node) return;
3532
3584
  const { scrollLeft, scrollWidth, clientWidth, scrollTop, scrollHeight, clientHeight } = node;
3533
3585
  const next = {
@@ -3541,7 +3593,7 @@ function useScrollEdges() {
3541
3593
  (previous) => previous.overflowing === next.overflowing && previous.atStart === next.atStart && previous.atEnd === next.atEnd && previous.overflowingY === next.overflowingY && previous.atTop === next.atTop ? previous : next
3542
3594
  );
3543
3595
  }, [node]);
3544
- (0, import_react31.useLayoutEffect)(() => {
3596
+ (0, import_react32.useLayoutEffect)(() => {
3545
3597
  if (!node) return;
3546
3598
  measure();
3547
3599
  if (typeof ResizeObserver === "undefined") return;
@@ -3607,6 +3659,11 @@ function DataTable({
3607
3659
  bordered = true,
3608
3660
  className
3609
3661
  }) {
3662
+ const fill = maxHeight === "fill";
3663
+ const facetCounts = (0, import_react32.useMemo)(
3664
+ () => ({ manual: Boolean(manual.filtering), counts: manual.facets }),
3665
+ [manual.filtering, manual.facets]
3666
+ );
3610
3667
  if (!label && !caption) {
3611
3668
  devWarn('DataTable needs `label` or `caption`: an unnamed table is announced as just "table".');
3612
3669
  }
@@ -3621,8 +3678,8 @@ function DataTable({
3621
3678
  })),
3622
3679
  onSortingChange
3623
3680
  );
3624
- const [ownOrder, setOwnOrder] = (0, import_react31.useState)(null);
3625
- (0, import_react31.useEffect)(() => setOwnOrder(null), [data]);
3681
+ const [ownOrder, setOwnOrder] = (0, import_react32.useState)(null);
3682
+ (0, import_react32.useEffect)(() => setOwnOrder(null), [data]);
3626
3683
  const tableData = ownOrder ?? data;
3627
3684
  const moveRow = (from, to) => {
3628
3685
  const next = (0, import_sortable.arrayMove)(tableData, from, to);
@@ -3630,10 +3687,10 @@ function DataTable({
3630
3687
  else setOwnOrder(next);
3631
3688
  };
3632
3689
  const group = typeof groupBy === "string" ? { key: groupBy } : groupBy;
3633
- const [groupsExpanded, setGroupsExpanded] = (0, import_react31.useState)(group?.defaultCollapsed ? {} : true);
3634
- const [openRows, setOpenRows] = (0, import_react31.useState)(() => new Set(expand?.defaultExpanded ?? []));
3635
- const [pinOverrides, setPinOverrides] = (0, import_react31.useState)({});
3636
- const [widthOverrides, setWidthOverrides] = (0, import_react31.useState)({});
3690
+ const [groupsExpanded, setGroupsExpanded] = (0, import_react32.useState)(group?.defaultCollapsed ? {} : true);
3691
+ const [openRows, setOpenRows] = (0, import_react32.useState)(() => new Set(expand?.defaultExpanded ?? []));
3692
+ const [pinOverrides, setPinOverrides] = (0, import_react32.useState)({});
3693
+ const [widthOverrides, setWidthOverrides] = (0, import_react32.useState)({});
3637
3694
  const getRowHref = getRowHrefProp ?? (rowHref ? (row) => fillTemplate(rowHref, row) : void 0);
3638
3695
  const format = useFormat();
3639
3696
  const [globalFilter, setGlobalFilter] = useTableState(state.globalFilter, "", onGlobalFilterChange);
@@ -3650,7 +3707,7 @@ function DataTable({
3650
3707
  );
3651
3708
  const [rowSelection, setRowSelection] = useTableState(state.rowSelection, {}, onRowSelectionChange);
3652
3709
  const hasExpand = Boolean(expand);
3653
- const allColumns = (0, import_react31.useMemo)(() => {
3710
+ const allColumns = (0, import_react32.useMemo)(() => {
3654
3711
  let cols = columns.map(
3655
3712
  (column) => isFieldColumn(column) ? fieldToColumn(column, format) : column
3656
3713
  );
@@ -3701,7 +3758,7 @@ function DataTable({
3701
3758
  group?.by,
3702
3759
  reorderable
3703
3760
  ]);
3704
- const fieldsByKey = (0, import_react31.useMemo)(() => {
3761
+ const fieldsByKey = (0, import_react32.useMemo)(() => {
3705
3762
  const map = /* @__PURE__ */ new Map();
3706
3763
  for (const column of columns) if (isFieldColumn(column)) map.set(column.key, column);
3707
3764
  return map;
@@ -3725,16 +3782,16 @@ function DataTable({
3725
3782
  ...columnIds.filter((id) => !isUtility(id) && !pinOf(id)),
3726
3783
  ...columnIds.filter((id) => !isUtility(id) && pinOf(id) === "end")
3727
3784
  ].join("\0");
3728
- const columnOrder = (0, import_react31.useMemo)(() => orderKey.split("\0"), [orderKey]);
3785
+ const columnOrder = (0, import_react32.useMemo)(() => orderKey.split("\0"), [orderKey]);
3729
3786
  const anyStartPin = columnIds.some((id) => !isUtility(id) && pinOf(id) === "start");
3730
3787
  const effectivePin = (id) => isUtility(id) ? anyStartPin ? "start" : void 0 : pinOf(id);
3731
3788
  const grouped = Boolean(group);
3732
3789
  const groupDesc = group?.order === "desc";
3733
- const effectiveSorting = (0, import_react31.useMemo)(
3790
+ const effectiveSorting = (0, import_react32.useMemo)(
3734
3791
  () => grouped ? [{ id: GROUP_COLUMN_ID, desc: groupDesc }, ...sorting.filter((sort) => sort.id !== GROUP_COLUMN_ID)] : sorting,
3735
3792
  [grouped, groupDesc, sorting]
3736
3793
  );
3737
- const effectiveVisibility = (0, import_react31.useMemo)(
3794
+ const effectiveVisibility = (0, import_react32.useMemo)(
3738
3795
  () => grouped ? { ...columnVisibility, [GROUP_COLUMN_ID]: false } : columnVisibility,
3739
3796
  [grouped, columnVisibility]
3740
3797
  );
@@ -3758,7 +3815,7 @@ function DataTable({
3758
3815
  }
3759
3816
  ) : expand.fields ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DetailFields, { row, fields: expand.fields }) : null
3760
3817
  } : void 0;
3761
- const searchTextById = (0, import_react31.useMemo)(() => {
3818
+ const searchTextById = (0, import_react32.useMemo)(() => {
3762
3819
  const map = /* @__PURE__ */ new Map();
3763
3820
  for (const column of allColumns) {
3764
3821
  const text = column.meta?.searchText;
@@ -3826,8 +3883,8 @@ function DataTable({
3826
3883
  enableSortingRemoval: false,
3827
3884
  ...tableOptions
3828
3885
  });
3829
- const selectionReported = (0, import_react31.useRef)(false);
3830
- (0, import_react31.useEffect)(() => {
3886
+ const selectionReported = (0, import_react32.useRef)(false);
3887
+ (0, import_react32.useEffect)(() => {
3831
3888
  if (!onSelectionChange) return;
3832
3889
  if (!selectionReported.current) {
3833
3890
  selectionReported.current = true;
@@ -3836,9 +3893,9 @@ function DataTable({
3836
3893
  onSelectionChange(table.getSelectedRowModel().rows.map((row) => row.original));
3837
3894
  }, [rowSelection]);
3838
3895
  const [wrapRef, containerWidth] = useElementWidth();
3839
- const captionId = (0, import_react31.useId)();
3896
+ const captionId = (0, import_react32.useId)();
3840
3897
  const breakpoint = responsive === false ? 0 : typeof responsive === "object" ? responsive.breakpoint ?? DEFAULT_CARD_BREAKPOINT_PX : DEFAULT_CARD_BREAKPOINT_PX;
3841
- const modeRef = (0, import_react31.useRef)("table");
3898
+ const modeRef = (0, import_react32.useRef)("table");
3842
3899
  const mode = nextLayoutMode(modeRef.current, containerWidth, breakpoint);
3843
3900
  modeRef.current = mode;
3844
3901
  const search = searchable === true ? {} : searchable || void 0;
@@ -3865,7 +3922,8 @@ function DataTable({
3865
3922
  const filterColumns = table.getAllLeafColumns().filter((column) => column.columnDef.meta?.filter);
3866
3923
  const tabsFilters = filterColumns.filter((column) => column.columnDef.meta?.filter?.variant === "tabs");
3867
3924
  const isToolbarFilter = (id) => filterColumns.some((c) => c.id === id && c.columnDef.meta?.filter?.variant !== "tabs");
3868
- const showToolbar = Boolean(search || toolbar || showColumnMenu || filterColumns.length > tabsFilters.length);
3925
+ const viewMenu = showColumnMenu || hideableColumns(table).some((column) => !column.getIsVisible());
3926
+ const showToolbar = Boolean(search || toolbar || viewMenu || filterColumns.length > tabsFilters.length);
3869
3927
  const reorderActive = reorderable && sorting.length === 0 && !filtering && !group;
3870
3928
  const showPager = paginated && !error && table.getRowCount() > 0;
3871
3929
  const view = {
@@ -3908,48 +3966,64 @@ function DataTable({
3908
3966
  summary: (row) => groupSummary(row, group.summary ?? [], formatOf, format)
3909
3967
  } : void 0
3910
3968
  };
3911
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-slot": "data-table", className: cn("relative flex flex-col gap-4", className), children: [
3912
- tabsFilters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("flex flex-wrap items-center gap-2", !bordered && "px-4 pt-3"), children: tabsFilters.map((column) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableTabsFilter, { column }, column.id)) }),
3913
- showToolbar && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("flex items-center justify-between gap-2", !bordered && "px-4 pt-3"), children: [
3914
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
3915
- search && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3916
- Input,
3917
- {
3918
- type: "search",
3919
- "aria-label": search.label ?? "Filter",
3920
- placeholder: search.placeholder ?? "Filter...",
3921
- value: searchValue,
3922
- onChange: (event) => setSearchValue(event.target.value),
3923
- className: "h-8 w-[150px] lg:w-[250px]"
3924
- }
3925
- ),
3926
- filterColumns.map(
3927
- (column) => column.columnDef.meta?.filter?.variant === "buttons" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableButtonFilter, { column }, column.id) : column.columnDef.meta?.filter?.variant === "tabs" ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableFacetedFilter, { column }, column.id)
3928
- ),
3929
- columnFilters.some((f) => isToolbarFilter(f.id)) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
3930
- Button,
3969
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableFacetsContext.Provider, { value: facetCounts, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
3970
+ "div",
3971
+ {
3972
+ "data-slot": "data-table",
3973
+ "data-fill": fill || void 0,
3974
+ className: cn("relative flex flex-col gap-4", fill && "h-full min-h-0 flex-1", className),
3975
+ children: [
3976
+ tabsFilters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("flex shrink-0 flex-wrap items-center gap-2", !bordered && "px-4 pt-3"), children: tabsFilters.map((column) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableTabsFilter, { column }, column.id)) }),
3977
+ showToolbar && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("flex shrink-0 items-center justify-between gap-2", !bordered && "px-4 pt-3"), children: [
3978
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
3979
+ search && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DisabledReason, { reason: search.disabled, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3980
+ Input,
3981
+ {
3982
+ type: "search",
3983
+ "aria-label": search.label ?? "Filter",
3984
+ placeholder: search.placeholder ?? "Filter...",
3985
+ value: searchValue,
3986
+ onChange: (event) => setSearchValue(event.target.value),
3987
+ disabled: Boolean(search.disabled),
3988
+ className: "h-8 w-[150px] lg:w-[250px]"
3989
+ }
3990
+ ) }),
3991
+ filterColumns.map(
3992
+ (column) => column.columnDef.meta?.filter?.variant === "buttons" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableButtonFilter, { column }, column.id) : column.columnDef.meta?.filter?.variant === "tabs" ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableFacetedFilter, { column }, column.id)
3993
+ ),
3994
+ columnFilters.some((f) => isToolbarFilter(f.id)) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
3995
+ Button,
3996
+ {
3997
+ variant: "ghost",
3998
+ size: "sm",
3999
+ onClick: () => table.setColumnFilters((current) => current.filter((f) => !isToolbarFilter(f.id))),
4000
+ children: [
4001
+ "Reset",
4002
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react12.XIcon, {})
4003
+ ]
4004
+ }
4005
+ ),
4006
+ toolbar
4007
+ ] }),
4008
+ viewMenu && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableViewOptions, { table }) })
4009
+ ] }),
4010
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", "aria-live": "polite", className: "sr-only", children: filtering && !loading ? `${resultCount} ${resultCount === 1 ? "result" : "results"}` : "" }),
4011
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4012
+ "div",
3931
4013
  {
3932
- variant: "ghost",
3933
- size: "sm",
3934
- onClick: () => table.setColumnFilters((current) => current.filter((f) => !isToolbarFilter(f.id))),
4014
+ ref: wrapRef,
4015
+ className: cn("overflow-hidden bg-background", bordered && "rounded-md border", fill && "flex min-h-0 flex-1 flex-col"),
3935
4016
  children: [
3936
- "Reset",
3937
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react12.XIcon, {})
4017
+ mode === "cards" && caption && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: captionId, className: "shrink-0 px-4 pt-3 text-left text-sm text-muted-foreground", children: caption }),
4018
+ mode === "cards" ? maxHeight ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardScroll, { label, maxHeight, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardList, { ...view }) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardList, { ...view }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TableView, { ...view }),
4019
+ footer && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "shrink-0 border-t p-2", children: footer })
3938
4020
  ]
3939
4021
  }
3940
4022
  ),
3941
- toolbar
3942
- ] }),
3943
- showColumnMenu && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableViewOptions, { table }) })
3944
- ] }),
3945
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", "aria-live": "polite", className: "sr-only", children: filtering && !loading ? `${resultCount} ${resultCount === 1 ? "result" : "results"}` : "" }),
3946
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: wrapRef, className: cn("overflow-hidden bg-background", bordered && "rounded-md border"), children: [
3947
- mode === "cards" && caption && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: captionId, className: "px-4 pt-3 text-left text-sm text-muted-foreground", children: caption }),
3948
- mode === "cards" ? maxHeight ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardScroll, { label, maxHeight, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardList, { ...view }) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CardList, { ...view }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TableView, { ...view }),
3949
- footer && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "border-t p-2", children: footer })
3950
- ] }),
3951
- showPager && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn(!bordered && "px-2 pb-3"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTablePagination, { table, pageSizeOptions }) })
3952
- ] });
4023
+ showPager && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("shrink-0", !bordered && "px-2 pb-3"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTablePagination, { table, pageSizeOptions }) })
4024
+ ]
4025
+ }
4026
+ ) });
3953
4027
  }
3954
4028
  var verticalOnly = ({ transform }) => ({ ...transform, x: 0 });
3955
4029
  function titleColumnId(columns) {
@@ -4024,7 +4098,7 @@ function TableView({
4024
4098
  const direction = scroll.overflowing && maxHeight && scroll.overflowingY ? "scrolls" : scroll.overflowing ? "scrolls horizontally" : "scrolls vertically";
4025
4099
  const regionLabel = `${label ?? "Table"} (${direction})`;
4026
4100
  const pinnedHeader = maxHeight ? (0, import_clsx5.default)("sticky top-0 z-sticky bg-background", !scroll.atTop && "shadow-[inset_0_-1px_0_var(--border)]") : void 0;
4027
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative", children: [
4101
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("relative", maxHeight === "fill" && "flex min-h-0 flex-1 flex-col"), children: [
4028
4102
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4029
4103
  "div",
4030
4104
  {
@@ -4032,10 +4106,11 @@ function TableView({
4032
4106
  onScroll: scroll.onScroll,
4033
4107
  className: cn(
4034
4108
  maxHeight ? "overflow-auto overscroll-contain" : "overflow-x-auto overscroll-x-contain",
4109
+ maxHeight === "fill" && "min-h-0 flex-1",
4035
4110
  SCROLLBAR_CLASSES,
4036
4111
  scrolls && FOCUS_RING_INSET
4037
4112
  ),
4038
- style: maxHeight ? { maxHeight } : void 0,
4113
+ style: maxHeight && maxHeight !== "fill" ? { maxHeight } : void 0,
4039
4114
  ...scrolls ? { role: "region", tabIndex: 0, "aria-label": regionLabel } : {},
4040
4115
  children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4041
4116
  DndWrapper,
@@ -4126,7 +4201,7 @@ function TableView({
4126
4201
  getRowTone,
4127
4202
  getRowDimmed
4128
4203
  };
4129
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react31.Fragment, { children: [
4204
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react32.Fragment, { children: [
4130
4205
  reorder ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4131
4206
  SortableBodyRow,
4132
4207
  {
@@ -4329,12 +4404,12 @@ function GroupRow({
4329
4404
  ) }) });
4330
4405
  }
4331
4406
  function usePinOffsets(key) {
4332
- const nodes = (0, import_react31.useRef)(/* @__PURE__ */ new Map());
4333
- const [offsets, setOffsets] = (0, import_react31.useState)({
4407
+ const nodes = (0, import_react32.useRef)(/* @__PURE__ */ new Map());
4408
+ const [offsets, setOffsets] = (0, import_react32.useState)({
4334
4409
  start: {},
4335
4410
  end: {}
4336
4411
  });
4337
- (0, import_react31.useLayoutEffect)(() => {
4412
+ (0, import_react32.useLayoutEffect)(() => {
4338
4413
  const cells = [...nodes.current.entries()].filter(([, node]) => node.isConnected);
4339
4414
  cells.sort(([, a], [, b]) => a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
4340
4415
  const start = {};
@@ -4353,7 +4428,7 @@ function usePinOffsets(key) {
4353
4428
  (current) => JSON.stringify(current) === JSON.stringify({ start, end }) ? current : { start, end }
4354
4429
  );
4355
4430
  }, [key]);
4356
- const register = (0, import_react31.useCallback)(
4431
+ const register = (0, import_react32.useCallback)(
4357
4432
  (id) => (node) => {
4358
4433
  if (node) nodes.current.set(id, node);
4359
4434
  else nodes.current.delete(id);
@@ -4369,7 +4444,7 @@ function ResizeHandle({
4369
4444
  width,
4370
4445
  onResize
4371
4446
  }) {
4372
- const [now, setNow] = (0, import_react31.useState)();
4447
+ const [now, setNow] = (0, import_react32.useState)();
4373
4448
  const set = (next) => {
4374
4449
  const clamped = next === void 0 ? void 0 : Math.max(floor, Math.round(next));
4375
4450
  setNow(clamped);
@@ -4424,13 +4499,14 @@ function ResizeHandle({
4424
4499
  }
4425
4500
  function CardScroll({ label, maxHeight, children }) {
4426
4501
  const scroll = useScrollEdges();
4502
+ const fill = maxHeight === "fill";
4427
4503
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4428
4504
  "div",
4429
4505
  {
4430
4506
  ref: scroll.ref,
4431
4507
  onScroll: scroll.onScroll,
4432
- style: { maxHeight },
4433
- className: cn("overflow-y-auto overscroll-contain", SCROLLBAR_CLASSES, scroll.overflowingY && FOCUS_RING_INSET),
4508
+ style: fill ? void 0 : { maxHeight },
4509
+ className: cn("overflow-y-auto overscroll-contain", fill && "min-h-0 flex-1", SCROLLBAR_CLASSES, scroll.overflowingY && FOCUS_RING_INSET),
4434
4510
  ...scroll.overflowingY ? { role: "region", tabIndex: 0, "aria-label": `${label ?? "Table"} (scrolls vertically)` } : {},
4435
4511
  children
4436
4512
  }