@caseparts-org/caseblocks 0.0.169 → 0.0.170

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
- ._wrapper_1p695_1{display:inline-flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs);cursor:pointer}._disabled_1p695_9{cursor:not-allowed}._switch_1p695_17{position:relative;display:inline-flex}._input_1p695_22{position:absolute;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}._track_1p695_31{width:2.5rem;height:1.5rem;padding:2px;border-radius:999px;border:1px solid var(--border-border-primary);background-color:var(--surface-surface-secondary);transition:background-color .12s ease,border-color .12s ease}._thumb_1p695_41{display:block;width:1.1rem;height:1.1rem;border-radius:999px;background-color:var(--surface-surface-primary);box-shadow:0 1px 2px #0003;transition:transform .12s ease}._input_1p695_22:checked+._track_1p695_31{background-color:var(--surface-surface-primary-btn);border-color:var(--surface-surface-primary-btn)}._input_1p695_22:checked+._track_1p695_31 ._thumb_1p695_41{transform:translate(1rem)}._input_1p695_22:focus-visible+._track_1p695_31{outline:2px solid var(--border-border-focus);outline-offset:2px}._input_1p695_22:disabled+._track_1p695_31{background-color:var(--surface-surface-disabled-btn-focus);border-color:var(--surface-surface-disabled-btn)}._input_1p695_22:disabled+._track_1p695_31 ._thumb_1p695_41{background-color:var(--surface-surface-disabled-btn)}
1
+ ._wrapper_x65sf_1{display:inline-flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs);cursor:pointer}._disabled_x65sf_9{cursor:not-allowed}._switch_x65sf_13{position:relative;display:inline-flex}._input_x65sf_18{position:absolute;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}._track_x65sf_27{width:2.5rem;height:1.5rem;padding:2px;border-radius:999px;border:1px solid var(--border-border-primary);background-color:var(--surface-surface-secondary);transition:background-color .12s ease,border-color .12s ease}._thumb_x65sf_37{display:block;width:1.1rem;height:1.1rem;border-radius:999px;background-color:var(--surface-surface-primary);box-shadow:0 1px 2px #0003;transition:transform .12s ease}._input_x65sf_18:checked+._track_x65sf_27{background-color:var(--surface-surface-primary-btn);border-color:var(--surface-surface-primary-btn)}._input_x65sf_18:checked+._track_x65sf_27 ._thumb_x65sf_37{transform:translate(1rem)}._input_x65sf_18:focus-visible+._track_x65sf_27{outline:2px solid var(--border-border-focus);outline-offset:2px}._input_x65sf_18:disabled+._track_x65sf_27{background-color:var(--surface-surface-disabled-btn-focus);border-color:var(--surface-surface-disabled-btn)}._input_x65sf_18:disabled+._track_x65sf_27 ._thumb_x65sf_37{background-color:var(--surface-surface-disabled-btn)}
@@ -1,9 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { HideAtProps } from '../HideAt';
3
- import { TextSize } from '../Text/Text';
4
3
  export interface ToggleSwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type">, HideAtProps {
5
- label?: string | React.ReactNode;
4
+ children?: React.ReactNode;
6
5
  labelAlignment?: "left" | "right";
7
- labelSize?: TextSize;
8
6
  }
