@caseparts-org/caseblocks 0.0.238 → 0.0.240

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,9 +1,8 @@
1
- import { TextSize } from '../Text/Text';
2
- export interface HighlightedTextProps {
1
+ import { TextProps } from '../Text/Text';
2
+ export interface HighlightedTextProps extends Omit<TextProps, "children" | "variant"> {
3
3
  text: string;
4
- size: TextSize;
5
4
  highlight: string;
6
5
  variant?: "bold" | "highlight" | "italic";
7
6
  className?: string;
8
7
  }
9
- export declare function HighlightedText({ text, size, highlight, variant, className }: HighlightedTextProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function HighlightedText({ text, highlight, variant, className, ...textProps }: HighlightedTextProps): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,23 @@
1
1
  import { jsx as g, jsxs as x } from "react/jsx-runtime";
2
2
  import { c as T } from "../../clsx-OuTLNxxd.js";
3
- import { Text as o } from "../Text/Text.js";
4
- import '../../assets/HighlightedText.css';const a = "_highlightedText_p19vf_1", c = {
3
+ import { Text as c } from "../Text/Text.js";
4
+ import '../../assets/HighlightedText.css';const a = "_highlightedText_p19vf_1", o = {
5
5
  highlightedText: a,
6
6
  "highlightedText-bold": "_highlightedText-bold_p19vf_9",
7
7
  "highlightedText-highlight": "_highlightedText-highlight_p19vf_17",
8
8
  "highlightedText-italic": "_highlightedText-italic_p19vf_29"
9
9
  };
10
- function m({ text: t, size: i, highlight: h, variant: d = "bold", className: l }) {
11
- const e = t.toLowerCase().indexOf(h.toLowerCase());
12
- if (!h || e === -1)
13
- return /* @__PURE__ */ g(o, { size: i, className: l, children: t });
14
- const r = t.slice(0, e), s = t.slice(e, e + h.length), n = t.slice(e + h.length);
15
- return /* @__PURE__ */ x(o, { size: i, children: [
10
+ function p({ text: e, highlight: h, variant: d = "bold", className: i, ...l }) {
11
+ const t = e.toLowerCase().indexOf(h.toLowerCase());
12
+ if (!h || t === -1)
13
+ return /* @__PURE__ */ g(c, { className: i, ...l, children: e });
14
+ const r = e.slice(0, t), s = e.slice(t, t + h.length), n = e.slice(t + h.length);
15
+ return /* @__PURE__ */ x(c, { ...l, children: [
16
16
  r,
17
- /* @__PURE__ */ g("span", { className: T(c.highlightedText, c[`highlightedText-${d}`], l), children: s }),
17
+ /* @__PURE__ */ g("span", { className: T(o.highlightedText, o[`highlightedText-${d}`], i), children: s }),
18
18
  n
19
19
  ] });
20
20
  }
21
21
  export {
22
- m as HighlightedText
22
+ p as HighlightedText
23
23
  };
@@ -1,15 +1,16 @@
1
1
  import { HighlightedText as t } from "./HighlightedText.js";
2
- const i = {
2
+ const e = {
3
3
  title: "Case Parts/Atoms/HighlightedText",
4
4
  component: t,
5
5
  parameters: {
6
6
  layout: "centered"
7
7
  },
8
8
  tags: ["autodocs"]
9
- }, e = {
9
+ }, i = {
10
10
  args: {
11
11
  text: "Thermostat",
12
12
  size: "md",
13
+ weight: "regular",
13
14
  highlight: "stat",
14
15
  variant: "bold"
15
16
  }
@@ -29,8 +30,8 @@ const i = {
29
30
  }
30
31
  };
31
32
  export {
32
- e as Bold,
33
+ i as Bold,
33
34
  s as Highlight,
34
35
  h as Italic,
35
- i as default
36
+ e as default
36
37
  };
@@ -1,126 +1,126 @@
1
- import { jsx as o, jsxs as l, Fragment as Q } 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 N } from "../../atoms/Icon/Icon.js";
6
- import { Flex as z } from "../../atoms/Flex/Flex.js";
7
- import { Grid as li, Column as mi } from "../../atoms/Grid/Grid.js";
8
- import { Input as W } from "../../atoms/Input/Input.js";
9
- import { InputEndAdornmentButton as p } from "../../atoms/InputEndAdornmentButton/InputEndAdornmentButton.js";
10
- import { Logo as ai } from "../../molecules/Logo/Logo.js";
11
- import { HamburgerMenu as ci } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
1
+ import { jsx as m, jsxs as d, Fragment as W } from "react/jsx-runtime";
2
+ import L from "react";
3
+ import { Text as U } from "../../atoms/Text/Text.js";
4
+ import { Link as j } from "../../atoms/Link/Link.js";
5
+ import { Icon as y } from "../../atoms/Icon/Icon.js";
6
+ import { Flex as u } from "../../atoms/Flex/Flex.js";
7
+ import { Grid as ni, Column as di } from "../../atoms/Grid/Grid.js";
8
+ import { Input as J } from "../../atoms/Input/Input.js";
9
+ import { InputEndAdornmentButton as B } from "../../atoms/InputEndAdornmentButton/InputEndAdornmentButton.js";
10
+ import { Logo as ei } from "../../molecules/Logo/Logo.js";
11
+ import { HamburgerMenu as fi } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
12
12
  import { ShoppingCart as si } from "../../molecules/Cart/Cart.js";
13
- import { Account as di } from "../../molecules/Account/Account.js";
13
+ import { Account as ci } from "../../molecules/Account/Account.js";
14
14
  import { CategoryNav as ri } from "../../molecules/CategoryNav/CategoryNav.js";
15
- import { SuggestionDropdown as B } from "../SuggestionDropdown/SuggestionDropdown.js";
16
- import { getHideAtStyles as J } from "../../atoms/HideAt.js";
17
- import { c as u } from "../../clsx-OuTLNxxd.js";
18
- import '../../assets/MainNav.css';const fi = "_main_12974_1", _i = "_column_12974_8", Ni = "_topNav_12974_13", ui = "_logo_12974_21", yi = "_operations_12974_24", ki = "_search_12974_31", wi = "_mobileSearch_12974_36", Ai = "_suggestionDropdown_12974_39", bi = "_siteLink_12974_45", Di = "_accountArea_12974_72", vi = "_category_12974_84", xi = "_categoryLink_12974_92", Li = "_menuList_12974_108", Ki = "_menuItemAction_12974_131", gi = "_shortcutIcon_12974_140", i = {
19
- main: fi,
20
- column: _i,
15
+ import { SuggestionDropdown as $ } from "../SuggestionDropdown/SuggestionDropdown.js";
16
+ import { getHideAtStyles as X } from "../../atoms/HideAt.js";
17
+ import { c as k } from "../../clsx-OuTLNxxd.js";
18
+ import '../../assets/MainNav.css';const _i = "_main_12974_1", ai = "_column_12974_8", Ni = "_topNav_12974_13", yi = "_logo_12974_21", ki = "_operations_12974_24", wi = "_search_12974_31", Ai = "_mobileSearch_12974_36", bi = "_suggestionDropdown_12974_39", Di = "_siteLink_12974_45", vi = "_accountArea_12974_72", xi = "_category_12974_84", Li = "_categoryLink_12974_92", Ki = "_menuList_12974_108", zi = "_menuItemAction_12974_131", pi = "_shortcutIcon_12974_140", t = {
19
+ main: _i,
20
+ column: ai,
21
21
  topNav: Ni,
22
- logo: ui,
23
- operations: yi,
24
- search: ki,
25
- mobileSearch: wi,
26
- suggestionDropdown: Ai,
27
- siteLink: bi,
28
- accountArea: Di,
29
- category: vi,
30
- categoryLink: xi,
31
- menuList: Li,
32
- menuItemAction: Ki,
33
- shortcutIcon: gi
34
- }, Wi = x.forwardRef(function({
35
- account: $,
36
- categories: A,
37
- homeRoute: X,
38
- faqRoute: Y,
39
- customPartsRoute: E,
40
- aboutUsRoute: Z,
41
- contactRoute: I,
22
+ logo: yi,
23
+ operations: ki,
24
+ search: wi,
25
+ mobileSearch: Ai,
26
+ suggestionDropdown: bi,
27
+ siteLink: Di,
28
+ accountArea: vi,
29
+ category: xi,
30
+ categoryLink: Li,
31
+ menuList: Ki,
32
+ menuItemAction: zi,
33
+ shortcutIcon: pi
34
+ }, Ji = L.forwardRef(function({
35
+ account: F,
36
+ categories: b,
37
+ homeRoute: Y,
38
+ faqRoute: Z,
39
+ customPartsRoute: I,
40
+ aboutUsRoute: g,
41
+ contactRoute: M,
42
42
  cart: C,
43
- open: V,
43
+ open: P,
44
44
  // consume external panel control props from CartPropsBase
45
- className: h,
46
- onLoginClick: P,
47
- searchInputProps: t,
48
- searchValue: c,
49
- onSearchValueChange: y,
50
- onClearSearch: k,
51
- onSearch: s,
52
- searchSuggestions: n,
53
- recentSearches: r,
54
- onClearRecentSearch: M,
55
- onCategoryClick: L,
56
- onClickModelSerial: H,
45
+ className: V,
46
+ onLoginClick: h,
47
+ searchInputProps: o,
48
+ searchValue: s,
49
+ onSearchValueChange: n,
50
+ onClearSearch: w,
51
+ onSearch: c,
52
+ searchSuggestions: l,
53
+ recentSearches: _,
54
+ onClearRecentSearch: H,
55
+ onCategoryClick: K,
56
+ onClickModelSerial: R,
57
57
  onCartClick: S,
58
58
  accountPopoverContent: ii,
59
- isAccountLoading: oi,
60
- isCategoriesLoading: ei,
61
- ...ti
62
- }, ni) {
63
- const [R, f] = x.useState(!1), [m, _] = x.useState(-1), K = x.useRef(null), d = x.useId(), b = R && !!c && !!n, F = R && !b && !!(r != null && r.length), D = b ? ((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 ? (r == null ? void 0 : r.length) ?? 0 : 0, T = {
64
- ...t,
65
- onChange: (e) => {
66
- var a;
67
- _(-1), (a = t == null ? void 0 : t.onChange) == null || a.call(t, e);
59
+ isAccountLoading: ti,
60
+ isCategoriesLoading: mi,
61
+ ...oi
62
+ }, li) {
63
+ const [T, a] = L.useState(!1), [e, N] = L.useState(-1), z = L.useRef(null), r = L.useId(), D = T && !!s && !!l, O = T && !D && !!(_ != null && _.length), v = D ? ((l == null ? void 0 : l.terms.length) ?? 0) + ((l == null ? void 0 : l.categories.length) ?? 0) + ((l == null ? void 0 : l.items.length) ?? 0) : O ? (_ == null ? void 0 : _.length) ?? 0 : 0, q = {
64
+ ...o,
65
+ onChange: (i) => {
66
+ var f;
67
+ N(-1), (f = o == null ? void 0 : o.onChange) == null || f.call(o, i);
68
68
  },
69
- onFocus: (e) => {
70
- var a;
71
- (a = t == null ? void 0 : t.onFocus) == null || a.call(t, e), f(!0);
69
+ onFocus: (i) => {
70
+ var f;
71
+ (f = o == null ? void 0 : o.onFocus) == null || f.call(o, i), a(!0);
72
72
  },
73
- onBlur: (e) => {
74
- var a;
75
- (a = t == null ? void 0 : t.onBlur) == null || a.call(t, e), f(!1);
73
+ onBlur: (i) => {
74
+ var f;
75
+ (f = o == null ? void 0 : o.onBlur) == null || f.call(o, i), a(!1);
76
76
  },
77
- onKeyDown: (e) => {
78
- var a, q, G;
79
- if ((a = t == null ? void 0 : t.onKeyDown) == null || a.call(t, e), !e.defaultPrevented) {
80
- if (e.key === "ArrowDown" && D > 0) {
81
- e.preventDefault(), _((v) => v >= D - 1 ? 0 : v + 1);
77
+ onKeyDown: (i) => {
78
+ var f, G, Q;
79
+ if ((f = o == null ? void 0 : o.onKeyDown) == null || f.call(o, i), !i.defaultPrevented) {
80
+ if (i.key === "ArrowDown" && v > 0) {
81
+ i.preventDefault(), N((x) => x >= v - 1 ? 0 : x + 1);
82
82
  return;
83
83
  }
84
- if (e.key === "ArrowUp" && D > 0) {
85
- e.preventDefault(), _((v) => v <= 0 ? D - 1 : v - 1);
84
+ if (i.key === "ArrowUp" && v > 0) {
85
+ i.preventDefault(), N((x) => x <= 0 ? v - 1 : x - 1);
86
86
  return;
87
87
  }
88
- if (e.key === "Tab" && b && 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) ?? ""), _(-1);
88
+ if (i.key === "Tab" && D && e >= 0 && e < ((l == null ? void 0 : l.terms.length) ?? 0)) {
89
+ i.preventDefault(), n == null || n((l == null ? void 0 : l.terms[e].name) ?? ""), N(-1);
90
90
  return;
91
91
  }
92
- if (e.key === "Enter" && m >= 0 && m < D) {
93
- e.preventDefault(), (q = document.getElementById(`${d}-${m}`)) == null || q.click();
92
+ if (i.key === "Enter" && e >= 0 && e < v) {
93
+ i.preventDefault(), (G = document.getElementById(`${r}-${e}`)) == null || G.click();
94
94
  return;
95
95
  }
96
- e.key === "Enter" && (e.preventDefault(), f(!1), (G = K.current) == null || G.blur(), s == null || s(c ?? ""));
96
+ i.key === "Enter" && (i.preventDefault(), a(!1), (Q = z.current) == null || Q.blur(), c == null || c(s ?? ""));
97
97
  }
98
98
  }
99
- }, g = (e) => {
100
- var a;
101
- e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), _(-1), y == null || y(`${c ?? ""}${e.key}`), (a = K.current) == null || a.focus());
99
+ }, p = (i) => {
100
+ var f;
101
+ i.key.length !== 1 || i.altKey || i.ctrlKey || i.metaKey || (i.preventDefault(), N(-1), n == null || n(`${s ?? ""}${i.key}`), (f = z.current) == null || f.focus());
102
102
  };
103
- return /* @__PURE__ */ o(li, { ...ti, gridWrapperClassName: u(i.main, h), children: /* @__PURE__ */ l(mi, { span: 12, className: i.column, children: [
104
- /* @__PURE__ */ l(
105
- z,
103
+ return /* @__PURE__ */ m(ni, { ...oi, gridWrapperClassName: k(t.main, V), children: /* @__PURE__ */ d(di, { span: 12, className: t.column, children: [
104
+ /* @__PURE__ */ d(
105
+ u,
106
106
  {
107
107
  flexDirection: "row",
108
108
  alignItems: "center",
109
109
  justifyContent: "space-between",
110
- className: i.topNav,
110
+ className: t.topNav,
111
111
  children: [
112
- /* @__PURE__ */ o("div", { className: i.logo, children: /* @__PURE__ */ o(U, { href: X, children: /* @__PURE__ */ o(ai, {}) }) }),
113
- /* @__PURE__ */ l(
114
- z,
112
+ /* @__PURE__ */ m("div", { className: t.logo, children: /* @__PURE__ */ m(j, { href: Y, children: /* @__PURE__ */ m(ei, {}) }) }),
113
+ /* @__PURE__ */ d(
114
+ u,
115
115
  {
116
116
  flexDirection: "row",
117
117
  alignItems: "center",
118
118
  justifyContent: "flex-end",
119
- className: i.operations,
119
+ className: t.operations,
120
120
  children: [
121
- /* @__PURE__ */ l(z, { flexDirection: "row", hideAt: ["sm"], className: i.search, children: [
122
- /* @__PURE__ */ o(
123
- W,
121
+ /* @__PURE__ */ d(u, { flexDirection: "row", hideAt: ["sm"], className: t.search, children: [
122
+ /* @__PURE__ */ m(
123
+ J,
124
124
  {
125
125
  variant: "search",
126
126
  label: "Search",
@@ -128,122 +128,136 @@ import '../../assets/MainNav.css';const fi = "_main_12974_1", _i = "_column_1297
128
128
  name: "cpc-search",
129
129
  autoComplete: "off",
130
130
  "aria-autocomplete": "list",
131
- "aria-controls": d,
132
- "aria-activedescendant": m >= 0 ? `${d}-${m}` : void 0,
133
- ...T,
134
- ref: K,
135
- value: c,
136
- endAdornment: /* @__PURE__ */ l(Q, { children: [
137
- !!c && /* @__PURE__ */ o(
138
- p,
131
+ "aria-controls": r,
132
+ "aria-activedescendant": e >= 0 ? `${r}-${e}` : void 0,
133
+ ...q,
134
+ ref: z,
135
+ value: s,
136
+ endAdornment: /* @__PURE__ */ d(W, { children: [
137
+ !!s && /* @__PURE__ */ m(
138
+ B,
139
139
  {
140
140
  "aria-label": "Clear search",
141
141
  onClick: () => {
142
- _(-1), k == null || k();
142
+ N(-1), w == null || w();
143
143
  },
144
144
  iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
145
145
  }
146
146
  ),
147
- /* @__PURE__ */ o(
148
- p,
147
+ /* @__PURE__ */ m(
148
+ B,
149
149
  {
150
150
  "aria-label": "Submit search",
151
- onClick: () => s == null ? void 0 : s(c ?? ""),
151
+ onClick: () => c == null ? void 0 : c(s ?? ""),
152
152
  iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
153
153
  }
154
154
  )
155
155
  ] })
156
156
  }
157
157
  ),
158
- b && n && /* @__PURE__ */ o(B, { ...n, activeOptionIndex: m, optionIdPrefix: d, onKeyDown: g, onSuggestionClick: () => f(!1), className: i.suggestionDropdown }),
159
- F && /* @__PURE__ */ o(
160
- B,
158
+ D && l && /* @__PURE__ */ m(
159
+ $,
160
+ {
161
+ ...l,
162
+ activeOptionIndex: e,
163
+ optionIdPrefix: r,
164
+ onKeyDown: p,
165
+ onSuggestionClick: (i) => {
166
+ n == null || n((i == null ? void 0 : i.name) ?? s ?? ""), a(!1);
167
+ },
168
+ className: t.suggestionDropdown
169
+ }
170
+ ),
171
+ O && /* @__PURE__ */ m(
172
+ $,
161
173
  {
162
174
  terms: [],
163
175
  categories: [],
164
176
  items: [],
165
177
  view: "recent-searches",
166
- recentSearches: r,
167
- onClearRecentSearch: M,
168
- activeOptionIndex: m,
169
- optionIdPrefix: d,
170
- onKeyDown: g,
171
- onSuggestionClick: () => f(!1),
172
- className: i.suggestionDropdown
178
+ recentSearches: _,
179
+ onClearRecentSearch: H,
180
+ activeOptionIndex: e,
181
+ optionIdPrefix: r,
182
+ onKeyDown: p,
183
+ onSuggestionClick: (i) => {
184
+ n == null || n((i == null ? void 0 : i.term) ?? s ?? ""), a(!1);
185
+ },
186
+ className: t.suggestionDropdown
173
187
  }
174
188
  )
175
189
  ] }),
176
- /* @__PURE__ */ l("button", { onClick: H, className: u(i.siteLink, J(["sm", "md"])), children: [
177
- /* @__PURE__ */ o(N, { iconKey: "fa-regular fa-sparkles", size: "sm" }),
190
+ /* @__PURE__ */ d("button", { onClick: R, className: k(t.siteLink, X(["sm", "md"])), children: [
191
+ /* @__PURE__ */ m(y, { iconKey: "fa-regular fa-sparkles", size: "sm" }),
178
192
  "Model/Serial"
179
193
  ] }),
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,
194
+ /* @__PURE__ */ m(A, { href: I, hideAt: ["sm", "md"], children: "Custom Parts" }),
195
+ /* @__PURE__ */ m(A, { href: M, hideAt: ["sm", "md"], children: "Contact Us" }),
196
+ /* @__PURE__ */ m("div", { className: t.accountArea, children: /* @__PURE__ */ m(
197
+ ci,
184
198
  {
185
- account: $,
186
- onLoginClick: P,
187
- className: i.avatar,
199
+ account: F,
200
+ onLoginClick: h,
201
+ className: t.avatar,
188
202
  popoverContent: ii,
189
- isAccountLoading: oi
203
+ isAccountLoading: ti
190
204
  }
191
205
  ) }),
192
- /* @__PURE__ */ o(
206
+ /* @__PURE__ */ m(
193
207
  si,
194
208
  {
195
- ref: ni,
209
+ ref: li,
196
210
  cart: C,
197
- open: V,
211
+ open: P,
198
212
  onCartClick: S
199
213
  }
200
214
  ),
201
- /* @__PURE__ */ l(ci, { 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(
215
+ /* @__PURE__ */ d(fi, { hideAt: ["lg"], children: [
216
+ /* @__PURE__ */ d("section", { children: [
217
+ /* @__PURE__ */ m(U, { size: "md", weight: "semibold", children: "Useful shortcuts" }),
218
+ /* @__PURE__ */ d("ul", { className: t.menuList, children: [
219
+ /* @__PURE__ */ m("li", { className: t.menuItem, children: /* @__PURE__ */ d(
206
220
  "button",
207
221
  {
208
- onClick: H,
222
+ onClick: R,
209
223
  "data-hamburger-close": "true",
210
- className: u(i.siteLink, i.menuItemAction, J(["lg"])),
224
+ className: k(t.siteLink, t.menuItemAction, X(["lg"])),
211
225
  children: [
212
- /* @__PURE__ */ o(N, { iconKey: "fa-regular fa-sparkles", size: "sm", className: i.shortcutIcon }),
226
+ /* @__PURE__ */ m(y, { iconKey: "fa-regular fa-sparkles", size: "sm", className: t.shortcutIcon }),
213
227
  "Model/Serial"
214
228
  ]
215
229
  }
216
230
  ) }),
217
- /* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: E, className: u(i.siteLink, i.menuItemAction), children: [
218
- /* @__PURE__ */ o(N, { iconKey: "fa-regular fa-screwdriver-wrench", size: "sm", className: i.shortcutIcon }),
231
+ /* @__PURE__ */ m("li", { className: t.menuItem, children: /* @__PURE__ */ d(A, { href: I, className: k(t.siteLink, t.menuItemAction), children: [
232
+ /* @__PURE__ */ m(y, { iconKey: "fa-regular fa-screwdriver-wrench", size: "sm", className: t.shortcutIcon }),
219
233
  "Custom Parts"
220
234
  ] }) }),
221
- /* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: I, className: u(i.siteLink, i.menuItemAction), children: [
222
- /* @__PURE__ */ o(N, { iconKey: "fa-regular fa-envelope", size: "sm", className: i.shortcutIcon }),
235
+ /* @__PURE__ */ m("li", { className: t.menuItem, children: /* @__PURE__ */ d(A, { href: M, className: k(t.siteLink, t.menuItemAction), children: [
236
+ /* @__PURE__ */ m(y, { iconKey: "fa-regular fa-envelope", size: "sm", className: t.shortcutIcon }),
223
237
  "Contact Us"
224
238
  ] }) }),
225
- /* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: Y, className: u(i.siteLink, i.menuItemAction), children: [
226
- /* @__PURE__ */ o(N, { iconKey: "fa-solid fa-question", size: "sm", className: i.shortcutIcon }),
239
+ /* @__PURE__ */ m("li", { className: t.menuItem, children: /* @__PURE__ */ d(A, { href: Z, className: k(t.siteLink, t.menuItemAction), children: [
240
+ /* @__PURE__ */ m(y, { iconKey: "fa-solid fa-question", size: "sm", className: t.shortcutIcon }),
227
241
  "FAQ"
228
242
  ] }) }),
229
- /* @__PURE__ */ o("li", { className: i.menuItem, children: /* @__PURE__ */ l(w, { href: Z, className: u(i.siteLink, i.menuItemAction), children: [
230
- /* @__PURE__ */ o(N, { iconKey: "fa-regular fa-people-group", size: "sm", className: i.shortcutIcon }),
243
+ /* @__PURE__ */ m("li", { className: t.menuItem, children: /* @__PURE__ */ d(A, { href: g, className: k(t.siteLink, t.menuItemAction), children: [
244
+ /* @__PURE__ */ m(y, { iconKey: "fa-regular fa-people-group", size: "sm", className: t.shortcutIcon }),
231
245
  "About Us"
232
246
  ] }) })
233
247
  ] })
234
248
  ] }),
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,
249
+ /* @__PURE__ */ d("section", { children: [
250
+ /* @__PURE__ */ m(U, { size: "md", weight: "semibold", children: "Shop by category" }),
251
+ /* @__PURE__ */ m("ul", { className: t.menuList, children: b && b.map((i) => /* @__PURE__ */ m("li", { className: t.category, children: /* @__PURE__ */ d(
252
+ j,
239
253
  {
240
- href: e.route,
241
- className: i.categoryLink,
242
- onClick: () => L == null ? void 0 : L(e),
254
+ href: i.route,
255
+ className: t.categoryLink,
256
+ onClick: () => K == null ? void 0 : K(i),
243
257
  children: [
244
- /* @__PURE__ */ o(O, { size: "sm", children: e.label }),
245
- /* @__PURE__ */ o(
246
- N,
258
+ /* @__PURE__ */ m(U, { size: "sm", children: i.label }),
259
+ /* @__PURE__ */ m(
260
+ y,
247
261
  {
248
262
  iconKey: "fa-solid fa-chevron-right",
249
263
  title: "Navigate",
@@ -252,7 +266,7 @@ import '../../assets/MainNav.css';const fi = "_main_12974_1", _i = "_column_1297
252
266
  )
253
267
  ]
254
268
  }
255
- ) }, e.id)) })
269
+ ) }, i.id)) })
256
270
  ] })
257
271
  ] })
258
272
  ]
@@ -261,9 +275,9 @@ import '../../assets/MainNav.css';const fi = "_main_12974_1", _i = "_column_1297
261
275
  ]
262
276
  }
263
277
  ),
264
- /* @__PURE__ */ o(z, { flexDirection: "row", hideAt: ["md", "lg"], className: i.mobileSearch, children: /* @__PURE__ */ l("div", { className: i.search, children: [
265
- /* @__PURE__ */ o(
266
- W,
278
+ /* @__PURE__ */ m(u, { flexDirection: "row", hideAt: ["md", "lg"], className: t.mobileSearch, children: /* @__PURE__ */ d("div", { className: t.search, children: [
279
+ /* @__PURE__ */ m(
280
+ J,
267
281
  {
268
282
  variant: "search",
269
283
  label: "Search",
@@ -271,68 +285,72 @@ import '../../assets/MainNav.css';const fi = "_main_12974_1", _i = "_column_1297
271
285
  name: "cpc-search",
272
286
  autoComplete: "off",
273
287
  "aria-autocomplete": "list",
274
- "aria-controls": d,
275
- "aria-activedescendant": m >= 0 ? `${d}-${m}` : void 0,
276
- ...T,
277
- ref: K,
278
- value: c,
279
- endAdornment: /* @__PURE__ */ l(Q, { children: [
280
- !!c && /* @__PURE__ */ o(
281
- p,
288
+ "aria-controls": r,
289
+ "aria-activedescendant": e >= 0 ? `${r}-${e}` : void 0,
290
+ ...q,
291
+ ref: z,
292
+ value: s,
293
+ endAdornment: /* @__PURE__ */ d(W, { children: [
294
+ !!s && /* @__PURE__ */ m(
295
+ B,
282
296
  {
283
297
  "aria-label": "Clear search",
284
298
  onClick: () => {
285
- _(-1), k == null || k();
299
+ N(-1), w == null || w();
286
300
  },
287
301
  iconProps: { iconKey: "fa-regular fa-xmark", size: "sm" }
288
302
  }
289
303
  ),
290
- /* @__PURE__ */ o(
291
- p,
304
+ /* @__PURE__ */ m(
305
+ B,
292
306
  {
293
307
  "aria-label": "Submit search",
294
- onClick: () => s == null ? void 0 : s(c ?? ""),
308
+ onClick: () => c == null ? void 0 : c(s ?? ""),
295
309
  iconProps: { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }
296
310
  }
297
311
  )
298
312
  ] })
299
313
  }
300
314
  ),
301
- b && n && /* @__PURE__ */ o(B, { ...n, activeOptionIndex: m, optionIdPrefix: d, onKeyDown: g, onSuggestionClick: () => f(!1), className: i.suggestionDropdown }),
302
- F && /* @__PURE__ */ o(
303
- B,
315
+ D && l && /* @__PURE__ */ m($, { ...l, activeOptionIndex: e, optionIdPrefix: r, onKeyDown: p, onSuggestionClick: (i) => {
316
+ n == null || n((i == null ? void 0 : i.name) ?? s ?? ""), a(!1);
317
+ }, className: t.suggestionDropdown }),
318
+ O && /* @__PURE__ */ m(
319
+ $,
304
320
  {
305
321
  terms: [],
306
322
  categories: [],
307
323
  items: [],
308
324
  view: "recent-searches",
309
- recentSearches: r,
310
- onClearRecentSearch: M,
311
- activeOptionIndex: m,
312
- optionIdPrefix: d,
313
- onKeyDown: g,
314
- onSuggestionClick: () => f(!1),
315
- className: i.suggestionDropdown
325
+ recentSearches: _,
326
+ onClearRecentSearch: H,
327
+ activeOptionIndex: e,
328
+ optionIdPrefix: r,
329
+ onKeyDown: p,
330
+ onSuggestionClick: (i) => {
331
+ n == null || n((i == null ? void 0 : i.term) ?? s ?? ""), a(!1);
332
+ },
333
+ className: t.suggestionDropdown
316
334
  }
317
335
  )
318
336
  ] }) }),
319
- /* @__PURE__ */ o(
337
+ /* @__PURE__ */ m(
320
338
  ri,
321
339
  {
322
- categories: A,
323
- isCategoriesLoading: ei,
324
- onCategoryClick: L
340
+ categories: b,
341
+ isCategoriesLoading: mi,
342
+ onCategoryClick: K
325
343
  }
326
344
  )
327
345
  ] }) });
328
346
  });
329
- function w({
330
- href: j,
331
- children: $,
332
- ...A
347
+ function A({
348
+ href: E,
349
+ children: F,
350
+ ...b
333
351
  }) {
334
- return /* @__PURE__ */ o(U, { href: j, className: i.siteLink, ...A, children: $ });
352
+ return /* @__PURE__ */ m(j, { href: E, className: t.siteLink, ...b, children: F });
335
353
  }
336
354
  export {
337
- Wi as MainNav
355
+ Ji as MainNav
338
356
  };
@@ -18,6 +18,10 @@ export type RecentSearch = {
18
18
  term: string;
19
19
  url: string;
20
20
  };
21
+ type SearchSelection = {
22
+ name?: string;
23
+ term?: string;
24
+ };
21
25
  export interface SuggestionDropdownProps {
22
26
  view?: "suggestions" | "recent-searches";
23
27
  terms: SuggestedTerm[];
@@ -25,10 +29,11 @@ export interface SuggestionDropdownProps {
25
29
  items: SuggestedItem[];
26
30
  recentSearches?: RecentSearch[];
27
31
  onClearRecentSearch?: (_recentSearch: RecentSearch) => void;
28
- onSuggestionClick?: () => void;
32
+ onSuggestionClick?: (_suggestion?: SearchSelection) => void;
29
33
  activeOptionIndex?: number;
30
34
  optionIdPrefix?: string;
31
35
  onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
32
36
  className?: string;
33
37
  }
34
38
  export declare function SuggestionDropdown({ terms, categories, items, view, recentSearches, onClearRecentSearch, onSuggestionClick, activeOptionIndex, optionIdPrefix, onKeyDown, className }: SuggestionDropdownProps): import("react/jsx-runtime").JSX.Element;
39
+ export {};
@@ -1,67 +1,67 @@
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";
1
+ import { jsxs as o, jsx as s } from "react/jsx-runtime";
2
+ import { Text as h } from "../../atoms/Text/Text.js";
3
+ import { Link as d } from "../../atoms/Link/Link.js";
4
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
5
+ import { c as r } from "../../clsx-OuTLNxxd.js";
6
+ import { Image as N } from "../../atoms/Image/Image.js";
7
+ import '../../assets/SuggestionDropdown.css';const v = "_suggestionDropdown_1udz7_1", y = "_leftColumn_1udz7_31", F = "_leftColumnFullWidth_1udz7_55", H = "_suggestionSectionFullHeight_1udz7_63", $ = "_rightColumn_1udz7_73", D = "_categorySection_1udz7_95", w = "_suggestions_1udz7_101", b = "_categories_1udz7_103", T = "_suggestionsFullHeight_1udz7_117", k = "_suggestionLink_1udz7_147", q = "_categoryLink_1udz7_149", W = "_activeOption_1udz7_163", j = "_itemList_1udz7_175", M = "_item_1udz7_175", O = "_activeItem_1udz7_209", S = "_itemInfo_1udz7_243", K = "_recentSearches_1udz7_253", R = "_recentSearchesHeader_1udz7_267", A = "_recentSearchesList_1udz7_275", B = "_recentSearch_1udz7_253", E = "_recentSearchLink_1udz7_305", G = "_clearRecentSearch_1udz7_321", t = {
8
+ suggestionDropdown: v,
9
+ leftColumn: y,
10
+ leftColumnFullWidth: F,
11
+ suggestionSectionFullHeight: H,
12
+ rightColumn: $,
13
+ categorySection: D,
14
+ suggestions: w,
15
+ categories: b,
16
+ suggestionsFullHeight: T,
17
+ suggestionLink: k,
18
+ categoryLink: q,
19
+ activeOption: W,
20
+ itemList: j,
21
+ item: M,
22
+ activeItem: O,
23
+ itemInfo: S,
24
+ recentSearches: K,
25
+ recentSearchesHeader: R,
26
+ recentSearchesList: A,
27
+ recentSearch: B,
28
+ recentSearchLink: E,
29
+ clearRecentSearch: G
30
30
  };
31
- function Y({
31
+ function Z({
32
32
  terms: n,
33
33
  categories: c,
34
- items: d,
34
+ items: m,
35
35
  view: p = "suggestions",
36
- recentSearches: h = [],
37
- onClearRecentSearch: m,
38
- onSuggestionClick: g,
39
- activeOptionIndex: o = -1,
36
+ recentSearches: _ = [],
37
+ onClearRecentSearch: g,
38
+ onSuggestionClick: l,
39
+ activeOptionIndex: a = -1,
40
40
  optionIdPrefix: u,
41
41
  onKeyDown: z,
42
42
  className: f
43
43
  }) {
44
- return p === "recent-searches" ? /* @__PURE__ */ r(
44
+ return p === "recent-searches" ? /* @__PURE__ */ o(
45
45
  "div",
46
46
  {
47
47
  id: u,
48
48
  role: "listbox",
49
- className: l(t.suggestionDropdown, t.recentSearches, f),
49
+ className: r(t.suggestionDropdown, t.recentSearches, f),
50
50
  onKeyDown: z,
51
51
  onMouseDown: (e) => e.preventDefault(),
52
52
  children: [
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: [
53
+ /* @__PURE__ */ s("div", { className: t.recentSearchesHeader, children: /* @__PURE__ */ s(h, { size: "xxs", colorToken: "quaternary", children: "Recent Searches" }) }),
54
+ /* @__PURE__ */ s("ol", { className: t.recentSearchesList, children: _.map((e) => /* @__PURE__ */ o("li", { className: t.recentSearch, children: [
55
55
  /* @__PURE__ */ s(
56
- _,
56
+ d,
57
57
  {
58
58
  href: e.url,
59
- id: `${u}-${h.indexOf(e)}`,
59
+ id: `${u}-${_.indexOf(e)}`,
60
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 })
61
+ "aria-selected": a === _.indexOf(e),
62
+ className: r(t.recentSearchLink, { [t.activeOption]: a === _.indexOf(e) }),
63
+ onClick: () => l == null ? void 0 : l(e),
64
+ children: /* @__PURE__ */ s(h, { size: "sm", children: e.term })
65
65
  }
66
66
  ),
67
67
  /* @__PURE__ */ s(
@@ -70,64 +70,64 @@ function Y({
70
70
  type: "button",
71
71
  className: t.clearRecentSearch,
72
72
  "aria-label": `Clear recent search: ${e.term}`,
73
- onClick: () => m == null ? void 0 : m(e),
73
+ onClick: () => g == null ? void 0 : g(e),
74
74
  children: /* @__PURE__ */ s(L, { iconKey: "fa-regular fa-xmark", size: "sm" })
75
75
  }
76
76
  )
77
77
  ] }, e.url)) })
78
78
  ]
79
79
  }
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" }),
80
+ ) : /* @__PURE__ */ o("div", { id: u, role: "listbox", className: r(t.suggestionDropdown, f), onKeyDown: z, onMouseDown: (e) => e.preventDefault(), children: [
81
+ (n.length > 0 || c.length > 0) && /* @__PURE__ */ o("div", { className: r(t.leftColumn, { [t.leftColumnFullWidth]: m.length === 0 }), children: [
82
+ n.length > 0 && /* @__PURE__ */ s("div", { className: r(t.suggestionSection, { [t.suggestionSectionFullHeight]: c.length === 0 }), children: /* @__PURE__ */ o("div", { className: r(t.suggestions, { [t.suggestionsFullHeight]: c.length === 0 }), children: [
83
+ /* @__PURE__ */ s(h, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
84
84
  n.map(
85
- (e, i) => /* @__PURE__ */ s(a, { size: "sm", children: /* @__PURE__ */ s(
86
- _,
85
+ (e, i) => /* @__PURE__ */ s(h, { size: "sm", children: /* @__PURE__ */ s(
86
+ d,
87
87
  {
88
88
  href: e.url,
89
89
  id: `${u}-${i}`,
90
90
  role: "option",
91
- "aria-selected": o === i,
92
- className: l(t.suggestionLink, { [t.activeOption]: o === i }),
93
- onClick: g,
91
+ "aria-selected": a === i,
92
+ className: r(t.suggestionLink, { [t.activeOption]: a === i }),
93
+ onClick: () => l == null ? void 0 : l(e),
94
94
  children: e.name
95
95
  }
96
96
  ) }, e.url)
97
97
  )
98
98
  ] }) }),
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" }),
99
+ c.length > 0 && /* @__PURE__ */ s("div", { className: t.categorySection, children: /* @__PURE__ */ o("div", { className: t.categories, children: [
100
+ /* @__PURE__ */ s(h, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
101
101
  c.map(
102
- (e, i) => /* @__PURE__ */ s(a, { size: "sm", children: /* @__PURE__ */ s(
103
- _,
102
+ (e, i) => /* @__PURE__ */ s(h, { size: "sm", children: /* @__PURE__ */ s(
103
+ d,
104
104
  {
105
105
  href: e.url,
106
106
  id: `${u}-${n.length + i}`,
107
107
  role: "option",
108
- "aria-selected": o === n.length + i,
109
- className: l(t.categoryLink, { [t.activeOption]: o === n.length + i }),
110
- onClick: g,
108
+ "aria-selected": a === n.length + i,
109
+ className: r(t.categoryLink, { [t.activeOption]: a === n.length + i }),
110
+ onClick: () => l == null ? void 0 : l(),
111
111
  children: e.name
112
112
  }
113
113
  ) }, e.categoryKey)
114
114
  )
115
115
  ] }) })
116
116
  ] }),
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
- _,
117
+ m.length > 0 && /* @__PURE__ */ s("div", { className: t.rightColumn, children: /* @__PURE__ */ s("ol", { className: t.itemList, children: m.map(
118
+ (e, i) => /* @__PURE__ */ s("li", { className: r(t.item, { [t.activeItem]: a === n.length + c.length + i }), children: /* @__PURE__ */ o(
119
+ d,
120
120
  {
121
121
  href: e.url,
122
122
  id: `${u}-${n.length + c.length + i}`,
123
123
  role: "option",
124
- "aria-selected": o === n.length + c.length + i,
125
- onClick: g,
124
+ "aria-selected": a === n.length + c.length + i,
125
+ onClick: () => l == null ? void 0 : l(),
126
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 })
127
+ /* @__PURE__ */ s(N, { src: e.image, alt: `${e.description} product image`, height: 72, width: 72 }),
128
+ /* @__PURE__ */ o("div", { className: t.itemInfo, children: [
129
+ /* @__PURE__ */ s(h, { size: "sm", children: e.description }),
130
+ /* @__PURE__ */ s(h, { size: "sm", colorToken: "quaternary", children: e.itemId })
131
131
  ] })
132
132
  ]
133
133
  }
@@ -136,5 +136,5 @@ function Y({
136
136
  ] });
137
137
  }
138
138
  export {
139
- Y as SuggestionDropdown
139
+ Z as SuggestionDropdown
140
140
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.238",
4
+ "version": "0.0.240",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",