@phillips/seldon 1.214.0-beta.3 → 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; //
|
|
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,12 +208,18 @@
|
|
|
208
208
|
--spacing-xl: 4rem;
|
|
209
209
|
--spacing-xxl: 5rem;
|
|
210
210
|
--spacing-xxxl: 6rem;
|
|
211
|
-
|
|
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;
|
|
218
|
+
|
|
219
|
+
// --header-height is set dynamically by Header component
|
|
220
|
+
|
|
221
|
+
// FONT SIZES
|
|
222
|
+
@include font-size-vars--lg;
|
|
217
223
|
}
|
|
218
224
|
|
|
219
225
|
@media (min-width: $breakpoint-xl) {
|
|
@@ -263,10 +269,7 @@
|
|
|
263
269
|
--spacing-xl: 4.25rem;
|
|
264
270
|
--spacing-xxl: 5.25rem;
|
|
265
271
|
--spacing-xxxl: 6.25rem;
|
|
266
|
-
--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
|
|
267
272
|
--search-size: 2.875rem; // This should be calculated from the scaling text and scaling spacing tokens instead of hardcoding in case they change
|
|
268
|
-
|
|
269
|
-
// FONT SIZES
|
|
270
|
-
@include font-size-vars--lg;
|
|
273
|
+
// --header-height is set dynamically by Header component
|
|
271
274
|
}
|
|
272
275
|
}
|
|
@@ -1,57 +1,76 @@
|
|
|
1
1
|
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import t, { createContext as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { SSRMediaQuery as
|
|
9
|
-
import { findChildrenOfType as
|
|
10
|
-
import { useMobileMenu as
|
|
11
|
-
import { defaultHeaderContext as
|
|
12
|
-
const
|
|
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:
|
|
15
|
-
logoHref:
|
|
16
|
-
className:
|
|
17
|
-
children:
|
|
18
|
-
toggleOpenText:
|
|
19
|
-
toggleCloseText:
|
|
20
|
-
logoText:
|
|
21
|
-
disabled:
|
|
22
|
-
bannerRef:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const e =
|
|
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
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
29
|
+
E(e.clientHeight);
|
|
30
|
+
const o = new window.ResizeObserver(() => {
|
|
31
|
+
E(e.clientHeight);
|
|
32
32
|
});
|
|
33
|
-
return
|
|
34
|
-
|
|
33
|
+
return o.observe(e), () => {
|
|
34
|
+
o.disconnect();
|
|
35
35
|
};
|
|
36
|
-
}, [
|
|
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
|
-
...
|
|
40
|
-
className:
|
|
41
|
-
ref:
|
|
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(
|
|
64
|
+
/* @__PURE__ */ r(J.Media, { greaterThanOrEqual: "md", children: v }),
|
|
46
65
|
/* @__PURE__ */ l(
|
|
47
66
|
"button",
|
|
48
67
|
{
|
|
49
|
-
"aria-label":
|
|
68
|
+
"aria-label": A,
|
|
50
69
|
"data-testid": "mobile-menu-toggle",
|
|
51
70
|
type: "button",
|
|
52
|
-
onClick:
|
|
53
|
-
className:
|
|
54
|
-
[`${n}-header__toggle-btn--open`]:
|
|
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:
|
|
63
|
-
|
|
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:
|
|
66
|
-
|
|
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:
|
|
70
|
-
setActiveSubmenuId:
|
|
71
|
-
closeTimeoutRef:
|
|
72
|
-
isMenuOpen:
|
|
73
|
-
isSearchExpanded:
|
|
74
|
-
setIsSearchExpanded:
|
|
75
|
-
closeMenu:
|
|
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
|
-
|
|
102
|
+
v
|
|
84
103
|
]
|
|
85
104
|
}) : e
|
|
86
105
|
),
|
|
87
|
-
|
|
106
|
+
j
|
|
88
107
|
]
|
|
89
108
|
}
|
|
90
109
|
) }),
|
|
91
110
|
/* @__PURE__ */ r(
|
|
92
111
|
"div",
|
|
93
112
|
{
|
|
94
|
-
className:
|
|
95
|
-
[`${n}-header__overlay--active`]:
|
|
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
|
-
|
|
123
|
+
Z.displayName = "Header";
|
|
105
124
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
125
|
+
Y as HeaderContext,
|
|
126
|
+
Z as default
|
|
108
127
|
};
|