@harpercollins/harpercollins-design-system 1.38.0 → 1.38.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/.DS_Store ADDED
Binary file
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("react/jsx-runtime"),p=require("react"),i=require("styled-components"),u=require("../Typography/Typography.cjs"),g=require("./ExportToExcelButton.cjs"),h=require("./FilterChipsSection.cjs"),f=require("./ManageColumnsDropdown.cjs"),T=require("./TableSettingsDropdown.cjs"),n=require("../../../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.cjs"),j=i(n)`
1
+ "use strict";const t=require("react/jsx-runtime"),u=require("react"),n=require("styled-components"),h=require("../Typography/Typography.cjs"),f=require("./ExportToExcelButton.cjs"),g=require("./FilterChipsSection.cjs"),w=require("./ManageColumnsDropdown.cjs"),T=require("./TableSettingsDropdown.cjs"),s=require("../../../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.cjs"),m=n(s)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 8px;
@@ -9,9 +9,32 @@
9
9
  position: sticky;
10
10
  top: 0;
11
11
  z-index: 1;
12
- `,m=i(n)`
12
+ `,y=n(s)`
13
13
  display: flex;
14
14
  align-items: center;
15
15
  justify-content: space-between;
16
+ gap: 8px;
16
17
  width: 100%;
17
- `;function w({toolbar:e,columnFilters:o,table:s,resetColumnVisibility:l,wrapText:r,onWrapTextToggle:c},d){const a=s.getFilteredRowModel().rows.length,x=o.length>0;return t.jsx(j,{ref:d,children:t.jsxs(m,{children:[t.jsxs(n,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.leftContent?e.leftContent:null,e.exportToExcel?.enabled&&t.jsx(g,{onExport:e.exportToExcel.onExport,disabled:e.exportToExcel.disabled}),e.showFilterChips?t.jsx(h,{columnFilters:o,table:s}):null]}),t.jsxs(n,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.totalResults!==void 0&&t.jsx(u,{level:"body-sm",sx:{fontWeight:500},children:x?`Showing ${a.toLocaleString()} of ${e.totalResults.toLocaleString()} results`:`Total Results: ${e.totalResults.toLocaleString()}`}),e.rightContent?e.rightContent:null,e.manageColumns?.enabled&&t.jsx(f,{table:s,onReset:l}),e.tableSettings?.enabled&&t.jsx(T,{wrapText:r,onWrapTextToggle:c})]})]})})}const y=p.forwardRef(w);module.exports=y;
18
+ /* Allow the start/end groups to wrap onto separate lines when they
19
+ no longer fit side by side (e.g. many filters on a narrow viewport). */
20
+ flex-wrap: wrap;
21
+ `,i=n(s)`
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 8px;
25
+ /* min-width: 0 lets the group shrink below its content width so children
26
+ (filter chips) can wrap or ellipsis instead of overflowing the toolbar. */
27
+ min-width: 0;
28
+ flex-wrap: wrap;
29
+ `,j=n(i)`
30
+ flex: 1 1 auto;
31
+ `,b=n(i)`
32
+ flex: 0 0 auto;
33
+ justify-content: flex-end;
34
+
35
+ /* On small screens, drop the controls onto their own full-width line. */
36
+ @media (max-width: 768px) {
37
+ flex: 1 1 100%;
38
+ justify-content: flex-start;
39
+ }
40
+ `;function R({toolbar:e,columnFilters:r,table:o,resetColumnVisibility:l,wrapText:a,onWrapTextToggle:c},d){const p=o.getFilteredRowModel().rows.length,x=r.length>0;return t.jsx(m,{ref:d,children:t.jsxs(y,{children:[t.jsxs(j,{children:[e.leftContent?e.leftContent:null,e.exportToExcel?.enabled&&t.jsx(f,{onExport:e.exportToExcel.onExport,disabled:e.exportToExcel.disabled}),e.showFilterChips?t.jsx(g,{columnFilters:r,table:o}):null]}),t.jsxs(b,{children:[e.totalResults!==void 0&&t.jsx(h,{level:"body-sm",sx:{fontWeight:500},children:x?`Showing ${p.toLocaleString()} of ${e.totalResults.toLocaleString()} results`:`Total Results: ${e.totalResults.toLocaleString()}`}),e.rightContent?e.rightContent:null,e.manageColumns?.enabled&&t.jsx(w,{table:o,onReset:l}),e.tableSettings?.enabled&&t.jsx(T,{wrapText:a,onWrapTextToggle:c})]})]})})}const q=u.forwardRef(R);module.exports=q;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react");function E({enabled:a,stickyHeaderOffset:f,tableWrapperRef:p,theadRef:u,toolbarRef:d}){const[T,i]=c.useState(!1),s=c.useRef(!1),e=c.useRef(null),n=c.useRef(!1),y=c.useRef(0);return c.useEffect(()=>{if(!a){i(!1),s.current=!1;const r=u.current;r&&(r.style.setProperty("--header-top","0px"),r.style.opacity="1");return}const o=p.current,t=u.current,m=d.current;if(!o||!t)return;const R=m?.offsetHeight??0,l=()=>{const h=t.getBoundingClientRect().top,v=f+R;if(h<=v){n.current||(n.current=!0,t.style.opacity="0"),e.current&&clearTimeout(e.current),e.current=setTimeout(()=>{n.current=!1,t.style.opacity="1"},150);const g=v-h;t.style.setProperty("--header-top",`${g}px`),s.current||(s.current=!0,i(!0))}else t.style.opacity="1",n.current=!1,e.current&&clearTimeout(e.current),t.style.setProperty("--header-top","0px"),s.current&&(s.current=!1,i(!1))};l(),window.addEventListener("scroll",l,{passive:!0});const S=()=>{const r=o.scrollTop;r!==y.current&&(y.current=r,l())};return o.addEventListener("scroll",S,{passive:!0}),()=>{window.removeEventListener("scroll",l),o.removeEventListener("scroll",S),e.current&&clearTimeout(e.current)}},[a,f,p,u,d]),T}exports.useStickyHeader=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react");function H({enabled:y,stickyHeaderOffset:h,tableWrapperRef:v,theadRef:a,toolbarRef:m}){const[w,p]=n.useState(!1),c=n.useRef(!1),t=n.useRef(null),l=n.useRef(!1),S=n.useRef(0),u=n.useRef(0);return n.useEffect(()=>{if(!y){p(!1),c.current=!1;const e=a.current;e&&(e.style.setProperty("--header-top","0px"),e.style.opacity="1");return}const i=v.current,r=a.current,f=m.current;if(!i||!r)return;u.current=f?.offsetHeight??0;const s=()=>{const T=r.getBoundingClientRect().top,g=h+u.current;if(T<=g){l.current||(l.current=!0,r.style.opacity="0"),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{l.current=!1,r.style.opacity="1"},150);const E=g-T;r.style.setProperty("--header-top",`${E}px`),c.current||(c.current=!0,p(!0))}else r.style.opacity="1",l.current=!1,t.current&&clearTimeout(t.current),r.style.setProperty("--header-top","0px"),c.current&&(c.current=!1,p(!1))};s(),window.addEventListener("scroll",s,{passive:!0});const R=()=>{const e=i.scrollTop;e!==S.current&&(S.current=e,s())};i.addEventListener("scroll",R,{passive:!0});let d,o=null;return f&&typeof ResizeObserver<"u"&&(d=new ResizeObserver(()=>{o===null&&(o=requestAnimationFrame(()=>{o=null;const e=f.offsetHeight;e!==u.current&&(u.current=e,s())}))}),d.observe(f)),()=>{window.removeEventListener("scroll",s),i.removeEventListener("scroll",R),d?.disconnect(),o!==null&&cancelAnimationFrame(o),t.current&&clearTimeout(t.current)}},[y,h,v,a,m]),w}exports.useStickyHeader=H;
@@ -1,13 +1,13 @@
1
- import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
- import f from "react";
3
- import r from "styled-components";
4
- import x from "../Typography/Typography.js";
5
- import g from "./ExportToExcelButton.js";
6
- import u from "./FilterChipsSection.js";
7
- import h from "./ManageColumnsDropdown.js";
1
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
+ import x from "react";
3
+ import o from "styled-components";
4
+ import m from "../Typography/Typography.js";
5
+ import u from "./ExportToExcelButton.js";
6
+ import g from "./FilterChipsSection.js";
7
+ import w from "./ManageColumnsDropdown.js";
8
8
  import T from "./TableSettingsDropdown.js";
9
- import o 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";
10
- const w = r(o)`
9
+ import l 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";
10
+ const y = o(l)`
11
11
  display: flex;
12
12
  flex-direction: column;
13
13
  gap: 8px;
@@ -18,54 +18,77 @@ const w = r(o)`
18
18
  position: sticky;
