@caseparts-org/caseblocks 0.0.240 → 0.0.242

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,133 +1,157 @@
1
- import { jsxs as o, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as a, jsx as l } from "react/jsx-runtime";
2
2
  import { Text as h } from "../../atoms/Text/Text.js";
3
- import { Link as d } from "../../atoms/Link/Link.js";
4
- import { Icon as L } from "../../atoms/Icon/Icon.js";
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
3
+ import { Link as m } from "../../atoms/Link/Link.js";
4
+ import { Icon as y } from "../../atoms/Icon/Icon.js";
5
+ import { c as o } from "../../clsx-OuTLNxxd.js";
6
+ import { Image as z } from "../../atoms/Image/Image.js";
7
+ import '../../assets/SuggestionDropdown.css';const F = "_suggestionDropdown_1un69_1", H = "_leftColumn_1un69_31", $ = "_leftColumnFullWidth_1un69_55", D = "_suggestionSectionFullHeight_1un69_63", w = "_rightColumn_1un69_73", b = "_categorySection_1un69_95", T = "_suggestions_1un69_101", k = "_categories_1un69_103", q = "_suggestionsFullHeight_1un69_117", W = "_customPartLink_1un69_125", j = "_suggestionLink_1un69_169", K = "_categoryLink_1un69_171", M = "_activeOption_1un69_207", O = "_itemList_1un69_215", R = "_item_1un69_215", x = "_activeItem_1un69_269", A = "_itemInfo_1un69_303", B = "_recentSearches_1un69_313", E = "_recentSearchesHeader_1un69_327", G = "_recentSearchesList_1un69_335", J = "_recentSearch_1un69_313", Q = "_recentSearchLink_1un69_365", U = "_clearRecentSearch_1un69_381", n = {
8
+ suggestionDropdown: F,
9
+ leftColumn: H,
10
+ leftColumnFullWidth: $,
11
+ suggestionSectionFullHeight: D,
12
+ rightColumn: w,
13
+ categorySection: b,
14
+ suggestions: T,
15
+ categories: k,
16
+ suggestionsFullHeight: q,
17
+ customPartLink: W,
18
+ suggestionLink: j,
19
+ categoryLink: K,
20
+ activeOption: M,
21
+ itemList: O,
22
+ item: R,
23
+ activeItem: x,
24
+ itemInfo: A,
25
+ recentSearches: B,
26
+ recentSearchesHeader: E,
27
+ recentSearchesList: G,
28
+ recentSearch: J,
29
+ recentSearchLink: Q,
30
+ clearRecentSearch: U
30
31
  };
