@phillips/seldon 1.66.0 → 1.67.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 +23 -22
- package/dist/components/Search/SearchResults/SearchResults.d.ts +2 -1
- package/dist/components/Search/SearchResults/SearchResults.js +21 -15
- package/dist/scss/componentStyles.scss +0 -1
- package/dist/scss/components/Search/SearchResults/_searchResults.scss +4 -0
- package/dist/scss/components/Search/_search.scss +17 -2
- package/dist/scss/components/Search/_searchButton.scss +15 -5
- package/dist/scss/site-furniture/Header/_header.scss +1 -1
- package/package.json +1 -1
- package/dist/scss/components/HTMLParser/_htmlParser.scss +0 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
1
|
+
import { jsx as a, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import i, { useEffect as y } from "react";
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import { getCommonProps as V, px as j, encodeURLSearchParams as g } from "../../utils/index.js";
|
|
4
|
+
import f from "../../node_modules/classnames/index.js";
|
|
5
|
+
import D from "../Input/Input.js";
|
|
6
|
+
import H from "../Link/Link.js";
|
|
7
|
+
import O from "./SearchResults/SearchResults.js";
|
|
8
8
|
import { TextVariants as A } from "../Text/types.js";
|
|
9
9
|
import F from "../Text/Text.js";
|
|
10
10
|
import { useOnClickOutside as K } from "../../node_modules/usehooks-ts/dist/index.js";
|
|
@@ -12,11 +12,11 @@ import { HeaderContext as M } from "../../site-furniture/Header/Header.js";
|
|
|
12
12
|
import { SearchButton as U } from "./SearchButton.js";
|
|
13
13
|
import q from "../../node_modules/react-transition-group/esm/CSSTransition.js";
|
|
14
14
|
const ne = ({
|
|
15
|
-
onSearch:
|
|
15
|
+
onSearch: p,
|
|
16
16
|
searchResults: C = [],
|
|
17
17
|
state: c = "idle",
|
|
18
|
-
defaultValue:
|
|
19
|
-
className:
|
|
18
|
+
defaultValue: I = "",
|
|
19
|
+
className: E,
|
|
20
20
|
placeholder: R = "",
|
|
21
21
|
searchButtonText: l = "Search",
|
|
22
22
|
loadingText: b = "Search In Progress...",
|
|
@@ -26,8 +26,8 @@ const ne = ({
|
|
|
26
26
|
...S
|
|
27
27
|
}) => {
|
|
28
28
|
var N;
|
|
29
|
-
const { className: e, "data-testid": d, ...L } =
|
|
30
|
-
|
|
29
|
+
const { className: e, "data-testid": d, ...L } = V(S, "Search"), o = i.useContext(M), m = i.useRef(null), h = i.useRef(null), v = i.useRef(null), t = o.isSearchExpanded, n = (N = m.current) == null ? void 0 : N.value, T = p ? (r) => {
|
|
30
|
+
p(r.target.value);
|
|
31
31
|
} : void 0;
|
|
32
32
|
K(v, () => $(!1));
|
|
33
33
|
const x = (r) => {
|
|
@@ -52,7 +52,7 @@ const ne = ({
|
|
|
52
52
|
var s;
|
|
53
53
|
o.setIsSearchExpanded(r), (s = h.current) == null || s.reset();
|
|
54
54
|
};
|
|
55
|
-
return /* @__PURE__ */ a("div", { className: `${e}__container`, children: /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ a("div", { className: `${e}__container`, children: /* @__PURE__ */ u(
|
|
56
56
|
"div",
|
|
57
57
|
{
|
|
58
58
|
onClick: () => o.setIsSearchExpanded(!0),
|
|
@@ -64,23 +64,23 @@ const ne = ({
|
|
|
64
64
|
"div",
|
|
65
65
|
{
|
|
66
66
|
...L,
|
|
67
|
-
className:
|
|
67
|
+
className: f(e, E, { [`${e}--active`]: t }),
|
|
68
68
|
"data-testid": d,
|
|
69
69
|
role: "search",
|
|
70
70
|
...S,
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ u(
|
|
72
72
|
"form",
|
|
73
73
|
{
|
|
74
74
|
"data-testid": `${d}-form`,
|
|
75
|
-
className:
|
|
75
|
+
className: f(`${e}__form`, {
|
|
76
76
|
[`${e}__form--active`]: t
|
|
77
77
|
}),
|
|
78
78
|
ref: h,
|
|
79
79
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ u(
|
|
81
81
|
"div",
|
|
82
82
|
{
|
|
83
|
-
className:
|
|
83
|
+
className: f(`${e}__content-wrapper`, {
|
|
84
84
|
[`${e}__content-wrapper--active`]: t
|
|
85
85
|
}),
|
|
86
86
|
role: "combobox",
|
|
@@ -90,11 +90,11 @@ const ne = ({
|
|
|
90
90
|
q,
|
|
91
91
|
{
|
|
92
92
|
in: t,
|
|
93
|
-
classNames: `${
|
|
93
|
+
classNames: `${j}-input`,
|
|
94
94
|
addEndListener: () => {
|
|
95
95
|
},
|
|
96
96
|
children: /* @__PURE__ */ a(
|
|
97
|
-
|
|
97
|
+
D,
|
|
98
98
|
{
|
|
99
99
|
"aria-hidden": !t,
|
|
100
100
|
className: `${e}__input`,
|
|
@@ -103,7 +103,7 @@ const ne = ({
|
|
|
103
103
|
labelText: l,
|
|
104
104
|
placeholder: t ? R : "",
|
|
105
105
|
type: "text",
|
|
106
|
-
defaultValue:
|
|
106
|
+
defaultValue: I,
|
|
107
107
|
invalid: c === "invalid",
|
|
108
108
|
invalidText: w,
|
|
109
109
|
onKeyDown: x,
|
|
@@ -128,14 +128,15 @@ const ne = ({
|
|
|
128
128
|
}
|
|
129
129
|
),
|
|
130
130
|
n && n.length > 2 ? /* @__PURE__ */ a(
|
|
131
|
-
|
|
131
|
+
O,
|
|
132
132
|
{
|
|
133
133
|
autoCompleteResults: C,
|
|
134
134
|
isLoading: c === "loading",
|
|
135
135
|
loadingText: b,
|
|
136
136
|
onKeyDown: x,
|
|
137
|
+
userInputValue: n,
|
|
137
138
|
children: /* @__PURE__ */ a("li", { className: `${e}__result`, children: /* @__PURE__ */ a(
|
|
138
|
-
|
|
139
|
+
H,
|
|
139
140
|
{
|
|
140
141
|
href: ((r) => g(_(r)))(n),
|
|
141
142
|
children: /* @__PURE__ */ a("p", { children: k(n) })
|
|
@@ -10,6 +10,7 @@ export interface SearchResultsProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
loadingText?: string;
|
|
12
12
|
onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void;
|
|
13
|
+
userInputValue?: string;
|
|
13
14
|
}
|
|
14
|
-
declare const SearchResults: ({ autoCompleteResults, isLoading, children, loadingText, onKeyDown, }: React.PropsWithChildren<SearchResultsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare const SearchResults: ({ autoCompleteResults, isLoading, children, loadingText, onKeyDown, userInputValue, }: React.PropsWithChildren<SearchResultsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export default SearchResults;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { px as
|
|
3
|
-
import
|
|
4
|
-
import { LinkVariants as
|
|
5
|
-
const
|
|
6
|
-
autoCompleteResults:
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { px as a } from "../../../utils/index.js";
|
|
3
|
+
import u from "../../Link/Link.js";
|
|
4
|
+
import { LinkVariants as L } from "../../Link/types.js";
|
|
5
|
+
const w = ({
|
|
6
|
+
autoCompleteResults: e = [],
|
|
7
7
|
isLoading: i,
|
|
8
|
-
children:
|
|
9
|
-
loadingText:
|
|
10
|
-
onKeyDown:
|
|
8
|
+
children: c,
|
|
9
|
+
loadingText: t = "Loading...",
|
|
10
|
+
onKeyDown: o,
|
|
11
|
+
userInputValue: h = ""
|
|
11
12
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const m = Array.isArray(e) && e.length > 0;
|
|
14
|
+
function d(s, n) {
|
|
15
|
+
return s.split(new RegExp(`(${n})`, "gi")).map(
|
|
16
|
+
(l, _) => l.toLocaleLowerCase() === n.toLocaleLowerCase() ? /* @__PURE__ */ r("strong", { children: l }, _) : l
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ r("div", { className: `${a}-search__results`, children: /* @__PURE__ */ p("ul", { "data-testid": "search-results", className: `${a}-search__results-container`, children: [
|
|
20
|
+
i ? /* @__PURE__ */ r("li", { className: `${a}-search__result`, children: t }) : null,
|
|
21
|
+
m && e.map((s) => /* @__PURE__ */ r("li", { className: `${a}-search__result`, children: /* @__PURE__ */ r(u, { href: s.url, onKeyDown: o, variant: L.snwFlyoutLink, children: /* @__PURE__ */ r("span", { className: "${px}-search__result__label", children: d(s.label, h) }) }) }, s.id)),
|
|
22
|
+
c
|
|
17
23
|
] }) });
|
|
18
24
|
};
|
|
19
25
|
export {
|
|
20
|
-
|
|
26
|
+
w as default
|
|
21
27
|
};
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
@use 'components/Accordion/accordion';
|
|
31
31
|
@use 'components/Breadcrumb/breadcrumb';
|
|
32
32
|
@use 'components/Drawer/drawer';
|
|
33
|
-
@use 'components/HTMLParser/htmlParser';
|
|
34
33
|
@use 'components/Dropdown/dropdown';
|
|
35
34
|
@use 'components/Video/video';
|
|
36
35
|
@use 'components/Pagination/pagination';
|
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
top: $padding-md;
|
|
12
12
|
transition: left 0.25s ease-in;
|
|
13
13
|
|
|
14
|
+
&::after {
|
|
15
|
+
border-bottom: 1px solid #000;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
content: '';
|
|
18
|
+
display: flex;
|
|
19
|
+
margin-bottom: -1px;
|
|
20
|
+
position: absolute;
|
|
21
|
+
right: 0;
|
|
22
|
+
transition: width 0.25s ease-in;
|
|
23
|
+
width: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
@include isHeaderDesktop {
|
|
15
27
|
top: 0;
|
|
16
28
|
}
|
|
@@ -25,13 +37,17 @@
|
|
|
25
37
|
left: 0;
|
|
26
38
|
transition: left 0.25s ease-in 0.2s;
|
|
27
39
|
|
|
40
|
+
&::after {
|
|
41
|
+
transition: width 0.25s ease-in 0.2s;
|
|
42
|
+
width: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
28
45
|
@include isHeaderMobile {
|
|
29
46
|
left: $spacing-md;
|
|
30
47
|
}
|
|
31
48
|
}
|
|
32
49
|
|
|
33
50
|
&__input-status-icon {
|
|
34
|
-
border-bottom: 1px solid $pure-black;
|
|
35
51
|
height: $search-size;
|
|
36
52
|
width: $search-size;
|
|
37
53
|
|
|
@@ -81,7 +97,6 @@
|
|
|
81
97
|
&__input {
|
|
82
98
|
background: transparent;
|
|
83
99
|
border: 0;
|
|
84
|
-
border-bottom: 1px solid $pure-black;
|
|
85
100
|
border-radius: unset;
|
|
86
101
|
color: $pure-black;
|
|
87
102
|
font-size: $string-size1;
|
|
@@ -26,10 +26,6 @@
|
|
|
26
26
|
padding: 0 0 0.125rem;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
&--close {
|
|
30
|
-
border-bottom: 1px solid $pure-black;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
svg {
|
|
34
30
|
height: 1.5rem;
|
|
35
31
|
width: 1.5rem;
|
|
@@ -38,7 +34,21 @@
|
|
|
38
34
|
&:hover,
|
|
39
35
|
&:focus-visible,
|
|
40
36
|
&:active {
|
|
41
|
-
|
|
37
|
+
&::after {
|
|
38
|
+
border-bottom: 1px solid #000;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
content: '';
|
|
41
|
+
display: flex;
|
|
42
|
+
margin-bottom: -2px;
|
|
43
|
+
position: absolute;
|
|
44
|
+
right: 0;
|
|
45
|
+
width: 102%;
|
|
46
|
+
|
|
47
|
+
@include isHeaderMobile {
|
|
48
|
+
margin-bottom: -1px;
|
|
49
|
+
width: 52%;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
&__icon {
|
package/package.json
CHANGED