@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.
Files changed (50) hide show
  1. package/dist/assets/account_circle.svg.js +2 -2
  2. package/dist/components/Accordion/AccordionItem.d.ts +8 -4
  3. package/dist/components/Accordion/AccordionItem.js +67 -65
  4. package/dist/components/Dropdown/Dropdown.d.ts +2 -2
  5. package/dist/components/Header/Header.d.ts +20 -13
  6. package/dist/components/Header/Header.js +73 -76
  7. package/dist/components/Header/utils.d.ts +2 -9
  8. package/dist/components/Header/utils.js +3 -7
  9. package/dist/components/LanguageSelector/LanguageSelector.d.ts +36 -0
  10. package/dist/components/LanguageSelector/LanguageSelector.js +73 -0
  11. package/dist/components/LanguageSelector/index.d.ts +1 -0
  12. package/dist/components/Link/Link.d.ts +3 -11
  13. package/dist/components/Link/index.d.ts +2 -0
  14. package/dist/components/Navigation/Navigation.d.ts +12 -4
  15. package/dist/components/Navigation/Navigation.js +34 -51
  16. package/dist/components/Navigation/NavigationItem/NavigationItem.d.ts +15 -10
  17. package/dist/components/Navigation/NavigationItem/NavigationItem.js +19 -37
  18. package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +12 -3
  19. package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +33 -29
  20. package/dist/components/Navigation/NavigationList/NavigationList.d.ts +2 -2
  21. package/dist/components/Navigation/NavigationList/NavigationList.js +31 -32
  22. package/dist/components/Search/Search.d.ts +1 -1
  23. package/dist/components/Search/Search.js +134 -122
  24. package/dist/components/Search/SearchButton.js +21 -17
  25. package/dist/components/Search/SearchResults/SearchResults.js +14 -13
  26. package/dist/components/UserManagement/UserManagement.d.ts +21 -13
  27. package/dist/components/UserManagement/UserManagement.js +31 -61
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +65 -62
  30. package/dist/scss/_utils.scss +13 -3
  31. package/dist/scss/_vars.scss +30 -11
  32. package/dist/scss/componentStyles.scss +1 -0
  33. package/dist/scss/components/Accordion/_accordion.scss +3 -0
  34. package/dist/scss/components/Dropdown/_dropdown.scss +2 -0
  35. package/dist/scss/components/Header/_header.scss +72 -86
  36. package/dist/scss/components/LanguageSelector/_languageSelector.scss +47 -0
  37. package/dist/scss/components/Link/_link.scss +15 -4
  38. package/dist/scss/components/LinkList/_linkList.scss +4 -0
  39. package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +4 -119
  40. package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +75 -0
  41. package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +29 -42
  42. package/dist/scss/components/Navigation/_navigation.scss +24 -82
  43. package/dist/scss/components/Search/SearchResults/_searchResults.scss +1 -25
  44. package/dist/scss/components/Search/_search.scss +48 -7
  45. package/dist/scss/components/Search/_searchButton.scss +6 -2
  46. package/dist/scss/components/UserManagement/_userManagement.scss +33 -94
  47. package/dist/scss/components/Video/_video.scss +1 -0
  48. package/dist/utils/index.d.ts +1 -0
  49. package/dist/utils/index.js +31 -24
  50. package/package.json +2 -1
@@ -1,5 +1,5 @@
1
1
  import * as e from "react";
2
- const C = (t) => /* @__PURE__ */ e.createElement("svg", { width: 19, height: 20, viewBox: "0 0 19 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M9.5026 0.833984C4.4426 0.833984 0.335938 4.94065 0.335938 10.0007C0.335938 15.0607 4.4426 19.1673 9.5026 19.1673C14.5626 19.1673 18.6693 15.0607 18.6693 10.0007C18.6693 4.94065 14.5626 0.833984 9.5026 0.833984ZM9.5026 3.58398C11.0243 3.58398 12.2526 4.81232 12.2526 6.33398C12.2526 7.85565 11.0243 9.08398 9.5026 9.08398C7.98094 9.08398 6.7526 7.85565 6.7526 6.33398C6.7526 4.81232 7.98094 3.58398 9.5026 3.58398ZM9.5026 16.6007C7.21094 16.6007 5.1851 15.4273 4.0026 13.649C4.0301 11.8248 7.66927 10.8257 9.5026 10.8257C11.3268 10.8257 14.9751 11.8248 15.0026 13.649C13.8201 15.4273 11.7943 16.6007 9.5026 16.6007Z", fill: "#ADADAD" }));
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
- C as default
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: boolean;
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
- * Text string for the Accordion header for label.
16
+ * Uniqueid for the Accordion Item.
17
17
  */
