@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.
@@ -1 +1 @@
1
- ._input-container_1p05n_1{display:flex;position:relative;flex-direction:column;align-items:flex-start;width:100%;box-sizing:border-box}._input_1p05n_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_1p05n_1{font-size:var(--font-size-md)}}._input_1p05n_1:focus{border:1px solid var(--border-border-primary-btn, #1380b1);box-shadow:0 0 2px 1px var(--border-border-primary-btn)}._input_1p05n_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_1p05n_1:disabled:hover,._input_1p05n_1:disabled:focus{border:1px solid var(--border-border-primary, #dfdfdf);box-shadow:none}._label_1p05n_42{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_1p05n_56{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_1p05n_76{color:var(--text-text-disabled, #b2b2b2)}._input_1p05n_1:hover:not(:disabled){border:1px solid var(--border-border-primary-btn, #1380b1);transition:all .2s ease}
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
- ._button_11jol_1{box-sizing:border-box;cursor:pointer;width:var(--spacing-2-5);height:var(--spacing-2-5);padding:var(--spacing-0-5);border-width:0;border-radius:0px var(--spacing-0-125) var(--spacing-0-125) 0px;display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:inherit;color:var(--icons-icon-search)}._text_11jol_16{flex:1;position:relative;border:none;border-radius:40px;outline:none;font-family:var(--font-family-body);font-size:var(--font-size-sm);line-height:var(--line-height-sm);background:var(--surface-surface-searchBar, #f6f6f6);padding:0px var(--spacing-0-5) 0px var(--spacing-0-5)}._text_11jol_16::placeholder{font-style:italic;font-weight:var(--font-weight-light);color:var(--text-text-search-bar)}._input_11jol_33{flex:1;padding:0px 0px 0px var(--spacing-0-5);box-sizing:border-box}._inputSearch_11jol_38{flex:1;border-radius:var(--spacing-0-125)}._searchfield_11jol_42{flex:1;height:var(--spacing-2-5);border-radius:var(--spacing-2-5);overflow:hidden;background-color:var(--surface-surface-search-bar)}._searchBox_11jol_49{flex:1;width:100%;min-width:250px;height:var(--spacing-2-5);position:relative;border-radius:var(--spacing-2-5);overflow:hidden;text-align:left;background-color:var(--surface-surface-search-bar)}
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 m, jsx as d } from "react/jsx-runtime";
2
- import f, { useState as F } from "react";
3
- import { c as t } from "../../clsx-OuTLNxxd.js";
4
- import { getHideAtStyles as h } from "../HideAt.js";
5
- import '../../assets/Input.css';const x = "_input_1p05n_1", B = "_label_1p05n_42", D = "_labelPlaceholder_1p05n_56", y = "_labelDisabled_1p05n_76", l = {
6
- "input-container": "_input-container_1p05n_1",
7
- input: x,
8
- label: B,
9
- labelPlaceholder: D,
10
- labelDisabled: y
11
- }, N = f.forwardRef(
12
- ({ label: e, placeholder: s, value: n, hideAt: r, className: p, ...a }, _) => {
13
- const [o, i] = F(!1), b = !!a.disabled, c = !!e && (o || !!n), u = !!s && !e && !o && !n;
14
- return /* @__PURE__ */ m("div", { className: t(l["input-container"], h(r)), children: [
15
- (e || u) && /* @__PURE__ */ d(
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: a.name,
19
- className: t(
20
- c ? l.label : l.labelPlaceholder,
21
- b ? l.labelDisabled : void 0
21
+ htmlFor: l.name,
22
+ className: o(
23
+ r ? e.label : e.labelPlaceholder,
24
+ h ? e.labelDisabled : void 0
22
25
  ),
23
- children: c ? e : s ?? e
26
+ children: r ? n : c ?? n
24
27
  }
25
28
  ),
26
- /* @__PURE__ */ d(
29
+ /* @__PURE__ */ t(
27
30
  "input",
28
31
  {
29
- value: n,
30
- ref: _,
31
- id: a.name,
32
+ value: a,
33
+ ref: b,
34
+ id: l.name,
32
35
  type: "text",
33
- onFocus: () => i(!0),
34
- onBlur: () => i(!1),
35
- className: t(l.input, p),
36
- ...a
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
- N.displayName = "Input";
46
+ I.displayName = "Input";
43
47
  export {
44
- N as Input
48
+ I as Input
45
49
  };
@@ -1,65 +1,36 @@
1
- import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
- import { c as h } from "../../clsx-OuTLNxxd.js";
3
- import { Flex as c } from "../../atoms/Flex/Flex.js";
4
- import { getHideAtStyles as u } from "../../atoms/HideAt.js";
5
- import { Icon as f } from "../../atoms/Icon/Icon.js";
6
- import '../../assets/SearchBox.css';const p = "_button_11jol_1", x = "_text_11jol_16", _ = "_input_11jol_33", d = "_inputSearch_11jol_38", g = "_searchfield_11jol_42", b = "_searchBox_11jol_49", t = {
7
- button: p,
8
- text: x,
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 N({
15
- onSearch: o,
16
- inputName: n,
17
- hideAt: s,
18
- className: a,
19
- ...i
10
+ function y({
11
+ onSearch: l,
12
+ inputName: o,
13
+ hideAt: f,
14
+ className: e,
15
+ ...a
20
16
  }) {
21
- return /* @__PURE__ */ e(
22
- c,
23
- {
24
- flexDirection: "row",
25
- alignItems: "center",
26
- className: h(t.searchBox, u(s), a),
27
- ...i,
28
- children: /* @__PURE__ */ e(
29
- c,
30
- {
31
- flexDirection: "row",
32
- alignItems: "center",
33
- className: t.searchfield,
34
- children: /* @__PURE__ */ e("div", { className: t.inputSearch, children: /* @__PURE__ */ e("form", { onSubmit: (r) => {
35
- r.preventDefault();
36
- const l = (new FormData(r.currentTarget).get(n ?? "search") || "").trim();
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
- N as SearchBox
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
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.225",
4
+ "version": "0.0.226",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",