@caseparts-org/caseblocks 0.0.225 → 0.0.227
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/Input.css +1 -1
- package/dist/assets/InputEndAdornmentButton.css +1 -0
- package/dist/assets/MainNav.css +1 -1
- package/dist/assets/SuggestionDropdown.css +1 -0
- package/dist/atoms/Input/Input.d.ts +2 -0
- package/dist/atoms/Input/Input.js +44 -31
- package/dist/atoms/InputEndAdornmentButton/InputEndAdornmentButton.d.ts +6 -0
- package/dist/atoms/InputEndAdornmentButton/InputEndAdornmentButton.js +17 -0
- package/dist/main-client.d.ts +2 -0
- package/dist/main-client.js +48 -48
- package/dist/main-server.d.ts +0 -2
- package/dist/main-server.js +35 -37
- package/dist/main.d.ts +2 -2
- package/dist/main.js +28 -28
- package/dist/organisms/MainNav/MainNav.d.ts +12 -1
- package/dist/organisms/MainNav/MainNav.js +218 -109
- package/dist/organisms/MainNav/MainNav.stories.d.ts +1 -0
- package/dist/organisms/MainNav/MainNav.stories.js +125 -64
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.d.ts +29 -0
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.js +85 -0
- package/dist/{molecules/SearchBox/SearchBox.stories.d.ts → organisms/SuggestionDropdown/SuggestionDropdown.stories.d.ts} +4 -2
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.js +64 -0
- package/package.json +1 -1
- package/dist/assets/SearchBox.css +0 -1
- package/dist/molecules/SearchBox/SearchBox.d.ts +0 -7
- package/dist/molecules/SearchBox/SearchBox.js +0 -65
- package/dist/molecules/SearchBox/SearchBox.stories.js +0 -15
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { MainNav as
|
|
4
|
-
import { Text as
|
|
5
|
-
import { Link as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { CartSlideInPanel as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as y, Fragment as k, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import { MainNav as b } from "./MainNav.js";
|
|
4
|
+
import { Text as p } from "../../atoms/Text/Text.js";
|
|
5
|
+
import { Link as h } from "../../atoms/Link/Link.js";
|
|
6
|
+
import { Button as S } from "../../atoms/Button/Button.js";
|
|
7
|
+
import { CartSlideInPanel as v } from "../../molecules/Cart/CartSlideInPanel.js";
|
|
8
|
+
const x = {
|
|
9
9
|
title: "Case Parts/Organisms/MainNav",
|
|
10
|
-
component:
|
|
10
|
+
component: b,
|
|
11
11
|
parameters: {
|
|
12
12
|
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
13
13
|
layout: "fullscreen"
|
|
14
14
|
}
|
|
15
15
|
// tags: ["autodocs"],
|
|
16
|
-
},
|
|
16
|
+
}, c = [
|
|
17
17
|
{
|
|
18
18
|
id: 0,
|
|
19
19
|
label: "Shop by Brands",
|
|
@@ -106,7 +106,31 @@ const q = {
|
|
|
106
106
|
route: "#",
|
|
107
107
|
children: []
|
|
108
108
|
}
|
|
109
|
-
], a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg",
|
|
109
|
+
], a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", I = {
|
|
110
|
+
terms: [
|
|
111
|
+
{ name: "gasket", url: "/search/gasket" },
|
|
112
|
+
{ name: "gasket strip", url: "/search/gasket-strip" },
|
|
113
|
+
{ name: "gasket material", url: "/search/gasket-material" }
|
|
114
|
+
],
|
|
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" }
|
|
121
|
+
],
|
|
122
|
+
items: [
|
|
123
|
+
{ itemKey: 13503, itemId: "GASKET-RING", description: "Gasket Sample Ring", image: a, url: "/part/GASKET-RING" },
|
|
124
|
+
{ itemKey: 13968, itemId: "810719", description: "26-5/8 x 54-1/4 Door Gasket For True", image: a, url: "/part/810719" },
|
|
125
|
+
{ itemKey: 14853, itemId: "932588", description: "23-3/8 x 26-3/4 Door Gasket For True", image: a, url: "/part/932588" },
|
|
126
|
+
{ itemKey: 435, itemId: "810803", description: "25-5/8 x 54-1/8 Door Gasket For True", image: a, url: "/part/810803" },
|
|
127
|
+
{ itemKey: 14622, itemId: "932587", description: "26-3/4 x 26-3/4 Door Gasket For True", image: a, url: "/part/932587" }
|
|
128
|
+
]
|
|
129
|
+
}, R = [
|
|
130
|
+
{ term: "door gasket", url: "/search/door-gasket" },
|
|
131
|
+
{ term: "walk-in cooler", url: "/search/walk-in-cooler" },
|
|
132
|
+
{ term: "thermostat", url: "/search/thermostat" }
|
|
133
|
+
], s = {
|
|
110
134
|
items: [
|
|
111
135
|
{ id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
|
|
112
136
|
{ id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
|
|
@@ -122,36 +146,36 @@ const q = {
|
|
|
122
146
|
{ id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" }
|
|
123
147
|
]
|
|
124
148
|
};
|
|
125
|
-
function
|
|
149
|
+
function f(e) {
|
|
126
150
|
return `$${e.items.reduce(
|
|
127
|
-
(
|
|
151
|
+
(o, r) => o + (parseFloat(r.price.replace(/[^0-9.]/g, "")) || 0) * r.quantity,
|
|
128
152
|
0
|
|
129
153
|
).toFixed(2)}`;
|
|
130
154
|
}
|
|
131
|
-
const
|
|
132
|
-
/* @__PURE__ */ t(
|
|
133
|
-
/* @__PURE__ */ t(
|
|
134
|
-
/* @__PURE__ */ t(
|
|
135
|
-
/* @__PURE__ */ t(
|
|
136
|
-
/* @__PURE__ */ t(
|
|
137
|
-
] }),
|
|
138
|
-
const [
|
|
139
|
-
return /* @__PURE__ */
|
|
155
|
+
const u = /* @__PURE__ */ y("div", { style: { display: "flex", flexDirection: "column", gap: 8, minWidth: 220 }, children: [
|
|
156
|
+
/* @__PURE__ */ t(p, { size: "sm", weight: "semibold", children: "Account" }),
|
|
157
|
+
/* @__PURE__ */ t(p, { size: "xs", children: "Signed in as Ringo" }),
|
|
158
|
+
/* @__PURE__ */ t(h, { href: "/account", "data-popover-close": "true", children: "View Account" }),
|
|
159
|
+
/* @__PURE__ */ t(h, { href: "/orders", "data-popover-close": "true", children: "Order History" }),
|
|
160
|
+
/* @__PURE__ */ t(S, { size: "sm", variant: "secondary", "data-popover-close": "true", onClick: () => alert("Sign out"), children: "Sign Out" })
|
|
161
|
+
] }), m = (e) => {
|
|
162
|
+
const [i, o] = g(!1);
|
|
163
|
+
return /* @__PURE__ */ y(k, { children: [
|
|
140
164
|
/* @__PURE__ */ t(
|
|
141
|
-
|
|
165
|
+
b,
|
|
142
166
|
{
|
|
143
167
|
...e,
|
|
144
|
-
open:
|
|
145
|
-
onCartClick: () =>
|
|
168
|
+
open: i,
|
|
169
|
+
onCartClick: () => o((r) => !r)
|
|
146
170
|
}
|
|
147
171
|
),
|
|
148
172
|
/* @__PURE__ */ t(
|
|
149
|
-
|
|
173
|
+
v,
|
|
150
174
|
{
|
|
151
|
-
open:
|
|
152
|
-
onClose: () =>
|
|
175
|
+
open: i,
|
|
176
|
+
onClose: () => o(!1),
|
|
153
177
|
cart: e.cart,
|
|
154
|
-
subtotal:
|
|
178
|
+
subtotal: f(e.cart),
|
|
155
179
|
itemPriceLabel: "List Price",
|
|
156
180
|
onItemQtyChange: () => alert("Qty Change"),
|
|
157
181
|
onItemDelete: () => alert("Delete"),
|
|
@@ -159,10 +183,34 @@ const d = /* @__PURE__ */ b("div", { style: { display: "flex", flexDirection: "c
|
|
|
159
183
|
}
|
|
160
184
|
)
|
|
161
185
|
] });
|
|
162
|
-
},
|
|
186
|
+
}, G = (e) => {
|
|
187
|
+
const [i, o] = g(""), [r, C] = g(R);
|
|
188
|
+
return /* @__PURE__ */ t(
|
|
189
|
+
b,
|
|
190
|
+
{
|
|
191
|
+
...e,
|
|
192
|
+
searchValue: i,
|
|
193
|
+
onClearSearch: () => o(""),
|
|
194
|
+
onSearch: (l) => alert(`Search for ${l}`),
|
|
195
|
+
searchSuggestions: i ? I : void 0,
|
|
196
|
+
recentSearches: r,
|
|
197
|
+
onClearRecentSearch: (l) => {
|
|
198
|
+
C((n) => n.filter((d) => d.url !== l.url));
|
|
199
|
+
},
|
|
200
|
+
searchInputProps: {
|
|
201
|
+
...e.searchInputProps,
|
|
202
|
+
value: i,
|
|
203
|
+
onChange: (l) => {
|
|
204
|
+
var n, d;
|
|
205
|
+
(d = (n = e.searchInputProps) == null ? void 0 : n.onChange) == null || d.call(n, l), o(l.target.value);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}, A = {
|
|
163
211
|
args: {
|
|
164
212
|
account: { name: "Ringo", initials: "RS", number: "123456789012" },
|
|
165
|
-
cart:
|
|
213
|
+
cart: s,
|
|
166
214
|
homeRoute: "/",
|
|
167
215
|
customPartsRoute: "/custom",
|
|
168
216
|
onClickModelSerial: () => {
|
|
@@ -174,23 +222,20 @@ const d = /* @__PURE__ */ b("div", { style: { display: "flex", flexDirection: "c
|
|
|
174
222
|
onLoginClick: () => {
|
|
175
223
|
alert("Login");
|
|
176
224
|
},
|
|
177
|
-
onSearch: (e) => {
|
|
178
|
-
alert(`Search ${e}`);
|
|
179
|
-
},
|
|
180
225
|
onCategoryClick: (e) => {
|
|
181
226
|
alert(`Category ${e.label}`);
|
|
182
227
|
},
|
|
183
228
|
onCartClick: () => {
|
|
184
229
|
},
|
|
185
230
|
// placeholder required by component
|
|
186
|
-
categories:
|
|
187
|
-
accountPopoverContent:
|
|
231
|
+
categories: c,
|
|
232
|
+
accountPopoverContent: u
|
|
188
233
|
},
|
|
189
|
-
render:
|
|
190
|
-
},
|
|
234
|
+
render: m
|
|
235
|
+
}, F = {
|
|
191
236
|
args: {
|
|
192
237
|
account: { name: "Ringo", initials: "RS", number: "123456789012" },
|
|
193
|
-
cart:
|
|
238
|
+
cart: s,
|
|
194
239
|
homeRoute: "/",
|
|
195
240
|
customPartsRoute: "/custom",
|
|
196
241
|
onClickModelSerial: () => {
|
|
@@ -202,21 +247,19 @@ const d = /* @__PURE__ */ b("div", { style: { display: "flex", flexDirection: "c
|
|
|
202
247
|
onLoginClick: () => {
|
|
203
248
|
alert("Login");
|
|
204
249
|
},
|
|
205
|
-
onSearch: (e) => {
|
|
206
|
-
alert(`Search ${e}`);
|
|
207
|
-
},
|
|
208
250
|
onCategoryClick: (e) => {
|
|
209
251
|
alert(`Category ${e.label}`);
|
|
210
252
|
},
|
|
211
253
|
onCartClick: () => {
|
|
212
254
|
},
|
|
213
|
-
categories:
|
|
214
|
-
accountPopoverContent:
|
|
255
|
+
categories: c,
|
|
256
|
+
accountPopoverContent: u
|
|
215
257
|
},
|
|
216
|
-
render:
|
|
217
|
-
},
|
|
258
|
+
render: m
|
|
259
|
+
}, w = {
|
|
218
260
|
args: {
|
|
219
|
-
|
|
261
|
+
account: { name: "Ringo", initials: "RS", number: "123456789012" },
|
|
262
|
+
cart: s,
|
|
220
263
|
homeRoute: "/",
|
|
221
264
|
customPartsRoute: "/custom",
|
|
222
265
|
onClickModelSerial: () => {
|
|
@@ -228,21 +271,41 @@ const d = /* @__PURE__ */ b("div", { style: { display: "flex", flexDirection: "c
|
|
|
228
271
|
onLoginClick: () => {
|
|
229
272
|
alert("Login");
|
|
230
273
|
},
|
|
231
|
-
|
|
232
|
-
alert(`
|
|
274
|
+
onCategoryClick: (e) => {
|
|
275
|
+
alert(`Category ${e.label}`);
|
|
276
|
+
},
|
|
277
|
+
onCartClick: () => {
|
|
278
|
+
},
|
|
279
|
+
categories: c,
|
|
280
|
+
accountPopoverContent: u
|
|
281
|
+
},
|
|
282
|
+
render: G
|
|
283
|
+
}, K = {
|
|
284
|
+
args: {
|
|
285
|
+
cart: s,
|
|
286
|
+
homeRoute: "/",
|
|
287
|
+
customPartsRoute: "/custom",
|
|
288
|
+
onClickModelSerial: () => {
|
|
289
|
+
alert("Model/Serial");
|
|
290
|
+
},
|
|
291
|
+
faqRoute: "/faq",
|
|
292
|
+
aboutUsRoute: "/about",
|
|
293
|
+
contactRoute: "/contact",
|
|
294
|
+
onLoginClick: () => {
|
|
295
|
+
alert("Login");
|
|
233
296
|
},
|
|
234
297
|
onCategoryClick: (e) => {
|
|
235
298
|
alert(`Category ${e.label}`);
|
|
236
299
|
},
|
|
237
300
|
onCartClick: () => {
|
|
238
301
|
},
|
|
239
|
-
categories:
|
|
302
|
+
categories: c
|
|
240
303
|
},
|
|
241
|
-
render:
|
|
242
|
-
},
|
|
304
|
+
render: m
|
|
305
|
+
}, T = {
|
|
243
306
|
args: {
|
|
244
307
|
account: { name: "Ringo", initials: "RS", number: "123456789012" },
|
|
245
|
-
cart:
|
|
308
|
+
cart: s,
|
|
246
309
|
homeRoute: "/",
|
|
247
310
|
customPartsRoute: "/custom",
|
|
248
311
|
onClickModelSerial: () => {
|
|
@@ -254,25 +317,23 @@ const d = /* @__PURE__ */ b("div", { style: { display: "flex", flexDirection: "c
|
|
|
254
317
|
onLoginClick: () => {
|
|
255
318
|
alert("Login");
|
|
256
319
|
},
|
|
257
|
-
onSearch: (e) => {
|
|
258
|
-
alert(`Search ${e}`);
|
|
259
|
-
},
|
|
260
320
|
onCategoryClick: (e) => {
|
|
261
321
|
alert(`Category ${e.label}`);
|
|
262
322
|
},
|
|
263
323
|
onCartClick: () => {
|
|
264
324
|
},
|
|
265
|
-
categories:
|
|
266
|
-
accountPopoverContent:
|
|
325
|
+
categories: c,
|
|
326
|
+
accountPopoverContent: u,
|
|
267
327
|
isAccountLoading: !0,
|
|
268
328
|
isCategoriesLoading: !0
|
|
269
329
|
},
|
|
270
|
-
render:
|
|
330
|
+
render: m
|
|
271
331
|
};
|
|
272
332
|
export {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
333
|
+
A as Authenticated,
|
|
334
|
+
T as Loading,
|
|
335
|
+
K as Unauthenticated,
|
|
336
|
+
F as WithCartItems,
|
|
337
|
+
w as WithSearchSuggestions,
|
|
338
|
+
x as default
|
|
278
339
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type SuggestedCategory = {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
};
|
|
5
|
+
export type SuggestedTerm = {
|
|
6
|
+
name: string;
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
export type SuggestedItem = {
|
|
10
|
+
itemKey: number;
|
|
11
|
+
itemId: string;
|
|
12
|
+
description: string;
|
|
13
|
+
image: string;
|
|
14
|
+
url: string;
|
|
15
|
+
};
|
|
16
|
+
export type RecentSearch = {
|
|
17
|
+
term: string;
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
export interface SuggestionDropdownProps {
|
|
21
|
+
view?: "suggestions" | "recent-searches";
|
|
22
|
+
terms: SuggestedTerm[];
|
|
23
|
+
categories: SuggestedCategory[];
|
|
24
|
+
items: SuggestedItem[];
|
|
25
|
+
recentSearches?: RecentSearch[];
|
|
26
|
+
onClearRecentSearch?: (_recentSearch: RecentSearch) => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function SuggestionDropdown({ terms, categories, items, view, recentSearches, onClearRecentSearch, className }: SuggestionDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs as n, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Text as i } from "../../atoms/Text/Text.js";
|
|
3
|
+
import { Link as c } from "../../atoms/Link/Link.js";
|
|
4
|
+
import { Icon as g } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import { c as a } from "../../clsx-OuTLNxxd.js";
|
|
6
|
+
import { Image as u } from "../../atoms/Image/Image.js";
|
|
7
|
+
import '../../assets/SuggestionDropdown.css';const k = "_suggestionDropdown_zk1ld_1", z = "_leftColumn_zk1ld_31", f = "_rightColumn_zk1ld_55", S = "_categorySection_zk1ld_75", p = "_suggestions_zk1ld_81", L = "_categories_zk1ld_83", N = "_suggestionLink_zk1ld_119", y = "_categoryLink_zk1ld_121", v = "_itemList_zk1ld_135", x = "_item_zk1ld_135", D = "_itemInfo_zk1ld_193", w = "_recentSearches_zk1ld_203", C = "_recentSearchesHeader_zk1ld_217", T = "_recentSearchesList_zk1ld_225", q = "_recentSearch_zk1ld_203", H = "_recentSearchLink_zk1ld_255", b = "_clearRecentSearch_zk1ld_271", r = {
|
|
8
|
+
suggestionDropdown: k,
|
|
9
|
+
leftColumn: z,
|
|
10
|
+
rightColumn: f,
|
|
11
|
+
categorySection: S,
|
|
12
|
+
suggestions: p,
|
|
13
|
+
categories: L,
|
|
14
|
+
suggestionLink: N,
|
|
15
|
+
categoryLink: y,
|
|
16
|
+
itemList: v,
|
|
17
|
+
item: x,
|
|
18
|
+
itemInfo: D,
|
|
19
|
+
recentSearches: w,
|
|
20
|
+
recentSearchesHeader: C,
|
|
21
|
+
recentSearchesList: T,
|
|
22
|
+
recentSearch: q,
|
|
23
|
+
recentSearchLink: H,
|
|
24
|
+
clearRecentSearch: b
|
|
25
|
+
};
|
|
26
|
+
function A({
|
|
27
|
+
terms: l,
|
|
28
|
+
categories: d,
|
|
29
|
+
items: h,
|
|
30
|
+
view: m = "suggestions",
|
|
31
|
+
recentSearches: _ = [],
|
|
32
|
+
onClearRecentSearch: t,
|
|
33
|
+
className: o
|
|
34
|
+
}) {
|
|
35
|
+
return m === "recent-searches" ? /* @__PURE__ */ n(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: a(r.suggestionDropdown, r.recentSearches, o),
|
|
39
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ s("div", { className: r.recentSearchesHeader, children: /* @__PURE__ */ s(i, { size: "xxs", colorToken: "quaternary", children: "Recent Searches" }) }),
|
|
42
|
+
/* @__PURE__ */ s("ol", { className: r.recentSearchesList, children: _.map((e) => /* @__PURE__ */ n("li", { className: r.recentSearch, children: [
|
|
43
|
+
/* @__PURE__ */ s(c, { href: e.url, className: r.recentSearchLink, children: /* @__PURE__ */ s(i, { size: "sm", children: e.term }) }),
|
|
44
|
+
/* @__PURE__ */ s(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
className: r.clearRecentSearch,
|
|
49
|
+
"aria-label": `Clear recent search: ${e.term}`,
|
|
50
|
+
onClick: () => t == null ? void 0 : t(e),
|
|
51
|
+
children: /* @__PURE__ */ s(g, { iconKey: "fa-regular fa-xmark", size: "sm" })
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] }, e.url)) })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
) : /* @__PURE__ */ n("div", { className: a(r.suggestionDropdown, o), onMouseDown: (e) => e.preventDefault(), children: [
|
|
58
|
+
/* @__PURE__ */ n("div", { className: r.leftColumn, children: [
|
|
59
|
+
/* @__PURE__ */ s("div", { className: r.suggestionSection, children: /* @__PURE__ */ n("div", { className: r.suggestions, children: [
|
|
60
|
+
/* @__PURE__ */ s(i, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
|
|
61
|
+
l.map(
|
|
62
|
+
(e) => /* @__PURE__ */ s(i, { size: "sm", children: /* @__PURE__ */ s(c, { href: e.url, className: r.suggestionLink, children: e.name }) }, e.url)
|
|
63
|
+
)
|
|
64
|
+
] }) }),
|
|
65
|
+
/* @__PURE__ */ s("div", { className: r.categorySection, children: /* @__PURE__ */ n("div", { className: r.categories, children: [
|
|
66
|
+
/* @__PURE__ */ s(i, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
|
|
67
|
+
d.map(
|
|
68
|
+
(e) => /* @__PURE__ */ s(i, { size: "sm", children: /* @__PURE__ */ s(c, { href: e.url, className: r.categoryLink, children: e.name }) }, e.name)
|
|
69
|
+
)
|
|
70
|
+
] }) })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ s("div", { className: r.rightColumn, children: /* @__PURE__ */ s("ol", { className: r.itemList, children: h.map(
|
|
73
|
+
(e) => /* @__PURE__ */ s("li", { className: r.item, children: /* @__PURE__ */ n(c, { href: e.url, children: [
|
|
74
|
+
/* @__PURE__ */ s(u, { src: e.image, alt: `${e.description} product image`, height: 72, width: 72 }),
|
|
75
|
+
/* @__PURE__ */ n("div", { className: r.itemInfo, children: [
|
|
76
|
+
/* @__PURE__ */ s(i, { size: "sm", children: e.description }),
|
|
77
|
+
/* @__PURE__ */ s(i, { size: "sm", colorToken: "quaternary", children: e.itemId })
|
|
78
|
+
] })
|
|
79
|
+
] }) }, e.itemId)
|
|
80
|
+
) }) })
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
A as SuggestionDropdown
|
|
85
|
+
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import {
|
|
2
|
+
import { SuggestionDropdown } from './SuggestionDropdown';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: typeof
|
|
5
|
+
component: typeof SuggestionDropdown;
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
8
8
|
};
|
|
9
|
+
tags: string[];
|
|
9
10
|
};
|
|
10
11
|
export default meta;
|
|
11
12
|
type Story = StoryObj<typeof meta>;
|
|
12
13
|
export declare const Default: Story;
|
|
14
|
+
export declare const RecentSearches: Story;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SuggestionDropdown as t } from "./SuggestionDropdown.js";
|
|
2
|
+
const s = {
|
|
3
|
+
title: "Case Parts/Organisms/SuggestionDropdown",
|
|
4
|
+
component: t,
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: "centered"
|
|
7
|
+
},
|
|
8
|
+
tags: ["autodocs"]
|
|
9
|
+
}, a = {
|
|
10
|
+
args: {
|
|
11
|
+
terms: [
|
|
12
|
+
{ name: "thermostat", url: "/search/thermostat" },
|
|
13
|
+
{ name: "sensor", url: "/search/sensor" },
|
|
14
|
+
{ name: "cover", url: "/search/cover" },
|
|
15
|
+
{ name: "wiring", url: "/search/wiring" }
|
|
16
|
+
],
|
|
17
|
+
categories: [
|
|
18
|
+
{ name: "Heating", url: "/categories/heating" },
|
|
19
|
+
{ name: "Accessories", url: "/categories/accessories" },
|
|
20
|
+
{ name: "Controls", url: "/categories/controls" }
|
|
21
|
+
],
|
|
22
|
+
items: [
|
|
23
|
+
{
|
|
24
|
+
itemKey: 1,
|
|
25
|
+
itemId: "P-1001",
|
|
26
|
+
description: "Smart Thermostat",
|
|
27
|
+
image: "https://placehold.co/120x80/png?text=Thermostat",
|
|
28
|
+
url: "/parts/p-1001"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
itemKey: 2,
|
|
32
|
+
itemId: "P-1002",
|
|
33
|
+
description: "Wire Harness",
|
|
34
|
+
image: "https://placehold.co/120x80/png?text=Harness",
|
|
35
|
+
url: "/parts/p-1002"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
itemKey: 3,
|
|
39
|
+
itemId: "P-1003",
|
|
40
|
+
description: "Replacement Cover",
|
|
41
|
+
image: "https://placehold.co/120x80/png?text=Cover",
|
|
42
|
+
url: "/parts/p-1003"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}, o = {
|
|
47
|
+
args: {
|
|
48
|
+
view: "recent-searches",
|
|
49
|
+
terms: [],
|
|
50
|
+
categories: [],
|
|
51
|
+
items: [],
|
|
52
|
+
recentSearches: [
|
|
53
|
+
{ term: "door gasket", url: "/search/door-gasket" },
|
|
54
|
+
{ term: "walk-in cooler", url: "/search/walk-in-cooler" },
|
|
55
|
+
{ term: "thermostat", url: "/search/thermostat" }
|
|
56
|
+
],
|
|
57
|
+
onClearRecentSearch: (e) => alert(`Clear ${e.term}`)
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
a as Default,
|
|
62
|
+
o as RecentSearches,
|
|
63
|
+
s as default
|
|
64
|
+
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._button_11jol_1{box-sizing:border-box;cursor:pointer;width:var(--spacing-2-5);height:var(--spacing-2-5);padding:var(--spacing-0-5);border-width:0;border-radius:0px var(--spacing-0-125) var(--spacing-0-125) 0px;display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:inherit;color:var(--icons-icon-search)}._text_11jol_16{flex:1;position:relative;border:none;border-radius:40px;outline:none;font-family:var(--font-family-body);font-size:var(--font-size-sm);line-height:var(--line-height-sm);background:var(--surface-surface-searchBar, #f6f6f6);padding:0px var(--spacing-0-5) 0px var(--spacing-0-5)}._text_11jol_16::placeholder{font-style:italic;font-weight:var(--font-weight-light);color:var(--text-text-search-bar)}._input_11jol_33{flex:1;padding:0px 0px 0px var(--spacing-0-5);box-sizing:border-box}._inputSearch_11jol_38{flex:1;border-radius:var(--spacing-0-125)}._searchfield_11jol_42{flex:1;height:var(--spacing-2-5);border-radius:var(--spacing-2-5);overflow:hidden;background-color:var(--surface-surface-search-bar)}._searchBox_11jol_49{flex:1;width:100%;min-width:250px;height:var(--spacing-2-5);position:relative;border-radius:var(--spacing-2-5);overflow:hidden;text-align:left;background-color:var(--surface-surface-search-bar)}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HideAtProps } from '../../atoms/HideAt';
|
|
2
|
-
/** A search box. */
|
|
3
|
-
export interface SearchBoxProps extends React.HTMLAttributes<HTMLDivElement>, HideAtProps {
|
|
4
|
-
onSearch: (_input: string) => void;
|
|
5
|
-
inputName?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function SearchBox({ onSearch, inputName, hideAt, className, ...otherProps }: SearchBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import { c as h } from "../../clsx-OuTLNxxd.js";
|
|
3
|
-
import { Flex as c } from "../../atoms/Flex/Flex.js";
|
|
4
|
-
import { getHideAtStyles as u } from "../../atoms/HideAt.js";
|
|
5
|
-
import { Icon as f } from "../../atoms/Icon/Icon.js";
|
|
6
|
-
import '../../assets/SearchBox.css';const p = "_button_11jol_1", x = "_text_11jol_16", _ = "_input_11jol_33", d = "_inputSearch_11jol_38", g = "_searchfield_11jol_42", b = "_searchBox_11jol_49", t = {
|
|
7
|
-
button: p,
|
|
8
|
-
text: x,
|
|
9
|
-
input: _,
|
|
10
|
-
inputSearch: d,
|
|
11
|
-
searchfield: g,
|
|
12
|
-
searchBox: b
|
|
13
|
-
};
|
|
14
|
-
function N({
|
|
15
|
-
onSearch: o,
|
|
16
|
-
inputName: n,
|
|
17
|
-
hideAt: s,
|
|
18
|
-
className: a,
|
|
19
|
-
...i
|
|
20
|
-
}) {
|
|
21
|
-
return /* @__PURE__ */ e(
|
|
22
|
-
c,
|
|
23
|
-
{
|
|
24
|
-
flexDirection: "row",
|
|
25
|
-
alignItems: "center",
|
|
26
|
-
className: h(t.searchBox, u(s), a),
|
|
27
|
-
...i,
|
|
28
|
-
children: /* @__PURE__ */ e(
|
|
29
|
-
c,
|
|
30
|
-
{
|
|
31
|
-
flexDirection: "row",
|
|
32
|
-
alignItems: "center",
|
|
33
|
-
className: t.searchfield,
|
|
34
|
-
children: /* @__PURE__ */ e("div", { className: t.inputSearch, children: /* @__PURE__ */ e("form", { onSubmit: (r) => {
|
|
35
|
-
r.preventDefault();
|
|
36
|
-
const l = (new FormData(r.currentTarget).get(n ?? "search") || "").trim();
|
|
37
|
-
o(l), r.currentTarget.reset();
|
|
38
|
-
}, children: /* @__PURE__ */ m(
|
|
39
|
-
c,
|
|
40
|
-
{
|
|
41
|
-
className: t.input,
|
|
42
|
-
flexDirection: "row",
|
|
43
|
-
alignItems: "center",
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ e("button", { className: t.button, type: "submit", children: /* @__PURE__ */ e(f, { iconKey: "fa-regular fa-magnifying-glass", size: "md" }) }),
|
|
46
|
-
/* @__PURE__ */ e(
|
|
47
|
-
"input",
|
|
48
|
-
{
|
|
49
|
-
type: "text",
|
|
50
|
-
className: t.text,
|
|
51
|
-
placeholder: "Search by keyword(s) or Part #....",
|
|
52
|
-
name: n ?? "search"
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
) }) })
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
N as SearchBox
|
|
65
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SearchBox as a } from "./SearchBox.js";
|
|
2
|
-
const r = {
|
|
3
|
-
title: "Case Parts/Molecules/SearchBox",
|
|
4
|
-
component: a,
|
|
5
|
-
parameters: {
|
|
6
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
7
|
-
layout: "centered"
|
|
8
|
-
}
|
|
9
|
-
}, o = {
|
|
10
|
-
args: { onSearch: (e) => alert(`Search ${e}`) }
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
o as Default,
|
|
14
|
-
r as default
|
|
15
|
-
};
|