@harpercollins/harpercollins-design-system 1.33.0 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/components/data-display/DataGrid/DataGrid.cjs +1 -0
  2. package/dist/cjs/components/data-display/{Table → DataGrid}/TableToolbar.cjs +1 -1
  3. package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -0
  4. package/dist/cjs/components/data-display/DataGrid/tableUrlUtils.cjs +1 -0
  5. package/dist/cjs/components/data-display/Table/Table.cjs +1 -1
  6. package/dist/cjs/components/data-display/Table/Table.styles.cjs +2 -2
  7. package/dist/cjs/components/data-display/Table/TableHeader.cjs +1 -0
  8. package/dist/cjs/components/data-display/Table/TableLayout.cjs +1 -0
  9. package/dist/cjs/hooks/useServerSideTableState.cjs +1 -0
  10. package/dist/cjs/index.cjs +1 -1
  11. package/dist/esm/components/data-display/DataGrid/DataGrid.js +70 -0
  12. package/dist/esm/components/data-display/{Table → DataGrid}/TableToolbar.js +10 -8
  13. package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +189 -0
  14. package/dist/esm/components/data-display/DataGrid/tableUrlUtils.js +108 -0
  15. package/dist/esm/components/data-display/Table/Table.js +51 -346
  16. package/dist/esm/components/data-display/Table/Table.styles.js +4 -5
  17. package/dist/esm/components/data-display/Table/TableHeader.js +92 -0
  18. package/dist/esm/components/data-display/Table/TableLayout.js +112 -0
  19. package/dist/esm/hooks/useServerSideTableState.js +47 -0
  20. package/dist/esm/index.js +221 -210
  21. package/dist/index.d.ts +163 -12
  22. package/package.json +1 -1
  23. package/dist/cjs/components/data-display/Table/index.cjs +0 -1
  24. package/dist/esm/components/data-display/Table/index.js +0 -4
  25. /package/dist/cjs/components/data-display/{Table → DataGrid}/ExportToExcelButton.cjs +0 -0
  26. /package/dist/cjs/components/data-display/{Table → DataGrid}/FilterChipsSection.cjs +0 -0
  27. /package/dist/cjs/components/data-display/{Table → DataGrid}/filters/FilterComponents.cjs +0 -0
  28. /package/dist/cjs/components/data-display/{Table → DataGrid}/filters/filterFunctions.cjs +0 -0
  29. /package/dist/cjs/components/data-display/{Table → DataGrid}/hooks/useInfiniteScroll.cjs +0 -0
  30. /package/dist/esm/components/data-display/{Table → DataGrid}/ExportToExcelButton.js +0 -0
  31. /package/dist/esm/components/data-display/{Table → DataGrid}/FilterChipsSection.js +0 -0
  32. /package/dist/esm/components/data-display/{Table → DataGrid}/filters/FilterComponents.js +0 -0
  33. /package/dist/esm/components/data-display/{Table → DataGrid}/filters/filterFunctions.js +0 -0
  34. /package/dist/esm/components/data-display/{Table → DataGrid}/hooks/useInfiniteScroll.js +0 -0
