@harpercollins/harpercollins-design-system 1.36.0 → 1.37.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.
- package/dist/cjs/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/cjs/components/data-display/DataGrid/FilterChipsSection.cjs +1 -1
- package/dist/cjs/components/data-display/DataGrid/TableSettingsDropdown.cjs +1 -0
- package/dist/cjs/components/data-display/DataGrid/TableToolbar.cjs +3 -3
- package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -1
- package/dist/cjs/components/data-display/Table/Table.cjs +1 -1
- package/dist/cjs/components/data-display/Table/Table.styles.cjs +32 -16
- package/dist/cjs/components/data-display/Table/TableHeader.cjs +1 -1
- package/dist/cjs/components/data-display/Table/TableLayout.cjs +1 -1
- package/dist/cjs/styles/lightExternalTheme.cjs +1 -1
- package/dist/cjs/styles/lightInternalTheme.cjs +1 -1
- package/dist/esm/components/data-display/DataGrid/DataGrid.js +32 -28
- package/dist/esm/components/data-display/DataGrid/FilterChipsSection.js +25 -16
- package/dist/esm/components/data-display/DataGrid/TableSettingsDropdown.js +41 -0
- package/dist/esm/components/data-display/DataGrid/TableToolbar.js +28 -18
- package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +120 -112
- package/dist/esm/components/data-display/Table/Table.js +19 -19
- package/dist/esm/components/data-display/Table/Table.styles.js +39 -21
- package/dist/esm/components/data-display/Table/TableHeader.js +24 -24
- package/dist/esm/components/data-display/Table/TableLayout.js +72 -72
- package/dist/esm/styles/lightExternalTheme.js +12 -0
- package/dist/esm/styles/lightInternalTheme.js +14 -2
- package/dist/index.d.ts +9 -4
- package/package.json +1 -1
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { flexRender as
|
|
1
|
+
import { jsxs as g, Fragment as M, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { flexRender as W } 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
|
|
5
|
-
import { TableWrapper as
|
|
6
|
-
import { TableBody as
|
|
7
|
-
import
|
|
8
|
-
import { useStickyHeader as
|
|
9
|
-
import { useStickyScrollbar as
|
|
10
|
-
import
|
|
11
|
-
function
|
|
12
|
-
ctx:
|
|
13
|
-
maxHeight:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
stickyHeaderOffset: h = 0,
|
|
4
|
+
import j from "./StickyHorizontalScrollbar.js";
|
|
5
|
+
import { TableWrapper as E, getTableStyles as L } from "./Table.styles.js";
|
|
6
|
+
import { TableBody as _ } from "./TableBody.js";
|
|
7
|
+
import D from "./TableHeader.js";
|
|
8
|
+
import { useStickyHeader as O } from "./hooks/useStickyHeader.js";
|
|
9
|
+
import { useStickyScrollbar as q } from "./hooks/useStickyScrollbar.js";
|
|
10
|
+
import A 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
|
+
function te({
|
|
12
|
+
ctx: S,
|
|
13
|
+
maxHeight: d = !1,
|
|
14
|
+
rowRender: b,
|
|
15
|
+
showStickyScrollbar: h = !1,
|
|
16
|
+
enableStickyHeader: T = !1,
|
|
17
|
+
stickyHeaderOffset: y = 0,
|
|
19
18
|
footer: z
|
|
20
19
|
}) {
|
|
21
20
|
const {
|
|
22
21
|
id: i,
|
|
23
|
-
table:
|
|
24
|
-
rows:
|
|
25
|
-
isVirtual:
|
|
26
|
-
virtualItems:
|
|
27
|
-
paddingTop:
|
|
28
|
-
paddingBottom:
|
|
29
|
-
measureElement:
|
|
22
|
+
table: t,
|
|
23
|
+
rows: R,
|
|
24
|
+
isVirtual: a,
|
|
25
|
+
virtualItems: v,
|
|
26
|
+
paddingTop: w,
|
|
27
|
+
paddingBottom: x,
|
|
28
|
+
measureElement: V,
|
|
30
29
|
wrapperRef: n,
|
|
31
|
-
toolbarRef:
|
|
32
|
-
loading:
|
|
33
|
-
fetchMoreOnBottomReached:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
toolbarRef: H,
|
|
31
|
+
loading: k,
|
|
32
|
+
fetchMoreOnBottomReached: F,
|
|
33
|
+
wrapText: $
|
|
34
|
+
} = S, m = c.useRef(null), B = q(n), C = O({
|
|
35
|
+
enabled: T,
|
|
36
|
+
stickyHeaderOffset: y,
|
|
37
37
|
tableWrapperRef: n,
|
|
38
|
-
theadRef:
|
|
39
|
-
toolbarRef:
|
|
40
|
-
}),
|
|
41
|
-
const o =
|
|
42
|
-
for (let
|
|
43
|
-
const s = o[
|
|
44
|
-
|
|
38
|
+
theadRef: m,
|
|
39
|
+
toolbarRef: H
|
|
40
|
+
}), { columnSizingInfo: u, columnSizing: p, columnVisibility: f } = t.getState(), G = c.useMemo(() => {
|
|
41
|
+
const o = t.getFlatHeaders(), e = {};
|
|
42
|
+
for (let l = 0; l < o.length; l += 1) {
|
|
43
|
+
const s = o[l];
|
|
44
|
+
e[`--${i}-header-${s.id}-size`] = s.getSize(), e[`--${i}-col-${s.column.id}-size`] = s.column.getSize();
|
|
45
45
|
}
|
|
46
|
-
return
|
|
47
|
-
}, [i,
|
|
48
|
-
return /* @__PURE__ */
|
|
46
|
+
return e;
|
|
47
|
+
}, [i, u, p, f]), I = c.useMemo(() => t.getFlatHeaders().reduce((e, l) => e + l.getSize(), 0), [u, p, f]);
|
|
48
|
+
return /* @__PURE__ */ g(M, { children: [
|
|
49
49
|
/* @__PURE__ */ r(
|
|
50
|
-
|
|
50
|
+
E,
|
|
51
51
|
{
|
|
52
52
|
ref: n,
|
|
53
53
|
"data-testid": "table-wrapper",
|
|
54
|
-
$maxHeight:
|
|
55
|
-
onScroll: (o) =>
|
|
56
|
-
children: /* @__PURE__ */
|
|
57
|
-
|
|
54
|
+
$maxHeight: d,
|
|
55
|
+
onScroll: (o) => F(o.currentTarget),
|
|
56
|
+
children: /* @__PURE__ */ g(
|
|
57
|
+
A,
|
|
58
58
|
{
|
|
59
59
|
hoverRow: !0,
|
|
60
60
|
"data-testid": i,
|
|
61
|
-
sx:
|
|
61
|
+
sx: L(
|
|
62
|
+
G,
|
|
63
|
+
I,
|
|
62
64
|
$,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
F,
|
|
66
|
-
m
|
|
65
|
+
C,
|
|
66
|
+
d
|
|
67
67
|
),
|
|
68
68
|
children: [
|
|
69
69
|
/* @__PURE__ */ r(
|
|
70
|
-
|
|
70
|
+
D,
|
|
71
71
|
{
|
|
72
|
-
headerGroups:
|
|
72
|
+
headerGroups: t.getHeaderGroups(),
|
|
73
73
|
id: i,
|
|
74
|
-
theadRef:
|
|
74
|
+
theadRef: m
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
77
|
/* @__PURE__ */ r(
|
|
78
|
-
|
|
78
|
+
_,
|
|
79
79
|
{
|
|
80
|
-
rows:
|
|
81
|
-
columns:
|
|
82
|
-
columnVisibility:
|
|
83
|
-
rowRender:
|
|
84
|
-
loading:
|
|
85
|
-
rowSelectionState:
|
|
86
|
-
virtualItems:
|
|
87
|
-
paddingTop:
|
|
88
|
-
paddingBottom:
|
|
89
|
-
measureElement:
|
|
80
|
+
rows: R,
|
|
81
|
+
columns: t.getVisibleLeafColumns(),
|
|
82
|
+
columnVisibility: t.getState().columnVisibility,
|
|
83
|
+
rowRender: b,
|
|
84
|
+
loading: k,
|
|
85
|
+
rowSelectionState: t.getState().rowSelection,
|
|
86
|
+
virtualItems: a ? v : void 0,
|
|
87
|
+
paddingTop: a ? w : void 0,
|
|
88
|
+
paddingBottom: a ? x : void 0,
|
|
89
|
+
measureElement: a ? V : void 0
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
|
-
z &&
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
) },
|
|
92
|
+
z && t.getFooterGroups().length > 0 && /* @__PURE__ */ r("tfoot", { children: t.getFooterGroups().map((o) => /* @__PURE__ */ r("tr", { children: o.headers.map((e) => /* @__PURE__ */ r("td", { colSpan: e.colSpan, children: W(
|
|
93
|
+
e.column.columnDef.footer,
|
|
94
|
+
e.getContext()
|
|
95
|
+
) }, e.id)) }, o.id)) })
|
|
96
96
|
]
|
|
97
97
|
}
|
|
98
98
|
)
|
|
99
99
|
}
|
|
100
100
|
),
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
h && /* @__PURE__ */ r(
|
|
102
|
+
j,
|
|
103
103
|
{
|
|
104
104
|
scrollContainerRef: n,
|
|
105
|
-
visible:
|
|
105
|
+
visible: B,
|
|
106
106
|
constrainToContainer: "main"
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
] });
|
|
110
110
|
}
|
|
111
111
|
export {
|
|
112
|
-
|
|
112
|
+
te as default
|
|
113
113
|
};
|
|
@@ -38,6 +38,18 @@ const a = e({
|
|
|
38
38
|
800: "#313132",
|
|
39
39
|
900: "#181919"
|
|
40
40
|
},
|
|
41
|
+
warning: {
|
|
42
|
+
50: "#FFEFE6",
|
|
43
|
+
100: "#FFD2B8",
|
|
44
|
+
200: "#FFB58A",
|
|
45
|
+
300: "#FF985C",
|
|
46
|
+
400: "#FF7B2E",
|
|
47
|
+
500: "#EC5800",
|
|
48
|
+
600: "#D14D00",
|
|
49
|
+
700: "#752B00",
|
|
50
|
+
800: "#471A00",
|
|
51
|
+
900: "#1A0900"
|
|
52
|
+
},
|
|
41
53
|
appbar: {
|
|
42
54
|
background: "var(--color--white)",
|
|
43
55
|
text: "var(--color--grey)",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r 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/styles/extendTheme.js";
|
|
2
|
-
const
|
|
2
|
+
const e = r({
|
|
3
3
|
cssVarPrefix: "",
|
|
4
4
|
colorSchemes: {
|
|
5
5
|
light: {
|
|
@@ -34,6 +34,18 @@ const a = r({
|
|
|
34
34
|
800: "#313132",
|
|
35
35
|
900: "#181919"
|
|
36
36
|
},
|
|
37
|
+
warning: {
|
|
38
|
+
50: "#FFEFE6",
|
|
39
|
+
100: "#FFD2B8",
|
|
40
|
+
200: "#FFB58A",
|
|
41
|
+
300: "#FF985C",
|
|
42
|
+
400: "#FF7B2E",
|
|
43
|
+
500: "#EC5800",
|
|
44
|
+
600: "#D14D00",
|
|
45
|
+
700: "#752B00",
|
|
46
|
+
800: "#471A00",
|
|
47
|
+
900: "#1A0900"
|
|
48
|
+
},
|
|
37
49
|
background: {
|
|
38
50
|
body: "var(--palette-primary-50)",
|
|
39
51
|
surface: "var(--color--white)"
|
|
@@ -51,5 +63,5 @@ const a = r({
|
|
|
51
63
|
}
|
|
52
64
|
});
|
|
53
65
|
export {
|
|
54
|
-
|
|
66
|
+
e as lightInternalTheme
|
|
55
67
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -228,7 +228,7 @@ export declare function Container(props: ContainerProps): JSX_2.Element;
|
|
|
228
228
|
* For a standard HTML table layout, use the `Table` component, which wraps
|
|
229
229
|
* `DataGrid` with the built-in `TableLayout`.
|
|
230
230
|
*/
|
|
231
|
-
export declare function DataGrid<TData = unknown>({ id, loading, reactTableOptions, gridCheckboxes, allSelected, onSelectionChange, infiniteScroll, syncUrl, urlParamPrefix, renderLayout, toolbar, isError, errorMessage, }: DataGridProps<TData>): JSX_2.Element;
|
|
231
|
+
export declare function DataGrid<TData = unknown>({ id, loading, reactTableOptions, gridCheckboxes, allSelected, onSelectionChange, infiniteScroll, syncUrl, urlParamPrefix, initialWrapText, renderLayout, toolbar, isError, errorMessage, }: DataGridProps<TData>): JSX_2.Element;
|
|
232
232
|
|
|
233
233
|
/** Core data-management options shared by DataGrid and Table. */
|
|
234
234
|
export declare interface DataGridCoreOptions<TData = unknown> {
|
|
@@ -265,9 +265,12 @@ export declare interface DataGridLayoutContext<TData = unknown> {
|
|
|
265
265
|
fetchMoreOnBottomReached: (container: HTMLDivElement | null) => void;
|
|
266
266
|
/** Resets column visibility to the defaults derived from column meta (hidden). Clears localStorage. */
|
|
267
267
|
resetColumnVisibility: () => void;
|
|
268
|
+
wrapText: boolean;
|
|
269
|
+
toggleWrapText: () => void;
|
|
268
270
|
}
|
|
269
271
|
|
|
270
272
|
export declare interface DataGridProps<TData = unknown> extends DataGridCoreOptions<TData> {
|
|
273
|
+
initialWrapText?: boolean;
|
|
271
274
|
/**
|
|
272
275
|
* Render prop that receives the processed data context and returns the
|
|
273
276
|
* layout to display. Use the built-in `TableLayout` for a standard table,
|
|
@@ -606,12 +609,11 @@ export declare function Table<TData = unknown>({ id, loading, maxHeight, wrapTex
|
|
|
606
609
|
* sticky header, sticky horizontal scrollbar, and virtual row rendering.
|
|
607
610
|
* Attach `ctx.wrapperRef` to your scroll container if building a custom layout.
|
|
608
611
|
*/
|
|
609
|
-
export declare function TableLayout<TData = unknown>({ ctx, maxHeight,
|
|
612
|
+
export declare function TableLayout<TData = unknown>({ ctx, maxHeight, rowRender, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, footer, }: TableLayoutProps<TData>): JSX_2.Element;
|
|
610
613
|
|
|
611
614
|
export declare interface TableLayoutProps<TData = unknown> {
|
|
612
615
|
ctx: DataGridLayoutContext<TData>;
|
|
613
616
|
maxHeight?: boolean;
|
|
614
|
-
wrapText?: boolean;
|
|
615
617
|
rowRender?: (row: Row<TData>, props: {
|
|
616
618
|
key: string;
|
|
617
619
|
}) => JSX.Element;
|
|
@@ -621,7 +623,7 @@ export declare interface TableLayoutProps<TData = unknown> {
|
|
|
621
623
|
footer?: boolean;
|
|
622
624
|
}
|
|
623
625
|
|
|
624
|
-
export declare interface TableProps<TData = unknown> extends Omit<DataGridProps<TData>, "renderLayout"> {
|
|
626
|
+
export declare interface TableProps<TData = unknown> extends Omit<DataGridProps<TData>, "renderLayout" | "initialWrapText"> {
|
|
625
627
|
maxHeight?: boolean;
|
|
626
628
|
wrapText?: boolean;
|
|
627
629
|
rowRender?: (row: Row<TData>, props: {
|
|
@@ -649,6 +651,9 @@ export declare interface TableToolbarOptions {
|
|
|
649
651
|
manageColumns?: {
|
|
650
652
|
enabled: boolean;
|
|
651
653
|
};
|
|
654
|
+
tableSettings?: {
|
|
655
|
+
enabled: boolean;
|
|
656
|
+
};
|
|
652
657
|
}
|
|
653
658
|
|
|
654
659
|
export { TabList }
|