@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.
@@ -1,144 +1,209 @@
1
- import { jsx as n, jsxs as s } from "react/jsx-runtime";
2
- import S from "react";
3
- import { Text as h } from "../../atoms/Text/Text.js";
4
- import { Link as u } from "../../atoms/Link/Link.js";
5
- import { Icon as i } from "../../atoms/Icon/Icon.js";
6
- import { Flex as m } from "../../atoms/Flex/Flex.js";
7
- import { Grid as U, Column as C } from "../../atoms/Grid/Grid.js";
8
- import { Logo as F } from "../../molecules/Logo/Logo.js";
9
- import { SearchBox as g } from "../../molecules/SearchBox/SearchBox.js";
10
- import { HamburgerMenu as H } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
11
- import { ShoppingCart as q } from "../../molecules/Cart/Cart.js";
12
- import { Account as B } from "../../molecules/Account/Account.js";
13
- import { CategoryNav as G } from "../../molecules/CategoryNav/CategoryNav.js";
14
- import { getHideAtStyles as x } from "../../atoms/HideAt.js";
1
+ import { jsx as i, jsxs as o, Fragment as B } from "react/jsx-runtime";
2
+ import F from "react";
3
+ import { Text as w } from "../../atoms/Text/Text.js";
4
+ import { Link as y } from "../../atoms/Link/Link.js";
5
+ import { Icon as a } from "../../atoms/Icon/Icon.js";
6
+ import { Flex as g } from "../../atoms/Flex/Flex.js";
7
+ import { Grid as Y, Column as Z } from "../../atoms/Grid/Grid.js";
8
+ import { Input as j } from "../../atoms/Input/Input.js";
9
+ import { InputEndAdornmentButton as _ } from "../../atoms/InputEndAdornmentButton/InputEndAdornmentButton.js";
10
+ import { Logo as $ } from "../../molecules/Logo/Logo.js";
11
+ import { HamburgerMenu as V } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
12
+ import { ShoppingCart as P } from "../../molecules/Cart/Cart.js";
13
+ import { Account as ee } from "../../molecules/Account/Account.js";
14
+ import { CategoryNav as ie } from "../../molecules/CategoryNav/CategoryNav.js";
15
+ import { SuggestionDropdown as N } from "../SuggestionDropdown/SuggestionDropdown.js";
16
+ import { getHideAtStyles as M } from "../../atoms/HideAt.js";
15
17
  import { c as t } from "../../clsx-OuTLNxxd.js";
