@caseparts-org/caseblocks 0.0.234 → 0.0.236
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/assets/SuggestionDropdown.css +1 -1
- package/dist/organisms/MainNav/MainNav.d.ts +2 -0
- package/dist/organisms/MainNav/MainNav.js +209 -161
- package/dist/organisms/MainNav/MainNav.stories.js +40 -39
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.d.ts +5 -1
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.js +113 -62
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._suggestionDropdown_1udz7_1{display:flex;flex-direction:row;width:100%;border:1px solid;border-color:var(--color-neutrals-neutral-2);border-radius:var(--border-radius-sm);box-shadow:0 8px 24px #0f172a14;overflow:hidden}@media (max-width: 767px){._suggestionDropdown_1udz7_1{flex-direction:column}}._leftColumn_1udz7_31{display:flex;flex-direction:column;border-right:1px solid var(--border-border-primary);background:var(--color-brand-primary-primary-pale-gray);min-width:150px}@media (max-width: 767px){._leftColumn_1udz7_31{border-right:0;border-bottom:1px solid var(--border-border-primary)}}._leftColumnFullWidth_1udz7_55{flex:1}._suggestionSectionFullHeight_1udz7_63{display:flex;flex:1}._rightColumn_1udz7_73{display:flex;flex:1;flex-direction:column;gap:var(--spacing-spacing-1xs);padding:var(--spacing-spacing-default);background:var(--color-brand-primary-white);min-width:250px}._categorySection_1udz7_95{border-top:1px solid var(--border-border-primary)}._suggestions_1udz7_101,._categories_1udz7_103{display:flex;flex-direction:column;gap:0;padding:0}._suggestionsFullHeight_1udz7_117{flex:1}._suggestions_1udz7_101>:first-child,._categories_1udz7_103>:first-child{padding-top:var(--spacing-spacing-default);padding-right:var(--spacing-spacing-default);padding-left:var(--spacing-spacing-default);padding-bottom:var(--spacing-spacing-2xs)}._suggestions_1udz7_101>:last-child{padding-bottom:var(--spacing-spacing-2xs)}._suggestionLink_1udz7_147,._categoryLink_1udz7_149{display:block;box-sizing:border-box;width:100%;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default)}._activeOption_1udz7_163{background:var(--color-brand-primary-white);outline:2px solid var(--text-text-links);outline-offset:-2px}._itemList_1udz7_175{margin:0;padding:0;display:flex;flex-direction:column;gap:var(--spacing-spacing-2xs);width:100%}._item_1udz7_175{display:flex;flex-direction:column;border:1px solid var(--border-border-primary);padding:var(--spacing-spacing-2xs);width:100%}._activeItem_1udz7_209{border-color:var(--text-text-links);box-shadow:inset 0 0 0 1px var(--text-text-links)}._item_1udz7_175 img{height:60px;width:60px}._item_1udz7_175 a{display:flex;flex-direction:row;align-items:flex-start;gap:var(--spacing-spacing-2xs)}._itemInfo_1udz7_243{display:grid;gap:var(--spacing-spacing-4xs)}._recentSearches_1udz7_253{display:flex;flex-direction:column;background:var(--color-brand-primary-white);min-width:250px}._recentSearchesHeader_1udz7_267{padding:var(--spacing-spacing-default) var(--spacing-spacing-default) var(--spacing-spacing-2xs)}._recentSearchesList_1udz7_275{display:flex;flex-direction:column;gap:0;margin:0;padding:0}._recentSearch_1udz7_253{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-spacing-2xs)}._recentSearchLink_1udz7_305{display:flex;flex:1;min-width:0;align-items:center;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default)}._clearRecentSearch_1udz7_321{display:flex;flex:0 0 auto;align-items:center;justify-content:center;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default);border:0;background:transparent;color:var(--text-text-primary);cursor:pointer}
|
|
@@ -16,6 +16,8 @@ export interface MainNavProps extends CartPropsBase, React.HTMLAttributes<HTMLDi
|
|
|
16
16
|
searchInputProps?: Omit<InputProps, "label" | "variant">;
|
|
17
17
|
/** Current value of the consumer-controlled search input. */
|
|
18
18
|
searchValue?: string;
|
|
19
|
+
/** Updates the consumer-controlled search input value. */
|
|
20
|
+
onSearchValueChange?: (_searchValue: string) => void;
|
|
19
21
|
onClearSearch?: () => void;
|
|
20
22
|
onSearch?: (_searchValue: string) => void;
|
|
21
23
|
/** Type-ahead results supplied by the consumer after a search input change. */
|
|
@@ -1,96 +1,126 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { Text as
|
|
4
|
-
import { Link as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Flex as
|
|
7
|
-
import { Grid as
|
|
8
|
-
import { Input as
|
|
9
|
-
import { InputEndAdornmentButton as
|
|
10
|
-
import { Logo as
|
|
11
|
-
import { HamburgerMenu as
|
|
12
|
-
import { ShoppingCart as
|
|
13
|
-
import { Account as
|
|
14
|
-
import { CategoryNav as
|
|
1
|
+
import { jsx as o, jsxs as l, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import x from "react";
|
|
3
|
+
import { Text as O } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Link as U } from "../../atoms/Link/Link.js";
|
|
5
|
+
import { Icon as _ } from "../../atoms/Icon/Icon.js";
|
|
6
|
+
import { Flex as g } from "../../atoms/Flex/Flex.js";
|
|
7
|
+
import { Grid as ni, Column as li } from "../../atoms/Grid/Grid.js";
|
|
8
|
+
import { Input as Q } from "../../atoms/Input/Input.js";
|
|
9
|
+
import { InputEndAdornmentButton as z } from "../../atoms/InputEndAdornmentButton/InputEndAdornmentButton.js";
|
|
10
|
+
import { Logo as mi } from "../../molecules/Logo/Logo.js";
|
|
11
|
+
import { HamburgerMenu as ai } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
|
|
12
|
+
import { ShoppingCart as ci } from "../../molecules/Cart/Cart.js";
|
|
13
|
+
import { Account as di } from "../../molecules/Account/Account.js";
|
|
14
|
+
import { CategoryNav as si } from "../../molecules/CategoryNav/CategoryNav.js";
|
|
15
15
|
import { SuggestionDropdown as p } from "../SuggestionDropdown/SuggestionDropdown.js";
|
|
16
|
-
import { getHideAtStyles as
|
|
17
|
-
import { c as
|
|
18
|
-
import '../../assets/MainNav.css';const
|
|
19
|
-
main:
|
|
20
|
-
column:
|
|
21
|
-
topNav:
|
|
22
|
-
logo:
|
|
23
|
-
operations:
|
|
24
|
-
search:
|
|
25
|
-
mobileSearch:
|
|
26
|
-
suggestionDropdown:
|
|
27
|
-
siteLink:
|
|
28
|
-
accountArea:
|
|
29
|
-
category:
|
|
30
|
-
categoryLink:
|
|
31
|
-
menuList:
|
|
32
|
-
menuItemAction:
|
|
33
|
-
shortcutIcon:
|
|
34
|
-
},
|
|
35
|
-
account:
|
|
36
|
-
categories:
|
|
37
|
-
homeRoute:
|
|
38
|
-
faqRoute:
|
|
39
|
-
customPartsRoute:
|
|
40
|
-
aboutUsRoute:
|
|
41
|
-
contactRoute:
|
|
42
|
-
cart:
|
|
43
|
-
open:
|
|
16
|
+
import { getHideAtStyles as W } from "../../atoms/HideAt.js";
|
|
17
|
+
import { c as N } from "../../clsx-OuTLNxxd.js";
|
|
18
|
+
import '../../assets/MainNav.css';const fi = "_main_12974_1", ri = "_column_12974_8", _i = "_topNav_12974_13", Ni = "_logo_12974_21", yi = "_operations_12974_24", ui = "_search_12974_31", ki = "_mobileSearch_12974_36", wi = "_suggestionDropdown_12974_39", Ai = "_siteLink_12974_45", Di = "_accountArea_12974_72", bi = "_category_12974_84", vi = "_categoryLink_12974_92", xi = "_menuList_12974_108", Li = "_menuItemAction_12974_131", Ki = "_shortcutIcon_12974_140", i = {
|
|
19
|
+
main: fi,
|
|
20
|
+
column: ri,
|
|
21
|
+
topNav: _i,
|
|
22
|
+
logo: Ni,
|
|
23
|
+
operations: yi,
|
|
24
|
+
search: ui,
|
|
25
|
+
mobileSearch: ki,
|
|
26
|
+
suggestionDropdown: wi,
|
|
27
|
+
siteLink: Ai,
|
|
28
|
+
accountArea: Di,
|
|
29
|
+
category: bi,
|
|
30
|
+
categoryLink: vi,
|
|
31
|
+
menuList: xi,
|
|
32
|
+
menuItemAction: Li,
|
|
33
|
+
shortcutIcon: Ki
|
|
34
|
+
}, Qi = x.forwardRef(function({
|
|
35
|
+
account: B,
|
|
36
|
+
categories: A,
|
|
37
|
+
homeRoute: J,
|
|
38
|
+
faqRoute: X,
|
|
39
|
+
customPartsRoute: E,
|
|
40
|
+
aboutUsRoute: Y,
|
|
41
|
+
contactRoute: I,
|
|
42
|
+
cart: Z,
|
|
43
|
+
open: C,
|
|
44
44
|
// consume external panel control props from CartPropsBase
|
|
45
|
-
className:
|
|
46
|
-
onLoginClick:
|
|
47
|
-
searchInputProps:
|
|
48
|
-
searchValue:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
className: V,
|
|
46
|
+
onLoginClick: h,
|
|
47
|
+
searchInputProps: t,
|
|
48
|
+
searchValue: c,
|
|
49
|
+
onSearchValueChange: y,
|
|
50
|
+
onClearSearch: u,
|
|
51
|
+
onSearch: d,
|
|
52
|
+
searchSuggestions: n,
|
|
52
53
|
recentSearches: f,
|
|
53
|
-
onClearRecentSearch:
|
|
54
|
-
onCategoryClick:
|
|
55
|
-
onClickModelSerial:
|
|
56
|
-
onCartClick:
|
|
57
|
-
accountPopoverContent:
|
|
58
|
-
isAccountLoading:
|
|
59
|
-
isCategoriesLoading:
|
|
60
|
-
...
|
|
61
|
-
},
|
|
62
|
-
const [
|
|
63
|
-
...
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
(
|
|
54
|
+
onClearRecentSearch: M,
|
|
55
|
+
onCategoryClick: L,
|
|
56
|
+
onClickModelSerial: H,
|
|
57
|
+
onCartClick: P,
|
|
58
|
+
accountPopoverContent: S,
|
|
59
|
+
isAccountLoading: ii,
|
|
60
|
+
isCategoriesLoading: oi,
|
|
61
|
+
...ei
|
|
62
|
+
}, ti) {
|
|
63
|
+
const [R, k] = x.useState(!1), [m, r] = x.useState(-1), $ = x.useRef(null), s = x.useId(), D = R && !!c && !!n, F = R && !D && !!(f != null && f.length), b = D ? ((n == null ? void 0 : n.terms.length) ?? 0) + ((n == null ? void 0 : n.categories.length) ?? 0) + ((n == null ? void 0 : n.items.length) ?? 0) : F ? (f == null ? void 0 : f.length) ?? 0 : 0, T = {
|
|
64
|
+
...t,
|
|
65
|
+
onChange: (e) => {
|
|
66
|
+
var a;
|
|
67
|
+
r(-1), (a = t == null ? void 0 : t.onChange) == null || a.call(t, e);
|
|
67
68
|
},
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
(
|
|
69
|
+
onFocus: (e) => {
|
|
70
|
+
var a;
|
|
71
|
+
(a = t == null ? void 0 : t.onFocus) == null || a.call(t, e), k(!0);
|
|
72
|
+
},
|
|
73
|
+
onBlur: (e) => {
|
|
74
|
+
var a;
|
|
75
|
+
(a = t == null ? void 0 : t.onBlur) == null || a.call(t, e), k(!1);
|
|
76
|
+
},
|
|
77
|
+
onKeyDown: (e) => {
|
|
78
|
+
var a, q;
|
|
79
|
+
if ((a = t == null ? void 0 : t.onKeyDown) == null || a.call(t, e), !e.defaultPrevented) {
|
|
80
|
+
if (e.key === "ArrowDown" && b > 0) {
|
|
81
|
+
e.preventDefault(), r((v) => v >= b - 1 ? 0 : v + 1);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (e.key === "ArrowUp" && b > 0) {
|
|
85
|
+
e.preventDefault(), r((v) => v <= 0 ? b - 1 : v - 1);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (e.key === "Tab" && D && m >= 0 && m < ((n == null ? void 0 : n.terms.length) ?? 0)) {
|
|
89
|
+
e.preventDefault(), y == null || y((n == null ? void 0 : n.terms[m].name) ?? ""), r(-1);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (e.key === "Enter" && m >= 0 && m < b) {
|
|
93
|
+
e.preventDefault(), (q = document.getElementById(`${s}-${m}`)) == null || q.click();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
e.key === "Enter" && (e.preventDefault(), d == null || d(c ?? ""));
|
|
97
|
+
}
|
|
71
98
|
}
|
|
99
|
+
}, K = (e) => {
|
|
100
|
+
var a;
|
|
101
|
+
e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), r(-1), y == null || y(`${c ?? ""}${e.key}`), (a = $.current) == null || a.focus());
|
|
72
102
|
};
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
103
|
+
return /* @__PURE__ */ o(ni, { ...ei, gridWrapperClassName: N(i.main, V), children: /* @__PURE__ */ l(li, { span: 12, className: i.column, children: [
|
|
104
|
+
/* @__PURE__ */ l(
|
|
105
|
+
g,
|
|
76
106
|
{
|
|
77
107
|
flexDirection: "row",
|
|
78
108
|
alignItems: "center",
|
|
79
109
|
justifyContent: "space-between",
|
|
80
|
-
className:
|
|
110
|
+
className: i.topNav,
|
|
81
111
|
children: [
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
112
|
+
/* @__PURE__ */ o("div", { className: i.logo, children: /* @__PURE__ */ o(U, { href: J, children: /* @__PURE__ */ o(mi, {}) }) }),
|
|
113
|
+
/* @__PURE__ */ l(
|
|
114
|
+
g,
|
|
85
115
|
{
|
|
86
116
|
flexDirection: "row",
|
|
87
117
|
alignItems: "center",
|
|
88
118
|
justifyContent: "flex-end",
|
|
89
|
-
className:
|
|
119
|
+
className: i.operations,
|
|
90
120
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
|
|
121
|
+
/* @__PURE__ */ l(g, { flexDirection: "row", hideAt: ["sm"], className: i.search, children: [
|
|
122
|
+
/* @__PURE__ */ o(
|
|
123
|
+
Q,
|
|
94
124
|
{
|
|
95
125
|
variant: "search",
|
|
96
126
|
label: "Search",
|
|
@@ -98,30 +128,35 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
98
128
|
name: "cpc-search",
|
|
99
129
|
autoComplete: "off",
|
|
100
130
|
"aria-autocomplete": "list",
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
131
|
+
"aria-controls": s,
|
|
132
|
+
"aria-activedescendant": m >= 0 ? `${s}-${m}` : void 0,
|
|
133
|
+
...T,
|
|
134
|
+
ref: $,
|
|
135
|
+
value: c,
|
|
136
|
+
endAdornment: /* @__PURE__ */ l(G, { children: [
|
|
137
|
+
!!c && /* @__PURE__ */ o(
|
|
138
|
+
z,
|
|
106
139
|
{
|
|
107
140
|
"aria-label": "Clear search",
|
|
108
|
-
onClick:
|
|
141
|
+
onClick: () => {
|
|
142
|
+
r(-1), u == null || u();
|
|
143
|
+
},
|
|
109
144
|
iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
|
|
110
145
|
}
|
|
111
146
|
),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
|
|
147
|
+
/* @__PURE__ */ o(
|
|
148
|
+
z,
|
|
114
149
|
{
|
|
115
150
|
"aria-label": "Submit search",
|
|
116
|
-
onClick: () =>
|
|
151
|
+
onClick: () => d == null ? void 0 : d(c ?? ""),
|
|
117
152
|
iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
|
|
118
153
|
}
|
|
119
154
|
)
|
|
120
155
|
] })
|
|
121
156
|
}
|
|
122
157
|
),
|
|
123
|
-
|
|
124
|
-
|
|
158
|
+
D && n && /* @__PURE__ */ o(p, { ...n, activeOptionIndex: m, optionIdPrefix: s, onKeyDown: K, onSuggestionClick: () => k(!1), className: i.suggestionDropdown }),
|
|
159
|
+
F && /* @__PURE__ */ o(
|
|
125
160
|
p,
|
|
126
161
|
{
|
|
127
162
|
terms: [],
|
|
@@ -129,82 +164,86 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
129
164
|
items: [],
|
|
130
165
|
view: "recent-searches",
|
|
131
166
|
recentSearches: f,
|
|
132
|
-
onClearRecentSearch:
|
|
133
|
-
|
|
167
|
+
onClearRecentSearch: M,
|
|
168
|
+
activeOptionIndex: m,
|
|
169
|
+
optionIdPrefix: s,
|
|
170
|
+
onKeyDown: K,
|
|
171
|
+
onSuggestionClick: () => k(!1),
|
|
172
|
+
className: i.suggestionDropdown
|
|
134
173
|
}
|
|
135
174
|
)
|
|
136
175
|
] }),
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ l("button", { onClick: H, className: N(i.siteLink, W(["sm", "md"])), children: [
|
|
177
|
+
/* @__PURE__ */ o(_, { iconKey: "fa-regular fa-sparkles", size: "sm" }),
|
|
139
178
|
"Model/Serial"
|
|
140
179
|
] }),
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
180
|
+
/* @__PURE__ */ o(w, { href: E, hideAt: ["sm", "md"], children: "Custom Parts" }),
|
|
181
|
+
/* @__PURE__ */ o(w, { href: I, hideAt: ["sm", "md"], children: "Contact Us" }),
|
|
182
|
+
/* @__PURE__ */ o("div", { className: i.accountArea, children: /* @__PURE__ */ o(
|
|
183
|
+
di,
|
|
145
184
|
{
|
|
146
|
-
account:
|
|
147
|
-
onLoginClick:
|
|
148
|
-
className:
|
|
149
|
-
popoverContent:
|
|
150
|
-
isAccountLoading:
|
|
185
|
+
account: B,
|
|
186
|
+
onLoginClick: h,
|
|
187
|
+
className: i.avatar,
|
|
188
|
+
popoverContent: S,
|
|
189
|
+
isAccountLoading: ii
|
|
151
190
|
}
|
|
152
191
|
) }),
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
|
|
192
|
+
/* @__PURE__ */ o(
|
|
193
|
+
ci,
|
|
155
194
|
{
|
|
156
|
-
ref:
|
|
157
|
-
cart:
|
|
158
|
-
open:
|
|
159
|
-
onCartClick:
|
|
195
|
+
ref: ti,
|
|
196
|
+
cart: Z,
|
|
197
|
+
open: C,
|
|
198
|
+
onCartClick: P
|
|
160
199
|
}
|
|
161
200
|
),
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ l(ai, { hideAt: ["lg"], children: [
|
|
202
|
+
/* @__PURE__ */ l("section", { children: [
|
|
203
|
+
/* @__PURE__ */ o(O, { size: "md", weight: "semibold", children: "Useful shortcuts" }),
|
|
204
|
+
/* @__PURE__ */ l("ul", { className: i.menuList, children: [
|
|
205
|
+
/* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(
|
|
167
206
|
"button",
|
|
168
207
|
{
|
|
169
|
-
onClick:
|
|
208
|
+
onClick: H,
|
|
170
209
|
"data-hamburger-close": "true",
|
|
171
|
-
className:
|
|
210
|
+
className: N(i.siteLink, i.menuItemAction, W(["lg"])),
|
|
172
211
|
children: [
|
|
173
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ o(_, { iconKey: "fa-regular fa-sparkles", size: "sm", className: i.shortcutIcon }),
|
|
174
213
|
"Model/Serial"
|
|
175
214
|
]
|
|
176
215
|
}
|
|
177
216
|
) }),
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: E, className: N(i.siteLink, i.menuItemAction), children: [
|
|
218
|
+
/* @__PURE__ */ o(_, { iconKey: "fa-regular fa-screwdriver-wrench", size: "sm", className: i.shortcutIcon }),
|
|
180
219
|
"Custom Parts"
|
|
181
220
|
] }) }),
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: I, className: N(i.siteLink, i.menuItemAction), children: [
|
|
222
|
+
/* @__PURE__ */ o(_, { iconKey: "fa-regular fa-envelope", size: "sm", className: i.shortcutIcon }),
|
|
184
223
|
"Contact Us"
|
|
185
224
|
] }) }),
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: X, className: N(i.siteLink, i.menuItemAction), children: [
|
|
226
|
+
/* @__PURE__ */ o(_, { iconKey: "fa-solid fa-question", size: "sm", className: i.shortcutIcon }),
|
|
188
227
|
"FAQ"
|
|
189
228
|
] }) }),
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: Y, className: N(i.siteLink, i.menuItemAction), children: [
|
|
230
|
+
/* @__PURE__ */ o(_, { iconKey: "fa-regular fa-people-group", size: "sm", className: i.shortcutIcon }),
|
|
192
231
|
"About Us"
|
|
193
232
|
] }) })
|
|
194
233
|
] })
|
|
195
234
|
] }),
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
|
|
235
|
+
/* @__PURE__ */ l("section", { children: [
|
|
236
|
+
/* @__PURE__ */ o(O, { size: "md", weight: "semibold", children: "Shop by category" }),
|
|
237
|
+
/* @__PURE__ */ o("ul", { className: i.menuList, children: A && A.map((e) => /* @__PURE__ */ o("li", { className: i.category, children: /* @__PURE__ */ l(
|
|
238
|
+
U,
|
|
200
239
|
{
|
|
201
|
-
href:
|
|
202
|
-
className:
|
|
203
|
-
onClick: () =>
|
|
240
|
+
href: e.route,
|
|
241
|
+
className: i.categoryLink,
|
|
242
|
+
onClick: () => L == null ? void 0 : L(e),
|
|
204
243
|
children: [
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
|
|
244
|
+
/* @__PURE__ */ o(O, { size: "sm", children: e.label }),
|
|
245
|
+
/* @__PURE__ */ o(
|
|
246
|
+
_,
|
|
208
247
|
{
|
|
209
248
|
iconKey: "fa-solid fa-chevron-right",
|
|
210
249
|
title: "Navigate",
|
|
@@ -213,7 +252,7 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
213
252
|
)
|
|
214
253
|
]
|
|
215
254
|
}
|
|
216
|
-
) },
|
|
255
|
+
) }, e.id)) })
|
|
217
256
|
] })
|
|
218
257
|
] })
|
|
219
258
|
]
|
|
@@ -222,9 +261,9 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
222
261
|
]
|
|
223
262
|
}
|
|
224
263
|
),
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
|
|
264
|
+
/* @__PURE__ */ o(g, { flexDirection: "row", hideAt: ["md", "lg"], className: i.mobileSearch, children: /* @__PURE__ */ l("div", { className: i.search, children: [
|
|
265
|
+
/* @__PURE__ */ o(
|
|
266
|
+
Q,
|
|
228
267
|
{
|
|
229
268
|
variant: "search",
|
|
230
269
|
label: "Search",
|
|
@@ -232,30 +271,35 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
232
271
|
name: "cpc-search",
|
|
233
272
|
autoComplete: "off",
|
|
234
273
|
"aria-autocomplete": "list",
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
274
|
+
"aria-controls": s,
|
|
275
|
+
"aria-activedescendant": m >= 0 ? `${s}-${m}` : void 0,
|
|
276
|
+
...T,
|
|
277
|
+
ref: $,
|
|
278
|
+
value: c,
|
|
279
|
+
endAdornment: /* @__PURE__ */ l(G, { children: [
|
|
280
|
+
!!c && /* @__PURE__ */ o(
|
|
281
|
+
z,
|
|
240
282
|
{
|
|
241
283
|
"aria-label": "Clear search",
|
|
242
|
-
onClick:
|
|
284
|
+
onClick: () => {
|
|
285
|
+
r(-1), u == null || u();
|
|
286
|
+
},
|
|
243
287
|
iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
|
|
244
288
|
}
|
|
245
289
|
),
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
|
|
290
|
+
/* @__PURE__ */ o(
|
|
291
|
+
z,
|
|
248
292
|
{
|
|
249
293
|
"aria-label": "Submit search",
|
|
250
|
-
onClick: () =>
|
|
294
|
+
onClick: () => d == null ? void 0 : d(c ?? ""),
|
|
251
295
|
iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
|
|
252
296
|
}
|
|
253
297
|
)
|
|
254
298
|
] })
|
|
255
299
|
}
|
|
256
300
|
),
|
|
257
|
-
|
|
258
|
-
|
|
301
|
+
D && n && /* @__PURE__ */ o(p, { ...n, activeOptionIndex: m, optionIdPrefix: s, onKeyDown: K, onSuggestionClick: () => k(!1), className: i.suggestionDropdown }),
|
|
302
|
+
F && /* @__PURE__ */ o(
|
|
259
303
|
p,
|
|
260
304
|
{
|
|
261
305
|
terms: [],
|
|
@@ -263,28 +307,32 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
263
307
|
items: [],
|
|
264
308
|
view: "recent-searches",
|
|
265
309
|
recentSearches: f,
|
|
266
|
-
onClearRecentSearch:
|
|
267
|
-
|
|
310
|
+
onClearRecentSearch: M,
|
|
311
|
+
activeOptionIndex: m,
|
|
312
|
+
optionIdPrefix: s,
|
|
313
|
+
onKeyDown: K,
|
|
314
|
+
onSuggestionClick: () => k(!1),
|
|
315
|
+
className: i.suggestionDropdown
|
|
268
316
|
}
|
|
269
317
|
)
|
|
270
318
|
] }) }),
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
|
|
319
|
+
/* @__PURE__ */ o(
|
|
320
|
+
si,
|
|
273
321
|
{
|
|
274
|
-
categories:
|
|
275
|
-
isCategoriesLoading:
|
|
276
|
-
onCategoryClick:
|
|
322
|
+
categories: A,
|
|
323
|
+
isCategoriesLoading: oi,
|
|
324
|
+
onCategoryClick: L
|
|
277
325
|
}
|
|
278
326
|
)
|
|
279
327
|
] }) });
|
|
280
328
|
});
|
|
281
|
-
function
|
|
282
|
-
href:
|
|
283
|
-
children:
|
|
284
|
-
...
|
|
329
|
+
function w({
|
|
330
|
+
href: j,
|
|
331
|
+
children: B,
|
|
332
|
+
...A
|
|
285
333
|
}) {
|
|
286
|
-
return /* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ o(U, { href: j, className: i.siteLink, ...A, children: B });
|
|
287
335
|
}
|
|
288
336
|
export {
|
|
289
|
-
|
|
337
|
+
Qi as MainNav
|
|
290
338
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as p, Fragment as k, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useState as g } from "react";
|
|
3
3
|
import { MainNav as b } from "./MainNav.js";
|
|
4
|
-
import { Text as
|
|
4
|
+
import { Text as y } from "../../atoms/Text/Text.js";
|
|
5
5
|
import { Link as h } from "../../atoms/Link/Link.js";
|
|
6
6
|
import { Button as S } from "../../atoms/Button/Button.js";
|
|
7
7
|
import { CartSlideInPanel as v } from "../../molecules/Cart/CartSlideInPanel.js";
|
|
8
|
-
const
|
|
8
|
+
const P = {
|
|
9
9
|
title: "Case Parts/Organisms/MainNav",
|
|
10
10
|
component: b,
|
|
11
11
|
parameters: {
|
|
@@ -113,11 +113,11 @@ const x = {
|
|
|
113
113
|
{ name: "gasket material", url: "/search/gasket-material" }
|
|
114
114
|
],
|
|
115
115
|
categories: [
|
|
116
|
-
{ name: "Magnetic Door Gaskets and Sweeper Gasket", url: "/category/47432" },
|
|
117
|
-
{ name: "01 Gaskets", url: "/category/46795" },
|
|
118
|
-
{ name: "Door Gaskets", url: "/category/47022" },
|
|
119
|
-
{ name: "Magnetic Gaskets", url: "/category/46971" },
|
|
120
|
-
{ name: "Magnetic Gaskets", url: "/category/47501" }
|
|
116
|
+
{ categoryKey: 47432, name: "Magnetic Door Gaskets and Sweeper Gasket", url: "/category/47432" },
|
|
117
|
+
{ categoryKey: 46795, name: "01 Gaskets", url: "/category/46795" },
|
|
118
|
+
{ categoryKey: 47022, name: "Door Gaskets", url: "/category/47022" },
|
|
119
|
+
{ categoryKey: 46971, name: "Magnetic Gaskets", url: "/category/46971" },
|
|
120
|
+
{ categoryKey: 47501, name: "Magnetic Gaskets", url: "/category/47501" }
|
|
121
121
|
],
|
|
122
122
|
items: [
|
|
123
123
|
{ itemKey: 13503, itemId: "GASKET-RING", description: "Gasket Sample Ring", image: a, url: "/part/GASKET-RING" },
|
|
@@ -148,32 +148,32 @@ const x = {
|
|
|
148
148
|
};
|
|
149
149
|
function f(e) {
|
|
150
150
|
return `$${e.items.reduce(
|
|
151
|
-
(
|
|
151
|
+
(t, r) => t + (parseFloat(r.price.replace(/[^0-9.]/g, "")) || 0) * r.quantity,
|
|
152
152
|
0
|
|
153
153
|
).toFixed(2)}`;
|
|
154
154
|
}
|
|
155
|
-
const u = /* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
155
|
+
const u = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "column", gap: 8, minWidth: 220 }, children: [
|
|
156
|
+
/* @__PURE__ */ i(y, { size: "sm", weight: "semibold", children: "Account" }),
|
|
157
|
+
/* @__PURE__ */ i(y, { size: "xs", children: "Signed in as Ringo" }),
|
|
158
|
+
/* @__PURE__ */ i(h, { href: "/account", "data-popover-close": "true", children: "View Account" }),
|
|
159
|
+
/* @__PURE__ */ i(h, { href: "/orders", "data-popover-close": "true", children: "Order History" }),
|
|
160
|
+
/* @__PURE__ */ i(S, { size: "sm", variant: "secondary", "data-popover-close": "true", onClick: () => alert("Sign out"), children: "Sign Out" })
|
|
161
161
|
] }), m = (e) => {
|
|
162
|
-
const [
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
162
|
+
const [o, t] = g(!1);
|
|
163
|
+
return /* @__PURE__ */ p(k, { children: [
|
|
164
|
+
/* @__PURE__ */ i(
|
|
165
165
|
b,
|
|
166
166
|
{
|
|
167
167
|
...e,
|
|
168
|
-
open:
|
|
169
|
-
onCartClick: () =>
|
|
168
|
+
open: o,
|
|
169
|
+
onCartClick: () => t((r) => !r)
|
|
170
170
|
}
|
|
171
171
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ i(
|
|
173
173
|
v,
|
|
174
174
|
{
|
|
175
|
-
open:
|
|
176
|
-
onClose: () =>
|
|
175
|
+
open: o,
|
|
176
|
+
onClose: () => t(!1),
|
|
177
177
|
cart: e.cart,
|
|
178
178
|
subtotal: f(e.cart),
|
|
179
179
|
itemPriceLabel: "List Price",
|
|
@@ -184,30 +184,31 @@ const u = /* @__PURE__ */ y("div", { style: { display: "flex", flexDirection: "c
|
|
|
184
184
|
)
|
|
185
185
|
] });
|
|
186
186
|
}, G = (e) => {
|
|
187
|
-
const [
|
|
188
|
-
return /* @__PURE__ */
|
|
187
|
+
const [o, t] = g(""), [r, C] = g(R);
|
|
188
|
+
return /* @__PURE__ */ i(
|
|
189
189
|
b,
|
|
190
190
|
{
|
|
191
191
|
...e,
|
|
192
|
-
searchValue:
|
|
193
|
-
|
|
192
|
+
searchValue: o,
|
|
193
|
+
onSearchValueChange: t,
|
|
194
|
+
onClearSearch: () => t(""),
|
|
194
195
|
onSearch: (l) => alert(`Search for ${l}`),
|
|
195
|
-
searchSuggestions:
|
|
196
|
+
searchSuggestions: o ? I : void 0,
|
|
196
197
|
recentSearches: r,
|
|
197
198
|
onClearRecentSearch: (l) => {
|
|
198
199
|
C((n) => n.filter((d) => d.url !== l.url));
|
|
199
200
|
},
|
|
200
201
|
searchInputProps: {
|
|
201
202
|
...e.searchInputProps,
|
|
202
|
-
value:
|
|
203
|
+
value: o,
|
|
203
204
|
onChange: (l) => {
|
|
204
205
|
var n, d;
|
|
205
|
-
(d = (n = e.searchInputProps) == null ? void 0 : n.onChange) == null || d.call(n, l),
|
|
206
|
+
(d = (n = e.searchInputProps) == null ? void 0 : n.onChange) == null || d.call(n, l), t(l.target.value);
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
);
|
|
210
|
-
},
|
|
211
|
+
}, x = {
|
|
211
212
|
args: {
|
|
212
213
|
account: { name: "Ringo", initials: "RS", number: "123456789012" },
|
|
213
214
|
cart: s,
|
|
@@ -232,7 +233,7 @@ const u = /* @__PURE__ */ y("div", { style: { display: "flex", flexDirection: "c
|
|
|
232
233
|
accountPopoverContent: u
|
|
233
234
|
},
|
|
234
235
|
render: m
|
|
235
|
-
},
|
|
236
|
+
}, A = {
|
|
236
237
|
args: {
|
|
237
238
|
account: { name: "Ringo", initials: "RS", number: "123456789012" },
|
|
238
239
|
cart: s,
|
|
@@ -256,7 +257,7 @@ const u = /* @__PURE__ */ y("div", { style: { display: "flex", flexDirection: "c
|
|
|
256
257
|
accountPopoverContent: u
|
|
257
258
|
},
|
|
258
259
|
render: m
|
|
259
|
-
},
|
|
260
|
+
}, F = {
|
|
260
261
|
args: {
|
|
261
262
|
account: { name: "Ringo", initials: "RS", number: "123456789012" },
|
|
262
263
|
cart: s,
|
|
@@ -280,7 +281,7 @@ const u = /* @__PURE__ */ y("div", { style: { display: "flex", flexDirection: "c
|
|
|
280
281
|
accountPopoverContent: u
|
|
281
282
|
},
|
|
282
283
|
render: G
|
|
283
|
-
},
|
|
284
|
+
}, w = {
|
|
284
285
|
args: {
|
|
285
286
|
cart: s,
|
|
286
287
|
homeRoute: "/",
|
|
@@ -330,10 +331,10 @@ const u = /* @__PURE__ */ y("div", { style: { display: "flex", flexDirection: "c
|
|
|
330
331
|
render: m
|
|
331
332
|
};
|
|
332
333
|
export {
|
|
333
|
-
|
|
334
|
+
x as Authenticated,
|
|
334
335
|
T as Loading,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
w as Unauthenticated,
|
|
337
|
+
A as WithCartItems,
|
|
338
|
+
F as WithSearchSuggestions,
|
|
339
|
+
P as default
|
|
339
340
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type SuggestedCategory = {
|
|
2
|
+
categoryKey: number;
|
|
2
3
|
name: string;
|
|
3
4
|
url: string;
|
|
4
5
|
};
|
|
@@ -25,6 +26,9 @@ export interface SuggestionDropdownProps {
|
|
|
25
26
|
recentSearches?: RecentSearch[];
|
|
26
27
|
onClearRecentSearch?: (_recentSearch: RecentSearch) => void;
|
|
27
28
|
onSuggestionClick?: () => void;
|
|
29
|
+
activeOptionIndex?: number;
|
|
30
|
+
optionIdPrefix?: string;
|
|
31
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
28
32
|
className?: string;
|
|
29
33
|
}
|
|
30
|
-
export declare function SuggestionDropdown({ terms, categories, items, view, recentSearches, onClearRecentSearch, onSuggestionClick, className }: SuggestionDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function SuggestionDropdown({ terms, categories, items, view, recentSearches, onClearRecentSearch, onSuggestionClick, activeOptionIndex, optionIdPrefix, onKeyDown, className }: SuggestionDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,89 +1,140 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Text as
|
|
3
|
-
import { Link as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { c as
|
|
6
|
-
import { Image as
|
|
7
|
-
import '../../assets/SuggestionDropdown.css';const
|
|
8
|
-
suggestionDropdown:
|
|
9
|
-
leftColumn:
|
|
10
|
-
leftColumnFullWidth:
|
|
11
|
-
suggestionSectionFullHeight:
|
|
12
|
-
rightColumn:
|
|
13
|
-
categorySection:
|
|
14
|
-
suggestions:
|
|
15
|
-
categories:
|
|
16
|
-
suggestionsFullHeight:
|
|
17
|
-
suggestionLink:
|
|
18
|
-
categoryLink:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { jsxs as r, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Text as a } from "../../atoms/Text/Text.js";
|
|
3
|
+
import { Link as _ } from "../../atoms/Link/Link.js";
|
|
4
|
+
import { Icon as L } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import { c as l } from "../../clsx-OuTLNxxd.js";
|
|
6
|
+
import { Image as k } from "../../atoms/Image/Image.js";
|
|
7
|
+
import '../../assets/SuggestionDropdown.css';const S = "_suggestionDropdown_1udz7_1", N = "_leftColumn_1udz7_31", v = "_leftColumnFullWidth_1udz7_55", y = "_suggestionSectionFullHeight_1udz7_63", C = "_rightColumn_1udz7_73", F = "_categorySection_1udz7_95", H = "_suggestions_1udz7_101", $ = "_categories_1udz7_103", D = "_suggestionsFullHeight_1udz7_117", w = "_suggestionLink_1udz7_147", b = "_categoryLink_1udz7_149", T = "_activeOption_1udz7_163", q = "_itemList_1udz7_175", W = "_item_1udz7_175", j = "_activeItem_1udz7_209", M = "_itemInfo_1udz7_243", O = "_recentSearches_1udz7_253", K = "_recentSearchesHeader_1udz7_267", R = "_recentSearchesList_1udz7_275", A = "_recentSearch_1udz7_253", B = "_recentSearchLink_1udz7_305", E = "_clearRecentSearch_1udz7_321", t = {
|
|
8
|
+
suggestionDropdown: S,
|
|
9
|
+
leftColumn: N,
|
|
10
|
+
leftColumnFullWidth: v,
|
|
11
|
+
suggestionSectionFullHeight: y,
|
|
12
|
+
rightColumn: C,
|
|
13
|
+
categorySection: F,
|
|
14
|
+
suggestions: H,
|
|
15
|
+
categories: $,
|
|
16
|
+
suggestionsFullHeight: D,
|
|
17
|
+
suggestionLink: w,
|
|
18
|
+
categoryLink: b,
|
|
19
|
+
activeOption: T,
|
|
20
|
+
itemList: q,
|
|
21
|
+
item: W,
|
|
22
|
+
activeItem: j,
|
|
23
|
+
itemInfo: M,
|
|
24
|
+
recentSearches: O,
|
|
25
|
+
recentSearchesHeader: K,
|
|
26
|
+
recentSearchesList: R,
|
|
27
|
+
recentSearch: A,
|
|
28
|
+
recentSearchLink: B,
|
|
29
|
+
clearRecentSearch: E
|
|
28
30
|
};
|
|
29
|
-
function
|
|
30
|
-
terms:
|
|
31
|
-
categories:
|
|
32
|
-
items:
|
|
33
|
-
view:
|
|
34
|
-
recentSearches:
|
|
35
|
-
onClearRecentSearch:
|
|
31
|
+
function Y({
|
|
32
|
+
terms: n,
|
|
33
|
+
categories: c,
|
|
34
|
+
items: d,
|
|
35
|
+
view: p = "suggestions",
|
|
36
|
+
recentSearches: h = [],
|
|
37
|
+
onClearRecentSearch: m,
|
|
36
38
|
onSuggestionClick: g,
|
|
37
|
-
|
|
39
|
+
activeOptionIndex: o = -1,
|
|
40
|
+
optionIdPrefix: u,
|
|
41
|
+
onKeyDown: z,
|
|
42
|
+
className: f
|
|
38
43
|
}) {
|
|
39
|
-
return
|
|
44
|
+
return p === "recent-searches" ? /* @__PURE__ */ r(
|
|
40
45
|
"div",
|
|
41
46
|
{
|
|
42
|
-
|
|
47
|
+
id: u,
|
|
48
|
+
role: "listbox",
|
|
49
|
+
className: l(t.suggestionDropdown, t.recentSearches, f),
|
|
50
|
+
onKeyDown: z,
|
|
43
51
|
onMouseDown: (e) => e.preventDefault(),
|
|
44
52
|
children: [
|
|
45
|
-
/* @__PURE__ */ s("div", { className:
|
|
46
|
-
/* @__PURE__ */ s("ol", { className:
|
|
47
|
-
/* @__PURE__ */ s(
|
|
53
|
+
/* @__PURE__ */ s("div", { className: t.recentSearchesHeader, children: /* @__PURE__ */ s(a, { size: "xxs", colorToken: "quaternary", children: "Recent Searches" }) }),
|
|
54
|
+
/* @__PURE__ */ s("ol", { className: t.recentSearchesList, children: h.map((e) => /* @__PURE__ */ r("li", { className: t.recentSearch, children: [
|
|
55
|
+
/* @__PURE__ */ s(
|
|
56
|
+
_,
|
|
57
|
+
{
|
|
58
|
+
href: e.url,
|
|
59
|
+
id: `${u}-${h.indexOf(e)}`,
|
|
60
|
+
role: "option",
|
|
61
|
+
"aria-selected": o === h.indexOf(e),
|
|
62
|
+
className: l(t.recentSearchLink, { [t.activeOption]: o === h.indexOf(e) }),
|
|
63
|
+
onClick: g,
|
|
64
|
+
children: /* @__PURE__ */ s(a, { size: "sm", children: e.term })
|
|
65
|
+
}
|
|
66
|
+
),
|
|
48
67
|
/* @__PURE__ */ s(
|
|
49
68
|
"button",
|
|
50
69
|
{
|
|
51
70
|
type: "button",
|
|
52
|
-
className:
|
|
71
|
+
className: t.clearRecentSearch,
|
|
53
72
|
"aria-label": `Clear recent search: ${e.term}`,
|
|
54
|
-
onClick: () =>
|
|
55
|
-
children: /* @__PURE__ */ s(
|
|
73
|
+
onClick: () => m == null ? void 0 : m(e),
|
|
74
|
+
children: /* @__PURE__ */ s(L, { iconKey: "fa-regular fa-xmark", size: "sm" })
|
|
56
75
|
}
|
|
57
76
|
)
|
|
58
77
|
] }, e.url)) })
|
|
59
78
|
]
|
|
60
79
|
}
|
|
61
|
-
) : /* @__PURE__ */
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */ s(
|
|
65
|
-
|
|
66
|
-
(e) => /* @__PURE__ */ s(
|
|
80
|
+
) : /* @__PURE__ */ r("div", { id: u, role: "listbox", className: l(t.suggestionDropdown, f), onKeyDown: z, onMouseDown: (e) => e.preventDefault(), children: [
|
|
81
|
+
(n.length > 0 || c.length > 0) && /* @__PURE__ */ r("div", { className: l(t.leftColumn, { [t.leftColumnFullWidth]: d.length === 0 }), children: [
|
|
82
|
+
n.length > 0 && /* @__PURE__ */ s("div", { className: l(t.suggestionSection, { [t.suggestionSectionFullHeight]: c.length === 0 }), children: /* @__PURE__ */ r("div", { className: l(t.suggestions, { [t.suggestionsFullHeight]: c.length === 0 }), children: [
|
|
83
|
+
/* @__PURE__ */ s(a, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
|
|
84
|
+
n.map(
|
|
85
|
+
(e, i) => /* @__PURE__ */ s(a, { size: "sm", children: /* @__PURE__ */ s(
|
|
86
|
+
_,
|
|
87
|
+
{
|
|
88
|
+
href: e.url,
|
|
89
|
+
id: `${u}-${i}`,
|
|
90
|
+
role: "option",
|
|
91
|
+
"aria-selected": o === i,
|
|
92
|
+
className: l(t.suggestionLink, { [t.activeOption]: o === i }),
|
|
93
|
+
onClick: g,
|
|
94
|
+
children: e.name
|
|
95
|
+
}
|
|
96
|
+
) }, e.url)
|
|
67
97
|
)
|
|
68
98
|
] }) }),
|
|
69
|
-
|
|
70
|
-
/* @__PURE__ */ s(
|
|
71
|
-
|
|
72
|
-
(e) => /* @__PURE__ */ s(
|
|
99
|
+
c.length > 0 && /* @__PURE__ */ s("div", { className: t.categorySection, children: /* @__PURE__ */ r("div", { className: t.categories, children: [
|
|
100
|
+
/* @__PURE__ */ s(a, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
|
|
101
|
+
c.map(
|
|
102
|
+
(e, i) => /* @__PURE__ */ s(a, { size: "sm", children: /* @__PURE__ */ s(
|
|
103
|
+
_,
|
|
104
|
+
{
|
|
105
|
+
href: e.url,
|
|
106
|
+
id: `${u}-${n.length + i}`,
|
|
107
|
+
role: "option",
|
|
108
|
+
"aria-selected": o === n.length + i,
|
|
109
|
+
className: l(t.categoryLink, { [t.activeOption]: o === n.length + i }),
|
|
110
|
+
onClick: g,
|
|
111
|
+
children: e.name
|
|
112
|
+
}
|
|
113
|
+
) }, e.categoryKey)
|
|
73
114
|
)
|
|
74
115
|
] }) })
|
|
75
116
|
] }),
|
|
76
|
-
|
|
77
|
-
(e) => /* @__PURE__ */ s("li", { className:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
117
|
+
d.length > 0 && /* @__PURE__ */ s("div", { className: t.rightColumn, children: /* @__PURE__ */ s("ol", { className: t.itemList, children: d.map(
|
|
118
|
+
(e, i) => /* @__PURE__ */ s("li", { className: l(t.item, { [t.activeItem]: o === n.length + c.length + i }), children: /* @__PURE__ */ r(
|
|
119
|
+
_,
|
|
120
|
+
{
|
|
121
|
+
href: e.url,
|
|
122
|
+
id: `${u}-${n.length + c.length + i}`,
|
|
123
|
+
role: "option",
|
|
124
|
+
"aria-selected": o === n.length + c.length + i,
|
|
125
|
+
onClick: g,
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ s(k, { src: e.image, alt: `${e.description} product image`, height: 72, width: 72 }),
|
|
128
|
+
/* @__PURE__ */ r("div", { className: t.itemInfo, children: [
|
|
129
|
+
/* @__PURE__ */ s(a, { size: "sm", children: e.description }),
|
|
130
|
+
/* @__PURE__ */ s(a, { size: "sm", colorToken: "quaternary", children: e.itemId })
|
|
131
|
+
] })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
) }, e.itemId)
|
|
84
135
|
) }) })
|
|
85
136
|
] });
|
|
86
137
|
}
|
|
87
138
|
export {
|
|
88
|
-
|
|
139
|
+
Y as SuggestionDropdown
|
|
89
140
|
};
|
|
@@ -15,9 +15,9 @@ const a = {
|
|
|
15
15
|
{ name: "wiring", url: "/search/wiring" }
|
|
16
16
|
],
|
|
17
17
|
categories: [
|
|
18
|
-
{ name: "Heating", url: "/categories/heating" },
|
|
19
|
-
{ name: "Accessories", url: "/categories/accessories" },
|
|
20
|
-
{ name: "Controls", url: "/categories/controls" }
|
|
18
|
+
{ categoryKey: 1, name: "Heating", url: "/categories/heating" },
|
|
19
|
+
{ categoryKey: 2, name: "Accessories", url: "/categories/accessories" },
|
|
20
|
+
{ categoryKey: 3, name: "Controls", url: "/categories/controls" }
|
|
21
21
|
],
|
|
22
22
|
items: [
|
|
23
23
|
{
|