@caseparts-org/caseblocks 0.0.232 → 0.0.233
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 +57 -54
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.d.ts +3 -0
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.js +27 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._suggestionDropdown_1fc5y_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_1fc5y_1{flex-direction:column}}._leftColumn_1fc5y_31{display:flex;flex-direction:column;border-right:1px solid var(--border-border-primary);background:var(--color-brand-primary-primary-pale-gray);min-width:150px}@media (max-width: 767px){._leftColumn_1fc5y_31{border-right:0;border-bottom:1px solid var(--border-border-primary)}}._leftColumnFullWidth_1fc5y_55{flex:1}._suggestionSectionFullHeight_1fc5y_63{display:flex;flex:1}._rightColumn_1fc5y_73{display:flex;flex:1;flex-direction:column;gap:var(--spacing-spacing-1xs);padding:var(--spacing-spacing-default);background:var(--color-brand-primary-white);min-width:250px}._categorySection_1fc5y_95{border-top:1px solid var(--border-border-primary)}._suggestions_1fc5y_101,._categories_1fc5y_103{display:flex;flex-direction:column;gap:0;padding:0}._suggestionsFullHeight_1fc5y_117{flex:1}._suggestions_1fc5y_101>:first-child,._categories_1fc5y_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_1fc5y_101>:last-child{padding-bottom:var(--spacing-spacing-2xs)}._suggestionLink_1fc5y_147,._categoryLink_1fc5y_149{display:block;box-sizing:border-box;width:100%;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default)}._itemList_1fc5y_163{margin:0;padding:0;display:flex;flex-direction:column;gap:var(--spacing-spacing-2xs);width:100%}._item_1fc5y_163{display:flex;flex-direction:column;border:1px solid var(--border-border-primary);padding:var(--spacing-spacing-2xs);width:100%}._item_1fc5y_163 img{height:60px;width:60px}._item_1fc5y_163 a{display:flex;flex-direction:row;align-items:flex-start;gap:var(--spacing-spacing-2xs)}._itemInfo_1fc5y_221{display:grid;gap:var(--spacing-spacing-4xs)}._recentSearches_1fc5y_231{display:flex;flex-direction:column;background:var(--color-brand-primary-white);min-width:250px}._recentSearchesHeader_1fc5y_245{padding:var(--spacing-spacing-default) var(--spacing-spacing-default) var(--spacing-spacing-2xs)}._recentSearchesList_1fc5y_253{display:flex;flex-direction:column;gap:0;margin:0;padding:0}._recentSearch_1fc5y_231{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-spacing-2xs)}._recentSearchLink_1fc5y_283{display:flex;flex:1;min-width:0;align-items:center;padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default)}._clearRecentSearch_1fc5y_299{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,85 +1,88 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Text as
|
|
3
|
-
import { Link as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { c as
|
|
6
|
-
import { Image as
|
|
7
|
-
import '../../assets/SuggestionDropdown.css';const
|
|
8
|
-
suggestionDropdown:
|
|
9
|
-
leftColumn:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsxs as t, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Text as c } from "../../atoms/Text/Text.js";
|
|
3
|
+
import { Link as o } from "../../atoms/Link/Link.js";
|
|
4
|
+
import { Icon as m } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import { c as r } from "../../clsx-OuTLNxxd.js";
|
|
6
|
+
import { Image as f } from "../../atoms/Image/Image.js";
|
|
7
|
+
import '../../assets/SuggestionDropdown.css';const d = "_suggestionDropdown_1fc5y_1", y = "_leftColumn_1fc5y_31", S = "_leftColumnFullWidth_1fc5y_55", p = "_suggestionSectionFullHeight_1fc5y_63", L = "_rightColumn_1fc5y_73", k = "_categorySection_1fc5y_95", N = "_suggestions_1fc5y_101", v = "_categories_1fc5y_103", x = "_suggestionsFullHeight_1fc5y_117", F = "_suggestionLink_1fc5y_147", H = "_categoryLink_1fc5y_149", C = "_itemList_1fc5y_163", D = "_item_1fc5y_163", w = "_itemInfo_1fc5y_221", z = "_recentSearches_1fc5y_231", T = "_recentSearchesHeader_1fc5y_245", q = "_recentSearchesList_1fc5y_253", W = "_recentSearch_1fc5y_231", b = "_recentSearchLink_1fc5y_283", I = "_clearRecentSearch_1fc5y_299", n = {
|
|
8
|
+
suggestionDropdown: d,
|
|
9
|
+
leftColumn: y,
|
|
10
|
+
leftColumnFullWidth: S,
|
|
11
|
+
suggestionSectionFullHeight: p,
|
|
12
|
+
rightColumn: L,
|
|
13
|
+
categorySection: k,
|
|
14
|
+
suggestions: N,
|
|
15
|
+
categories: v,
|
|
16
|
+
suggestionsFullHeight: x,
|
|
17
|
+
suggestionLink: F,
|
|
18
|
+
categoryLink: H,
|
|
19
|
+
itemList: C,
|
|
20
|
+
item: D,
|
|
21
|
+
itemInfo: w,
|
|
22
|
+
recentSearches: z,
|
|
23
|
+
recentSearchesHeader: T,
|
|
24
|
+
recentSearchesList: q,
|
|
25
|
+
recentSearch: W,
|
|
26
|
+
recentSearchLink: b,
|
|
27
|
+
clearRecentSearch: I
|
|
25
28
|
};
|
|
26
|
-
function
|
|
29
|
+
function B({
|
|
27
30
|
terms: l,
|
|
28
|
-
categories:
|
|
29
|
-
items:
|
|
30
|
-
view:
|
|
31
|
+
categories: i,
|
|
32
|
+
items: a,
|
|
33
|
+
view: u = "suggestions",
|
|
31
34
|
recentSearches: _ = [],
|
|
32
|
-
onClearRecentSearch:
|
|
33
|
-
className:
|
|
35
|
+
onClearRecentSearch: g,
|
|
36
|
+
className: h
|
|
34
37
|
}) {
|
|
35
|
-
return
|
|
38
|
+
return u === "recent-searches" ? /* @__PURE__ */ t(
|
|
36
39
|
"div",
|
|
37
40
|
{
|
|
38
|
-
className:
|
|
41
|
+
className: r(n.suggestionDropdown, n.recentSearches, h),
|
|
39
42
|
onMouseDown: (e) => e.preventDefault(),
|
|
40
43
|
children: [
|
|
41
|
-
/* @__PURE__ */ s("div", { className:
|
|
42
|
-
/* @__PURE__ */ s("ol", { className:
|
|
43
|
-
/* @__PURE__ */ s(
|
|
44
|
+
/* @__PURE__ */ s("div", { className: n.recentSearchesHeader, children: /* @__PURE__ */ s(c, { size: "xxs", colorToken: "quaternary", children: "Recent Searches" }) }),
|
|
45
|
+
/* @__PURE__ */ s("ol", { className: n.recentSearchesList, children: _.map((e) => /* @__PURE__ */ t("li", { className: n.recentSearch, children: [
|
|
46
|
+
/* @__PURE__ */ s(o, { href: e.url, className: n.recentSearchLink, children: /* @__PURE__ */ s(c, { size: "sm", children: e.term }) }),
|
|
44
47
|
/* @__PURE__ */ s(
|
|
45
48
|
"button",
|
|
46
49
|
{
|
|
47
50
|
type: "button",
|
|
48
|
-
className:
|
|
51
|
+
className: n.clearRecentSearch,
|
|
49
52
|
"aria-label": `Clear recent search: ${e.term}`,
|
|
50
|
-
onClick: () =>
|
|
51
|
-
children: /* @__PURE__ */ s(
|
|
53
|
+
onClick: () => g == null ? void 0 : g(e),
|
|
54
|
+
children: /* @__PURE__ */ s(m, { iconKey: "fa-regular fa-xmark", size: "sm" })
|
|
52
55
|
}
|
|
53
56
|
)
|
|
54
57
|
] }, e.url)) })
|
|
55
58
|
]
|
|
56
59
|
}
|
|
57
|
-
) : /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */ s("div", { className: r.suggestionSection, children: /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */ s(
|
|
60
|
+
) : /* @__PURE__ */ t("div", { className: r(n.suggestionDropdown, h), onMouseDown: (e) => e.preventDefault(), children: [
|
|
61
|
+
(l.length > 0 || i.length > 0) && /* @__PURE__ */ t("div", { className: r(n.leftColumn, { [n.leftColumnFullWidth]: a.length === 0 }), children: [
|
|
62
|
+
l.length > 0 && /* @__PURE__ */ s("div", { className: r(n.suggestionSection, { [n.suggestionSectionFullHeight]: i.length === 0 }), children: /* @__PURE__ */ t("div", { className: r(n.suggestions, { [n.suggestionsFullHeight]: i.length === 0 }), children: [
|
|
63
|
+
/* @__PURE__ */ s(c, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
|
|
61
64
|
l.map(
|
|
62
|
-
(e) => /* @__PURE__ */ s(
|
|
65
|
+
(e) => /* @__PURE__ */ s(c, { size: "sm", children: /* @__PURE__ */ s(o, { href: e.url, className: n.suggestionLink, children: e.name }) }, e.url)
|
|
63
66
|
)
|
|
64
67
|
] }) }),
|
|
65
|
-
/* @__PURE__ */ s("div", { className:
|
|
66
|
-
/* @__PURE__ */ s(
|
|
67
|
-
|
|
68
|
-
(e) => /* @__PURE__ */ s(
|
|
68
|
+
i.length > 0 && /* @__PURE__ */ s("div", { className: n.categorySection, children: /* @__PURE__ */ t("div", { className: n.categories, children: [
|
|
69
|
+
/* @__PURE__ */ s(c, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
|
|
70
|
+
i.map(
|
|
71
|
+
(e) => /* @__PURE__ */ s(c, { size: "sm", children: /* @__PURE__ */ s(o, { href: e.url, className: n.categoryLink, children: e.name }) }, e.name)
|
|
69
72
|
)
|
|
70
73
|
] }) })
|
|
71
74
|
] }),
|
|
72
|
-
/* @__PURE__ */ s("div", { className:
|
|
73
|
-
(e) => /* @__PURE__ */ s("li", { className:
|
|
74
|
-
/* @__PURE__ */ s(
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */ s(
|
|
77
|
-
/* @__PURE__ */ s(
|
|
75
|
+
a.length > 0 && /* @__PURE__ */ s("div", { className: n.rightColumn, children: /* @__PURE__ */ s("ol", { className: n.itemList, children: a.map(
|
|
76
|
+
(e) => /* @__PURE__ */ s("li", { className: n.item, children: /* @__PURE__ */ t(o, { href: e.url, children: [
|
|
77
|
+
/* @__PURE__ */ s(f, { src: e.image, alt: `${e.description} product image`, height: 72, width: 72 }),
|
|
78
|
+
/* @__PURE__ */ t("div", { className: n.itemInfo, children: [
|
|
79
|
+
/* @__PURE__ */ s(c, { size: "sm", children: e.description }),
|
|
80
|
+
/* @__PURE__ */ s(c, { size: "sm", colorToken: "quaternary", children: e.itemId })
|
|
78
81
|
] })
|
|
79
82
|
] }) }, e.itemId)
|
|
80
83
|
) }) })
|
|
81
84
|
] });
|
|
82
85
|
}
|
|
83
86
|
export {
|
|
84
|
-
|
|
87
|
+
B as SuggestionDropdown
|
|
85
88
|
};
|
|
@@ -11,4 +11,7 @@ declare const meta: {
|
|
|
11
11
|
export default meta;
|
|
12
12
|
type Story = StoryObj<typeof meta>;
|
|
13
13
|
export declare const Default: Story;
|
|
14
|
+
export declare const WithoutCategories: Story;
|
|
15
|
+
export declare const WithoutItems: Story;
|
|
16
|
+
export declare const OnlyItems: Story;
|
|
14
17
|
export declare const RecentSearches: Story;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { SuggestionDropdown as
|
|
2
|
-
const
|
|
1
|
+
import { SuggestionDropdown as r } from "./SuggestionDropdown.js";
|
|
2
|
+
const a = {
|
|
3
3
|
title: "Case Parts/Organisms/SuggestionDropdown",
|
|
4
|
-
component:
|
|
4
|
+
component: r,
|
|
5
5
|
parameters: {
|
|
6
6
|
layout: "centered"
|
|
7
7
|
},
|
|
8
8
|
tags: ["autodocs"]
|
|
9
|
-
},
|
|
9
|
+
}, e = {
|
|
10
10
|
args: {
|
|
11
11
|
terms: [
|
|
12
12
|
{ name: "thermostat", url: "/search/thermostat" },
|
|
@@ -44,6 +44,22 @@ const s = {
|
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
46
|
}, o = {
|
|
47
|
+
args: {
|
|
48
|
+
...e.args,
|
|
49
|
+
categories: []
|
|
50
|
+
}
|
|
51
|
+
}, c = {
|
|
52
|
+
args: {
|
|
53
|
+
...e.args,
|
|
54
|
+
items: []
|
|
55
|
+
}
|
|
56
|
+
}, n = {
|
|
57
|
+
args: {
|
|
58
|
+
...e.args,
|
|
59
|
+
terms: [],
|
|
60
|
+
categories: []
|
|
61
|
+
}
|
|
62
|
+
}, i = {
|
|
47
63
|
args: {
|
|
48
64
|
view: "recent-searches",
|
|
49
65
|
terms: [],
|
|
@@ -54,11 +70,14 @@ const s = {
|
|
|
54
70
|
{ term: "walk-in cooler", url: "/search/walk-in-cooler" },
|
|
55
71
|
{ term: "thermostat", url: "/search/thermostat" }
|
|
56
72
|
],
|
|
57
|
-
onClearRecentSearch: (
|
|
73
|
+
onClearRecentSearch: (t) => alert(`Clear ${t.term}`)
|
|
58
74
|
}
|
|
59
75
|
};
|
|
60
76
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
e as Default,
|
|
78
|
+
n as OnlyItems,
|
|
79
|
+
i as RecentSearches,
|
|
80
|
+
o as WithoutCategories,
|
|
81
|
+
c as WithoutItems,
|
|
82
|
+
a as default
|
|
64
83
|
};
|