@phillips/seldon 1.130.0 → 1.130.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.
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { getCommonProps as
|
|
1
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import n, { useEffect as V } from "react";
|
|
3
|
+
import { getCommonProps as j, px as D, encodeURLSearchParams as $ } from "../../utils/index.js";
|
|
4
4
|
import p from "../../node_modules/classnames/index.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { TextVariants as
|
|
9
|
-
import
|
|
10
|
-
import { useOnClickOutside as
|
|
11
|
-
import { HeaderContext as
|
|
12
|
-
import { SearchButton as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
onSearch:
|
|
17
|
-
onCancel:
|
|
18
|
-
searchResults:
|
|
19
|
-
state:
|
|
20
|
-
defaultValue:
|
|
21
|
-
className:
|
|
5
|
+
import H from "../Input/Input.js";
|
|
6
|
+
import O from "../Link/Link.js";
|
|
7
|
+
import A from "./SearchResults/SearchResults.js";
|
|
8
|
+
import { TextVariants as F } from "../Text/types.js";
|
|
9
|
+
import K from "../Text/Text.js";
|
|
10
|
+
import { useOnClickOutside as M } from "../../node_modules/usehooks-ts/dist/index.js";
|
|
11
|
+
import { HeaderContext as U } from "../../site-furniture/Header/Header.js";
|
|
12
|
+
import { SearchButton as Z } from "./SearchButton.js";
|
|
13
|
+
import q from "../../node_modules/react-remove-scroll/dist/es2015/Combination.js";
|
|
14
|
+
import z from "../../node_modules/react-transition-group/esm/CSSTransition.js";
|
|
15
|
+
const ie = ({
|
|
16
|
+
onSearch: _,
|
|
17
|
+
onCancel: S,
|
|
18
|
+
searchResults: N = [],
|
|
19
|
+
state: o = "idle",
|
|
20
|
+
defaultValue: w = "",
|
|
21
|
+
className: C,
|
|
22
22
|
placeholder: I = "",
|
|
23
|
-
searchButtonText:
|
|
23
|
+
searchButtonText: i = "Search",
|
|
24
24
|
loadingText: E = "Search In Progress...",
|
|
25
25
|
invalidText: b = "Invalid search",
|
|
26
|
-
getAllResultsText:
|
|
27
|
-
getAllResultsLink:
|
|
28
|
-
...
|
|
26
|
+
getAllResultsText: P = (e) => `View all results for ${e}`,
|
|
27
|
+
getAllResultsLink: v = (e) => `/Search?Search=${e}`,
|
|
28
|
+
...x
|
|
29
29
|
}) => {
|
|
30
|
-
const { className: e, "data-testid":
|
|
31
|
-
|
|
30
|
+
const { className: e, "data-testid": c, ...k } = j(x, "Search"), l = n.useContext(U), d = n.useRef(null), m = n.useRef(null), R = n.useRef(null), a = l.isSearchExpanded, s = d.current?.value, [L, u] = n.useState(!0), T = _ ? (r) => {
|
|
31
|
+
_(r.target.value);
|
|
32
32
|
} : void 0;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
M(R, (r) => {
|
|
34
|
+
S?.(), h(!1), r.stopPropagation();
|
|
35
35
|
});
|
|
36
36
|
const g = (r) => {
|
|
37
37
|
if (r.stopPropagation(), r.key === "Enter") {
|
|
38
|
-
if (r.preventDefault(),
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
if (r.preventDefault(), s && s.length > 2) {
|
|
39
|
+
const y = $(v(s));
|
|
40
|
+
u(!1), window.location.href = y;
|
|
41
41
|
}
|
|
42
|
-
r.currentTarget instanceof HTMLAnchorElement && (
|
|
42
|
+
r.currentTarget instanceof HTMLAnchorElement && (u(!1), r.currentTarget.click());
|
|
43
43
|
}
|
|
44
|
-
r.key === "Escape" && (
|
|
44
|
+
r.key === "Escape" && (m.current?.reset(), l.setIsSearchExpanded(!1));
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
V(() => {
|
|
47
47
|
if (a) {
|
|
48
|
-
|
|
48
|
+
d.current?.focus();
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
}, [a]);
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const h = (r) => {
|
|
53
|
+
m.current?.reset(), l.setIsSearchExpanded(r);
|
|
54
54
|
};
|
|
55
|
-
return /* @__PURE__ */ t(
|
|
55
|
+
return /* @__PURE__ */ t(q, { enabled: a, allowPinchZoom: !0, removeScrollBar: !1, children: /* @__PURE__ */ t("div", { className: `${e}__container`, children: /* @__PURE__ */ f(
|
|
56
56
|
"div",
|
|
57
57
|
{
|
|
58
58
|
className: `${e}__container__inner`,
|
|
59
|
-
ref:
|
|
59
|
+
ref: R,
|
|
60
60
|
onClick: (r) => {
|
|
61
|
-
a || (
|
|
61
|
+
a || (h(!0), r.stopPropagation());
|
|
62
62
|
},
|
|
63
63
|
children: [
|
|
64
|
-
/* @__PURE__ */ t(
|
|
64
|
+
/* @__PURE__ */ t(K, { variant: F.heading4, className: `${e}__container__inner__label`, children: i }),
|
|
65
65
|
/* @__PURE__ */ t(
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
68
|
-
...
|
|
69
|
-
className: p(e,
|
|
70
|
-
"data-testid":
|
|
68
|
+
...k,
|
|
69
|
+
className: p(e, C, { [`${e}--active`]: a }),
|
|
70
|
+
"data-testid": c,
|
|
71
71
|
role: "search",
|
|
72
|
-
...
|
|
73
|
-
children: /* @__PURE__ */
|
|
72
|
+
...x,
|
|
73
|
+
children: /* @__PURE__ */ f(
|
|
74
74
|
"form",
|
|
75
75
|
{
|
|
76
|
-
"data-testid": `${
|
|
76
|
+
"data-testid": `${c}-form`,
|
|
77
77
|
className: p(`${e}__form`, {
|
|
78
78
|
[`${e}__form--active`]: a
|
|
79
79
|
}),
|
|
80
|
-
ref:
|
|
80
|
+
ref: m,
|
|
81
81
|
children: [
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ f(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
className: p(`${e}__content-wrapper`, {
|
|
@@ -89,62 +89,61 @@ const oe = ({
|
|
|
89
89
|
"aria-haspopup": "listbox",
|
|
90
90
|
children: [
|
|
91
91
|
/* @__PURE__ */ t(
|
|
92
|
-
|
|
92
|
+
z,
|
|
93
93
|
{
|
|
94
94
|
in: a,
|
|
95
|
-
classNames: `${
|
|
95
|
+
classNames: `${D}-input`,
|
|
96
96
|
addEndListener: () => {
|
|
97
97
|
},
|
|
98
98
|
children: /* @__PURE__ */ t(
|
|
99
|
-
|
|
99
|
+
H,
|
|
100
100
|
{
|
|
101
101
|
"aria-hidden": !a,
|
|
102
102
|
className: `${e}__input`,
|
|
103
103
|
id: "search-input",
|
|
104
104
|
hideLabel: !0,
|
|
105
|
-
labelText:
|
|
105
|
+
labelText: i,
|
|
106
106
|
placeholder: a ? I : "",
|
|
107
107
|
type: "text",
|
|
108
|
-
defaultValue:
|
|
109
|
-
invalid:
|
|
108
|
+
defaultValue: w,
|
|
109
|
+
invalid: o === "invalid",
|
|
110
110
|
invalidText: b,
|
|
111
111
|
onKeyDown: g,
|
|
112
|
-
onChange:
|
|
113
|
-
ref:
|
|
112
|
+
onChange: T,
|
|
113
|
+
ref: d
|
|
114
114
|
}
|
|
115
115
|
)
|
|
116
116
|
}
|
|
117
117
|
),
|
|
118
118
|
/* @__PURE__ */ t(
|
|
119
|
-
|
|
119
|
+
Z,
|
|
120
120
|
{
|
|
121
121
|
className: e,
|
|
122
|
-
searchButtonText:
|
|
123
|
-
state:
|
|
124
|
-
testId:
|
|
122
|
+
searchButtonText: i,
|
|
123
|
+
state: o,
|
|
124
|
+
testId: c,
|
|
125
125
|
isSearchExpanded: a,
|
|
126
|
-
setIsSearchExpanded:
|
|
127
|
-
onCancel:
|
|
126
|
+
setIsSearchExpanded: h,
|
|
127
|
+
onCancel: S
|
|
128
128
|
}
|
|
129
129
|
)
|
|
130
130
|
]
|
|
131
131
|
}
|
|
132
132
|
),
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
a && L && s && s.length > 2 ? /* @__PURE__ */ t(
|
|
134
|
+
A,
|
|
135
135
|
{
|
|
136
|
-
autoCompleteResults:
|
|
137
|
-
isLoading:
|
|
136
|
+
autoCompleteResults: N,
|
|
137
|
+
isLoading: o === "loading",
|
|
138
138
|
loadingText: E,
|
|
139
139
|
onKeyDown: g,
|
|
140
|
-
userInputValue:
|
|
141
|
-
closeSearch:
|
|
140
|
+
userInputValue: s,
|
|
141
|
+
closeSearch: u,
|
|
142
142
|
children: /* @__PURE__ */ t("li", { className: `${e}__result`, children: /* @__PURE__ */ t(
|
|
143
|
-
|
|
143
|
+
O,
|
|
144
144
|
{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
children: /* @__PURE__ */ t("p", { children: w(n) })
|
|
145
|
+
href: ((r) => $(v(r)))(s),
|
|
146
|
+
children: /* @__PURE__ */ t("p", { children: P(s) })
|
|
148
147
|
}
|
|
149
148
|
) }, "viewAllSearchResults")
|
|
150
149
|
}
|
|
@@ -159,5 +158,5 @@ const oe = ({
|
|
|
159
158
|
) }) });
|
|
160
159
|
};
|
|
161
160
|
export {
|
|
162
|
-
|
|
161
|
+
ie as default
|
|
163
162
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../_virtual/
|
|
1
|
+
import { __module as e } from "../../../../_virtual/index6.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;
|
package/dist/scss/_vars.scss
CHANGED
|
@@ -103,9 +103,10 @@ $snwHeaderLink: 'snwHeaderLink';
|
|
|
103
103
|
$snwFlyoutLink: 'snwFlyoutLink';
|
|
104
104
|
$snwHeadingHero1: 'snwHeadingHero1';
|
|
105
105
|
$snwHeadingHero2: 'snwHeadingHero2';
|
|
106
|
-
$text-tokens:
|
|
107
|
-
$
|
|
108
|
-
$
|
|
106
|
+
$text-tokens:
|
|
107
|
+
$button, $link, $email, $label, $badge, $blockquote, $heading1, $heading2, $heading3, $heading4, $heading5, $title1,
|
|
108
|
+
$title2, $title3, $title4, $body1, $body2, $body3, $string1, $string2, $string3, $snwFlyoutLink, $snwHeaderLink,
|
|
109
|
+
$snwHeadingHero1, $snwHeadingHero2;
|
|
109
110
|
|
|
110
111
|
////////////////////////
|
|
111
112
|
/// Breakpoint TOKENS to be used for min-width comparisons, make sure they match BREAKPOINTS in constants.ts
|