@caseparts-org/caseblocks 0.0.262 → 0.0.264

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
- ._disclaimer_1bxdj_1{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--spacing-spacing-2xs);width:100%;border:1px solid;border-radius:var(--border-radius-sm);padding:var(--spacing-spacing-2xs) var(--spacing-spacing-1xs)}._content_1bxdj_12{display:flex;align-items:flex-start;gap:var(--spacing-spacing-2xs);flex:1;min-width:0}._layout-stacked_1bxdj_20 ._content_1bxdj_12{display:grid;grid-template-columns:auto minmax(0,1fr);row-gap:var(--spacing-spacing-3xs)}._layout-stacked_1bxdj_20 ._primary_1bxdj_26,._layout-stacked_1bxdj_20 ._subtext_1bxdj_27{grid-column:2}._layout-stacked_1bxdj_20 ._icon_1bxdj_31{grid-row:span 2;align-self:start}._primary_1bxdj_26{font-size:var(--font-size-sm);font-weight:var(--font-weight-semibold)}._subtext_1bxdj_27{font-size:var(--font-size-xs);white-space:pre-line}._cta_1bxdj_46{flex:none}._background-neutral_1bxdj_50{background-color:var(--color-neutrals-neutral-1)}._background-secondary_1bxdj_54{background-color:var(--color-brand-secondary-lt-teal-blue)}._background-caution-tips_1bxdj_58{background-color:var(--color-brand-secondary-lt-yellow)}._background-warning_1bxdj_62{background-color:var(--color-brand-secondary-lt-orange)}._background-success_1bxdj_66{background-color:var(--color-brand-secondary-lt-green)}._background-error-warning_1bxdj_70{background-color:var(--color-brand-secondary-lt-red)}._border-neutral_1bxdj_74{border-color:var(--color-neutrals-neutral-1)}._border-secondary_1bxdj_78{border-color:var(--color-brand-secondary-lt-teal-blue)}._border-caution-tips_1bxdj_82{border-color:var(--color-brand-secondary-lt-yellow)}._border-warning_1bxdj_86{border-color:var(--color-brand-secondary-lt-orange)}._border-success_1bxdj_90{border-color:var(--color-brand-secondary-lt-green)}._border-error-warning_1bxdj_94{border-color:var(--color-brand-secondary-lt-red)}
1
+ ._disclaimer_1kiis_1{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--spacing-spacing-2xs);width:100%;border:1px solid;border-radius:var(--border-radius-sm);padding:var(--spacing-spacing-2xs) var(--spacing-spacing-1xs)}._content_1kiis_12{display:flex;align-items:center;gap:var(--spacing-spacing-2xs);flex:1;min-width:0}._layout-stacked_1kiis_20 ._content_1kiis_12{display:grid;grid-template-columns:auto minmax(0,1fr);row-gap:var(--spacing-spacing-3xs)}._layout-stacked_1kiis_20 ._primary_1kiis_26,._layout-stacked_1kiis_20 ._subtext_1kiis_27{grid-column:2}._layout-stacked_1kiis_20 ._content_1kiis_12:has(._primary_1kiis_26):has(._subtext_1kiis_27) ._icon_1kiis_31{grid-row:span 2}._primary_1kiis_26{font-size:var(--font-size-sm);font-weight:var(--font-weight-semibold)}._subtext_1kiis_27{font-size:var(--font-size-xs);white-space:pre-line}._cta_1kiis_45{flex:none}._background-neutral_1kiis_49{background-color:var(--color-neutrals-neutral-1)}._background-secondary_1kiis_53{background-color:var(--color-brand-secondary-lt-teal-blue)}._background-caution-tips_1kiis_57{background-color:var(--color-brand-secondary-lt-yellow)}._background-warning_1kiis_61{background-color:var(--color-brand-secondary-lt-orange)}._background-success_1kiis_65{background-color:var(--color-brand-secondary-lt-green)}._background-error-warning_1kiis_69{background-color:var(--color-brand-secondary-lt-red)}._border-neutral_1kiis_73{border-color:var(--color-neutrals-neutral-1)}._border-secondary_1kiis_77{border-color:var(--color-brand-secondary-lt-teal-blue)}._border-caution-tips_1kiis_81{border-color:var(--color-brand-secondary-lt-yellow)}._border-warning_1kiis_85{border-color:var(--color-brand-secondary-lt-orange)}._border-success_1kiis_89{border-color:var(--color-brand-secondary-lt-green)}._border-error-warning_1kiis_93{border-color:var(--color-brand-secondary-lt-red)}
@@ -4,10 +4,15 @@ export interface SelectOption {
4
4
  value: string;
5
5
  label: string;
6
6
  }
