@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.
Files changed (24) hide show
  1. package/dist/cjs/components/data-display/DataGrid/DataGrid.cjs +1 -1
  2. package/dist/cjs/components/data-display/DataGrid/FilterChipsSection.cjs +1 -1
  3. package/dist/cjs/components/data-display/DataGrid/TableSettingsDropdown.cjs +1 -0
  4. package/dist/cjs/components/data-display/DataGrid/TableToolbar.cjs +3 -3
  5. package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -1
  6. package/dist/cjs/components/data-display/Table/Table.cjs +1 -1
  7. package/dist/cjs/components/data-display/Table/Table.styles.cjs +32 -16
  8. package/dist/cjs/components/data-display/Table/TableHeader.cjs +1 -1
  9. package/dist/cjs/components/data-display/Table/TableLayout.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 +32 -28
  13. package/dist/esm/components/data-display/DataGrid/FilterChipsSection.js +25 -16
  14. package/dist/esm/components/data-display/DataGrid/TableSettingsDropdown.js +41 -0
  15. package/dist/esm/components/data-display/DataGrid/TableToolbar.js +28 -18
  16. package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +120 -112
  17. package/dist/esm/components/data-display/Table/Table.js +19 -19
  18. package/dist/esm/components/data-display/Table/Table.styles.js +39 -21
  19. package/dist/esm/components/data-display/Table/TableHeader.js +24 -24
  20. package/dist/esm/components/data-display/Table/TableLayout.js +72 -72
  21. package/dist/esm/styles/lightExternalTheme.js +12 -0
  22. package/dist/esm/styles/lightInternalTheme.js +14 -2
  23. package/dist/index.d.ts +9 -4
  24. package/package.json +1 -1
@@ -1,113 +1,113 @@
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";
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 G from "./StickyHorizontalScrollbar.js";
5
- import { TableWrapper as M, getTableStyles as W } from "./Table.styles.js";
6
- import { TableBody as j } from "./TableBody.js";
7
- import E from "./TableHeader.js";
8
- import { useStickyHeader as L } from "./hooks/useStickyHeader.js";
9
- import { useStickyScrollbar as _ } from "./hooks/useStickyScrollbar.js";
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
- function Y({
12
- ctx: f,
13
- maxHeight: m = !1,
14
- wrapText: p = !1,
15
- rowRender: g,
16
- showStickyScrollbar: S = !1,
17
- enableStickyHeader: b = !1,
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: e,
24
- rows: T,
25
- isVirtual: l,
26
- virtualItems: y,
27
- paddingTop: R,
28
- paddingBottom: v,
29
- measureElement: w,
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: x,
32
- loading: H,
33
- fetchMoreOnBottomReached: V
34
- } = f, d = c.useRef(null), k = _(n), F = L({
35
- enabled: b,
36
- stickyHeaderOffset: h,
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: d,
39
- toolbarRef: x
40
- }), $ = c.useMemo(() => {
41
- const o = e.getFlatHeaders(), t = {};
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();
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 t;
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: [
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
- M,
50
+ E,
51
51
  {
52
52
  ref: n,
53
53
  "data-testid": "table-wrapper",
54
- $maxHeight: m,
55
- onScroll: (o) => V(o.currentTarget),
56
- children: /* @__PURE__ */ u(
57
- D,
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: W(
61
+ sx: L(
62
+ G,
63
+ I,
62
64
  $,
63
- B,
64
- p,
65
- F,
66
- m
65
+ C,
66
+ d
67
67
  ),
68
68
  children: [
69
69
  /* @__PURE__ */ r(
70
- E,
70
+ D,
71
71
  {
72
- headerGroups: e.getHeaderGroups(),
72
+ headerGroups: t.getHeaderGroups(),
73
73
  id: i,
74
- theadRef: d
74
+ theadRef: m
75
75
  }
76
76
  ),
77
77
  /* @__PURE__ */ r(
78
- j,
78
+ _,
79
79
  {
80
- rows: T,
81
- columns: e.getVisibleLeafColumns(),
82
- columnVisibility: e.getState().columnVisibility,
83
- rowRender: g,
84
- loading: H,
85
- rowSelectionState: e.getState().rowSelection,
86
- virtualItems: l ? y : void 0,
87
- paddingTop: l ? R : void 0,
88
- paddingBottom: l ? v : void 0,
89
- measureElement: l ? w : void 0
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 && 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(
93
- t.column.columnDef.footer,
94
- t.getContext()
95
- ) }, t.id)) }, o.id)) })
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
- S && /* @__PURE__ */ r(
102
- G,
101
+ h && /* @__PURE__ */ r(
102
+ j,
103
103
  {
104
104
  scrollContainerRef: n,
105
- visible: k,
105
+ visible: B,
106
106
  constrainToContainer: "main"
107
107
  }
108
108
  )
109
109
  ] });
110
110
  }
111
111
  export {
112
- Y as default
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 a = r({
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
- a as lightInternalTheme
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, wrapText, rowRender, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, footer, }: TableLayoutProps<TData>): JSX_2.Element;
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 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harpercollins/harpercollins-design-system",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@ssh.dev.azure.com:v3/HarperCollinsUK/HCDesignSystem/HCDesignSystem"