16
- import '../../assets/MainNav.css';const P = "_main_14nx2_1", Q = "_column_14nx2_8", T = "_topNav_14nx2_13", W = "_logo_14nx2_21", E = "_operations_14nx2_24", J = "_search_14nx2_31", O = "_siteLink_14nx2_34", R = "_accountArea_14nx2_61", V = "_category_14nx2_73", X = "_categoryLink_14nx2_81", Y = "_menuList_14nx2_97", Z = "_menuItemAction_14nx2_120", $ = "_shortcutIcon_14nx2_129", e = {
17
- main: P,
18
- column: Q,
19
- topNav: T,
20
- logo: W,
21
- operations: E,
22
- search: J,
23
- siteLink: O,
24
- accountArea: R,
25
- category: V,
26
- categoryLink: X,
27
- menuList: Y,
28
- menuItemAction: Z,
29
- shortcutIcon: $
30
- }, pe = S.forwardRef(function({
31
- account: l,
32
- categories: r,
33
- homeRoute: I,
34
- faqRoute: L,
35
- customPartsRoute: f,
36
- aboutUsRoute: A,
37
- contactRoute: p,
38
- cart: v,
39
- open: k,
18
+ import '../../assets/MainNav.css';const oe = "_main_12974_1", se = "_column_12974_8", ne = "_topNav_12974_13", ae = "_logo_12974_21", te = "_operations_12974_24", me = "_search_12974_31", ce = "_mobileSearch_12974_36", le = "_suggestionDropdown_12974_39", re = "_siteLink_12974_45", de = "_accountArea_12974_72", fe = "_category_12974_84", ue = "_categoryLink_12974_92", he = "_menuList_12974_108", ge = "_menuItemAction_12974_131", _e = "_shortcutIcon_12974_140", e = {
19
+ main: oe,
20
+ column: se,
21
+ topNav: ne,
22
+ logo: ae,
23
+ operations: te,
24
+ search: me,
25
+ mobileSearch: ce,
26
+ suggestionDropdown: le,
27
+ siteLink: re,
28
+ accountArea: de,
29
+ category: fe,
30
+ categoryLink: ue,
31
+ menuList: he,
32
+ menuItemAction: ge,
33
+ shortcutIcon: _e
34
+ }, je = F.forwardRef(function({
35
+ account: p,
36
+ categories: l,
37
+ homeRoute: U,
38
+ faqRoute: H,
39
+ customPartsRoute: k,
40
+ aboutUsRoute: q,
41
+ contactRoute: L,
42
+ cart: E,
43
+ open: G,
40
44
  // consume external panel control props from CartPropsBase
41
- className: y,
42
- onLoginClick: b,
43
- onSearch: N,
44
- onCategoryClick: o,
45
- onClickModelSerial: _,
46
- onCartClick: w,
47
- accountPopoverContent: z,
48
- isAccountLoading: K,
49
- isCategoriesLoading: j,
50
- ...D
51
- }, M) {
52
- return /* @__PURE__ */ n(U, { ...D, gridWrapperClassName: t(e.main, y), children: /* @__PURE__ */ s(C, { span: 12, className: e.column, children: [
53
- /* @__PURE__ */ s(
54
- m,
45
+ className: Q,
46
+ onLoginClick: T,
47
+ searchInputProps: s,
48
+ searchValue: r,
49
+ onClearSearch: v,
50
+ onSearch: m,
51
+ searchSuggestions: d,
52
+ recentSearches: f,
53
+ onClearRecentSearch: z,
54
+ onCategoryClick: h,
55
+ onClickModelSerial: x,
56
+ onCartClick: W,
57
+ accountPopoverContent: J,
58
+ isAccountLoading: O,
59
+ isCategoriesLoading: R,
60
+ ...S
61
+ }, X) {
62
+ const [D, K] = F.useState(!1), b = D && !!r && !!d, I = D && !b && !!(f != null && f.length), C = {
63
+ ...s,
64
+ onFocus: (n) => {
65
+ var u;
66
+ (u = s == null ? void 0 : s.onFocus) == null || u.call(s, n), K(!0);
67
+ },
68
+ onBlur: (n) => {
69
+ var u;
70
+ (u = s == null ? void 0 : s.onBlur) == null || u.call(s, n), K(!1);
71
+ }
72
+ };
73
+ return /* @__PURE__ */ i(Y, { ...S, gridWrapperClassName: t(e.main, Q), children: /* @__PURE__ */ o(Z, { span: 12, className: e.column, children: [
74
+ /* @__PURE__ */ o(
75
+ g,
55
76
  {
56
77
  flexDirection: "row",
57
78
  alignItems: "center",
58
79
  justifyContent: "space-between",
59
80
  className: e.topNav,
60
81
  children: [
61
- /* @__PURE__ */ n("div", { className: e.logo, children: /* @__PURE__ */ n(u, { href: I, children: /* @__PURE__ */ n(F, {}) }) }),
62
- /* @__PURE__ */ s(
63
- m,
82
+ /* @__PURE__ */ i("div", { className: e.logo, children: /* @__PURE__ */ i(y, { href: U, children: /* @__PURE__ */ i($, {}) }) }),
83
+ /* @__PURE__ */ o(
84
+ g,
64
85
  {
65
86
  flexDirection: "row",
66
87
  alignItems: "center",
67
88
  justifyContent: "flex-end",
68
89
  className: e.operations,
69
90
  children: [
70
- /* @__PURE__ */ n(m, { flexDirection: "row", hideAt: ["sm"], className: e.search, children: /* @__PURE__ */ n(g, { onSearch: N, inputName: "cpc-search" }) }),
71
- /* @__PURE__ */ s("button", { onClick: _, className: t(e.siteLink, x(["sm", "md"])), children: [
72
- /* @__PURE__ */ n(i, { iconKey: "fa-regular fa-sparkles", size: "sm" }),
91
+ /* @__PURE__ */ o(g, { flexDirection: "row", hideAt: ["sm"], className: e.search, children: [
92
+ /* @__PURE__ */ i(
93
+ j,
94
+ {
95
+ variant: "search",
96
+ label: "Search",
97
+ placeholder: "Search by keyword(s) or Part #....",
98
+ name: "cpc-search",
99
+ autoComplete: "off",
100
+ "aria-autocomplete": "list",
101
+ ...C,
102
+ endAdornment: /* @__PURE__ */ o(B, { children: [
103
+ !!r && /* @__PURE__ */ i(
104
+ _,
105
+ {
106
+ "aria-label": "Clear search",
107
+ onClick: v,
108
+ iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
109
+ }
110
+ ),
111
+ /* @__PURE__ */ i(
112
+ _,
113
+ {
114
+ "aria-label": "Submit search",
115
+ onClick: () => m == null ? void 0 : m(r ?? ""),
116
+ iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
117
+ }
118
+ )
119
+ ] })
120
+ }
121
+ ),
122
+ b && d && /* @__PURE__ */ i(N, { ...d, className: e.suggestionDropdown }),
123
+ I && /* @__PURE__ */ i(
124
+ N,
125
+ {
126
+ terms: [],
127
+ categories: [],
128
+ items: [],
129
+ view: "recent-searches",
130
+ recentSearches: f,
131
+ onClearRecentSearch: z,
132
+ className: e.suggestionDropdown
133
+ }
134
+ )
135
+ ] }),
136
+ /* @__PURE__ */ o("button", { onClick: x, className: t(e.siteLink, M(["sm", "md"])), children: [
137
+ /* @__PURE__ */ i(a, { iconKey: "fa-regular fa-sparkles", size: "sm" }),
73
138
  "Model/Serial"
74
139
  ] }),
75
- /* @__PURE__ */ n(c, { href: f, hideAt: ["sm", "md"], children: "Custom Parts" }),
76
- /* @__PURE__ */ n(c, { href: p, hideAt: ["sm", "md"], children: "Contact Us" }),
77
- /* @__PURE__ */ n("div", { className: e.accountArea, children: /* @__PURE__ */ n(
78
- B,
140
+ /* @__PURE__ */ i(c, { href: k, hideAt: ["sm", "md"], children: "Custom Parts" }),
141
+ /* @__PURE__ */ i(c, { href: L, hideAt: ["sm", "md"], children: "Contact Us" }),
142
+ /* @__PURE__ */ i("div", { className: e.accountArea, children: /* @__PURE__ */ i(
143
+ ee,
79
144
  {
80
- account: l,
81
- onLoginClick: b,
145
+ account: p,
146
+ onLoginClick: T,
82
147
  className: e.avatar,
83
- popoverContent: z,
84
- isAccountLoading: K
148
+ popoverContent: J,
149
+ isAccountLoading: O
85
150
  }
86
151
  ) }),
87
- /* @__PURE__ */ n(
88
- q,
152
+ /* @__PURE__ */ i(
153
+ P,
89
154
  {
90
- ref: M,
91
- cart: v,
92
- open: k,
93
- onCartClick: w
155
+ ref: X,
156
+ cart: E,
157
+ open: G,
158
+ onCartClick: W
94
159
  }
95
160
  ),
96
- /* @__PURE__ */ s(H, { hideAt: ["lg"], children: [
97
- /* @__PURE__ */ s("section", { children: [
98
- /* @__PURE__ */ n(h, { size: "md", weight: "semibold", children: "Useful shortcuts" }),
99
- /* @__PURE__ */ s("ul", { className: e.menuList, children: [
100
- /* @__PURE__ */ n("li", { className: e.menuItem, children: /* @__PURE__ */ s(
161
+ /* @__PURE__ */ o(V, { hideAt: ["lg"], children: [
162
+ /* @__PURE__ */ o("section", { children: [
163
+ /* @__PURE__ */ i(w, { size: "md", weight: "semibold", children: "Useful shortcuts" }),
164
+ /* @__PURE__ */ o("ul", { className: e.menuList, children: [
165
+ /* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(
101
166
  "button",
102
167
  {
103
- onClick: _,
168
+ onClick: x,
104
169
  "data-hamburger-close": "true",
105
- className: t(e.siteLink, e.menuItemAction, x(["lg"])),
170
+ className: t(e.siteLink, e.menuItemAction, M(["lg"])),
106
171
  children: [
107
- /* @__PURE__ */ n(i, { iconKey: "fa-regular fa-sparkles", size: "sm", className: e.shortcutIcon }),
172
+ /* @__PURE__ */ i(a, { iconKey: "fa-regular fa-sparkles", size: "sm", className: e.shortcutIcon }),
108
173
  "Model/Serial"
109
174
  ]
110
175
  }
111
176
  ) }),
112
- /* @__PURE__ */ n("li", { className: e.menuItem, children: /* @__PURE__ */ s(c, { href: f, className: t(e.siteLink, e.menuItemAction), children: [
113
- /* @__PURE__ */ n(i, { iconKey: "fa-regular fa-screwdriver-wrench", size: "sm", className: e.shortcutIcon }),
177
+ /* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: k, className: t(e.siteLink, e.menuItemAction), children: [
178
+ /* @__PURE__ */ i(a, { iconKey: "fa-regular fa-screwdriver-wrench", size: "sm", className: e.shortcutIcon }),
114
179
  "Custom Parts"
115
180
  ] }) }),
116
- /* @__PURE__ */ n("li", { className: e.menuItem, children: /* @__PURE__ */ s(c, { href: p, className: t(e.siteLink, e.menuItemAction), children: [
117
- /* @__PURE__ */ n(i, { iconKey: "fa-regular fa-envelope", size: "sm", className: e.shortcutIcon }),
181
+ /* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: L, className: t(e.siteLink, e.menuItemAction), children: [
182
+ /* @__PURE__ */ i(a, { iconKey: "fa-regular fa-envelope", size: "sm", className: e.shortcutIcon }),
118
183
  "Contact Us"
119
184
  ] }) }),
120
- /* @__PURE__ */ n("li", { className: e.menuItem, children: /* @__PURE__ */ s(c, { href: L, className: t(e.siteLink, e.menuItemAction), children: [
121
- /* @__PURE__ */ n(i, { iconKey: "fa-solid fa-question", size: "sm", className: e.shortcutIcon }),
185
+ /* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: H, className: t(e.siteLink, e.menuItemAction), children: [
186
+ /* @__PURE__ */ i(a, { iconKey: "fa-solid fa-question", size: "sm", className: e.shortcutIcon }),
122
187
  "FAQ"
123
188
  ] }) }),
124
- /* @__PURE__ */ n("li", { className: e.menuItem, children: /* @__PURE__ */ s(c, { href: A, className: t(e.siteLink, e.menuItemAction), children: [
125
- /* @__PURE__ */ n(i, { iconKey: "fa-regular fa-people-group", size: "sm", className: e.shortcutIcon }),
189
+ /* @__PURE__ */ i("li", { className: e.menuItem, children: /* @__PURE__ */ o(c, { href: q, className: t(e.siteLink, e.menuItemAction), children: [
190
+ /* @__PURE__ */ i(a, { iconKey: "fa-regular fa-people-group", size: "sm", className: e.shortcutIcon }),
126
191
  "About Us"
127
192
  ] }) })
128
193
  ] })
129
194
  ] }),
130
- /* @__PURE__ */ s("section", { children: [
131
- /* @__PURE__ */ n(h, { size: "md", weight: "semibold", children: "Shop by category" }),
132
- /* @__PURE__ */ n("ul", { className: e.menuList, children: r && r.map((a) => /* @__PURE__ */ n("li", { className: e.category, children: /* @__PURE__ */ s(
133
- u,
195
+ /* @__PURE__ */ o("section", { children: [
196
+ /* @__PURE__ */ i(w, { size: "md", weight: "semibold", children: "Shop by category" }),
197
+ /* @__PURE__ */ i("ul", { className: e.menuList, children: l && l.map((n) => /* @__PURE__ */ i("li", { className: e.category, children: /* @__PURE__ */ o(
198
+ y,
134
199
  {
135
- href: a.route,
200
+ href: n.route,
136
201
  className: e.categoryLink,
137
- onClick: () => o == null ? void 0 : o(a),
202
+ onClick: () => h == null ? void 0 : h(n),
138
203
  children: [
139
- /* @__PURE__ */ n(h, { size: "sm", children: a.label }),
140
- /* @__PURE__ */ n(
141
- i,
204
+ /* @__PURE__ */ i(w, { size: "sm", children: n.label }),
205
+ /* @__PURE__ */ i(
206
+ a,
142
207
  {
143
208
  iconKey: "fa-solid fa-chevron-right",
144
209
  title: "Navigate",
@@ -147,7 +212,7 @@ import '../../assets/MainNav.css';const P = "_main_14nx2_1", Q = "_column_14nx2_
147
212
  )
148
213
  ]
149
214
  }
150
- ) }, a.id)) })
215
+ ) }, n.id)) })
151
216
  ] })
152
217
  ] })
153
218
  ]
@@ -156,24 +221,68 @@ import '../../assets/MainNav.css';const P = "_main_14nx2_1", Q = "_column_14nx2_
156
221
  ]
157
222
  }
158
223
  ),
159
- /* @__PURE__ */ n(m, { flexDirection: "row", hideAt: ["md", "lg"], children: /* @__PURE__ */ n(g, { onSearch: N, inputName: "cpc-search", className: e.search }) }),
160
- /* @__PURE__ */ n(
161
- G,
224
+ /* @__PURE__ */ i(g, { flexDirection: "row", hideAt: ["md", "lg"], className: e.mobileSearch, children: /* @__PURE__ */ o("div", { className: e.search, children: [
225
+ /* @__PURE__ */ i(
226
+ j,
227
+ {
228
+ variant: "search",
229
+ label: "Search",
230
+ placeholder: "Search by keyword(s) or Part #....",
231
+ name: "cpc-search",
232
+ autoComplete: "off",
233
+ "aria-autocomplete": "list",
234
+ ...C,
235
+ endAdornment: /* @__PURE__ */ o(B, { children: [
236
+ !!r && /* @__PURE__ */ i(
237
+ _,
238
+ {
239
+ "aria-label": "Clear search",
240
+ onClick: v,
241
+ iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
242
+ }
243
+ ),
244
+ /* @__PURE__ */ i(
245
+ _,
246
+ {
247
+ "aria-label": "Submit search",
248
+ onClick: () => m == null ? void 0 : m(r ?? ""),
249
+ iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
250
+ }
251
+ )
252
+ ] })
253
+ }
254
+ ),
255
+ b && d && /* @__PURE__ */ i(N, { ...d, className: e.suggestionDropdown }),
256
+ I && /* @__PURE__ */ i(
257
+ N,
258
+ {
259
+ terms: [],
260
+ categories: [],
261
+ items: [],
262
+ view: "recent-searches",
263
+ recentSearches: f,
264
+ onClearRecentSearch: z,
265
+ className: e.suggestionDropdown
266
+ }
267
+ )
268
+ ] }) }),
269
+ /* @__PURE__ */ i(
270
+ ie,
162
271
  {
163
- categories: r,
164
- isCategoriesLoading: j,
165
- onCategoryClick: o
272
+ categories: l,
273
+ isCategoriesLoading: R,
274
+ onCategoryClick: h
166
275
  }
167
276
  )
168
277
  ] }) });
169
278
  });
170
279
  function c({
171
- href: d,
172
- children: l,
173
- ...r
280
+ href: A,
281
+ children: p,
282
+ ...l
174
283
  }) {
175
- return /* @__PURE__ */ n(u, { href: d, className: e.siteLink, ...r, children: l });
284
+ return /* @__PURE__ */ i(y, { href: A, className: e.siteLink, ...l, children: p });
176
285
  }
177
286
  export {
178
- pe as MainNav
287
+ je as MainNav
179
288
  };
@@ -10,5 +10,6 @@ export default meta;
10
10
  type Story = StoryObj<typeof meta>;
11
11
  export declare const Authenticated: Story;
12
12
  export declare const WithCartItems: Story;
13
+ export declare const WithSearchSuggestions: Story;
13
14
  export declare const Unauthenticated: Story;
14
15
  export declare const Loading: Story;