@phillips/seldon 1.51.1 → 1.52.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/assets/account_circle.svg.js +2 -2
- package/dist/components/Accordion/AccordionItem.d.ts +8 -4
- package/dist/components/Accordion/AccordionItem.js +67 -65
- package/dist/components/Dropdown/Dropdown.d.ts +2 -2
- package/dist/components/Header/Header.d.ts +20 -13
- package/dist/components/Header/Header.js +73 -76
- package/dist/components/Header/utils.d.ts +2 -9
- package/dist/components/Header/utils.js +3 -7
- package/dist/components/LanguageSelector/LanguageSelector.d.ts +36 -0
- package/dist/components/LanguageSelector/LanguageSelector.js +73 -0
- package/dist/components/LanguageSelector/index.d.ts +1 -0
- package/dist/components/Link/Link.d.ts +3 -11
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Navigation/Navigation.d.ts +12 -4
- package/dist/components/Navigation/Navigation.js +34 -51
- package/dist/components/Navigation/NavigationItem/NavigationItem.d.ts +15 -10
- package/dist/components/Navigation/NavigationItem/NavigationItem.js +19 -37
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +12 -3
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +33 -29
- package/dist/components/Navigation/NavigationList/NavigationList.d.ts +2 -2
- package/dist/components/Navigation/NavigationList/NavigationList.js +31 -32
- package/dist/components/Search/Search.d.ts +1 -1
- package/dist/components/Search/Search.js +134 -122
- package/dist/components/Search/SearchButton.js +21 -17
- package/dist/components/Search/SearchResults/SearchResults.js +14 -13
- package/dist/components/UserManagement/UserManagement.d.ts +21 -13
- package/dist/components/UserManagement/UserManagement.js +31 -61
- package/dist/index.d.ts +1 -0
- package/dist/index.js +65 -62
- package/dist/scss/_utils.scss +13 -3
- package/dist/scss/_vars.scss +30 -11
- package/dist/scss/componentStyles.scss +1 -0
- package/dist/scss/components/Accordion/_accordion.scss +3 -0
- package/dist/scss/components/Dropdown/_dropdown.scss +2 -0
- package/dist/scss/components/Header/_header.scss +72 -86
- package/dist/scss/components/LanguageSelector/_languageSelector.scss +47 -0
- package/dist/scss/components/Link/_link.scss +15 -4
- package/dist/scss/components/LinkList/_linkList.scss +4 -0
- package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +4 -119
- package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +75 -0
- package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +29 -42
- package/dist/scss/components/Navigation/_navigation.scss +24 -82
- package/dist/scss/components/Search/SearchResults/_searchResults.scss +1 -25
- package/dist/scss/components/Search/_search.scss +48 -7
- package/dist/scss/components/Search/_searchButton.scss +6 -2
- package/dist/scss/components/UserManagement/_userManagement.scss +33 -94
- package/dist/scss/components/Video/_video.scss +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +31 -24
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
const
|
|
2
|
+
const t = (l) => /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...l }, /* @__PURE__ */ e.createElement("g", { clipPath: "url(#clip0_11553_447)" }, /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10.5 5.5C10.5 6.88071 9.38071 8 8 8C6.61929 8 5.5 6.88071 5.5 5.5C5.5 4.11929 6.61929 3 8 3C9.38071 3 10.5 4.11929 10.5 5.5ZM9.5 5.5C9.5 6.32843 8.82843 7 8 7C7.17157 7 6.5 6.32843 6.5 5.5C6.5 4.67157 7.17157 4 8 4C8.82843 4 9.5 4.67157 9.5 5.5Z", fill: "black" }), /* @__PURE__ */ e.createElement("path", { d: "M5.375 10C4.75 10 4.5 10.75 4.5 11.0769V12.5C4.5 12.75 4.25 13 4 13C3.75 13 3.5 12.75 3.5 12.5V11.0769C3.5 10.0148 4.33947 9 5.375 9H10.625C11.6605 9 12.5 10.0148 12.5 11.0769V12.5C12.5 12.75 12.25 13 12 13C11.75 13 11.5 12.75 11.5 12.5V11.0769C11.5 10.75 11.2463 10 10.625 10H5.375Z", fill: "black" })), /* @__PURE__ */ e.createElement("defs", null, /* @__PURE__ */ e.createElement("clipPath", { id: "clip0_11553_447" }, /* @__PURE__ */ e.createElement("rect", { width: 16, height: 16, fill: "white" }))));
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
t as default
|
|
5
5
|
};
|
|
@@ -7,15 +7,19 @@ export interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
7
7
|
/**
|
|
8
8
|
* When true, prevents the user from interacting with the item.
|
|
9
9
|
*/
|
|
10
|
-
isLocked
|
|
10
|
+
isLocked?: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Determines whether the variation on text style is large or small.
|
|
13
13
|
*/
|
|
14
14
|
variation: string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Uniqueid for the Accordion Item.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
id: string;
|
|
19
|
+
/**
|
|
20
|
+
* Accordion item label.
|
|
21
|
+
*/
|
|
22
|
+
label: React.ReactNode;
|
|
19
23
|
/**
|
|
20
24
|
* Child element pass in to display as item content.
|
|
21
25
|
*/
|
|
@@ -25,5 +29,5 @@ export interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
25
29
|
*/
|
|
26
30
|
hasTransition?: boolean;
|
|
27
31
|
}
|
|
28
|
-
declare const AccordionItem: ({ isLocked, variation, label, isLastItem, hasTransition, children, ...props }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
declare const AccordionItem: ({ isLocked, variation, id, label, isLastItem, hasTransition, children, ...props }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
33
|
export default AccordionItem;
|
|
@@ -1,108 +1,110 @@
|
|
|
1
|
-
import { jsxs as g, jsx as
|
|
1
|
+
import { jsxs as g, jsx as o, Fragment as h } from "react/jsx-runtime";
|
|
2
2
|
import { getCommonProps as $ } from "../../utils/index.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import f from "../../assets/plus.svg.js";
|
|
4
|
+
import v from "../../assets/minus.svg.js";
|
|
5
5
|
import I from "../../assets/lock.svg.js";
|
|
6
|
-
import
|
|
7
|
-
import { Item as _, Trigger as C, Content as
|
|
8
|
-
import { getIconClasses as
|
|
9
|
-
const
|
|
6
|
+
import d from "../../node_modules/classnames/index.js";
|
|
7
|
+
import { Item as _, Trigger as C, Content as x } from "../../node_modules/@radix-ui/react-accordion/dist/index.js";
|
|
8
|
+
import { getIconClasses as p } from "./utils.js";
|
|
9
|
+
const N = ({
|
|
10
10
|
children: n,
|
|
11
|
-
className:
|
|
12
|
-
baseClassName:
|
|
13
|
-
disable:
|
|
11
|
+
className: s,
|
|
12
|
+
baseClassName: t,
|
|
13
|
+
disable: c,
|
|
14
14
|
isLargeVariation: e,
|
|
15
|
-
id:
|
|
15
|
+
id: r
|
|
16
16
|
}) => {
|
|
17
|
-
const
|
|
17
|
+
const a = c, l = /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
18
18
|
I,
|
|
19
19
|
{
|
|
20
|
-
className:
|
|
21
|
-
"data-testid": `${
|
|
20
|
+
className: p(t, e, "lock"),
|
|
21
|
+
"data-testid": `${r}-lockedIcon`,
|
|
22
22
|
"aria-hidden": !0
|
|
23
23
|
}
|
|
24
|
-
) }),
|
|
25
|
-
|
|
24
|
+
) }), u = /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
25
|
+
f,
|
|
26
26
|
{
|
|
27
|
-
className:
|
|
28
|
-
"data-testid": `${
|
|
27
|
+
className: p(t, e, "plus"),
|
|
28
|
+
"data-testid": `${r}-plusIcon`,
|
|
29
29
|
"aria-hidden": !0
|
|
30
30
|
}
|
|
31
|
-
) }),
|
|
32
|
-
|
|
31
|
+
) }), i = /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
32
|
+
v,
|
|
33
33
|
{
|
|
34
|
-
className:
|
|
35
|
-
"data-testid": `${
|
|
34
|
+
className: p(t, e, "minus"),
|
|
35
|
+
"data-testid": `${r}-minusIcon`,
|
|
36
36
|
"aria-hidden": !0
|
|
37
37
|
}
|
|
38
38
|
) });
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ o(
|
|
40
40
|
C,
|
|
41
41
|
{
|
|
42
|
-
"data-disabled":
|
|
42
|
+
"data-disabled": c,
|
|
43
43
|
asChild: !0,
|
|
44
|
-
className:
|
|
45
|
-
children: /* @__PURE__ */ g("div", { "data-testid": `${
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
!
|
|
49
|
-
!
|
|
44
|
+
className: d(t, { [`${t}--hoverable`]: !c }, s),
|
|
45
|
+
children: /* @__PURE__ */ g("div", { "data-testid": `${r}-trigger`, children: [
|
|
46
|
+
/* @__PURE__ */ o("div", { className: d(`${t}__text`, { [`${t}__text--lg`]: e }), children: n }),
|
|
47
|
+
a && l,
|
|
48
|
+
!a && u,
|
|
49
|
+
!a && i
|
|
50
50
|
] })
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
},
|
|
53
|
+
}, A = ({
|
|
54
54
|
children: n,
|
|
55
|
-
baseClassName:
|
|
56
|
-
disable:
|
|
57
|
-
hasTransition:
|
|
55
|
+
baseClassName: s,
|
|
56
|
+
disable: t,
|
|
57
|
+
hasTransition: c,
|
|
58
58
|
isLargeVariation: e,
|
|
59
|
-
className:
|
|
60
|
-
}) => /* @__PURE__ */
|
|
61
|
-
|
|
59
|
+
className: r
|
|
60
|
+
}) => /* @__PURE__ */ o(h, { children: t && n ? /* @__PURE__ */ o("div", { children: n }) : /* @__PURE__ */ o(
|
|
61
|
+
x,
|
|
62
62
|
{
|
|
63
63
|
asChild: !0,
|
|
64
|
-
className:
|
|
65
|
-
{ [`${
|
|
66
|
-
{ [`${
|
|
67
|
-
|
|
64
|
+
className: d(
|
|
65
|
+
{ [`${s}__content--lg`]: e },
|
|
66
|
+
{ [`${s}--transition`]: c },
|
|
67
|
+
r
|
|
68
68
|
),
|
|
69
69
|
children: n
|
|
70
70
|
}
|
|
71
|
-
) }),
|
|
72
|
-
isLocked: n,
|
|
73
|
-
variation:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
) }), H = ({
|
|
72
|
+
isLocked: n = !1,
|
|
73
|
+
variation: s,
|
|
74
|
+
id: t,
|
|
75
|
+
label: c,
|
|
76
|
+
isLastItem: e,
|
|
77
|
+
hasTransition: r = !1,
|
|
78
|
+
children: a,
|
|
79
|
+
...l
|
|
79
80
|
}) => {
|
|
80
|
-
const { className:
|
|
81
|
+
const { className: u } = $({ id: t }, "Accordion"), i = s === "lg", m = `${u}-item`;
|
|
81
82
|
return /* @__PURE__ */ g(
|
|
82
83
|
_,
|
|
83
84
|
{
|
|
84
85
|
disabled: n,
|
|
85
|
-
value:
|
|
86
|
-
className:
|
|
86
|
+
value: t,
|
|
87
|
+
className: d(m, { [`${m}__border-bottom`]: !e }),
|
|
88
|
+
...l,
|
|
87
89
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
90
|
+
/* @__PURE__ */ o(
|
|
91
|
+
N,
|
|
90
92
|
{
|
|
91
93
|
disable: n,
|
|
92
|
-
isLargeVariation:
|
|
93
|
-
id:
|
|
94
|
-
baseClassName: `${
|
|
95
|
-
children:
|
|
94
|
+
isLargeVariation: i,
|
|
95
|
+
id: t,
|
|
96
|
+
baseClassName: `${m}-label`,
|
|
97
|
+
children: c
|
|
96
98
|
}
|
|
97
99
|
),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
|
|
100
|
+
/* @__PURE__ */ o(
|
|
101
|
+
A,
|
|
100
102
|
{
|
|
101
103
|
disable: n,
|
|
102
|
-
hasTransition:
|
|
103
|
-
isLargeVariation:
|
|
104
|
-
baseClassName:
|
|
105
|
-
children:
|
|
104
|
+
hasTransition: r,
|
|
105
|
+
isLargeVariation: i,
|
|
106
|
+
baseClassName: m,
|
|
107
|
+
children: a
|
|
106
108
|
}
|
|
107
109
|
)
|
|
108
110
|
]
|
|
@@ -110,5 +112,5 @@ const x = ({
|
|
|
110
112
|
);
|
|
111
113
|
};
|
|
112
114
|
export {
|
|
113
|
-
|
|
115
|
+
H as default
|
|
114
116
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import * as DropdownSelect from '@radix-ui/react-select';
|
|
3
3
|
import { DropdownItem } from './types';
|
|
4
|
-
export interface DropdownProps extends Omit<DropdownSelect.SelectProps, 'defaultValue' | 'dir'>,
|
|
4
|
+
export interface DropdownProps extends Omit<DropdownSelect.SelectProps, 'defaultValue' | 'dir'>, ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* All options to be listed in the dropdown
|
|
7
7
|
*/
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Default mobile menu label
|
|
5
|
-
*/
|
|
6
|
-
defaultMobileMenuLabel?: string;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Component, ComponentProps, ReactElement } from 'react';
|
|
3
|
+
export interface HeaderProps extends ComponentProps<'header'> {
|
|
7
4
|
/**
|
|
8
5
|
* Logo src
|
|
9
6
|
*/
|
|
10
|
-
logo?:
|
|
7
|
+
logo?: ReactElement<Component> | string;
|
|
11
8
|
/**
|
|
12
9
|
* Toggle open text
|
|
13
10
|
*/
|
|
@@ -22,11 +19,10 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
22
19
|
logoText?: string;
|
|
23
20
|
}
|
|
24
21
|
export type HeaderContextType = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onSelect: (label: string) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Used for mobile navigation menu hiding and showing
|
|
24
|
+
*/
|
|
25
|
+
isMenuOpen: boolean;
|
|
30
26
|
/**
|
|
31
27
|
* Is the user within the search input and searching
|
|
32
28
|
*/
|
|
@@ -37,5 +33,16 @@ export type HeaderContextType = {
|
|
|
37
33
|
setIsSearchExpanded: React.Dispatch<React.SetStateAction<boolean>>;
|
|
38
34
|
};
|
|
39
35
|
export declare const HeaderContext: React.Context<HeaderContextType>;
|
|
40
|
-
|
|
36
|
+
/**
|
|
37
|
+
* ## Overview
|
|
38
|
+
*
|
|
39
|
+
* This component allows navigation, search, login/logout, and language selection and supports desktop and mobile layouts
|
|
40
|
+
*
|
|
41
|
+
* [Figma Link Mobile](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10877-33417&node-type=INSTANCE&m=dev)
|
|
42
|
+
*
|
|
43
|
+
* [Figma Link Desktop](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-6295&node-type=FRAME&m=dev)
|
|
44
|
+
*
|
|
45
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-header--overview)
|
|
46
|
+
*/
|
|
47
|
+
declare const Header: React.ForwardRefExoticComponent<Omit<HeaderProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
41
48
|
export default Header;
|
|
@@ -1,79 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import l, { createContext as O, forwardRef as P, useState as h } from "react";
|
|
2
3
|
import s from "../../node_modules/classnames/index.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
] });
|
|
75
|
-
};
|
|
4
|
+
import { findChildrenOfType as i, findChildrenExcludingTypes as T, px as e } from "../../utils/index.js";
|
|
5
|
+
import j from "../../assets/PhillipsLogo.svg.js";
|
|
6
|
+
import p from "../UserManagement/UserManagement.js";
|
|
7
|
+
import g from "../LanguageSelector/LanguageSelector.js";
|
|
8
|
+
import f from "../Navigation/Navigation.js";
|
|
9
|
+
import { defaultHeaderContext as w } from "./utils.js";
|
|
10
|
+
const I = O(w), L = P(
|
|
11
|
+
({
|
|
12
|
+
logo: d = /* @__PURE__ */ a(j, {}),
|
|
13
|
+
className: u,
|
|
14
|
+
children: r,
|
|
15
|
+
toggleOpenText: _ = "Open Menu",
|
|
16
|
+
toggleCloseText: v = "Close Menu",
|
|
17
|
+
logoText: x = "Home Page",
|
|
18
|
+
...C
|
|
19
|
+
}, $) => {
|
|
20
|
+
const b = i(r, p), m = i(r, g), [c, y] = h(!1), E = i(r, f), N = T(r, [f, p, g]), [n, M] = h(!1), S = n ? v : _, H = function() {
|
|
21
|
+
M((t) => !t);
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ o("header", { ...C, className: s(`${e}-header`, u), ref: $, children: [
|
|
24
|
+
/* @__PURE__ */ o("div", { className: `${e}-header__top-row`, children: [
|
|
25
|
+
m,
|
|
26
|
+
" ",
|
|
27
|
+
/* @__PURE__ */ o(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
"aria-label": S,
|
|
31
|
+
"data-testid": "mobile-menu-toggle",
|
|
32
|
+
type: "button",
|
|
33
|
+
onClick: H,
|
|
34
|
+
className: s(`${e}-header__toggle-btn`, {
|
|
35
|
+
[`${e}-header__toggle-btn--open`]: n
|
|
36
|
+
}),
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ a("span", {}),
|
|
39
|
+
" "
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ a("h1", { "data-testid": "header-logo", className: `${e}-header__logo`, children: /* @__PURE__ */ a("a", { href: "/", "aria-label": x, children: typeof d == "object" ? d : /* @__PURE__ */ a("img", { alt: "Phillips", "data-testid": "header-logo-img", src: d, height: "14" }) }) }),
|
|
44
|
+
b
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ a("div", { className: s(`${e}-header__nav`, { [`${e}-header__nav--closed`]: !n }), children: /* @__PURE__ */ o(
|
|
47
|
+
I.Provider,
|
|
48
|
+
{
|
|
49
|
+
value: {
|
|
50
|
+
isMenuOpen: n,
|
|
51
|
+
isSearchExpanded: c,
|
|
52
|
+
setIsSearchExpanded: y
|
|
53
|
+
},
|
|
54
|
+
children: [
|
|
55
|
+
l.Children.map(
|
|
56
|
+
E,
|
|
57
|
+
(t) => l.isValidElement(t) ? l.cloneElement(t, {
|
|
58
|
+
children: [
|
|
59
|
+
...l.Children.toArray(t.props.children),
|
|
60
|
+
m
|
|
61
|
+
]
|
|
62
|
+
}) : t
|
|
63
|
+
),
|
|
64
|
+
N
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
) }),
|
|
68
|
+
/* @__PURE__ */ a("div", { className: s(`${e}-header__overlay`, { [`${e}-header__overlay--active`]: c }) })
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
L.displayName = "Header";
|
|
76
73
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
I as HeaderContext,
|
|
75
|
+
L as default
|
|
79
76
|
};
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
expandedItem: string;
|
|
4
|
-
setExpandedItem: () => void;
|
|
5
|
-
isExpanded: boolean;
|
|
6
|
-
onSelect: () => void;
|
|
7
|
-
isSearchExpanded: boolean;
|
|
8
|
-
setIsSearchExpanded: () => void;
|
|
9
|
-
};
|
|
1
|
+
import { HeaderContextType } from './Header';
|
|
2
|
+
export declare const defaultHeaderContext: HeaderContextType;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { noOp as e } from "../../utils/index.js";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
expandedItem: "",
|
|
5
|
-
setExpandedItem: e,
|
|
6
|
-
isExpanded: !1,
|
|
7
|
-
onSelect: e,
|
|
2
|
+
const n = {
|
|
3
|
+
isMenuOpen: !1,
|
|
8
4
|
isSearchExpanded: !1,
|
|
9
5
|
setIsSearchExpanded: e
|
|
10
6
|
};
|
|
11
7
|
export {
|
|
12
|
-
|
|
8
|
+
n as defaultHeaderContext
|
|
13
9
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { SupportedLanguages } from '../../types/commonTypes';
|
|
3
|
+
export type LanguageOption = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: SupportedLanguages;
|
|
6
|
+
};
|
|
7
|
+
export interface LanguageSelectorProps extends ComponentProps<'div'> {
|
|
8
|
+
/**
|
|
9
|
+
* Available language options to select from
|
|
10
|
+
*/
|
|
11
|
+
languageOptions?: LanguageOption[];
|
|
12
|
+
/**
|
|
13
|
+
* The currently selected language, shows in the input
|
|
14
|
+
*/
|
|
15
|
+
currentLanguage?: SupportedLanguages;
|
|
16
|
+
/**
|
|
17
|
+
* Called when the language is changed in the dropdown
|
|
18
|
+
* @param language
|
|
19
|
+
*/
|
|
20
|
+
onLanguageChange?: (language: SupportedLanguages) => void;
|
|
21
|
+
/**
|
|
22
|
+
* hide or show with an opacity transition
|
|
23
|
+
*/
|
|
24
|
+
isHidden?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* ## Overview
|
|
28
|
+
*
|
|
29
|
+
* This is used in the Header component to allow users to change the language of the site. It is a controlled component.
|
|
30
|
+
*
|
|
31
|
+
* [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-6295&m=dev)
|
|
32
|
+
*
|
|
33
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-languageselector--overview)
|
|
34
|
+
*/
|
|
35
|
+
declare const LanguageSelector: import("react").ForwardRefExoticComponent<Omit<LanguageSelectorProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
36
|
+
export default LanguageSelector;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs as b, Fragment as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as L } from "react";
|
|
3
|
+
import { getCommonProps as N, noOp as x } from "../../utils/index.js";
|
|
4
|
+
import C from "../../node_modules/classnames/index.js";
|
|
5
|
+
import { SupportedLanguages as s } from "../../types/commonTypes.js";
|
|
6
|
+
import S from "../Dropdown/Dropdown.js";
|
|
7
|
+
import k from "../Accordion/Accordion.js";
|
|
8
|
+
import w from "../Accordion/AccordionItem.js";
|
|
9
|
+
import y from "../Navigation/NavigationItem/NavigationItem.js";
|
|
10
|
+
import { LinkVariants as P } from "../Link/types.js";
|
|
11
|
+
import { TextVariants as T } from "../Text/types.js";
|
|
12
|
+
import V from "../Text/Text.js";
|
|
13
|
+
import j from "../Navigation/NavigationList/NavigationList.js";
|
|
14
|
+
const A = ({
|
|
15
|
+
id: o,
|
|
16
|
+
value: n,
|
|
17
|
+
// can't be passed to the accordion
|
|
18
|
+
onValueChange: r,
|
|
19
|
+
label: t,
|
|
20
|
+
options: l,
|
|
21
|
+
...m
|
|
22
|
+
}) => /* @__PURE__ */ e(k, { ...m, children: /* @__PURE__ */ e(
|
|
23
|
+
w,
|
|
24
|
+
{
|
|
25
|
+
variation: "sm",
|
|
26
|
+
id: o != null ? o : "language-selector-accordion",
|
|
27
|
+
label: /* @__PURE__ */ e(V, { variant: T.snwHeaderLink, children: t }),
|
|
28
|
+
children: /* @__PURE__ */ e(j, { id: `${o}-navlist`, children: l.map((a) => /* @__PURE__ */ e(
|
|
29
|
+
y,
|
|
30
|
+
{
|
|
31
|
+
label: a.label,
|
|
32
|
+
onClick: () => r(a.value),
|
|
33
|
+
navType: P.snwFlyoutLink
|
|
34
|
+
},
|
|
35
|
+
a.value
|
|
36
|
+
)) })
|
|
37
|
+
}
|
|
38
|
+
) }), E = L(
|
|
39
|
+
({
|
|
40
|
+
className: o,
|
|
41
|
+
currentLanguage: n = s.en,
|
|
42
|
+
languageOptions: r = [
|
|
43
|
+
{ label: "English", value: s.en },
|
|
44
|
+
{ label: "中文", value: s.zh }
|
|
45
|
+
],
|
|
46
|
+
onLanguageChange: t = x,
|
|
47
|
+
id: l,
|
|
48
|
+
isHidden: m,
|
|
49
|
+
...a
|
|
50
|
+
}, c) => {
|
|
51
|
+
var g, f;
|
|
52
|
+
const { className: p, ...v } = N({ id: l }, "LanguageSelector"), d = (f = (g = r.find((i) => i.value === n)) == null ? void 0 : g.label) != null ? f : "English", u = {
|
|
53
|
+
...v,
|
|
54
|
+
...a,
|
|
55
|
+
id: l,
|
|
56
|
+
className: C(p, o, {
|
|
57
|
+
[`${p}--hidden`]: m
|
|
58
|
+
}),
|
|
59
|
+
options: r,
|
|
60
|
+
value: n,
|
|
61
|
+
onValueChange: (i) => t(i),
|
|
62
|
+
label: d
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ b(h, { children: [
|
|
65
|
+
/* @__PURE__ */ e(S, { ...u, ref: c }),
|
|
66
|
+
/* @__PURE__ */ e(A, { ...u, ref: c })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
E.displayName = "LanguageSelector";
|
|
71
|
+
export {
|
|
72
|
+
E as default
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LanguageSelector, type LanguageSelectorProps } from './LanguageSelector';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, ElementType } from 'react';
|
|
2
2
|
import { LinkVariants } from './types';
|
|
3
|
-
export interface LinkProps extends
|
|
3
|
+
export interface LinkProps extends ComponentProps<'a'> {
|
|
4
4
|
/**
|
|
5
5
|
* Describes where the link is used. It controls the styling of the link so we apply consistent styles. Defaults to `standalone`. See the documentation [here](https://www.figma.com/file/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?type=design&node-id=5731-12815) to see where each variant is used.
|
|
6
6
|
*
|
|
@@ -8,19 +8,11 @@ export interface LinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
8
8
|
* @see LinkVariants
|
|
9
9
|
*/
|
|
10
10
|
variant?: LinkVariants;
|
|
11
|
-
/**
|
|
12
|
-
* The text of the link
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* URL to navigate to when clicked
|
|
17
|
-
*/
|
|
18
|
-
href?: string;
|
|
19
11
|
/**
|
|
20
12
|
* Can be used to render alternative link components like the prefetching `Link` from `@remix-run/react`.
|
|
21
13
|
* This component should handle the `children`, `data-testid`, `id`, `className`, and `href` props.
|
|
22
14
|
*/
|
|
23
|
-
element?:
|
|
15
|
+
element?: ElementType<LinkProps & {
|
|
24
16
|
'data-testid': string;
|
|
25
17
|
}>;
|
|
26
18
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface NavigationProps extends
|
|
3
|
-
backBtnLabel?: string;
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
|
+
export interface NavigationProps extends ComponentProps<'nav'> {
|
|
4
3
|
/**
|
|
5
4
|
* Optional visible state
|
|
6
5
|
*/
|
|
7
6
|
visible?: boolean;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* ## Overview
|
|
10
|
+
*
|
|
11
|
+
* This is used within the Header component and displays the site navigation links. It support both mobile and desktop.
|
|
12
|
+
*
|
|
13
|
+
* [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-5784&m=dev)
|
|
14
|
+
*
|
|
15
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-navigation--overview)
|
|
16
|
+
*/
|
|
17
|
+
declare const Navigation: React.ForwardRefExoticComponent<Omit<NavigationProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
10
18
|
export default Navigation;
|