@phillips/seldon 1.47.0 → 1.49.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 (46) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +15 -13
  2. package/dist/assets/PhillipsLogo.svg.js +1 -1
  3. package/dist/assets/close.svg.js +1 -1
  4. package/dist/components/Header/Header.d.ts +13 -4
  5. package/dist/components/Header/Header.js +53 -48
  6. package/dist/components/Header/utils.d.ts +9 -0
  7. package/dist/components/Header/utils.js +13 -0
  8. package/dist/components/Navigation/Navigation.js +35 -31
  9. package/dist/components/Navigation/NavigationList/NavigationList.d.ts +5 -1
  10. package/dist/components/Navigation/NavigationList/NavigationList.js +11 -7
  11. package/dist/components/Search/Search.js +121 -113
  12. package/dist/components/Search/SearchButton.d.ts +7 -0
  13. package/dist/components/Search/SearchButton.js +37 -0
  14. package/dist/components/Subscribe/Subscribe.js +12 -13
  15. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
  16. package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  17. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +10 -0
  18. package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  19. package/dist/node_modules/dom-helpers/esm/addClass.js +7 -0
  20. package/dist/node_modules/dom-helpers/esm/hasClass.js +6 -0
  21. package/dist/node_modules/dom-helpers/esm/removeClass.js +9 -0
  22. package/dist/node_modules/lodash.debounce/index.js +3 -0
  23. package/dist/node_modules/prop-types/index.js +11 -8
  24. package/dist/node_modules/react-transition-group/esm/CSSTransition.js +207 -0
  25. package/dist/node_modules/react-transition-group/esm/Transition.js +336 -0
  26. package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +5 -0
  27. package/dist/node_modules/react-transition-group/esm/config.js +6 -0
  28. package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +21 -0
  29. package/dist/node_modules/react-transition-group/esm/utils/reflow.js +6 -0
  30. package/dist/node_modules/usehooks-ts/dist/index.js +37 -0
  31. package/dist/scss/_vars.scss +3 -0
  32. package/dist/scss/componentStyles.scss +1 -0
  33. package/dist/scss/components/Drawer/_drawer.scss +1 -1
  34. package/dist/scss/components/Header/_header.scss +30 -3
  35. package/dist/scss/components/Input/_input.scss +1 -2
  36. package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +2 -2
  37. package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +14 -2
  38. package/dist/scss/components/Navigation/_navigation.scss +6 -16
  39. package/dist/scss/components/Search/SearchResults/_searchResults.scss +10 -19
  40. package/dist/scss/components/Search/_search.scss +52 -74
  41. package/dist/scss/components/Search/_searchButton.scss +41 -0
  42. package/dist/scss/components/Subscribe/_subscribe.scss +3 -14
  43. package/dist/utils/index.d.ts +1 -1
  44. package/dist/utils/index.js +1 -1
  45. package/package.json +5 -2
  46. package/dist/assets/loading_spinner.svg.js +0 -7
@@ -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
  };
