@caseparts-org/caseblocks 0.0.225 → 0.0.226
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/Input.css +1 -1
- package/dist/assets/SearchBox.css +1 -1
- package/dist/assets/SuggestionDropdown.css +1 -0
- package/dist/atoms/Input/Input.d.ts +2 -0
- package/dist/atoms/Input/Input.js +35 -31
- package/dist/molecules/SearchBox/SearchBox.js +31 -60
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.d.ts +18 -0
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.js +51 -0
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.d.ts +13 -0
- package/dist/organisms/SuggestionDropdown/SuggestionDropdown.stories.js +45 -0
- package/package.json +1 -1
package/dist/assets/Input.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._input-
|
|
1
|
+
._input-container_wjc1i_1{display:flex;position:relative;flex-direction:column;align-items:flex-start;width:100%;box-sizing:border-box}._input_wjc1i_1{height:32px;border-radius:var(--radius-radius-sm, .25rem);border:1px solid var(--border-border-primary, #dfdfdf);background:var(--surface-surface-primary);padding:0px var(--spacing-spacing-1xs, 12px);outline:none;font-size:var(--font-size-sm);width:100%}@media (max-width:767px){._input_wjc1i_1{font-size:var(--font-size-md)}}._search_wjc1i_24{border-radius:40px}._hasEndAdornment_wjc1i_28{padding-right:40px}._endAdornment_wjc1i_32{position:absolute;right:8px;top:50%;display:flex;transform:translateY(-50%)}._input_wjc1i_1:focus{border:1px solid var(--border-border-primary-btn, #1380b1);box-shadow:0 0 2px 1px var(--border-border-primary-btn)}._input_wjc1i_1:disabled{border:1px solid var(--border-border-primary, #dfdfdf);background:var(--surface-surface-secondary, #f6f6f6);color:var(--text-text-disabled, #b2b2b2);cursor:not-allowed}._input_wjc1i_1:disabled:hover,._input_wjc1i_1:disabled:focus{border:1px solid var(--border-border-primary, #dfdfdf);box-shadow:none}._label_wjc1i_58{position:absolute;align-self:flex-start;left:8px;top:-8px;padding:0 8px;cursor:text;transition:all .2s ease-in;font-family:var(--font-family-label);font-size:var(--font-size-xxs);color:var(--text-text-quaternary);background-color:var(--surface-surface-primary)}._labelPlaceholder_wjc1i_72{position:absolute;align-self:flex-start;box-sizing:border-box;max-width:calc(100% - 24px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:italic;font-family:var(--font-family-label);font-size:var(--font-size-sm);background-color:transparent;color:var(--text-text-quaternary);left:12px;top:8px;padding:0 2px;pointer-events:none;transition:all .2s ease-in}._labelDisabled_wjc1i_92{color:var(--text-text-disabled, #b2b2b2)}._input_wjc1i_1:hover:not(:disabled){border:1px solid var(--border-border-primary-btn, #1380b1);transition:all .2s ease}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._inputContainer_ptqd0_1{position:relative;width:100%}._button_ptqd0_10{background-color:transparent;border:none;padding:0;margin:0;position:absolute;right:8px;top:4px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._suggestionDropdown_1y1jy_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_1y1jy_1{flex-direction:column}}._leftColumn_1y1jy_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_1y1jy_31{border-right:0;border-bottom:1px solid var(--border-border-primary)}}._rightColumn_1y1jy_55{display:flex;flex-direction:column;gap:var(--spacing-spacing-1xs);padding:var(--spacing-spacing-default);background:var(--color-brand-primary-white);min-width:250px}._categorySection_1y1jy_75{border-top:1px solid var(--border-border-primary)}._suggestions_1y1jy_81,._categories_1y1jy_83{display:flex;flex-direction:column;gap:var(--spacing-spacing-2xs);padding:var(--spacing-spacing-default)}._itemList_1y1jy_97{margin:0;padding:0;display:flex;flex-direction:column;gap:var(--spacing-spacing-2xs);width:100%}._item_1y1jy_97{display:flex;flex-direction:column;border:1px solid var(--border-border-primary);padding:var(--spacing-spacing-2xs);width:100%}._item_1y1jy_97 img{height:60px;width:60px}._item_1y1jy_97 a{display:flex;flex-direction:row;align-items:flex-start;gap:var(--spacing-spacing-2xs)}._itemInfo_1y1jy_155{display:grid;gap:var(--spacing-spacing-4xs)}
|
|
@@ -3,5 +3,7 @@ import { HideAtProps } from '../HideAt';
|
|
|
3
3
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "placeholder">, HideAtProps {
|
|
4
4
|
label: string | null;
|
|
5
5
|
placeholder?: string;
|
|
6
|
+
variant?: "default" | "search";
|
|
7
|
+
endAdornment?: React.ReactNode;
|
|
6
8
|
}
|
|
7
9
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,45 +1,49 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import f, { useState as
|
|
3
|
-
import { c as
|
|
4
|
-
import { getHideAtStyles as
|
|
5
|
-
import '../../assets/Input.css';const x = "
|
|
6
|
-
"input-container": "_input-
|
|
7
|
-
input:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as w, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import f, { useState as j } from "react";
|
|
3
|
+
import { c as o } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { getHideAtStyles as A } from "../HideAt.js";
|
|
5
|
+
import '../../assets/Input.css';const F = "_input_wjc1i_1", x = "_search_wjc1i_24", B = "_hasEndAdornment_wjc1i_28", D = "_endAdornment_wjc1i_32", N = "_label_wjc1i_58", y = "_labelPlaceholder_wjc1i_72", E = "_labelDisabled_wjc1i_92", e = {
|
|
6
|
+
"input-container": "_input-container_wjc1i_1",
|
|
7
|
+
input: F,
|
|
8
|
+
search: x,
|
|
9
|
+
hasEndAdornment: B,
|
|
10
|
+
endAdornment: D,
|
|
11
|
+
label: N,
|
|
12
|
+
labelPlaceholder: y,
|
|
13
|
+
labelDisabled: E
|
|
14
|
+
}, I = f.forwardRef(
|
|
15
|
+
({ label: n, placeholder: c, value: a, hideAt: _, className: m, variant: u = "default", endAdornment: s, ...l }, b) => {
|
|
16
|
+
const [i, d] = j(!1), h = !!l.disabled, r = !!n && (i || !!a), p = !!c && !n && !i && !a;
|
|
17
|
+
return /* @__PURE__ */ w("div", { className: o(e["input-container"], A(_)), children: [
|
|
18
|
+
(n || p) && /* @__PURE__ */ t(
|
|
16
19
|
"label",
|
|
17
20
|
{
|
|
18
|
-
htmlFor:
|
|
19
|
-
className:
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
htmlFor: l.name,
|
|
22
|
+
className: o(
|
|
23
|
+
r ? e.label : e.labelPlaceholder,
|
|
24
|
+
h ? e.labelDisabled : void 0
|
|
22
25
|
),
|
|
23
|
-
children:
|
|
26
|
+
children: r ? n : c ?? n
|
|
24
27
|
}
|
|
25
28
|
),
|
|
26
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ t(
|
|
27
30
|
"input",
|
|
28
31
|
{
|
|
29
|
-
value:
|
|
30
|
-
ref:
|
|
31
|
-
id:
|
|
32
|
+
value: a,
|
|
33
|
+
ref: b,
|
|
34
|
+
id: l.name,
|
|
32
35
|
type: "text",
|
|
33
|
-
onFocus: () =>
|
|
34
|
-
onBlur: () =>
|
|
35
|
-
className:
|
|
36
|
-
...
|
|
36
|
+
onFocus: () => d(!0),
|
|
37
|
+
onBlur: () => d(!1),
|
|
38
|
+
className: o(e.input, e[u], s && e.hasEndAdornment, m),
|
|
39
|
+
...l
|
|
37
40
|
}
|
|
38
|
-
)
|
|
41
|
+
),
|
|
42
|
+
s && /* @__PURE__ */ t("span", { className: e.endAdornment, children: s })
|
|
39
43
|
] });
|
|
40
44
|
}
|
|
41
45
|
);
|
|
42
|
-
|
|
46
|
+
I.displayName = "Input";
|
|
43
47
|
export {
|
|
44
|
-
|
|
48
|
+
I as Input
|
|
45
49
|
};
|
|
@@ -1,65 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
input: _,
|
|
10
|
-
inputSearch: d,
|
|
11
|
-
searchfield: g,
|
|
12
|
-
searchBox: b
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Icon as i } from "../../atoms/Icon/Icon.js";
|
|
3
|
+
import { Input as s } from "../../atoms/Input/Input.js";
|
|
4
|
+
import { c as p } from "../../clsx-OuTLNxxd.js";
|
|
5
|
+
import '../../assets/SearchBox.css';const c = "_inputContainer_ptqd0_1", u = "_input_ptqd0_1", m = "_button_ptqd0_10", n = {
|
|
6
|
+
inputContainer: c,
|
|
7
|
+
input: u,
|
|
8
|
+
button: m
|
|
13
9
|
};
|
|
14
|
-
function
|
|
15
|
-
onSearch:
|
|
16
|
-
inputName:
|
|
17
|
-
hideAt:
|
|
18
|
-
className:
|
|
19
|
-
...
|
|
10
|
+
function y({
|
|
11
|
+
onSearch: l,
|
|
12
|
+
inputName: o,
|
|
13
|
+
hideAt: f,
|
|
14
|
+
className: e,
|
|
15
|
+
...a
|
|
20
16
|
}) {
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
o(l), r.currentTarget.reset();
|
|
38
|
-
}, children: /* @__PURE__ */ m(
|
|
39
|
-
c,
|
|
40
|
-
{
|
|
41
|
-
className: t.input,
|
|
42
|
-
flexDirection: "row",
|
|
43
|
-
alignItems: "center",
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ e("button", { className: t.button, type: "submit", children: /* @__PURE__ */ e(f, { iconKey: "fa-regular fa-magnifying-glass", size: "md" }) }),
|
|
46
|
-
/* @__PURE__ */ e(
|
|
47
|
-
"input",
|
|
48
|
-
{
|
|
49
|
-
type: "text",
|
|
50
|
-
className: t.text,
|
|
51
|
-
placeholder: "Search by keyword(s) or Part #....",
|
|
52
|
-
name: n ?? "search"
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
) }) })
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
);
|
|
17
|
+
return /* @__PURE__ */ r("div", { className: n.inputContainer, children: [
|
|
18
|
+
/* @__PURE__ */ t(
|
|
19
|
+
s,
|
|
20
|
+
{
|
|
21
|
+
type: "text",
|
|
22
|
+
className: p(n.input, e),
|
|
23
|
+
autoComplete: "off",
|
|
24
|
+
label: "Search",
|
|
25
|
+
placeholder: "Search by keyword(s) or Part #....",
|
|
26
|
+
name: o ?? "search",
|
|
27
|
+
"aria-autocomplete": "list",
|
|
28
|
+
...a
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ t("button", { className: n.button, type: "submit", children: /* @__PURE__ */ t(i, { iconKey: "fa-regular fa-magnifying-glass", size: "sm" }) })
|
|
32
|
+
] });
|
|
62
33
|
}
|
|
63
34
|
export {
|
|
64
|
-
|
|
35
|
+
y as SearchBox
|
|
65
36
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type SuggestedCategory = {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
};
|
|
5
|
+
export type SuggestedItem = {
|
|
6
|
+
itemKey: number;
|
|
7
|
+
itemId: string;
|
|
8
|
+
description: string;
|
|
9
|
+
image: string;
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
export interface SuggestionDropdownProps {
|
|
13
|
+
terms: string[];
|
|
14
|
+
categories: SuggestedCategory[];
|
|
15
|
+
items: SuggestedItem[];
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function SuggestionDropdown({ terms: suggestions, categories, items: recommendedItems, className }: SuggestionDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsxs as o, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Text as t } from "../../atoms/Text/Text.js";
|
|
3
|
+
import { Link as n } from "../../atoms/Link/Link.js";
|
|
4
|
+
import { c as m } from "../../clsx-OuTLNxxd.js";
|
|
5
|
+
import { Image as g } from "../../atoms/Image/Image.js";
|
|
6
|
+
import '../../assets/SuggestionDropdown.css';const d = "_suggestionDropdown_1y1jy_1", h = "_leftColumn_1y1jy_31", u = "_rightColumn_1y1jy_55", _ = "_categorySection_1y1jy_75", y = "_suggestions_1y1jy_81", p = "_categories_1y1jy_83", f = "_itemList_1y1jy_97", j = "_item_1y1jy_97", N = "_itemInfo_1y1jy_155", e = {
|
|
7
|
+
suggestionDropdown: d,
|
|
8
|
+
leftColumn: h,
|
|
9
|
+
rightColumn: u,
|
|
10
|
+
categorySection: _,
|
|
11
|
+
suggestions: y,
|
|
12
|
+
categories: p,
|
|
13
|
+
itemList: f,
|
|
14
|
+
item: j,
|
|
15
|
+
itemInfo: N
|
|
16
|
+
};
|
|
17
|
+
function z({
|
|
18
|
+
terms: r,
|
|
19
|
+
categories: c,
|
|
20
|
+
items: l,
|
|
21
|
+
className: a
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ o("div", { className: m(e.suggestionDropdown, a), children: [
|
|
24
|
+
/* @__PURE__ */ o("div", { className: e.leftColumn, children: [
|
|
25
|
+
/* @__PURE__ */ s("div", { className: e.suggestionSection, children: /* @__PURE__ */ o("div", { className: e.suggestions, children: [
|
|
26
|
+
/* @__PURE__ */ s(t, { size: "xxs", colorToken: "quaternary", children: "Suggestions" }),
|
|
27
|
+
r.map(
|
|
28
|
+
(i) => /* @__PURE__ */ s(t, { size: "sm", children: i }, i)
|
|
29
|
+
)
|
|
30
|
+
] }) }),
|
|
31
|
+
/* @__PURE__ */ s("div", { className: e.categorySection, children: /* @__PURE__ */ o("div", { className: e.categories, children: [
|
|
32
|
+
/* @__PURE__ */ s(t, { size: "xxs", colorToken: "quaternary", children: "Categories" }),
|
|
33
|
+
c.map(
|
|
34
|
+
(i) => /* @__PURE__ */ s(t, { size: "sm", children: /* @__PURE__ */ s(n, { href: i.url, children: i.name }, i.url) }, i.name)
|
|
35
|
+
)
|
|
36
|
+
] }) })
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ s("div", { className: e.rightColumn, children: /* @__PURE__ */ s("ol", { className: e.itemList, children: l.map(
|
|
39
|
+
(i) => /* @__PURE__ */ s("li", { className: e.item, children: /* @__PURE__ */ o(n, { href: i.url, children: [
|
|
40
|
+
/* @__PURE__ */ s(g, { src: i.image, alt: `${i.description} product image`, height: 72, width: 72 }),
|
|
41
|
+
/* @__PURE__ */ o("div", { className: e.itemInfo, children: [
|
|
42
|
+
/* @__PURE__ */ s(t, { size: "sm", children: i.description }),
|
|
43
|
+
/* @__PURE__ */ s(t, { size: "sm", colorToken: "quaternary", children: i.itemId })
|
|
44
|
+
] })
|
|
45
|
+
] }) }, i.itemId)
|
|
46
|
+
) }) })
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
z as SuggestionDropdown
|
|
51
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { SuggestionDropdown } from './SuggestionDropdown';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof SuggestionDropdown;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SuggestionDropdown as e } from "./SuggestionDropdown.js";
|
|
2
|
+
const s = {
|
|
3
|
+
title: "Case Parts/Organisms/SuggestionDropdown",
|
|
4
|
+
component: e,
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: "centered"
|
|
7
|
+
},
|
|
8
|
+
tags: ["autodocs"]
|
|
9
|
+
}, r = {
|
|
10
|
+
args: {
|
|
11
|
+
terms: ["thermostat", "sensor", "cover", "wiring"],
|
|
12
|
+
categories: [
|
|
13
|
+
{ name: "Heating", url: "/categories/heating" },
|
|
14
|
+
{ name: "Accessories", url: "/categories/accessories" },
|
|
15
|
+
{ name: "Controls", url: "/categories/controls" }
|
|
16
|
+
],
|
|
17
|
+
items: [
|
|
18
|
+
{
|
|
19
|
+
itemKey: 1,
|
|
20
|
+
itemId: "P-1001",
|
|
21
|
+
description: "Smart Thermostat",
|
|
22
|
+
image: "https://placehold.co/120x80/png?text=Thermostat",
|
|
23
|
+
url: "/parts/p-1001"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
itemKey: 2,
|
|
27
|
+
itemId: "P-1002",
|
|
28
|
+
description: "Wire Harness",
|
|
29
|
+
image: "https://placehold.co/120x80/png?text=Harness",
|
|
30
|
+
url: "/parts/p-1002"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
itemKey: 3,
|
|
34
|
+
itemId: "P-1003",
|
|
35
|
+
description: "Replacement Cover",
|
|
36
|
+
image: "https://placehold.co/120x80/png?text=Cover",
|
|
37
|
+
url: "/parts/p-1003"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
r as Default,
|
|
44
|
+
s as default
|
|
45
|
+
};
|