19
19
  top: 0;
20
20
  z-index: 1;
21
- `, y = r(o)`
21
+ `, b = o(l)`
22
22
  display: flex;
23
23
  align-items: center;
24
24
  justify-content: space-between;
25
+ gap: 8px;
25
26
  width: 100%;
27
+ /* Allow the start/end groups to wrap onto separate lines when they
28
+ no longer fit side by side (e.g. many filters on a narrow viewport). */
29
+ flex-wrap: wrap;
30
+ `, s = o(l)`
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 8px;
34
+ /* min-width: 0 lets the group shrink below its content width so children
35
+ (filter chips) can wrap or ellipsis instead of overflowing the toolbar. */
36
+ min-width: 0;
37
+ flex-wrap: wrap;
38
+ `, R = o(s)`
39
+ flex: 1 1 auto;
40
+ `, C = o(s)`
41
+ flex: 0 0 auto;
42
+ justify-content: flex-end;
43
+
44
+ /* On small screens, drop the controls onto their own full-width line. */
45
+ @media (max-width: 768px) {
46
+ flex: 1 1 100%;
47
+ justify-content: flex-start;
48
+ }
26
49
  `;
27
- function R({
50
+ function S({
28
51
  toolbar: e,
29
52
  columnFilters: i,
30
53
  table: n,
31
- resetColumnVisibility: s,
32
- wrapText: d,
33
- onWrapTextToggle: p
34
- }, a) {
35
- const c = n.getFilteredRowModel().rows.length, m = i.length > 0;
36
- return /* @__PURE__ */ t(w, { ref: a, children: /* @__PURE__ */ l(y, { children: [
37
- /* @__PURE__ */ l(o, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
54
+ resetColumnVisibility: a,
55
+ wrapText: p,
56
+ onWrapTextToggle: d
57
+ }, c) {
58
+ const f = n.getFilteredRowModel().rows.length, h = i.length > 0;
59
+ return /* @__PURE__ */ t(y, { ref: c, children: /* @__PURE__ */ r(b, { children: [
60
+ /* @__PURE__ */ r(R, { children: [
38
61
  e.leftContent ? e.leftContent : null,
39
62
  e.exportToExcel?.enabled && /* @__PURE__ */ t(
40
- g,
63
+ u,
41
64
  {
42
65
  onExport: e.exportToExcel.onExport,
43
66
  disabled: e.exportToExcel.disabled
44
67
  }
45
68
  ),
46
- e.showFilterChips ? /* @__PURE__ */ t(u, { columnFilters: i, table: n }) : null
69
+ e.showFilterChips ? /* @__PURE__ */ t(g, { columnFilters: i, table: n }) : null
47
70
  ] }),
48
- /* @__PURE__ */ l(o, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
49
- e.totalResults !== void 0 && /* @__PURE__ */ t(x, { level: "body-sm", sx: { fontWeight: 500 }, children: m ? `Showing ${c.toLocaleString()} of ${e.totalResults.toLocaleString()} results` : `Total Results: ${e.totalResults.toLocaleString()}` }),
71
+ /* @__PURE__ */ r(C, { children: [
72
+ e.totalResults !== void 0 && /* @__PURE__ */ t(m, { level: "body-sm", sx: { fontWeight: 500 }, children: h ? `Showing ${f.toLocaleString()} of ${e.totalResults.toLocaleString()} results` : `Total Results: ${e.totalResults.toLocaleString()}` }),
50
73
  e.rightContent ? e.rightContent : null,
51
74
  e.manageColumns?.enabled && /* @__PURE__ */ t(
52
- h,
75
+ w,
53
76
  {
54
77
  table: n,
55
- onReset: s
78
+ onReset: a
56
79
  }
57
80
  ),
58
81
  e.tableSettings?.enabled && /* @__PURE__ */ t(
59
82
  T,
60
83
  {
61
- wrapText: d,
62
- onWrapTextToggle: p
84
+ wrapText: p,
85
+ onWrapTextToggle: d
63
86
  }
64
87
  )
65
88
  ] })
66
89
  ] }) });
67
90
  }
68
- const L = f.forwardRef(R);
91
+ const B = x.forwardRef(S);
69
92
  export {
70
- L as default
93
+ B as default
71
94
  };
@@ -1,44 +1,53 @@
1
- import c from "react";
2
- function w({
3
- enabled: a,
4
- stickyHeaderOffset: f,
5
- tableWrapperRef: p,
6
- theadRef: u,
7
- toolbarRef: d
1
+ import n from "react";
2
+ function H({
3
+ enabled: y,
4
+ stickyHeaderOffset: h,
5
+ tableWrapperRef: m,
6
+ theadRef: a,
7
+ toolbarRef: v
8
8
  }) {
9
- const [v, i] = c.useState(!1), s = c.useRef(!1), e = c.useRef(null), n = c.useRef(!1), y = c.useRef(0);
10
- return c.useEffect(() => {
11
- if (!a) {
12
- i(!1), s.current = !1;
13
- const r = u.current;
14
- r && (r.style.setProperty("--header-top", "0px"), r.style.opacity = "1");
9
+ const [w, p] = n.useState(!1), c = n.useRef(!1), t = n.useRef(null), l = n.useRef(!1), R = n.useRef(0), u = n.useRef(0);
10
+ return n.useEffect(() => {
11
+ if (!y) {
12
+ p(!1), c.current = !1;
13
+ const e = a.current;
14
+ e && (e.style.setProperty("--header-top", "0px"), e.style.opacity = "1");
15
15
  return;
16
16
  }
17
- const o = p.current, t = u.current, T = d.current;
18
- if (!o || !t) return;
19
- const R = T?.offsetHeight ?? 0, l = () => {
20
- const S = t.getBoundingClientRect().top, m = f + R;
21
- if (S <= m) {
22
- n.current || (n.current = !0, t.style.opacity = "0"), e.current && clearTimeout(e.current), e.current = setTimeout(() => {
23
- n.current = !1, t.style.opacity = "1";
17
+ const i = m.current, r = a.current, f = v.current;
18
+ if (!i || !r) return;
19
+ u.current = f?.offsetHeight ?? 0;
20
+ const s = () => {
21
+ const T = r.getBoundingClientRect().top, g = h + u.current;
22
+ if (T <= g) {
23
+ l.current || (l.current = !0, r.style.opacity = "0"), t.current && clearTimeout(t.current), t.current = setTimeout(() => {
24
+ l.current = !1, r.style.opacity = "1";
24
25
  }, 150);
25
- const E = m - S;
26
- t.style.setProperty("--header-top", `${E}px`), s.current || (s.current = !0, i(!0));
26
+ const E = g - T;
27
+ r.style.setProperty("--header-top", `${E}px`), c.current || (c.current = !0, p(!0));
27
28
  } else
28
- t.style.opacity = "1", n.current = !1, e.current && clearTimeout(e.current), t.style.setProperty("--header-top", "0px"), s.current && (s.current = !1, i(!1));
29
+ r.style.opacity = "1", l.current = !1, t.current && clearTimeout(t.current), r.style.setProperty("--header-top", "0px"), c.current && (c.current = !1, p(!1));
29
30
  };
30
- l(), window.addEventListener("scroll", l, { passive: !0 });
31
- const h = () => {
32
- const r = o.scrollTop;
33
- r !== y.current && (y.current = r, l());
31
+ s(), window.addEventListener("scroll", s, { passive: !0 });
32
+ const S = () => {
33
+ const e = i.scrollTop;
34
+ e !== R.current && (R.current = e, s());
34
35
  };
35
- return o.addEventListener("scroll", h, {
36
+ i.addEventListener("scroll", S, {
36
37
  passive: !0
37
- }), () => {
38
- window.removeEventListener("scroll", l), o.removeEventListener("scroll", h), e.current && clearTimeout(e.current);
38
+ });
39
+ let d, o = null;
40
+ return f && typeof ResizeObserver < "u" && (d = new ResizeObserver(() => {
41
+ o === null && (o = requestAnimationFrame(() => {
42
+ o = null;
43
+ const e = f.offsetHeight;
44
+ e !== u.current && (u.current = e, s());
45
+ }));
46
+ }), d.observe(f)), () => {
47
+ window.removeEventListener("scroll", s), i.removeEventListener("scroll", S), d?.disconnect(), o !== null && cancelAnimationFrame(o), t.current && clearTimeout(t.current);
39
48
  };
40
- }, [a, f, p, u, d]), v;
49
+ }, [y, h, m, a, v]), w;
41
50
  }
42
51
  export {
43
- w as useStickyHeader
52
+ H as useStickyHeader
44
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harpercollins/harpercollins-design-system",
3
- "version": "1.38.0",
3
+ "version": "1.38.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@ssh.dev.azure.com:v3/HarperCollinsUK/HCDesignSystem/HCDesignSystem"
@@ -42,7 +42,7 @@
42
42
  "@tanstack/react-virtual": "^3.13.12",
43
43
  "@types/react-datepicker": "^6.2.0",
44
44
  "@vitejs/plugin-react": "^4.2.1",
45
- "chromatic": "^15.2.0",
45
+ "chromatic": "^18.13.3",
46
46
  "date-fns": "^3.6.0",
47
47
  "focus-trap-react": "^10.2.3",
48
48
  "react": "^18.2.0",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@chromatic-com/storybook": "^4.1.3",
62
- "@playwright/test": "^1.55.0",
62
+ "@playwright/test": "^1.64.1",
63
63
  "@rollup/plugin-babel": "^6.0.3",
64
64
  "@rollup/plugin-commonjs": "^24.1.0",
65
65
  "@rollup/plugin-node-resolve": "^15.0.2",
@@ -93,7 +93,7 @@
93
93
  "eslint-plugin-react-refresh": "^0.4.6",
94
94
  "eslint-plugin-storybook": "^10.0.8",
95
95
  "happy-dom": "^14.3.8",
96
- "playwright": "^1.55.0",
96
+ "playwright": "^1.64.1",
97
97
  "prettier": "^3.2.5",
98
98
  "react-syntax-highlighter": "^15.5.0",
99
99
  "storybook": "^10.0.8",