@phillips/seldon 1.164.2 → 1.165.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/components/Navigation/Navigation.stories.d.ts +2 -1
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +4 -0
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +60 -49
- package/dist/scss/components/ExitGateCard/_exitGateCard.scss +1 -0
- package/dist/site-furniture/Header/Header.d.ts +12 -0
- package/dist/site-furniture/Header/Header.js +50 -47
- package/dist/site-furniture/Header/utils.js +6 -3
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
declare const meta: {
|
|
2
3
|
title: string;
|
|
3
|
-
component:
|
|
4
|
+
component: React.ForwardRefExoticComponent<Omit<import('./Navigation').NavigationProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
4
5
|
tags: string[];
|
|
5
6
|
parameters: {
|
|
6
7
|
docs: {
|
|
@@ -1,62 +1,73 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { SSRMediaQuery as
|
|
6
|
-
import { HeaderContext as
|
|
7
|
-
import { getCommonProps as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { AccordionItemVariant as
|
|
11
|
-
import { TextVariants as
|
|
1
|
+
import { jsx as o, Fragment as $, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import M from "../../../node_modules/classnames/index.js";
|
|
3
|
+
import t, { forwardRef as y, useEffect as E } from "react";
|
|
4
|
+
import O from "../../../node_modules/react-remove-scroll/dist/es2015/Combination.js";
|
|
5
|
+
import { SSRMediaQuery as v } from "../../../providers/SeldonProvider/utils.js";
|
|
6
|
+
import { HeaderContext as C } from "../../../site-furniture/Header/Header.js";
|
|
7
|
+
import { getCommonProps as w, findChildrenOfType as A, focusElementById as L, px as T } from "../../../utils/index.js";
|
|
8
|
+
import H from "../../Accordion/Accordion.js";
|
|
9
|
+
import P from "../../Accordion/AccordionItem.js";
|
|
10
|
+
import { AccordionItemVariant as j } from "../../Accordion/types.js";
|
|
11
|
+
import { TextVariants as b } from "../../Text/types.js";
|
|
12
12
|
import N from "../../Text/Text.js";
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const { isMenuOpen:
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
13
|
+
import B from "../NavigationList/NavigationList.js";
|
|
14
|
+
const V = ({ id: r, label: i, children: s }) => {
|
|
15
|
+
const { isMenuOpen: u } = t.useContext(C);
|
|
16
|
+
return /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(
|
|
17
|
+
P,
|
|
18
18
|
{
|
|
19
19
|
hasTransition: !0,
|
|
20
|
-
id: `accordion-item-${
|
|
21
|
-
label: /* @__PURE__ */
|
|
22
|
-
variant:
|
|
23
|
-
children:
|
|
20
|
+
id: `accordion-item-${r}`,
|
|
21
|
+
label: /* @__PURE__ */ o(N, { variant: b.snwHeaderLink, children: i }),
|
|
22
|
+
variant: j.lg,
|
|
23
|
+
children: s
|
|
24
24
|
},
|
|
25
|
-
`accordion-key-${
|
|
26
|
-
) }, `accordion-key-${
|
|
27
|
-
},
|
|
28
|
-
({ id:
|
|
29
|
-
const { className: m, ...
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
`accordion-key-${i}`
|
|
26
|
+
) }, `accordion-key-${i}-${u}`);
|
|
27
|
+
}, q = y(
|
|
28
|
+
({ id: r, label: i, children: s, className: u, onClick: x, ...k }, c) => {
|
|
29
|
+
const { className: m, ...f } = w({ id: r }, "NavigationItemTrigger"), e = A(s, B), {
|
|
30
|
+
closeMenu: g,
|
|
31
|
+
activeSubmenuId: R,
|
|
32
|
+
setActiveSubmenuId: l,
|
|
33
|
+
closeTimeoutRef: d
|
|
34
|
+
} = t.useContext(C), _ = t.useRef(null), n = d || _, p = R === r, I = t.useCallback(() => {
|
|
35
|
+
n.current && (clearTimeout(n.current), n.current = null), l?.(r || null), e && e[0]?.props?.id && L(e[0].props.id, !0);
|
|
36
|
+
const a = c && "current" in c ? c.current : null;
|
|
37
|
+
a && a.focus();
|
|
38
|
+
}, [e, c, r, l, n]), S = t.useCallback(() => {
|
|
39
|
+
n.current = setTimeout(() => {
|
|
40
|
+
l?.(null), n.current = null;
|
|
41
|
+
}, 200);
|
|
42
|
+
}, [l, n]);
|
|
43
|
+
return E(() => () => {
|
|
44
|
+
!d && n.current && clearTimeout(n.current);
|
|
45
|
+
}, [d, n]), /* @__PURE__ */ o($, { children: /* @__PURE__ */ h(O, { enabled: p, allowPinchZoom: !0, removeScrollBar: !1, children: [
|
|
46
|
+
/* @__PURE__ */ o(v.Media, { lessThan: "md", children: /* @__PURE__ */ o(V, { id: r, label: i, ...f, children: e ? t.cloneElement(e[0], {
|
|
36
47
|
className: `${m}__submenu--mobile`,
|
|
37
|
-
onClick: (
|
|
38
|
-
e[0].props?.onClick?.(
|
|
48
|
+
onClick: (a) => {
|
|
49
|
+
e[0].props?.onClick?.(a), l?.(null), g?.();
|
|
39
50
|
}
|
|
40
51
|
}) : null }) }),
|
|
41
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ o(v.Media, { greaterThanOrEqual: "md", children: /* @__PURE__ */ h(
|
|
42
53
|
"li",
|
|
43
54
|
{
|
|
44
|
-
...
|
|
45
|
-
ref:
|
|
46
|
-
"aria-expanded":
|
|
47
|
-
className:
|
|
48
|
-
[`${m}--hovered`]:
|
|
55
|
+
...f,
|
|
56
|
+
ref: c,
|
|
57
|
+
"aria-expanded": p,
|
|
58
|
+
className: M(u, m, `${T}-nav__item`, {
|
|
59
|
+
[`${m}--hovered`]: p
|
|
49
60
|
}),
|
|
50
|
-
onClick:
|
|
51
|
-
onMouseOver:
|
|
52
|
-
onMouseOut:
|
|
53
|
-
...
|
|
61
|
+
onClick: x,
|
|
62
|
+
onMouseOver: I,
|
|
63
|
+
onMouseOut: S,
|
|
64
|
+
...k,
|
|
54
65
|
children: [
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
e ?
|
|
66
|
+
/* @__PURE__ */ o("button", { className: `${T}-nav__item-trigger`, type: "button", children: /* @__PURE__ */ o(N, { variant: b.snwHeaderLink, children: i }) }),
|
|
67
|
+
e ? t.cloneElement(e[0], {
|
|
57
68
|
className: `${m}__submenu`,
|
|
58
|
-
onClick: (
|
|
59
|
-
e[0].props?.onClick?.(
|
|
69
|
+
onClick: (a) => {
|
|
70
|
+
e[0].props?.onClick?.(a), l?.(null), g?.();
|
|
60
71
|
}
|
|
61
72
|
}) : null
|
|
62
73
|
]
|
|
@@ -65,7 +76,7 @@ const A = ({ id: a, label: o, children: l }) => {
|
|
|
65
76
|
] }) });
|
|
66
77
|
}
|
|
67
78
|
);
|
|
68
|
-
|
|
79
|
+
q.displayName = "NavigationItemTrigger";
|
|
69
80
|
export {
|
|
70
|
-
|
|
81
|
+
q as default
|
|
71
82
|
};
|
|
@@ -42,6 +42,18 @@ export type HeaderContextType = {
|
|
|
42
42
|
* Close the mobile menu
|
|
43
43
|
* */
|
|
44
44
|
closeMenu?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Active submenu ID for navigation
|
|
47
|
+
*/
|
|
48
|
+
activeSubmenuId: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Set the active submenu ID
|
|
51
|
+
*/
|
|
52
|
+
setActiveSubmenuId: (id: string | null) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Reference to timeout for submenu closing
|
|
55
|
+
*/
|
|
56
|
+
closeTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>;
|
|
45
57
|
};
|
|
46
58
|
export declare const HeaderContext: React.Context<HeaderContextType>;
|
|
47
59
|
/**
|
|
@@ -1,85 +1,88 @@
|
|
|
1
|
-
import { jsxs as o, jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import e, { createContext as w, forwardRef as A, useState as g } from "react";
|
|
3
3
|
import l from "../../node_modules/classnames/index.js";
|
|
4
|
-
import { findChildrenOfType as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { defaultHeaderContext as
|
|
9
|
-
import { SSRMediaQuery as
|
|
10
|
-
import { useMobileMenu as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
4
|
+
import { findChildrenOfType as d, findChildrenExcludingTypes as L, px as a } from "../../utils/index.js";
|
|
5
|
+
import f from "../../patterns/UserManagement/UserManagement.js";
|
|
6
|
+
import _ from "../../patterns/LanguageSelector/LanguageSelector.js";
|
|
7
|
+
import v from "../../components/Navigation/Navigation.js";
|
|
8
|
+
import { defaultHeaderContext as k } from "./utils.js";
|
|
9
|
+
import { SSRMediaQuery as q } from "../../providers/SeldonProvider/utils.js";
|
|
10
|
+
import { useMobileMenu as Q } from "./hooks.js";
|
|
11
|
+
import U from "../../components/Icon/Icon.js";
|
|
12
|
+
const z = w(k), B = A(
|
|
13
13
|
({
|
|
14
|
-
logo: i = /* @__PURE__ */
|
|
14
|
+
logo: i = /* @__PURE__ */ t(U, { icon: "PhillipsLogo" }),
|
|
15
15
|
logoHref: E = "/",
|
|
16
|
-
className:
|
|
17
|
-
children:
|
|
18
|
-
toggleOpenText:
|
|
19
|
-
toggleCloseText:
|
|
20
|
-
logoText:
|
|
16
|
+
className: C,
|
|
17
|
+
children: n,
|
|
18
|
+
toggleOpenText: M = "Open Menu",
|
|
19
|
+
toggleCloseText: x = "Close Menu",
|
|
20
|
+
logoText: b = "Home Page",
|
|
21
21
|
disabled: m,
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
const c =
|
|
25
|
-
return /* @__PURE__ */ o("header", { ...
|
|
26
|
-
/* @__PURE__ */ o("div", { className: `${
|
|
27
|
-
/* @__PURE__ */
|
|
22
|
+
...S
|
|
23
|
+
}, y) => {
|
|
24
|
+
const c = d(n, f), $ = e.isValidElement(c?.[0]) ? e.cloneElement(c[0], { disabled: m }) : "", h = d(n, _), u = e.isValidElement(h?.[0]) ? e.cloneElement(h[0], { disabled: m }) : "", [p, N] = g(!1), T = d(n, v), H = L(n, [v, f, _]), { closeMenu: R, handleMenuToggle: I, isMenuOpen: s, toggleText: O } = Q({ toggleOpenText: M, toggleCloseText: x }), [P, j] = g(null), V = e.useRef(null);
|
|
25
|
+
return /* @__PURE__ */ o("header", { ...S, className: l(`${a}-header`, C), ref: y, children: [
|
|
26
|
+
/* @__PURE__ */ o("div", { className: `${a}-header__top-row`, children: [
|
|
27
|
+
/* @__PURE__ */ t(q.Media, { greaterThanOrEqual: "md", children: u }),
|
|
28
28
|
/* @__PURE__ */ o(
|
|
29
29
|
"button",
|
|
30
30
|
{
|
|
31
|
-
"aria-label":
|
|
31
|
+
"aria-label": O,
|
|
32
32
|
"data-testid": "mobile-menu-toggle",
|
|
33
33
|
type: "button",
|
|
34
|
-
onClick:
|
|
35
|
-
className: l(`${
|
|
36
|
-
[`${
|
|
34
|
+
onClick: I,
|
|
35
|
+
className: l(`${a}-header__toggle-btn`, {
|
|
36
|
+
[`${a}-header__toggle-btn--open`]: s
|
|
37
37
|
}),
|
|
38
38
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ t("span", {}),
|
|
40
40
|
" "
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
43
|
),
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
|
|
44
|
+
/* @__PURE__ */ t("h1", { "data-testid": "header-logo", className: `${a}-header__logo`, children: /* @__PURE__ */ t("a", { href: E, "aria-label": b, children: typeof i == "object" ? i : /* @__PURE__ */ t("img", { alt: "Phillips", "data-testid": "header-logo-img", src: i }) }) }),
|
|
45
|
+
$
|
|
46
46
|
] }),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
47
|
+
/* @__PURE__ */ t("div", { className: l(`${a}-header__nav`, { [`${a}-header__nav--closed`]: !s }), children: /* @__PURE__ */ o(
|
|
48
|
+
z.Provider,
|
|
49
49
|
{
|
|
50
50
|
value: {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
activeSubmenuId: P,
|
|
52
|
+
setActiveSubmenuId: j,
|
|
53
|
+
closeTimeoutRef: V,
|
|
54
|
+
isMenuOpen: s,
|
|
55
|
+
isSearchExpanded: p,
|
|
53
56
|
setIsSearchExpanded: N,
|
|
54
|
-
closeMenu:
|
|
57
|
+
closeMenu: R
|
|
55
58
|
},
|
|
56
59
|
children: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(
|
|
60
|
+
e.Children.map(
|
|
61
|
+
T,
|
|
62
|
+
(r) => e.isValidElement(r) ? e.cloneElement(r, {
|
|
60
63
|
children: [
|
|
61
|
-
...
|
|
62
|
-
|
|
64
|
+
...e.Children.toArray(r.props.children),
|
|
65
|
+
u
|
|
63
66
|
]
|
|
64
|
-
}) :
|
|
67
|
+
}) : r
|
|
65
68
|
),
|
|
66
69
|
H
|
|
67
70
|
]
|
|
68
71
|
}
|
|
69
72
|
) }),
|
|
70
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ t(
|
|
71
74
|
"div",
|
|
72
75
|
{
|
|
73
|
-
className: l(`${
|
|
74
|
-
[`${
|
|
76
|
+
className: l(`${a}-header__overlay`, {
|
|
77
|
+
[`${a}-header__overlay--active`]: p
|
|
75
78
|
})
|
|
76
79
|
}
|
|
77
80
|
)
|
|
78
81
|
] });
|
|
79
82
|
}
|
|
80
83
|
);
|
|
81
|
-
|
|
84
|
+
B.displayName = "Header";
|
|
82
85
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
z as HeaderContext,
|
|
87
|
+
B as default
|
|
85
88
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { noOp as e } from "../../utils/index.js";
|
|
2
|
-
const
|
|
2
|
+
const t = {
|
|
3
3
|
isMenuOpen: !1,
|
|
4
4
|
isSearchExpanded: !1,
|
|
5
5
|
setIsSearchExpanded: e,
|
|
6
|
-
closeMenu: e
|
|
6
|
+
closeMenu: e,
|
|
7
|
+
activeSubmenuId: null,
|
|
8
|
+
setActiveSubmenuId: e,
|
|
9
|
+
closeTimeoutRef: { current: null }
|
|
7
10
|
};
|
|
8
11
|
export {
|
|
9
|
-
|
|
12
|
+
t as defaultHeaderContext
|
|
10
13
|
};
|