@phillips/seldon 1.214.0-beta.4 → 1.214.0-beta.5

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.
@@ -148,7 +148,7 @@
148
148
  --spacing-xl: 3.75rem;
149
149
  --spacing-xxl: 4.75rem;
150
150
  --spacing-xxxl: 5.75rem;
151
- --header-height: 56px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
151
+ --header-height: 56px; // Set dynamically by Header component on mount
152
152
  --search-size: 2.32rem; // This should be calculated from the scaling text and scaling spacing tokens instead of hardcoding in case they change
153
153
  --banner-height: 0px;
154
154
 
@@ -208,13 +208,15 @@
208
208
  --spacing-xl: 4rem;
209
209
  --spacing-xxl: 5rem;
210
210
  --spacing-xxxl: 6rem;
211
- --header-height: 121px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
211
+
212
+ // --header-height is set dynamically by Header component
212
213
  }
213
214
 
214
215
  @media (min-width: $breakpoint-lg) {
215
216
  --snw-flyout-link-size: 0.875rem;
216
217
  --snw-flyout-link-line-height: 1.75rem;
217
- --header-height: 124px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
218
+
219
+ // --header-height is set dynamically by Header component
218
220
 
219
221
  // FONT SIZES
220
222
  @include font-size-vars--lg;
@@ -268,6 +270,6 @@
268
270
  --spacing-xxl: 5.25rem;
269
271
  --spacing-xxxl: 6.25rem;
270
272
  --search-size: 2.875rem; // This should be calculated from the scaling text and scaling spacing tokens instead of hardcoding in case they change
271
- --header-height: 132px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
273
+ // --header-height is set dynamically by Header component
272
274
  }
273
275
  }
@@ -38,7 +38,7 @@
38
38
  }
39
39
 
40
40
  @include media($breakpoint-xl) {
41
- top: -4px;
41
+ top: -5px;
42
42
  }
43
43
 
