@caseparts-org/caseblocks 0.0.244 → 0.0.245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/SuggestionDropdown.css +1 -1
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.js +54 -54
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.d.ts +1 -0
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.js +31 -18
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._suggestionDropdown_otg7h_1{display:flex;flex-direction:row;width:100%;border:1px solid;border-color:var(--color-neutrals-neutral-2);border-radius:var(--border-radius-sm);box-shadow:0 8px 24px #0f172a14;overflow:hidden}@media (max-width: 767px){._suggestionDropdown_otg7h_1{flex-direction:column}}._leftColumn_otg7h_29{display:flex;flex-direction:column;border-right:1px solid var(--border-border-primary);background-color:#fff;min-width:150px;max-width:220px}@media (max-width: 767px){._leftColumn_otg7h_29{border-right:0;border-bottom:1px solid var(--border-border-primary)}}._leftColumnFullWidth_otg7h_55{flex:1;max-width:none}._suggestionSectionFullHeight_otg7h_65{display:flex;flex:1}._rightColumn_otg7h_75{display:flex;flex:1;flex-direction:column;gap:var(--spacing-spacing-1xs);padding:var(--spacing-spacing-default);background:var(--color-brand-primary-primary-pale-gray);min-width:250px}._categorySection_otg7h_95{border-top:1px solid var(--border-border-primary)}._suggestions_otg7h_101,._categories_otg7h_103{display:flex;flex-direction:column;gap:0;padding:0}._suggestionsFullHeight_otg7h_117{flex:1}._customPartLink_otg7h_125{display:flex;align-items:center;gap:var(--spacing-spacing-4xs);box-sizing:border-box;width:100%;padding:var(--spacing-spacing-4xs) var(--spacing-spacing-default);transition:background-color .3s ease-in}._suggestions_otg7h_101>:first-child,._categories_otg7h_103>:first-child{padding-top:var(--spacing-spacing-default);padding-right:var(--spacing-spacing-default);padding-left:var(--spacing-spacing-default);padding-bottom:var(--spacing-spacing-2xs)}._suggestions_otg7h_101>:last-child,._categories_otg7h_103>:last-child{margin-bottom:var(--spacing-spacing-2xs)}._suggestionLink_otg7h_169,._categoryLink_otg7h_171{display:block;box-sizing:border-box;width:100%;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default);transition:background-color .3s ease-in}._suggestionLink_otg7h_169:hover,._categoryLink_otg7h_171:hover,._customPartLink_otg7h_125:hover{text-decoration:none;background-color:var(--color-alerts-light-teal-blue)}._activeOption_otg7h_207{background:var(--color-alerts-light-teal-blue)}._itemList_otg7h_215{margin:0;padding:0;display:flex;flex-direction:column;gap:var(--spacing-spacing-2xs);width:100%}._item_otg7h_215{display:flex;flex-direction:column;border:1px solid var(--border-border-primary);padding:var(--spacing-spacing-2xs);width:100%;background-color:#fff;transition:background-color .3s ease-in}._item_otg7h_215:hover{background-color:var(--color-alerts-light-teal-blue)}._item_otg7h_215>a:hover{text-decoration:none}._activeItem_otg7h_269{border-color:var(--text-text-links);box-shadow:inset 0 0 0 1px var(--text-text-links)}._item_otg7h_215 img{height:60px;width:60px;object-fit:contain}._item_otg7h_215 a{display:flex;flex-direction:row;align-items:flex-start;gap:var(--spacing-spacing-2xs)}._itemInfo_otg7h_305{display:grid;gap:var(--spacing-spacing-4xs)}._recentSearches_otg7h_315{display:flex;flex-direction:column;background:var(--color-brand-primary-white);min-width:250px}._recentSearchesHeader_otg7h_329{padding:var(--spacing-spacing-default) var(--spacing-spacing-default) var(--spacing-spacing-2xs)}._recentSearchesList_otg7h_337{display:flex;flex-direction:column;gap:0;margin:0;padding:0}._recentSearch_otg7h_315{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-spacing-2xs)}._recentSearchLink_otg7h_367{display:flex;flex:1;min-width:0;align-items:center;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default)}._clearRecentSearch_otg7h_383{display:flex;flex:0 0 auto;align-items:center;justify-content:center;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default);border:0;background:transparent;color:var(--text-text-primary);cursor:pointer}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Text as
|
|
3
|
-
import { Link as
|
|
1
|
+
import { jsxs as c, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { Text as o } from "../../atoms/Text/Text.js";
|
|
3
|
+
import { Link as m } from "../../atoms/Link/Link.js";
|
|
4
4
|
import { Icon as y } from "../../atoms/Icon/Icon.js";
|
|
5
|
-
import { c as
|
|
5
|
+
import { c as a } from "../../clsx-OuTLNxxd.js";
|
|
6
6
|
import { Image as z } from "../../atoms/Image/Image.js";
|
|
7
|
-
import '../../assets/SuggestionDropdown.css';const F = "
|
|
7
|
+
import '../../assets/SuggestionDropdown.css';const F = "_suggestionDropdown_otg7h_1", H = "_leftColumn_otg7h_29", $ = "_leftColumnFullWidth_otg7h_55", D = "_suggestionSectionFullHeight_otg7h_65", w = "_rightColumn_otg7h_75", b = "_categorySection_otg7h_95", T = "_suggestions_otg7h_101", k = "_categories_otg7h_103", q = "_suggestionsFullHeight_otg7h_117", W = "_customPartLink_otg7h_125", j = "_suggestionLink_otg7h_169", K = "_categoryLink_otg7h_171", M = "_activeOption_otg7h_207", O = "_itemList_otg7h_215", R = "_item_otg7h_215", x = "_activeItem_otg7h_269", A = "_itemInfo_otg7h_305", B = "_recentSearches_otg7h_315", E = "_recentSearchesHeader_otg7h_329", G = "_recentSearchesList_otg7h_337", J = "_recentSearch_otg7h_315", Q = "_recentSearchLink_otg7h_367", U = "_clearRecentSearch_otg7h_383", t = {
|
|
8
8
|
suggestionDropdown: F,
|
|
9
9
|
leftColumn: H,
|
|
10
10
|
leftColumnFullWidth: $,
|
|
@@ -32,105 +32,105 @@ import '../../assets/SuggestionDropdown.css';const F = "_suggestionDropdown_11em
|
|
|
32
32
|
function I({
|
|
33
33
|
terms: i,
|
|
34
34
|
categories: r,
|
|
35
|
-
items:
|
|
36
|
-
customParts:
|
|
35
|
+
items: u,
|
|
36
|
+
customParts: g = [],
|
|
37
37
|
view: v = "suggestions",
|
|
38
|
-
recentSearches:
|
|
38
|
+
recentSearches: d = [],
|
|
39
39
|
onClearRecentSearch: f,
|
|
40
40
|
onSuggestionClick: n,
|
|
41
|
-
activeOptionIndex:
|
|
41
|
+
activeOptionIndex: h = -1,
|
|
42
42
|
optionIdPrefix: _,
|
|
43
43
|
onKeyDown: p,
|
|
44
44
|
className: N
|
|
45
45
|
}) {
|
|
46
|
-
return i.length === 0 && r.length === 0 &&
|
|
46
|
+
return i.length === 0 && r.length === 0 && u.length === 0 && g.length === 0 && d.length === 0 ? null : v === "recent-searches" ? /* @__PURE__ */ c(
|
|
47
47
|
"div",
|
|
48
48
|
{
|
|
49
49
|
id: _,
|
|
50
50
|
role: "listbox",
|
|
51
|
-
className:
|
|
51
|
+
className: a(t.suggestionDropdown, t.recentSearches, N),
|
|
52
52
|
onKeyDown: p,
|
|
53
53
|
onMouseDown: (e) => e.preventDefault(),
|
|
54
54
|
children: [
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
55
|
+
/* @__PURE__ */ l("div", { className: t.recentSearchesHeader, children: /* @__PURE__ */ l(o, { size: "xxs", colorToken: "quaternary", children: "Recent Searches" }) }),
|
|
56
|
+
/* @__PURE__ */ l("ol", { className: t.recentSearchesList, children: d.map((e) => /* @__PURE__ */ c("li", { className: t.recentSearch, children: [
|
|
57
|
+
/* @__PURE__ */ l(
|
|
58
|
+
m,
|
|
59
59
|
{
|
|
60
60
|
href: e.url,
|
|
61
|
-
id: `${_}-${
|
|
61
|
+
id: `${_}-${d.indexOf(e)}`,
|
|
62
62
|
role: "option",
|
|
63
|
-
"aria-selected":
|
|
64
|
-
className:
|
|
63
|
+
"aria-selected": h === d.indexOf(e),
|
|
64
|
+
className: a(t.recentSearchLink, { [t.activeOption]: h === d.indexOf(e) }),
|
|
65
65
|
onClick: () => n == null ? void 0 : n(e),
|
|
66
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ l(o, { size: "sm", children: e.term })
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ l(
|
|
70
70
|
"button",
|
|
71
71
|
{
|
|
72
72
|
type: "button",
|
|
73
|
-
className:
|
|
73
|
+
className: t.clearRecentSearch,
|
|
74
74
|
"aria-label": `Clear recent search: ${e.term}`,
|
|
75
75
|
onClick: () => f == null ? void 0 : f(e),
|
|
76
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ l(y, { iconKey: "fa-regular fa-xmark", size: "sm" })
|
|
77
77
|
}
|
|
78
78
|
)
|
|
79
79
|
] }, e.url)) })
|
|
80
80
|
]
|
|
81
81
|
}
|
|
82
|
-
) : /* @__PURE__ */
|
|
83
|
-
(i.length > 0 || r.length > 0 ||
|
|
84
|
-
i.length > 0 && /* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
82
|
+
) : /* @__PURE__ */ c("div", { id: _, role: "listbox", className: a(t.suggestionDropdown, N), onKeyDown: p, onMouseDown: (e) => e.preventDefault(), children: [
|
|
83
|
+
(i.length > 0 || r.length > 0 || g.length > 0) && /* @__PURE__ */ c("div", { className: a(t.leftColumn, { [t.leftColumnFullWidth]: u.length === 0 }), children: [
|
|
84
|
+
i.length > 0 && /* @__PURE__ */ l("div", { className: a(t.suggestionSection, { [t.suggestionSectionFullHeight]: r.length === 0 }), children: /* @__PURE__ */ c("div", { className: a(t.suggestions, { [t.suggestionsFullHeight]: r.length === 0 }), children: [
|
|
85
|
+
/* @__PURE__ */ l(o, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
|
|
86
86
|
i.map(
|
|
87
|
-
(e, s) => /* @__PURE__ */
|
|
88
|
-
|
|
87
|
+
(e, s) => /* @__PURE__ */ l(o, { size: "sm", children: /* @__PURE__ */ l(
|
|
88
|
+
m,
|
|
89
89
|
{
|
|
90
90
|
href: e.url,
|
|
91
91
|
id: `${_}-${s}`,
|
|
92
92
|
role: "option",
|
|
93
|
-
"aria-selected":
|
|
94
|
-
className:
|
|
93
|
+
"aria-selected": h === s,
|
|
94
|
+
className: a(t.suggestionLink, { [t.activeOption]: h === s }),
|
|
95
95
|
onClick: () => n == null ? void 0 : n(e),
|
|
96
96
|
children: e.name
|
|
97
97
|
}
|
|
98
98
|
) }, e.url)
|
|
99
99
|
)
|
|
100
100
|
] }) }),
|
|
101
|
-
r.length > 0 && /* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
101
|
+
r.length > 0 && /* @__PURE__ */ l("div", { className: t.categorySection, children: /* @__PURE__ */ c("div", { className: t.categories, children: [
|
|
102
|
+
/* @__PURE__ */ l(o, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
|
|
103
103
|
r.map(
|
|
104
|
-
(e, s) => /* @__PURE__ */
|
|
105
|
-
|
|
104
|
+
(e, s) => /* @__PURE__ */ l(o, { size: "sm", children: /* @__PURE__ */ l(
|
|
105
|
+
m,
|
|
106
106
|
{
|
|
107
107
|
href: e.url,
|
|
108
108
|
id: `${_}-${i.length + s}`,
|
|
109
109
|
role: "option",
|
|
110
|
-
"aria-selected":
|
|
111
|
-
className:
|
|
110
|
+
"aria-selected": h === i.length + s,
|
|
111
|
+
className: a(t.categoryLink, { [t.activeOption]: h === i.length + s }),
|
|
112
112
|
onClick: () => n == null ? void 0 : n(),
|
|
113
113
|
children: e.name
|
|
114
114
|
}
|
|
115
115
|
) }, e.categoryKey)
|
|
116
116
|
)
|
|
117
117
|
] }) }),
|
|
118
|
-
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
|
|
118
|
+
g.length > 0 && /* @__PURE__ */ l("div", { className: t.categorySection, children: /* @__PURE__ */ c("div", { className: t.categories, children: [
|
|
119
|
+
/* @__PURE__ */ l(o, { size: "xxs", colorToken: "quaternary", children: "Custom Parts" }),
|
|
120
|
+
g.map((e, s) => {
|
|
121
121
|
const L = i.length + r.length + s;
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
|
|
122
|
+
return /* @__PURE__ */ c(
|
|
123
|
+
m,
|
|
124
124
|
{
|
|
125
125
|
href: e.url,
|
|
126
126
|
id: `${_}-${L}`,
|
|
127
127
|
role: "option",
|
|
128
|
-
"aria-selected":
|
|
129
|
-
className:
|
|
128
|
+
"aria-selected": h === L,
|
|
129
|
+
className: a(t.customPartLink, { [t.activeOption]: h === L }),
|
|
130
130
|
onClick: () => n == null ? void 0 : n(),
|
|
131
131
|
children: [
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ l(y, { iconKey: e.icon, size: "sm" }),
|
|
133
|
+
/* @__PURE__ */ l(o, { size: "sm", children: e.label })
|
|
134
134
|
]
|
|
135
135
|
},
|
|
136
136
|
e.id
|
|
@@ -138,20 +138,20 @@ function I({
|
|
|
138
138
|
})
|
|
139
139
|
] }) })
|
|
140
140
|
] }),
|
|
141
|
-
|
|
142
|
-
(e, s) => /* @__PURE__ */
|
|
143
|
-
|
|
141
|
+
u.length > 0 && /* @__PURE__ */ l("div", { className: t.rightColumn, children: /* @__PURE__ */ l("ol", { className: t.itemList, children: u.map(
|
|
142
|
+
(e, s) => /* @__PURE__ */ l("li", { className: a(t.item, { [t.activeItem]: h === i.length + r.length + g.length + s }), children: /* @__PURE__ */ c(
|
|
143
|
+
m,
|
|
144
144
|
{
|
|
145
145
|
href: e.url,
|
|
146
|
-
id: `${_}-${i.length + r.length +
|
|
146
|
+
id: `${_}-${i.length + r.length + g.length + s}`,
|
|
147
147
|
role: "option",
|
|
148
|
-
"aria-selected":
|
|
148
|
+
"aria-selected": h === i.length + r.length + g.length + s,
|
|
149
149
|
onClick: () => n == null ? void 0 : n(),
|
|
150
150
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ l(z, { src: e.image, alt: `${e.description} product image`, height: 72, width: 72 }),
|
|
152
|
+
/* @__PURE__ */ c("div", { className: t.itemInfo, children: [
|
|
153
|
+
/* @__PURE__ */ l(o, { size: "sm", children: e.description }),
|
|
154
|
+
/* @__PURE__ */ l(o, { size: "xs", colorToken: "quaternary", children: e.itemId })
|
|
155
155
|
] })
|
|
156
156
|
]
|
|
157
157
|
}
|
|
@@ -14,4 +14,5 @@ export declare const Default: Story;
|
|
|
14
14
|
export declare const WithoutCategories: Story;
|
|
15
15
|
export declare const WithoutItems: Story;
|
|
16
16
|
export declare const OnlyItems: Story;
|
|
17
|
+
export declare const OnlyCustomParts: Story;
|
|
17
18
|
export declare const RecentSearches: Story;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { SuggestionDropdown as s } from "./SuggestionDropdown.js";
|
|
3
|
+
const c = {
|
|
3
4
|
title: "Case Parts/Organisms/SuggestionDropdown",
|
|
4
|
-
component:
|
|
5
|
+
component: s,
|
|
5
6
|
parameters: {
|
|
6
7
|
layout: "centered"
|
|
7
8
|
},
|
|
8
9
|
tags: ["autodocs"]
|
|
9
|
-
},
|
|
10
|
+
}, t = {
|
|
10
11
|
args: {
|
|
11
12
|
terms: [
|
|
12
13
|
{ name: "thermostat", url: "/search/thermostat" },
|
|
@@ -47,23 +48,34 @@ const a = {
|
|
|
47
48
|
}
|
|
48
49
|
]
|
|
49
50
|
}
|
|
50
|
-
},
|
|
51
|
+
}, i = {
|
|
51
52
|
args: {
|
|
52
|
-
...
|
|
53
|
+
...t.args,
|
|
53
54
|
categories: []
|
|
54
55
|
}
|
|
55
|
-
},
|
|
56
|
+
}, n = {
|
|
56
57
|
args: {
|
|
57
|
-
...
|
|
58
|
+
...t.args,
|
|
58
59
|
items: []
|
|
59
60
|
}
|
|
60
|
-
},
|
|
61
|
+
}, m = {
|
|
61
62
|
args: {
|
|
62
|
-
...
|
|
63
|
+
...t.args,
|
|
63
64
|
terms: [],
|
|
64
65
|
categories: []
|
|
65
66
|
}
|
|
66
|
-
},
|
|
67
|
+
}, l = {
|
|
68
|
+
args: {
|
|
69
|
+
terms: [],
|
|
70
|
+
categories: [],
|
|
71
|
+
items: [],
|
|
72
|
+
customParts: [
|
|
73
|
+
{ id: "gasket", label: "Gaskets", url: "/custom/gasket", icon: "fa-kit fa-gaskets" },
|
|
74
|
+
{ id: "heater", label: "Bent Heaters", url: "/custom/heater", icon: "fa-kit fa-coils" }
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
render: (e) => /* @__PURE__ */ r("div", { style: { width: "600px" }, children: /* @__PURE__ */ r(s, { ...e }) })
|
|
78
|
+
}, g = {
|
|
67
79
|
args: {
|
|
68
80
|
view: "recent-searches",
|
|
69
81
|
terms: [],
|
|
@@ -74,14 +86,15 @@ const a = {
|
|
|
74
86
|
{ term: "walk-in cooler", url: "/search/walk-in-cooler" },
|
|
75
87
|
{ term: "thermostat", url: "/search/thermostat" }
|
|
76
88
|
],
|
|
77
|
-
onClearRecentSearch: (
|
|
89
|
+
onClearRecentSearch: (e) => alert(`Clear ${e.term}`)
|
|
78
90
|
}
|
|
79
91
|
};
|
|
80
92
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
t as Default,
|
|
94
|
+
l as OnlyCustomParts,
|
|
95
|
+
m as OnlyItems,
|
|
96
|
+
g as RecentSearches,
|
|
97
|
+
i as WithoutCategories,
|
|
98
|
+
n as WithoutItems,
|
|
99
|
+
c as default
|
|
87
100
|
};
|