@phillips/seldon 1.47.0 → 1.48.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 (41) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +15 -13
  2. package/dist/assets/PhillipsLogo.svg.js +1 -1
  3. package/dist/components/Header/Header.d.ts +13 -4
  4. package/dist/components/Header/Header.js +53 -48
  5. package/dist/components/Header/utils.d.ts +9 -0
  6. package/dist/components/Header/utils.js +13 -0
  7. package/dist/components/Navigation/Navigation.js +35 -31
  8. package/dist/components/Navigation/NavigationList/NavigationList.d.ts +5 -1
  9. package/dist/components/Navigation/NavigationList/NavigationList.js +11 -7
  10. package/dist/components/Search/Search.js +121 -113
  11. package/dist/components/Search/SearchButton.d.ts +7 -0
  12. package/dist/components/Search/SearchButton.js +37 -0
  13. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
  14. package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  15. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +10 -0
  16. package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  17. package/dist/node_modules/dom-helpers/esm/addClass.js +7 -0
  18. package/dist/node_modules/dom-helpers/esm/hasClass.js +6 -0
  19. package/dist/node_modules/dom-helpers/esm/removeClass.js +9 -0
  20. package/dist/node_modules/lodash.debounce/index.js +3 -0
  21. package/dist/node_modules/prop-types/index.js +11 -8
  22. package/dist/node_modules/react-transition-group/esm/CSSTransition.js +207 -0
  23. package/dist/node_modules/react-transition-group/esm/Transition.js +336 -0
  24. package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +5 -0
  25. package/dist/node_modules/react-transition-group/esm/config.js +6 -0
  26. package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +21 -0
  27. package/dist/node_modules/react-transition-group/esm/utils/reflow.js +6 -0
  28. package/dist/node_modules/usehooks-ts/dist/index.js +37 -0
  29. package/dist/scss/_vars.scss +3 -0
  30. package/dist/scss/componentStyles.scss +1 -0
  31. package/dist/scss/components/Header/_header.scss +30 -3
  32. package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +2 -2
  33. package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +14 -2
  34. package/dist/scss/components/Navigation/_navigation.scss +6 -16
  35. package/dist/scss/components/Search/SearchResults/_searchResults.scss +10 -19
  36. package/dist/scss/components/Search/_search.scss +52 -74
  37. package/dist/scss/components/Search/_searchButton.scss +41 -0
  38. package/dist/utils/index.d.ts +1 -1
  39. package/dist/utils/index.js +1 -1
  40. package/package.json +5 -2
  41. package/dist/assets/loading_spinner.svg.js +0 -7