@@ -0,0 +1,7 @@
1
+ import { SearchProps } from './Search';
2
+ import { ComponentProps } from 'react';
3
+ export declare const SearchButton: ({ state, isSearchExpanded, setIsSearchExpanded, searchButtonText, className, testId, ...props }: {
4
+ testId: string;
5
+ isSearchExpanded: boolean;
6
+ setIsSearchExpanded: React.Dispatch<React.SetStateAction<boolean>>;
7
+ } & Pick<SearchProps, "state" | "searchButtonText"> & import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,37 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import b from "../../assets/search.svg.js";
3
+ import l from "../../assets/close.svg.js";
4
+ const f = ({
5
+ state: e,
6
+ isSearchExpanded: r,
7
+ setIsSearchExpanded: i,
8
+ searchButtonText: _,
9
+ className: t,
10
+ testId: o,
11
+ ...u
12
+ }) => r ? r && e === "idle" ? /* @__PURE__ */ n(
13
+ "button",
14
+ {
15
+ ...u,
16
+ type: "button",
17
+ "data-testid": `${o}-close-button`,
18
+ "aria-label": "Close Search",
19
+ className: `${t}__button ${t}__button--close`,
20
+ onClick: () => i(!1),
21
+ children: /* @__PURE__ */ n(l, { "data-testid": `${o}-form-icon`, className: `${t}__button__icon` })
22
+ }
23
+ ) : null : /* @__PURE__ */ n(
24
+ "button",
25
+ {
26
+ ...u,
27
+ type: "button",
28
+ "data-testid": `${o}-button`,
29
+ "aria-label": _,
30
+ className: `${t}__button ${t}__button--search`,
31
+ onClick: () => i(!0),
32
+ children: /* @__PURE__ */ n(b, { "data-testid": `${o}-button-icon`, className: `${t}__button__icon` })
33
+ }
34
+ );
35
+ export {
36
+ f as SearchButton
37
+ };
@@ -5,11 +5,11 @@ import L from "../Input/Input.js";
5
5
  import S from "../Button/Button.js";
6
6
  import { SubscriptionState as o } from "./types.js";
7
7
  import { ButtonVariants as T } from "../Button/types.js";
8
- const z = ({
9
- blurb: s,
10
- buttonText: t = "Sign Up",
8
+ const Y = ({
9
+ blurb: a,
10
+ buttonText: m = "Sign Up",
11
11
  buttonProps: c,
12
- className: a,
12
+ className: s,
13
13
  element: d = "form",
14
14
  inputLabelText: u = "Enter Your Email Address To Sign Up*",
15
15
  inputPlaceholder: p = "example@email.com",
@@ -27,10 +27,10 @@ const z = ({
27
27
  success: v,
28
28
  loading: g,
29
29
  error: h
30
- }, m = e !== o.Default ? E[e] : "", P = $ || y, A = N || b;
31
- return /* @__PURE__ */ B(d, { ...x, className: C(r, a), noValidate: !0, ...l, children: [
30
+ }, t = e !== o.Default ? E[e] : "", P = $ || y, A = N || b;
31
+ return /* @__PURE__ */ B(d, { ...x, className: C(r, s), noValidate: !0, ...l, children: [
32
32
  /* @__PURE__ */ n("h3", { className: `${r}__title`, children: f }),
33
- s ? /* @__PURE__ */ n("p", { className: `${r}__blurb`, children: s }) : null,
33
+ a ? /* @__PURE__ */ n("p", { className: `${r}__blurb`, children: a }) : null,
34
34
  /* @__PURE__ */ n(
35
35
  L,
36
36
  {
@@ -40,26 +40,25 @@ const z = ({
40
40
  placeholder: p,
41
41
  labelText: u,
42
42
  invalid: A,
43
- invalidText: m,
43
+ invalidText: t,
44
44
  warn: P,
45
- warnText: m,
45
+ warnText: t,
46
46
  required: !0
47
47
  }
48
48
  ),
49
49
  /* @__PURE__ */ n(
50
50
  S,
51
51
  {
52
- className: `${r}__button ${a}`,
52
+ className: `${r}__button ${s}`,
53
53
  variant: T.secondary,
54
- size: "sm",
55
54
  type: "submit",
56
55
  ...c,
57
- children: t
56
+ children: m
58
57
  }
59
58
  ),
60
59
  i ? /* @__PURE__ */ n("p", { className: `${r}__privacy`, children: i }) : null
61
60
  ] });
62
61
  };
63
62
  export {
64
- z as default
63
+ Y as default
65
64
  };
@@ -0,0 +1,13 @@
1
+ function e() {
2
+ return e = Object.assign ? Object.assign.bind() : function(a) {
3
+ for (var n = 1; n < arguments.length; n++) {
4
+ var t = arguments[n];
5
+ for (var r in t)
6
+ Object.prototype.hasOwnProperty.call(t, r) && (a[r] = t[r]);
7
+ }
8
+ return a;
9
+ }, e.apply(this, arguments);
10
+ }
11
+ export {
12
+ e as default
13
+ };
@@ -0,0 +1,7 @@
1
+ import e from "./setPrototypeOf.js";
2
+ function p(t, o) {
3
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, e(t, o);
4
+ }
5
+ export {
6
+ p as default
7
+ };
@@ -0,0 +1,10 @@
1
+ function a(r, o) {
2
+ if (r == null) return {};
3
+ var n = {}, i = Object.keys(r), e, t;
4
+ for (t = 0; t < i.length; t++)
5
+ e = i[t], !(o.indexOf(e) >= 0) && (n[e] = r[e]);
6
+ return n;
7
+ }
8
+ export {
9
+ a as default
10
+ };
@@ -0,0 +1,8 @@
1
+ function e(o, r) {
2
+ return e = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, f) {
3
+ return t.__proto__ = f, t;
4
+ }, e(o, r);
5
+ }
6
+ export {
7
+ e as default
8
+ };
@@ -0,0 +1,7 @@
1
+ import i from "./hasClass.js";
2
+ function c(s, a) {
3
+ s.classList ? s.classList.add(a) : i(s, a) || (typeof s.className == "string" ? s.className = s.className + " " + a : s.setAttribute("class", (s.className && s.className.baseVal || "") + " " + a));
4
+ }
5
+ export {
6
+ c as default
7
+ };
@@ -0,0 +1,6 @@
1
+ function i(s, a) {
2
+ return s.classList ? !!a && s.classList.contains(a) : (" " + (s.className.baseVal || s.className) + " ").indexOf(" " + a + " ") !== -1;
3
+ }
4
+ export {
5
+ i as default
6
+ };
@@ -0,0 +1,9 @@
1
+ function c(s, a) {
2
+ return s.replace(new RegExp("(^|\\s)" + a + "(?:\\s|$)", "g"), "$1").replace(/\s+/g, " ").replace(/^\s*|\s*$/g, "");
3
+ }
4
+ function r(s, a) {
5
+ s.classList ? s.classList.remove(a) : typeof s.className == "string" ? s.className = c(s.className, a) : s.setAttribute("class", c(s.className && s.className.baseVal || "", a));
6
+ }
7
+ export {
8
+ r as default
9
+ };
@@ -0,0 +1,3 @@
1
+ import { commonjsGlobal as e } from "../../_virtual/_commonjsHelpers.js";
2
+ var t = typeof e == "object" && e && e.Object === Object && e, o = typeof self == "object" && self && self.Object === Object && self;
3
+ t || o || Function("return this")();
@@ -1,13 +1,16 @@
1
+ import { getDefaultExportFromCjs as e } from "../../_virtual/_commonjsHelpers.js";
1
2
  import { __module as r } from "../../_virtual/index3.js";
2
- import { __require as e } from "./node_modules/react-is/index.js";
3
- import { __require as o } from "./factoryWithTypeCheckers.js";
4
- import { __require as p } from "./factoryWithThrowingShims.js";
3
+ import { __require as o } from "./node_modules/react-is/index.js";
4
+ import { __require as p } from "./factoryWithTypeCheckers.js";
5
+ import { __require as t } from "./factoryWithThrowingShims.js";
5
6
  if (process.env.NODE_ENV !== "production") {
6
- var s = e(), i = !0;
7
- r.exports = o()(s.isElement, i);
7
+ var s = o(), i = !0;
8
+ r.exports = p()(s.isElement, i);
8
9
  } else
9
- r.exports = p()();
10
- var _ = r.exports;
10
+ r.exports = t()();
11
+ var a = r.exports;
12
+ const q = /* @__PURE__ */ e(a);
11
13
  export {
12
- _ as p
14
+ q as default,
15
+ a as p
13
16
  };