44
44
  &--active {
@@ -1,57 +1,76 @@
1
1
  import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import i from "../../node_modules/classnames/index.js";
3
- import t, { createContext as k, forwardRef as q, useState as c, useEffect as B } from "react";
4
- import Q from "../../components/Icon/Icon.js";
5
- import b from "../../components/Navigation/Navigation.js";
6
- import x from "../../patterns/LanguageSelector/LanguageSelector.js";
7
- import C from "../../patterns/UserManagement/UserManagement.js";
8
- import { SSRMediaQuery as U } from "../../providers/SeldonProvider/utils.js";
9
- import { findChildrenOfType as m, findChildrenExcludingTypes as D, px as n } from "../../utils/index.js";
10
- import { useMobileMenu as F } from "./hooks.js";
11
- import { defaultHeaderContext as G } from "./utils.js";
12
- const J = k(G), K = q(
2
+ import c from "../../node_modules/classnames/index.js";
3
+ import t, { createContext as D, forwardRef as F, useState as u, useEffect as C } from "react";
4
+ import G from "../../components/Icon/Icon.js";
5
+ import H from "../../components/Navigation/Navigation.js";
6
+ import M from "../../patterns/LanguageSelector/LanguageSelector.js";
7
+ import $ from "../../patterns/UserManagement/UserManagement.js";
8
+ import { SSRMediaQuery as J } from "../../providers/SeldonProvider/utils.js";
9
+ import { findChildrenOfType as h, findChildrenExcludingTypes as K, px as n } from "../../utils/index.js";
10
+ import { useMobileMenu as W } from "./hooks.js";
11
+ import { defaultHeaderContext as X } from "./utils.js";
12
+ const Y = D(X), Z = F(
13
13
  ({
14
- logo: s = /* @__PURE__ */ r(Q, { icon: "PhillipsLogo" }),
15
- logoHref: M = "/",
16
- className: y,
17
- children: a,
18
- toggleOpenText: H = "Open Menu",
19
- toggleCloseText: S = "Close Menu",
20
- logoText: $ = "Home Page",
21
- disabled: h,
22
- bannerRef: o,
23
- ...N
24
- }, O) => {
25
- const u = m(a, C), T = t.isValidElement(u?.[0]) ? t.cloneElement(u[0], { disabled: h }) : "", g = m(a, x), p = t.isValidElement(g?.[0]) ? t.cloneElement(g[0], { disabled: h }) : "", [f, w] = c(!1), I = m(a, b), P = D(a, [b, C, x]), { closeMenu: j, handleMenuToggle: R, isMenuOpen: d, toggleText: V } = F({ toggleOpenText: H, toggleCloseText: S }), [z, A] = c(null), L = t.useRef(null), [_, v] = c(o?.current ? o.current.clientHeight : 0);
26
- return B(() => {
27
- const e = o?.current;
14
+ logo: d = /* @__PURE__ */ r(G, { icon: "PhillipsLogo" }),
15
+ logoHref: S = "/",
16
+ className: w,
17
+ children: i,
18
+ toggleOpenText: N = "Open Menu",
19
+ toggleCloseText: O = "Close Menu",
20
+ logoText: R = "Home Page",
21
+ disabled: g,
22
+ bannerRef: s,
23
+ ...T
24
+ }, a) => {
25
+ const p = h(i, $), P = t.isValidElement(p?.[0]) ? t.cloneElement(p[0], { disabled: g }) : "", f = h(i, M), v = t.isValidElement(f?.[0]) ? t.cloneElement(f[0], { disabled: g }) : "", [b, z] = u(!1), I = h(i, H), j = K(i, [H, $, M]), { closeMenu: V, handleMenuToggle: k, isMenuOpen: m, toggleText: A } = W({ toggleOpenText: N, toggleCloseText: O }), [L, q] = u(null), B = t.useRef(null), [_, E] = u(s?.current ? s.current.clientHeight : 0), x = t.useRef(null);
26
+ C(() => {
27
+ const e = s?.current;
28
28
  if (!e) return;
29
- v(e.clientHeight);
30
- const E = new window.ResizeObserver(() => {
31
- v(e.clientHeight);
29
+ E(e.clientHeight);
30
+ const o = new window.ResizeObserver(() => {
31
+ E(e.clientHeight);
32
32
  });
33
- return E.observe(e), () => {
34
- E.disconnect();
33
+ return o.observe(e), () => {
34
+ o.disconnect();
35
35
  };
36
- }, [o, _]), /* @__PURE__ */ l(
36
+ }, [s, _]), C(() => {
37
+ const e = x.current;
38
+ if (!e) return;
39
+ const o = () => {
40
+ const U = e.offsetHeight;
41
+ document.documentElement.style.setProperty("--header-height", `${U}px`);
42
+ };
43
+ o();
44
+ const y = new window.ResizeObserver(o);
45
+ return y.observe(e), () => {
46
+ y.disconnect();
47
+ };
48
+ }, []);
49
+ const Q = t.useCallback(
50
+ (e) => {
51
+ x.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
52
+ },
53
+ [a]
54
+ );
55
+ return /* @__PURE__ */ l(
37
56
  "header",
38
57
  {
39
- ...N,
40
- className: i(`${n}-header`, y),
41
- ref: O,
58
+ ...T,
59
+ className: c(`${n}-header`, w),
60
+ ref: Q,
42
61
  style: { "--banner-height": `${_}px` },
43
62
  children: [
44
63
  /* @__PURE__ */ l("div", { className: `${n}-header__top-row`, children: [
45
- /* @__PURE__ */ r(U.Media, { greaterThanOrEqual: "md", children: p }),
64
+ /* @__PURE__ */ r(J.Media, { greaterThanOrEqual: "md", children: v }),
46
65
  /* @__PURE__ */ l(
47
66
  "button",
48
67
  {
49
- "aria-label": V,
68
+ "aria-label": A,
50
69
  "data-testid": "mobile-menu-toggle",
51
70
  type: "button",
52
- onClick: R,
53
- className: i(`${n}-header__toggle-btn`, {
54
- [`${n}-header__toggle-btn--open`]: d
71
+ onClick: k,
72
+ className: c(`${n}-header__toggle-btn`, {
73
+ [`${n}-header__toggle-btn--open`]: m
55
74
  }),
56
75
  children: [
57
76
  /* @__PURE__ */ r("span", {}),
@@ -59,20 +78,20 @@ const J = k(G), K = q(
59
78
  ]
60
79
  }
61
80
  ),
62
- /* @__PURE__ */ r("h1", { "data-testid": "header-logo", className: `${n}-header__logo`, children: /* @__PURE__ */ r("a", { href: M, "aria-label": $, children: typeof s == "object" ? s : /* @__PURE__ */ r("img", { alt: "Phillips", "data-testid": "header-logo-img", src: s }) }) }),
63
- T
81
+ /* @__PURE__ */ r("h1", { "data-testid": "header-logo", className: `${n}-header__logo`, children: /* @__PURE__ */ r("a", { href: S, "aria-label": R, children: typeof d == "object" ? d : /* @__PURE__ */ r("img", { alt: "Phillips", "data-testid": "header-logo-img", src: d }) }) }),
82
+ P
64
83
  ] }),
65
- /* @__PURE__ */ r("div", { className: i(`${n}-header__nav`, { [`${n}-header__nav--closed`]: !d }), children: /* @__PURE__ */ l(
66
- J.Provider,
84
+ /* @__PURE__ */ r("div", { className: c(`${n}-header__nav`, { [`${n}-header__nav--closed`]: !m }), children: /* @__PURE__ */ l(
85
+ Y.Provider,
67
86
  {
68
87
  value: {
69
- activeSubmenuId: z,
70
- setActiveSubmenuId: A,
71
- closeTimeoutRef: L,
72
- isMenuOpen: d,
73
- isSearchExpanded: f,
74
- setIsSearchExpanded: w,
75
- closeMenu: j
88
+ activeSubmenuId: L,
89
+ setActiveSubmenuId: q,
90
+ closeTimeoutRef: B,
91
+ isMenuOpen: m,
92
+ isSearchExpanded: b,
93
+ setIsSearchExpanded: z,
94
+ closeMenu: V
76
95
  },
77
96
  children: [
78
97
  t.Children.map(
@@ -80,19 +99,19 @@ const J = k(G), K = q(
80
99
  (e) => t.isValidElement(e) ? t.cloneElement(e, {
81
100
  children: [
82
101
  ...t.Children.toArray(e.props.children),
83
- p
102
+ v
84
103
  ]
85
104
  }) : e
86
105
  ),
87
- P
106
+ j
88
107
  ]
89
108
  }
90
109
  ) }),
91
110
  /* @__PURE__ */ r(
92
111
  "div",
93
112
  {
94
- className: i(`${n}-header__overlay`, {
95
- [`${n}-header__overlay--active`]: f
113
+ className: c(`${n}-header__overlay`, {
114
+ [`${n}-header__overlay--active`]: b
96
115
  })
97
116
  }
98
117
  )
@@ -101,8 +120,8 @@ const J = k(G), K = q(
101
120
  );
102
121
  }
103
122
  );
104
- K.displayName = "Header";
123
+ Z.displayName = "Header";
105
124
  export {
106
- J as HeaderContext,
107
- K as default
125
+ Y as HeaderContext,
126
+ Z as default
108
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.214.0-beta.4",
3
+ "version": "1.214.0-beta.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"