@@ -1,26 +1,28 @@
1
- function n(e) {
1
+ var u = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
2
+ function f(e) {
2
3
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3
4
  }
4
- function c(e) {
5
+ function l(e) {
5
6
  if (e.__esModule) return e;
6
- var o = e.default;
7
- if (typeof o == "function") {
8
- var t = function r() {
9
- return this instanceof r ? Reflect.construct(o, arguments, this.constructor) : o.apply(this, arguments);
7
+ var r = e.default;
8
+ if (typeof r == "function") {
9
+ var t = function o() {
10
+ return this instanceof o ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
10
11
  };
11
- t.prototype = o.prototype;
12
+ t.prototype = r.prototype;
12
13
  } else t = {};
13
- return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
14
- var u = Object.getOwnPropertyDescriptor(e, r);
15
- Object.defineProperty(t, r, u.get ? u : {
14
+ return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
15
+ var n = Object.getOwnPropertyDescriptor(e, o);
16
+ Object.defineProperty(t, o, n.get ? n : {
16
17
  enumerable: !0,
17
18
  get: function() {
18
- return e[r];
19
+ return e[o];
19
20
  }
20
21
  });
21
22
  }), t;
22
23
  }
23
24
  export {
24
- c as getAugmentedNamespace,
25
- n as getDefaultExportFromCjs
25
+ u as commonjsGlobal,
26
+ l as getAugmentedNamespace,
27
+ f as getDefaultExportFromCjs
26
28
  };
@@ -1,5 +1,5 @@
1
1
  import * as e from "react";
2
- const l = (t) => /* @__PURE__ */ e.createElement("svg", { "data-testid": "header-logo-svg", width: 131, height: 18, viewBox: "0 0 131 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("g", { id: "Logo/ HP Button", clipPath: "url(#clip0_3288_4057)" }, /* @__PURE__ */ e.createElement("path", { id: "Phillips Logo", d: "M54.8166 0.274027H52.6224V13.726H63.7504V11.6083H54.8166V0.274027ZM41.3171 13.7273H43.5119V0.274027H41.3171V13.7273ZM21.276 0.274027H19.1214V13.726H21.2566V8.86215H30.0526V13.726H32.2079V0.274027H30.0526V6.80339H21.2566L21.276 0.274027ZM87.8477 13.7273H90.0425V0.274027H87.8477V13.7273ZM118.23 10.402L117.489 12.3843C119.214 13.3651 122.153 14 124.23 14C128.07 14 130.48 12.4912 130.48 9.84295C130.48 6.72565 127.521 6.17565 124.309 5.86211C122.252 5.66647 120.096 5.50969 120.096 4.01971C120.096 2.86206 121.135 2.11772 123.898 2.11772C125.543 2.11772 127.444 2.49021 129.031 3.15747L129.716 1.157C127.953 0.39193 125.817 0 123.936 0C120.058 0 117.863 1.52885 117.863 4.01971C117.863 7.1571 120.861 7.7058 124.034 7.99991C126.091 8.1962 128.227 8.37305 128.227 9.8436C128.227 11.0401 127.15 11.8829 124.25 11.8829C122.467 11.8823 120.004 11.3485 118.23 10.402ZM72.4298 0.274027H70.2357V13.726H81.3637V11.6083H72.4298V0.274027ZM106.676 0.274027H99.1724V13.726H101.367V9.27417H106.676C109.811 9.27417 111.614 7.39161 111.614 4.76406C111.614 2.15659 109.85 0.274027 106.676 0.274027ZM106.421 7.1571H101.367V2.39174H106.421C108.321 2.39174 109.379 3.27407 109.379 4.7647C109.38 6.25533 108.361 7.1571 106.421 7.1571ZM7.50343 0.274027H0V13.726H2.19414V9.27417H7.50343C10.638 9.27417 12.4399 7.39161 12.4399 4.76406C12.4406 2.15659 10.6775 0.274027 7.50343 0.274027ZM7.24907 7.1571H2.19414V2.39174H7.24907C9.14936 2.39174 10.2069 3.27407 10.2069 4.7647C10.2063 6.25533 9.18819 7.1571 7.24907 7.1571Z", fill: "black" })), /* @__PURE__ */ e.createElement("defs", null, /* @__PURE__ */ e.createElement("clipPath", { id: "clip0_3288_4057" }, /* @__PURE__ */ e.createElement("rect", { width: 130.667, height: 14, fill: "white" }))));
2
+ const l = (t) => /* @__PURE__ */ e.createElement("svg", { "data-testid": "header-logo-svg", viewBox: "0 0 131 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("g", { id: "Logo/ HP Button", clipPath: "url(#clip0_3288_4057)" }, /* @__PURE__ */ e.createElement("path", { id: "Phillips Logo", d: "M54.8166 0.274027H52.6224V13.726H63.7504V11.6083H54.8166V0.274027ZM41.3171 13.7273H43.5119V0.274027H41.3171V13.7273ZM21.276 0.274027H19.1214V13.726H21.2566V8.86215H30.0526V13.726H32.2079V0.274027H30.0526V6.80339H21.2566L21.276 0.274027ZM87.8477 13.7273H90.0425V0.274027H87.8477V13.7273ZM118.23 10.402L117.489 12.3843C119.214 13.3651 122.153 14 124.23 14C128.07 14 130.48 12.4912 130.48 9.84295C130.48 6.72565 127.521 6.17565 124.309 5.86211C122.252 5.66647 120.096 5.50969 120.096 4.01971C120.096 2.86206 121.135 2.11772 123.898 2.11772C125.543 2.11772 127.444 2.49021 129.031 3.15747L129.716 1.157C127.953 0.39193 125.817 0 123.936 0C120.058 0 117.863 1.52885 117.863 4.01971C117.863 7.1571 120.861 7.7058 124.034 7.99991C126.091 8.1962 128.227 8.37305 128.227 9.8436C128.227 11.0401 127.15 11.8829 124.25 11.8829C122.467 11.8823 120.004 11.3485 118.23 10.402ZM72.4298 0.274027H70.2357V13.726H81.3637V11.6083H72.4298V0.274027ZM106.676 0.274027H99.1724V13.726H101.367V9.27417H106.676C109.811 9.27417 111.614 7.39161 111.614 4.76406C111.614 2.15659 109.85 0.274027 106.676 0.274027ZM106.421 7.1571H101.367V2.39174H106.421C108.321 2.39174 109.379 3.27407 109.379 4.7647C109.38 6.25533 108.361 7.1571 106.421 7.1571ZM7.50343 0.274027H0V13.726H2.19414V9.27417H7.50343C10.638 9.27417 12.4399 7.39161 12.4399 4.76406C12.4406 2.15659 10.6775 0.274027 7.50343 0.274027ZM7.24907 7.1571H2.19414V2.39174H7.24907C9.14936 2.39174 10.2069 3.27407 10.2069 4.7647C10.2063 6.25533 9.18819 7.1571 7.24907 7.1571Z", fill: "black" })), /* @__PURE__ */ e.createElement("defs", null, /* @__PURE__ */ e.createElement("clipPath", { id: "clip0_3288_4057" }, /* @__PURE__ */ e.createElement("rect", { width: 130.667, height: 14, fill: "white" }))));
3
3
  export {
4
4
  l as default
5
5
  };
@@ -21,12 +21,21 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
21
21
  */
22
22
  logoText?: string;
23
23
  }
24
- export declare const HeaderContext: React.Context<{
24
+ export type HeaderContextType = {
25
25
  defaultMobileMenuLabel: string;
26
26
  expandedItem: string;
27
- setExpandedItem: (_item: string) => void;
27
+ setExpandedItem: (item: string) => void;
28
28
  isExpanded: boolean;
29
- onSelect: (_label: string) => void;
30
- }>;
29
+ onSelect: (label: string) => void;
30
+ /**
31
+ * Is the user within the search input and searching
32
+ */
33
+ isSearchExpanded: boolean;
34
+ /**
35
+ * Set the search expanded state
36
+ */
37
+ setIsSearchExpanded: React.Dispatch<React.SetStateAction<boolean>>;
38
+ };
39
+ export declare const HeaderContext: React.Context<HeaderContextType>;
31
40
  declare const Header: ({ defaultMobileMenuLabel, logo, className, children, toggleOpenText, toggleCloseText, logoText, ...props }: React.PropsWithChildren<HeaderProps>) => import("react/jsx-runtime").JSX.Element;
32
41
  export default Header;
@@ -1,74 +1,79 @@
1
- import { jsxs as N, jsx as e } from "react/jsx-runtime";
2
- import r from "../../node_modules/classnames/index.js";
3
- import * as i from "react";
4
- import { findChildrenOfType as _, px as a } from "../../utils/index.js";
5
- import x from "../Search/Search.js";
6
- import P from "../../assets/PhillipsLogo.svg.js";
7
- const j = i.createContext({
8
- defaultMobileMenuLabel: "",
9
- expandedItem: "",
10
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
11
- setExpandedItem: (t) => {
12
- },
13
- isExpanded: !1,
14
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
15
- onSelect: (t) => {
16
- }
17
- }), R = ({
18
- defaultMobileMenuLabel: t = "Main Menu",
19
- logo: s = /* @__PURE__ */ e(P, {}),
20
- className: v,
21
- children: l,
22
- toggleOpenText: m = "Open Menu",
23
- toggleCloseText: h = "Close Menu",
1
+ import { jsxs as _, jsx as t } from "react/jsx-runtime";
2
+ 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",
24
15
  logoText: f = "Home Page",
25
- ...S
16
+ ...E
26
17
  }) => {
27
- const $ = _(l, x), u = _(l, x, !0), [d, E] = i.useState(!1), [p, c] = i.useState(t), o = d ? h : m, y = p !== t, g = function() {
28
- E((n) => !n), c(t);
29
- }, I = function(n) {
30
- c((C) => C === t ? n : t);
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);
31
24
  };
32
- return /* @__PURE__ */ N("header", { ...S, className: r(`${a}-header`, v), children: [
33
- /* @__PURE__ */ e(
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(
34
36
  "div",
35
37
  {
36
- className: r(`${a}-header__overlay`, { [`${a}-header__overlay--active`]: d }),
38
+ className: s(`${a}-header__overlay`, { [`${a}-header__overlay--active`]: c }),
37
39
  "data-testid": "header-overlay",
38
40
  onClick: g
39
41
  }
40
42
  ),
41
- /* @__PURE__ */ e(
43
+ /* @__PURE__ */ t(
42
44
  "button",
43
45
  {
44
- "aria-label": o,
46
+ "aria-label": n,
45
47
  "data-testid": "mobile-menu-toggle",
46
48
  type: "button",
47
49
  onClick: g,
48
- className: r(`${a}-header__toggle-btn`, {
49
- [`${a}-header__toggle-btn--open`]: o === h
50
+ className: s(`${a}-header__toggle-btn`, {
51
+ [`${a}-header__toggle-btn--open`]: n === m
50
52
  }),
51
- children: /* @__PURE__ */ e("span", { children: o })
53
+ children: /* @__PURE__ */ t("span", { children: n })
52
54
  }
53
55
  ),
54
- /* @__PURE__ */ e("h1", { "data-testid": "header-logo", className: `${a}-header__logo`, tabIndex: o === m ? 0 : -1, children: /* @__PURE__ */ e("a", { href: "/", "aria-label": f, children: typeof s == "object" ? s : /* @__PURE__ */ e("img", { alt: "Phillips", "data-testid": "header-logo-img", src: s, height: "14" }) }) }),
55
- /* @__PURE__ */ e("div", { className: r(`${a}-header__nav`, { [`${a}-header__nav--open`]: d }), children: /* @__PURE__ */ e(
56
- j.Provider,
56
+ /* @__PURE__ */ _(
57
+ w.Provider,
57
58
  {
58
59
  value: {
59
- defaultMobileMenuLabel: t,
60
+ defaultMobileMenuLabel: r,
60
61
  expandedItem: p,
61
- setExpandedItem: (n) => c(n),
62
- isExpanded: y,
63
- onSelect: (n) => I(n)
62
+ setExpandedItem: (e) => i(e),
63
+ isExpanded: N,
64
+ onSelect: (e) => H(e),
65
+ isSearchExpanded: C,
66
+ setIsSearchExpanded: P
64
67
  },
65
- children: u
68
+ children: [
69
+ /* @__PURE__ */ t("div", { className: s(`${a}-header__nav`, { [`${a}-header__nav--open`]: c }), children: u }),
70
+ $
71
+ ]
66
72
  }
67
- ) }),
68
- $
73
+ )
69
74
  ] });
70
75
  };
71
76
  export {
72
- j as HeaderContext,
73
- R as default
77
+ w as HeaderContext,
78
+ D as default
74
79
  };
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1,13 @@
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,
8
+ isSearchExpanded: !1,
9
+ setIsSearchExpanded: e
10
+ };
11
+ export {
12
+ d as defaultHeaderContext
13
+ };
@@ -1,50 +1,54 @@
1
- import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import * as x from "react";
3
- import { px as e } from "../../utils/index.js";
4
- import d from "../../node_modules/classnames/index.js";
5
- import { HeaderContext as v } from "../Header/Header.js";
6
- const _ = ({
7
- backBtnLabel: i,
8
- children: r,
9
- className: b,
10
- id: a,
11
- visible: n = !0
1
+ import { jsxs as r, jsx as c } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import { findChildrenOfType as m, px as a } from "../../utils/index.js";
4
+ import b from "../../node_modules/classnames/index.js";
5
+ import { HeaderContext as _ } from "../Header/Header.js";
6
+ import p from "./NavigationList/NavigationList.js";
7
+ const g = ({
8
+ backBtnLabel: f,
9
+ children: i,
10
+ className: v,
11
+ id: e,
12
+ visible: s = !0
12
13
  }) => {
13
- const { defaultMobileMenuLabel: l, isExpanded: s, expandedItem: t, setExpandedItem: m } = x.useContext(v), c = () => m(t === l ? t : l);
14
- return /* @__PURE__ */ p(
14
+ const { defaultMobileMenuLabel: o, isExpanded: d, expandedItem: n, setExpandedItem: x, isSearchExpanded: $ } = l.useContext(_), h = () => x(n === o ? n : o), t = m(i, p), u = m(i, p, !0);
15
+ return /* @__PURE__ */ r(
15
16
  "nav",
16
17
  {
17
18
  role: "navigation",
18
- "aria-labelledby": `${a}-label`,
19
- "data-testid": a,
20
- id: a,
21
- className: d(`${e}-nav`, b, { [`${e}-nav--expanded`]: s }),
19
+ "aria-labelledby": `${e}-label`,
20
+ "data-testid": e,
21
+ id: e,
22
+ className: b(`${a}-nav`, v, { [`${a}-nav--expanded`]: d }),
22
23
  children: [
23
- /* @__PURE__ */ o(
24
+ /* @__PURE__ */ c(
24
25
  "button",
25
26
  {
26
- "data-testid": `${a}-back-btn`,
27
- tabIndex: s ? 0 : -1,
28
- className: `${e}-nav__back-btn`,
29
- onClick: c,
30
- children: i
27
+ "data-testid": `${e}-back-btn`,
28
+ tabIndex: d ? 0 : -1,
29
+ className: `${a}-nav__back-btn`,
30
+ onClick: h,
31
+ children: f
31
32
  }
32
33
  ),
33
- /* @__PURE__ */ o(
34
+ /* @__PURE__ */ c(
34
35
  "h2",
35
36
  {
36
- id: `${a}-label`,
37
- "data-testid": `${a}-label`,
38
- className: d(`${e}-nav__label`, { [`${e}-nav__label--hidden`]: !n }),
39
- style: { "--visible": n ? "visible" : "hidden" },
40
- children: t || "Main Menu"
37
+ id: `${e}-label`,
38
+ "data-testid": `${e}-label`,
39
+ className: b(`${a}-nav__label`, { [`${a}-nav__label--hidden`]: !s }),
40
+ style: { "--visible": s ? "visible" : "hidden" },
41
+ children: n || "Main Menu"
41
42
  }
42
43
  ),
43
- r
44
+ /* @__PURE__ */ r("div", { className: `${a}-nav__list-container`, children: [
45
+ l.isValidElement(t == null ? void 0 : t[0]) ? l.cloneElement(t[0], { isOffScreen: $ }) : void 0,
46
+ u
47
+ ] })
44
48
  ]
45
49
  }
46
50
  );
47
51
  };
48
52
  export {
49
- _ as default
53
+ g as default
50
54
  };
@@ -4,6 +4,10 @@ export interface NavigationListProps extends React.HTMLAttributes<HTMLElement> {
4
4
  * id for the navigation list
5
5
  */
6
6
  id: string;
7
+ /**
8
+ * Is the nav list offscreen?
9
+ */
10
+ isOffScreen?: boolean;
7
11
  }
8
- declare const NavigationList: ({ id, children, className }: React.PropsWithChildren<NavigationListProps>) => import("react/jsx-runtime").JSX.Element;
12
+ declare const NavigationList: React.FC<NavigationListProps>;
9
13
  export default NavigationList;
@@ -1,24 +1,28 @@
1
- import { jsxs as p, jsx as _ } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as _ } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
3
  import { px as a } from "../../../utils/index.js";
4
4
  import l from "../../../node_modules/classnames/index.js";
5
- import { HeaderContext as v } from "../../Header/Header.js";
6
- const x = ({ id: o, children: n, className: m }) => {
7
- const { isExpanded: i } = r.useContext(v), s = r.Children.toArray(n).filter((t) => {
5
+ import { HeaderContext as f } from "../../Header/Header.js";
6
+ const $ = ({ id: o, children: n, className: m, isOffScreen: p, ...v }) => {
7
+ const { isExpanded: i } = r.useContext(f), s = r.Children.toArray(n).filter((t) => {
8
8
  if (t && t.props.navGroup === "nav-link-lg")
9
9
  return t;
10
10
  }), e = r.Children.toArray(n).filter((t) => {
11
11
  if (t && t.props.navGroup === "nav-link-sm")
12
12
  return t;
13
13
  });
14
- return /* @__PURE__ */ p(
14
+ return /* @__PURE__ */ c(
15
15
  "ul",
16
16
  {
17
17
  id: o,
18
18
  "data-testid": o,
19
19
  role: "list",
20
20
  "aria-expanded": i,
21
- className: l(m, `${a}-nav__list`, { [`${a}-nav__list--expanded`]: i }),
21
+ className: l(m, `${a}-nav__list`, {
22
+ [`${a}-nav__list--expanded`]: i,
23
+ [`${a}-nav__list--offscreen`]: p
24
+ }),
25
+ ...v,
22
26
  children: [
23
27
  s.length > 0 ? /* @__PURE__ */ _("div", { className: l(`${a}-nav__list__section`, `${a}-nav__list__section--large-cta`), children: s }) : null,
24
28
  e.length > 0 ? /* @__PURE__ */ _("div", { className: l(`${a}-nav__list__section`, `${a}-nav__list__section--small-cta`), children: e }) : null,
@@ -28,5 +32,5 @@ const x = ({ id: o, children: n, className: m }) => {
28
32
  );
29
33
  };
30
34
  export {
31
- x as default
35
+ $ as default
32
36
  };
@@ -1,137 +1,145 @@
1
- import { jsxs as v, jsx as a } from "react/jsx-runtime";
2
- import * as d from "react";
3
- import { getCommonProps as P, encodeURLSearchParams as N } from "../../utils/index.js";
4
- import f from "../../node_modules/classnames/index.js";
5
- import T from "../Input/Input.js";
6
- import j from "../../assets/search.svg.js";
7
- import D from "../../assets/close.svg.js";
8
- import V from "../../assets/loading_spinner.svg.js";
9
- import A from "../Link/Link.js";
1
+ import { jsxs as p, Fragment as k, jsx as a } from "react/jsx-runtime";
2
+ import * as f from "react";
3
+ import { getCommonProps as P, px as y, encodeURLSearchParams as N } from "../../utils/index.js";
4
+ import u from "../../node_modules/classnames/index.js";
5
+ import j from "../Input/Input.js";
6
+ import D from "../Link/Link.js";
10
7
  import F from "./SearchResults/SearchResults.js";
11
8
  import { TextVariants as H } from "../Text/types.js";
12
- import K from "../Text/Text.js";
13
- const Z = ({
14
- onSearch: h,
15
- searchResults: R = [],
16
- state: s = "idle",
17
- defaultValue: C = "",
18
- className: w,
19
- placeholder: l,
20
- searchButtonText: c = "Search",
21
- loadingText: x = "Search In Progress...",
22
- invalidText: k = "Invalid search",
23
- getAllResultsText: y = (e) => `View all results for ${e}`,
24
- getAllResultsLink: _ = (e) => `/Search?Search=${e}`,
25
- ...p
9
+ import O from "../Text/Text.js";
10
+ import { useOnClickOutside as V } from "../../node_modules/usehooks-ts/dist/index.js";
11
+ import { HeaderContext as A } from "../Header/Header.js";
12
+ import { SearchButton as K } from "./SearchButton.js";
13
+ import M from "../../node_modules/react-transition-group/esm/CSSTransition.js";
14
+ const re = ({
15
+ onSearch: S,
16
+ searchResults: C = [],
17
+ state: c = "idle",
18
+ defaultValue: I = "",
19
+ className: R,
20
+ placeholder: b = "",
21
+ searchButtonText: l = "Search",
22
+ loadingText: w = "Search In Progress...",
23
+ invalidText: E = "Invalid search",
24
+ getAllResultsText: L = (e) => `View all results for ${e}`,
25
+ getAllResultsLink: v = (e) => `/Search?Search=${e}`,
26
+ ...x
26
27
  }) => {
27
- var g;
28
- const { className: e, "data-testid": r, ...L } = P(p, "Search"), [n, b] = d.useState(!1), m = d.useRef(null), u = d.useRef(null), o = (g = m.current) == null ? void 0 : g.value, E = s === "loading" || s === "submitting", $ = () => {
29
- var t, i;
30
- if (b(!n), n) {
31
- (t = u.current) == null || t.reset();
32
- return;
33
- }
34
- (i = m.current) == null || i.focus();
35
- }, S = (t) => {
36
- var i;
37
- if (t.stopPropagation(), t.key === "Enter") {
38
- if (t.preventDefault(), o && o.length > 2) {
39
- const I = N(_(o));
40
- window.location.href = I;
28
+ var $;
29
+ const { className: e, "data-testid": m, ...T } = P(x, "Search"), d = f.useContext(A), h = f.useRef(null), o = f.useRef(null), t = d.isSearchExpanded, s = ($ = h.current) == null ? void 0 : $.value;
30
+ V(o, () => g(!1));
31
+ const _ = (r) => {
32
+ var n;
33
+ if (r.stopPropagation(), r.key === "Enter") {
34
+ if (r.preventDefault(), s && s.length > 2) {
35
+ const i = N(v(s));
36
+ window.location.href = i;
41
37
  }
42
- t.currentTarget instanceof HTMLAnchorElement && t.currentTarget.click();
38
+ r.currentTarget instanceof HTMLAnchorElement && r.currentTarget.click();
39
+ }
40
+ r.key === "Escape" && (d.setIsSearchExpanded(!1), (n = o.current) == null || n.reset());
41
+ }, g = (r) => {
42
+ var n, i;
43
+ if (d.setIsSearchExpanded(r), r) {
44
+ (n = h.current) == null || n.focus();
45
+ return;
43
46
  }
44
- t.key === "Escape" && (b(!1), (i = u.current) == null || i.reset());
47
+ (i = o.current) == null || i.reset();
45
48
  };
46
- return /* @__PURE__ */ v(
47
- "div",
48
- {
49
- ...L,
50
- className: f(e, w),
51
- "data-testid": r,
52
- role: "search",
53
- ...p,
54
- children: [
55
- /* @__PURE__ */ a(K, { variant: H.heading3, className: `${e}__label`, children: c }),
56
- n ? null : /* @__PURE__ */ a(
57
- "button",
58
- {
59
- type: "button",
60
- "data-testid": `${r}-button`,
61
- "aria-label": c,
62
- className: `${e}__button ${e}__button--search`,
63
- onClick: $,
64
- children: /* @__PURE__ */ a(j, { "data-testid": `${r}-button-icon`, className: `${e}__button__icon` })
65
- }
66
- ),
67
- n && s === "idle" ? /* @__PURE__ */ a(
68
- "button",
69
- {
70
- type: "button",
71
- "data-testid": `${r}-close-button`,
72
- "aria-label": "Close Search",
73
- className: `${e}__button ${e}__button--close`,
74
- onClick: $,
75
- children: /* @__PURE__ */ a(D, { "data-testid": `${r}-form-icon`, className: `${e}__button__icon` })
76
- }
77
- ) : null,
78
- n && E ? /* @__PURE__ */ a(
79
- V,
80
- {
81
- "data-testid": `${r}-form-icon`,
82
- className: `${e}__button__icon ${e}__input-status-icon`
83
- }
84
- ) : null,
85
- /* @__PURE__ */ a(
49
+ return /* @__PURE__ */ p(k, { children: [
50
+ /* @__PURE__ */ a(O, { variant: H.heading3, className: `${e}__label`, children: l }),
51
+ /* @__PURE__ */ a(
52
+ "div",
53
+ {
54
+ ...T,
55
+ className: u(e, R, { [`${e}--active`]: t }),
56
+ "data-testid": m,
57
+ role: "search",
58
+ ...x,
59
+ children: /* @__PURE__ */ p(
86
60
  "form",
87
61
  {
88
- "data-testid": `${r}-form`,
89
- className: f(`${e}__form`, { [`${e}__form--active`]: n }),
90
- "aria-hidden": !n,
91
- ref: u,
92
- children: /* @__PURE__ */ v("div", { className: f(`${e}__content-wrapper`), role: "combobox", "aria-haspopup": "listbox", children: [
93
- /* @__PURE__ */ a(
94
- T,
62
+ "data-testid": `${m}-form`,
63
+ className: u(`${e}__form`, {
64
+ [`${e}__form--active`]: t
65
+ }),
66
+ ref: o,
67
+ children: [
68
+ /* @__PURE__ */ p(
69
+ "div",
95
70
  {
96
- className: `${e}__input`,
97
- id: "search-input",
98
- hideLabel: !0,
99
- labelText: c,
100
- placeholder: l != null ? l : null,
101
- type: "text",
102
- defaultValue: C,
103
- invalid: s === "invalid",
104
- invalidText: k,
105
- onKeyDown: S,
106
- onChange: h ? (t) => {
107
- h(t.target.value);
108
- } : void 0,
109
- ref: m
71
+ className: u(`${e}__content-wrapper`, {
72
+ [`${e}__content-wrapper--active`]: t
73
+ }),
74
+ role: "combobox",
75
+ "aria-haspopup": "listbox",
76
+ children: [
77
+ /* @__PURE__ */ a(
78
+ M,
79
+ {
80
+ in: t,
81
+ classNames: `${y}-input`,
82
+ addEndListener: () => {
83
+ },
84
+ children: /* @__PURE__ */ a(
85
+ j,
86
+ {
87
+ "aria-hidden": !t,
88
+ className: `${e}__input`,
89
+ id: "search-input",
90
+ hideLabel: !0,
91
+ labelText: l,
92
+ placeholder: t ? b : "",
93
+ type: "text",
94
+ defaultValue: I,
95
+ invalid: c === "invalid",
96
+ invalidText: E,
97
+ onKeyDown: _,
98
+ onChange: S ? (r) => {
99
+ S(r.target.value);
100
+ } : void 0,
101
+ ref: h
102
+ }
103
+ )
104
+ }
105
+ ),
106
+ /* @__PURE__ */ a(
107
+ K,
108
+ {
109
+ className: e,
110
+ searchButtonText: l,
111
+ state: c,
112
+ testId: m,
113
+ isSearchExpanded: t,
114
+ setIsSearchExpanded: g
115
+ }
116
+ )
117
+ ]
110
118
  }
111
119
  ),
112
- o && o.length > 2 ? /* @__PURE__ */ a(
120
+ s && s.length > 2 ? /* @__PURE__ */ a(
113
121
  F,
114
122
  {
115
- autoCompleteResults: R,
116
- isLoading: s === "loading",
117
- loadingText: x,
118
- onKeyDown: S,
123
+ autoCompleteResults: C,
124
+ isLoading: c === "loading",
125
+ loadingText: w,
126
+ onKeyDown: _,
119
127
  children: /* @__PURE__ */ a("li", { className: `${e}__result`, children: /* @__PURE__ */ a(
120
- A,
128
+ D,
121
129
  {
122
- href: ((t) => N(_(t)))(o),
123
- children: /* @__PURE__ */ a("p", { children: y(o) })
130
+ href: ((r) => N(v(r)))(s),
131
+ children: /* @__PURE__ */ a("p", { children: L(s) })
124
132
  }
125
133
  ) }, "viewAllSearchResults")
126
134
  }
127
135
  ) : null
128
- ] })
136
+ ]
129
137
  }
130
138
  )
131
- ]
132
- }
133
- );
139
+ }
140
+ )
141
+ ] });
134
142
  };
135
143
  export {
136
- Z as default
144
+ re as default
137
145
  };