@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.
- package/dist/assets/ToggleSwitch.css +1 -1
- package/dist/atoms/ToggleSwitch/ToggleSwitch.d.ts +2 -4
- package/dist/atoms/ToggleSwitch/ToggleSwitch.js +26 -29
- package/dist/atoms/ToggleSwitch/ToggleSwitch.stories.d.ts +4 -3
- package/dist/atoms/ToggleSwitch/ToggleSwitch.stories.js +28 -18
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
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
|
-
|
|
4
|
+
children?: React.ReactNode;
|
|
6
5
|
labelAlignment?: "left" | "right";
|
|
7
|
-
labelSize?: TextSize;
|
|
8
6
|
}
|
|
9
|
-
export declare function ToggleSwitch({
|
|
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
|
|
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
|
|
4
|
-
import
|
|
5
|
-
|
|
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
|
-
|
|
9
|
-
switch: "_switch_1p695_17",
|
|
7
|
+
switch: "_switch_x65sf_13",
|
|
10
8
|
input: x,
|
|
11
|
-
track:
|
|
12
|
-
thumb:
|
|
9
|
+
track: w,
|
|
10
|
+
thumb: b
|
|
13
11
|
};
|
|
14
|
-
function
|
|
15
|
-
|
|
12
|
+
function y({
|
|
13
|
+
children: p,
|
|
16
14
|
labelAlignment: c = "left",
|
|
17
|
-
hideAt:
|
|
18
|
-
className:
|
|
15
|
+
hideAt: o,
|
|
16
|
+
className: l,
|
|
19
17
|
id: _,
|
|
20
|
-
name:
|
|
21
|
-
disabled:
|
|
22
|
-
labelSize: m = "sm",
|
|
18
|
+
name: r,
|
|
19
|
+
disabled: e,
|
|
23
20
|
...h
|
|
24
21
|
}) {
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
22
|
+
const a = _ ?? r, i = p ?? null;
|
|
23
|
+
return /* @__PURE__ */ n(
|
|
27
24
|
"label",
|
|
28
25
|
{
|
|
29
|
-
htmlFor:
|
|
26
|
+
htmlFor: a,
|
|
30
27
|
className: d(
|
|
31
28
|
t.wrapper,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
e && t.disabled,
|
|
30
|
+
m(o),
|
|
31
|
+
l
|
|
35
32
|
),
|
|
36
33
|
children: [
|
|
37
|
-
c === "left" &&
|
|
38
|
-
/* @__PURE__ */
|
|
34
|
+
c === "left" && i,
|
|
35
|
+
/* @__PURE__ */ n("span", { className: t.switch, children: [
|
|
39
36
|
/* @__PURE__ */ s(
|
|
40
37
|
"input",
|
|
41
38
|
{
|
|
42
|
-
id:
|
|
43
|
-
name:
|
|
39
|
+
id: a,
|
|
40
|
+
name: r,
|
|
44
41
|
type: "checkbox",
|
|
45
42
|
role: "switch",
|
|
46
|
-
disabled:
|
|
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" &&
|
|
50
|
+
c === "right" && i
|
|
54
51
|
]
|
|
55
52
|
}
|
|
56
53
|
);
|
|
57
54
|
}
|
|
58
55
|
export {
|
|
59
|
-
|
|
56
|
+
y as ToggleSwitch
|
|
60
57
|
};
|
|
@@ -7,7 +7,7 @@ declare const meta: {
|
|
|
7
7
|
layout: string;
|
|
8
8
|
};
|
|
9
9
|
argTypes: {
|
|
10
|
-
|
|
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
|
|
21
|
-
export declare const
|
|
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 {
|
|
2
|
-
|
|
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:
|
|
5
|
+
component: r,
|
|
5
6
|
parameters: {
|
|
6
7
|
layout: "centered"
|
|
7
8
|
},
|
|
8
9
|
argTypes: {
|
|
9
|
-
|
|
10
|
+
children: {
|
|
10
11
|
control: "text"
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
tags: ["autodocs"]
|
|
14
|
-
},
|
|
15
|
+
}, l = {
|
|
15
16
|
args: {
|
|
16
17
|
"aria-label": "Save card"
|
|
17
18
|
}
|
|
18
|
-
},
|
|
19
|
+
}, o = {
|
|
19
20
|
args: {
|
|
20
21
|
"aria-label": "Save card",
|
|
21
22
|
defaultChecked: !0
|
|
22
23
|
}
|
|
23
|
-
},
|
|
24
|
+
}, n = {
|
|
24
25
|
args: {
|
|
25
|
-
|
|
26
|
+
children: "Save for future purchases",
|
|
26
27
|
defaultChecked: !0
|
|
27
28
|
}
|
|
28
|
-
},
|
|
29
|
+
}, u = {
|
|
29
30
|
args: {
|
|
30
|
-
|
|
31
|
+
children: "Save for future purchases",
|
|
31
32
|
labelAlignment: "right",
|
|
32
33
|
defaultChecked: !0
|
|
33
34
|
}
|
|
34
|
-
},
|
|
35
|
+
}, h = {
|
|
35
36
|
args: {
|
|
36
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
};
|