@upbound/monarch-blocks 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -214,6 +214,14 @@ function isFilterOnlyColumn(column) {
214
214
  var _a;
215
215
  return ((_a = column.columnDef.meta) == null ? void 0 : _a.filterOnly) === true;
216
216
  }
217
+ function hasFilterableColumns(columns) {
218
+ return columns.some(
219
+ (column) => {
220
+ var _a;
221
+ return !isFilterOnlyColumn(column) && column.getCanFilter() && !!((_a = column.columnDef.meta) == null ? void 0 : _a.filter);
222
+ }
223
+ );
224
+ }
217
225
  function getTableState({
218
226
  error,
219
227
  loading,
@@ -447,6 +455,7 @@ function ColumnOptions({
447
455
  import { Button as Button2 } from "@upbound/monarch-core";
448
456
  import { DropdownMenu as DropdownMenu2, DropdownMenuContent as DropdownMenuContent2, DropdownMenuItem as DropdownMenuItem2, DropdownMenuTrigger as DropdownMenuTrigger2 } from "@upbound/monarch-core";
449
457
  import { Icon as Icon2 } from "@upbound/monarch-core";
458
+ import { Link } from "@upbound/monarch-core";
450
459
 
451
460
  // src/relative-time.tsx
452
461
  import * as React2 from "react";
@@ -662,7 +671,7 @@ function getExpandColumnDefinition(options) {
662
671
  function DataTableValueCell({ content, title, className, href, onClick }) {
663
672
  const baseClassName = cn("text-body truncate", className);
664
673
  if (href) {
665
- return /* @__PURE__ */ jsx4("p", { className: baseClassName, children: /* @__PURE__ */ jsx4("a", { href, title, className: "underline hover:no-underline", onClick, children: content }) });
674
+ return /* @__PURE__ */ jsx4("p", { className: baseClassName, children: /* @__PURE__ */ jsx4(Link, { href, title, onClick, children: content }) });
666
675
  }
667
676
  if (title) {
668
677
  return /* @__PURE__ */ jsxs3(Tooltip, { children: [
@@ -689,7 +698,7 @@ function TimestampCell({ timestamp }) {
689
698
  }
690
699
 
691
700
  // src/data-table/data-table.tsx
692
- import * as React8 from "react";
701
+ import * as React9 from "react";
693
702
  import {
694
703
  getCoreRowModel,
695
704
  getExpandedRowModel,
@@ -1718,6 +1727,7 @@ function CelFilterBar({
1718
1727
  (_a = onCompileResultChangeRef.current) == null ? void 0 : _a.call(onCompileResultChangeRef, __spreadProps(__spreadValues({}, displayResult), { isEmitReady }));
1719
1728
  }, [displayResult, isEmitReady]);
1720
1729
  const conditions = tree.root.children.filter(isCelFilterCondition);
1730
+ const containerRef = React3.useRef(null);
1721
1731
  function handleAddFilter(columnId) {
1722
1732
  const condition = createDefaultCondition({ schema, columnId });
1723
1733
  onChange(appendCondition(tree, condition));
@@ -1732,8 +1742,8 @@ function CelFilterBar({
1732
1742
  onChange({ root: __spreadProps(__spreadValues({}, tree.root), { children: [] }) });
1733
1743
  editor.clearSuppress();
1734
1744
  }
1735
- return /* @__PURE__ */ jsxs4("div", { "data-slot": "cel-filter-bar", className: cn("flex flex-wrap items-center gap-2", className), children: [
1736
- /* @__PURE__ */ jsx5(CelAddFilterButton, { schema, conditions, onSelect: handleAddFilter }),
1745
+ return /* @__PURE__ */ jsxs4("div", { "data-slot": "cel-filter-bar", className: cn("flex flex-wrap items-center gap-2", className), ref: containerRef, children: [
1746
+ /* @__PURE__ */ jsx5(CelAddFilterButton, { schema, conditions, onSelect: handleAddFilter, container: containerRef }),
1737
1747
  conditions.map((condition) => {
1738
1748
  const columnDef = resolveColumnDefinition(condition, schema);
1739
1749
  if (!columnDef) return null;
@@ -1748,7 +1758,8 @@ function CelFilterBar({
1748
1758
  controller: editor.getController(condition.id),
1749
1759
  issues: displayResult.issues.filter((issue) => issue.nodeId === condition.id),
1750
1760
  onRemove: () => handleRemove(condition.id),
1751
- onRestrictedOptionSelect
1761
+ onRestrictedOptionSelect,
1762
+ container: containerRef
1752
1763
  },
1753
1764
  condition.id
1754
1765
  );
@@ -1759,7 +1770,8 @@ function CelFilterBar({
1759
1770
  function CelAddFilterButton({
1760
1771
  schema,
1761
1772
  conditions,
1762
- onSelect
1773
+ onSelect,
1774
+ container
1763
1775
  }) {
1764
1776
  var _a, _b;
1765
1777
  const usedSingleInstanceColumnIds = new Set(
@@ -1790,7 +1802,7 @@ function CelAddFilterButton({
1790
1802
  /* @__PURE__ */ jsx5(Icon3, { name: "plus", "data-icon": "inline-start" }),
1791
1803
  "Add filter"
1792
1804
  ] }),
1793
- /* @__PURE__ */ jsxs4(ComboboxContent, { align: "start", className: "w-64", children: [
1805
+ /* @__PURE__ */ jsxs4(ComboboxContent, { container, align: "start", className: "w-64", children: [
1794
1806
  /* @__PURE__ */ jsx5(ComboboxInput, { showTrigger: false, placeholder: "Search filters\u2026" }),
1795
1807
  /* @__PURE__ */ jsx5(ComboboxEmpty, { children: "No filters found." }),
1796
1808
  /* @__PURE__ */ jsx5(ComboboxList, { children: (group) => /* @__PURE__ */ jsxs4(ComboboxGroup, { items: group.items, children: [
@@ -1854,7 +1866,8 @@ function CelFilterPill({
1854
1866
  controller,
1855
1867
  issues,
1856
1868
  onRemove,
1857
- onRestrictedOptionSelect
1869
+ onRestrictedOptionSelect,
1870
+ container
1858
1871
  }) {
1859
1872
  var _a;
1860
1873
  const shape = (_a = resolveFilterShape(condition, schema)) != null ? _a : columnDef.filterType;
@@ -1871,7 +1884,8 @@ function CelFilterPill({
1871
1884
  controller,
1872
1885
  issues,
1873
1886
  onRemove,
1874
- onRestrictedOptionSelect
1887
+ onRestrictedOptionSelect,
1888
+ container
1875
1889
  }
1876
1890
  );
1877
1891
  }
@@ -1886,7 +1900,8 @@ function CelFilterPill({
1886
1900
  controller,
1887
1901
  issues,
1888
1902
  onRemove,
1889
- onRestrictedOptionSelect
1903
+ onRestrictedOptionSelect,
1904
+ container
1890
1905
  }
1891
1906
  );
1892
1907
  }
@@ -1996,7 +2011,8 @@ function CelCheckboxComboboxPill({
1996
2011
  controller,
1997
2012
  issues,
1998
2013
  onRemove,
1999
- onRestrictedOptionSelect
2014
+ onRestrictedOptionSelect,
2015
+ container
2000
2016
  }) {
2001
2017
  var _a;
2002
2018
  const options = (_a = columnDef.options) != null ? _a : [];
@@ -2055,7 +2071,7 @@ function CelCheckboxComboboxPill({
2055
2071
  ),
2056
2072
  /* @__PURE__ */ jsx5(Button3, { variant: "outline", size: "icon", "aria-label": `Remove ${columnDef.title} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx5(Icon3, { name: "xmark" }) })
2057
2073
  ] }),
2058
- /* @__PURE__ */ jsxs4(ComboboxContent, { className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
2074
+ /* @__PURE__ */ jsxs4(ComboboxContent, { container, className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
2059
2075
  /* @__PURE__ */ jsx5(ComboboxInput, { showTrigger: false, placeholder: `Search ${columnDef.title.toLowerCase()}\u2026` }),
2060
2076
  selected.length > 0 && /* @__PURE__ */ jsxs4(Fragment3, { children: [
2061
2077
  /* @__PURE__ */ jsxs4(ComboboxSelectedChips, { children: [
@@ -2084,7 +2100,8 @@ function CelRadioComboboxPill({
2084
2100
  controller,
2085
2101
  issues,
2086
2102
  onRemove,
2087
- onRestrictedOptionSelect
2103
+ onRestrictedOptionSelect,
2104
+ container
2088
2105
  }) {
2089
2106
  var _a, _b;
2090
2107
  const options = (_a = columnDef.options) != null ? _a : [];
@@ -2139,7 +2156,7 @@ function CelRadioComboboxPill({
2139
2156
  ),
2140
2157
  /* @__PURE__ */ jsx5(Button3, { variant: "outline", size: "icon", "aria-label": `Remove ${columnDef.title} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx5(Icon3, { name: "xmark" }) })
2141
2158
  ] }),
2142
- /* @__PURE__ */ jsxs4(ComboboxContent, { className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
2159
+ /* @__PURE__ */ jsxs4(ComboboxContent, { container, className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
2143
2160
  /* @__PURE__ */ jsx5(ComboboxInput, { showTrigger: false, placeholder: `Search ${columnDef.title.toLowerCase()}\u2026` }),
2144
2161
  /* @__PURE__ */ jsxs4(ComboboxEmpty, { children: [
2145
2162
  "No ",
@@ -2341,7 +2358,7 @@ function CelDateValueEditor({
2341
2358
  }
2342
2359
 
2343
2360
  // src/data-table/data-table.tsx
2344
- import { Icon as Icon8 } from "@upbound/monarch-core";
2361
+ import { Icon as Icon9 } from "@upbound/monarch-core";
2345
2362
  import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
2346
2363
 
2347
2364
  // src/lib/data-table/contextual-filters.ts
@@ -2939,6 +2956,18 @@ function useGridLayout({
2939
2956
  };
2940
2957
  }
2941
2958
 
2959
+ // src/hooks/use-filter-visibility.ts
2960
+ import * as React5 from "react";
2961
+ function useFilterVisibility(filterVisibility) {
2962
+ var _a, _b, _c;
2963
+ const config = typeof filterVisibility === "object" ? filterVisibility : void 0;
2964
+ const [innerVisible, setInnerVisible] = React5.useState((_a = config == null ? void 0 : config.defaultVisible) != null ? _a : false);
2965
+ const showFilterToggle = filterVisibility !== false;
2966
+ const filterRowVisible = (_b = config == null ? void 0 : config.visible) != null ? _b : innerVisible;
2967
+ const setFilterRowVisible = (_c = config == null ? void 0 : config.onVisibleChange) != null ? _c : setInnerVisible;
2968
+ return { showFilterToggle, filterRowVisible, setFilterRowVisible };
2969
+ }
2970
+
2942
2971
  // src/data-table/empty-view.tsx
2943
2972
  import { Alert, AlertDescription } from "@upbound/monarch-core";
2944
2973
  import { Button as Button4 } from "@upbound/monarch-core";
@@ -2991,9 +3020,34 @@ function DataTableEmptyView({
2991
3020
  ] }) });
2992
3021
  }
2993
3022
 
3023
+ // src/data-table/filter-toggle.tsx
3024
+ import { Icon as Icon5, Toggle } from "@upbound/monarch-core";
3025
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
3026
+ function FilterToggle({ pressed, onPressedChange, count }) {
3027
+ return /* @__PURE__ */ jsxs6(
3028
+ Toggle,
3029
+ {
3030
+ variant: "outline",
3031
+ pressed,
3032
+ onPressedChange,
3033
+ "aria-label": "Toggle filters",
3034
+ className: "shrink-0 gap-1.5",
3035
+ children: [
3036
+ /* @__PURE__ */ jsx7(Icon5, { name: "filter", "data-icon": "inline-start" }),
3037
+ "Filter",
3038
+ !!count && /* @__PURE__ */ jsxs6("span", { className: "tabular-nums", children: [
3039
+ "(",
3040
+ count,
3041
+ ")"
3042
+ ] })
3043
+ ]
3044
+ }
3045
+ );
3046
+ }
3047
+
2994
3048
  // src/data-table/pagination.tsx
2995
3049
  import { Button as Button5 } from "@upbound/monarch-core";
2996
- import { Icon as Icon5 } from "@upbound/monarch-core";
3050
+ import { Icon as Icon6 } from "@upbound/monarch-core";
2997
3051
  import { Label as Label2 } from "@upbound/monarch-core";
2998
3052
  import {
2999
3053
  Pagination,
@@ -3004,7 +3058,7 @@ import {
3004
3058
  } from "@upbound/monarch-core";
3005
3059
  import { Select as Select2, SelectContent as SelectContent2, SelectGroup as SelectGroup2, SelectItem as SelectItem2, SelectTrigger as SelectTrigger2, SelectValue as SelectValue2 } from "@upbound/monarch-core";
3006
3060
  import { Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2 } from "@upbound/monarch-core";
3007
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
3061
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
3008
3062
  var DEFAULT_PAGINATION_CONFIG = {
3009
3063
  summary: true,
3010
3064
  arrows: true,
@@ -3043,36 +3097,36 @@ function DataTablePagination({
3043
3097
  const currentPage = pageIndex + 1;
3044
3098
  const mounted = useMounted();
3045
3099
  const locale = mounted ? void 0 : "en-US";
3046
- return /* @__PURE__ */ jsxs6("div", { "data-testid": "table-footer", className: "flex items-center justify-between px-2 pt-4", children: [
3047
- resolved.summary ? /* @__PURE__ */ jsxs6("div", { className: "text-body text-muted-foreground", "data-testid": "table-pagination-summary", children: [
3100
+ return /* @__PURE__ */ jsxs7("div", { "data-testid": "table-footer", className: "flex items-center justify-between px-2 pt-4", children: [
3101
+ resolved.summary ? /* @__PURE__ */ jsxs7("div", { className: "text-body text-muted-foreground", "data-testid": "table-pagination-summary", children: [
3048
3102
  "Showing ",
3049
- /* @__PURE__ */ jsx7("span", { className: "text-foreground font-medium", children: itemStart.toLocaleString(locale) }),
3103
+ /* @__PURE__ */ jsx8("span", { className: "text-foreground font-medium", children: itemStart.toLocaleString(locale) }),
3050
3104
  " to",
3051
3105
  " ",
3052
- /* @__PURE__ */ jsx7("span", { className: "text-foreground font-medium", children: itemEnd.toLocaleString(locale) }),
3106
+ /* @__PURE__ */ jsx8("span", { className: "text-foreground font-medium", children: itemEnd.toLocaleString(locale) }),
3053
3107
  " of",
3054
3108
  " ",
3055
- /* @__PURE__ */ jsxs6("span", { className: "text-foreground font-medium", children: [
3109
+ /* @__PURE__ */ jsxs7("span", { className: "text-foreground font-medium", children: [
3056
3110
  rowCount.toLocaleString(locale),
3057
3111
  !isRowCountExact && "+"
3058
3112
  ] }),
3059
3113
  " ",
3060
3114
  "results",
3061
- !isRowCountExact && /* @__PURE__ */ jsxs6(Tooltip2, { children: [
3062
- /* @__PURE__ */ jsx7(TooltipTrigger2, { className: "ml-1 align-middle", children: /* @__PURE__ */ jsx7(Icon5, { name: "circle-info", size: "sm" }) }),
3063
- /* @__PURE__ */ jsx7(TooltipContent2, { children: "Add filters or refine your search to reduce the result set." })
3115
+ !isRowCountExact && /* @__PURE__ */ jsxs7(Tooltip2, { children: [
3116
+ /* @__PURE__ */ jsx8(TooltipTrigger2, { className: "ml-1 align-middle", children: /* @__PURE__ */ jsx8(Icon6, { name: "circle-info", size: "sm" }) }),
3117
+ /* @__PURE__ */ jsx8(TooltipContent2, { children: "Add filters or refine your search to reduce the result set." })
3064
3118
  ] })
3065
- ] }) : /* @__PURE__ */ jsx7("div", {}),
3066
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4", children: [
3067
- resolved.pageSizeSelector && /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
3068
- /* @__PURE__ */ jsx7(Label2, { htmlFor: PAGE_SIZE_SELECT_ID, className: "font-semibold", children: "Rows per page" }),
3069
- /* @__PURE__ */ jsxs6(Select2, { value: String(effectivePageSize), onValueChange: (value) => onPageSizeChange(Number(value)), children: [
3070
- /* @__PURE__ */ jsx7(SelectTrigger2, { id: PAGE_SIZE_SELECT_ID, size: "sm", className: "w-18", "data-testid": "table-page-size-select", children: /* @__PURE__ */ jsx7(SelectValue2, {}) }),
3071
- /* @__PURE__ */ jsx7(SelectContent2, { align: "end", children: /* @__PURE__ */ jsx7(SelectGroup2, { children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx7(SelectItem2, { value: String(option), children: option }, option)) }) })
3119
+ ] }) : /* @__PURE__ */ jsx8("div", {}),
3120
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-4", children: [
3121
+ resolved.pageSizeSelector && /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
3122
+ /* @__PURE__ */ jsx8(Label2, { htmlFor: PAGE_SIZE_SELECT_ID, className: "font-semibold", children: "Rows per page" }),
3123
+ /* @__PURE__ */ jsxs7(Select2, { value: String(effectivePageSize), onValueChange: (value) => onPageSizeChange(Number(value)), children: [
3124
+ /* @__PURE__ */ jsx8(SelectTrigger2, { id: PAGE_SIZE_SELECT_ID, size: "sm", className: "w-18", "data-testid": "table-page-size-select", children: /* @__PURE__ */ jsx8(SelectValue2, {}) }),
3125
+ /* @__PURE__ */ jsx8(SelectContent2, { align: "end", children: /* @__PURE__ */ jsx8(SelectGroup2, { children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx8(SelectItem2, { value: String(option), children: option }, option)) }) })
3072
3126
  ] })
3073
3127
  ] }),
3074
- pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx7(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs6(PaginationContent, { children: [
3075
- resolved.arrows && /* @__PURE__ */ jsx7(PaginationItem, { children: /* @__PURE__ */ jsx7(
3128
+ pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx8(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs7(PaginationContent, { children: [
3129
+ resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
3076
3130
  Button5,
3077
3131
  {
3078
3132
  variant: "outline",
@@ -3080,10 +3134,10 @@ function DataTablePagination({
3080
3134
  "aria-label": "Go to first page",
3081
3135
  disabled: currentPage <= 1,
3082
3136
  onClick: () => onPageChange(1),
3083
- children: /* @__PURE__ */ jsx7(Icon5, { name: "chevrons-left", className: "cn-rtl-flip" })
3137
+ children: /* @__PURE__ */ jsx8(Icon6, { name: "chevrons-left", className: "cn-rtl-flip" })
3084
3138
  }
3085
3139
  ) }),
3086
- resolved.arrows && /* @__PURE__ */ jsx7(PaginationItem, { children: /* @__PURE__ */ jsx7(
3140
+ resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
3087
3141
  Button5,
3088
3142
  {
3089
3143
  variant: "outline",
@@ -3091,11 +3145,11 @@ function DataTablePagination({
3091
3145
  "aria-label": "Go to previous page",
3092
3146
  disabled: currentPage <= 1,
3093
3147
  onClick: () => onPageChange(currentPage - 1),
3094
- children: /* @__PURE__ */ jsx7(Icon5, { name: "chevron-left", className: "cn-rtl-flip" })
3148
+ children: /* @__PURE__ */ jsx8(Icon6, { name: "chevron-left", className: "cn-rtl-flip" })
3095
3149
  }
3096
3150
  ) }),
3097
3151
  resolved.numbers && visiblePages.map(
3098
- (page, index) => page === void 0 ? /* @__PURE__ */ jsx7(PaginationItem, { children: /* @__PURE__ */ jsx7(PaginationEllipsis, {}) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx7(PaginationItem, { children: /* @__PURE__ */ jsx7(
3152
+ (page, index) => page === void 0 ? /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(PaginationEllipsis, {}) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
3099
3153
  PaginationLink,
3100
3154
  {
3101
3155
  href: "#",
@@ -3108,7 +3162,7 @@ function DataTablePagination({
3108
3162
  }
3109
3163
  ) }, page)
3110
3164
  ),
3111
- resolved.arrows && /* @__PURE__ */ jsx7(PaginationItem, { children: /* @__PURE__ */ jsx7(
3165
+ resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
3112
3166
  Button5,
3113
3167
  {
3114
3168
  variant: "outline",
@@ -3116,10 +3170,10 @@ function DataTablePagination({
3116
3170
  "aria-label": "Go to next page",
3117
3171
  disabled: currentPage >= pageCount,
3118
3172
  onClick: () => onPageChange(currentPage + 1),
3119
- children: /* @__PURE__ */ jsx7(Icon5, { name: "chevron-right", className: "cn-rtl-flip" })
3173
+ children: /* @__PURE__ */ jsx8(Icon6, { name: "chevron-right", className: "cn-rtl-flip" })
3120
3174
  }
3121
3175
  ) }),
3122
- resolved.arrows && /* @__PURE__ */ jsx7(PaginationItem, { children: /* @__PURE__ */ jsx7(
3176
+ resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
3123
3177
  Button5,
3124
3178
  {
3125
3179
  variant: "outline",
@@ -3127,7 +3181,7 @@ function DataTablePagination({
3127
3181
  "aria-label": "Go to last page",
3128
3182
  disabled: currentPage >= pageCount,
3129
3183
  onClick: () => onPageChange(pageCount),
3130
- children: /* @__PURE__ */ jsx7(Icon5, { name: "chevrons-right", className: "cn-rtl-flip" })
3184
+ children: /* @__PURE__ */ jsx8(Icon6, { name: "chevrons-right", className: "cn-rtl-flip" })
3131
3185
  }
3132
3186
  ) })
3133
3187
  ] }) })
@@ -3136,7 +3190,7 @@ function DataTablePagination({
3136
3190
  }
3137
3191
 
3138
3192
  // src/data-table/table-primitives.tsx
3139
- import * as React5 from "react";
3193
+ import * as React6 from "react";
3140
3194
  import {
3141
3195
  flexRender as flexRender2
3142
3196
  } from "@tanstack/react-table";
@@ -3148,7 +3202,7 @@ import {
3148
3202
  DropdownMenuSeparator,
3149
3203
  DropdownMenuTrigger as DropdownMenuTrigger3
3150
3204
  } from "@upbound/monarch-core";
3151
- import { Icon as Icon6 } from "@upbound/monarch-core";
3205
+ import { Icon as Icon7 } from "@upbound/monarch-core";
3152
3206
  import { Skeleton } from "@upbound/monarch-core";
3153
3207
  import {
3154
3208
  Table as BaseTable,
@@ -3159,7 +3213,7 @@ import {
3159
3213
  TableRow as BaseTableRow
3160
3214
  } from "@upbound/monarch-core";
3161
3215
  import { Tooltip as Tooltip3, TooltipContent as TooltipContent3, TooltipTrigger as TooltipTrigger3 } from "@upbound/monarch-core";
3162
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
3216
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3163
3217
  var HEADER_SURFACE_BG = "bg-[color-mix(in_oklch,var(--muted)_50%,var(--card))]";
3164
3218
  var TABLE_HEAD_CLASSES = "text-body-sm text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap has-[[role=checkbox]]:pr-0";
3165
3219
  var TABLE_CELL_CLASSES = "px-4 py-2 align-middle whitespace-nowrap has-[[role=checkbox]]:pr-0";
@@ -3173,7 +3227,7 @@ function DataTableRoot({
3173
3227
  children
3174
3228
  }) {
3175
3229
  if (layout === "grid") {
3176
- return /* @__PURE__ */ jsx8(
3230
+ return /* @__PURE__ */ jsx9(
3177
3231
  "div",
3178
3232
  {
3179
3233
  ref: gridRootRef,
@@ -3184,7 +3238,7 @@ function DataTableRoot({
3184
3238
  }
3185
3239
  );
3186
3240
  }
3187
- return /* @__PURE__ */ jsx8(BaseTable, { className, style, children });
3241
+ return /* @__PURE__ */ jsx9(BaseTable, { className, style, children });
3188
3242
  }
3189
3243
  function getColumnPinningProps(column, surface = "body") {
3190
3244
  const isPinned = column.getIsPinned();
@@ -3207,8 +3261,8 @@ function getColumnPinningProps(column, surface = "body") {
3207
3261
  }
3208
3262
  function DataTableSortIcon({ sortOrder }) {
3209
3263
  if (!sortOrder) return null;
3210
- return /* @__PURE__ */ jsx8(
3211
- Icon6,
3264
+ return /* @__PURE__ */ jsx9(
3265
+ Icon7,
3212
3266
  {
3213
3267
  name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
3214
3268
  size: "xs",
@@ -3227,57 +3281,57 @@ function ColumnActionsMenuItems({
3227
3281
  const canResize = header.column.getCanResize();
3228
3282
  const canHide = header.column.getCanHide();
3229
3283
  const canPin = !isGrid && header.column.getCanPin();
3230
- return /* @__PURE__ */ jsxs7(DropdownMenuContent3, { align: "start", className: "w-45", children: [
3231
- canSort && /* @__PURE__ */ jsxs7(Fragment5, { children: [
3232
- /* @__PURE__ */ jsxs7(
3284
+ return /* @__PURE__ */ jsxs8(DropdownMenuContent3, { align: "start", className: "w-45", children: [
3285
+ canSort && /* @__PURE__ */ jsxs8(Fragment5, { children: [
3286
+ /* @__PURE__ */ jsxs8(
3233
3287
  DropdownMenuItem3,
3234
3288
  {
3235
3289
  disabled: header.column.getIsSorted() === "asc",
3236
3290
  onClick: () => header.column.toggleSorting(false),
3237
3291
  children: [
3238
- /* @__PURE__ */ jsx8(Icon6, { name: "arrow-up" }),
3292
+ /* @__PURE__ */ jsx9(Icon7, { name: "arrow-up" }),
3239
3293
  "Sort ascending"
3240
3294
  ]
3241
3295
  }
3242
3296
  ),
3243
- /* @__PURE__ */ jsxs7(
3297
+ /* @__PURE__ */ jsxs8(
3244
3298
  DropdownMenuItem3,
3245
3299
  {
3246
3300
  disabled: header.column.getIsSorted() === "desc",
3247
3301
  onClick: () => header.column.toggleSorting(true),
3248
3302
  children: [
3249
- /* @__PURE__ */ jsx8(Icon6, { name: "arrow-down" }),
3303
+ /* @__PURE__ */ jsx9(Icon7, { name: "arrow-down" }),
3250
3304
  "Sort descending"
3251
3305
  ]
3252
3306
  }
3253
3307
  ),
3254
- !!header.column.getIsSorted() && /* @__PURE__ */ jsxs7(DropdownMenuItem3, { onClick: () => header.column.clearSorting(), children: [
3255
- /* @__PURE__ */ jsx8(Icon6, { name: "xmark" }),
3308
+ !!header.column.getIsSorted() && /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => header.column.clearSorting(), children: [
3309
+ /* @__PURE__ */ jsx9(Icon7, { name: "xmark" }),
3256
3310
  "Remove sorting"
3257
3311
  ] })
3258
3312
  ] }),
3259
- canResize && /* @__PURE__ */ jsxs7(Fragment5, { children: [
3260
- canSort && /* @__PURE__ */ jsx8(DropdownMenuSeparator, {}),
3261
- !isGrid && /* @__PURE__ */ jsxs7(DropdownMenuItem3, { onClick: () => onAutosizeColumn(header.column.id), children: [
3262
- /* @__PURE__ */ jsx8(Icon6, { name: "arrows-left-right" }),
3313
+ canResize && /* @__PURE__ */ jsxs8(Fragment5, { children: [
3314
+ canSort && /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
3315
+ !isGrid && /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => onAutosizeColumn(header.column.id), children: [
3316
+ /* @__PURE__ */ jsx9(Icon7, { name: "arrows-left-right" }),
3263
3317
  "Autosize column"
3264
3318
  ] }),
3265
- /* @__PURE__ */ jsxs7(DropdownMenuItem3, { onClick: () => onAutosizeAll(), children: [
3266
- /* @__PURE__ */ jsx8(Icon6, { name: "table-columns" }),
3319
+ /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => onAutosizeAll(), children: [
3320
+ /* @__PURE__ */ jsx9(Icon7, { name: "table-columns" }),
3267
3321
  isGrid ? "Reset all columns" : "Autosize all columns"
3268
3322
  ] })
3269
3323
  ] }),
3270
- (canHide || canPin) && /* @__PURE__ */ jsxs7(Fragment5, { children: [
3271
- (canSort || canResize) && /* @__PURE__ */ jsx8(DropdownMenuSeparator, {}),
3272
- canHide && /* @__PURE__ */ jsxs7(DropdownMenuItem3, { onClick: () => header.column.toggleVisibility(), children: [
3273
- /* @__PURE__ */ jsx8(Icon6, { name: "eye-slash" }),
3324
+ (canHide || canPin) && /* @__PURE__ */ jsxs8(Fragment5, { children: [
3325
+ (canSort || canResize) && /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
3326
+ canHide && /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => header.column.toggleVisibility(), children: [
3327
+ /* @__PURE__ */ jsx9(Icon7, { name: "eye-slash" }),
3274
3328
  "Hide column"
3275
3329
  ] }),
3276
- canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs7(DropdownMenuItem3, { onClick: () => header.column.pin(false), children: [
3277
- /* @__PURE__ */ jsx8(Icon6, { name: "thumbtack" }),
3330
+ canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => header.column.pin(false), children: [
3331
+ /* @__PURE__ */ jsx9(Icon7, { name: "thumbtack" }),
3278
3332
  "Unpin column"
3279
- ] }) : /* @__PURE__ */ jsxs7(DropdownMenuItem3, { onClick: () => header.column.pin("left"), children: [
3280
- /* @__PURE__ */ jsx8(Icon6, { name: "thumbtack" }),
3333
+ ] }) : /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => header.column.pin("left"), children: [
3334
+ /* @__PURE__ */ jsx9(Icon7, { name: "thumbtack" }),
3281
3335
  "Pin column"
3282
3336
  ] }))
3283
3337
  ] })
@@ -3297,7 +3351,7 @@ function HeaderCellContent({
3297
3351
  const resizeHandler = header.getResizeHandler();
3298
3352
  const headerTitle = typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "";
3299
3353
  const sorted = header.column.getIsSorted();
3300
- const labelButton = /* @__PURE__ */ jsxs7(
3354
+ const labelButton = /* @__PURE__ */ jsxs8(
3301
3355
  "button",
3302
3356
  {
3303
3357
  type: "button",
@@ -3308,10 +3362,10 @@ function HeaderCellContent({
3308
3362
  shouldShowActionsMenu ? "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 cursor-pointer" : "cursor-default"
3309
3363
  ),
3310
3364
  children: [
3311
- /* @__PURE__ */ jsx8(DataTableSortIcon, { sortOrder: sorted }),
3312
- /* @__PURE__ */ jsx8("span", { className: "min-w-0 truncate", children: flexRender2(header.column.columnDef.header, header.getContext()) }),
3313
- shouldShowActionsMenu && /* @__PURE__ */ jsx8(
3314
- Icon6,
3365
+ /* @__PURE__ */ jsx9(DataTableSortIcon, { sortOrder: sorted }),
3366
+ /* @__PURE__ */ jsx9("span", { className: "min-w-0 truncate", children: flexRender2(header.column.columnDef.header, header.getContext()) }),
3367
+ shouldShowActionsMenu && /* @__PURE__ */ jsx9(
3368
+ Icon7,
3315
3369
  {
3316
3370
  size: "sm",
3317
3371
  name: "ellipsis",
@@ -3321,9 +3375,9 @@ function HeaderCellContent({
3321
3375
  ]
3322
3376
  }
3323
3377
  );
3324
- const label = shouldShowActionsMenu ? /* @__PURE__ */ jsxs7(DropdownMenu3, { children: [
3325
- /* @__PURE__ */ jsx8(DropdownMenuTrigger3, { asChild: true, children: labelButton }),
3326
- /* @__PURE__ */ jsx8(
3378
+ const label = shouldShowActionsMenu ? /* @__PURE__ */ jsxs8(DropdownMenu3, { children: [
3379
+ /* @__PURE__ */ jsx9(DropdownMenuTrigger3, { asChild: true, children: labelButton }),
3380
+ /* @__PURE__ */ jsx9(
3327
3381
  ColumnActionsMenuItems,
3328
3382
  {
3329
3383
  header,
@@ -3333,12 +3387,12 @@ function HeaderCellContent({
3333
3387
  }
3334
3388
  )
3335
3389
  ] }) : labelButton;
3336
- return /* @__PURE__ */ jsxs7(Fragment5, { children: [
3337
- /* @__PURE__ */ jsx8("div", { className: "flex min-w-0 items-center gap-1", children: /* @__PURE__ */ jsx8("div", { className: "min-w-0 flex-1", children: !isActionColumn && !isGroupedColumn && (headerTitle ? /* @__PURE__ */ jsxs7(Tooltip3, { children: [
3338
- /* @__PURE__ */ jsx8(TooltipTrigger3, { asChild: true, children: label }),
3339
- /* @__PURE__ */ jsx8(TooltipContent3, { children: headerTitle })
3390
+ return /* @__PURE__ */ jsxs8(Fragment5, { children: [
3391
+ /* @__PURE__ */ jsx9("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: /* @__PURE__ */ jsx9("div", { className: "min-w-0 flex-1", children: !isActionColumn && !isGroupedColumn && (headerTitle ? /* @__PURE__ */ jsxs8(Tooltip3, { children: [
3392
+ /* @__PURE__ */ jsx9(TooltipTrigger3, { asChild: true, children: label }),
3393
+ /* @__PURE__ */ jsx9(TooltipContent3, { children: headerTitle })
3340
3394
  ] }) : label) }) }),
3341
- canResize && /* @__PURE__ */ jsx8(
3395
+ canResize && /* @__PURE__ */ jsx9(
3342
3396
  "button",
3343
3397
  {
3344
3398
  type: "button",
@@ -3354,7 +3408,7 @@ function HeaderCellContent({
3354
3408
  ] });
3355
3409
  }
3356
3410
  var DEFAULT_STICKY_HEADER_OFFSET_PX = 0;
3357
- var DEFAULT_STICKY_HEADER_ROW_HEIGHT_PX = 48;
3411
+ var DEFAULT_STICKY_HEADER_ROW_HEIGHT_PX = 40;
3358
3412
  function DataTableHeader({
3359
3413
  headerGroups,
3360
3414
  onAutosizeAll,
@@ -3382,7 +3436,7 @@ function DataTableHeader({
3382
3436
  const stickyTopPx = stickyHeader ? stickyHeaderOffset + headerGroupIndex * stickyHeaderRowHeight : void 0;
3383
3437
  const isPinned = !isGrid && header.column.getIsPinned();
3384
3438
  const pinning = isGrid ? { className: "", style: {} } : getColumnPinningProps(header.column, "header");
3385
- const content = /* @__PURE__ */ jsx8(
3439
+ const content = /* @__PURE__ */ jsx9(
3386
3440
  HeaderCellContent,
3387
3441
  {
3388
3442
  header,
@@ -3403,11 +3457,11 @@ function DataTableHeader({
3403
3457
  isPinned && "z-30"
3404
3458
  );
3405
3459
  if (isGrid) {
3406
- return /* @__PURE__ */ jsx8(
3460
+ return /* @__PURE__ */ jsx9(
3407
3461
  "div",
3408
3462
  {
3409
3463
  role: "columnheader",
3410
- className: cn(TABLE_HEAD_CLASSES, cellClassName, "h-auto py-1.5 whitespace-normal"),
3464
+ className: cn(TABLE_HEAD_CLASSES, cellClassName, "flex items-center whitespace-normal"),
3411
3465
  style: __spreadValues({
3412
3466
  minWidth: header.column.columnDef.minSize
3413
3467
  }, stickyTopPx !== void 0 ? { top: stickyTopPx } : {}),
@@ -3416,10 +3470,10 @@ function DataTableHeader({
3416
3470
  header.id
3417
3471
  );
3418
3472
  }
3419
- return /* @__PURE__ */ jsx8(
3473
+ return /* @__PURE__ */ jsx9(
3420
3474
  BaseTableHead,
3421
3475
  {
3422
- className: cn(cellClassName, "h-auto py-1.5 whitespace-normal"),
3476
+ className: cn(cellClassName, "whitespace-normal"),
3423
3477
  style: __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, pinning.style), {
3424
3478
  minWidth: header.column.columnDef.minSize,
3425
3479
  maxWidth: header.column.columnDef.maxSize
@@ -3431,19 +3485,19 @@ function DataTableHeader({
3431
3485
  });
3432
3486
  };
3433
3487
  if (isGrid) {
3434
- return /* @__PURE__ */ jsx8(
3488
+ return /* @__PURE__ */ jsx9(
3435
3489
  "div",
3436
3490
  {
3437
3491
  role: "rowgroup",
3438
3492
  className: cn("col-span-full grid grid-cols-subgrid", HEADER_SURFACE_BG, !!stickyHeader && "sticky z-20"),
3439
3493
  style: stickyHeader ? { top: stickyHeaderOffset } : void 0,
3440
- children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx8("div", { role: "row", className: "col-span-full grid grid-cols-subgrid border-b", children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id))
3494
+ children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx9("div", { role: "row", className: "col-span-full grid grid-cols-subgrid border-b", children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id))
3441
3495
  }
3442
3496
  );
3443
3497
  }
3444
- return /* @__PURE__ */ jsx8(BaseTableHeader, { children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx8(BaseTableRow, { children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id)) });
3498
+ return /* @__PURE__ */ jsx9(BaseTableHeader, { children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx9(BaseTableRow, { children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id)) });
3445
3499
  }
3446
- var DataTableRow = React5.forwardRef(
3500
+ var DataTableRow = React6.forwardRef(
3447
3501
  (_a, ref) => {
3448
3502
  var _b = _a, { hoverable, disabled, className, layout = "auto" } = _b, props = __objRest(_b, ["hoverable", "disabled", "className", "layout"]);
3449
3503
  const classes = cn(
@@ -3453,7 +3507,7 @@ var DataTableRow = React5.forwardRef(
3453
3507
  className
3454
3508
  );
3455
3509
  if (layout === "grid") {
3456
- return /* @__PURE__ */ jsx8(
3510
+ return /* @__PURE__ */ jsx9(
3457
3511
  "div",
3458
3512
  __spreadValues({
3459
3513
  ref,
@@ -3462,7 +3516,7 @@ var DataTableRow = React5.forwardRef(
3462
3516
  }, props)
3463
3517
  );
3464
3518
  }
3465
- return /* @__PURE__ */ jsx8(BaseTableRow, __spreadValues({ ref, className: classes }, props));
3519
+ return /* @__PURE__ */ jsx9(BaseTableRow, __spreadValues({ ref, className: classes }, props));
3466
3520
  }
3467
3521
  );
3468
3522
  DataTableRow.displayName = "DataTableRow";
@@ -3493,7 +3547,7 @@ function DataTableCell({
3493
3547
  isPinned && "z-10",
3494
3548
  className
3495
3549
  );
3496
- const cellElement = isGrid ? /* @__PURE__ */ jsx8(
3550
+ const cellElement = isGrid ? /* @__PURE__ */ jsx9(
3497
3551
  "div",
3498
3552
  {
3499
3553
  role: "cell",
@@ -3501,7 +3555,7 @@ function DataTableCell({
3501
3555
  style: { minWidth: cell.column.columnDef.minSize },
3502
3556
  children: content
3503
3557
  }
3504
- ) : /* @__PURE__ */ jsx8(
3558
+ ) : /* @__PURE__ */ jsx9(
3505
3559
  BaseTableCell,
3506
3560
  {
3507
3561
  className: cellClassName,
@@ -3513,9 +3567,9 @@ function DataTableCell({
3513
3567
  }
3514
3568
  );
3515
3569
  if (!shouldShowContextualMenu || !onContextCell) return cellElement;
3516
- return /* @__PURE__ */ jsxs7(ContextMenu, { children: [
3517
- /* @__PURE__ */ jsx8(ContextMenuTrigger, { asChild: true, children: cellElement }),
3518
- /* @__PURE__ */ jsx8(
3570
+ return /* @__PURE__ */ jsxs8(ContextMenu, { children: [
3571
+ /* @__PURE__ */ jsx9(ContextMenuTrigger, { asChild: true, children: cellElement }),
3572
+ /* @__PURE__ */ jsx9(
3519
3573
  CellContextualFilter,
3520
3574
  {
3521
3575
  filter: contextualFilter,
@@ -3534,7 +3588,7 @@ function DataTableGroupRow({
3534
3588
  layout = "auto"
3535
3589
  }) {
3536
3590
  if (layout === "grid") {
3537
- return /* @__PURE__ */ jsx8("div", { role: "row", className: "bg-muted/50 hover:bg-muted/50 col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx8(
3591
+ return /* @__PURE__ */ jsx9("div", { role: "row", className: "bg-muted/50 hover:bg-muted/50 col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx9(
3538
3592
  "div",
3539
3593
  {
3540
3594
  role: "cell",
@@ -3544,7 +3598,7 @@ function DataTableGroupRow({
3544
3598
  }
3545
3599
  ) });
3546
3600
  }
3547
- return /* @__PURE__ */ jsx8(BaseTableRow, { className: "bg-muted/50 hover:bg-muted/50", children: /* @__PURE__ */ jsx8(BaseTableCell, { colSpan, className: "text-foreground border-b font-semibold whitespace-nowrap", children: groupLabel }) });
3601
+ return /* @__PURE__ */ jsx9(BaseTableRow, { className: "bg-muted/50 hover:bg-muted/50", children: /* @__PURE__ */ jsx9(BaseTableCell, { colSpan, className: "text-foreground border-b font-semibold whitespace-nowrap", children: groupLabel }) });
3548
3602
  }
3549
3603
  function DataTableSkeletonBody({
3550
3604
  rowCount = 10,
@@ -3553,32 +3607,32 @@ function DataTableSkeletonBody({
3553
3607
  layout = "auto"
3554
3608
  }) {
3555
3609
  const isGrid = layout === "grid";
3556
- const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx8(DataTableRow, { layout, children: columns.map(
3610
+ const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx9(DataTableRow, { layout, children: columns.map(
3557
3611
  (col) => {
3558
3612
  var _a, _b;
3559
- return isGrid ? /* @__PURE__ */ jsx8(
3613
+ return isGrid ? /* @__PURE__ */ jsx9(
3560
3614
  "div",
3561
3615
  {
3562
3616
  role: "cell",
3563
3617
  className: cn(TABLE_CELL_CLASSES, "flex items-center overflow-hidden"),
3564
3618
  style: { minWidth: col.minSize },
3565
- children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */ jsx8(Skeleton, { className: "h-4 w-full" })
3619
+ children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */ jsx9(Skeleton, { className: "h-4 w-full" })
3566
3620
  },
3567
3621
  `skeleton-col-${col.id}-row-${rowIndex}`
3568
- ) : /* @__PURE__ */ jsx8(
3622
+ ) : /* @__PURE__ */ jsx9(
3569
3623
  BaseTableCell,
3570
3624
  {
3571
3625
  style: { width: col.size, minWidth: col.minSize, maxWidth: col.maxSize },
3572
- children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */ jsx8(Skeleton, { className: "h-4 w-full" })
3626
+ children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */ jsx9(Skeleton, { className: "h-4 w-full" })
3573
3627
  },
3574
3628
  `skeleton-col-${col.id}-row-${rowIndex}`
3575
3629
  );
3576
3630
  }
3577
3631
  ) }, `skeleton-row-${rowIndex}`));
3578
3632
  if (isGrid) {
3579
- return /* @__PURE__ */ jsx8("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", "data-testid": "table-skeleton-loader", children: rows });
3633
+ return /* @__PURE__ */ jsx9("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", "data-testid": "table-skeleton-loader", children: rows });
3580
3634
  }
3581
- return /* @__PURE__ */ jsx8(BaseTableBody, { "data-testid": "table-skeleton-loader", children: rows });
3635
+ return /* @__PURE__ */ jsx9(BaseTableBody, { "data-testid": "table-skeleton-loader", children: rows });
3582
3636
  }
3583
3637
  function DataTableExpandedRow({
3584
3638
  colSpan,
@@ -3588,9 +3642,9 @@ function DataTableExpandedRow({
3588
3642
  }) {
3589
3643
  if (!show) return null;
3590
3644
  if (layout === "grid") {
3591
- return /* @__PURE__ */ jsx8("div", { role: "row", className: "col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx8("div", { role: "cell", style: { gridColumn: `span ${colSpan}` }, className: "bg-card p-0 align-top whitespace-normal", children }) });
3645
+ return /* @__PURE__ */ jsx9("div", { role: "row", className: "col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx9("div", { role: "cell", style: { gridColumn: `span ${colSpan}` }, className: "bg-card p-0 align-top whitespace-normal", children }) });
3592
3646
  }
3593
- return /* @__PURE__ */ jsx8(BaseTableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx8(BaseTableCell, { colSpan, className: "bg-card p-0 align-top whitespace-normal", children }) });
3647
+ return /* @__PURE__ */ jsx9(BaseTableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx9(BaseTableCell, { colSpan, className: "bg-card p-0 align-top whitespace-normal", children }) });
3594
3648
  }
3595
3649
  function DataTableBody({
3596
3650
  tableRows,
@@ -3616,7 +3670,7 @@ function DataTableBody({
3616
3670
  minSize: c.columnDef.minSize,
3617
3671
  maxSize: c.columnDef.maxSize
3618
3672
  }));
3619
- return /* @__PURE__ */ jsx8(
3673
+ return /* @__PURE__ */ jsx9(
3620
3674
  DataTableSkeletonBody,
3621
3675
  {
3622
3676
  columns: skeletonColumns,
@@ -3630,17 +3684,17 @@ function DataTableBody({
3630
3684
  var _a, _b, _c, _d;
3631
3685
  if ((_a = row.getIsGrouped) == null ? void 0 : _a.call(row)) {
3632
3686
  const groupLabel = (_c = row.groupingValue) != null ? _c : row.groupingColumnId ? (_b = row.getGroupingValue) == null ? void 0 : _b.call(row, row.groupingColumnId) : void 0;
3633
- return /* @__PURE__ */ jsx8(DataTableGroupRow, { groupLabel: String(groupLabel != null ? groupLabel : ""), colSpan, layout }, row.id);
3687
+ return /* @__PURE__ */ jsx9(DataTableGroupRow, { groupLabel: String(groupLabel != null ? groupLabel : ""), colSpan, layout }, row.id);
3634
3688
  }
3635
3689
  const isExpanded = !!(renderExpandedRow && ((_d = row.getIsExpanded) == null ? void 0 : _d.call(row)));
3636
3690
  const expandedRow = renderExpandedRow ? renderExpandedRow(row.original) : null;
3637
- return /* @__PURE__ */ jsxs7(React5.Fragment, { children: [
3638
- /* @__PURE__ */ jsx8(
3691
+ return /* @__PURE__ */ jsxs8(React6.Fragment, { children: [
3692
+ /* @__PURE__ */ jsx9(
3639
3693
  DataTableRow,
3640
3694
  __spreadProps(__spreadValues({}, onRowRender ? onRowRender(row.original) : {}), {
3641
3695
  "data-expanded": isExpanded || void 0,
3642
3696
  layout,
3643
- children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */ jsx8(
3697
+ children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */ jsx9(
3644
3698
  DataTableCell,
3645
3699
  {
3646
3700
  cell,
@@ -3654,21 +3708,21 @@ function DataTableBody({
3654
3708
  ))
3655
3709
  })
3656
3710
  ),
3657
- /* @__PURE__ */ jsx8(DataTableExpandedRow, { colSpan, show: isExpanded, layout, children: expandedRow })
3711
+ /* @__PURE__ */ jsx9(DataTableExpandedRow, { colSpan, show: isExpanded, layout, children: expandedRow })
3658
3712
  ] }, row.id);
3659
3713
  });
3660
3714
  if (isGrid) {
3661
- return /* @__PURE__ */ jsx8("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", children: rows });
3715
+ return /* @__PURE__ */ jsx9("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", children: rows });
3662
3716
  }
3663
- return /* @__PURE__ */ jsx8(BaseTableBody, { children: rows });
3717
+ return /* @__PURE__ */ jsx9(BaseTableBody, { children: rows });
3664
3718
  }
3665
3719
 
3666
3720
  // src/data-table/view-filter.tsx
3667
- import * as React7 from "react";
3721
+ import * as React8 from "react";
3668
3722
 
3669
3723
  // src/filter-bar/filter-bar.tsx
3670
- import * as React6 from "react";
3671
- import { Icon as Icon7 } from "@upbound/monarch-core";
3724
+ import * as React7 from "react";
3725
+ import { Icon as Icon8 } from "@upbound/monarch-core";
3672
3726
  import { Badge as Badge2 } from "@upbound/monarch-core";
3673
3727
  import { Button as Button6 } from "@upbound/monarch-core";
3674
3728
  import { ButtonGroup as ButtonGroup2, ButtonGroupText as ButtonGroupText2 } from "@upbound/monarch-core";
@@ -3691,7 +3745,6 @@ import {
3691
3745
  DropdownMenu as DropdownMenu4,
3692
3746
  DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2,
3693
3747
  DropdownMenuContent as DropdownMenuContent4,
3694
- DropdownMenuItem as DropdownMenuItem4,
3695
3748
  DropdownMenuRadioGroup,
3696
3749
  DropdownMenuRadioItem,
3697
3750
  DropdownMenuTrigger as DropdownMenuTrigger4
@@ -3699,7 +3752,7 @@ import {
3699
3752
  import { Input as Input2 } from "@upbound/monarch-core";
3700
3753
  import { Label as Label3 } from "@upbound/monarch-core";
3701
3754
  import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2 } from "@upbound/monarch-core";
3702
- import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3755
+ import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3703
3756
  function asCheckboxValue(value) {
3704
3757
  return Array.isArray(value) ? value : [];
3705
3758
  }
@@ -3733,6 +3786,14 @@ function applyTimeToDate(date, time) {
3733
3786
  function formatDateLabel(date) {
3734
3787
  return date.toLocaleDateString(void 0, { month: "short", day: "numeric" });
3735
3788
  }
3789
+ function composeRefs(...refs) {
3790
+ return (node) => {
3791
+ for (const ref of refs) {
3792
+ if (typeof ref === "function") ref(node);
3793
+ else if (ref) ref.current = node;
3794
+ }
3795
+ };
3796
+ }
3736
3797
  function FilterBar(_a) {
3737
3798
  var _b = _a, {
3738
3799
  filters,
@@ -3741,7 +3802,8 @@ function FilterBar(_a) {
3741
3802
  onRemoveFilter,
3742
3803
  onChangeFilter,
3743
3804
  className,
3744
- children
3805
+ children,
3806
+ ref
3745
3807
  } = _b, props = __objRest(_b, [
3746
3808
  "filters",
3747
3809
  "activeFilters",
@@ -3749,48 +3811,59 @@ function FilterBar(_a) {
3749
3811
  "onRemoveFilter",
3750
3812
  "onChangeFilter",
3751
3813
  "className",
3752
- "children"
3814
+ "children",
3815
+ "ref"
3753
3816
  ]);
3754
3817
  const usedKeys = new Set(activeFilters.map((f) => f.key));
3755
3818
  const availableFilters = filters.filter((f) => !usedKeys.has(f.key));
3756
3819
  const shouldShowFilters = availableFilters.length > 0 || activeFilters.length > 0;
3757
- const [pendingOpenKey, setPendingOpenKey] = React6.useState(null);
3820
+ const [pendingOpenKey, setPendingOpenKey] = React7.useState(null);
3758
3821
  function handleAddFilter(key) {
3759
3822
  onAddFilter(key);
3760
3823
  setPendingOpenKey(key);
3761
3824
  }
3762
- return /* @__PURE__ */ jsxs8(
3825
+ const containerRef = React7.useRef(null);
3826
+ return /* @__PURE__ */ jsxs9(
3763
3827
  "div",
3764
3828
  __spreadProps(__spreadValues({
3765
3829
  "data-slot": "filter-bar",
3766
3830
  "data-visible-filters": shouldShowFilters,
3767
- className: cn("flex flex-wrap items-center gap-2", className)
3831
+ className: cn("flex flex-wrap items-center gap-2", className),
3832
+ ref: composeRefs(containerRef, ref)
3768
3833
  }, props), {
3769
3834
  children: [
3770
- availableFilters.length > 0 && /* @__PURE__ */ jsxs8(DropdownMenu4, { children: [
3771
- /* @__PURE__ */ jsx9(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs8(Button6, { variant: "outline", children: [
3772
- /* @__PURE__ */ jsx9(Icon7, { name: "plus", "data-icon": "inline-start" }),
3773
- "Add filter"
3774
- ] }) }),
3775
- /* @__PURE__ */ jsx9(
3776
- DropdownMenuContent4,
3777
- {
3778
- align: "start",
3779
- className: "w-48",
3780
- onCloseAutoFocus: (e) => e.preventDefault(),
3781
- children: availableFilters.map((filter) => /* @__PURE__ */ jsx9(DropdownMenuItem4, { onSelect: () => handleAddFilter(filter.key), children: filter.label }, filter.key))
3782
- }
3783
- )
3784
- ] }),
3835
+ availableFilters.length > 0 && /* @__PURE__ */ jsxs9(
3836
+ Combobox2,
3837
+ {
3838
+ items: availableFilters,
3839
+ itemToStringValue: (item) => item.label,
3840
+ itemToStringLabel: (item) => item.label,
3841
+ onValueChange: (filter) => {
3842
+ if (filter) handleAddFilter(filter.key);
3843
+ },
3844
+ children: [
3845
+ /* @__PURE__ */ jsxs9(ComboboxTrigger2, { "aria-label": "Add filter", render: /* @__PURE__ */ jsx10(Button6, { variant: "outline" }), children: [
3846
+ /* @__PURE__ */ jsx10(Icon8, { name: "plus", "data-icon": "inline-start" }),
3847
+ "Add filter"
3848
+ ] }),
3849
+ /* @__PURE__ */ jsxs9(ComboboxContent2, { container: containerRef, align: "start", className: "w-48", children: [
3850
+ /* @__PURE__ */ jsx10(ComboboxInput2, { showTrigger: false, placeholder: "Search filters\u2026" }),
3851
+ /* @__PURE__ */ jsx10(ComboboxEmpty2, { children: "No filters found." }),
3852
+ /* @__PURE__ */ jsx10(ComboboxList2, { children: (filter) => /* @__PURE__ */ jsx10(ComboboxItem2, { value: filter, children: filter.label }, filter.key) })
3853
+ ] })
3854
+ ]
3855
+ }
3856
+ ),
3785
3857
  activeFilters.map((active) => {
3786
3858
  const definition = filters.find((f) => f.key === active.key);
3787
3859
  if (!definition) return null;
3788
- return /* @__PURE__ */ jsx9(
3860
+ return /* @__PURE__ */ jsx10(
3789
3861
  FilterChip,
3790
3862
  {
3791
3863
  definition,
3792
3864
  value: active.value,
3793
3865
  autoOpen: active.key === pendingOpenKey,
3866
+ container: containerRef,
3794
3867
  onChangeValue: (value) => onChangeFilter(active.key, value),
3795
3868
  onRemove: () => onRemoveFilter(active.key)
3796
3869
  },
@@ -3802,34 +3875,36 @@ function FilterBar(_a) {
3802
3875
  })
3803
3876
  );
3804
3877
  }
3805
- function FilterChip({ definition, value, autoOpen, onChangeValue, onRemove }) {
3878
+ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onRemove }) {
3806
3879
  var _a;
3807
3880
  const type = (_a = definition.type) != null ? _a : "checkbox";
3808
3881
  switch (type) {
3809
3882
  case "checkbox":
3810
- return /* @__PURE__ */ jsx9(
3883
+ return /* @__PURE__ */ jsx10(
3811
3884
  CheckboxFilterChip,
3812
3885
  {
3813
3886
  definition,
3814
3887
  value,
3815
3888
  autoOpen,
3889
+ container,
3816
3890
  onChangeValue,
3817
3891
  onRemove
3818
3892
  }
3819
3893
  );
3820
3894
  case "radio":
3821
- return /* @__PURE__ */ jsx9(
3895
+ return /* @__PURE__ */ jsx10(
3822
3896
  RadioFilterChip,
3823
3897
  {
3824
3898
  definition,
3825
3899
  value,
3826
3900
  autoOpen,
3901
+ container,
3827
3902
  onChangeValue,
3828
3903
  onRemove
3829
3904
  }
3830
3905
  );
3831
3906
  case "text":
3832
- return /* @__PURE__ */ jsx9(
3907
+ return /* @__PURE__ */ jsx10(
3833
3908
  TextFilterChip,
3834
3909
  {
3835
3910
  definition,
@@ -3840,7 +3915,7 @@ function FilterChip({ definition, value, autoOpen, onChangeValue, onRemove }) {
3840
3915
  }
3841
3916
  );
3842
3917
  case "multiText":
3843
- return /* @__PURE__ */ jsx9(
3918
+ return /* @__PURE__ */ jsx10(
3844
3919
  MultiTextFilterChip,
3845
3920
  {
3846
3921
  definition,
@@ -3851,7 +3926,7 @@ function FilterChip({ definition, value, autoOpen, onChangeValue, onRemove }) {
3851
3926
  }
3852
3927
  );
3853
3928
  case "date":
3854
- return /* @__PURE__ */ jsx9(
3929
+ return /* @__PURE__ */ jsx10(
3855
3930
  DateFilterChip,
3856
3931
  {
3857
3932
  definition,
@@ -3864,12 +3939,13 @@ function FilterChip({ definition, value, autoOpen, onChangeValue, onRemove }) {
3864
3939
  }
3865
3940
  }
3866
3941
  function FilterChipRemoveButton({ label, onRemove }) {
3867
- return /* @__PURE__ */ jsx9(Button6, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx9(Icon7, { name: "xmark" }) });
3942
+ return /* @__PURE__ */ jsx10(Button6, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx10(Icon8, { name: "xmark" }) });
3868
3943
  }
3869
3944
  function CheckboxFilterChip({
3870
3945
  definition,
3871
3946
  value,
3872
3947
  autoOpen,
3948
+ container,
3873
3949
  onChangeValue,
3874
3950
  onRemove
3875
3951
  }) {
@@ -3881,9 +3957,9 @@ function CheckboxFilterChip({
3881
3957
  const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
3882
3958
  onChangeValue(next);
3883
3959
  }
3884
- return /* @__PURE__ */ jsxs8(ButtonGroup2, { children: [
3885
- /* @__PURE__ */ jsx9(ButtonGroupText2, { children: label }),
3886
- searchable ? /* @__PURE__ */ jsxs8(
3960
+ return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
3961
+ /* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
3962
+ searchable ? /* @__PURE__ */ jsxs9(
3887
3963
  Combobox2,
3888
3964
  {
3889
3965
  items: options,
@@ -3893,40 +3969,48 @@ function CheckboxFilterChip({
3893
3969
  value: options.filter((o) => values.includes(o.value)),
3894
3970
  onValueChange: (selected) => onChangeValue(selected.map((s) => s.value)),
3895
3971
  children: [
3896
- /* @__PURE__ */ jsx9(
3972
+ /* @__PURE__ */ jsx10(
3897
3973
  ComboboxTrigger2,
3898
3974
  {
3899
- render: /* @__PURE__ */ jsx9(Button6, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
3900
- children: /* @__PURE__ */ jsx9("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
3975
+ render: /* @__PURE__ */ jsx10(Button6, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
3976
+ children: /* @__PURE__ */ jsx10("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
3901
3977
  }
3902
3978
  ),
3903
- /* @__PURE__ */ jsxs8(ComboboxContent2, { className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
3904
- /* @__PURE__ */ jsx9(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
3905
- values.length > 0 && /* @__PURE__ */ jsxs8(Fragment6, { children: [
3906
- /* @__PURE__ */ jsxs8(ComboboxSelectedChips2, { children: [
3907
- /* @__PURE__ */ jsx9(ComboboxValue2, { children: (selected) => /* @__PURE__ */ jsx9(Fragment6, { children: selected.map((item) => /* @__PURE__ */ jsx9(ComboboxChip2, { children: item.label }, item.value)) }) }),
3908
- /* @__PURE__ */ jsx9(ComboboxClearAll2, { onClick: () => onChangeValue([]) })
3909
- ] }),
3910
- /* @__PURE__ */ jsx9(ComboboxSeparator2, {})
3911
- ] }),
3912
- /* @__PURE__ */ jsxs8(ComboboxEmpty2, { children: [
3913
- "No ",
3914
- label.toLowerCase(),
3915
- " found."
3916
- ] }),
3917
- /* @__PURE__ */ jsx9(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs8(ComboboxItem2, { value: item, children: [
3918
- item.icon,
3919
- item.label
3920
- ] }, item.value) })
3921
- ] })
3979
+ /* @__PURE__ */ jsxs9(
3980
+ ComboboxContent2,
3981
+ {
3982
+ container,
3983
+ className: "min-w-64",
3984
+ collisionAvoidance: { side: "none", align: "shift" },
3985
+ children: [
3986
+ /* @__PURE__ */ jsx10(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
3987
+ values.length > 0 && /* @__PURE__ */ jsxs9(Fragment6, { children: [
3988
+ /* @__PURE__ */ jsxs9(ComboboxSelectedChips2, { children: [
3989
+ /* @__PURE__ */ jsx10(ComboboxValue2, { children: (selected) => /* @__PURE__ */ jsx10(Fragment6, { children: selected.map((item) => /* @__PURE__ */ jsx10(ComboboxChip2, { children: item.label }, item.value)) }) }),
3990
+ /* @__PURE__ */ jsx10(ComboboxClearAll2, { onClick: () => onChangeValue([]) })
3991
+ ] }),
3992
+ /* @__PURE__ */ jsx10(ComboboxSeparator2, {})
3993
+ ] }),
3994
+ /* @__PURE__ */ jsxs9(ComboboxEmpty2, { children: [
3995
+ "No ",
3996
+ label.toLowerCase(),
3997
+ " found."
3998
+ ] }),
3999
+ /* @__PURE__ */ jsx10(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs9(ComboboxItem2, { value: item, children: [
4000
+ item.icon,
4001
+ item.label
4002
+ ] }, item.value) })
4003
+ ]
4004
+ }
4005
+ )
3922
4006
  ]
3923
4007
  }
3924
- ) : /* @__PURE__ */ jsxs8(DropdownMenu4, { defaultOpen: autoOpen, children: [
3925
- /* @__PURE__ */ jsx9(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs8(Button6, { variant: "outline", className: "gap-1 font-normal", children: [
3926
- /* @__PURE__ */ jsx9("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
3927
- /* @__PURE__ */ jsx9(Icon7, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
4008
+ ) : /* @__PURE__ */ jsxs9(DropdownMenu4, { defaultOpen: autoOpen, children: [
4009
+ /* @__PURE__ */ jsx10(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs9(Button6, { variant: "outline", className: "gap-1 font-normal", children: [
4010
+ /* @__PURE__ */ jsx10("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
4011
+ /* @__PURE__ */ jsx10(Icon8, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
3928
4012
  ] }) }),
3929
- /* @__PURE__ */ jsx9(DropdownMenuContent4, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs8(
4013
+ /* @__PURE__ */ jsx10(DropdownMenuContent4, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs9(
3930
4014
  DropdownMenuCheckboxItem2,
3931
4015
  {
3932
4016
  checked: values.includes(opt.value),
@@ -3939,13 +4023,14 @@ function CheckboxFilterChip({
3939
4023
  opt.value
3940
4024
  )) })
3941
4025
  ] }),
3942
- /* @__PURE__ */ jsx9(FilterChipRemoveButton, { label, onRemove })
4026
+ /* @__PURE__ */ jsx10(FilterChipRemoveButton, { label, onRemove })
3943
4027
  ] });
3944
4028
  }
3945
4029
  function RadioFilterChip({
3946
4030
  definition,
3947
4031
  value,
3948
4032
  autoOpen,
4033
+ container,
3949
4034
  onChangeValue,
3950
4035
  onRemove
3951
4036
  }) {
@@ -3954,9 +4039,9 @@ function RadioFilterChip({
3954
4039
  const selectedValue = asRadioValue(value);
3955
4040
  const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
3956
4041
  const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
3957
- return /* @__PURE__ */ jsxs8(ButtonGroup2, { children: [
3958
- /* @__PURE__ */ jsx9(ButtonGroupText2, { children: label }),
3959
- searchable ? /* @__PURE__ */ jsxs8(
4042
+ return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
4043
+ /* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
4044
+ searchable ? /* @__PURE__ */ jsxs9(
3960
4045
  Combobox2,
3961
4046
  {
3962
4047
  items: options,
@@ -3968,38 +4053,46 @@ function RadioFilterChip({
3968
4053
  return onChangeValue((_a2 = next == null ? void 0 : next.value) != null ? _a2 : "");
3969
4054
  },
3970
4055
  children: [
3971
- /* @__PURE__ */ jsx9(
4056
+ /* @__PURE__ */ jsx10(
3972
4057
  ComboboxTrigger2,
3973
4058
  {
3974
- render: /* @__PURE__ */ jsx9(Button6, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
3975
- children: /* @__PURE__ */ jsx9("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
4059
+ render: /* @__PURE__ */ jsx10(Button6, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
4060
+ children: /* @__PURE__ */ jsx10("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
3976
4061
  }
3977
4062
  ),
3978
- /* @__PURE__ */ jsxs8(ComboboxContent2, { className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
3979
- /* @__PURE__ */ jsx9(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
3980
- /* @__PURE__ */ jsxs8(ComboboxEmpty2, { children: [
3981
- "No ",
3982
- label.toLowerCase(),
3983
- " found."
3984
- ] }),
3985
- /* @__PURE__ */ jsx9(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs8(ComboboxItem2, { value: item, children: [
3986
- item.icon,
3987
- item.label
3988
- ] }, item.value) })
3989
- ] })
4063
+ /* @__PURE__ */ jsxs9(
4064
+ ComboboxContent2,
4065
+ {
4066
+ container,
4067
+ className: "min-w-64",
4068
+ collisionAvoidance: { side: "none", align: "shift" },
4069
+ children: [
4070
+ /* @__PURE__ */ jsx10(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
4071
+ /* @__PURE__ */ jsxs9(ComboboxEmpty2, { children: [
4072
+ "No ",
4073
+ label.toLowerCase(),
4074
+ " found."
4075
+ ] }),
4076
+ /* @__PURE__ */ jsx10(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs9(ComboboxItem2, { value: item, children: [
4077
+ item.icon,
4078
+ item.label
4079
+ ] }, item.value) })
4080
+ ]
4081
+ }
4082
+ )
3990
4083
  ]
3991
4084
  }
3992
- ) : /* @__PURE__ */ jsxs8(DropdownMenu4, { defaultOpen: autoOpen, children: [
3993
- /* @__PURE__ */ jsx9(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs8(Button6, { variant: "outline", className: "gap-1 font-normal", children: [
3994
- /* @__PURE__ */ jsx9("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
3995
- /* @__PURE__ */ jsx9(Icon7, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
4085
+ ) : /* @__PURE__ */ jsxs9(DropdownMenu4, { defaultOpen: autoOpen, children: [
4086
+ /* @__PURE__ */ jsx10(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs9(Button6, { variant: "outline", className: "gap-1 font-normal", children: [
4087
+ /* @__PURE__ */ jsx10("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
4088
+ /* @__PURE__ */ jsx10(Icon8, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
3996
4089
  ] }) }),
3997
- /* @__PURE__ */ jsx9(DropdownMenuContent4, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx9(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__PURE__ */ jsxs8(DropdownMenuRadioItem, { value: opt.value, children: [
4090
+ /* @__PURE__ */ jsx10(DropdownMenuContent4, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx10(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__PURE__ */ jsxs9(DropdownMenuRadioItem, { value: opt.value, children: [
3998
4091
  opt.icon,
3999
4092
  opt.label
4000
4093
  ] }, opt.value)) }) })
4001
4094
  ] }),
4002
- /* @__PURE__ */ jsx9(FilterChipRemoveButton, { label, onRemove })
4095
+ /* @__PURE__ */ jsx10(FilterChipRemoveButton, { label, onRemove })
4003
4096
  ] });
4004
4097
  }
4005
4098
  function TextFilterChip({
@@ -4011,12 +4104,12 @@ function TextFilterChip({
4011
4104
  }) {
4012
4105
  const { label, placeholder } = definition;
4013
4106
  const text = asTextValue(value);
4014
- const [open, setOpen] = React6.useState(!!autoOpen);
4015
- return /* @__PURE__ */ jsxs8(ButtonGroup2, { children: [
4016
- /* @__PURE__ */ jsx9(ButtonGroupText2, { children: label }),
4017
- /* @__PURE__ */ jsxs8(Popover2, { open, onOpenChange: setOpen, children: [
4018
- /* @__PURE__ */ jsx9(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx9(Button6, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx9("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
4019
- /* @__PURE__ */ jsx9(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx9(
4107
+ const [open, setOpen] = React7.useState(!!autoOpen);
4108
+ return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
4109
+ /* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
4110
+ /* @__PURE__ */ jsxs9(Popover2, { open, onOpenChange: setOpen, children: [
4111
+ /* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(Button6, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx10("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
4112
+ /* @__PURE__ */ jsx10(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx10(
4020
4113
  Input2,
4021
4114
  {
4022
4115
  autoFocus: true,
@@ -4029,7 +4122,7 @@ function TextFilterChip({
4029
4122
  }
4030
4123
  ) })
4031
4124
  ] }),
4032
- /* @__PURE__ */ jsx9(FilterChipRemoveButton, { label, onRemove })
4125
+ /* @__PURE__ */ jsx10(FilterChipRemoveButton, { label, onRemove })
4033
4126
  ] });
4034
4127
  }
4035
4128
  function MultiTextFilterChip({
@@ -4041,7 +4134,7 @@ function MultiTextFilterChip({
4041
4134
  }) {
4042
4135
  const { label, placeholder } = definition;
4043
4136
  const tokens = asMultiTextValue(value);
4044
- const [draft, setDraft] = React6.useState("");
4137
+ const [draft, setDraft] = React7.useState("");
4045
4138
  const displayLabel = tokens.length === 0 ? "Any" : tokens.length === 1 ? tokens[0] : `${tokens.length} values`;
4046
4139
  function addToken() {
4047
4140
  const token = draft.trim();
@@ -4055,25 +4148,25 @@ function MultiTextFilterChip({
4055
4148
  function removeToken(token) {
4056
4149
  onChangeValue(tokens.filter((t) => t !== token));
4057
4150
  }
4058
- return /* @__PURE__ */ jsxs8(ButtonGroup2, { children: [
4059
- /* @__PURE__ */ jsx9(ButtonGroupText2, { children: label }),
4060
- /* @__PURE__ */ jsxs8(Popover2, { defaultOpen: autoOpen, children: [
4061
- /* @__PURE__ */ jsx9(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx9(Button6, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx9("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
4062
- /* @__PURE__ */ jsx9(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2", children: [
4063
- tokens.length > 0 && /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs8(Badge2, { variant: "secondary", className: "gap-1", children: [
4151
+ return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
4152
+ /* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
4153
+ /* @__PURE__ */ jsxs9(Popover2, { defaultOpen: autoOpen, children: [
4154
+ /* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(Button6, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx10("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
4155
+ /* @__PURE__ */ jsx10(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2", children: [
4156
+ tokens.length > 0 && /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs9(Badge2, { variant: "secondary", className: "gap-1", children: [
4064
4157
  token,
4065
- /* @__PURE__ */ jsx9(
4158
+ /* @__PURE__ */ jsx10(
4066
4159
  "button",
4067
4160
  {
4068
4161
  type: "button",
4069
4162
  "aria-label": `Remove ${token}`,
4070
4163
  onClick: () => removeToken(token),
4071
4164
  className: "cursor-pointer",
4072
- children: /* @__PURE__ */ jsx9(Icon7, { name: "xmark", size: "xs" })
4165
+ children: /* @__PURE__ */ jsx10(Icon8, { name: "xmark", size: "xs" })
4073
4166
  }
4074
4167
  )
4075
4168
  ] }, token)) }),
4076
- /* @__PURE__ */ jsx9(
4169
+ /* @__PURE__ */ jsx10(
4077
4170
  Input2,
4078
4171
  {
4079
4172
  autoFocus: true,
@@ -4092,7 +4185,7 @@ function MultiTextFilterChip({
4092
4185
  )
4093
4186
  ] }) })
4094
4187
  ] }),
4095
- /* @__PURE__ */ jsx9(FilterChipRemoveButton, { label, onRemove })
4188
+ /* @__PURE__ */ jsx10(FilterChipRemoveButton, { label, onRemove })
4096
4189
  ] });
4097
4190
  }
4098
4191
  function DateFilterChip({
@@ -4122,12 +4215,12 @@ function DateFilterChip({
4122
4215
  if (!endDate) return;
4123
4216
  onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
4124
4217
  }
4125
- return /* @__PURE__ */ jsxs8(ButtonGroup2, { children: [
4126
- /* @__PURE__ */ jsx9(ButtonGroupText2, { children: label }),
4127
- /* @__PURE__ */ jsxs8(Popover2, { defaultOpen: autoOpen, children: [
4128
- /* @__PURE__ */ jsx9(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx9(Button6, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx9("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
4129
- /* @__PURE__ */ jsx9(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2", children: [
4130
- /* @__PURE__ */ jsx9(
4218
+ return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
4219
+ /* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
4220
+ /* @__PURE__ */ jsxs9(Popover2, { defaultOpen: autoOpen, children: [
4221
+ /* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(Button6, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx10("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
4222
+ /* @__PURE__ */ jsx10(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2", children: [
4223
+ /* @__PURE__ */ jsx10(
4131
4224
  Calendar2,
4132
4225
  {
4133
4226
  mode: "range",
@@ -4135,9 +4228,9 @@ function DateFilterChip({
4135
4228
  onSelect: pickRange
4136
4229
  }
4137
4230
  ),
4138
- showTimeInputs && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2", children: [
4139
- /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center gap-2", children: [
4140
- /* @__PURE__ */ jsx9(
4231
+ showTimeInputs && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2", children: [
4232
+ /* @__PURE__ */ jsxs9("div", { className: "flex w-full items-center gap-2", children: [
4233
+ /* @__PURE__ */ jsx10(
4141
4234
  Label3,
4142
4235
  {
4143
4236
  htmlFor: `${definition.key}-start-time`,
@@ -4145,7 +4238,7 @@ function DateFilterChip({
4145
4238
  children: "Start"
4146
4239
  }
4147
4240
  ),
4148
- /* @__PURE__ */ jsx9(
4241
+ /* @__PURE__ */ jsx10(
4149
4242
  Input2,
4150
4243
  {
4151
4244
  id: `${definition.key}-start-time`,
@@ -4157,8 +4250,8 @@ function DateFilterChip({
4157
4250
  }
4158
4251
  )
4159
4252
  ] }),
4160
- /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center gap-2", children: [
4161
- /* @__PURE__ */ jsx9(
4253
+ /* @__PURE__ */ jsxs9("div", { className: "flex w-full items-center gap-2", children: [
4254
+ /* @__PURE__ */ jsx10(
4162
4255
  Label3,
4163
4256
  {
4164
4257
  htmlFor: `${definition.key}-end-time`,
@@ -4166,7 +4259,7 @@ function DateFilterChip({
4166
4259
  children: "End"
4167
4260
  }
4168
4261
  ),
4169
- /* @__PURE__ */ jsx9(
4262
+ /* @__PURE__ */ jsx10(
4170
4263
  Input2,
4171
4264
  {
4172
4265
  id: `${definition.key}-end-time`,
@@ -4181,7 +4274,7 @@ function DateFilterChip({
4181
4274
  ] })
4182
4275
  ] }) })
4183
4276
  ] }),
4184
- /* @__PURE__ */ jsx9(FilterChipRemoveButton, { label, onRemove })
4277
+ /* @__PURE__ */ jsx10(FilterChipRemoveButton, { label, onRemove })
4185
4278
  ] });
4186
4279
  }
4187
4280
 
@@ -4192,7 +4285,7 @@ var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
4192
4285
  var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
4193
4286
 
4194
4287
  // src/data-table/view-filter.tsx
4195
- import { jsx as jsx10 } from "react/jsx-runtime";
4288
+ import { jsx as jsx11 } from "react/jsx-runtime";
4196
4289
  function toFilterOption(opt) {
4197
4290
  return typeof opt === "string" ? { value: opt, label: opt } : { value: opt.value, label: opt.label };
4198
4291
  }
@@ -4235,7 +4328,7 @@ function ViewFilter({
4235
4328
  onColumnFiltersChange,
4236
4329
  className
4237
4330
  }) {
4238
- const filterableColumns = React7.useMemo(
4331
+ const filterableColumns = React8.useMemo(
4239
4332
  () => columns.filter((column) => !isFilterOnlyColumn(column) && column.getCanFilter()).flatMap((column) => {
4240
4333
  var _a;
4241
4334
  const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
@@ -4243,19 +4336,19 @@ function ViewFilter({
4243
4336
  }),
4244
4337
  [columns]
4245
4338
  );
4246
- const filterDefinitions = React7.useMemo(
4339
+ const filterDefinitions = React8.useMemo(
4247
4340
  () => filterableColumns.map(({ key, filter }) => toFilterBarDefinition(key, filter)).sort((a, b) => a.order - b.order),
4248
4341
  [filterableColumns]
4249
4342
  );
4250
- const emptyValueByKey = React7.useMemo(
4343
+ const emptyValueByKey = React8.useMemo(
4251
4344
  () => new Map(filterableColumns.map(({ key, filter }) => [key, emptyValueFor(filter)])),
4252
4345
  [filterableColumns]
4253
4346
  );
4254
- const activeFilters = React7.useMemo(
4347
+ const activeFilters = React8.useMemo(
4255
4348
  () => columnFilters.map((filter) => ({ key: filter.id, value: filter.value })),
4256
4349
  [columnFilters]
4257
4350
  );
4258
- return /* @__PURE__ */ jsx10(
4351
+ return /* @__PURE__ */ jsx11(
4259
4352
  FilterBar,
4260
4353
  {
4261
4354
  className,
@@ -4269,10 +4362,10 @@ function ViewFilter({
4269
4362
  }
4270
4363
 
4271
4364
  // src/section-header.tsx
4272
- import { jsx as jsx11 } from "react/jsx-runtime";
4365
+ import { jsx as jsx12 } from "react/jsx-runtime";
4273
4366
  function SectionHeader(_a) {
4274
4367
  var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
4275
- return /* @__PURE__ */ jsx11(
4368
+ return /* @__PURE__ */ jsx12(
4276
4369
  "div",
4277
4370
  __spreadProps(__spreadValues({
4278
4371
  "data-slot": "section-header",
@@ -4284,19 +4377,19 @@ function SectionHeader(_a) {
4284
4377
  }
4285
4378
  function SectionHeaderContent(_a) {
4286
4379
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
4287
- return /* @__PURE__ */ jsx11("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
4380
+ return /* @__PURE__ */ jsx12("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
4288
4381
  }
4289
4382
  function SectionHeaderTitle(_a) {
4290
4383
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
4291
- return /* @__PURE__ */ jsx11("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
4384
+ return /* @__PURE__ */ jsx12("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
4292
4385
  }
4293
4386
  function SectionHeaderDescription(_a) {
4294
4387
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
4295
- return /* @__PURE__ */ jsx11("p", __spreadValues({ "data-slot": "section-header-description", className: cn("text-body text-muted-foreground", className) }, props));
4388
+ return /* @__PURE__ */ jsx12("p", __spreadValues({ "data-slot": "section-header-description", className: cn("text-body text-muted-foreground", className) }, props));
4296
4389
  }
4297
4390
 
4298
4391
  // src/data-table/data-table.tsx
4299
- import { Fragment as Fragment7, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
4392
+ import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
4300
4393
  var DEFAULT_PAGE_SIZE = 20;
4301
4394
  function DataTable({
4302
4395
  id,
@@ -4347,23 +4440,24 @@ function DataTable({
4347
4440
  initialColumnSizing,
4348
4441
  onColumnSizingPersist,
4349
4442
  stickyHeader = false,
4350
- celFilterConfig
4443
+ celFilterConfig,
4444
+ filterVisibility
4351
4445
  }) {
4352
4446
  var _a, _b, _c, _d, _e, _f;
4353
4447
  const isGrid = layout === "grid";
4354
- const tableBodyScrollRef = React8.useRef(null);
4355
- const [innerGlobalFilter, setInnerGlobalFilter] = React8.useState("");
4356
- const [innerColumnOrdering, setInnerColumnOrdering] = React8.useState([]);
4357
- const [innerColumnFilters, setInnerColumnFilters] = React8.useState([]);
4358
- const [innerSorting, setInnerSorting] = React8.useState(((_a = config.state) == null ? void 0 : _a.sorting) || []);
4359
- const [innerColumnPinning, setInnerColumnPinning] = React8.useState({ left: [], right: [] });
4360
- const [innerPagination, setInnerPagination] = React8.useState({
4448
+ const tableBodyScrollRef = React9.useRef(null);
4449
+ const [innerGlobalFilter, setInnerGlobalFilter] = React9.useState("");
4450
+ const [innerColumnOrdering, setInnerColumnOrdering] = React9.useState([]);
4451
+ const [innerColumnFilters, setInnerColumnFilters] = React9.useState([]);
4452
+ const [innerSorting, setInnerSorting] = React9.useState(((_a = config.state) == null ? void 0 : _a.sorting) || []);
4453
+ const [innerColumnPinning, setInnerColumnPinning] = React9.useState({ left: [], right: [] });
4454
+ const [innerPagination, setInnerPagination] = React9.useState({
4361
4455
  pageIndex: ((_c = (_b = config.state) == null ? void 0 : _b.pagination) == null ? void 0 : _c.pageIndex) || 0,
4362
4456
  pageSize: ((_e = (_d = config.state) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) || DEFAULT_PAGE_SIZE
4363
4457
  });
4364
- const [innerGrouping, setInnerGrouping] = React8.useState([]);
4365
- const [innerColumnVisibility, setInnerColumnVisibility] = React8.useState({});
4366
- const [innerExpanded, setInnerExpanded] = React8.useState({});
4458
+ const [innerGrouping, setInnerGrouping] = React9.useState([]);
4459
+ const [innerColumnVisibility, setInnerColumnVisibility] = React9.useState({});
4460
+ const [innerExpanded, setInnerExpanded] = React9.useState({});
4367
4461
  const {
4368
4462
  columnSizing,
4369
4463
  handleColumnSizingChange,
@@ -4375,6 +4469,11 @@ function DataTable({
4375
4469
  onColumnSizingPersist,
4376
4470
  maxSize: isGrid ? RESIZE_MAX_UNBOUNDED : void 0
4377
4471
  });
4472
+ const {
4473
+ showFilterToggle: filterToggleRequested,
4474
+ filterRowVisible,
4475
+ setFilterRowVisible
4476
+ } = useFilterVisibility(filterVisibility);
4378
4477
  const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
4379
4478
  const applyGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
4380
4479
  const columnFilters = parentColumnFilters || innerColumnFilters;
@@ -4382,25 +4481,25 @@ function DataTable({
4382
4481
  const pagination = parentPagination || innerPagination;
4383
4482
  const setPagination = parentSetPagination != null ? parentSetPagination : setInnerPagination;
4384
4483
  const shouldDisablePagination = paginationConfig === false;
4385
- const resetPageIndexOnFilterChange = React8.useCallback(() => {
4484
+ const resetPageIndexOnFilterChange = React9.useCallback(() => {
4386
4485
  if (!serverSidePagination || pagination.pageIndex === 0) return;
4387
4486
  setPagination((prev) => __spreadProps(__spreadValues({}, prev), { pageIndex: 0 }));
4388
4487
  }, [serverSidePagination, pagination.pageIndex, setPagination]);
4389
- const setGlobalFilter = React8.useCallback(
4488
+ const setGlobalFilter = React9.useCallback(
4390
4489
  (value) => {
4391
4490
  applyGlobalFilter(value);
4392
4491
  resetPageIndexOnFilterChange();
4393
4492
  },
4394
4493
  [applyGlobalFilter, resetPageIndexOnFilterChange]
4395
4494
  );
4396
- const setColumnFilters = React8.useCallback(
4495
+ const setColumnFilters = React9.useCallback(
4397
4496
  (value) => {
4398
4497
  applyColumnFilters(value);
4399
4498
  resetPageIndexOnFilterChange();
4400
4499
  },
4401
4500
  [applyColumnFilters, resetPageIndexOnFilterChange]
4402
4501
  );
4403
- React8.useLayoutEffect(() => {
4502
+ React9.useLayoutEffect(() => {
4404
4503
  var _a2;
4405
4504
  if (shouldDisablePagination) return;
4406
4505
  (_a2 = tableBodyScrollRef.current) == null ? void 0 : _a2.scrollTo({ top: 0 });
@@ -4482,7 +4581,9 @@ function DataTable({
4482
4581
  const flatColumns = table.getAllFlatColumns();
4483
4582
  const displayableColumns = flatColumns.filter((col) => !isFilterOnlyColumn(col));
4484
4583
  const orderedVisibleColumns = table.getVisibleLeafColumns().filter((col) => !isFilterOnlyColumn(col));
4485
- const [gridMeasuredMins, setGridMeasuredMins] = React8.useState({});
4584
+ const hasFilters = !!celFilterConfig || hasFilterableColumns(flatColumns);
4585
+ const showFilterToggle = filterToggleRequested && !disableFilters && hasFilters;
4586
+ const [gridMeasuredMins, setGridMeasuredMins] = React9.useState({});
4486
4587
  const { gridTemplateColumns, gridRootRef, handleAutosizeAll, handleAutosizeColumn, handleResetColumnSize } = useGridLayout({
4487
4588
  layout,
4488
4589
  table,
@@ -4496,7 +4597,7 @@ function DataTable({
4496
4597
  rawHandleAutosizeColumn,
4497
4598
  rawHandleResetColumnSize
4498
4599
  });
4499
- const handleContextCell = React8.useCallback(
4600
+ const handleContextCell = React9.useCallback(
4500
4601
  (filter, cell) => {
4501
4602
  var _a2, _b2;
4502
4603
  if (celFilterConfig == null ? void 0 : celFilterConfig.onContextualFilter) {
@@ -4513,13 +4614,13 @@ function DataTable({
4513
4614
  },
4514
4615
  [celFilterConfig, onContextCell, setColumnFilters, table]
4515
4616
  );
4516
- const handleContextSearch = React8.useCallback(
4617
+ const handleContextSearch = React9.useCallback(
4517
4618
  (searchTerm) => {
4518
4619
  setGlobalFilter(searchTerm);
4519
4620
  },
4520
4621
  [setGlobalFilter]
4521
4622
  );
4522
- const totalTableWidth = React8.useMemo(() => {
4623
+ const totalTableWidth = React9.useMemo(() => {
4523
4624
  if (isGrid) return 0;
4524
4625
  const firstGroup = headerGroups[0];
4525
4626
  if (!firstGroup) return 0;
@@ -4543,12 +4644,12 @@ function DataTable({
4543
4644
  }
4544
4645
  setGlobalFilter("");
4545
4646
  };
4546
- React8.useEffect(() => {
4647
+ React9.useEffect(() => {
4547
4648
  if (parentGlobalFilter !== void 0) {
4548
4649
  setInnerGlobalFilter(parentGlobalFilter);
4549
4650
  }
4550
4651
  }, [parentGlobalFilter]);
4551
- React8.useEffect(() => {
4652
+ React9.useEffect(() => {
4552
4653
  if (disableColumnReordering) return;
4553
4654
  const allColumnIds = flatColumns.map((col) => col.id);
4554
4655
  const normalizedColumnOrdering = normalizeColumnOrdering(columnOrdering, allColumnIds);
@@ -4558,9 +4659,9 @@ function DataTable({
4558
4659
  }, [columnOrdering, disableColumnReordering, flatColumns, setColumnOrdering]);
4559
4660
  const showViewHeader = !!title || !!Actions;
4560
4661
  const showColumnOptions = !disableColumnReordering || !disableColumnVisibility;
4561
- const toolbarSearch = !disableSearch && /* @__PURE__ */ jsxs9(InputGroup2, { className: "w-70", children: [
4562
- /* @__PURE__ */ jsx12(InputGroupAddon2, { align: "inline-start", children: /* @__PURE__ */ jsx12(Icon8, { name: "magnifying-glass" }) }),
4563
- /* @__PURE__ */ jsx12(
4662
+ const toolbarSearch = !disableSearch && /* @__PURE__ */ jsxs10(InputGroup2, { className: "w-70", children: [
4663
+ /* @__PURE__ */ jsx13(InputGroupAddon2, { align: "inline-start", children: /* @__PURE__ */ jsx13(Icon9, { name: "magnifying-glass" }) }),
4664
+ /* @__PURE__ */ jsx13(
4564
4665
  InputGroupInput2,
4565
4666
  {
4566
4667
  "aria-label": "Search",
@@ -4571,7 +4672,7 @@ function DataTable({
4571
4672
  }
4572
4673
  )
4573
4674
  ] });
4574
- const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx12(
4675
+ const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx13(
4575
4676
  ColumnOptions,
4576
4677
  {
4577
4678
  columns: flatColumns,
@@ -4580,7 +4681,7 @@ function DataTable({
4580
4681
  disableColumnOrdering: disableColumnReordering
4581
4682
  }
4582
4683
  );
4583
- return /* @__PURE__ */ jsxs9(
4684
+ return /* @__PURE__ */ jsxs10(
4584
4685
  "div",
4585
4686
  {
4586
4687
  id: `table-${id}`,
@@ -4591,18 +4692,19 @@ function DataTable({
4591
4692
  className
4592
4693
  ),
4593
4694
  children: [
4594
- showViewHeader && /* @__PURE__ */ jsx12(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */ jsxs9(SectionHeaderContent, { children: [
4595
- !!title && /* @__PURE__ */ jsx12(SectionHeaderTitle, { children: title }),
4596
- !!description && /* @__PURE__ */ jsx12(SectionHeaderDescription, { children: description })
4695
+ showViewHeader && /* @__PURE__ */ jsx13(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */ jsxs10(SectionHeaderContent, { children: [
4696
+ !!title && /* @__PURE__ */ jsx13(SectionHeaderTitle, { children: title }),
4697
+ !!description && /* @__PURE__ */ jsx13(SectionHeaderDescription, { children: description })
4597
4698
  ] }) }),
4598
- /* @__PURE__ */ jsxs9("div", { className: "mb-4 flex flex-row gap-2", children: [
4699
+ /* @__PURE__ */ jsxs10("div", { className: "mb-4 flex flex-row gap-2", children: [
4599
4700
  toolbarSearch,
4600
- /* @__PURE__ */ jsxs9("div", { className: "ml-auto flex items-center gap-2", children: [
4601
- !!Actions && /* @__PURE__ */ jsx12(Actions, { state: tableState }),
4701
+ /* @__PURE__ */ jsxs10("div", { className: "ml-auto flex items-center gap-2", children: [
4702
+ showFilterToggle && /* @__PURE__ */ jsx13(FilterToggle, { pressed: filterRowVisible, onPressedChange: setFilterRowVisible, count: filterCount }),
4703
+ !!Actions && /* @__PURE__ */ jsx13(Actions, { state: tableState }),
4602
4704
  toolbarColumns
4603
4705
  ] })
4604
4706
  ] }),
4605
- !disableFilters && /* @__PURE__ */ jsx12("div", { className: "flex w-full", children: celFilterConfig ? /* @__PURE__ */ jsx12("div", { className: cn("mr-2 mb-4 min-w-0 flex-1", celFilterClassName), children: /* @__PURE__ */ jsx12(
4707
+ !disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */ jsx13("div", { className: "flex w-full", children: celFilterConfig ? /* @__PURE__ */ jsx13("div", { className: cn("mr-2 mb-4 min-w-0 flex-1", celFilterClassName), children: /* @__PURE__ */ jsx13(
4606
4708
  CelFilterBar,
4607
4709
  {
4608
4710
  schema: celFilterConfig.schema,
@@ -4612,7 +4714,7 @@ function DataTable({
4612
4714
  onRestrictedOptionSelect: celFilterConfig.onRestrictedOptionSelect,
4613
4715
  showClearButton: celFilterConfig.showClearButton
4614
4716
  }
4615
- ) }) : /* @__PURE__ */ jsx12(
4717
+ ) }) : /* @__PURE__ */ jsx13(
4616
4718
  ViewFilter,
4617
4719
  {
4618
4720
  columns: flatColumns,
@@ -4621,8 +4723,8 @@ function DataTable({
4621
4723
  className: "data-[visible-filters=true]:mb-4"
4622
4724
  }
4623
4725
  ) }),
4624
- shouldRenderTableContent ? /* @__PURE__ */ jsxs9(Fragment7, { children: [
4625
- /* @__PURE__ */ jsx12("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "table-main", children: /* @__PURE__ */ jsx12(
4726
+ shouldRenderTableContent ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
4727
+ /* @__PURE__ */ jsx13("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "table-main", children: /* @__PURE__ */ jsx13(
4626
4728
  "div",
4627
4729
  {
4628
4730
  ref: tableBodyScrollRef,
@@ -4630,7 +4732,7 @@ function DataTable({
4630
4732
  "min-h-0 flex-1 overflow-auto rounded-lg border **:data-[slot=table-container]:overflow-visible",
4631
4733
  !!stickyHeader && "max-h-[calc(100svh-250px)]"
4632
4734
  ),
4633
- children: /* @__PURE__ */ jsxs9(
4735
+ children: /* @__PURE__ */ jsxs10(
4634
4736
  DataTableRoot,
4635
4737
  {
4636
4738
  layout,
@@ -4638,7 +4740,7 @@ function DataTable({
4638
4740
  gridRootRef,
4639
4741
  style: isGrid ? { width: "100%" } : totalTableWidth > 0 ? { width: `max(100%, ${totalTableWidth}px)`, minWidth: "100%" } : { width: "100%" },
4640
4742
  children: [
4641
- /* @__PURE__ */ jsx12(
4743
+ /* @__PURE__ */ jsx13(
4642
4744
  DataTableHeader,
4643
4745
  {
4644
4746
  headerGroups,
@@ -4649,7 +4751,7 @@ function DataTable({
4649
4751
  layout
4650
4752
  }
4651
4753
  ),
4652
- /* @__PURE__ */ jsx12(
4754
+ /* @__PURE__ */ jsx13(
4653
4755
  DataTableBody,
4654
4756
  {
4655
4757
  tableRows,
@@ -4671,7 +4773,7 @@ function DataTable({
4671
4773
  )
4672
4774
  }
4673
4775
  ) }),
4674
- !shouldDisablePagination && !!pagination && /* @__PURE__ */ jsx12(
4776
+ !shouldDisablePagination && !!pagination && /* @__PURE__ */ jsx13(
4675
4777
  DataTablePagination,
4676
4778
  {
4677
4779
  rowCount,
@@ -4683,7 +4785,7 @@ function DataTable({
4683
4785
  onPageSizeChange: (nextPageSize) => setPagination((prev) => __spreadProps(__spreadValues({}, prev || pagination), { pageIndex: 0, pageSize: nextPageSize }))
4684
4786
  }
4685
4787
  )
4686
- ] }) : /* @__PURE__ */ jsx12(
4788
+ ] }) : /* @__PURE__ */ jsx13(
4687
4789
  DataTableEmptyView,
4688
4790
  {
4689
4791
  emptyView,