@phillips/seldon 1.78.0 → 1.79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Search/Search.js +110 -117
- package/dist/components/Search/SearchResults/SearchResults.d.ts +2 -1
- package/dist/components/Search/SearchResults/SearchResults.js +25 -15
- package/dist/node_modules/exenv/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +8 -1
- package/dist/site-furniture/Header/Header.d.ts +4 -0
- package/dist/site-furniture/Header/Header.js +29 -28
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { getCommonProps as j, px as D, encodeURLSearchParams as
|
|
4
|
-
import
|
|
1
|
+
import { jsx as a, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import i, { useEffect as V } from "react";
|
|
3
|
+
import { getCommonProps as j, px as D, encodeURLSearchParams as I } from "../../utils/index.js";
|
|
4
|
+
import _ from "../../node_modules/classnames/index.js";
|
|
5
5
|
import H from "../Input/Input.js";
|
|
6
6
|
import O from "../Link/Link.js";
|
|
7
7
|
import A from "./SearchResults/SearchResults.js";
|
|
@@ -12,37 +12,37 @@ import { HeaderContext as U } from "../../site-furniture/Header/Header.js";
|
|
|
12
12
|
import { SearchButton as q } from "./SearchButton.js";
|
|
13
13
|
import z from "../../node_modules/react-transition-group/esm/CSSTransition.js";
|
|
14
14
|
const ne = ({
|
|
15
|
-
onSearch:
|
|
16
|
-
onCancel:
|
|
17
|
-
searchResults:
|
|
18
|
-
state:
|
|
19
|
-
defaultValue:
|
|
15
|
+
onSearch: S,
|
|
16
|
+
onCancel: o,
|
|
17
|
+
searchResults: R = [],
|
|
18
|
+
state: c = "idle",
|
|
19
|
+
defaultValue: E = "",
|
|
20
20
|
className: b,
|
|
21
21
|
placeholder: w = "",
|
|
22
|
-
searchButtonText:
|
|
22
|
+
searchButtonText: l = "Search",
|
|
23
23
|
loadingText: C = "Search In Progress...",
|
|
24
|
-
invalidText:
|
|
25
|
-
getAllResultsText:
|
|
26
|
-
getAllResultsLink:
|
|
27
|
-
...
|
|
24
|
+
invalidText: L = "Invalid search",
|
|
25
|
+
getAllResultsText: P = (r) => `View all results for ${r}`,
|
|
26
|
+
getAllResultsLink: v = (r) => `/Search?Search=${r}`,
|
|
27
|
+
...x
|
|
28
28
|
}) => {
|
|
29
|
-
var
|
|
30
|
-
const { className: r, "data-testid":
|
|
31
|
-
|
|
29
|
+
var N;
|
|
30
|
+
const { className: r, "data-testid": d, ...T } = j(x, "Search"), m = i.useContext(U), h = i.useRef(null), p = i.useRef(null), $ = i.useRef(null), t = m.isSearchExpanded, s = (N = h.current) == null ? void 0 : N.value, k = S ? (e) => {
|
|
31
|
+
S(e.target.value);
|
|
32
32
|
} : void 0;
|
|
33
|
-
M(
|
|
34
|
-
|
|
33
|
+
M($, (e) => {
|
|
34
|
+
o == null || o(), u(!1), e.stopPropagation();
|
|
35
35
|
});
|
|
36
|
-
const
|
|
36
|
+
const g = (e) => {
|
|
37
37
|
var n;
|
|
38
38
|
if (e.stopPropagation(), e.key === "Enter") {
|
|
39
39
|
if (e.preventDefault(), s && s.length > 2) {
|
|
40
|
-
const y =
|
|
40
|
+
const y = I(v(s));
|
|
41
41
|
window.location.href = y;
|
|
42
42
|
}
|
|
43
43
|
e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.click();
|
|
44
44
|
}
|
|
45
|
-
e.key === "Escape" && ((n = p.current) == null || n.reset(),
|
|
45
|
+
e.key === "Escape" && ((n = p.current) == null || n.reset(), m.setIsSearchExpanded(!1));
|
|
46
46
|
};
|
|
47
47
|
V(() => {
|
|
48
48
|
var e;
|
|
@@ -51,111 +51,104 @@ const ne = ({
|
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
}, [t]);
|
|
54
|
-
const
|
|
54
|
+
const u = (e) => {
|
|
55
55
|
var n;
|
|
56
|
-
(n = p.current) == null || n.reset(),
|
|
56
|
+
(n = p.current) == null || n.reset(), m.setIsSearchExpanded(e);
|
|
57
57
|
};
|
|
58
|
-
return /* @__PURE__ */ a("div", { className: `${r}__container`, children: /* @__PURE__ */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
return /* @__PURE__ */ a("div", { className: `${r}__container`, children: /* @__PURE__ */ f("div", { className: `${r}__container__inner`, ref: $, children: [
|
|
59
|
+
/* @__PURE__ */ a(K, { variant: F.heading4, className: `${r}__container__inner__label`, children: l }),
|
|
60
|
+
/* @__PURE__ */ a(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
...T,
|
|
64
|
+
className: _(r, b, { [`${r}--active`]: t }),
|
|
65
|
+
"data-testid": d,
|
|
66
|
+
role: "search",
|
|
67
|
+
...x,
|
|
68
|
+
children: /* @__PURE__ */ f(
|
|
69
|
+
"form",
|
|
68
70
|
{
|
|
69
|
-
|
|
70
|
-
className:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
children:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
z,
|
|
94
|
-
{
|
|
95
|
-
in: t,
|
|
96
|
-
classNames: `${D}-input`,
|
|
97
|
-
addEndListener: () => {
|
|
98
|
-
},
|
|
99
|
-
children: /* @__PURE__ */ a(
|
|
100
|
-
H,
|
|
101
|
-
{
|
|
102
|
-
"aria-hidden": !t,
|
|
103
|
-
className: `${r}__input`,
|
|
104
|
-
id: "search-input",
|
|
105
|
-
hideLabel: !0,
|
|
106
|
-
labelText: d,
|
|
107
|
-
placeholder: t ? w : "",
|
|
108
|
-
type: "text",
|
|
109
|
-
defaultValue: R,
|
|
110
|
-
invalid: l === "invalid",
|
|
111
|
-
invalidText: k,
|
|
112
|
-
onKeyDown: $,
|
|
113
|
-
onChange: T,
|
|
114
|
-
ref: h
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
/* @__PURE__ */ a(
|
|
120
|
-
q,
|
|
71
|
+
"data-testid": `${d}-form`,
|
|
72
|
+
className: _(`${r}__form`, {
|
|
73
|
+
[`${r}__form--active`]: t
|
|
74
|
+
}),
|
|
75
|
+
ref: p,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ f(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: _(`${r}__content-wrapper`, {
|
|
81
|
+
[`${r}__content-wrapper--active`]: t
|
|
82
|
+
}),
|
|
83
|
+
role: "combobox",
|
|
84
|
+
"aria-haspopup": "listbox",
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ a(
|
|
87
|
+
z,
|
|
88
|
+
{
|
|
89
|
+
in: t,
|
|
90
|
+
classNames: `${D}-input`,
|
|
91
|
+
addEndListener: () => {
|
|
92
|
+
},
|
|
93
|
+
children: /* @__PURE__ */ a(
|
|
94
|
+
H,
|
|
121
95
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
96
|
+
"aria-hidden": !t,
|
|
97
|
+
className: `${r}__input`,
|
|
98
|
+
id: "search-input",
|
|
99
|
+
hideLabel: !0,
|
|
100
|
+
labelText: l,
|
|
101
|
+
placeholder: t ? w : "",
|
|
102
|
+
type: "text",
|
|
103
|
+
defaultValue: E,
|
|
104
|
+
invalid: c === "invalid",
|
|
105
|
+
invalidText: L,
|
|
106
|
+
onKeyDown: g,
|
|
107
|
+
onChange: k,
|
|
108
|
+
ref: h
|
|
129
109
|
}
|
|
130
110
|
)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ a(
|
|
114
|
+
q,
|
|
115
|
+
{
|
|
116
|
+
className: r,
|
|
117
|
+
searchButtonText: l,
|
|
118
|
+
state: c,
|
|
119
|
+
testId: d,
|
|
120
|
+
isSearchExpanded: t,
|
|
121
|
+
setIsSearchExpanded: u,
|
|
122
|
+
onCancel: o
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
s && s.length > 2 ? /* @__PURE__ */ a(
|
|
129
|
+
A,
|
|
130
|
+
{
|
|
131
|
+
autoCompleteResults: R,
|
|
132
|
+
isLoading: c === "loading",
|
|
133
|
+
loadingText: C,
|
|
134
|
+
onKeyDown: g,
|
|
135
|
+
userInputValue: s,
|
|
136
|
+
closeSearch: u,
|
|
137
|
+
children: /* @__PURE__ */ a("li", { className: `${r}__result`, children: /* @__PURE__ */ a(
|
|
138
|
+
O,
|
|
136
139
|
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
loadingText: C,
|
|
140
|
-
onKeyDown: $,
|
|
141
|
-
userInputValue: s,
|
|
142
|
-
children: /* @__PURE__ */ a("li", { className: `${r}__result`, children: /* @__PURE__ */ a(
|
|
143
|
-
O,
|
|
144
|
-
{
|
|
145
|
-
href: ((e) => N(S(e)))(s),
|
|
146
|
-
children: /* @__PURE__ */ a("p", { children: L(s) })
|
|
147
|
-
}
|
|
148
|
-
) }, "viewAllSearchResults")
|
|
140
|
+
href: ((e) => I(v(e)))(s),
|
|
141
|
+
children: /* @__PURE__ */ a("p", { children: P(s) })
|
|
149
142
|
}
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
) }, "viewAllSearchResults")
|
|
144
|
+
}
|
|
145
|
+
) : null
|
|
146
|
+
]
|
|
154
147
|
}
|
|
155
148
|
)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
) });
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] }) });
|
|
159
152
|
};
|
|
160
153
|
export {
|
|
161
154
|
ne as default
|
|
@@ -11,6 +11,7 @@ export interface SearchResultsProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
11
11
|
loadingText?: string;
|
|
12
12
|
onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void;
|
|
13
13
|
userInputValue?: string;
|
|
14
|
+
closeSearch: (value: boolean) => void;
|
|
14
15
|
}
|
|
15
|
-
declare const SearchResults: ({ autoCompleteResults, isLoading, children, loadingText, onKeyDown, userInputValue, }: React.PropsWithChildren<SearchResultsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const SearchResults: ({ autoCompleteResults, isLoading, children, loadingText, onKeyDown, userInputValue, closeSearch, }: React.PropsWithChildren<SearchResultsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default SearchResults;
|
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import { px as
|
|
3
|
-
import
|
|
2
|
+
import { px as e } from "../../../utils/index.js";
|
|
3
|
+
import f from "../../Link/Link.js";
|
|
4
4
|
import { LinkVariants as L } from "../../Link/types.js";
|
|
5
5
|
const w = ({
|
|
6
|
-
autoCompleteResults:
|
|
7
|
-
isLoading:
|
|
8
|
-
children:
|
|
9
|
-
loadingText:
|
|
6
|
+
autoCompleteResults: l = [],
|
|
7
|
+
isLoading: t,
|
|
8
|
+
children: i,
|
|
9
|
+
loadingText: c = "Loading...",
|
|
10
10
|
onKeyDown: o,
|
|
11
|
-
userInputValue: h = ""
|
|
11
|
+
userInputValue: h = "",
|
|
12
|
+
closeSearch: d
|
|
12
13
|
}) => {
|
|
13
|
-
const m = Array.isArray(
|
|
14
|
-
function
|
|
15
|
-
return s.split(new RegExp(`(${
|
|
16
|
-
(
|
|
14
|
+
const m = Array.isArray(l) && l.length > 0;
|
|
15
|
+
function _(s, a) {
|
|
16
|
+
return s.split(new RegExp(`(${a})`, "gi")).map(
|
|
17
|
+
(n, u) => n.toLocaleLowerCase() === a.toLocaleLowerCase() ? /* @__PURE__ */ r("strong", { children: n }, u) : n
|
|
17
18
|
);
|
|
18
19
|
}
|
|
19
|
-
return /* @__PURE__ */ r("div", { className: `${
|
|
20
|
-
|
|
21
|
-
m &&
|
|
22
|
-
|
|
20
|
+
return /* @__PURE__ */ r("div", { className: `${e}-search__results`, children: /* @__PURE__ */ p("ul", { "data-testid": "search-results", className: `${e}-search__results-container`, children: [
|
|
21
|
+
t ? /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: c }) : null,
|
|
22
|
+
m && l.map((s, a) => /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: /* @__PURE__ */ r(
|
|
23
|
+
f,
|
|
24
|
+
{
|
|
25
|
+
href: s.url,
|
|
26
|
+
onKeyDown: o,
|
|
27
|
+
onClick: () => d(!1),
|
|
28
|
+
variant: L.snwFlyoutLink,
|
|
29
|
+
children: /* @__PURE__ */ r("span", { "data-testid": `search-result-${a}`, className: "${px}-search__result__label", children: _(s.label, h) })
|
|
30
|
+
}
|
|
31
|
+
) }, s.id)),
|
|
32
|
+
i
|
|
23
33
|
] }) });
|
|
24
34
|
};
|
|
25
35
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../_virtual/
|
|
1
|
+
import { __module as e } from "../../../../_virtual/index5.js";
|
|
2
2
|
import { __require as o } from "./cjs/react-is.production.min.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.development.js";
|
|
4
4
|
var r;
|
|
@@ -55,13 +55,20 @@
|
|
|
55
55
|
|
|
56
56
|
&--hovered &__submenu {
|
|
57
57
|
left: 0;
|
|
58
|
-
max-height:
|
|
58
|
+
max-height: calc(90vh - #{$header-height});
|
|
59
59
|
opacity: 1;
|
|
60
|
+
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
61
|
+
overflow-y: scroll;
|
|
60
62
|
pointer-events: all;
|
|
63
|
+
scrollbar-width: none; /* Firefox */
|
|
61
64
|
transition:
|
|
62
65
|
max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
|
|
63
66
|
opacity 0.3s cubic-bezier(0.33, 1, 0.68, 1);
|
|
64
67
|
|
|
68
|
+
&::-webkit-scrollbar {
|
|
69
|
+
display: none; /* Safari and Chrome */
|
|
70
|
+
}
|
|
71
|
+
|
|
65
72
|
.#{$px}-nav__list__section {
|
|
66
73
|
opacity: 1;
|
|
67
74
|
}
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import { jsxs as o, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import l, { createContext as
|
|
2
|
+
import l, { createContext as T, forwardRef as P, useState as h } from "react";
|
|
3
3
|
import d from "../../node_modules/classnames/index.js";
|
|
4
|
-
import { findChildrenOfType as s, findChildrenExcludingTypes as
|
|
5
|
-
import
|
|
4
|
+
import { findChildrenOfType as s, findChildrenExcludingTypes as j, px as e } from "../../utils/index.js";
|
|
5
|
+
import R from "../../assets/PhillipsLogo.svg.js";
|
|
6
6
|
import p from "../../patterns/UserManagement/UserManagement.js";
|
|
7
7
|
import g from "../../patterns/LanguageSelector/LanguageSelector.js";
|
|
8
8
|
import f from "../../components/Navigation/Navigation.js";
|
|
9
|
-
import { defaultHeaderContext as
|
|
10
|
-
import { SSRMediaQuery as
|
|
11
|
-
const
|
|
9
|
+
import { defaultHeaderContext as w } from "./utils.js";
|
|
10
|
+
import { SSRMediaQuery as I } from "../../providers/SeldonProvider/utils.js";
|
|
11
|
+
const L = T(w), k = P(
|
|
12
12
|
({
|
|
13
|
-
logo: i = /* @__PURE__ */ a(
|
|
14
|
-
|
|
13
|
+
logo: i = /* @__PURE__ */ a(R, {}),
|
|
14
|
+
logoHref: u = "/",
|
|
15
|
+
className: _,
|
|
15
16
|
children: r,
|
|
16
|
-
toggleOpenText:
|
|
17
|
-
toggleCloseText:
|
|
18
|
-
logoText:
|
|
19
|
-
...
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
|
|
17
|
+
toggleOpenText: v = "Open Menu",
|
|
18
|
+
toggleCloseText: x = "Close Menu",
|
|
19
|
+
logoText: C = "Home Page",
|
|
20
|
+
...y
|
|
21
|
+
}, E) => {
|
|
22
|
+
const M = s(r, p), m = s(r, g), [c, $] = h(!1), b = s(r, f), N = j(r, [f, p, g]), [n, S] = h(!1), H = n ? x : v, O = function() {
|
|
23
|
+
S((t) => !t);
|
|
23
24
|
};
|
|
24
|
-
return /* @__PURE__ */ o("header", { ...
|
|
25
|
+
return /* @__PURE__ */ o("header", { ...y, className: d(`${e}-header`, _), ref: E, children: [
|
|
25
26
|
/* @__PURE__ */ o("div", { className: `${e}-header__top-row`, children: [
|
|
26
|
-
/* @__PURE__ */ a(
|
|
27
|
+
/* @__PURE__ */ a(I.Media, { greaterThanOrEqual: "md", children: m }),
|
|
27
28
|
/* @__PURE__ */ o(
|
|
28
29
|
"button",
|
|
29
30
|
{
|
|
30
|
-
"aria-label":
|
|
31
|
+
"aria-label": H,
|
|
31
32
|
"data-testid": "mobile-menu-toggle",
|
|
32
33
|
type: "button",
|
|
33
|
-
onClick:
|
|
34
|
+
onClick: O,
|
|
34
35
|
className: d(`${e}-header__toggle-btn`, {
|
|
35
36
|
[`${e}-header__toggle-btn--open`]: n
|
|
36
37
|
}),
|
|
@@ -40,20 +41,20 @@ const I = O(R), L = T(
|
|
|
40
41
|
]
|
|
41
42
|
}
|
|
42
43
|
),
|
|
43
|
-
/* @__PURE__ */ a("h1", { "data-testid": "header-logo", className: `${e}-header__logo`, children: /* @__PURE__ */ a("a", { href:
|
|
44
|
-
|
|
44
|
+
/* @__PURE__ */ a("h1", { "data-testid": "header-logo", className: `${e}-header__logo`, children: /* @__PURE__ */ a("a", { href: u, "aria-label": C, children: typeof i == "object" ? i : /* @__PURE__ */ a("img", { alt: "Phillips", "data-testid": "header-logo-img", src: i, height: "14" }) }) }),
|
|
45
|
+
M
|
|
45
46
|
] }),
|
|
46
47
|
/* @__PURE__ */ a("div", { className: d(`${e}-header__nav`, { [`${e}-header__nav--closed`]: !n }), children: /* @__PURE__ */ o(
|
|
47
|
-
|
|
48
|
+
L.Provider,
|
|
48
49
|
{
|
|
49
50
|
value: {
|
|
50
51
|
isMenuOpen: n,
|
|
51
52
|
isSearchExpanded: c,
|
|
52
|
-
setIsSearchExpanded:
|
|
53
|
+
setIsSearchExpanded: $
|
|
53
54
|
},
|
|
54
55
|
children: [
|
|
55
56
|
l.Children.map(
|
|
56
|
-
|
|
57
|
+
b,
|
|
57
58
|
(t) => l.isValidElement(t) ? l.cloneElement(t, {
|
|
58
59
|
children: [
|
|
59
60
|
...l.Children.toArray(t.props.children),
|
|
@@ -61,7 +62,7 @@ const I = O(R), L = T(
|
|
|
61
62
|
]
|
|
62
63
|
}) : t
|
|
63
64
|
),
|
|
64
|
-
|
|
65
|
+
N
|
|
65
66
|
]
|
|
66
67
|
}
|
|
67
68
|
) }),
|
|
@@ -76,8 +77,8 @@ const I = O(R), L = T(
|
|
|
76
77
|
] });
|
|
77
78
|
}
|
|
78
79
|
);
|
|
79
|
-
|
|
80
|
+
k.displayName = "Header";
|
|
80
81
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
L as HeaderContext,
|
|
83
|
+
k as default
|
|
83
84
|
};
|