@caseparts-org/caseblocks 0.0.232 → 0.0.234
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.js +74 -74
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.d.ts +2 -1
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.js +61 -57
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.d.ts +3 -0
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.js +27 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._suggestionDropdown_1fc5y_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_1fc5y_1{flex-direction:column}}._leftColumn_1fc5y_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_1fc5y_31{border-right:0;border-bottom:1px solid var(--border-border-primary)}}._leftColumnFullWidth_1fc5y_55{flex:1}._suggestionSectionFullHeight_1fc5y_63{display:flex;flex:1}._rightColumn_1fc5y_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_1fc5y_95{border-top:1px solid var(--border-border-primary)}._suggestions_1fc5y_101,._categories_1fc5y_103{display:flex;flex-direction:column;gap:0;padding:0}._suggestionsFullHeight_1fc5y_117{flex:1}._suggestions_1fc5y_101>:first-child,._categories_1fc5y_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_1fc5y_101>:last-child{padding-bottom:var(--spacing-spacing-2xs)}._suggestionLink_1fc5y_147,._categoryLink_1fc5y_149{display:block;box-sizing:border-box;width:100%;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default)}._itemList_1fc5y_163{margin:0;padding:0;display:flex;flex-direction:column;gap:var(--spacing-spacing-2xs);width:100%}._item_1fc5y_163{display:flex;flex-direction:column;border:1px solid var(--border-border-primary);padding:var(--spacing-spacing-2xs);width:100%}._item_1fc5y_163 img{height:60px;width:60px}._item_1fc5y_163 a{display:flex;flex-direction:row;align-items:flex-start;gap:var(--spacing-spacing-2xs)}._itemInfo_1fc5y_221{display:grid;gap:var(--spacing-spacing-4xs)}._recentSearches_1fc5y_231{display:flex;flex-direction:column;background:var(--color-brand-primary-white);min-width:250px}._recentSearchesHeader_1fc5y_245{padding:var(--spacing-spacing-default) var(--spacing-spacing-default) var(--spacing-spacing-2xs)}._recentSearchesList_1fc5y_253{display:flex;flex-direction:column;gap:0;margin:0;padding:0}._recentSearch_1fc5y_231{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-spacing-2xs)}._recentSearchLink_1fc5y_283{display:flex;flex:1;min-width:0;align-items:center;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default)}._clearRecentSearch_1fc5y_299{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}
|
|
@@ -3,76 +3,76 @@ import F from "react";
|
|
|
3
3
|
import { Text as w } from "../../atoms/Text/Text.js";
|
|
4
4
|
import { Link as y } from "../../atoms/Link/Link.js";
|
|
5
5
|
import { Icon as t } from "../../atoms/Icon/Icon.js";
|
|
6
|
-
import { Flex as
|
|
6
|
+
import { Flex as _ } from "../../atoms/Flex/Flex.js";
|
|
7
7
|
import { Grid as Y, Column as Z } from "../../atoms/Grid/Grid.js";
|
|
8
8
|
import { Input as j } from "../../atoms/Input/Input.js";
|
|
9
|
-
import { InputEndAdornmentButton as
|
|
9
|
+
import { InputEndAdornmentButton as N } from "../../atoms/InputEndAdornmentButton/InputEndAdornmentButton.js";
|
|
10
10
|
import { Logo as $ } from "../../molecules/Logo/Logo.js";
|
|
11
11
|
import { HamburgerMenu as V } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
|
|
12
12
|
import { ShoppingCart as P } from "../../molecules/Cart/Cart.js";
|
|
13
13
|
import { Account as ee } from "../../molecules/Account/Account.js";
|
|
14
14
|
import { CategoryNav as ie } from "../../molecules/CategoryNav/CategoryNav.js";
|
|
15
|
-
import { SuggestionDropdown as
|
|
15
|
+
import { SuggestionDropdown as p } from "../SuggestionDropdown/SuggestionDropdown.js";
|
|
16
16
|
import { getHideAtStyles as M } from "../../atoms/HideAt.js";
|
|
17
|
-
import { c as
|
|
18
|
-
import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_12974_8", se = "_topNav_12974_13", ae = "_logo_12974_21", te = "_operations_12974_24",
|
|
17
|
+
import { c as l } from "../../clsx-OuTLNxxd.js";
|
|
18
|
+
import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_12974_8", se = "_topNav_12974_13", ae = "_logo_12974_21", te = "_operations_12974_24", le = "_search_12974_31", me = "_mobileSearch_12974_36", ce = "_suggestionDropdown_12974_39", re = "_siteLink_12974_45", de = "_accountArea_12974_72", fe = "_category_12974_84", ue = "_categoryLink_12974_92", ge = "_menuList_12974_108", he = "_menuItemAction_12974_131", _e = "_shortcutIcon_12974_140", e = {
|
|
19
19
|
main: oe,
|
|
20
20
|
column: ne,
|
|
21
21
|
topNav: se,
|
|
22
22
|
logo: ae,
|
|
23
23
|
operations: te,
|
|
24
|
-
search:
|
|
25
|
-
mobileSearch:
|
|
24
|
+
search: le,
|
|
25
|
+
mobileSearch: me,
|
|
26
26
|
suggestionDropdown: ce,
|
|
27
27
|
siteLink: re,
|
|
28
28
|
accountArea: de,
|
|
29
29
|
category: fe,
|
|
30
30
|
categoryLink: ue,
|
|
31
|
-
menuList:
|
|
32
|
-
menuItemAction:
|
|
31
|
+
menuList: ge,
|
|
32
|
+
menuItemAction: he,
|
|
33
33
|
shortcutIcon: _e
|
|
34
34
|
}, je = F.forwardRef(function({
|
|
35
|
-
account:
|
|
35
|
+
account: k,
|
|
36
36
|
categories: r,
|
|
37
37
|
homeRoute: U,
|
|
38
38
|
faqRoute: H,
|
|
39
|
-
customPartsRoute:
|
|
40
|
-
aboutUsRoute:
|
|
41
|
-
contactRoute:
|
|
42
|
-
cart:
|
|
43
|
-
open:
|
|
39
|
+
customPartsRoute: v,
|
|
40
|
+
aboutUsRoute: S,
|
|
41
|
+
contactRoute: L,
|
|
42
|
+
cart: q,
|
|
43
|
+
open: E,
|
|
44
44
|
// consume external panel control props from CartPropsBase
|
|
45
|
-
className:
|
|
46
|
-
onLoginClick:
|
|
45
|
+
className: G,
|
|
46
|
+
onLoginClick: Q,
|
|
47
47
|
searchInputProps: n,
|
|
48
48
|
searchValue: a,
|
|
49
|
-
onClearSearch:
|
|
50
|
-
onSearch:
|
|
49
|
+
onClearSearch: z,
|
|
50
|
+
onSearch: m,
|
|
51
51
|
searchSuggestions: d,
|
|
52
52
|
recentSearches: f,
|
|
53
|
-
onClearRecentSearch:
|
|
54
|
-
onCategoryClick:
|
|
55
|
-
onClickModelSerial:
|
|
56
|
-
onCartClick:
|
|
57
|
-
accountPopoverContent:
|
|
58
|
-
isAccountLoading:
|
|
59
|
-
isCategoriesLoading:
|
|
60
|
-
...
|
|
53
|
+
onClearRecentSearch: x,
|
|
54
|
+
onCategoryClick: g,
|
|
55
|
+
onClickModelSerial: D,
|
|
56
|
+
onCartClick: T,
|
|
57
|
+
accountPopoverContent: W,
|
|
58
|
+
isAccountLoading: J,
|
|
59
|
+
isCategoriesLoading: O,
|
|
60
|
+
...R
|
|
61
61
|
}, X) {
|
|
62
|
-
const [
|
|
62
|
+
const [C, h] = F.useState(!1), b = C && !!a && !!d, K = C && !b && !!(f != null && f.length), I = {
|
|
63
63
|
...n,
|
|
64
64
|
onFocus: (s) => {
|
|
65
65
|
var u;
|
|
66
|
-
(u = n == null ? void 0 : n.onFocus) == null || u.call(n, s),
|
|
66
|
+
(u = n == null ? void 0 : n.onFocus) == null || u.call(n, s), h(!0);
|
|
67
67
|
},
|
|
68
68
|
onBlur: (s) => {
|
|
69
69
|
var u;
|
|
70
|
-
(u = n == null ? void 0 : n.onBlur) == null || u.call(n, s),
|
|
70
|
+
(u = n == null ? void 0 : n.onBlur) == null || u.call(n, s), h(!1);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
return /* @__PURE__ */ i(Y, { ...
|
|
73
|
+
return /* @__PURE__ */ i(Y, { ...R, gridWrapperClassName: l(e.main, G), children: /* @__PURE__ */ o(Z, { span: 12, className: e.column, children: [
|
|
74
74
|
/* @__PURE__ */ o(
|
|
75
|
-
|
|
75
|
+
_,
|
|
76
76
|
{
|
|
77
77
|
flexDirection: "row",
|
|
78
78
|
alignItems: "center",
|
|
@@ -81,14 +81,14 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
81
81
|
children: [
|
|
82
82
|
/* @__PURE__ */ i("div", { className: e.logo, children: /* @__PURE__ */ i(y, { href: U, children: /* @__PURE__ */ i($, {}) }) }),
|
|
83
83
|
/* @__PURE__ */ o(
|
|
84
|
-
|
|
84
|
+
_,
|
|
85
85
|
{
|
|
86
86
|
flexDirection: "row",
|
|
87
87
|
alignItems: "center",
|
|
88
88
|
justifyContent: "flex-end",
|
|
89
89
|
className: e.operations,
|
|
90
90
|
children: [
|
|
91
|
-
/* @__PURE__ */ o(
|
|
91
|
+
/* @__PURE__ */ o(_, { flexDirection: "row", hideAt: ["sm"], className: e.search, children: [
|
|
92
92
|
/* @__PURE__ */ i(
|
|
93
93
|
j,
|
|
94
94
|
{
|
|
@@ -98,65 +98,65 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
98
98
|
name: "cpc-search",
|
|
99
99
|
autoComplete: "off",
|
|
100
100
|
"aria-autocomplete": "list",
|
|
101
|
-
...
|
|
101
|
+
...I,
|
|
102
102
|
value: a,
|
|
103
103
|
endAdornment: /* @__PURE__ */ o(B, { children: [
|
|
104
104
|
!!a && /* @__PURE__ */ i(
|
|
105
|
-
|
|
105
|
+
N,
|
|
106
106
|
{
|
|
107
107
|
"aria-label": "Clear search",
|
|
108
|
-
onClick:
|
|
108
|
+
onClick: z,
|
|
109
109
|
iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
112
|
/* @__PURE__ */ i(
|
|
113
|
-
|
|
113
|
+
N,
|
|
114
114
|
{
|
|
115
115
|
"aria-label": "Submit search",
|
|
116
|
-
onClick: () =>
|
|
116
|
+
onClick: () => m == null ? void 0 : m(a ?? ""),
|
|
117
117
|
iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
|
|
118
118
|
}
|
|
119
119
|
)
|
|
120
120
|
] })
|
|
121
121
|
}
|
|
122
122
|
),
|
|
123
|
-
b && d && /* @__PURE__ */ i(
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
b && d && /* @__PURE__ */ i(p, { ...d, onSuggestionClick: () => h(!1), className: e.suggestionDropdown }),
|
|
124
|
+
K && /* @__PURE__ */ i(
|
|
125
|
+
p,
|
|
126
126
|
{
|
|
127
127
|
terms: [],
|
|
128
128
|
categories: [],
|
|
129
129
|
items: [],
|
|
130
130
|
view: "recent-searches",
|
|
131
131
|
recentSearches: f,
|
|
132
|
-
onClearRecentSearch:
|
|
132
|
+
onClearRecentSearch: x,
|
|
133
133
|
className: e.suggestionDropdown
|
|
134
134
|
}
|
|
135
135
|
)
|
|
136
136
|
] }),
|
|
137
|
-
/* @__PURE__ */ o("button", { onClick:
|
|
137
|
+
/* @__PURE__ */ o("button", { onClick: D, className: l(e.siteLink, M(["sm", "md"])), children: [
|
|
138
138
|
/* @__PURE__ */ i(t, { iconKey: "fa-regular fa-sparkles", size: "sm" }),
|
|
139
139
|
"Model/Serial"
|
|
140
140
|
] }),
|
|
141
|
-
/* @__PURE__ */ i(c, { href:
|
|
142
|
-
/* @__PURE__ */ i(c, { href:
|
|
141
|
+
/* @__PURE__ */ i(c, { href: v, hideAt: ["sm", "md"], children: "Custom Parts" }),
|
|
142
|
+
/* @__PURE__ */ i(c, { href: L, hideAt: ["sm", "md"], children: "Contact Us" }),
|
|
143
143
|
/* @__PURE__ */ i("div", { className: e.accountArea, children: /* @__PURE__ */ i(
|
|
144
144
|
ee,
|
|
145
145
|
{
|
|
146
|
-
account:
|
|
147
|
-
onLoginClick:
|
|
146
|
+
account: k,
|
|
147
|
+
onLoginClick: Q,
|
|
148
148
|
className: e.avatar,
|
|
149
|
-
popoverContent:
|
|
150
|
-
isAccountLoading:
|
|
149
|
+
popoverContent: W,
|
|
150
|
+
isAccountLoading: J
|
|
151
151
|
}
|
|
152
152
|
) }),
|
|
153
153
|
/* @__PURE__ */ i(
|
|
154
154
|
P,
|
|
155
155
|
{
|
|
156
156
|
ref: X,
|
|
157
|
-
cart:
|
|
158
|
-
open:
|
|
159
|
-
onCartClick:
|
|
157
|
+
cart: q,
|
|
158
|
+
open: E,
|
|
159
|
+
onCartClick: T
|
|
160
160
|
}
|
|
161
161
|
),
|
|
162
162
|
/* @__PURE__ */ o(V, { hideAt: ["lg"], children: [
|
|
@@ -166,28 +166,28 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
166
166
|
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(
|
|
167
167
|
"button",
|
|
168
168
|
{
|
|
169
|
-
onClick:
|
|
169
|
+
onClick: D,
|
|
170
170
|
"data-hamburger-close": "true",
|
|
171
|
-
className:
|
|
171
|
+
className: l(e.siteLink, e.menuItemAction, M(["lg"])),
|
|
172
172
|
children: [
|
|
173
173
|
/* @__PURE__ */ i(t, { iconKey: "fa-regular fa-sparkles", size: "sm", className: e.shortcutIcon }),
|
|
174
174
|
"Model/Serial"
|
|
175
175
|
]
|
|
176
176
|
}
|
|
177
177
|
) }),
|
|
178
|
-
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href:
|
|
178
|
+
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: v, className: l(e.siteLink, e.menuItemAction), children: [
|
|
179
179
|
/* @__PURE__ */ i(t, { iconKey: "fa-regular fa-screwdriver-wrench", size: "sm", className: e.shortcutIcon }),
|
|
180
180
|
"Custom Parts"
|
|
181
181
|
] }) }),
|
|
182
|
-
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href:
|
|
182
|
+
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: L, className: l(e.siteLink, e.menuItemAction), children: [
|
|
183
183
|
/* @__PURE__ */ i(t, { iconKey: "fa-regular fa-envelope", size: "sm", className: e.shortcutIcon }),
|
|
184
184
|
"Contact Us"
|
|
185
185
|
] }) }),
|
|
186
|
-
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: H, className:
|
|
186
|
+
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: H, className: l(e.siteLink, e.menuItemAction), children: [
|
|
187
187
|
/* @__PURE__ */ i(t, { iconKey: "fa-solid fa-question", size: "sm", className: e.shortcutIcon }),
|
|
188
188
|
"FAQ"
|
|
189
189
|
] }) }),
|
|
190
|
-
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href:
|
|
190
|
+
/* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: S, className: l(e.siteLink, e.menuItemAction), children: [
|
|
191
191
|
/* @__PURE__ */ i(t, { iconKey: "fa-regular fa-people-group", size: "sm", className: e.shortcutIcon }),
|
|
192
192
|
"About Us"
|
|
193
193
|
] }) })
|
|
@@ -200,7 +200,7 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
200
200
|
{
|
|
201
201
|
href: s.route,
|
|
202
202
|
className: e.categoryLink,
|
|
203
|
-
onClick: () =>
|
|
203
|
+
onClick: () => g == null ? void 0 : g(s),
|
|
204
204
|
children: [
|
|
205
205
|
/* @__PURE__ */ i(w, { size: "sm", children: s.label }),
|
|
206
206
|
/* @__PURE__ */ i(
|
|
@@ -222,7 +222,7 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
222
222
|
]
|
|
223
223
|
}
|
|
224
224
|
),
|
|
225
|
-
/* @__PURE__ */ i(
|
|
225
|
+
/* @__PURE__ */ i(_, { flexDirection: "row", hideAt: ["md", "lg"], className: e.mobileSearch, children: /* @__PURE__ */ o("div", { className: e.search, children: [
|
|
226
226
|
/* @__PURE__ */ i(
|
|
227
227
|
j,
|
|
228
228
|
{
|
|
@@ -232,38 +232,38 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
232
232
|
name: "cpc-search",
|
|
233
233
|
autoComplete: "off",
|
|
234
234
|
"aria-autocomplete": "list",
|
|
235
|
-
...
|
|
235
|
+
...I,
|
|
236
236
|
value: a,
|
|
237
237
|
endAdornment: /* @__PURE__ */ o(B, { children: [
|
|
238
238
|
!!a && /* @__PURE__ */ i(
|
|
239
|
-
|
|
239
|
+
N,
|
|
240
240
|
{
|
|
241
241
|
"aria-label": "Clear search",
|
|
242
|
-
onClick:
|
|
242
|
+
onClick: z,
|
|
243
243
|
iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
|
|
244
244
|
}
|
|
245
245
|
),
|
|
246
246
|
/* @__PURE__ */ i(
|
|
247
|
-
|
|
247
|
+
N,
|
|
248
248
|
{
|
|
249
249
|
"aria-label": "Submit search",
|
|
250
|
-
onClick: () =>
|
|
250
|
+
onClick: () => m == null ? void 0 : m(a ?? ""),
|
|
251
251
|
iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
|
|
252
252
|
}
|
|
253
253
|
)
|
|
254
254
|
] })
|
|
255
255
|
}
|
|
256
256
|
),
|
|
257
|
-
b && d && /* @__PURE__ */ i(
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
b && d && /* @__PURE__ */ i(p, { ...d, onSuggestionClick: () => h(!1), className: e.suggestionDropdown }),
|
|
258
|
+
K && /* @__PURE__ */ i(
|
|
259
|
+
p,
|
|
260
260
|
{
|
|
261
261
|
terms: [],
|
|
262
262
|
categories: [],
|
|
263
263
|
items: [],
|
|
264
264
|
view: "recent-searches",
|
|
265
265
|
recentSearches: f,
|
|
266
|
-
onClearRecentSearch:
|
|
266
|
+
onClearRecentSearch: x,
|
|
267
267
|
className: e.suggestionDropdown
|
|
268
268
|
}
|
|
269
269
|
)
|
|
@@ -272,18 +272,18 @@ import '../../assets/MainNav.css';const oe = "_main_12974_1", ne = "_column_1297
|
|
|
272
272
|
ie,
|
|
273
273
|
{
|
|
274
274
|
categories: r,
|
|
275
|
-
isCategoriesLoading:
|
|
276
|
-
onCategoryClick:
|
|
275
|
+
isCategoriesLoading: O,
|
|
276
|
+
onCategoryClick: g
|
|
277
277
|
}
|
|
278
278
|
)
|
|
279
279
|
] }) });
|
|
280
280
|
});
|
|
281
281
|
function c({
|
|
282
282
|
href: A,
|
|
283
|
-
children:
|
|
283
|
+
children: k,
|
|
284
284
|
...r
|
|
285
285
|
}) {
|
|
286
|
-
return /* @__PURE__ */ i(y, { href: A, className: e.siteLink, ...r, children:
|
|
286
|
+
return /* @__PURE__ */ i(y, { href: A, className: e.siteLink, ...r, children: k });
|
|
287
287
|
}
|
|
288
288
|
export {
|
|
289
289
|
je as MainNav
|
|
@@ -24,6 +24,7 @@ export interface SuggestionDropdownProps {
|
|
|
24
24
|
items: SuggestedItem[];
|
|
25
25
|
recentSearches?: RecentSearch[];
|
|
26
26
|
onClearRecentSearch?: (_recentSearch: RecentSearch) => void;
|
|
27
|
+
onSuggestionClick?: () => void;
|
|
27
28
|
className?: string;
|
|
28
29
|
}
|
|
29
|
-
export declare function SuggestionDropdown({ terms, categories, items, view, recentSearches, onClearRecentSearch, className }: SuggestionDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function SuggestionDropdown({ terms, categories, items, view, recentSearches, onClearRecentSearch, onSuggestionClick, className }: SuggestionDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,85 +1,89 @@
|
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsxs as t, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Text as c } from "../../atoms/Text/Text.js";
|
|
3
|
+
import { Link as l } from "../../atoms/Link/Link.js";
|
|
4
|
+
import { Icon as f } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import { c as r } from "../../clsx-OuTLNxxd.js";
|
|
6
|
+
import { Image as d } from "../../atoms/Image/Image.js";
|
|
7
|
+
import '../../assets/SuggestionDropdown.css';const y = "_suggestionDropdown_1fc5y_1", S = "_leftColumn_1fc5y_31", p = "_leftColumnFullWidth_1fc5y_55", L = "_suggestionSectionFullHeight_1fc5y_63", k = "_rightColumn_1fc5y_73", N = "_categorySection_1fc5y_95", v = "_suggestions_1fc5y_101", x = "_categories_1fc5y_103", C = "_suggestionsFullHeight_1fc5y_117", F = "_suggestionLink_1fc5y_147", H = "_categoryLink_1fc5y_149", D = "_itemList_1fc5y_163", w = "_item_1fc5y_163", z = "_itemInfo_1fc5y_221", T = "_recentSearches_1fc5y_231", q = "_recentSearchesHeader_1fc5y_245", W = "_recentSearchesList_1fc5y_253", b = "_recentSearch_1fc5y_231", I = "_recentSearchLink_1fc5y_283", j = "_clearRecentSearch_1fc5y_299", n = {
|
|
8
|
+
suggestionDropdown: y,
|
|
9
|
+
leftColumn: S,
|
|
10
|
+
leftColumnFullWidth: p,
|
|
11
|
+
suggestionSectionFullHeight: L,
|
|
12
|
+
rightColumn: k,
|
|
13
|
+
categorySection: N,
|
|
14
|
+
suggestions: v,
|
|
15
|
+
categories: x,
|
|
16
|
+
suggestionsFullHeight: C,
|
|
17
|
+
suggestionLink: F,
|
|
18
|
+
categoryLink: H,
|
|
19
|
+
itemList: D,
|
|
20
|
+
item: w,
|
|
21
|
+
itemInfo: z,
|
|
22
|
+
recentSearches: T,
|
|
23
|
+
recentSearchesHeader: q,
|
|
24
|
+
recentSearchesList: W,
|
|
25
|
+
recentSearch: b,
|
|
26
|
+
recentSearchLink: I,
|
|
27
|
+
clearRecentSearch: j
|
|
25
28
|
};
|
|
26
|
-
function
|
|
27
|
-
terms:
|
|
28
|
-
categories:
|
|
29
|
-
items:
|
|
30
|
-
view:
|
|
31
|
-
recentSearches:
|
|
32
|
-
onClearRecentSearch:
|
|
33
|
-
|
|
29
|
+
function E({
|
|
30
|
+
terms: o,
|
|
31
|
+
categories: i,
|
|
32
|
+
items: a,
|
|
33
|
+
view: _ = "suggestions",
|
|
34
|
+
recentSearches: m = [],
|
|
35
|
+
onClearRecentSearch: h,
|
|
36
|
+
onSuggestionClick: g,
|
|
37
|
+
className: u
|
|
34
38
|
}) {
|
|
35
|
-
return
|
|
39
|
+
return _ === "recent-searches" ? /* @__PURE__ */ t(
|
|
36
40
|
"div",
|
|
37
41
|
{
|
|
38
|
-
className:
|
|
42
|
+
className: r(n.suggestionDropdown, n.recentSearches, u),
|
|
39
43
|
onMouseDown: (e) => e.preventDefault(),
|
|
40
44
|
children: [
|
|
41
|
-
/* @__PURE__ */ s("div", { className:
|
|
42
|
-
/* @__PURE__ */ s("ol", { className:
|
|
43
|
-
/* @__PURE__ */ s(
|
|
45
|
+
/* @__PURE__ */ s("div", { className: n.recentSearchesHeader, children: /* @__PURE__ */ s(c, { size: "xxs", colorToken: "quaternary", children: "Recent Searches" }) }),
|
|
46
|
+
/* @__PURE__ */ s("ol", { className: n.recentSearchesList, children: m.map((e) => /* @__PURE__ */ t("li", { className: n.recentSearch, children: [
|
|
47
|
+
/* @__PURE__ */ s(l, { href: e.url, className: n.recentSearchLink, children: /* @__PURE__ */ s(c, { size: "sm", children: e.term }) }),
|
|
44
48
|
/* @__PURE__ */ s(
|
|
45
49
|
"button",
|
|
46
50
|
{
|
|
47
51
|
type: "button",
|
|
48
|
-
className:
|
|
52
|
+
className: n.clearRecentSearch,
|
|
49
53
|
"aria-label": `Clear recent search: ${e.term}`,
|
|
50
|
-
onClick: () =>
|
|
51
|
-
children: /* @__PURE__ */ s(
|
|
54
|
+
onClick: () => h == null ? void 0 : h(e),
|
|
55
|
+
children: /* @__PURE__ */ s(f, { iconKey: "fa-regular fa-xmark", size: "sm" })
|
|
52
56
|
}
|
|
53
57
|
)
|
|
54
58
|
] }, e.url)) })
|
|
55
59
|
]
|
|
56
60
|
}
|
|
57
|
-
) : /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */ s("div", { className: r.suggestionSection, children: /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */ s(
|
|
61
|
-
|
|
62
|
-
(e) => /* @__PURE__ */ s(
|
|
61
|
+
) : /* @__PURE__ */ t("div", { className: r(n.suggestionDropdown, u), onMouseDown: (e) => e.preventDefault(), children: [
|
|
62
|
+
(o.length > 0 || i.length > 0) && /* @__PURE__ */ t("div", { className: r(n.leftColumn, { [n.leftColumnFullWidth]: a.length === 0 }), children: [
|
|
63
|
+
o.length > 0 && /* @__PURE__ */ s("div", { className: r(n.suggestionSection, { [n.suggestionSectionFullHeight]: i.length === 0 }), children: /* @__PURE__ */ t("div", { className: r(n.suggestions, { [n.suggestionsFullHeight]: i.length === 0 }), children: [
|
|
64
|
+
/* @__PURE__ */ s(c, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
|
|
65
|
+
o.map(
|
|
66
|
+
(e) => /* @__PURE__ */ s(c, { size: "sm", children: /* @__PURE__ */ s(l, { href: e.url, className: n.suggestionLink, onClick: g, children: e.name }) }, e.url)
|
|
63
67
|
)
|
|
64
68
|
] }) }),
|
|
65
|
-
/* @__PURE__ */ s("div", { className:
|
|
66
|
-
/* @__PURE__ */ s(
|
|
67
|
-
|
|
68
|
-
(e) => /* @__PURE__ */ s(
|
|
69
|
+
i.length > 0 && /* @__PURE__ */ s("div", { className: n.categorySection, children: /* @__PURE__ */ t("div", { className: n.categories, children: [
|
|
70
|
+
/* @__PURE__ */ s(c, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
|
|
71
|
+
i.map(
|
|
72
|
+
(e) => /* @__PURE__ */ s(c, { size: "sm", children: /* @__PURE__ */ s(l, { href: e.url, className: n.categoryLink, onClick: g, children: e.name }) }, e.name)
|
|
69
73
|
)
|
|
70
74
|
] }) })
|
|
71
75
|
] }),
|
|
72
|
-
/* @__PURE__ */ s("div", { className:
|
|
73
|
-
(e) => /* @__PURE__ */ s("li", { className:
|
|
74
|
-
/* @__PURE__ */ s(
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */ s(
|
|
77
|
-
/* @__PURE__ */ s(
|
|
76
|
+
a.length > 0 && /* @__PURE__ */ s("div", { className: n.rightColumn, children: /* @__PURE__ */ s("ol", { className: n.itemList, children: a.map(
|
|
77
|
+
(e) => /* @__PURE__ */ s("li", { className: n.item, children: /* @__PURE__ */ t(l, { href: e.url, onClick: g, children: [
|
|
78
|
+
/* @__PURE__ */ s(d, { src: e.image, alt: `${e.description} product image`, height: 72, width: 72 }),
|
|
79
|
+
/* @__PURE__ */ t("div", { className: n.itemInfo, children: [
|
|
80
|
+
/* @__PURE__ */ s(c, { size: "sm", children: e.description }),
|
|
81
|
+
/* @__PURE__ */ s(c, { size: "sm", colorToken: "quaternary", children: e.itemId })
|
|
78
82
|
] })
|
|
79
83
|
] }) }, e.itemId)
|
|
80
84
|
) }) })
|
|
81
85
|
] });
|
|
82
86
|
}
|
|
83
87
|
export {
|
|
84
|
-
|
|
88
|
+
E as SuggestionDropdown
|
|
85
89
|
};
|
|
@@ -11,4 +11,7 @@ declare const meta: {
|
|
|
11
11
|
export default meta;
|
|
12
12
|
type Story = StoryObj<typeof meta>;
|
|
13
13
|
export declare const Default: Story;
|
|
14
|
+
export declare const WithoutCategories: Story;
|
|
15
|
+
export declare const WithoutItems: Story;
|
|
16
|
+
export declare const OnlyItems: Story;
|
|
14
17
|
export declare const RecentSearches: Story;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { SuggestionDropdown as
|
|
2
|
-
const
|
|
1
|
+
import { SuggestionDropdown as r } from "./SuggestionDropdown.js";
|
|
2
|
+
const a = {
|
|
3
3
|
title: "Case Parts/Organisms/SuggestionDropdown",
|
|
4
|
-
component:
|
|
4
|
+
component: r,
|
|
5
5
|
parameters: {
|
|
6
6
|
layout: "centered"
|
|
7
7
|
},
|
|
8
8
|
tags: ["autodocs"]
|
|
9
|
-
},
|
|
9
|
+
}, e = {
|
|
10
10
|
args: {
|
|
11
11
|
terms: [
|
|
12
12
|
{ name: "thermostat", url: "/search/thermostat" },
|
|
@@ -44,6 +44,22 @@ const s = {
|
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
46
|
}, o = {
|
|
47
|
+
args: {
|
|
48
|
+
...e.args,
|
|
49
|
+
categories: []
|
|
50
|
+
}
|
|
51
|
+
}, c = {
|
|
52
|
+
args: {
|
|
53
|
+
...e.args,
|
|
54
|
+
items: []
|
|
55
|
+
}
|
|
56
|
+
}, n = {
|
|
57
|
+
args: {
|
|
58
|
+
...e.args,
|
|
59
|
+
terms: [],
|
|
60
|
+
categories: []
|
|
61
|
+
}
|
|
62
|
+
}, i = {
|
|
47
63
|
args: {
|
|
48
64
|
view: "recent-searches",
|
|
49
65
|
terms: [],
|
|
@@ -54,11 +70,14 @@ const s = {
|
|
|
54
70
|
{ term: "walk-in cooler", url: "/search/walk-in-cooler" },
|
|
55
71
|
{ term: "thermostat", url: "/search/thermostat" }
|
|
56
72
|
],
|
|
57
|
-
onClearRecentSearch: (
|
|
73
|
+
onClearRecentSearch: (t) => alert(`Clear ${t.term}`)
|
|
58
74
|
}
|
|
59
75
|
};
|
|
60
76
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
e as Default,
|
|
78
|
+
n as OnlyItems,
|
|
79
|
+
i as RecentSearches,
|
|
80
|
+
o as WithoutCategories,
|
|
81
|
+
c as WithoutItems,
|
|
82
|
+
a as default
|
|
64
83
|
};
|