@@ -0,0 +1,108 @@
1
+ function i(t, e) {
2
+ return t ? `${t}_${e}` : e;
3
+ }
4
+ function h(t, e) {
5
+ const n = t.get(i(e, "sort_by")), o = t.get(i(e, "sort_order"));
6
+ return n ? [{ id: n, desc: o === "desc" }] : [];
7
+ }
8
+ function f(t, e, n) {
9
+ return Object.entries(n).reduce(
10
+ (o, [r, c]) => {
11
+ if (c === "multiselect") {
12
+ const s = t.get(i(e, r));
13
+ s && o.push({ id: r, value: s.split(",") });
14
+ } else if (c === "date" || c === "number") {
15
+ const s = t.get(i(e, `${r}_gte`)), a = t.get(i(e, `${r}_lte`));
16
+ (s !== null || a !== null) && o.push({
17
+ id: r,
18
+ value: {
19
+ min: s ?? void 0,
20
+ max: a ?? void 0
21
+ }
22
+ });
23
+ } else {
24
+ const s = t.get(i(e, r));
25
+ s && o.push({ id: r, value: s });
26
+ }
27
+ return o;
28
+ },
29
+ []
30
+ );
31
+ }
32
+ function y(t) {
33
+ const e = {};
34
+ return t.forEach((n) => {
35
+ const o = n.id ?? n.accessorKey, r = n.meta?.filterType;
36
+ o && r && (e[o] = r);
37
+ }), e;
38
+ }
39
+ function d(t, e, n) {
40
+ if (t.length === 0 || !t[0]?.id) return;
41
+ const { id: o, desc: r } = t[0];
42
+ n.set(i(e, "sort_by"), o), n.set(i(e, "sort_order"), r ? "desc" : "asc");
43
+ }
44
+ function g(t, e, n) {
45
+ t.forEach((o) => {
46
+ const { value: r } = o;
47
+ if (!(r == null || r === "")) {
48
+ if (Array.isArray(r)) {
49
+ r.length > 0 && n.set(i(e, o.id), r.join(","));
50
+ return;
51
+ }
52
+ if (typeof r == "object" && r !== null) {
53
+ const c = r, s = c.min ?? c.gte ?? c.start, a = c.max ?? c.lte ?? c.end;
54
+ if (s != null && s !== "") {
55
+ const u = s instanceof Date ? s.toISOString().split("T")[0] : String(s);
56
+ n.set(i(e, `${o.id}_gte`), u);
57
+ }
58
+ if (a != null && a !== "") {
59
+ const u = a instanceof Date ? a.toISOString().split("T")[0] : String(a);
60
+ n.set(i(e, `${o.id}_lte`), u);
61
+ }
62
+ return;
63
+ }
64
+ n.set(i(e, o.id), String(r));
65
+ }
66
+ });
67
+ }
68
+ function S(t, e) {
69
+ return [
70
+ i(t, "sort_by"),
71
+ i(t, "sort_order"),
72
+ ...Object.entries(e).flatMap(
73
+ ([n, o]) => o === "date" || o === "number" ? [i(t, `${n}_gte`), i(t, `${n}_lte`)] : [i(t, n)]
74
+ )
75
+ ];
76
+ }
77
+ function _(t, e, n, o) {
78
+ const r = new URL(window.location.href), c = new Set(S(n, o)), s = [];
79
+ r.searchParams.forEach((u, l) => {
80
+ c.has(l) || s.push([l, u]);
81
+ });
82
+ const a = new URLSearchParams();
83
+ s.forEach(([u, l]) => a.append(u, l)), d(t, n, a), g(e, n, a), r.search = a.toString(), window.history.replaceState(null, "", r.toString());
84
+ }
85
+ function m(t, e) {
86
+ if (t.length === 0 || !t[0]?.id) return "";
87
+ const n = new URLSearchParams();
88
+ return d(t, e, n), `&${n.toString()}`;
89
+ }
90
+ function w(t, e) {
91
+ if (t.length === 0) return "";
92
+ const n = new URLSearchParams();
93
+ g(t, e, n);
94
+ const o = n.toString();
95
+ return o ? `&${o}` : "";
96
+ }
97
+ export {
98
+ w as buildFilterQueryString,
99
+ m as buildSortQueryString,
100
+ y as extractColumnFilterTypes,
101
+ S as getManagedUrlKeys,
102
+ f as parseFiltersFromUrl,
103
+ h as parseSortingFromUrl,
104
+ i as prefixKey,
105
+ _ as syncStateToUrl,
106
+ g as writeFiltersToSearchParams,
107
+ d as writeSortToSearchParams
108
+ };
@@ -1,353 +1,58 @@
1
- import { jsxs as u, Fragment as fe, jsx as o } from "react/jsx-runtime";
2
- import { faArrowDown as $, faArrowUp as B } from "../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
- import { useReactTable as Se, flexRender as S } 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";
4
- import l from "react";
5
- import { useLocalStorage as pe } from "../../../hooks/useLocalStorage.js";
6
- import he from "../../feedback/Alert/Alert.js";
7
- import T from "../../feedback/CircularProgress/CircularProgress.js";
8
- import E from "../../inputs/Checkbox/Checkbox.js";
9
- import p from "../Icon/Icon.js";
10
- import Ce from "../Typography/Typography.js";
11
- import Re from "./StickyHorizontalScrollbar.js";
12
- import { TableWrapper as ze, HeaderContent as xe, SortButton as we, ColumnHeaderContainer as Fe, getTableStyles as be } from "./Table.styles.js";
13
- import { SortDirection as A } from "./Table.types.js";
14
- import { TableBody as ye } from "./TableBody.js";
15
- import Me from "./TableToolbar.js";
16
- import { ColumnFilter as De } from "./filters/FilterComponents.js";
17
- import { multiSelectFilter as He, selectFilter as ke, dateFilter as Ie, numericFilter as ve, textFilter as Ne } from "./filters/filterFunctions.js";
18
- import { useInfiniteScroll as Pe } from "./hooks/useInfiniteScroll.js";
19
- import { useStickyHeader as $e } from "./hooks/useStickyHeader.js";
20
- import { useStickyScrollbar as Be } from "./hooks/useStickyScrollbar.js";
21
- import z 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";
22
- import Te 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";
23
- import { getFilteredRowModel as Ae, getSortedRowModel as Ee, getCoreRowModel as je } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
24
- function Le({ table: i }) {
25
- return /* @__PURE__ */ o(
26
- E,
27
- {
28
- checked: i.getIsAllRowsSelected(),
29
- indeterminate: i.getIsSomeRowsSelected(),
30
- onChange: (c) => i.toggleAllRowsSelected(c.target.checked),
31
- size: "md"
32
- }
33
- );
34
- }
35
- function Ve({ row: i }) {
36
- return /* @__PURE__ */ o(
37
- E,
38
- {
39
- checked: i.getIsSelected(),
40
- disabled: !i.getCanSelect(),
41
- onChange: (c) => i.toggleSelected(c.target.checked),
42
- size: "md"
43
- }
44
- );
45
- }
46
- function ut({
47
- id: i,
48
- loading: c = !1,
49
- maxHeight: x = !1,
50
- wrapText: j = !1,
51
- rowRender: L,
52
- reactTableOptions: r,
53
- gridCheckboxes: h = !1,
54
- allSelected: w = !1,
55
- onSelectionChange: F,
56
- showStickyScrollbar: V = !1,
57
- enableStickyHeader: W = !1,
58
- stickyHeaderOffset: _ = 0,
59
- infiniteScroll: m,
60
- toolbar: b,
61
- footer: U,
62
- isError: q = !1,
63
- errorMessage: G = "An error occurred while loading data. Please try again."
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import h from "../DataGrid/DataGrid.js";
3
+ import j from "./TableLayout.js";
4
+ function G({
5
+ id: e,
6
+ loading: r = !1,
7
+ maxHeight: l = !1,
8
+ wrapText: f = !1,
9
+ rowRender: o,
10
+ reactTableOptions: s,
11
+ gridCheckboxes: t = !1,
12
+ allSelected: i = !1,
13
+ onSelectionChange: n,
14
+ showStickyScrollbar: d = !1,
15
+ enableStickyHeader: m = !1,
16
+ stickyHeaderOffset: u = 0,
17
+ infiniteScroll: p,
18
+ toolbar: c,
19
+ footer: y,
20
+ isError: b = !1,
21
+ errorMessage: g = "An error occurred while loading data. Please try again.",
22
+ syncUrl: x = !1,
23
+ urlParamPrefix: L = ""
64
24
  }) {
65
- const [J, K] = l.useState([]), [Q, X] = l.useState(
66
- []
67
- ), [Y, Z] = pe(
68
- `table.${i}.columnSizing`,
69
- {}
70
- ), [O, ee] = l.useState({}), te = l.useCallback(
71
- (t) => {
72
- ee((e) => {
73
- const n = typeof t == "function" ? t(e) : t;
74
- return F?.(n), n;
75
- });
76
- },
77
- [F]
78
- ), y = l.useRef(null), C = l.useRef(r.data), oe = c && C.current.length > 0 ? C.current : r.data;
79
- l.useEffect(() => {
80
- !c && r.data.length > 0 && (C.current = r.data);
81
- }, [c, r.data]);
82
- const d = l.useRef(null), M = l.useRef(null), D = l.useRef(null), ne = Be(d), re = $e({
83
- enabled: W,
84
- stickyHeaderOffset: _,
85
- tableWrapperRef: d,
86
- theadRef: M,
87
- toolbarRef: D
88
- }), { columns: f } = r, le = l.useMemo(() => {
89
- const t = [], e = [];
90
- return f.forEach((n) => {
91
- n.meta?.pinned === "left" && n.id ? t.push(n.id) : n.meta?.pinned === "right" && n.id && e.push(n.id);
92
- }), { left: t, right: e };
93
- }, [f]), ie = l.useMemo(() => {
94
- let t = [...f];
95
- return t = t.map((e) => {
96
- const n = e.meta?.filterType;
97
- return n && !e.filterFn ? {
98
- ...e,
99
- filterFn: {
100
- text: Ne,
101
- number: ve,
102
- date: Ie,
103
- select: ke,
104
- multiselect: He
105
- }[n]
106
- } : e;
107
- }), h && (t = [{
108
- id: "select",
109
- size: 26,
110
- enableSorting: !1,
111
- enableResizing: !1,
112
- meta: { noSortButton: !0 },
113
- header: Le,
114
- cell: Ve
115
- }, ...t]), t;
116
- }, [h, f]), s = Se({
117
- // Overridable defaults
118
- columnResizeDirection: "ltr",
119
- defaultColumn: { size: 200, minSize: 20, maxSize: 500 },
120
- // Consumer customisation
121
- ...r,
122
- // Values always controlled by this component
123
- getCoreRowModel: je(),
124
- getSortedRowModel: Ee(),
125
- getFilteredRowModel: Ae(),
126
- columns: ie,
127
- data: oe,
128
- enableSorting: r.enableSorting ?? !0,
129
- enableColumnResizing: r.enableColumnResizing ?? !0,
130
- columnResizeMode: r.columnResizeMode ?? "onChange",
131
- onColumnSizingChange: r.onColumnSizingChange ?? Z,
132
- onSortingChange: r.onSortingChange ?? K,
133
- onColumnFiltersChange: r.onColumnFiltersChange ?? X,
134
- enableRowSelection: h,
135
- onRowSelectionChange: r.onRowSelectionChange ?? te,
136
- state: {
137
- ...r.state,
138
- rowSelection: r.state?.rowSelection ?? O,
139
- sorting: r.state?.sorting ?? J,
140
- columnFilters: r.state?.columnFilters ?? Q,
141
- columnSizing: Y,
142
- columnPinning: le
143
- }
144
- }), { rows: H } = s.getRowModel(), {
145
- enabled: g,
146
- virtualItems: se,
147
- paddingTop: ce,
148
- paddingBottom: ae,
149
- measureElement: me
150
- } = Pe(H.length, m, d), k = m?.enabled, I = m?.hasNextPage, v = m?.isFetchingNextPage, N = m?.fetchNextPage, ue = 200, R = l.useCallback(
151
- (t) => {
152
- if (!t || !k) return;
153
- const { scrollHeight: e, scrollTop: n, clientHeight: a } = t;
154
- e - n - a < ue && !v && I && N?.();
155
- },
156
- [k, I, v, N]
157
- );
158
- l.useEffect(() => {
159
- R(d.current);
160
- }, [R]), y.current = s, l.useEffect(() => {
161
- y.current?.toggleAllRowsSelected(w);
162
- }, [w]);
163
- const de = () => {
164
- const t = s.getFlatHeaders(), e = {};
165
- for (let n = 0; n < t.length; n += 1) {
166
- const a = t[n];
167
- e[`--${i}-header-${a.id}-size`] = a.getSize(), e[`--${i}-col-${a.column.id}-size`] = a.column.getSize();
168
- }
169
- return e;
170
- }, ge = l.useMemo(() => s.getFlatHeaders().reduce((e, n) => e + n.getSize(), 0), [s.getState().columnSizingInfo, s.getState().columnSizing]);
171
- return /* @__PURE__ */ u(fe, { children: [
172
- q && /* @__PURE__ */ o(he, { color: "danger", sx: { marginBottom: 1 }, children: G }),
173
- b?.enabled && /* @__PURE__ */ o(
174
- Me,
175
- {
176
- ref: D,
177
- toolbar: b,
178
- columnFilters: s.getState().columnFilters,
179
- table: s
180
- }
181
- ),
182
- /* @__PURE__ */ u(z, { sx: { position: "relative" }, children: [
183
- c && /* @__PURE__ */ o(
184
- z,
185
- {
186
- sx: {
187
- position: "absolute",
188
- top: 0,
189
- left: 0,
190
- width: "100%",
191
- height: "100%",
192
- backgroundColor: "rgba(255, 255, 255, 0.7)",
193
- display: "flex",
194
- justifyContent: "center",
195
- alignItems: "flex-start",
196
- zIndex: 1,
197
- paddingTop: "10%"
198
- },
199
- children: /* @__PURE__ */ o(T, {})
200
- }
201
- ),
202
- /* @__PURE__ */ o(
203
- ze,
25
+ return /* @__PURE__ */ a(
26
+ h,
27
+ {
28
+ id: e,
29
+ loading: r,
30
+ reactTableOptions: s,
31
+ gridCheckboxes: t,
32
+ allSelected: i,
33
+ onSelectionChange: n,
34
+ infiniteScroll: p,
35
+ toolbar: c,
36
+ isError: b,
37
+ errorMessage: g,
38
+ syncUrl: x,
39
+ urlParamPrefix: L,
40
+ renderLayout: (T) => /* @__PURE__ */ a(
41
+ j,
204
42
  {
205
- ref: d,
206
- "data-testid": "table-wrapper",
207
- $maxHeight: x,
208
- onScroll: (t) => R(t.currentTarget),
209
- children: /* @__PURE__ */ u(
210
- Te,
211
- {
212
- hoverRow: !0,
213
- "data-testid": i,
214
- sx: be(
215
- de(),
216
- ge,
217
- j,
218
- re,
219
- x
220
- ),
221
- children: [
222
- s.getHeaderGroups().map((t) => /* @__PURE__ */ o("thead", { ref: M, children: /* @__PURE__ */ o("tr", { children: t.headers.map((e, n) => {
223
- const a = n === t.headers.length - 1, P = e.column.getIsPinned();
224
- return /* @__PURE__ */ u(
225
- "th",
226
- {
227
- colSpan: e.colSpan,
228
- "data-pinned": P || void 0,
229
- style: {
230
- width: !P && a ? "auto" : `calc(var(--${i}-header-${e.id}-size) * 1px)`
231
- },
232
- children: [
233
- e.isPlaceholder ? null : /* @__PURE__ */ u(xe, { children: [
234
- e.column.columnDef.meta?.noSortButton ? S(
235
- e.column.columnDef.header,
236
- e.getContext()
237
- ) : e.column.getCanSort() ? /* @__PURE__ */ u(
238
- we,
239
- {
240
- type: "button",
241
- "aria-label": `Sort ${e.id} column`,
242
- onClick: e.column.getToggleSortingHandler(),
243
- title: (
244
- // eslint-disable-next-line no-nested-ternary
245
- e.column.getNextSortingOrder() === A.ASC ? "Sort ascending" : e.column.getNextSortingOrder() === A.DESC ? "Sort descending" : "Clear sort"
246
- ),
247
- children: [
248
- S(
249
- e.column.columnDef.header,
250
- e.getContext()
251
- ),
252
- {
253
- asc: /* @__PURE__ */ o(p, { icon: B, size: "sm" }),
254
- desc: /* @__PURE__ */ o(p, { icon: $, size: "sm" })
255
- }[e.column.getIsSorted()] ?? (e.column.getNextSortingOrder() === "desc" ? /* @__PURE__ */ o(
256
- p,
257
- {
258
- icon: $,
259
- size: "sm",
260
- className: "fade"
261
- }
262
- ) : /* @__PURE__ */ o(
263
- p,
264
- {
265
- icon: B,
266
- size: "sm",
267
- className: "fade"
268
- }
269
- ))
270
- ]
271
- }
272
- ) : /* @__PURE__ */ o(Fe, { children: S(
273
- e.column.columnDef.header,
274
- e.getContext()
275
- ) }),
276
- e.column.getCanFilter() && e.column.columnDef.meta?.filterType && /* @__PURE__ */ o(
277
- De,
278
- {
279
- column: e.column,
280
- filterType: e.column.columnDef.meta.filterType,
281
- filterOptions: e.column.columnDef.meta?.filterOptions,
282
- filterSearchable: e.column.columnDef.meta?.filterSearchable
283
- }
284
- )
285
- ] }),
286
- e.column.getCanResize() && /* @__PURE__ */ o(
287
- "button",
288
- {
289
- type: "button",
290
- "aria-label": `Resize ${e.id} column`,
291
- onMouseDown: e.getResizeHandler(),
292
- onTouchStart: e.getResizeHandler(),
293
- className: `resizer ${e.column.getIsResizing() ? "isResizing" : ""}`
294
- }
295
- )
296
- ]
297
- },
298
- e.id
299
- );
300
- }) }) }, t.id)),
301
- /* @__PURE__ */ o(
302
- ye,
303
- {
304
- rows: H,
305
- columns: s.getAllColumns(),
306
- rowRender: L,
307
- loading: c,
308
- rowSelectionState: s.getState().rowSelection,
309
- virtualItems: g ? se : void 0,
310
- paddingTop: g ? ce : void 0,
311
- paddingBottom: g ? ae : void 0,
312
- measureElement: g ? me : void 0
313
- }
314
- ),
315
- U && s.getFooterGroups().length > 0 && /* @__PURE__ */ o("tfoot", { children: s.getFooterGroups().map((t) => /* @__PURE__ */ o("tr", { children: t.headers.map((e) => /* @__PURE__ */ o("td", { colSpan: e.colSpan, children: S(
316
- e.column.columnDef.footer,
317
- e.getContext()
318
- ) }, e.id)) }, t.id)) })
319
- ]
320
- }
321
- )
43
+ ctx: T,
44
+ maxHeight: l,
45
+ wrapText: f,
46
+ rowRender: o,
47
+ showStickyScrollbar: d,
48
+ enableStickyHeader: m,
49
+ stickyHeaderOffset: u,
50
+ footer: y
322
51
  }
323
52
  )
324
- ] }),
325
- g && m?.isFetchingNextPage && /* @__PURE__ */ u(
326
- z,
327
- {
328
- sx: {
329
- display: "flex",
330
- justifyContent: "center",
331
- alignItems: "center",
332
- gap: 1,
333
- padding: 1
334
- },
335
- children: [
336
- /* @__PURE__ */ o(T, { size: "sm" }),
337
- /* @__PURE__ */ o(Ce, { children: m.loadingText ?? "Loading more..." })
338
- ]
339
- }
340
- ),
341
- V && /* @__PURE__ */ o(
342
- Re,
343
- {
344
- scrollContainerRef: d,
345
- visible: ne,
346
- constrainToContainer: "main"
347
- }
348
- )
349
- ] });
53
+ }
54
+ );
350
55
  }
351
56
  export {
352
- ut as default
57
+ G as default
353
58
  };
@@ -54,8 +54,7 @@ const l = e.div`
54
54
  gap: 2px;
55
55
  width: 100%;
56
56
  height: 100%;
57
- `;
58
- e(r)`
57
+ `, g = e(r)`
59
58
  position: absolute;
60
59
  top: 0;
61
60
  left: 0;
@@ -67,8 +66,7 @@ e(r)`
67
66
  align-items: flex-start;
68
67
  z-index: 1;
69
68
  padding-top: 10%;
70
- `;
71
- const g = (t, i, o, a, n) => ({
69
+ `, f = (t, i, o, a, n) => ({
72
70
  ...t,
73
71
  tableLayout: "fixed",
74
72
  width: "100%",
@@ -191,7 +189,8 @@ const g = (t, i, o, a, n) => ({
191
189
  export {
192
190
  h as ColumnHeaderContainer,
193
191
  c as HeaderContent,
192
+ g as LoadingOverlay,
194
193
  s as SortButton,
195
194
  l as TableWrapper,
196
- g as getTableStyles
195
+ f as getTableStyles
197
196
  };
@@ -0,0 +1,92 @@
1
+ import { jsx as n, Fragment as p, jsxs as r } from "react/jsx-runtime";
2
+ import { faArrowDown as c, faArrowUp as m } from "../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
+ import { flexRender as l } 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";
4
+ import t from "../Icon/Icon.js";
5
+ import { HeaderContent as S, SortButton as C, ColumnHeaderContainer as z } from "./Table.styles.js";
6
+ import { SortDirection as a } from "./Table.types.js";
7
+ import { ColumnFilter as D } from "../DataGrid/filters/FilterComponents.js";
8
+ function w({
9
+ headerGroups: s,
10
+ id: u,
11
+ theadRef: d
12
+ }) {
13
+ return /* @__PURE__ */ n(p, { children: s.map((o) => /* @__PURE__ */ n("thead", { ref: d, children: /* @__PURE__ */ n("tr", { children: o.headers.map((e, f) => {
14
+ const g = f === o.headers.length - 1, i = e.column.getIsPinned();
15
+ return /* @__PURE__ */ r(
16
+ "th",
17
+ {
18
+ colSpan: e.colSpan,
19
+ "data-pinned": i || void 0,
20
+ style: {
21
+ width: !i && g ? "auto" : `calc(var(--${u}-header-${e.id}-size) * 1px)`
22
+ },
23
+ children: [
24
+ e.isPlaceholder ? null : /* @__PURE__ */ r(S, { children: [
25
+ e.column.columnDef.meta?.noSortButton ? l(e.column.columnDef.header, e.getContext()) : e.column.getCanSort() ? /* @__PURE__ */ r(
26
+ C,
27
+ {
28
+ type: "button",
29
+ "aria-label": `Sort ${e.id} column`,
30
+ onClick: e.column.getToggleSortingHandler(),
31
+ title: (
32
+ // eslint-disable-next-line no-nested-ternary
33
+ e.column.getNextSortingOrder() === a.ASC ? "Sort ascending" : e.column.getNextSortingOrder() === a.DESC ? "Sort descending" : "Clear sort"
34
+ ),
35
+ children: [
36
+ l(
37
+ e.column.columnDef.header,
38
+ e.getContext()
39
+ ),
40
+ {
41
+ asc: /* @__PURE__ */ n(t, { icon: m, size: "sm" }),
42
+ desc: /* @__PURE__ */ n(t, { icon: c, size: "sm" })
43
+ }[e.column.getIsSorted()] ?? (e.column.getNextSortingOrder() === "desc" ? /* @__PURE__ */ n(
44
+ t,
45
+ {
46
+ icon: c,
47
+ size: "sm",
48
+ className: "fade"
49
+ }
50
+ ) : /* @__PURE__ */ n(
51
+ t,
52
+ {
53
+ icon: m,
54
+ size: "sm",
55
+ className: "fade"
56
+ }
57
+ ))
58
+ ]
59
+ }
60
+ ) : /* @__PURE__ */ n(z, { children: l(
61
+ e.column.columnDef.header,
62
+ e.getContext()
63
+ ) }),
64
+ e.column.getCanFilter() && e.column.columnDef.meta?.filterType && /* @__PURE__ */ n(
65
+ D,
66
+ {
67
+ column: e.column,
68
+ filterType: e.column.columnDef.meta.filterType,
69
+ filterOptions: e.column.columnDef.meta?.filterOptions,
70
+ filterSearchable: e.column.columnDef.meta?.filterSearchable
71
+ }
72
+ )
73
+ ] }),
74
+ e.column.getCanResize() && /* @__PURE__ */ n(
75
+ "button",
76
+ {
77
+ type: "button",
78
+ "aria-label": `Resize ${e.id} column`,
79
+ onMouseDown: e.getResizeHandler(),
80
+ onTouchStart: e.getResizeHandler(),
81
+ className: `resizer ${e.column.getIsResizing() ? "isResizing" : ""}`
82
+ }
83
+ )
84
+ ]
85
+ },
86
+ e.id
87
+ );
88
+ }) }) }, o.id)) });
89
+ }
90
+ export {
91
+ w as default
92
+ };