18
- label: string;
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 t, Fragment as h } from "react/jsx-runtime";
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 v from "../../assets/plus.svg.js";
4
- import f from "../../assets/minus.svg.js";
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 a from "../../node_modules/classnames/index.js";
7
- import { Item as _, Trigger as C, Content as p } from "../../node_modules/@radix-ui/react-accordion/dist/index.js";
8
- import { getIconClasses as u } from "./utils.js";
9
- const x = ({
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: d,
12
- baseClassName: o,
13
- disable: i,
11
+ className: s,
12
+ baseClassName: t,
13
+ disable: c,
14
14
  isLargeVariation: e,
15
- id: c
15
+ id: r
16
16
  }) => {
17
- const r = i, l = /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
17
+ const a = c, l = /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
18
18
  I,
19
19
  {
20
- className: u(o, e, "lock"),
21
- "data-testid": `${c}-lockedIcon`,
20
+ className: p(t, e, "lock"),
21
+ "data-testid": `${r}-lockedIcon`,
22
22
  "aria-hidden": !0
23
23
  }
24
- ) }), m = /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
25
- v,
24
+ ) }), u = /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
25
+ f,
26
26
  {
27
- className: u(o, e, "plus"),
28
- "data-testid": `${c}-plusIcon`,
27
+ className: p(t, e, "plus"),
28
+ "data-testid": `${r}-plusIcon`,
29
29
  "aria-hidden": !0
30
30
  }
31
- ) }), s = /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
32
- f,
31
+ ) }), i = /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
32
+ v,
33
33
  {
34
- className: u(o, e, "minus"),
35
- "data-testid": `${c}-minusIcon`,
34
+ className: p(t, e, "minus"),
35
+ "data-testid": `${r}-minusIcon`,
36
36
  "aria-hidden": !0
37
37
  }
38
38
  ) });
