@harpercollins/harpercollins-design-system 1.35.3 → 1.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/cjs/components/data-display/DataGrid/DataGrid.cjs +1 -1
  2. package/dist/cjs/components/data-display/DataGrid/ManageColumnsDropdown.cjs +1 -0
  3. package/dist/cjs/components/data-display/DataGrid/TableToolbar.cjs +3 -3
  4. package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -1
  5. package/dist/cjs/components/data-display/Table/TableBody.cjs +1 -1
  6. package/dist/cjs/components/data-display/Table/TableLayout.cjs +1 -1
  7. package/dist/cjs/components/global/Layout/Layout.cjs +3 -3
  8. package/dist/cjs/components/global/Sidebar/Sidebar.cjs +1 -1
  9. package/dist/cjs/node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.cjs +1 -1
  10. package/dist/cjs/styles/lightExternalTheme.cjs +1 -1
  11. package/dist/cjs/styles/lightInternalTheme.cjs +1 -1
  12. package/dist/esm/components/data-display/DataGrid/DataGrid.js +25 -24
  13. package/dist/esm/components/data-display/DataGrid/ManageColumnsDropdown.js +121 -0
  14. package/dist/esm/components/data-display/DataGrid/TableToolbar.js +25 -12
  15. package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +140 -119
  16. package/dist/esm/components/data-display/Table/TableBody.js +53 -47
  17. package/dist/esm/components/data-display/Table/TableLayout.js +46 -45
  18. package/dist/esm/components/global/Layout/Layout.js +28 -26
  19. package/dist/esm/components/global/Sidebar/Sidebar.js +1 -3
  20. package/dist/esm/node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js +38 -27
  21. package/dist/esm/node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Divider/dividerClasses.js +3 -3
  22. package/dist/esm/styles/lightExternalTheme.js +12 -0
  23. package/dist/esm/styles/lightInternalTheme.js +14 -2
  24. package/dist/index.d.ts +15 -1
  25. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- import { jsx as I } from "react/jsx-runtime";
2
- import { useReactTable as b } from "../../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.js";
1
+ import { jsx as D } from "react/jsx-runtime";
2
+ import { useReactTable as ie } from "../../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.js";
3
3
  import n from "react";
