schummar-table 0.43.1 → 0.44.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.
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  defaultClasses,
9
9
  globalTableTheme,
10
10
  mergeThemes
11
- } from "./chunk-FTCKJOPQ.js";
11
+ } from "./chunk-NTYYITKA.js";
12
12
  import "./chunk-WFCJ3D3G.js";
13
13
  import {
14
14
  __async,
@@ -791,13 +791,13 @@ var FilterControlContext = createContext3({
791
791
  isActive: false,
792
792
  close: () => void 0
793
793
  });
794
- function FilterControl() {
794
+ function FilterControl({
795
+ component: Component = DefaultButton,
796
+ onClose
797
+ }) {
795
798
  const table = useTableContext();
796
799
  const columnId = useColumnContext();
797
- const IconButton2 = useTheme((t) => t.components.IconButton);
798
800
  const Popover2 = useTheme((t) => t.components.Popover);
799
- const FilterList2 = useTheme((t) => t.icons.FilterList);
800
- const ArrowDropDown2 = useTheme((t) => t.icons.ArrowDropDown);
801
801
  const classes = useTheme((t) => t.classes);
802
802
  const cssVariables = useCssVariables();
803
803
  const [anchor, setAnchor] = useState2(null);
@@ -817,14 +817,14 @@ function FilterControl() {
817
817
  }
818
818
  );
819
819
  function reset() {
820
- table.update((state) => {
821
- var _a;
822
- const impl = state.filters.get(columnId);
823
- (_a = impl == null ? void 0 : impl.onChange) == null ? void 0 : _a.call(impl, void 0);
824
- if ((impl == null ? void 0 : impl.value) === void 0) {
820
+ var _a;
821
+ const impl = table.getState().filters.get(columnId);
822
+ (_a = impl == null ? void 0 : impl.onChange) == null ? void 0 : _a.call(impl, void 0);
823
+ if ((impl == null ? void 0 : impl.value) === void 0) {
824
+ table.update((state) => {
825
825
  state.filterValues.delete(columnId);
826
- }
827
- });
826
+ });
827
+ }
828
828
  }
829
829
  const context = useMemo2(
830
830
  () => ({
@@ -836,7 +836,7 @@ function FilterControl() {
836
836
  if (!filter) return null;
837
837
  return /* @__PURE__ */ jsxs7(FilterControlContext.Provider, { value: context, children: [
838
838
  /* @__PURE__ */ jsx9(
839
- "div",
839
+ Component,
840
840
  {
841
841
  onClick: (event) => setAnchor(event.currentTarget),
842
842
  onContextMenu: (event) => {
@@ -844,18 +844,7 @@ function FilterControl() {
844
844
  event.preventDefault();
845
845
  return false;
846
846
  },
847
- children: /* @__PURE__ */ jsx9(
848
- IconButton2,
849
- {
850
- css: [
851
- { color: "#b0bac9" },
852
- isActive && {
853
- color: "var(--primaryMain) !important"
854
- }
855
- ],
856
- children: isActive ? /* @__PURE__ */ jsx9(FilterList2, {}) : /* @__PURE__ */ jsx9(ArrowDropDown2, {})
857
- }
858
- )
847
+ isActive
859
848
  }
860
849
  ),
861
850
  /* @__PURE__ */ jsx9(
@@ -872,7 +861,10 @@ function FilterControl() {
872
861
  {
873
862
  open: true,
874
863
  hidden: !anchor,
875
- onClose: () => setAnchor(null),
864
+ onClose: () => {
865
+ setAnchor(null);
866
+ onClose == null ? void 0 : onClose();
867
+ },
876
868
  anchorEl: anchor != null ? anchor : document.body,
877
869
  css: cssVariables,
878
870
  className: cx(classes == null ? void 0 : classes.popover, filterClassNames == null ? void 0 : filterClassNames.popover),
@@ -884,6 +876,24 @@ function FilterControl() {
884
876
  )
885
877
  ] });
886
878
  }
879
+ function DefaultButton(_a) {
880
+ var _b = _a, { isActive } = _b, props = __objRest(_b, ["isActive"]);
881
+ const IconButton2 = useTheme((t) => t.components.IconButton);
882
+ const FilterList2 = useTheme((t) => t.icons.FilterList);
883
+ const ArrowDropDown2 = useTheme((t) => t.icons.ArrowDropDown);
884
+ return /* @__PURE__ */ jsx9(
885
+ IconButton2,
886
+ __spreadProps(__spreadValues({}, props), {
887
+ css: [
888
+ { color: "#b0bac9" },
889
+ isActive && {
890
+ color: "var(--primaryMain) !important"
891
+ }
892
+ ],
893
+ children: isActive ? /* @__PURE__ */ jsx9(FilterList2, {}) : /* @__PURE__ */ jsx9(ArrowDropDown2, {})
894
+ })
895
+ );
896
+ }
887
897
 
888
898
  // src/components/autoFocusTextField.tsx
889
899
  import { jsx as jsx10 } from "@emotion/react/jsx-runtime";
@@ -1011,6 +1021,83 @@ function useFilter(impl) {
1011
1021
  }, context);
1012
1022
  }
1013
1023
 
1024
+ // src/components/combinedFilter.tsx
1025
+ import { jsx as jsx11 } from "@emotion/react/jsx-runtime";
1026
+ function CombinedFilter(_a) {
1027
+ var _b = _a, {
1028
+ columnIds: inputColumnIds
1029
+ } = _b, props = __objRest(_b, [
1030
+ "columnIds"
1031
+ ]);
1032
+ const table = useTableContext();
1033
+ const columnIds = table.useState((state) => {
1034
+ return inputColumnIds != null ? inputColumnIds : state.activeColumns.filter(
1035
+ (column) => column.filter !== void 0 && !state.visibleColumns.some((c) => c.id === column.id)
1036
+ ).map((column) => column.id);
1037
+ });
1038
+ const isActive = table.useState((state) => {
1039
+ return columnIds.some((columnId) => {
1040
+ const filter = state.filters.get(columnId);
1041
+ const filterValue = state.filterValues.get(columnId);
1042
+ return filter !== void 0 && filterValue !== void 0 && filter.isActive(filterValue);
1043
+ });
1044
+ });
1045
+ useFilter(__spreadProps(__spreadValues({}, props), {
1046
+ id: "combinedFilter",
1047
+ value: isActive,
1048
+ isActive(filterValue) {
1049
+ return filterValue;
1050
+ },
1051
+ test() {
1052
+ return true;
1053
+ },
1054
+ onChange(value) {
1055
+ var _a2;
1056
+ if (value === void 0) {
1057
+ for (const columnId of columnIds) {
1058
+ const impl = table.getState().filters.get(columnId);
1059
+ (_a2 = impl == null ? void 0 : impl.onChange) == null ? void 0 : _a2.call(impl, void 0);
1060
+ if ((impl == null ? void 0 : impl.value) === void 0) {
1061
+ table.update((state) => {
1062
+ state.filterValues.delete(columnId);
1063
+ });
1064
+ }
1065
+ }
1066
+ }
1067
+ }
1068
+ }));
1069
+ return /* @__PURE__ */ jsx11("div", { children: columnIds.map((columnId) => /* @__PURE__ */ jsx11(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ jsx11(FilterControl, { component: Filter }) }, columnId)) });
1070
+ }
1071
+ function Filter(_a) {
1072
+ var _b = _a, { isActive } = _b, props = __objRest(_b, ["isActive"]);
1073
+ const table = useTableContext();
1074
+ const columnId = useColumnContext();
1075
+ const FilterList2 = useTheme((t) => t.icons.FilterList);
1076
+ const label = table.useState((state) => {
1077
+ var _a2, _b2;
1078
+ return (_b2 = (_a2 = state.activeColumns.find((column) => column.id === columnId)) == null ? void 0 : _a2.header) != null ? _b2 : null;
1079
+ });
1080
+ const Button2 = useTheme((t) => t.components.Button);
1081
+ return /* @__PURE__ */ jsx11(
1082
+ Button2,
1083
+ __spreadProps(__spreadValues({}, props), {
1084
+ startIcon: /* @__PURE__ */ jsx11(
1085
+ FilterList2,
1086
+ {
1087
+ css: {
1088
+ color: isActive ? "var(--primaryMain)" : "#b0bac9"
1089
+ }
1090
+ }
1091
+ ),
1092
+ css: {
1093
+ width: "100%",
1094
+ color: isActive ? "var(--primaryMain)" : "var(--color-text)"
1095
+ },
1096
+ children: label
1097
+ })
1098
+ );
1099
+ }
1100
+
1014
1101
  // src/components/datePicker.tsx
1015
1102
  import { useDayzed } from "dayzed";
1016
1103
  import {
@@ -1036,7 +1123,7 @@ function defaults(first, ...more) {
1036
1123
 
1037
1124
  // src/components/dateInput.tsx
1038
1125
  import { Fragment, useMemo as useMemo4, useState as useState4 } from "react";
1039
- import { jsx as jsx11 } from "@emotion/react/jsx-runtime";
1126
+ import { jsx as jsx12 } from "@emotion/react/jsx-runtime";
1040
1127
  var className = "schummar-table-date-input";
1041
1128
  var defaultDate = new Date(1970, 0, 1);
1042
1129
  var isIncludedType = (type) => type === "day" || type === "month" || type === "year";
@@ -1104,14 +1191,14 @@ function DateInput({
1104
1191
  );
1105
1192
  const parts = format.formatToParts(value != null ? value : defaultDate);
1106
1193
  const isEmpty = !value;
1107
- return /* @__PURE__ */ jsx11(
1194
+ return /* @__PURE__ */ jsx12(
1108
1195
  "div",
1109
1196
  {
1110
1197
  css: {
1111
1198
  display: "flex",
1112
1199
  alignItems: "baseline"
1113
1200
  },
1114
- children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */ jsx11(Fragment, { children: isIncludedType(type) ? /* @__PURE__ */ jsx11(
1201
+ children: parts.map(({ type, value: value2 }, index) => /* @__PURE__ */ jsx12(Fragment, { children: isIncludedType(type) ? /* @__PURE__ */ jsx12(
1115
1202
  "input",
1116
1203
  {
1117
1204
  className,
@@ -1146,20 +1233,20 @@ function DateInput({
1146
1233
  onFocus: (event) => event.target.select(),
1147
1234
  onBlur: commit
1148
1235
  }
1149
- ) : type === "literal" ? /* @__PURE__ */ jsx11("span", { children: value2 }) : null }, index))
1236
+ ) : type === "literal" ? /* @__PURE__ */ jsx12("span", { children: value2 }) : null }, index))
1150
1237
  }
1151
1238
  );
1152
1239
  }
1153
1240
 
1154
1241
  // src/components/text.tsx
1155
- import { Fragment as Fragment2, jsx as jsx12 } from "@emotion/react/jsx-runtime";
1242
+ import { Fragment as Fragment2, jsx as jsx13 } from "@emotion/react/jsx-runtime";
1156
1243
  function Text({ id }) {
1157
1244
  const text = useTheme((t) => t.text[id]);
1158
- return /* @__PURE__ */ jsx12(Fragment2, { children: text });
1245
+ return /* @__PURE__ */ jsx13(Fragment2, { children: text });
1159
1246
  }
1160
1247
 
1161
1248
  // src/components/datePicker.tsx
1162
- import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
1249
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
1163
1250
  var DatePickerContext = createContext4({});
1164
1251
  function DatePickerProvider(_a) {
1165
1252
  var _b = _a, {
@@ -1168,7 +1255,7 @@ function DatePickerProvider(_a) {
1168
1255
  "children"
1169
1256
  ]);
1170
1257
  const value = useMemo5(() => props, [JSON.stringify(props)]);
1171
- return /* @__PURE__ */ jsx13(DatePickerContext.Provider, { value, children });
1258
+ return /* @__PURE__ */ jsx14(DatePickerContext.Provider, { value, children });
1172
1259
  }
1173
1260
  var weekDays = [0, 1, 2, 3, 4, 5, 6];
1174
1261
  var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
@@ -1246,12 +1333,12 @@ var getCalendarWeek = (date) => {
1246
1333
  return weekOfYear;
1247
1334
  };
1248
1335
  var commonQuickOptions = {
1249
- today: { label: /* @__PURE__ */ jsx13(Text, { id: "today" }), value: today },
1250
- thisWeek: { label: /* @__PURE__ */ jsx13(Text, { id: "thisWeek" }), value: (props) => thisWeek(0, props.firstDayOfWeek) },
1251
- thisMonth: { label: /* @__PURE__ */ jsx13(Text, { id: "thisMonth" }), value: () => thisMonth() },
1252
- thisYear: { label: /* @__PURE__ */ jsx13(Text, { id: "thisYear" }), value: () => thisYear() },
1253
- lastSevenDays: { label: /* @__PURE__ */ jsx13(Text, { id: "lastSevenDays" }), value: () => lastDays(7) },
1254
- lastThirtyDays: { label: /* @__PURE__ */ jsx13(Text, { id: "lastThirtyDays" }), value: () => lastDays(30) }
1336
+ today: { label: /* @__PURE__ */ jsx14(Text, { id: "today" }), value: today },
1337
+ thisWeek: { label: /* @__PURE__ */ jsx14(Text, { id: "thisWeek" }), value: (props) => thisWeek(0, props.firstDayOfWeek) },
1338
+ thisMonth: { label: /* @__PURE__ */ jsx14(Text, { id: "thisMonth" }), value: () => thisMonth() },
1339
+ thisYear: { label: /* @__PURE__ */ jsx14(Text, { id: "thisYear" }), value: () => thisYear() },
1340
+ lastSevenDays: { label: /* @__PURE__ */ jsx14(Text, { id: "lastSevenDays" }), value: () => lastDays(7) },
1341
+ lastThirtyDays: { label: /* @__PURE__ */ jsx14(Text, { id: "lastThirtyDays" }), value: () => lastDays(30) }
1255
1342
  };
1256
1343
  function dateIntersect(a, b) {
1257
1344
  if (a instanceof Date) {
@@ -1380,7 +1467,7 @@ function DatePicker(props) {
1380
1467
  const max = dirty ? dirty.max : value instanceof Date ? value : value == null ? void 0 : value.max;
1381
1468
  const resolvedQuickOptions = [
1382
1469
  ...quickOptions,
1383
- ...noReset ? [] : [{ label: /* @__PURE__ */ jsx13(Text, { id: "reset" }), value: null }]
1470
+ ...noReset ? [] : [{ label: /* @__PURE__ */ jsx14(Text, { id: "reset" }), value: null }]
1384
1471
  ].map((option, index) => {
1385
1472
  if (option instanceof Function) {
1386
1473
  return option((value3) => {
@@ -1389,7 +1476,7 @@ function DatePicker(props) {
1389
1476
  });
1390
1477
  }
1391
1478
  const { label, value: value2 } = typeof option === "string" ? commonQuickOptions[option] : option;
1392
- return /* @__PURE__ */ jsx13(
1479
+ return /* @__PURE__ */ jsx14(
1393
1480
  Button2,
1394
1481
  {
1395
1482
  variant: "text",
@@ -1486,7 +1573,7 @@ function DatePicker(props) {
1486
1573
  gap: "var(--spacing)"
1487
1574
  },
1488
1575
  children: [
1489
- /* @__PURE__ */ jsx13(
1576
+ /* @__PURE__ */ jsx14(
1490
1577
  DateInput,
1491
1578
  {
1492
1579
  value: min != null ? min : null,
@@ -1496,7 +1583,7 @@ function DatePicker(props) {
1496
1583
  ),
1497
1584
  rangeSelect && /* @__PURE__ */ jsxs8(Fragment4, { children: [
1498
1585
  " - ",
1499
- /* @__PURE__ */ jsx13(
1586
+ /* @__PURE__ */ jsx14(
1500
1587
  DateInput,
1501
1588
  {
1502
1589
  value: max != null ? max : null,
@@ -1520,13 +1607,13 @@ function DatePicker(props) {
1520
1607
  alignItems: "center"
1521
1608
  },
1522
1609
  children: [
1523
- /* @__PURE__ */ jsx13(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getBackProps({ calendars })), { children: /* @__PURE__ */ jsx13(ChevronRight2, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } }) })),
1610
+ /* @__PURE__ */ jsx14(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getBackProps({ calendars })), { children: /* @__PURE__ */ jsx14(ChevronRight2, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } }) })),
1524
1611
  /* @__PURE__ */ jsxs8("div", { css: { display: "flex" }, children: [
1525
1612
  formatMonth(month),
1526
1613
  " ",
1527
1614
  formatYear(year)
1528
1615
  ] }),
1529
- /* @__PURE__ */ jsx13(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getForwardProps({ calendars })), { children: /* @__PURE__ */ jsx13(ChevronRight2, {}) }))
1616
+ /* @__PURE__ */ jsx14(IconButton2, __spreadProps(__spreadValues({ type: "button" }, getForwardProps({ calendars })), { children: /* @__PURE__ */ jsx14(ChevronRight2, {}) }))
1530
1617
  ]
1531
1618
  }
1532
1619
  ),
@@ -1539,7 +1626,7 @@ function DatePicker(props) {
1539
1626
  gridTemplateColumns: "repeat(8, max-content)"
1540
1627
  },
1541
1628
  children: [
1542
- showCalendarWeek ? /* @__PURE__ */ jsx13(
1629
+ showCalendarWeek ? /* @__PURE__ */ jsx14(
1543
1630
  "div",
1544
1631
  {
1545
1632
  css: {
@@ -1547,10 +1634,10 @@ function DatePicker(props) {
1547
1634
  padding: 10,
1548
1635
  borderRight: "1px solid var(--date-picker-separator, var(--table-border, #bdbdbd))"
1549
1636
  },
1550
- children: /* @__PURE__ */ jsx13(Text, { id: "calendarWeek" })
1637
+ children: /* @__PURE__ */ jsx14(Text, { id: "calendarWeek" })
1551
1638
  }
1552
- ) : /* @__PURE__ */ jsx13("div", {}),
1553
- weekDays.map((_v, weekDay) => /* @__PURE__ */ jsx13(
1639
+ ) : /* @__PURE__ */ jsx14("div", {}),
1640
+ weekDays.map((_v, weekDay) => /* @__PURE__ */ jsx14(
1554
1641
  "div",
1555
1642
  {
1556
1643
  css: {
@@ -1566,7 +1653,7 @@ function DatePicker(props) {
1566
1653
  const weekEnd = week[6];
1567
1654
  const weekDisabled = !rangeSelect || minDate && weekEnd.date < minDate || maxDate && weekStart.date > maxDate;
1568
1655
  return /* @__PURE__ */ jsxs8(Fragment3, { children: [
1569
- showCalendarWeek ? /* @__PURE__ */ jsx13(
1656
+ showCalendarWeek ? /* @__PURE__ */ jsx14(
1570
1657
  "button",
1571
1658
  {
1572
1659
  type: "button",
@@ -1591,10 +1678,10 @@ function DatePicker(props) {
1591
1678
  onPointerOut: () => !weekDisabled && setHovered(void 0),
1592
1679
  children: getCalendarWeek(weekEnd.date)
1593
1680
  }
1594
- ) : /* @__PURE__ */ jsx13("div", {}),
1681
+ ) : /* @__PURE__ */ jsx14("div", {}),
1595
1682
  week.map((dateObject, dayIndex) => {
1596
1683
  if (!dateObject) {
1597
- return /* @__PURE__ */ jsx13("div", {}, dayIndex);
1684
+ return /* @__PURE__ */ jsx14("div", {}, dayIndex);
1598
1685
  }
1599
1686
  const { prevMonth, nextMonth, date } = dateObject;
1600
1687
  const today2 = startOfDay(date).getTime() === now.getTime();
@@ -1605,7 +1692,7 @@ function DatePicker(props) {
1605
1692
  min <= hovered.min ? { min, max: hovered.min } : { min: hovered.max, max: min }
1606
1693
  ));
1607
1694
  const blocked = blockedRanges.some((range) => dateIntersect(date, range));
1608
- return /* @__PURE__ */ jsx13(
1695
+ return /* @__PURE__ */ jsx14(
1609
1696
  "button",
1610
1697
  __spreadProps(__spreadValues({
1611
1698
  type: "button",
@@ -1641,7 +1728,7 @@ function DatePicker(props) {
1641
1728
  }
1642
1729
  )
1643
1730
  ] }, `${month}${year}`)),
1644
- /* @__PURE__ */ jsx13(
1731
+ /* @__PURE__ */ jsx14(
1645
1732
  "div",
1646
1733
  {
1647
1734
  css: {
@@ -1659,7 +1746,7 @@ function DatePicker(props) {
1659
1746
  }
1660
1747
 
1661
1748
  // src/components/dateFilter.tsx
1662
- import { jsx as jsx14 } from "@emotion/react/jsx-runtime";
1749
+ import { jsx as jsx15 } from "@emotion/react/jsx-runtime";
1663
1750
  function convertDate(x) {
1664
1751
  if (x instanceof Date) return x;
1665
1752
  if (typeof x === "number" || typeof x === "string") return new Date(x);
@@ -1711,14 +1798,14 @@ function DateFilter(_a) {
1711
1798
  return dateIntersect(filterValue, value2);
1712
1799
  }
1713
1800
  }));
1714
- return /* @__PURE__ */ jsx14(
1801
+ return /* @__PURE__ */ jsx15(
1715
1802
  "div",
1716
1803
  {
1717
1804
  css: {
1718
1805
  padding: "calc(var(--spacing) * 2)",
1719
1806
  display: "grid"
1720
1807
  },
1721
- children: /* @__PURE__ */ jsx14(
1808
+ children: /* @__PURE__ */ jsx15(
1722
1809
  DatePicker,
1723
1810
  {
1724
1811
  rangeSelect: !singleSelect,
@@ -1739,7 +1826,7 @@ function DateFilter(_a) {
1739
1826
 
1740
1827
  // src/components/numberField.tsx
1741
1828
  import { useState as useState6 } from "react";
1742
- import { jsx as jsx15 } from "@emotion/react/jsx-runtime";
1829
+ import { jsx as jsx16 } from "@emotion/react/jsx-runtime";
1743
1830
  var Pattern = /^-?\d*(?:[.,]\d*)?$/;
1744
1831
  var printNumber = (value, locale) => {
1745
1832
  if (value === null) {
@@ -1765,7 +1852,7 @@ function NumberField(_a) {
1765
1852
  const locale = useTheme((t) => t.locale);
1766
1853
  const TextField2 = useTheme((t) => t.components.TextField);
1767
1854
  const [value = printNumber(commitedValue, locale), setValue] = useState6();
1768
- return /* @__PURE__ */ jsx15(
1855
+ return /* @__PURE__ */ jsx16(
1769
1856
  TextField2,
1770
1857
  __spreadProps(__spreadValues({
1771
1858
  value,
@@ -1790,7 +1877,7 @@ function NumberField(_a) {
1790
1877
  }
1791
1878
 
1792
1879
  // src/components/rangeFilter.tsx
1793
- import { jsx as jsx16, jsxs as jsxs9 } from "@emotion/react/jsx-runtime";
1880
+ import { jsx as jsx17, jsxs as jsxs9 } from "@emotion/react/jsx-runtime";
1794
1881
  function RangeFilter(_a) {
1795
1882
  var _b = _a, {
1796
1883
  min,
@@ -1844,7 +1931,7 @@ function RangeFilter(_a) {
1844
1931
  return value2 !== null && value2 >= min2 && value2 <= max2;
1845
1932
  }
1846
1933
  }));
1847
- return /* @__PURE__ */ jsx16(
1934
+ return /* @__PURE__ */ jsx17(
1848
1935
  "div",
1849
1936
  {
1850
1937
  css: {
@@ -1864,12 +1951,12 @@ function RangeFilter(_a) {
1864
1951
  }
1865
1952
  },
1866
1953
  children: [
1867
- /* @__PURE__ */ jsx16(
1954
+ /* @__PURE__ */ jsx17(
1868
1955
  NumberField,
1869
1956
  {
1870
1957
  value: value == null ? void 0 : value[0],
1871
1958
  onChange: (newMin) => onChange(normalize(newMin, value == null ? void 0 : value[1], "min", { min, max })),
1872
- startIcon: /* @__PURE__ */ jsx16("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
1959
+ startIcon: /* @__PURE__ */ jsx17("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMinText }),
1873
1960
  placeholder: String(minValue != null ? minValue : ""),
1874
1961
  css: {
1875
1962
  alignItems: "baseline"
@@ -1877,12 +1964,12 @@ function RangeFilter(_a) {
1877
1964
  }
1878
1965
  ),
1879
1966
  "-",
1880
- /* @__PURE__ */ jsx16(
1967
+ /* @__PURE__ */ jsx17(
1881
1968
  NumberField,
1882
1969
  {
1883
1970
  value: value == null ? void 0 : value[1],
1884
1971
  onChange: (newMax) => onChange(normalize(value == null ? void 0 : value[0], newMax, "max", { min, max })),
1885
- startIcon: /* @__PURE__ */ jsx16("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
1972
+ startIcon: /* @__PURE__ */ jsx17("span", { css: { margin: "0 calc(var(--spacing) * 2)" }, children: rangeMaxText }),
1886
1973
  placeholder: String(maxValue != null ? maxValue : ""),
1887
1974
  css: {
1888
1975
  alignItems: "baseline"
@@ -1915,7 +2002,7 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
1915
2002
  import { useEffect as useEffect4, useMemo as useMemo7, useState as useState8 } from "react";
1916
2003
 
1917
2004
  // src/components/formControlLabel.tsx
1918
- import { jsx as jsx17, jsxs as jsxs10 } from "@emotion/react/jsx-runtime";
2005
+ import { jsx as jsx18, jsxs as jsxs10 } from "@emotion/react/jsx-runtime";
1919
2006
  function FormControlLabel({
1920
2007
  control,
1921
2008
  label,
@@ -1938,7 +2025,7 @@ function FormControlLabel({
1938
2025
  ],
1939
2026
  children: [
1940
2027
  control,
1941
- /* @__PURE__ */ jsx17("span", { css: { marginLeft: "var(--spacing)" }, children: label })
2028
+ /* @__PURE__ */ jsx18("span", { css: { marginLeft: "var(--spacing)" }, children: label })
1942
2029
  ]
1943
2030
  }
1944
2031
  );
@@ -1986,7 +2073,7 @@ function throttle(function_, ms) {
1986
2073
  }
1987
2074
 
1988
2075
  // src/components/virtualList.tsx
1989
- import { jsx as jsx18, jsxs as jsxs11 } from "@emotion/react/jsx-runtime";
2076
+ import { jsx as jsx19, jsxs as jsxs11 } from "@emotion/react/jsx-runtime";
1990
2077
  function VirtualList(_a) {
1991
2078
  var _b = _a, {
1992
2079
  virtual = true,
@@ -2016,7 +2103,7 @@ function VirtualList(_a) {
2016
2103
  };
2017
2104
  }, [update, virtual, throttleScroll]);
2018
2105
  if (!virtual) {
2019
- return /* @__PURE__ */ jsx18(
2106
+ return /* @__PURE__ */ jsx19(
2020
2107
  "div",
2021
2108
  __spreadProps(__spreadValues({}, props), {
2022
2109
  css: {
@@ -2061,9 +2148,9 @@ function VirtualList(_a) {
2061
2148
  display: "grid"
2062
2149
  },
2063
2150
  children: [
2064
- /* @__PURE__ */ jsx18("div", { "data-virtual-before": true, style: { height: before } }),
2151
+ /* @__PURE__ */ jsx19("div", { "data-virtual-before": true, style: { height: before } }),
2065
2152
  items.slice(from, to).map((item, index) => children(item, index + from)),
2066
- /* @__PURE__ */ jsx18("div", { "data-virtual-after": true, style: { height: after } })
2153
+ /* @__PURE__ */ jsx19("div", { "data-virtual-after": true, style: { height: after } })
2067
2154
  ]
2068
2155
  })
2069
2156
  );
@@ -2077,7 +2164,7 @@ function averageItemHeight(container) {
2077
2164
  }
2078
2165
 
2079
2166
  // src/components/selectFilter.tsx
2080
- import { jsx as jsx19, jsxs as jsxs12 } from "@emotion/react/jsx-runtime";
2167
+ import { jsx as jsx20, jsxs as jsxs12 } from "@emotion/react/jsx-runtime";
2081
2168
  function toggle(set, value, singleSelect) {
2082
2169
  const newSet = new Set(singleSelect ? [] : set);
2083
2170
  if (set.has(value)) {
@@ -2151,19 +2238,20 @@ function SelectFilter(_a) {
2151
2238
  css: {
2152
2239
  padding: "calc(var(--spacing) * 2)",
2153
2240
  display: "grid",
2241
+ gridTemplateColumns: "minmax(0, 1fr)",
2154
2242
  gap: "var(--spacing)"
2155
2243
  },
2156
2244
  children: [
2157
- !hideSearchField && /* @__PURE__ */ jsx19(
2245
+ !hideSearchField && /* @__PURE__ */ jsx20(
2158
2246
  AutoFocusTextField,
2159
2247
  {
2160
2248
  value: query,
2161
2249
  onChange: (event) => setQuery(event.target.value),
2162
- endIcon: /* @__PURE__ */ jsx19(IconButton2, { onClick: () => setQuery(""), children: !query ? /* @__PURE__ */ jsx19(Search2, {}) : /* @__PURE__ */ jsx19(Clear2, {}) }),
2250
+ endIcon: /* @__PURE__ */ jsx20(IconButton2, { onClick: () => setQuery(""), children: !query ? /* @__PURE__ */ jsx20(Search2, {}) : /* @__PURE__ */ jsx20(Clear2, {}) }),
2163
2251
  css: { marginBottom: "var(--spacing)" }
2164
2252
  }
2165
2253
  ),
2166
- !hideResetButton && /* @__PURE__ */ jsx19(
2254
+ !hideResetButton && /* @__PURE__ */ jsx20(
2167
2255
  Button2,
2168
2256
  {
2169
2257
  disabled: value.size === 0,
@@ -2178,18 +2266,22 @@ function SelectFilter(_a) {
2178
2266
  children: deselectAll
2179
2267
  }
2180
2268
  ),
2181
- /* @__PURE__ */ jsx19(
2269
+ /* @__PURE__ */ jsx20(
2182
2270
  VirtualList,
2183
2271
  {
2184
2272
  items: ordered,
2185
2273
  css: {
2186
2274
  width: "20em",
2187
- maxHeight: "20em"
2275
+ maxWidth: "100%",
2276
+ maxHeight: "min(20em, 50vh)",
2277
+ overflow: "hidden auto",
2278
+ display: "grid",
2279
+ gridTemplateColumns: "minmax(0, 1fr)"
2188
2280
  },
2189
- children: (option, index) => /* @__PURE__ */ jsx19(
2281
+ children: (option, index) => /* @__PURE__ */ jsx20(
2190
2282
  FormControlLabel,
2191
2283
  {
2192
- control: /* @__PURE__ */ jsx19(
2284
+ control: /* @__PURE__ */ jsx20(
2193
2285
  Checkbox2,
2194
2286
  {
2195
2287
  checked: value.has(option),
@@ -2202,14 +2294,14 @@ function SelectFilter(_a) {
2202
2294
  )
2203
2295
  }
2204
2296
  ),
2205
- ordered.length === 0 && /* @__PURE__ */ jsx19("span", { css: { textAlign: "center" }, children: noResults })
2297
+ ordered.length === 0 && /* @__PURE__ */ jsx20("span", { css: { textAlign: "center" }, children: noResults })
2206
2298
  ]
2207
2299
  }
2208
2300
  );
2209
2301
  }
2210
2302
 
2211
2303
  // src/components/table.tsx
2212
- import { memo as memo3, useEffect as useEffect14, useLayoutEffect as useLayoutEffect6, useState as useState14 } from "react";
2304
+ import { memo as memo3, useEffect as useEffect15, useLayoutEffect as useLayoutEffect6, useState as useState14 } from "react";
2213
2305
 
2214
2306
  // src/internalState/tableStateStorage.ts
2215
2307
  import { useEffect as useEffect5, useState as useState9 } from "react";
@@ -2418,8 +2510,8 @@ function useTableStateStorage(table) {
2418
2510
  }
2419
2511
 
2420
2512
  // src/internalState/useTableState.ts
2421
- import { castDraft as castDraft3 } from "immer";
2422
- import { useEffect as useEffect11, useMemo as useMemo9, useState as useState10 } from "react";
2513
+ import { castDraft as castDraft4 } from "immer";
2514
+ import { useEffect as useEffect12, useMemo as useMemo9, useState as useState10 } from "react";
2423
2515
 
2424
2516
  // src/internalState/calcItems.ts
2425
2517
  import { castDraft as castDraft2 } from "immer";
@@ -2555,104 +2647,149 @@ function defaultSerializer(x) {
2555
2647
  return (_a = JSON.stringify(x)) != null ? _a : "";
2556
2648
  }
2557
2649
 
2650
+ // src/misc/overrides.ts
2651
+ function overrides(first, ...overrides2) {
2652
+ return overrides2.reduce(
2653
+ (result, source) => {
2654
+ for (const [key, value] of Object.entries(source != null ? source : {})) {
2655
+ if (value !== void 0) {
2656
+ result[key] = value;
2657
+ }
2658
+ }
2659
+ return result;
2660
+ },
2661
+ __spreadValues({}, first)
2662
+ );
2663
+ }
2664
+
2558
2665
  // src/internalState/calcProps.ts
2559
- var noopParentId = () => void 0;
2666
+ var defaultProps = {
2667
+ id: () => "",
2668
+ columns: [],
2669
+ enableSelection: true,
2670
+ selectSyncChildren: true,
2671
+ stickyHeader: true,
2672
+ stickyFooter: true,
2673
+ enableColumnSelection: true,
2674
+ enableColumnResize: true,
2675
+ enableColumnReorder: true,
2676
+ displaySizeOverrides: {
2677
+ mobile: {
2678
+ enableSelection: false,
2679
+ enableColumnSelection: false,
2680
+ enableExport: false,
2681
+ enableColumnResize: false,
2682
+ enableColumnReorder: false
2683
+ }
2684
+ }
2685
+ };
2560
2686
  function calcProps(props) {
2561
2687
  const cache = useTableMemo();
2562
- return useMemo8(() => {
2563
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2564
- let id;
2565
- if (props.id instanceof Function || Array.isArray(props.id)) {
2566
- id = cache("id", props.id);
2567
- } else {
2568
- id = cache("id", [(item) => item[props.id], props.id]);
2569
- }
2570
- let parentId;
2571
- if (props.parentId instanceof Function || Array.isArray(props.parentId)) {
2572
- parentId = cache("parentId", props.parentId);
2573
- } else if (props.parentId !== void 0) {
2574
- parentId = cache("parentId", [
2575
- (item) => item[props.parentId],
2576
- props.parentId
2577
- ]);
2578
- } else {
2579
- parentId = noopParentId;
2580
- }
2581
- const columnProps = props.columnProps && cache("columnProps", props.columnProps);
2582
- let inputColumns;
2583
- if (props.columns instanceof Function) {
2584
- inputColumns = props.columns((value, column) => __spreadProps(__spreadValues({}, column), { value }));
2585
- } else {
2586
- inputColumns = props.columns.map((column) => __spreadProps(__spreadValues({}, column), { dependecies: void 0 }));
2587
- }
2588
- const globalDefaults = props.defaultColumnProps;
2589
- const mapColumn = ({
2590
- id: _id,
2591
- header,
2592
- exportHeader,
2593
- footer,
2594
- value,
2595
- renderCell,
2596
- exportCell,
2597
- sortBy,
2688
+ return useMemo8(
2689
+ () => overrides(defaultProps, calc(props, cache)),
2690
+ [props]
2691
+ );
2692
+ }
2693
+ function calc(props, cache) {
2694
+ var _a;
2695
+ let id;
2696
+ if (props.id instanceof Function || Array.isArray(props.id)) {
2697
+ id = cache("id", props.id);
2698
+ } else if (props.id !== void 0) {
2699
+ id = cache("id", [(item) => item[props.id], props.id]);
2700
+ }
2701
+ let parentId;
2702
+ if (props.parentId instanceof Function || Array.isArray(props.parentId)) {
2703
+ parentId = cache("parentId", props.parentId);
2704
+ } else if (props.parentId !== void 0) {
2705
+ parentId = cache("parentId", [
2706
+ (item) => item[props.parentId],
2707
+ props.parentId
2708
+ ]);
2709
+ }
2710
+ const columnProps = props.columnProps && cache("columnProps", props.columnProps);
2711
+ let inputColumns;
2712
+ if (props.columns instanceof Function) {
2713
+ inputColumns = props.columns((value, column) => __spreadProps(__spreadValues({}, column), { value }));
2714
+ } else if (props.columns !== void 0) {
2715
+ inputColumns = props.columns.map((column) => __spreadProps(__spreadValues({}, column), { dependecies: void 0 }));
2716
+ }
2717
+ const globalDefaults = props.defaultColumnProps;
2718
+ const mapColumn = ({
2719
+ id: _id,
2720
+ header,
2721
+ exportHeader,
2722
+ footer,
2723
+ value,
2724
+ renderCell,
2725
+ exportCell,
2726
+ sortBy,
2727
+ disableSort,
2728
+ hidden,
2729
+ classes,
2730
+ styles,
2731
+ filter,
2732
+ width,
2733
+ displaySize
2734
+ }, index) => {
2735
+ var _a2, _b, _c, _d, _e, _f;
2736
+ const id2 = _id != null ? _id : index;
2737
+ const cacheKey = typeof id2 === "string" ? `s${id2}` : `n${id2}`;
2738
+ const defaults2 = __spreadValues(__spreadValues({}, globalDefaults), columnProps == null ? void 0 : columnProps(id2));
2739
+ return {
2740
+ id: id2,
2741
+ header: (_a2 = header != null ? header : defaults2 == null ? void 0 : defaults2.header) != null ? _a2 : null,
2742
+ exportHeader: (_b = exportHeader != null ? exportHeader : defaults2 == null ? void 0 : defaults2.exportHeader) != null ? _b : id2,
2743
+ footer: (_c = footer != null ? footer : defaults2 == null ? void 0 : defaults2.footer) != null ? _c : null,
2744
+ value: cache(`columns.${cacheKey}.value`, value),
2745
+ renderCell: cache(
2746
+ `columns.${cacheKey}.renderCell`,
2747
+ (_d = renderCell != null ? renderCell : defaults2 == null ? void 0 : defaults2.renderCell) != null ? _d : asString
2748
+ ),
2749
+ exportCell: (_e = exportCell != null ? exportCell : defaults2 == null ? void 0 : defaults2.exportCell) != null ? _e : defaultSerializer,
2750
+ sortBy: ((_f = sortBy != null ? sortBy : defaults2 == null ? void 0 : defaults2.sortBy) != null ? _f : [
2751
+ (v) => typeof v === "number" || v instanceof Date ? v : v === null || v === void 0 ? "" : String(v)
2752
+ ]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
2598
2753
  disableSort,
2599
- hidden,
2600
- classes,
2601
- styles,
2602
- filter,
2603
- width
2604
- }, index) => {
2605
- var _a2, _b2, _c2, _d2, _e2, _f2;
2606
- const id2 = _id != null ? _id : index;
2607
- const cacheKey = typeof id2 === "string" ? `s${id2}` : `n${id2}`;
2608
- const defaults2 = __spreadValues(__spreadValues({}, globalDefaults), columnProps == null ? void 0 : columnProps(id2));
2609
- return {
2610
- id: id2,
2611
- header: (_a2 = header != null ? header : defaults2 == null ? void 0 : defaults2.header) != null ? _a2 : null,
2612
- exportHeader: (_b2 = exportHeader != null ? exportHeader : defaults2 == null ? void 0 : defaults2.exportHeader) != null ? _b2 : id2,
2613
- footer: (_c2 = footer != null ? footer : defaults2 == null ? void 0 : defaults2.footer) != null ? _c2 : null,
2614
- value: cache(`columns.${cacheKey}.value`, value),
2615
- renderCell: cache(
2616
- `columns.${cacheKey}.renderCell`,
2617
- (_d2 = renderCell != null ? renderCell : defaults2 == null ? void 0 : defaults2.renderCell) != null ? _d2 : asString
2618
- ),
2619
- exportCell: (_e2 = exportCell != null ? exportCell : defaults2 == null ? void 0 : defaults2.exportCell) != null ? _e2 : defaultSerializer,
2620
- sortBy: ((_f2 = sortBy != null ? sortBy : defaults2 == null ? void 0 : defaults2.sortBy) != null ? _f2 : [
2621
- (v) => typeof v === "number" || v instanceof Date ? v : v === null || v === void 0 ? "" : String(v)
2622
- ]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
2623
- disableSort,
2624
- hidden: hidden != null ? hidden : defaults2 == null ? void 0 : defaults2.hidden,
2625
- classes: classes != null ? classes : defaults2 == null ? void 0 : defaults2.classes,
2626
- styles: styles != null ? styles : defaults2 == null ? void 0 : defaults2.styles,
2627
- filter: filter != null ? filter : defaults2 == null ? void 0 : defaults2.filter,
2628
- width: width != null ? width : defaults2 == null ? void 0 : defaults2.width
2629
- };
2754
+ hidden: hidden != null ? hidden : defaults2 == null ? void 0 : defaults2.hidden,
2755
+ classes: classes != null ? classes : defaults2 == null ? void 0 : defaults2.classes,
2756
+ styles: styles != null ? styles : defaults2 == null ? void 0 : defaults2.styles,
2757
+ filter: filter != null ? filter : defaults2 == null ? void 0 : defaults2.filter,
2758
+ width: width != null ? width : defaults2 == null ? void 0 : defaults2.width,
2759
+ displaySize: Array.isArray(displaySize) ? displaySize : displaySize ? [displaySize] : void 0
2630
2760
  };
2631
- const columns = inputColumns.map(mapColumn);
2632
- const wrapRow = props.wrapRow && cache("wrapRow", props.wrapRow);
2633
- const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
2634
- const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
2635
- const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
2636
- return __spreadProps(__spreadValues({}, props), {
2637
- id,
2638
- parentId,
2639
- columns,
2640
- columnProps,
2641
- wrapRow,
2642
- wrapCell,
2643
- rowAction,
2644
- rowDetails,
2645
- enableSelection: (_a = props.enableSelection) != null ? _a : true,
2646
- selectSyncChildren: (_b = props.selectSyncChildren) != null ? _b : true,
2647
- stickyHeader: (_c = props.stickyHeader) != null ? _c : true,
2648
- stickyFooter: (_d = props.stickyFooter) != null ? _d : true,
2649
- enableExport: (_e = props.enableExport) != null ? _e : false,
2650
- enableColumnSelection: (_f = props.enableColumnSelection) != null ? _f : true,
2651
- enableClearFiltersButton: (_g = props.enableClearFiltersButton) != null ? _g : false,
2652
- enableColumnResize: (_h = props.enableColumnResize) != null ? _h : true,
2653
- enableColumnReorder: (_i = props.enableColumnReorder) != null ? _i : true
2654
- });
2655
- }, [props]);
2761
+ };
2762
+ const columns = inputColumns == null ? void 0 : inputColumns.map(mapColumn);
2763
+ const wrapRow = props.wrapRow && cache("wrapRow", props.wrapRow);
2764
+ const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
2765
+ const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
2766
+ const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
2767
+ const displaySizeOverrides = props.displaySizeOverrides && Object.fromEntries(
2768
+ Object.entries((_a = props.displaySizeOverrides) != null ? _a : {}).map(([size, overrides2]) => [
2769
+ size,
2770
+ overrides2 && calc(overrides2, cache)
2771
+ ])
2772
+ );
2773
+ return __spreadProps(__spreadValues({}, props), {
2774
+ id,
2775
+ parentId,
2776
+ columns,
2777
+ columnProps,
2778
+ wrapRow,
2779
+ wrapCell,
2780
+ rowAction,
2781
+ rowDetails,
2782
+ enableSelection: props.enableSelection,
2783
+ selectSyncChildren: props.selectSyncChildren,
2784
+ stickyHeader: props.stickyHeader,
2785
+ stickyFooter: props.stickyFooter,
2786
+ enableColumnSelection: props.enableColumnSelection,
2787
+ enableExport: props.enableExport,
2788
+ enableClearFiltersButton: props.enableClearFiltersButton,
2789
+ enableColumnResize: props.enableColumnResize,
2790
+ enableColumnReorder: props.enableColumnReorder,
2791
+ displaySizeOverrides
2792
+ });
2656
2793
  }
2657
2794
 
2658
2795
  // src/internalState/cleanupState.ts
@@ -2722,8 +2859,14 @@ import { useEffect as useEffect8 } from "react";
2722
2859
  function filterColumns(state) {
2723
2860
  useEffect8(
2724
2861
  () => state.addReaction(
2725
- (state2) => [state2.props.columns, state2.hiddenColumns, state2.columnOrder],
2726
- ([columns, hiddenColumns, columnOrder], draft) => {
2862
+ (state2) => [
2863
+ state2.props.columns,
2864
+ state2.hiddenColumns,
2865
+ state2.columnOrder,
2866
+ state2.displaySize,
2867
+ state2.displaySizePx
2868
+ ],
2869
+ ([columns, hiddenColumns, columnOrder, displaySize], draft) => {
2727
2870
  draft.activeColumns = orderBy(
2728
2871
  columns.filter((column) => {
2729
2872
  var _a;
@@ -2731,6 +2874,9 @@ function filterColumns(state) {
2731
2874
  }),
2732
2875
  [(column) => columnOrder.indexOf(column.id)]
2733
2876
  );
2877
+ draft.visibleColumns = draft.activeColumns.filter(
2878
+ (column) => displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(displaySize)
2879
+ );
2734
2880
  },
2735
2881
  { runNow: true }
2736
2882
  ),
@@ -2812,6 +2958,53 @@ function syncSelections(table) {
2812
2958
  );
2813
2959
  }
2814
2960
 
2961
+ // src/internalState/watchDisplaySize.ts
2962
+ import { castDraft as castDraft3 } from "immer";
2963
+ import { useEffect as useEffect11 } from "react";
2964
+ var DEFAULT_DISPLAY_SIZES = {
2965
+ mobile: 400,
2966
+ desktop: Infinity
2967
+ };
2968
+ function watchDisplaySize(state) {
2969
+ useEffect11(
2970
+ () => state.addReaction(
2971
+ (state2) => ({
2972
+ displaySizePx: state2.displaySizePx,
2973
+ displaySize: state2.props.displaySize
2974
+ }),
2975
+ ({ displaySizePx, displaySize = DEFAULT_DISPLAY_SIZES }, draft) => {
2976
+ if (displaySizePx === void 0) {
2977
+ return;
2978
+ }
2979
+ if (typeof displaySize === "object") {
2980
+ const entry = Object.entries(displaySize).find(
2981
+ ([, maxWidth]) => maxWidth >= displaySizePx
2982
+ );
2983
+ draft.displaySize = entry == null ? void 0 : entry[0];
2984
+ } else {
2985
+ draft.displaySize = displaySize;
2986
+ }
2987
+ }
2988
+ ),
2989
+ [state]
2990
+ );
2991
+ useEffect11(
2992
+ () => state.addReaction(
2993
+ (state2) => ({
2994
+ props: state2.normalizedProps,
2995
+ displaySize: state2.displaySize
2996
+ }),
2997
+ ({ props, displaySize }, draft) => {
2998
+ var _a;
2999
+ draft.props = castDraft3(
3000
+ overrides(props, displaySize ? (_a = props.displaySizeOverrides) == null ? void 0 : _a[displaySize] : void 0)
3001
+ );
3002
+ }
3003
+ ),
3004
+ [state]
3005
+ );
3006
+ }
3007
+
2815
3008
  // src/internalState/useTableState.ts
2816
3009
  function useTableState(_props) {
2817
3010
  const [key, setKey] = useState10({});
@@ -2837,6 +3030,7 @@ function useTableState(_props) {
2837
3030
  () => {
2838
3031
  var _a, _b, _c, _d;
2839
3032
  return new Store({
3033
+ normalizedProps: props,
2840
3034
  props,
2841
3035
  key,
2842
3036
  sort: (_a = props.defaultSort) != null ? _a : [],
@@ -2850,11 +3044,14 @@ function useTableState(_props) {
2850
3044
  columnOrder: props.columns.map((column) => column.id),
2851
3045
  columnStyleOverride: /* @__PURE__ */ new Map(),
2852
3046
  activeColumns: [],
3047
+ visibleColumns: [],
2853
3048
  items: [],
2854
3049
  itemsById: /* @__PURE__ */ new Map(),
2855
3050
  activeItems: [],
2856
3051
  activeItemsById: /* @__PURE__ */ new Map(),
2857
- lastSelectedId: void 0
3052
+ lastSelectedId: void 0,
3053
+ displaySizePx: void 0,
3054
+ displaySize: void 0
2858
3055
  });
2859
3056
  },
2860
3057
  [key]
@@ -2864,9 +3061,10 @@ function useTableState(_props) {
2864
3061
  normalizeExpanded(state);
2865
3062
  syncSelections(state);
2866
3063
  cleanupState(state);
2867
- useEffect11(() => {
3064
+ watchDisplaySize(state);
3065
+ useEffect12(() => {
2868
3066
  state.update((state2) => {
2869
- state2.props = castDraft3(props);
3067
+ state2.normalizedProps = castDraft4(props);
2870
3068
  if (props.sort) state2.sort = props.sort;
2871
3069
  if (props.selection) state2.selection = props.selection;
2872
3070
  if (props.expanded) state2.expanded = props.expanded;
@@ -2883,12 +3081,12 @@ function useTableState(_props) {
2883
3081
  }
2884
3082
 
2885
3083
  // src/components/clearFiltersButton.tsx
2886
- import { jsx as jsx20 } from "@emotion/react/jsx-runtime";
3084
+ import { jsx as jsx21 } from "@emotion/react/jsx-runtime";
2887
3085
  function ClearFiltersButton() {
2888
3086
  const Button2 = useTheme((t) => t.components.Button);
2889
3087
  const textClearFilters = useTheme((t) => t.text.clearFilters);
2890
3088
  const table = useTableContext();
2891
- return /* @__PURE__ */ jsx20("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ jsx20(
3089
+ return /* @__PURE__ */ jsx21("div", { css: defaultClasses.clearFiltersButton, children: /* @__PURE__ */ jsx21(
2892
3090
  Button2,
2893
3091
  {
2894
3092
  variant: "outlined",
@@ -2907,7 +3105,7 @@ function ClearFiltersButton() {
2907
3105
  }
2908
3106
 
2909
3107
  // src/components/columnFooter.tsx
2910
- import { jsx as jsx21 } from "@emotion/react/jsx-runtime";
3108
+ import { jsx as jsx22 } from "@emotion/react/jsx-runtime";
2911
3109
  function ColumnFooter() {
2912
3110
  const table = useTableContext();
2913
3111
  const columnId = useColumnContext();
@@ -2939,7 +3137,7 @@ function ColumnFooter() {
2939
3137
  const column = state.activeColumns.find((column2) => column2.id === columnId);
2940
3138
  return column == null ? void 0 : column.footer;
2941
3139
  });
2942
- return /* @__PURE__ */ jsx21(
3140
+ return /* @__PURE__ */ jsx22(
2943
3141
  "div",
2944
3142
  {
2945
3143
  className: cx(classes, columnClasses),
@@ -2957,11 +3155,11 @@ function ColumnFooter() {
2957
3155
  }
2958
3156
 
2959
3157
  // src/components/columnHeader.tsx
2960
- import { castDraft as castDraft4 } from "immer";
2961
- import { useEffect as useEffect12, useRef as useRef4 } from "react";
3158
+ import { castDraft as castDraft5 } from "immer";
3159
+ import { useEffect as useEffect13, useRef as useRef4 } from "react";
2962
3160
 
2963
3161
  // src/components/resizeHandle.tsx
2964
- import { jsx as jsx22 } from "@emotion/react/jsx-runtime";
3162
+ import { jsx as jsx23 } from "@emotion/react/jsx-runtime";
2965
3163
  function ResizeHandle() {
2966
3164
  const table = useTableContext();
2967
3165
  const columnId = useColumnContext();
@@ -2995,7 +3193,10 @@ function ResizeHandle() {
2995
3193
  }
2996
3194
  });
2997
3195
  }
2998
- return /* @__PURE__ */ jsx22(
3196
+ if (!enabled) {
3197
+ return null;
3198
+ }
3199
+ return /* @__PURE__ */ jsx23(
2999
3200
  ResizeHandleView,
3000
3201
  {
3001
3202
  enabled,
@@ -3020,7 +3221,7 @@ function ResizeHandleView(_a) {
3020
3221
  var _a2;
3021
3222
  return (_a2 = theme.styles) == null ? void 0 : _a2.columnDivider;
3022
3223
  });
3023
- return /* @__PURE__ */ jsx22(
3224
+ return /* @__PURE__ */ jsx23(
3024
3225
  "div",
3025
3226
  __spreadValues({
3026
3227
  className: className2,
@@ -3028,7 +3229,7 @@ function ResizeHandleView(_a) {
3028
3229
  {
3029
3230
  alignSelf: "stretch",
3030
3231
  padding: "0 5px",
3031
- cursor: enabled ? "col-resize" : "initial",
3232
+ cursor: enabled === true ? "col-resize" : "initial",
3032
3233
  display: "flex",
3033
3234
  alignItems: "center",
3034
3235
  "&:after": {
@@ -3037,6 +3238,9 @@ function ResizeHandleView(_a) {
3037
3238
  height: "1.5em",
3038
3239
  background: "#c9cfda",
3039
3240
  transition: "transform 300ms"
3241
+ },
3242
+ "@media (pointer: coarse)": {
3243
+ pointerEvents: "none"
3040
3244
  }
3041
3245
  },
3042
3246
  styles
@@ -3046,7 +3250,7 @@ function ResizeHandleView(_a) {
3046
3250
  }
3047
3251
 
3048
3252
  // src/components/sortComponent.tsx
3049
- import { jsx as jsx23, jsxs as jsxs13 } from "@emotion/react/jsx-runtime";
3253
+ import { jsx as jsx24, jsxs as jsxs13 } from "@emotion/react/jsx-runtime";
3050
3254
  function SortComponent({ children }) {
3051
3255
  const table = useTableContext();
3052
3256
  const columnId = useColumnContext();
@@ -3103,8 +3307,8 @@ function SortComponent({ children }) {
3103
3307
  onClick: (event) => toggle2(event),
3104
3308
  onContextMenu: (event) => toggle2(event, true),
3105
3309
  children: [
3106
- /* @__PURE__ */ jsx23("div", { children }),
3107
- /* @__PURE__ */ jsx23(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ jsx23(
3310
+ /* @__PURE__ */ jsx24("div", { children }),
3311
+ /* @__PURE__ */ jsx24(Badge2, { badgeContent: sortDisabled ? 0 : index, children: /* @__PURE__ */ jsx24(
3108
3312
  "span",
3109
3313
  {
3110
3314
  css: [
@@ -3112,7 +3316,7 @@ function SortComponent({ children }) {
3112
3316
  !direction && { opacity: 0 },
3113
3317
  direction === "desc" && { transform: "rotate3d(0, 0, 1, 180deg)" }
3114
3318
  ],
3115
- children: /* @__PURE__ */ jsx23(ArrowUpward2, {})
3319
+ children: /* @__PURE__ */ jsx24(ArrowUpward2, {})
3116
3320
  }
3117
3321
  ) })
3118
3322
  ]
@@ -3121,7 +3325,7 @@ function SortComponent({ children }) {
3121
3325
  }
3122
3326
 
3123
3327
  // src/components/columnHeader.tsx
3124
- import { jsx as jsx24, jsxs as jsxs14 } from "@emotion/react/jsx-runtime";
3328
+ import { jsx as jsx25, jsxs as jsxs14 } from "@emotion/react/jsx-runtime";
3125
3329
  var ColumnHeaderContext = new StoreScope({
3126
3330
  items: /* @__PURE__ */ new Map()
3127
3331
  });
@@ -3154,11 +3358,11 @@ function ColumnHeader() {
3154
3358
  const store = ColumnHeaderContext.useStore();
3155
3359
  const draggingStart = useRef4();
3156
3360
  const clone = useRef4();
3157
- useEffect12(() => {
3361
+ useEffect13(() => {
3158
3362
  const div = ref.current;
3159
3363
  if (!div) return;
3160
3364
  store.update((state) => {
3161
- state.items.set(columnId, castDraft4(div));
3365
+ state.items.set(columnId, castDraft5(div));
3162
3366
  });
3163
3367
  return () => {
3164
3368
  store.update((state) => {
@@ -3284,10 +3488,10 @@ function ColumnHeader() {
3284
3488
  onPointerMove: enabled ? onPointerMove : void 0,
3285
3489
  onPointerUp: enabled ? onPointerUp : void 0,
3286
3490
  children: [
3287
- /* @__PURE__ */ jsx24(SortComponent, { children: header }),
3288
- /* @__PURE__ */ jsx24("div", { css: { flex: 1 } }),
3289
- /* @__PURE__ */ jsx24(FilterControl, {}),
3290
- /* @__PURE__ */ jsx24(ResizeHandle, {})
3491
+ /* @__PURE__ */ jsx25(SortComponent, { children: header }),
3492
+ /* @__PURE__ */ jsx25("div", { css: { flex: 1 } }),
3493
+ /* @__PURE__ */ jsx25(FilterControl, {}),
3494
+ /* @__PURE__ */ jsx25(ResizeHandle, {})
3291
3495
  ]
3292
3496
  }
3293
3497
  );
@@ -3295,7 +3499,7 @@ function ColumnHeader() {
3295
3499
 
3296
3500
  // src/components/columnSelection.tsx
3297
3501
  import { useContext as useContext7, useState as useState11 } from "react";
3298
- import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs15 } from "@emotion/react/jsx-runtime";
3502
+ import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs15 } from "@emotion/react/jsx-runtime";
3299
3503
  function ColumnSelection() {
3300
3504
  const IconButton2 = useTheme((t) => t.components.IconButton);
3301
3505
  const Popover2 = useTheme((t) => t.components.Popover);
@@ -3334,8 +3538,8 @@ function ColumnSelection() {
3334
3538
  };
3335
3539
  const allVisible = columns.every((column) => !hiddenColumns.has(column.id));
3336
3540
  return /* @__PURE__ */ jsxs15(Fragment5, { children: [
3337
- /* @__PURE__ */ jsx25(IconButton2, { onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget), children: /* @__PURE__ */ jsx25(Settings2, {}) }),
3338
- /* @__PURE__ */ jsx25(
3541
+ /* @__PURE__ */ jsx26(IconButton2, { onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget), children: /* @__PURE__ */ jsx26(Settings2, {}) }),
3542
+ /* @__PURE__ */ jsx26(
3339
3543
  Popover2,
3340
3544
  {
3341
3545
  anchorEl: anchorElement,
@@ -3345,17 +3549,17 @@ function ColumnSelection() {
3345
3549
  className: classes == null ? void 0 : classes.popover,
3346
3550
  backdropClassName: classes == null ? void 0 : classes.popoverBackdrop,
3347
3551
  children: /* @__PURE__ */ jsxs15("div", { css: { padding: `calc(var(--spacing) * 2)`, display: "grid" }, children: [
3348
- /* @__PURE__ */ jsx25("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
3552
+ /* @__PURE__ */ jsx26("div", { css: { marginBottom: "var(--spacing)" }, children: selectColumns }),
3349
3553
  /* @__PURE__ */ jsxs15("div", { css: { margin: "0.5em 0", display: "flex", gap: "0.5em" }, children: [
3350
- /* @__PURE__ */ jsx25(Button2, { variant: "outlined", onClick: () => toggle2(void 0, !allVisible), children: allVisible ? hideAll : showAll }),
3351
- /* @__PURE__ */ jsx25(Button2, { variant: "outlined", onClick: reset, children: resetAll })
3554
+ /* @__PURE__ */ jsx26(Button2, { variant: "outlined", onClick: () => toggle2(void 0, !allVisible), children: allVisible ? hideAll : showAll }),
3555
+ /* @__PURE__ */ jsx26(Button2, { variant: "outlined", onClick: reset, children: resetAll })
3352
3556
  ] }),
3353
3557
  columns.map((column) => {
3354
3558
  var _a;
3355
- return /* @__PURE__ */ jsx25(
3559
+ return /* @__PURE__ */ jsx26(
3356
3560
  FormControlLabel,
3357
3561
  {
3358
- control: /* @__PURE__ */ jsx25(
3562
+ control: /* @__PURE__ */ jsx26(
3359
3563
  Checkbox2,
3360
3564
  {
3361
3565
  checked: !((_a = column.hidden) != null ? _a : hiddenColumns.has(column.id)),
@@ -3376,7 +3580,7 @@ function ColumnSelection() {
3376
3580
 
3377
3581
  // src/components/export.tsx
3378
3582
  import { useContext as useContext8, useState as useState12 } from "react";
3379
- import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
3583
+ import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
3380
3584
  function Export2() {
3381
3585
  const { exporters: contextExporters } = useContext8(TableSettingsContext);
3382
3586
  const table = useTableContext();
@@ -3391,7 +3595,7 @@ function Export2() {
3391
3595
  const classes = useTheme((t) => t.classes);
3392
3596
  const cssVariables = useCssVariables();
3393
3597
  const { all, exporters } = table.useState((state) => {
3394
- if (typeof state.props.enableExport === "boolean") {
3598
+ if (typeof state.props.enableExport === "boolean" || state.props.enableExport === void 0) {
3395
3599
  return {
3396
3600
  all: false,
3397
3601
  exporters: contextExporters
@@ -3422,8 +3626,8 @@ function Export2() {
3422
3626
  }
3423
3627
  }
3424
3628
  return /* @__PURE__ */ jsxs16(Fragment6, { children: [
3425
- /* @__PURE__ */ jsx26(IconButton2, { onClick: (event) => setAnchor(anchor ? null : event.currentTarget), children: /* @__PURE__ */ jsx26(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } }) }),
3426
- /* @__PURE__ */ jsx26(
3629
+ /* @__PURE__ */ jsx27(IconButton2, { onClick: (event) => setAnchor(anchor ? null : event.currentTarget), children: /* @__PURE__ */ jsx27(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } }) }),
3630
+ /* @__PURE__ */ jsx27(
3427
3631
  Popover2,
3428
3632
  {
3429
3633
  open: !!anchor,
@@ -3445,11 +3649,11 @@ function Export2() {
3445
3649
  }
3446
3650
  },
3447
3651
  children: [
3448
- /* @__PURE__ */ jsx26("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
3652
+ /* @__PURE__ */ jsx27("div", { css: { marginBottom: "var(--spacing)" }, children: exportTitle }),
3449
3653
  exporters.map((entry, index) => /* @__PURE__ */ jsxs16(
3450
3654
  Button2,
3451
3655
  {
3452
- startIcon: entry.action === "copy" ? /* @__PURE__ */ jsx26(Clipboard2, {}) : /* @__PURE__ */ jsx26(ExportIcon, {}),
3656
+ startIcon: entry.action === "copy" ? /* @__PURE__ */ jsx27(Clipboard2, {}) : /* @__PURE__ */ jsx27(ExportIcon, {}),
3453
3657
  onClick: () => execute(entry),
3454
3658
  children: [
3455
3659
  entry.action === "copy" ? exportCopy : exportDownload,
@@ -3490,10 +3694,10 @@ function calcCss(styles, item, index) {
3490
3694
 
3491
3695
  // src/components/cell.tsx
3492
3696
  import { memo, useLayoutEffect as useLayoutEffect3 } from "react";
3493
- import { jsx as jsx27 } from "@emotion/react/jsx-runtime";
3697
+ import { jsx as jsx28 } from "@emotion/react/jsx-runtime";
3494
3698
  var defaultWrapCell = (content) => {
3495
3699
  if (typeof content === "string") {
3496
- return /* @__PURE__ */ jsx27("span", { css: defaultClasses.text, title: content, children: content });
3700
+ return /* @__PURE__ */ jsx28("span", { css: defaultClasses.text, title: content, children: content });
3497
3701
  }
3498
3702
  return content;
3499
3703
  };
@@ -3521,12 +3725,12 @@ var Cell = memo(function Cell2({ itemId, rowIndex }) {
3521
3725
  const styles = useTheme((t) => calcCss(t.styles, item == null ? void 0 : item.value, rowIndex));
3522
3726
  if (!column || !item) return null;
3523
3727
  const content = column.renderCell(column.value(item.value), item.value);
3524
- return /* @__PURE__ */ jsx27("div", { className: className2, css: [defaultClasses.cell, styles], style: columnStyleOverride, children: wrapCell(content, column.value(item.value), item.value, rowIndex) });
3728
+ return /* @__PURE__ */ jsx28("div", { className: className2, css: [defaultClasses.cell, styles], style: columnStyleOverride, children: wrapCell(content, column.value(item.value), item.value, rowIndex) });
3525
3729
  });
3526
3730
 
3527
3731
  // src/components/details.tsx
3528
3732
  import { forwardRef } from "react";
3529
- import { jsx as jsx28 } from "@emotion/react/jsx-runtime";
3733
+ import { jsx as jsx29 } from "@emotion/react/jsx-runtime";
3530
3734
  var Details = forwardRef(function Details2({ itemId, rowIndex }, ref) {
3531
3735
  const table = useTableContext();
3532
3736
  const classes = useTheme((t) => t.classes);
@@ -3539,11 +3743,11 @@ var Details = forwardRef(function Details2({ itemId, rowIndex }, ref) {
3539
3743
  css: (styles == null ? void 0 : styles.details) instanceof Function ? styles.details(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.details
3540
3744
  };
3541
3745
  });
3542
- return details ? /* @__PURE__ */ jsx28("div", { ref, className: className2, css: [defaultClasses.details, css3], children: details }) : null;
3746
+ return details ? /* @__PURE__ */ jsx29("div", { ref, className: className2, css: [defaultClasses.details, css3], children: details }) : null;
3543
3747
  });
3544
3748
 
3545
3749
  // src/components/expandControl.tsx
3546
- import { jsx as jsx29 } from "@emotion/react/jsx-runtime";
3750
+ import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
3547
3751
  function ExpandControl({
3548
3752
  itemId,
3549
3753
  hasDeferredChildren
@@ -3590,9 +3794,9 @@ function ExpandControl({
3590
3794
  }
3591
3795
  }
3592
3796
  if (isExpanded && hasDeferredChildren && !hasChildren) {
3593
- return /* @__PURE__ */ jsx29(Spinner2, { css: { margin: "0 var(--spacing)" } });
3797
+ return /* @__PURE__ */ jsx30(Spinner2, { css: { margin: "0 var(--spacing)" } });
3594
3798
  }
3595
- return /* @__PURE__ */ jsx29(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ jsx29(
3799
+ return /* @__PURE__ */ jsx30(IconButton2, { onClick: toggle2, children: /* @__PURE__ */ jsx30(
3596
3800
  "span",
3597
3801
  {
3598
3802
  css: {
@@ -3600,13 +3804,13 @@ function ExpandControl({
3600
3804
  transition: "all 300ms",
3601
3805
  transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
3602
3806
  },
3603
- children: /* @__PURE__ */ jsx29(ChevronRight2, {})
3807
+ children: /* @__PURE__ */ jsx30(ChevronRight2, {})
3604
3808
  }
3605
3809
  ) });
3606
3810
  }
3607
3811
 
3608
3812
  // src/components/selectComponent.tsx
3609
- import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
3813
+ import { jsx as jsx31 } from "@emotion/react/jsx-runtime";
3610
3814
  function SelectComponent({ itemId }) {
3611
3815
  const table = useTableContext();
3612
3816
  const Checkbox2 = useTheme((t) => t.components.Checkbox);
@@ -3655,7 +3859,7 @@ function SelectComponent({ itemId }) {
3655
3859
  state.lastSelectedId = itemId;
3656
3860
  });
3657
3861
  }
3658
- return /* @__PURE__ */ jsx30(
3862
+ return /* @__PURE__ */ jsx31(
3659
3863
  Checkbox2,
3660
3864
  {
3661
3865
  css: {
@@ -3669,7 +3873,7 @@ function SelectComponent({ itemId }) {
3669
3873
  }
3670
3874
 
3671
3875
  // src/components/row.tsx
3672
- import { Fragment as Fragment7, jsx as jsx31, jsxs as jsxs17 } from "@emotion/react/jsx-runtime";
3876
+ import { Fragment as Fragment7, jsx as jsx32, jsxs as jsxs17 } from "@emotion/react/jsx-runtime";
3673
3877
  var Row = memo2(function Row2({
3674
3878
  itemId,
3675
3879
  rowIndex
@@ -3681,7 +3885,7 @@ var Row = memo2(function Row2({
3681
3885
  const classes = useTheme((t) => t.classes);
3682
3886
  const styles = useTheme((t) => t.styles);
3683
3887
  const item = table.useState((state) => state.activeItemsById.get(itemId));
3684
- const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ jsx31("div", __spreadValues({}, props));
3888
+ const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ jsx32("div", __spreadValues({}, props));
3685
3889
  const rowClassName = (classes == null ? void 0 : classes.row) instanceof Function ? classes.row(item == null ? void 0 : item.value, rowIndex) : classes == null ? void 0 : classes.row;
3686
3890
  const rowStyles = (styles == null ? void 0 : styles.row) instanceof Function ? styles.row(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.row;
3687
3891
  const subgrid = table.useState((state) => state.props.subgrid);
@@ -3704,7 +3908,7 @@ var Row = memo2(function Row2({
3704
3908
  indent: item2 ? getAncestors(state.activeItemsById, item2).size : 0,
3705
3909
  hasChildren: !!(item2 == null ? void 0 : item2.children.length),
3706
3910
  hasDeferredChildren: item2 && ((_b = (_a2 = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a2, item2.value)),
3707
- columnIds: state.activeColumns.map((column) => column.id),
3911
+ columnIds: state.visibleColumns.map((column) => column.id),
3708
3912
  enableSelection: state.props.enableSelection,
3709
3913
  rowAction: state.props.rowAction instanceof Function ? item2 ? state.props.rowAction(item2.value, rowIndex) : null : state.props.rowAction,
3710
3914
  hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
@@ -3738,7 +3942,7 @@ var Row = memo2(function Row2({
3738
3942
  if (!item) {
3739
3943
  return null;
3740
3944
  }
3741
- return /* @__PURE__ */ jsx31(ClassNames2, { children: ({ css: css3 }) => /* @__PURE__ */ jsx31(Fragment7, { children: wrapRow(
3945
+ return /* @__PURE__ */ jsx32(ClassNames2, { children: ({ css: css3 }) => /* @__PURE__ */ jsx32(Fragment7, { children: wrapRow(
3742
3946
  {
3743
3947
  className: css3([
3744
3948
  subgrid ? {
@@ -3752,7 +3956,7 @@ var Row = memo2(function Row2({
3752
3956
  rowStyles
3753
3957
  ]),
3754
3958
  children: /* @__PURE__ */ jsxs17(Fragment7, { children: [
3755
- /* @__PURE__ */ jsx31(
3959
+ /* @__PURE__ */ jsx32(
3756
3960
  "div",
3757
3961
  {
3758
3962
  className: cellClassName,
@@ -3766,16 +3970,16 @@ var Row = memo2(function Row2({
3766
3970
  className: cellClassName,
3767
3971
  css: [defaultClasses.cell, defaultClasses.firstCell, css_],
3768
3972
  children: [
3769
- indent > 0 && /* @__PURE__ */ jsx31("div", { css: { width: indent * 20 } }),
3770
- enableSelection && /* @__PURE__ */ jsx31(SelectComponent, { itemId }),
3771
- (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ jsx31(ExpandControl, { itemId, hasDeferredChildren }),
3973
+ indent > 0 && /* @__PURE__ */ jsx32("div", { css: { width: indent * 20 } }),
3974
+ enableSelection && /* @__PURE__ */ jsx32(SelectComponent, { itemId }),
3975
+ (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ jsx32(ExpandControl, { itemId, hasDeferredChildren }),
3772
3976
  rowAction
3773
3977
  ]
3774
3978
  }
3775
3979
  ),
3776
- columnIds.map((columnId) => /* @__PURE__ */ jsx31(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ jsx31(Cell, { itemId, rowIndex }) }, columnId)),
3777
- /* @__PURE__ */ jsx31("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
3778
- /* @__PURE__ */ jsx31(Details, { ref: detailsDivRef, itemId, rowIndex })
3980
+ columnIds.map((columnId) => /* @__PURE__ */ jsx32(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ jsx32(Cell, { itemId, rowIndex }) }, columnId)),
3981
+ /* @__PURE__ */ jsx32("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
3982
+ /* @__PURE__ */ jsx32(Details, { ref: detailsDivRef, itemId, rowIndex })
3779
3983
  ] })
3780
3984
  },
3781
3985
  item.value,
@@ -3784,8 +3988,8 @@ var Row = memo2(function Row2({
3784
3988
  });
3785
3989
 
3786
3990
  // src/components/virtualized.tsx
3787
- import { useEffect as useEffect13, useLayoutEffect as useLayoutEffect5, useMemo as useMemo10, useRef as useRef6, useState as useState13 } from "react";
3788
- import { jsx as jsx32, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
3991
+ import { useEffect as useEffect14, useLayoutEffect as useLayoutEffect5, useMemo as useMemo10, useRef as useRef6, useState as useState13 } from "react";
3992
+ import { jsx as jsx33, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
3789
3993
  var findScrollRoot = (x) => {
3790
3994
  const parent = x.parentElement;
3791
3995
  if (!parent) return document.documentElement;
@@ -3824,8 +4028,9 @@ function Virtualized(_a) {
3824
4028
  var _a3;
3825
4029
  const itemIds2 = state.activeItems.map((item) => item.id);
3826
4030
  const root = probeRef.current && findScrollRoot(probeRef.current);
4031
+ if (!probeRef.current || !root || !document.contains(root) || state.displaySizePx === void 0)
4032
+ return {};
3827
4033
  if (!state.props.virtual) return { itemIds: itemIds2 };
3828
- if (!probeRef.current || !root || !document.contains(root)) return {};
3829
4034
  const {
3830
4035
  rowHeight,
3831
4036
  initalRowHeight,
@@ -3864,7 +4069,24 @@ function Virtualized(_a) {
3864
4069
  );
3865
4070
  const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
3866
4071
  const update = useMemo10(() => throttle(() => setId({}), throttleScroll), [throttleScroll]);
3867
- useEffect13(() => {
4072
+ useEffect14(() => {
4073
+ var _a3;
4074
+ const tableElem = (_a3 = probeRef.current) == null ? void 0 : _a3.parentElement;
4075
+ if (!tableElem) return;
4076
+ const update2 = () => {
4077
+ table.update((state) => {
4078
+ state.displaySizePx = tableElem.clientWidth;
4079
+ });
4080
+ };
4081
+ const ro = new ResizeObserver(update2);
4082
+ ro.observe(tableElem);
4083
+ window.addEventListener("resize", update2, true);
4084
+ return () => {
4085
+ ro.disconnect();
4086
+ window.removeEventListener("resize", update2, true);
4087
+ };
4088
+ }, [table, probeRef.current]);
4089
+ useEffect14(() => {
3868
4090
  if (!virtual || !probeRef.current) return;
3869
4091
  window.addEventListener("scroll", update, true);
3870
4092
  window.addEventListener("resize", update, true);
@@ -3873,7 +4095,7 @@ function Virtualized(_a) {
3873
4095
  window.removeEventListener("resize", update, true);
3874
4096
  };
3875
4097
  }, [update, virtual]);
3876
- useEffect13(() => update.cancel, [update]);
4098
+ useEffect14(() => update.cancel, [update]);
3877
4099
  useLayoutEffect5(
3878
4100
  () => {
3879
4101
  var _a3, _b3;
@@ -3882,15 +4104,15 @@ function Virtualized(_a) {
3882
4104
  );
3883
4105
  return /* @__PURE__ */ jsxs18("div", __spreadProps(__spreadValues({}, props), { children: [
3884
4106
  header,
3885
- virtual && /* @__PURE__ */ jsx32("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
4107
+ virtual && /* @__PURE__ */ jsx33("div", { style: { gridColumn: "1 / -1", height: before }, ref: probeRef }),
3886
4108
  children(itemIds, from),
3887
- virtual && /* @__PURE__ */ jsx32("div", { style: { gridColumn: "1 / -1", height: after } }),
4109
+ virtual && /* @__PURE__ */ jsx33("div", { style: { gridColumn: "1 / -1", height: after } }),
3888
4110
  footer
3889
4111
  ] }));
3890
4112
  }
3891
4113
 
3892
4114
  // src/components/table.tsx
3893
- import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
4115
+ import { Fragment as Fragment8, jsx as jsx34, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
3894
4116
  function Table(props) {
3895
4117
  const [table, resetState] = useTableState(props);
3896
4118
  const [isHydrated, clearStorage] = useTableStateStorage(table);
@@ -3904,29 +4126,30 @@ function Table(props) {
3904
4126
  var _a, _b;
3905
4127
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
3906
4128
  });
3907
- return /* @__PURE__ */ jsx33(TableContext.Provider, { value: table, children: /* @__PURE__ */ jsx33(TableResetContext.Provider, { value: reset, children: /* @__PURE__ */ jsx33(TableMemoContextProvider, { children: /* @__PURE__ */ jsx33(TableLoadingState, { isHydrated }) }) }) });
4129
+ return /* @__PURE__ */ jsx34(TableContext.Provider, { value: table, children: /* @__PURE__ */ jsx34(TableResetContext.Provider, { value: reset, children: /* @__PURE__ */ jsx34(TableMemoContextProvider, { children: /* @__PURE__ */ jsx34(TableLoadingState, { isHydrated }) }) }) });
3908
4130
  }
3909
4131
  function TableLoadingState({ isHydrated }) {
3910
4132
  const loadingText = useTheme((t) => t.text.loading);
3911
4133
  const [showLoading, setShowLoading] = useState14(false);
3912
- useEffect14(() => {
4134
+ useEffect15(() => {
3913
4135
  const handle = setTimeout(() => setShowLoading(true), 500);
3914
4136
  return () => clearTimeout(handle);
3915
4137
  });
3916
4138
  return /* @__PURE__ */ jsxs19(Fragment8, { children: [
3917
- !isHydrated && showLoading && /* @__PURE__ */ jsx33("div", { children: loadingText }),
3918
- /* @__PURE__ */ jsx33(TableInner, { hidden: !isHydrated })
4139
+ !isHydrated && showLoading && /* @__PURE__ */ jsx34("div", { children: loadingText }),
4140
+ /* @__PURE__ */ jsx34(TableInner, { hidden: !isHydrated })
3919
4141
  ] });
3920
4142
  }
3921
4143
  var TableInner = memo3(function TableInner2({ hidden }) {
3922
4144
  const table = useTableContext();
3923
4145
  const fullWidth = table.useState((state) => state.props.fullWidth);
3924
- const activeColumns = table.useState(
3925
- (state) => state.activeColumns.map((column) => ({
4146
+ const visibleColumns = table.useState(
4147
+ (state) => state.visibleColumns.map((column) => ({
3926
4148
  id: column.id,
3927
4149
  width: column.width,
3928
4150
  classes: column.classes,
3929
- styles: column.styles
4151
+ styles: column.styles,
4152
+ footer: column.footer
3930
4153
  }))
3931
4154
  );
3932
4155
  const hasActiveFilters = table.useState((state) => {
@@ -3943,15 +4166,19 @@ var TableInner = memo3(function TableInner2({ hidden }) {
3943
4166
  const stickyHeader = table.useState((state) => state.props.stickyHeader);
3944
4167
  const stickyFooter = table.useState((state) => state.props.stickyFooter);
3945
4168
  const enableSelection = table.useState((state) => state.props.enableSelection);
3946
- const enableColumnSelection = table.useState((state) => state.props.enableColumnSelection);
3947
- const enableExport = table.useState((state) => !!state.props.enableExport);
4169
+ const enableColumnSelection = table.useState(
4170
+ (state) => Array.isArray(state.props.enableColumnSelection) ? !state.displaySize || state.props.enableColumnSelection.includes(state.displaySize) : state.props.enableColumnSelection
4171
+ );
4172
+ const enableExport = table.useState(
4173
+ (state) => typeof state.props.enableExport === "object" && !("exporters" in state.props.enableExport) ? !state.displaySize || !!state.props.enableExport[state.displaySize] : !!state.props.enableExport
4174
+ );
3948
4175
  const cssVariables = useCssVariables();
3949
4176
  const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
3950
4177
  useLayoutEffect6(() => {
3951
4178
  var _a, _b;
3952
4179
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
3953
4180
  });
3954
- return /* @__PURE__ */ jsx33(
4181
+ return /* @__PURE__ */ jsx34(
3955
4182
  Virtualized,
3956
4183
  {
3957
4184
  className: classes == null ? void 0 : classes.table,
@@ -3961,7 +4188,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
3961
4188
  //
3962
4189
  fullWidth === "right" || fullWidth === true ? "auto" : "0",
3963
4190
  "max-content",
3964
- ...activeColumns.map(
4191
+ ...visibleColumns.map(
3965
4192
  (column) => {
3966
4193
  var _a, _b;
3967
4194
  return (_b = (_a = columnWidths.get(column.id)) != null ? _a : column.width) != null ? _b : "max-content";
@@ -3971,11 +4198,12 @@ var TableInner = memo3(function TableInner2({ hidden }) {
3971
4198
  ].join(" ")
3972
4199
  },
3973
4200
  header: /* @__PURE__ */ jsxs19(Fragment8, { children: [
3974
- /* @__PURE__ */ jsx33(
4201
+ /* @__PURE__ */ jsx34(
3975
4202
  "div",
3976
4203
  {
3977
4204
  className: classes == null ? void 0 : classes.headerCell,
3978
4205
  css: [
4206
+ { gridColumn: 1 },
3979
4207
  defaultClasses.headerFill,
3980
4208
  stickyHeader && defaultClasses.sticky,
3981
4209
  stickyHeader instanceof Object && stickyHeader,
@@ -3988,24 +4216,25 @@ var TableInner = memo3(function TableInner2({ hidden }) {
3988
4216
  {
3989
4217
  className: classes == null ? void 0 : classes.headerCell,
3990
4218
  css: [
4219
+ { gridColumn: 2 },
3991
4220
  defaultClasses.headerCell,
3992
4221
  stickyHeader && defaultClasses.sticky,
3993
4222
  stickyHeader instanceof Object && stickyHeader,
3994
4223
  styles == null ? void 0 : styles.headerCell
3995
4224
  ],
3996
4225
  children: [
3997
- enableSelection && /* @__PURE__ */ jsx33(SelectComponent, {}),
3998
- enableColumnSelection && /* @__PURE__ */ jsx33(ColumnSelection, {}),
3999
- enableExport && /* @__PURE__ */ jsx33(Export2, {}),
4226
+ enableSelection && /* @__PURE__ */ jsx34(SelectComponent, {}),
4227
+ enableColumnSelection && /* @__PURE__ */ jsx34(ColumnSelection, {}),
4228
+ enableExport && /* @__PURE__ */ jsx34(Export2, {}),
4000
4229
  (enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ jsxs19(Fragment8, { children: [
4001
- /* @__PURE__ */ jsx33("div", { css: { flex: 1 } }),
4002
- /* @__PURE__ */ jsx33(ResizeHandleView, {})
4230
+ /* @__PURE__ */ jsx34("div", { css: { flex: 1 } }),
4231
+ /* @__PURE__ */ jsx34(ResizeHandleView, {})
4003
4232
  ] })
4004
4233
  ]
4005
4234
  }
4006
4235
  ),
4007
- /* @__PURE__ */ jsx33(ColumnHeaderContext.Provider, { children: activeColumns.map((column) => /* @__PURE__ */ jsx33(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ jsx33(ColumnHeader, {}) }, column.id)) }),
4008
- /* @__PURE__ */ jsx33(
4236
+ /* @__PURE__ */ jsx34(ColumnHeaderContext.Provider, { children: visibleColumns.map((column) => /* @__PURE__ */ jsx34(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ jsx34(ColumnHeader, {}) }, column.id)) }),
4237
+ /* @__PURE__ */ jsx34(
4009
4238
  "div",
4010
4239
  {
4011
4240
  className: classes == null ? void 0 : classes.headerCell,
@@ -4019,13 +4248,14 @@ var TableInner = memo3(function TableInner2({ hidden }) {
4019
4248
  )
4020
4249
  ] }),
4021
4250
  footer: /* @__PURE__ */ jsxs19(Fragment8, { children: [
4022
- enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ jsx33(ClearFiltersButton, {}),
4251
+ enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ jsx34(ClearFiltersButton, {}),
4023
4252
  hasFooter && /* @__PURE__ */ jsxs19(Fragment8, { children: [
4024
- /* @__PURE__ */ jsx33(
4253
+ /* @__PURE__ */ jsx34(
4025
4254
  "div",
4026
4255
  {
4027
4256
  className: classes == null ? void 0 : classes.footerCell,
4028
4257
  css: [
4258
+ { gridColumn: 1 },
4029
4259
  defaultClasses.footerFill,
4030
4260
  stickyFooter && defaultClasses.stickyBottom,
4031
4261
  stickyFooter instanceof Object && stickyFooter,
@@ -4033,7 +4263,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
4033
4263
  ]
4034
4264
  }
4035
4265
  ),
4036
- /* @__PURE__ */ jsx33(
4266
+ /* @__PURE__ */ jsx34(
4037
4267
  "div",
4038
4268
  {
4039
4269
  className: classes == null ? void 0 : classes.footerCell,
@@ -4045,8 +4275,8 @@ var TableInner = memo3(function TableInner2({ hidden }) {
4045
4275
  ]
4046
4276
  }
4047
4277
  ),
4048
- activeColumns.map((column) => /* @__PURE__ */ jsx33(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ jsx33(ColumnFooter, {}) }, column.id)),
4049
- /* @__PURE__ */ jsx33(
4278
+ visibleColumns.map((column) => /* @__PURE__ */ jsx34(ColumnContext.Provider, { value: column.id, children: /* @__PURE__ */ jsx34(ColumnFooter, {}) }, column.id)),
4279
+ /* @__PURE__ */ jsx34(
4050
4280
  "div",
4051
4281
  {
4052
4282
  className: classes == null ? void 0 : classes.footerCell,
@@ -4060,7 +4290,7 @@ var TableInner = memo3(function TableInner2({ hidden }) {
4060
4290
  )
4061
4291
  ] })
4062
4292
  ] }),
4063
- children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ jsx33(Row, { itemId, rowIndex: startIndex + index }, itemId))
4293
+ children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ jsx34(Row, { itemId, rowIndex: startIndex + index }, itemId))
4064
4294
  }
4065
4295
  );
4066
4296
  });
@@ -4086,7 +4316,7 @@ var termMatch = (text, query) => {
4086
4316
  };
4087
4317
 
4088
4318
  // src/components/textFilter.tsx
4089
- import { jsx as jsx34 } from "@emotion/react/jsx-runtime";
4319
+ import { jsx as jsx35 } from "@emotion/react/jsx-runtime";
4090
4320
  function TextFilter(_a) {
4091
4321
  var _b = _a, {
4092
4322
  compare = textMatch,
@@ -4110,19 +4340,19 @@ function TextFilter(_a) {
4110
4340
  return compare(value2, filterValue);
4111
4341
  }
4112
4342
  }));
4113
- return /* @__PURE__ */ jsx34(
4343
+ return /* @__PURE__ */ jsx35(
4114
4344
  "div",
4115
4345
  {
4116
4346
  css: {
4117
4347
  padding: `calc(var(--spacing) * 2)`,
4118
4348
  display: "grid"
4119
4349
  },
4120
- children: /* @__PURE__ */ jsx34(
4350
+ children: /* @__PURE__ */ jsx35(
4121
4351
  AutoFocusTextField,
4122
4352
  {
4123
4353
  value,
4124
4354
  onChange: (event) => onChange(event.target.value),
4125
- endIcon: /* @__PURE__ */ jsx34(IconButton2, { onClick: () => onChange(""), children: !value ? /* @__PURE__ */ jsx34(Search2, {}) : /* @__PURE__ */ jsx34(Clear2, {}) }),
4355
+ endIcon: /* @__PURE__ */ jsx35(IconButton2, { onClick: () => onChange(""), children: !value ? /* @__PURE__ */ jsx35(Search2, {}) : /* @__PURE__ */ jsx35(Clear2, {}) }),
4126
4356
  placeholder
4127
4357
  }
4128
4358
  )
@@ -4132,6 +4362,7 @@ function TextFilter(_a) {
4132
4362
  export {
4133
4363
  AutoFocusTextField,
4134
4364
  ColumnContext,
4365
+ CombinedFilter,
4135
4366
  DateFilter,
4136
4367
  DatePicker,
4137
4368
  DatePickerProvider,