31
- function Z({
32
- terms: n,
33
- categories: c,
34
- items: m,
35
- view: p = "suggestions",
36
- recentSearches: _ = [],
37
- onClearRecentSearch: g,
38
- onSuggestionClick: l,
39
- activeOptionIndex: a = -1,
32
+ function I({
33
+ terms: i,
34
+ categories: r,
35
+ items: g,
36
+ customParts: _ = [],
37
+ view: v = "suggestions",
38
+ recentSearches: d = [],
39
+ onClearRecentSearch: f,
40
+ onSuggestionClick: t,
41
+ activeOptionIndex: c = -1,
40
42
  optionIdPrefix: u,
41
- onKeyDown: z,
42
- className: f
43
+ onKeyDown: p,
44
+ className: N
43
45
  }) {
44
- return p === "recent-searches" ? /* @__PURE__ */ o(
46
+ return i.length === 0 && r.length === 0 && g.length === 0 && _.length === 0 && d.length === 0 ? null : v === "recent-searches" ? /* @__PURE__ */ a(
45
47
  "div",
46
48
  {
47
49
  id: u,
48
50
  role: "listbox",
49
- className: r(t.suggestionDropdown, t.recentSearches, f),
50
- onKeyDown: z,
51
+ className: o(n.suggestionDropdown, n.recentSearches, N),
52
+ onKeyDown: p,
51
53
  onMouseDown: (e) => e.preventDefault(),
52
54
  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
- /* @__PURE__ */ s(
56
- d,
55
+ /* @__PURE__ */ l("div", { className: n.recentSearchesHeader, children: /* @__PURE__ */ l(h, { size: "xxs", colorToken: "quaternary", children: "Recent Searches" }) }),
56
+ /* @__PURE__ */ l("ol", { className: n.recentSearchesList, children: d.map((e) => /* @__PURE__ */ a("li", { className: n.recentSearch, children: [
57
+ /* @__PURE__ */ l(
58
+ m,
57
59
  {
58
60
  href: e.url,
59
- id: `${u}-${_.indexOf(e)}`,
61
+ id: `${u}-${d.indexOf(e)}`,
60
62
  role: "option",
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 })
63
+ "aria-selected": c === d.indexOf(e),
64
+ className: o(n.recentSearchLink, { [n.activeOption]: c === d.indexOf(e) }),
65
+ onClick: () => t == null ? void 0 : t(e),
66
+ children: /* @__PURE__ */ l(h, { size: "sm", children: e.term })
65
67
  }
66
68
  ),
67
- /* @__PURE__ */ s(
69
+ /* @__PURE__ */ l(
68
70
  "button",
69
71
  {
70
72
  type: "button",
71
- className: t.clearRecentSearch,
73
+ className: n.clearRecentSearch,
72
74
  "aria-label": `Clear recent search: ${e.term}`,
73
- onClick: () => g == null ? void 0 : g(e),
74
- children: /* @__PURE__ */ s(L, { iconKey: "fa-regular fa-xmark", size: "sm" })
75
+ onClick: () => f == null ? void 0 : f(e),
76
+ children: /* @__PURE__ */ l(y, { iconKey: "fa-regular fa-xmark", size: "sm" })
75
77
  }
76
78
  )
77
79
  ] }, e.url)) })
78
80
  ]
79
81
  }
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
- n.map(
85
- (e, i) => /* @__PURE__ */ s(h, { size: "sm", children: /* @__PURE__ */ s(
86
- d,
82
+ ) : /* @__PURE__ */ a("div", { id: u, role: "listbox", className: o(n.suggestionDropdown, N), onKeyDown: p, onMouseDown: (e) => e.preventDefault(), children: [
83
+ (i.length > 0 || r.length > 0 || _.length > 0) && /* @__PURE__ */ a("div", { className: o(n.leftColumn, { [n.leftColumnFullWidth]: g.length === 0 }), children: [
84
+ i.length > 0 && /* @__PURE__ */ l("div", { className: o(n.suggestionSection, { [n.suggestionSectionFullHeight]: r.length === 0 }), children: /* @__PURE__ */ a("div", { className: o(n.suggestions, { [n.suggestionsFullHeight]: r.length === 0 }), children: [
85
+ /* @__PURE__ */ l(h, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
86
+ i.map(
87
+ (e, s) => /* @__PURE__ */ l(h, { size: "sm", children: /* @__PURE__ */ l(
88
+ m,
87
89
  {
88
90
  href: e.url,
89
- id: `${u}-${i}`,
91
+ id: `${u}-${s}`,
90
92
  role: "option",
91
- "aria-selected": a === i,
92
- className: r(t.suggestionLink, { [t.activeOption]: a === i }),
93
- onClick: () => l == null ? void 0 : l(e),
93
+ "aria-selected": c === s,
94
+ className: o(n.suggestionLink, { [n.activeOption]: c === s }),
95
+ onClick: () => t == null ? void 0 : t(e),
94
96
  children: e.name
95
97
  }
96
98
  ) }, e.url)
97
99
  )
98
100
  ] }) }),
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
- c.map(
102
- (e, i) => /* @__PURE__ */ s(h, { size: "sm", children: /* @__PURE__ */ s(
103
- d,
101
+ r.length > 0 && /* @__PURE__ */ l("div", { className: n.categorySection, children: /* @__PURE__ */ a("div", { className: n.categories, children: [
102
+ /* @__PURE__ */ l(h, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
103
+ r.map(
104
+ (e, s) => /* @__PURE__ */ l(h, { size: "sm", children: /* @__PURE__ */ l(
105
+ m,
104
106
  {
105
107
  href: e.url,
106
- id: `${u}-${n.length + i}`,
108
+ id: `${u}-${i.length + s}`,
107
109
  role: "option",
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(),
110
+ "aria-selected": c === i.length + s,
111
+ className: o(n.categoryLink, { [n.activeOption]: c === i.length + s }),
112
+ onClick: () => t == null ? void 0 : t(),
111
113
  children: e.name
112
114
  }
113
115
  ) }, e.categoryKey)
114
116
  )
117
+ ] }) }),
118
+ _.length > 0 && /* @__PURE__ */ l("div", { className: n.categorySection, children: /* @__PURE__ */ a("div", { className: n.categories, children: [
119
+ /* @__PURE__ */ l(h, { size: "xxs", colorToken: "quaternary", children: "Custom Parts" }),
120
+ _.map((e, s) => {
121
+ const L = i.length + r.length + s;
122
+ return /* @__PURE__ */ a(
123
+ m,
124
+ {
125
+ href: e.url,
126
+ id: `${u}-${L}`,
127
+ role: "option",
128
+ "aria-selected": c === L,
129
+ className: o(n.customPartLink, { [n.activeOption]: c === L }),
130
+ onClick: () => t == null ? void 0 : t(),
131
+ children: [
132
+ /* @__PURE__ */ l(y, { iconKey: e.icon, size: "sm" }),
133
+ /* @__PURE__ */ l(h, { size: "sm", children: e.label })
134
+ ]
135
+ },
136
+ e.id
137
+ );
138
+ })
115
139
  ] }) })
116
140
  ] }),
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,
141
+ g.length > 0 && /* @__PURE__ */ l("div", { className: n.rightColumn, children: /* @__PURE__ */ l("ol", { className: n.itemList, children: g.map(
142
+ (e, s) => /* @__PURE__ */ l("li", { className: o(n.item, { [n.activeItem]: c === i.length + r.length + _.length + s }), children: /* @__PURE__ */ a(
143
+ m,
120
144
  {
121
145
  href: e.url,
122
- id: `${u}-${n.length + c.length + i}`,
146
+ id: `${u}-${i.length + r.length + _.length + s}`,
123
147
  role: "option",
124
- "aria-selected": a === n.length + c.length + i,
125
- onClick: () => l == null ? void 0 : l(),
148
+ "aria-selected": c === i.length + r.length + _.length + s,
149
+ onClick: () => t == null ? void 0 : t(),
126
150
  children: [
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 })
151
+ /* @__PURE__ */ l(z, { src: e.image, alt: `${e.description} product image`, height: 72, width: 72 }),
152
+ /* @__PURE__ */ a("div", { className: n.itemInfo, children: [
153
+ /* @__PURE__ */ l(h, { size: "sm", children: e.description }),
154
+ /* @__PURE__ */ l(h, { size: "xs", colorToken: "quaternary", children: e.itemId })
131
155
  ] })
132
156
  ]
133
157
  }
@@ -136,5 +160,5 @@ function Z({
136
160
  ] });
137
161
  }
138
162
  export {
139
- Z as SuggestionDropdown
163
+ I as SuggestionDropdown
140
164
  };
@@ -19,19 +19,23 @@ const a = {
19
19
  { categoryKey: 2, name: "Accessories", url: "/categories/accessories" },
20
20
  { categoryKey: 3, name: "Controls", url: "/categories/controls" }
21
21
  ],
22
+ customParts: [
23
+ { id: "gasket", label: "Gaskets", url: "/custom/gasket", icon: "fa-kit fa-gaskets" },
24
+ { id: "heater", label: "Bent Heaters", url: "/custom/heater", icon: "fa-kit fa-coils" }
25
+ ],
22
26
  items: [
23
27
  {
24
28
  itemKey: 1,
25
29
  itemId: "P-1001",
26
30
  description: "Smart Thermostat",
27
- image: "https://placehold.co/120x80/png?text=Thermostat",
31
+ image: "https://placehold.co/120x80/png?text=T-Stat",
28
32
  url: "/parts/p-1001"
29
33
  },
30
34
  {
31
35
  itemKey: 2,
32
36
  itemId: "P-1002",
33
37
  description: "Wire Harness",
34
- image: "https://placehold.co/120x80/png?text=Harness",
38
+ image: "https://placehold.co/120x80/png?text=Gasket",
35
39
  url: "/parts/p-1002"
36
40
  },
37
41
  {
@@ -53,13 +57,13 @@ const a = {
53
57
  ...e.args,
54
58
  items: []
55
59
  }
56
- }, n = {
60
+ }, i = {
57
61
  args: {
58
62
  ...e.args,
59
63
  terms: [],
60
64
  categories: []
61
65
  }
62
- }, i = {
66
+ }, n = {
63
67
  args: {
64
68
  view: "recent-searches",
65
69
  terms: [],
@@ -75,8 +79,8 @@ const a = {
75
79
  };
76
80
  export {
77
81
  e as Default,
78
- n as OnlyItems,
79
- i as RecentSearches,
82
+ i as OnlyItems,
83
+ n as RecentSearches,
80
84
  o as WithoutCategories,
81
85
  c as WithoutItems,
82
86
  a as default
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.240",
4
+ "version": "0.0.242",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",