4
- import { useLocalStorage as T } from "../../../../hooks/useLocalStorage.js";
5
- import B from "../../../inputs/Checkbox/Checkbox.js";
6
- import { multiSelectFilter as O, selectFilter as ee, dateFilter as te, numericFilter as ne, textFilter as oe } from "../filters/filterFunctions.js";
7
- import { extractColumnFilterTypes as H, parseSortingFromUrl as re, parseFiltersFromUrl as se, syncStateToUrl as le } from "../tableUrlUtils.js";
8
- import { useInfiniteScroll as ie } from "./useInfiniteScroll.js";
9
- import { getFilteredRowModel as ce, getSortedRowModel as ue, getCoreRowModel as me } from "../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
10
- function fe({ table: s }) {
11
- return /* @__PURE__ */ I(
12
- B,
4
+ import { useLocalStorage as H } from "../../../../hooks/useLocalStorage.js";
5
+ import L from "../../../inputs/Checkbox/Checkbox.js";
6
+ import { multiSelectFilter as se, selectFilter as le, dateFilter as re, numericFilter as ue, textFilter as ce } from "../filters/filterFunctions.js";
7
+ import { extractColumnFilterTypes as B, parseSortingFromUrl as me, parseFiltersFromUrl as ae, syncStateToUrl as fe } from "../tableUrlUtils.js";
8
+ import { useInfiniteScroll as ge } from "./useInfiniteScroll.js";
9
+ import { getFilteredRowModel as de, getSortedRowModel as he, getCoreRowModel as Ce } from "../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
10
+ function Re({ table: s }) {
11
+ return /* @__PURE__ */ D(
12
+ L,
13
13
  {
14
14
  checked: s.getIsAllRowsSelected(),
15
15
  indeterminate: s.getIsSomeRowsSelected(),
@@ -18,9 +18,9 @@ function fe({ table: s }) {
18
18
  }
19
19
  );
20
20
  }
21
- function ae({ row: s }) {
22
- return /* @__PURE__ */ I(
23
- B,
21
+ function Se({ row: s }) {
22
+ return /* @__PURE__ */ D(
23
+ L,
24
24
  {
25
25
  checked: s.getIsSelected(),
26
26
  disabled: !s.getCanSelect(),
@@ -29,161 +29,182 @@ function ae({ row: s }) {
29
29
  }
30
30
  );
31
31
  }
32
- function ze({
32
+ function ke({
33
33
  id: s,
34
34
  loading: l = !1,
35
- reactTableOptions: e,
35
+ reactTableOptions: t,
36
36
  gridCheckboxes: f = !1,
37
- allSelected: h = !1,
38
- onSelectionChange: R,
39
- infiniteScroll: c,
40
- syncUrl: u = !1,
37
+ allSelected: w = !1,
38
+ onSelectionChange: F,
39
+ infiniteScroll: u,
40
+ syncUrl: c = !1,
41
41
  urlParamPrefix: m = ""
42
42
  }) {
43
- const { columns: i } = e, D = n.useRef(
44
- H(i)
45
- ), [w, L] = n.useState(() => {
46
- if (u && typeof window < "u") {
47
- const t = new URLSearchParams(window.location.search);
48
- return re(t, m);
43
+ const { columns: r } = t, A = n.useRef(
44
+ B(r)
45
+ ), [y, P] = n.useState(() => {
46
+ if (c && typeof window < "u") {
47
+ const e = new URLSearchParams(window.location.search);
48
+ return me(e, m);
49
49
  }
50
50
  return [];
51
- }), [C, A] = n.useState(
51
+ }), [z, _] = n.useState(
52
52
  () => {
53
- if (u && typeof window < "u") {
54
- const t = new URLSearchParams(window.location.search);
55
- return se(
56
- t,
53
+ if (c && typeof window < "u") {
54
+ const e = new URLSearchParams(window.location.search);
55
+ return ae(
56
+ e,
57
57
  m,
58
- D.current
58
+ A.current
59
59
  );
60
60
  }
61
61
  return [];
62
62
  }
63
- ), [P, _] = T(
63
+ ), [U, $] = H(
64
64
  `table.${s}.columnSizing`,
65
65
  {}
66
- ), [U, j] = n.useState({}), G = n.useCallback(
67
- (t) => {
68
- j((r) => {
69
- const o = typeof t == "function" ? t(r) : t;
70
- return R?.(o), o;
66
+ ), j = n.useRef(r), g = n.useMemo(() => {
67
+ const e = {};
68
+ return j.current.forEach((i) => {
69
+ const o = i.id ?? i.accessorKey;
70
+ o && i.meta?.hidden && (e[o] = !1);
71
+ }), e;
72
+ }, []), [d, a] = H(
73
+ `table.${s}.columnVisibility`,
74
+ g
75
+ ), G = n.useCallback(() => {
76
+ a(g);
77
+ }, [g, a]), K = n.useCallback(
78
+ (e) => {
79
+ a(
80
+ typeof e == "function" ? e(d) : e
81
+ );
82
+ },
83
+ [d, a]
84
+ ), [q, J] = n.useState({}), Q = n.useCallback(
85
+ (e) => {
86
+ J((i) => {
87
+ const o = typeof e == "function" ? e(i) : e;
88
+ return F?.(o), o;
71
89
  });
72
90
  },
73
- [R]
74
- ), F = n.useRef(null), a = n.useRef(e.data), V = l && a.current.length > 0 ? a.current : e.data;
91
+ [F]
92
+ ), M = n.useRef(null), h = n.useRef(t.data), W = l && h.current.length > 0 ? h.current : t.data;
75
93
  n.useEffect(() => {
76
- !l && e.data.length > 0 && (a.current = e.data);
77
- }, [l, e.data]);
78
- const g = n.useRef(null), $ = n.useRef(null), q = n.useMemo(() => {
79
- const t = [], r = [];
80
- return i.forEach((o) => {
81
- o.meta?.pinned === "left" && o.id ? t.push(o.id) : o.meta?.pinned === "right" && o.id && r.push(o.id);
82
- }), { left: t, right: r };
83
- }, [i]), J = n.useMemo(() => {
84
- let t = [...i];
85
- return t = t.map((r) => {
86
- const o = r.meta?.filterType;
87
- return o && !r.filterFn ? {
88
- ...r,
94
+ !l && t.data.length > 0 && (h.current = t.data);
95
+ }, [l, t.data]);
96
+ const C = n.useRef(null), X = n.useRef(null), Y = n.useMemo(() => {
97
+ const e = [], i = [];
98
+ return r.forEach((o) => {
99
+ o.meta?.pinned === "left" && o.id ? e.push(o.id) : o.meta?.pinned === "right" && o.id && i.push(o.id);
100
+ }), { left: e, right: i };
101
+ }, [r]), Z = n.useMemo(() => {
102
+ let e = [...r];
103
+ return e = e.map((i) => {
104
+ const o = i.meta?.filterType;
105
+ return o && !i.filterFn ? {
106
+ ...i,
89
107
  filterFn: {
90
- text: oe,
91
- number: ne,
92
- date: te,
93
- select: ee,
94
- multiselect: O
108
+ text: ce,
109
+ number: ue,
110
+ date: re,
111
+ select: le,
112
+ multiselect: se
95
113
  }[o]
96
- } : r;
97
- }), f && (t = [{
114
+ } : i;
115
+ }), f && (e = [{
98
116
  id: "select",
99
117
  size: 32,
100
118
  enableSorting: !1,
101
119
  enableResizing: !1,
102
120
  meta: { noSortButton: !0 },
103
- header: fe,
104
- cell: ae
105
- }, ...t]), t;
106
- }, [f, i]), d = b({
121
+ header: Re,
122
+ cell: Se
123
+ }, ...e]), e;
124
+ }, [f, r]), R = ie({
107
125
  // Overridable defaults
108
126
  columnResizeDirection: "ltr",
109
127
  defaultColumn: { size: 200, minSize: 20, maxSize: 500 },
110
128
  // Consumer customisation
111
- ...e,
129
+ ...t,
112
130
  // Values always controlled by this hook
113
- getCoreRowModel: me(),
114
- getSortedRowModel: ue(),
115
- getFilteredRowModel: ce(),
116
- columns: J,
117
- data: V,
118
- enableSorting: e.enableSorting ?? !0,
119
- enableColumnResizing: e.enableColumnResizing ?? !0,
120
- columnResizeMode: e.columnResizeMode ?? "onChange",
121
- onColumnSizingChange: e.onColumnSizingChange ?? _,
122
- onSortingChange: e.onSortingChange ?? L,
123
- onColumnFiltersChange: e.onColumnFiltersChange ?? A,
131
+ getCoreRowModel: Ce(),
132
+ getSortedRowModel: he(),
133
+ getFilteredRowModel: de(),
134
+ columns: Z,
135
+ data: W,
136
+ enableSorting: t.enableSorting ?? !0,
137
+ enableColumnResizing: t.enableColumnResizing ?? !0,
138
+ columnResizeMode: t.columnResizeMode ?? "onChange",
139
+ onColumnSizingChange: t.onColumnSizingChange ?? $,
140
+ onSortingChange: t.onSortingChange ?? P,
141
+ onColumnFiltersChange: t.onColumnFiltersChange ?? _,
142
+ onColumnVisibilityChange: t.onColumnVisibilityChange ?? K,
124
143
  enableRowSelection: f,
125
- onRowSelectionChange: e.onRowSelectionChange ?? G,
144
+ onRowSelectionChange: t.onRowSelectionChange ?? Q,
126
145
  state: {
127
- ...e.state,
128
- rowSelection: e.state?.rowSelection ?? U,
129
- sorting: e.state?.sorting ?? w,
130
- columnFilters: e.state?.columnFilters ?? C,
131
- columnSizing: P,
132
- columnPinning: q
146
+ ...t.state,
147
+ rowSelection: t.state?.rowSelection ?? q,
148
+ sorting: t.state?.sorting ?? y,
149
+ columnFilters: t.state?.columnFilters ?? z,
150
+ columnSizing: U,
151
+ columnPinning: Y,
152
+ columnVisibility: t.state?.columnVisibility ?? d
133
153
  }
134
- }), { rows: p } = d.getRowModel(), {
135
- enabled: K,
136
- virtualItems: Q,
137
- paddingTop: W,
138
- paddingBottom: X,
139
- measureElement: Y
140
- } = ie(p.length, c, g), z = c?.enabled, M = c?.hasNextPage, x = c?.isFetchingNextPage, y = c?.fetchNextPage, Z = 200, S = n.useCallback(
141
- (t) => {
142
- if (!t || !z) return;
143
- const { scrollHeight: r, scrollTop: o, clientHeight: v } = t;
144
- r - o - v < Z && !x && M && y?.();
154
+ }), { rows: p } = R.getRowModel(), {
155
+ enabled: T,
156
+ virtualItems: O,
157
+ paddingTop: ee,
158
+ paddingBottom: te,
159
+ measureElement: ne
160
+ } = ge(p.length, u, C), b = u?.enabled, x = u?.hasNextPage, V = u?.isFetchingNextPage, k = u?.fetchNextPage, oe = 200, S = n.useCallback(
161
+ (e) => {
162
+ if (!e || !b) return;
163
+ const { scrollHeight: i, scrollTop: o, clientHeight: N } = e;
164
+ i - o - N < oe && !V && x && k?.();
145
165
  },
146
- [z, M, x, y]
166
+ [b, x, V, k]
147
167
  );
148
168
  n.useEffect(() => {
149
- S(g.current);
150
- }, [S]), F.current = d, n.useEffect(() => {
151
- F.current?.toggleAllRowsSelected(h);
152
- }, [h]);
153
- const E = e.state?.sorting ?? w, k = e.state?.columnFilters ?? C, N = n.useMemo(
154
- () => H(
155
- i
169
+ S(C.current);
170
+ }, [S]), M.current = R, n.useEffect(() => {
171
+ M.current?.toggleAllRowsSelected(w);
172
+ }, [w]);
173
+ const E = t.state?.sorting ?? y, v = t.state?.columnFilters ?? z, I = n.useMemo(
174
+ () => B(
175
+ r
156
176
  ),
157
- [i]
177
+ [r]
158
178
  );
159
179
  return n.useEffect(() => {
160
- !u || typeof window > "u" || le(
180
+ !c || typeof window > "u" || fe(
161
181
  E,
162
- k,
182
+ v,
163
183
  m,
164
- N
184
+ I
165
185
  );
166
186
  }, [
167
- u,
187
+ c,
168
188
  E,
169
- k,
189
+ v,
170
190
  m,
171
- N
191
+ I
172
192
  ]), {
173
193
  id: s,
174
- table: d,
194
+ table: R,
175
195
  rows: p,
176
- isVirtual: K,
177
- virtualItems: Q,
178
- paddingTop: W,
179
- paddingBottom: X,
180
- measureElement: Y,
181
- wrapperRef: g,
182
- toolbarRef: $,
196
+ isVirtual: T,
197
+ virtualItems: O,
198
+ paddingTop: ee,
199
+ paddingBottom: te,
200
+ measureElement: ne,
201
+ wrapperRef: C,
202
+ toolbarRef: X,
183
203
  loading: l,
184
- fetchMoreOnBottomReached: S
204
+ fetchMoreOnBottomReached: S,
205
+ resetColumnVisibility: G
185
206
  };
186
207
  }
187
208
  export {
188
- ze as useDataGrid
209
+ ke as useDataGrid
189
210
  };
@@ -1,80 +1,86 @@
1
- import { jsx as t, jsxs as u } from "react/jsx-runtime";
1
+ import { jsx as l, jsxs as b } from "react/jsx-runtime";
2
2
  import { flexRender as f } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.js";
3
- import m from "react";
4
- import p from "../Typography/Typography.js";
3
+ import h from "react";
4
+ import C from "../Typography/Typography.js";
5
5
  import y from "../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.js";
6
- function S({
7
- row: e,
6
+ function p({
7
+ row: i,
8
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
+ isSelected: e,
8
10
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
- isSelected: i,
11
+ visibleCellCount: m,
10
12
  virtualIndex: n,
11
- measureElement: a
13
+ measureElement: s
12
14
  }) {
13
- return /* @__PURE__ */ t(
15
+ return /* @__PURE__ */ l(
14
16
  "tr",
15
17
  {
16
18
  "data-index": n,
17
- ref: n !== void 0 ? a : void 0,
18
- children: e.getVisibleCells().map((l) => {
19
- const o = l.column.getIsPinned();
20
- return /* @__PURE__ */ t("td", { "data-pinned": o || void 0, children: f(l.column.columnDef.cell, l.getContext()) }, l.id);
19
+ ref: n !== void 0 ? s : void 0,
20
+ children: i.getVisibleCells().map((o) => {
21
+ const d = o.column.getIsPinned();
22
+ return /* @__PURE__ */ l("td", { "data-pinned": d || void 0, children: f(o.column.columnDef.cell, o.getContext()) }, o.id);
21
23
  })
22
24
  }
23
25
  );
24
26
  }
25
- const h = m.memo(
26
- S,
27
- (e, i) => e.row.id === i.row.id && e.row.original === i.row.original && e.isSelected === i.isSelected && e.virtualIndex === i.virtualIndex
27
+ const u = h.memo(
28
+ p,
29
+ (i, e) => i.row.id === e.row.id && i.row.original === e.row.original && i.isSelected === e.isSelected && i.virtualIndex === e.virtualIndex && i.visibleCellCount === e.visibleCellCount
28
30
  );
29
- function b({
30
- rows: e,
31
- columns: i,
31
+ function S({
32
+ rows: i,
33
+ columns: e,
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ columnVisibility: m,
32
36
  rowRender: n,
33
- loading: a,
34
- rowSelectionState: l,
35
- virtualItems: o,
36
- paddingTop: c = 0,
37
- paddingBottom: s = 0,
37
+ loading: s,
38
+ rowSelectionState: o,
39
+ virtualItems: d,
40
+ paddingTop: a = 0,
41
+ paddingBottom: c = 0,
38
42
  measureElement: g
39
43
  }) {
40
- return !!(o && o.length > 0) && o ? /* @__PURE__ */ u("tbody", { children: [
41
- c > 0 && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
44
+ return !!(d && d.length > 0) && d ? /* @__PURE__ */ b("tbody", { children: [
45
+ a > 0 && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l(
42
46
  "td",
43
47
  {
44
48
  "aria-hidden": !0,
45
- style: { height: `${c}px` },
46
- colSpan: i.length
49
+ style: { height: `${a}px` },
50
+ colSpan: e.length
47
51
  }
48
52
  ) }),
49
- o.map((d) => {
50
- const r = e[d.index];
51
- return n ? n(r, { key: r.id }) : /* @__PURE__ */ t(
52
- h,
53
+ d.map((t) => {
54
+ const r = i[t.index];
55
+ return n ? n(r, { key: r.id }) : /* @__PURE__ */ l(
56
+ u,
53
57
  {
54
58
  row: r,
55
- isSelected: l?.[r.id] ?? !1,
56
- virtualIndex: d.index,
59
+ isSelected: o?.[r.id] ?? !1,
60
+ visibleCellCount: r.getVisibleCells().length,
61
+ virtualIndex: t.index,
57
62
  measureElement: g
58
63
  },
59
64
  r.id
60
65
  );
61
66
  }),
62
- s > 0 && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
67
+ c > 0 && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l(
63
68
  "td",
64
69
  {
65
70
  "aria-hidden": !0,
66
- style: { height: `${s}px` },
67
- colSpan: i.length
71
+ style: { height: `${c}px` },
72
+ colSpan: e.length
68
73
  }
69
74
  ) })
70
- ] }) : e.length > 0 ? /* @__PURE__ */ t("tbody", { children: e.map((d) => n ? n(d, { key: d.id }) : /* @__PURE__ */ t(
71
- h,
75
+ ] }) : i.length > 0 ? /* @__PURE__ */ l("tbody", { children: i.map((t) => n ? n(t, { key: t.id }) : /* @__PURE__ */ l(
76
+ u,
72
77
  {
73
- row: d,
74
- isSelected: l?.[d.id] ?? !1
78
+ row: t,
79
+ isSelected: o?.[t.id] ?? !1,
80
+ visibleCellCount: t.getVisibleCells().length
75
81
  },
76
- d.id
77
- )) }) : /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: i.length, children: /* @__PURE__ */ t(
82
+ t.id
83
+ )) }) : /* @__PURE__ */ l("tbody", { children: /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: e.length, children: /* @__PURE__ */ l(
78
84
  y,
79
85
  {
80
86
  sx: {
@@ -83,14 +89,14 @@ function b({
83
89
  alignItems: "center",
84
90
  height: "200px"
85
91
  },
86
- children: /* @__PURE__ */ t(p, { children: a ? "Loading..." : " There is no data available" })
92
+ children: /* @__PURE__ */ l(C, { children: s ? "Loading..." : " There is no data available" })
87
93
  }
88
94
  ) }) }) });
89
95
  }
90
- const V = m.memo(
91
- b,
92
- (e, i) => e.rowRender === i.rowRender && e.loading === i.loading && e.columns === i.columns && e.rows === i.rows && e.rowSelectionState === i.rowSelectionState && e.virtualItems === i.virtualItems && e.paddingTop === i.paddingTop && e.paddingBottom === i.paddingBottom
96
+ const j = h.memo(
97
+ S,
98
+ (i, e) => i.rowRender === e.rowRender && i.loading === e.loading && i.columns === e.columns && i.columnVisibility === e.columnVisibility && i.rows === e.rows && i.rowSelectionState === e.rowSelectionState && i.virtualItems === e.virtualItems && i.paddingTop === e.paddingTop && i.paddingBottom === e.paddingBottom
93
99
  );
94
100
  export {
95
- V as TableBody
101
+ j as TableBody
96
102
  };
@@ -1,94 +1,95 @@
1
- import { jsxs as u, Fragment as I, jsx as r } from "react/jsx-runtime";
2
- import { flexRender as G } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.js";
1
+ import { jsxs as u, Fragment as C, jsx as r } from "react/jsx-runtime";
2
+ import { flexRender as I } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.js";
3
3
  import c from "react";
4
- import M from "./StickyHorizontalScrollbar.js";
5
- import { TableWrapper as V, getTableStyles as W } from "./Table.styles.js";
4
+ import G from "./StickyHorizontalScrollbar.js";
5
+ import { TableWrapper as M, getTableStyles as W } from "./Table.styles.js";
6
6
  import { TableBody as j } from "./TableBody.js";
7
7
  import E from "./TableHeader.js";
8
- import { useStickyHeader as _ } from "./hooks/useStickyHeader.js";
9
- import { useStickyScrollbar as A } from "./hooks/useStickyScrollbar.js";
8
+ import { useStickyHeader as L } from "./hooks/useStickyHeader.js";
9
+ import { useStickyScrollbar as _ } from "./hooks/useStickyScrollbar.js";
10
10
  import D from "../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Table/Table.js";
11
11
  function Y({
12
- ctx: p,
13
- maxHeight: d = !1,
14
- wrapText: f = !1,
12
+ ctx: f,
13
+ maxHeight: m = !1,
14
+ wrapText: p = !1,
15
15
  rowRender: g,
16
16
  showStickyScrollbar: S = !1,
17
- enableStickyHeader: h = !1,
18
- stickyHeaderOffset: b = 0,
17
+ enableStickyHeader: b = !1,
18
+ stickyHeaderOffset: h = 0,
19
19
  footer: z
20
20
  }) {
21
21
  const {
22
- id: a,
22
+ id: i,
23
23
  table: e,
24
24
  rows: T,
25
- isVirtual: i,
26
- virtualItems: R,
27
- paddingTop: v,
28
- paddingBottom: y,
25
+ isVirtual: l,
26
+ virtualItems: y,
27
+ paddingTop: R,
28
+ paddingBottom: v,
29
29
  measureElement: w,
30
30
  wrapperRef: n,
31
31
  toolbarRef: x,
32
32
  loading: H,
33
- fetchMoreOnBottomReached: k
34
- } = p, m = c.useRef(null), F = A(n), $ = _({
35
- enabled: h,
36
- stickyHeaderOffset: b,
33
+ fetchMoreOnBottomReached: V
34
+ } = f, d = c.useRef(null), k = _(n), F = L({
35
+ enabled: b,
36
+ stickyHeaderOffset: h,
37
37
  tableWrapperRef: n,
38
- theadRef: m,
38
+ theadRef: d,
39
39
  toolbarRef: x
40
- }), B = c.useMemo(() => {
40
+ }), $ = c.useMemo(() => {
41
41
  const o = e.getFlatHeaders(), t = {};
42
- for (let l = 0; l < o.length; l += 1) {
43
- const s = o[l];
44
- t[`--${a}-header-${s.id}-size`] = s.getSize(), t[`--${a}-col-${s.column.id}-size`] = s.column.getSize();
42
+ for (let a = 0; a < o.length; a += 1) {
43
+ const s = o[a];
44
+ t[`--${i}-header-${s.id}-size`] = s.getSize(), t[`--${i}-col-${s.column.id}-size`] = s.column.getSize();
45
45
  }
46
46
  return t;
47
- }, [a, e.getState().columnSizingInfo, e.getState().columnSizing]), C = c.useMemo(() => e.getFlatHeaders().reduce((t, l) => t + l.getSize(), 0), [e.getState().columnSizingInfo, e.getState().columnSizing]);
48
- return /* @__PURE__ */ u(I, { children: [
47
+ }, [i, e.getState().columnSizingInfo, e.getState().columnSizing]), B = c.useMemo(() => e.getFlatHeaders().reduce((t, a) => t + a.getSize(), 0), [e.getState().columnSizingInfo, e.getState().columnSizing]);
48
+ return /* @__PURE__ */ u(C, { children: [
49
49
  /* @__PURE__ */ r(
50
- V,
50
+ M,
51
51
  {
52
52
  ref: n,
53
53
  "data-testid": "table-wrapper",
54
- $maxHeight: d,
55
- onScroll: (o) => k(o.currentTarget),
54
+ $maxHeight: m,
55
+ onScroll: (o) => V(o.currentTarget),
56
56
  children: /* @__PURE__ */ u(
57
57
  D,
58
58
  {
59
59
  hoverRow: !0,
60
- "data-testid": a,
60
+ "data-testid": i,
61
61
  sx: W(
62
- B,
63
- C,
64
- f,
65
62
  $,
66
- d
63
+ B,
64
+ p,
65
+ F,
66
+ m
67
67
  ),
68
68
  children: [
69
69
  /* @__PURE__ */ r(
70
70
  E,
71
71
  {
72
72
  headerGroups: e.getHeaderGroups(),
73
- id: a,
74
- theadRef: m
73
+ id: i,
74
+ theadRef: d
75
75
  }
76
76
  ),
77
77
  /* @__PURE__ */ r(
78
78
  j,
79
79
  {
80
80
  rows: T,
81
- columns: e.getAllColumns(),
81
+ columns: e.getVisibleLeafColumns(),
82
+ columnVisibility: e.getState().columnVisibility,
82
83
  rowRender: g,
83
84
  loading: H,
84
85
  rowSelectionState: e.getState().rowSelection,
85
- virtualItems: i ? R : void 0,
86
- paddingTop: i ? v : void 0,
87
- paddingBottom: i ? y : void 0,
88
- measureElement: i ? w : void 0
86
+ virtualItems: l ? y : void 0,
87
+ paddingTop: l ? R : void 0,
88
+ paddingBottom: l ? v : void 0,
89
+ measureElement: l ? w : void 0
89
90
  }
90
91
  ),
91
- z && e.getFooterGroups().length > 0 && /* @__PURE__ */ r("tfoot", { children: e.getFooterGroups().map((o) => /* @__PURE__ */ r("tr", { children: o.headers.map((t) => /* @__PURE__ */ r("td", { colSpan: t.colSpan, children: G(
92
+ z && e.getFooterGroups().length > 0 && /* @__PURE__ */ r("tfoot", { children: e.getFooterGroups().map((o) => /* @__PURE__ */ r("tr", { children: o.headers.map((t) => /* @__PURE__ */ r("td", { colSpan: t.colSpan, children: I(
92
93
  t.column.columnDef.footer,
93
94
  t.getContext()
94
95
  ) }, t.id)) }, o.id)) })
@@ -98,10 +99,10 @@ function Y({
98
99
  }
99
100
  ),
100
101
  S && /* @__PURE__ */ r(
101
- M,
102
+ G,
102
103
  {
103
104
  scrollContainerRef: n,
104
- visible: F,
105
+ visible: k,
105
106
  constrainToContainer: "main"
106
107
  }
107
108
  )