9
- export declare function ToggleSwitch({ label, labelAlignment, hideAt, className, id, name, disabled, labelSize, ...otherProps }: ToggleSwitchProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function ToggleSwitch({ children, labelAlignment, hideAt, className, id, name, disabled, ...otherProps }: ToggleSwitchProps): import("react/jsx-runtime").JSX.Element;
@@ -1,60 +1,57 @@
1
- import { jsxs as i, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as s } from "react/jsx-runtime";
2
2
  import { c as d } from "../../clsx-OuTLNxxd.js";
3
- import { getHideAtStyles as u } from "../HideAt.js";
4
- import { Text as b } from "../Text/Text.js";
5
- import '../../assets/ToggleSwitch.css';const w = "_wrapper_1p695_1", f = "_disabled_1p695_9", N = "_label_1p695_13", x = "_input_1p695_22", k = "_track_1p695_31", g = "_thumb_1p695_41", t = {
6
- wrapper: w,
3
+ import { getHideAtStyles as m } from "../HideAt.js";
4
+ import '../../assets/ToggleSwitch.css';const u = "_wrapper_x65sf_1", f = "_disabled_x65sf_9", x = "_input_x65sf_18", w = "_track_x65sf_27", b = "_thumb_x65sf_37", t = {
5
+ wrapper: u,
7
6
  disabled: f,
8
- label: N,
9
- switch: "_switch_1p695_17",
7
+ switch: "_switch_x65sf_13",
10
8
  input: x,
11
- track: k,
12
- thumb: g
9
+ track: w,
10
+ thumb: b
13
11
  };
14
- function z({
15
- label: e,
12
+ function y({
13
+ children: p,
16
14
  labelAlignment: c = "left",
17
- hideAt: n,
18
- className: o,
15
+ hideAt: o,
16
+ className: l,
19
17
  id: _,
20
- name: a,
21
- disabled: r,
22
- labelSize: m = "sm",
18
+ name: r,
19
+ disabled: e,
23
20
  ...h
24
21
  }) {
25
- const l = _ ?? a, p = e ? /* @__PURE__ */ s(b, { size: m, className: t.label, children: e }) : null;
26
- return /* @__PURE__ */ i(
22
+ const a = _ ?? r, i = p ?? null;
23
+ return /* @__PURE__ */ n(
27
24
  "label",
28
25
  {
29
- htmlFor: l,
26
+ htmlFor: a,
30
27
  className: d(
31
28
  t.wrapper,
32
- r && t.disabled,
33
- u(n),
34
- o
29
+ e && t.disabled,
30
+ m(o),
31
+ l
35
32
  ),
36
33
  children: [
37
- c === "left" && p,
38
- /* @__PURE__ */ i("span", { className: t.switch, children: [
34
+ c === "left" && i,
35
+ /* @__PURE__ */ n("span", { className: t.switch, children: [
39
36
  /* @__PURE__ */ s(
40
37
  "input",
41
38
  {
42
- id: l,
43
- name: a,
39
+ id: a,
40
+ name: r,
44
41
  type: "checkbox",
45
42
  role: "switch",
46
- disabled: r,
43
+ disabled: e,
47
44
  className: t.input,
48
45
  ...h
49
46
  }
50
47
  ),
51
48
  /* @__PURE__ */ s("span", { className: t.track, "aria-hidden": "true", children: /* @__PURE__ */ s("span", { className: t.thumb }) })
52
49
  ] }),
53
- c === "right" && p
50
+ c === "right" && i
54
51
  ]
55
52
  }
56
53
  );
57
54
  }
58
55
  export {
59
- z as ToggleSwitch
56
+ y as ToggleSwitch
60
57
  };
@@ -7,7 +7,7 @@ declare const meta: {
7
7
  layout: string;
8
8
  };
9
9
  argTypes: {
10
- label: {
10
+ children: {
11
11
  control: "text";
12
12
  };
13
13
  };
@@ -17,6 +17,7 @@ export default meta;
17
17
  type Story = StoryObj<typeof meta>;
18
18
  export declare const Default: Story;
19
19
  export declare const Checked: Story;
20
- export declare const WithLabel: Story;
21
- export declare const WithRightLabel: Story;
20
+ export declare const WithChildren: Story;
21
+ export declare const WithRightChildren: Story;
22
22
  export declare const Disabled: Story;
23
+ export declare const RichContent: Story;
@@ -1,48 +1,58 @@
1
- import { ToggleSwitch as e } from "./ToggleSwitch.js";
2
- const t = {
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
+ import { ToggleSwitch as r } from "./ToggleSwitch.js";
3
+ const d = {
3
4
  title: "Case Parts/Atoms/ToggleSwitch",
4
- component: e,
5
+ component: r,
5
6
  parameters: {
6
7
  layout: "centered"
7
8
  },
8
9
  argTypes: {
9
- label: {
10
+ children: {
10
11
  control: "text"
11
12
  }
12
13
  },
13
14
  tags: ["autodocs"]
14
- }, r = {
15
+ }, l = {
15
16
  args: {
16
17
  "aria-label": "Save card"
17
18
  }
18
- }, l = {
19
+ }, o = {
19
20
  args: {
20
21
  "aria-label": "Save card",
21
22
  defaultChecked: !0
22
23
  }
23
- }, s = {
24
+ }, n = {
24
25
  args: {
25
- label: "Save for future purchases",
26
+ children: "Save for future purchases",
26
27
  defaultChecked: !0
27
28
  }
28
- }, c = {
29
+ }, u = {
29
30
  args: {
30
- label: "Save for future purchases",
31
+ children: "Save for future purchases",
31
32
  labelAlignment: "right",
32
33
  defaultChecked: !0
33
34
  }
34
- }, o = {
35
+ }, h = {
35
36
  args: {
36
- label: "Save for future purchases",
37
+ children: "Save for future purchases",
37
38
  disabled: !0,
38
39
  defaultChecked: !0
39
40
  }
41
+ }, i = {
42
+ args: {
43
+ defaultChecked: !0
44
+ },
45
+ render: (t) => /* @__PURE__ */ e(r, { ...t, children: /* @__PURE__ */ a("span", { children: [
46
+ "Save card for ",
47
+ /* @__PURE__ */ e("strong", { children: "future purchases" })
48
+ ] }) })
40
49
  };
41
50
  export {
42
- l as Checked,
43
- r as Default,
44
- o as Disabled,
45
- s as WithLabel,
46
- c as WithRightLabel,
47
- t as default
51
+ o as Checked,
52
+ l as Default,
53
+ h as Disabled,
54
+ i as RichContent,
55
+ n as WithChildren,
56
+ u as WithRightChildren,
57
+ d as default
48
58
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.169",
4
+ "version": "0.0.170",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",