7
+ export interface SelectOptionGroup {
8
+ label: string;
9
+ options: SelectOption[];
10
+ }
7
11
  export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "children">, HideAtProps {
8
12
  label: string | null;
9
13
  placeholder?: string;
10
- options: SelectOption[];
14
+ options?: SelectOption[];
15
+ groups?: SelectOptionGroup[];
11
16
  error?: string | null;
12
17
  }
13
18
  export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
@@ -1,79 +1,81 @@
1
- import { jsxs as u, jsx as a } from "react/jsx-runtime";
2
- import w, { useState as E } from "react";
1
+ import { jsxs as D, jsx as a } from "react/jsx-runtime";
2
+ import F, { useState as V } from "react";
3
3
  import { c as f } from "../../clsx-OuTLNxxd.js";
4
- import { getHideAtStyles as M } from "../HideAt.js";
5
- import { Icon as F } from "../Icon/Icon.js";
6
- import '../../assets/Select.css';const V = "_select_kfi8n_1", j = "_icon_kfi8n_29", I = "_selectError_kfi8n_59", L = "_label_kfi8n_63", P = "_labelPlaceholder_kfi8n_78", R = "_labelDisabled_kfi8n_99", z = "_errorMessage_kfi8n_103", e = {
4
+ import { getHideAtStyles as j } from "../HideAt.js";
5
+ import { Icon as p } from "../Icon/Icon.js";
6
+ import '../../assets/Select.css';const I = "_select_kfi8n_1", L = "_icon_kfi8n_29", P = "_selectError_kfi8n_59", R = "_label_kfi8n_63", z = "_labelPlaceholder_kfi8n_78", A = "_labelDisabled_kfi8n_99", B = "_errorMessage_kfi8n_103", l = {
7
7
  "select-container": "_select-container_kfi8n_1",
8
- select: V,
9
- icon: j,
10
- selectError: I,
11
- label: L,
12
- labelPlaceholder: P,
13
- labelDisabled: R,
14
- errorMessage: z
15
- }, A = w.forwardRef(
8
+ select: I,
9
+ icon: L,
10
+ selectError: P,
11
+ label: R,
12
+ labelPlaceholder: z,
13
+ labelDisabled: A,
14
+ errorMessage: B
15
+ }, C = F.forwardRef(
16
16
  ({
17
17
  label: s,
18
- placeholder: o,
19
- options: k,
20
- value: m,
21
- defaultValue: i,
22
- hideAt: g,
23
- className: D,
24
- error: t,
18
+ placeholder: c,
19
+ options: N = [],
20
+ groups: i,
21
+ value: v,
22
+ defaultValue: t,
23
+ hideAt: S,
24
+ className: x,
25
+ error: d,
25
26
  onFocus: r,
26
- onBlur: d,
27
- ...c
28
- }, N) => {
29
- const [S, b] = E(!1), x = !!c.disabled, n = m !== void 0, v = n ? String(m ?? "") : void 0, h = !n && i !== void 0 && i !== null ? String(i) : "", _ = !!s && (S || (n ? v !== "" : h !== "")), y = !!o && !_, p = s ? "" : o ?? "";
30
- return /* @__PURE__ */ u("div", { className: f(e["select-container"], M(g)), children: [
31
- (s || y) && /* @__PURE__ */ a(
27
+ onBlur: _,
28
+ ...o
29
+ }, y) => {
30
+ const [w, h] = V(!1), E = !!o.disabled, n = v !== void 0, k = n ? String(v ?? "") : void 0, u = !n && t !== void 0 && t !== null ? String(t) : "", b = !!s && (w || (n ? k !== "" : u !== "")), M = !!c && !b, g = s ? "" : c ?? "";
31
+ return /* @__PURE__ */ D("div", { className: f(l["select-container"], j(S)), children: [
32
+ (s || M) && /* @__PURE__ */ a(
32
33
  "label",
33
34
  {
34
- htmlFor: c.name,
35
+ htmlFor: o.name,
35
36
  className: f(
36
- _ ? e.label : e.labelPlaceholder,
37
- x ? e.labelDisabled : void 0
37
+ b ? l.label : l.labelPlaceholder,
38
+ E ? l.labelDisabled : void 0
38
39
  ),
39
- children: _ ? s : o ?? s
40
+ children: b ? s : c ?? s
40
41
  }
41
42
  ),
42
- /* @__PURE__ */ u(
43
+ /* @__PURE__ */ D(
43
44
  "select",
44
45
  {
45
- ...c,
46
- ref: N,
47
- id: c.name,
48
- value: v,
49
- defaultValue: n ? void 0 : h,
50
- className: f(e.select, t ? e.selectError : void 0, D),
51
- onFocus: (l) => {
52
- b(!0), r == null || r(l);
46
+ ...o,
47
+ ref: y,
48
+ id: o.name,
49
+ value: k,
50
+ defaultValue: n ? void 0 : u,
51
+ className: f(l.select, d ? l.selectError : void 0, x),
52
+ onFocus: (e) => {
53
+ h(!0), r == null || r(e);
53
54
  },
54
- onBlur: (l) => {
55
- b(!1), d == null || d(l);
55
+ onBlur: (e) => {
56
+ h(!1), _ == null || _(e);
56
57
  },
57
58
  children: [
58
- o ? /* @__PURE__ */ a("option", { value: "", disabled: !0, hidden: !!s, children: p }) : null,
59
- k.map((l) => /* @__PURE__ */ a("option", { value: l.value, children: l.label }, l.value))
59
+ c ? /* @__PURE__ */ a("option", { value: "", disabled: !0, hidden: !!s, children: g }) : null,
60
+ N.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value)),
61
+ i == null ? void 0 : i.map((e) => /* @__PURE__ */ a("optgroup", { label: e.label, children: e.options.map((m) => /* @__PURE__ */ a("option", { value: m.value, children: m.label }, m.value)) }, e.label))
60
62
  ]
61
63
  }
62
64
  ),
63
65
  /* @__PURE__ */ a(
64
- F,
66
+ p,
65
67
  {
66
- className: e.icon,
68
+ className: l.icon,
67
69
  iconKey: "fa-solid fa-chevron-down",
68
70
  size: "3xs",
69
71
  colorToken: "secondary"
70
72
  }
71
73
  ),
72
- t ? /* @__PURE__ */ a("div", { className: e.errorMessage, children: t }) : null
74
+ d ? /* @__PURE__ */ a("div", { className: l.errorMessage, children: d }) : null
73
75
  ] });
74
76
  }
75
77
  );
76
- A.displayName = "Select";
78
+ C.displayName = "Select";
77
79
  export {
78
- A as Select
80
+ C as Select
79
81
  };
@@ -5,4 +5,5 @@ export default meta;
5
5
  type Story = StoryObj<typeof Select>;
6
6
  export declare const Default: Story;
7
7
  export declare const WithSelectedValue: Story;
8
+ export declare const WithOptionGroups: Story;
8
9
  export declare const ErrorState: Story;
@@ -1,10 +1,22 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { useState as c } from "react";
2
+ import { useState as s } from "react";
3
3
  import { Select as n } from "./Select.js";
4
- const i = [
4
+ const o = [
5
5
  { value: "US", label: "United States" },
6
6
  { value: "CA", label: "Canada" },
7
7
  { value: "MX", label: "Mexico" }
8
+ ], c = [
9
+ {
10
+ label: "North America",
11
+ options: o
12
+ },
13
+ {
14
+ label: "Europe",
15
+ options: [
16
+ { value: "DE", label: "Germany" },
17
+ { value: "GB", label: "United Kingdom" }
18
+ ]
19
+ }
8
20
  ], S = {
9
21
  title: "Case Parts/Atoms/Select",
10
22
  component: n,
@@ -12,34 +24,40 @@ const i = [
12
24
  name: "country",
13
25
  label: "Country",
14
26
  placeholder: "Select country",
15
- options: i
27
+ options: o
16
28
  },
17
29
  parameters: {
18
30
  layout: "centered"
19
31
  }
20
32
  };
21
33
  function a(e) {
22
- const [o, u] = c(String(e.value ?? ""));
34
+ const [u, i] = s(String(e.value ?? ""));
23
35
  return /* @__PURE__ */ t("div", { style: { width: 320 }, children: /* @__PURE__ */ t(
24
36
  n,
25
37
  {
26
38
  ...e,
27
- value: o,
39
+ value: u,
28
40
  onChange: (r) => {
29
41
  var l;
30
- u(r.target.value), (l = e.onChange) == null || l.call(e, r);
42
+ i(r.target.value), (l = e.onChange) == null || l.call(e, r);
31
43
  }
32
44
  }
33
45
  ) });
34
46
  }
35
- const v = {
47
+ const g = {
36
48
  render: (e) => /* @__PURE__ */ t(a, { ...e })
37
- }, g = {
49
+ }, b = {
38
50
  args: {
39
51
  value: "US"
40
52
  },
41
53
  render: (e) => /* @__PURE__ */ t(a, { ...e })
42
- }, C = {
54
+ }, h = {
55
+ args: {
56
+ options: void 0,
57
+ groups: c
58
+ },
59
+ render: (e) => /* @__PURE__ */ t(a, { ...e })
60
+ }, y = {
43
61
  args: {
44
62
  value: "",
45
63
  error: "Country is required"
@@ -47,8 +65,9 @@ const v = {
47
65
  render: (e) => /* @__PURE__ */ t(a, { ...e })
48
66
  };
49
67
  export {
50
- v as Default,
51
- C as ErrorState,
52
- g as WithSelectedValue,
68
+ g as Default,
69
+ y as ErrorState,
70
+ h as WithOptionGroups,
71
+ b as WithSelectedValue,
53
72
  S as default
54
73
  };
@@ -10,7 +10,7 @@ export type { InputProps } from './atoms/Input/Input';
10
10
  export { InputEndAdornmentButton } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
11
11
  export type { InputEndAdornmentButtonProps } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
12
12
  export { Select } from './atoms/Select/Select';
13
- export type { SelectProps, SelectOption } from './atoms/Select/Select';
13
+ export type { SelectProps, SelectOption, SelectOptionGroup } from './atoms/Select/Select';
14
14
  export { Tooltip } from './atoms/Tooltip/Tooltip';
15
15
  export { Popover } from './atoms/Popover/Popover';
16
16
  export type { PopoverProps } from './atoms/Popover/Popover';
package/dist/main.d.ts CHANGED
@@ -16,7 +16,7 @@ export type { InputProps } from './atoms/Input/Input';
16
16
  export { InputEndAdornmentButton } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
17
17
  export type { InputEndAdornmentButtonProps } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
18
18
  export { Select } from './atoms/Select/Select';
19
- export type { SelectProps } from './atoms/Select/Select';
19
+ export type { SelectProps, SelectOption, SelectOptionGroup } from './atoms/Select/Select';
20
20
  export { Account } from './molecules/Account/Account';
21
21
  export type { AccountProps } from './molecules/Account/Account';
22
22
  export { Avatar } from './molecules/Avatar/Avatar';
@@ -1,82 +1,82 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { c as t } from "../../clsx-OuTLNxxd.js";
3
- import { Icon as b } from "../../atoms/Icon/Icon.js";
4
- import { getHideAtStyles as i } from "../../atoms/HideAt.js";
5
- import '../../assets/Disclaimer.css';const u = "_disclaimer_1bxdj_1", l = "_content_1bxdj_12", m = "_primary_1bxdj_26", x = "_subtext_1bxdj_27", g = "_icon_1bxdj_31", f = "_cta_1bxdj_46", c = {
6
- disclaimer: u,
7
- content: l,
8
- "layout-stacked": "_layout-stacked_1bxdj_20",
9
- primary: m,
10
- subtext: x,
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { c } from "../../clsx-OuTLNxxd.js";
3
+ import { Icon as d } from "../../atoms/Icon/Icon.js";
4
+ import { getHideAtStyles as e } from "../../atoms/HideAt.js";
5
+ import '../../assets/Disclaimer.css';const l = "_disclaimer_1kiis_1", k = "_content_1kiis_12", b = "_primary_1kiis_26", m = "_subtext_1kiis_27", g = "_icon_1kiis_31", f = "_cta_1kiis_45", o = {
6
+ disclaimer: l,
7
+ content: k,
8
+ "layout-stacked": "_layout-stacked_1kiis_20",
9
+ primary: b,
10
+ subtext: m,
11
11
  icon: g,
12
12
  cta: f,
13
- "background-neutral": "_background-neutral_1bxdj_50",
14
- "background-secondary": "_background-secondary_1bxdj_54",
15
- "background-caution-tips": "_background-caution-tips_1bxdj_58",
16
- "background-warning": "_background-warning_1bxdj_62",
17
- "background-success": "_background-success_1bxdj_66",
18
- "background-error-warning": "_background-error-warning_1bxdj_70",
19
- "border-neutral": "_border-neutral_1bxdj_74",
20
- "border-secondary": "_border-secondary_1bxdj_78",
21
- "border-caution-tips": "_border-caution-tips_1bxdj_82",
22
- "border-warning": "_border-warning_1bxdj_86",
23
- "border-success": "_border-success_1bxdj_90",
24
- "border-error-warning": "_border-error-warning_1bxdj_94"
25
- }, j = {
13
+ "background-neutral": "_background-neutral_1kiis_49",
14
+ "background-secondary": "_background-secondary_1kiis_53",
15
+ "background-caution-tips": "_background-caution-tips_1kiis_57",
16
+ "background-warning": "_background-warning_1kiis_61",
17
+ "background-success": "_background-success_1kiis_65",
18
+ "background-error-warning": "_background-error-warning_1kiis_69",
19
+ "border-neutral": "_border-neutral_1kiis_73",
20
+ "border-secondary": "_border-secondary_1kiis_77",
21
+ "border-caution-tips": "_border-caution-tips_1kiis_81",
22
+ "border-warning": "_border-warning_1kiis_85",
23
+ "border-success": "_border-success_1kiis_89",
24
+ "border-error-warning": "_border-error-warning_1kiis_93"
25
+ }, y = {
26
26
  info: "fa-solid fa-circle-info",
27
27
  question: "fa-solid fa-circle-question",
28
28
  warning: "fa-solid fa-triangle-exclamation",
29
29
  security: "fa-solid fa-shield",
30
30
  lock: "fa-solid fa-lock"
31
31
  };
32
- function k({
33
- backgroundColorToken: r = "neutral",
34
- borderColorToken: n = "neutral",
35
- layout: o = "stacked",
36
- hideAt: a,
37
- className: s,
38
- children: d,
39
- ..._
32
+ function p({
33
+ backgroundColorToken: i = "neutral",
34
+ borderColorToken: r = "neutral",
35
+ layout: n = "stacked",
36
+ hideAt: s,
37
+ className: t,
38
+ children: _,
39
+ ...u
40
40
  }) {
41
- return /* @__PURE__ */ e(
41
+ return /* @__PURE__ */ a(
42
42
  "aside",
43
43
  {
44
- ..._,
45
- className: t(
46
- c.disclaimer,
47
- c[`background-${r}`],
48
- c[`border-${n}`],
49
- c[`layout-${o}`],
50
- i(a),
51
- s
44
+ ...u,
45
+ className: c(
46
+ o.disclaimer,
47
+ o[`background-${i}`],
48
+ o[`border-${r}`],
49
+ o[`layout-${n}`],
50
+ e(s),
51
+ t
52
52
  ),
53
53
  role: "note",
54
- children: d
54
+ children: _
55
55
  }
56
56
  );
57
57
  }
58
- function y({ hideAt: r, className: n, children: o, ...a }) {
59
- return /* @__PURE__ */ e("div", { ...a, className: t(c.content, i(r), n), children: o });
58
+ function x({ hideAt: i, className: r, children: n, ...s }) {
59
+ return /* @__PURE__ */ a("div", { ...s, className: c(o.content, e(i), r), children: n });
60
60
  }
61
- function p({ icon: r = "info", iconKey: n, className: o, ...a }) {
62
- return /* @__PURE__ */ e(b, { ...a, iconKey: n ?? j[r], className: t(c.icon, o) });
61
+ function w({ icon: i = "info", iconKey: r, className: n, ...s }) {
62
+ return /* @__PURE__ */ a(d, { ...s, iconKey: r ?? y[i], className: c(o.icon, n) });
63
63
  }
64
- function w({ hideAt: r, className: n, children: o, ...a }) {
65
- return /* @__PURE__ */ e("span", { ...a, className: t(c.primary, i(r), n), children: o });
64
+ function D({ hideAt: i, className: r, children: n, ...s }) {
65
+ return /* @__PURE__ */ a("span", { ...s, className: c(o.primary, e(i), r), children: n });
66
66
  }
67
- function D({ hideAt: r, className: n, children: o, ...a }) {
68
- return /* @__PURE__ */ e("span", { ...a, className: t(c.subtext, i(r), n), children: o });
67
+ function N({ hideAt: i, className: r, children: n, ...s }) {
68
+ return /* @__PURE__ */ a("span", { ...s, className: c(o.subtext, e(i), r), children: n });
69
69
  }
70
- function N({ hideAt: r, className: n, children: o, ...a }) {
71
- return /* @__PURE__ */ e("div", { ...a, className: t(c.cta, i(r), n), children: o });
70
+ function C({ hideAt: i, className: r, children: n, ...s }) {
71
+ return /* @__PURE__ */ a("div", { ...s, className: c(o.cta, e(i), r), children: n });
72
72
  }
73
- const $ = Object.assign(k, {
74
- Content: y,
75
- Icon: p,
76
- Primary: w,
77
- Subtext: D,
78
- CTA: N
73
+ const j = Object.assign(p, {
74
+ Content: x,
75
+ Icon: w,
76
+ Primary: D,
77
+ Subtext: N,
78
+ CTA: C
79
79
  });
80
80
  export {
81
- $ as Disclaimer
81
+ j as Disclaimer
82
82
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.262",
4
+ "version": "0.0.264",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",