39
- return /* @__PURE__ */ t(
39
+ return /* @__PURE__ */ o(
40
40
  C,
41
41
  {
42
- "data-disabled": i,
42
+ "data-disabled": c,
43
43
  asChild: !0,
44
- className: a(o, { [`${o}--hoverable`]: !i }, d),
45
- children: /* @__PURE__ */ g("div", { "data-testid": `${c}-trigger`, children: [
46
- /* @__PURE__ */ t("div", { className: a(`${o}__text`, { [`${o}__text--lg`]: e }), children: n }),
47
- r && l,
48
- !r && m,
49
- !r && s
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
- }, N = ({
53
+ }, A = ({
54
54
  children: n,
55
- baseClassName: d,
56
- disable: o,
57
- hasTransition: i,
55
+ baseClassName: s,
56
+ disable: t,
57
+ hasTransition: c,
58
58
  isLargeVariation: e,
59
- className: c
60
- }) => /* @__PURE__ */ t(h, { children: o && n ? /* @__PURE__ */ t("div", { children: n }) : /* @__PURE__ */ t(
61
- p,
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: a(
65
- { [`${d}__content--lg`]: e },
66
- { [`${d}--transition`]: i },
67
- c
64
+ className: d(
65
+ { [`${s}__content--lg`]: e },
66
+ { [`${s}--transition`]: c },
67
+ r
68
68
  ),
69
69
  children: n
70
70
  }
71
- ) }), F = ({
72
- isLocked: n,
73
- variation: d,
74
- label: o,
75
- isLastItem: i,
76
- hasTransition: e = !1,
77
- children: c,
78
- ...r
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: l } = $(r, "Accordion"), m = d === "lg", s = `${l}-item`;
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: o,
86
- className: a(s, { [`${s}__border-bottom`]: !i }),
86
+ value: t,
87
+ className: d(m, { [`${m}__border-bottom`]: !e }),
88
+ ...l,
87
89
  children: [
88
- /* @__PURE__ */ t(
89
- x,
90
+ /* @__PURE__ */ o(
91
+ N,
90
92
  {
91
93
  disable: n,
92
- isLargeVariation: m,
93
- id: r == null ? void 0 : r.id,
94
- baseClassName: `${s}-label`,
95
- children: o
94
+ isLargeVariation: i,
95
+ id: t,
96
+ baseClassName: `${m}-label`,
97
+ children: c
96
98
  }
97
99
  ),
98
- /* @__PURE__ */ t(
99
- N,
100
+ /* @__PURE__ */ o(
101
+ A,
100
102
  {
101
103
  disable: n,
102
- hasTransition: e,
103
- isLargeVariation: m,
104
- baseClassName: s,
105
- children: c
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
- F as default
115
+ H as default
114
116
  };
@@ -1,7 +1,7 @@
1
- import React, { ComponentProps } from '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'>, Omit<ComponentProps<'div'>, 'ref'> {
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 * as React from 'react';
2
- export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
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?: React.ReactElement<React.Component> | string;
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
- defaultMobileMenuLabel: string;
26
- expandedItem: string;
27
- setExpandedItem: (item: string) => void;
28
- isExpanded: boolean;
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
- declare const Header: ({ defaultMobileMenuLabel, logo, className, children, toggleOpenText, toggleCloseText, logoText, ...props }: React.PropsWithChildren<HeaderProps>) => import("react/jsx-runtime").JSX.Element;
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 _, jsx as t } from "react/jsx-runtime";
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 * as o from "react";
4
- import { findChildrenOfType as x, px as a } from "../../utils/index.js";
5
- import v from "../Search/Search.js";
6
- import k from "../../assets/PhillipsLogo.svg.js";
7
- import { defaultHeaderContext as T } from "./utils.js";
8
- const w = o.createContext(T), D = ({
9
- defaultMobileMenuLabel: r = "Main Menu",
10
- logo: d = /* @__PURE__ */ t(k, {}),
11
- className: S,
12
- children: h,
13
- toggleOpenText: l = "Open Menu",
14
- toggleCloseText: m = "Close Menu",
15
- logoText: f = "Home Page",
16
- ...E
17
- }) => {
18
- const $ = x(h, v), u = x(h, v, !0), [c, y] = o.useState(!1), [p, i] = o.useState(r), [C, I] = o.useState(!1), n = c ? m : l, N = p !== r, g = function() {
19
- y((e) => !e), i(r);
20
- }, H = function(e) {
21
- i((j) => j === r ? e : r);
22
- }, P = (e) => {
23
- I(e);
24
- };
25
- return /* @__PURE__ */ _("header", { ...E, className: s(`${a}-header`, S), children: [
26
- /* @__PURE__ */ t("div", { className: `${a}-header__top-row`, children: /* @__PURE__ */ t(
27
- "h1",
28
- {
29
- "data-testid": "header-logo",
30
- className: `${a}-header__logo`,
31
- tabIndex: n === l ? 0 : -1,
32
- children: /* @__PURE__ */ t("a", { href: "/", "aria-label": f, children: typeof d == "object" ? d : /* @__PURE__ */ t("img", { alt: "Phillips", "data-testid": "header-logo-img", src: d, height: "14" }) })
33
- }
34
- ) }),
35
- /* @__PURE__ */ t(
36
- "div",
37
- {
38
- className: s(`${a}-header__overlay`, { [`${a}-header__overlay--active`]: c }),
39
- "data-testid": "header-overlay",
40
- onClick: g
41
- }
42
- ),
43
- /* @__PURE__ */ t(
44
- "button",
45
- {
46
- "aria-label": n,
47
- "data-testid": "mobile-menu-toggle",
48
- type: "button",
49
- onClick: g,
50
- className: s(`${a}-header__toggle-btn`, {
51
- [`${a}-header__toggle-btn--open`]: n === m
52
- }),
53
- children: /* @__PURE__ */ t("span", { children: n })
54
- }
55
- ),
56
- /* @__PURE__ */ _(
57
- w.Provider,
58
- {
59
- value: {
60
- defaultMobileMenuLabel: r,
61
- expandedItem: p,
62
- setExpandedItem: (e) => i(e),
63
- isExpanded: N,
64
- onSelect: (e) => H(e),
65
- isSearchExpanded: C,
66
- setIsSearchExpanded: P
67
- },
68
- children: [
69
- /* @__PURE__ */ t("div", { className: s(`${a}-header__nav`, { [`${a}-header__nav--open`]: c }), children: u }),
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
- w as HeaderContext,
78
- D as default
74
+ I as HeaderContext,
75
+ L as default
79
76
  };
@@ -1,9 +1,2 @@
1
- export declare const defaultHeaderContext: {
2
- defaultMobileMenuLabel: string;
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 d = {
3
- defaultMobileMenuLabel: "",
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
- d as defaultHeaderContext
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 React, { HTMLAttributes } from 'react';
1
+ import { ComponentProps, ElementType } from 'react';
2
2
  import { LinkVariants } from './types';
3
- export interface LinkProps extends HTMLAttributes<HTMLAnchorElement> {
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?: React.ElementType<LinkProps & {
15
+ element?: ElementType<LinkProps & {
24
16
  'data-testid': string;
25
17
  }>;
26
18
  }
@@ -0,0 +1,2 @@
1
+ export { LinkVariants } from './types';
2
+ export { default as Link, type LinkProps } from './Link';
@@ -1,10 +1,18 @@
1
- import * as React from 'react';
2
- export interface NavigationProps extends React.HTMLAttributes<HTMLElement> {
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
- declare const Navigation: ({ backBtnLabel, children, className, id, visible, }: React.PropsWithChildren<NavigationProps>) => import("react/jsx-runtime").JSX.Element;
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;