lucentia-ui 0.1.1
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/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.js +6 -0
- package/dist/components/Button/Button.module.css +64 -0
- package/dist/components/Button/Button.stories.d.ts +9 -0
- package/dist/components/Button/Button.stories.js +41 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Button/types.d.ts +4 -0
- package/dist/components/Button/types.js +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.js +5 -0
- package/dist/components/Checkbox/Checkbox.module.css +56 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +7 -0
- package/dist/components/Checkbox/Checkbox.stories.js +13 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.js +1 -0
- package/dist/components/Checkbox/types.d.ts +3 -0
- package/dist/components/Checkbox/types.js +1 -0
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.js +6 -0
- package/dist/components/Input/Input.module.css +33 -0
- package/dist/components/Input/Input.stories.d.ts +7 -0
- package/dist/components/Input/Input.stories.js +17 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Input/types.d.ts +4 -0
- package/dist/components/Input/types.js +1 -0
- package/dist/components/Modal/Modal.d.ts +3 -0
- package/dist/components/Modal/Modal.js +7 -0
- package/dist/components/Modal/Modal.module.css +20 -0
- package/dist/components/Modal/Modal.stories.d.ts +6 -0
- package/dist/components/Modal/Modal.stories.js +15 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/Modal/types.d.ts +6 -0
- package/dist/components/Modal/types.js +1 -0
- package/dist/components/Radio/Radio.d.ts +2 -0
- package/dist/components/Radio/Radio.js +6 -0
- package/dist/components/Radio/Radio.module.css +53 -0
- package/dist/components/Radio/Radio.stories.d.ts +7 -0
- package/dist/components/Radio/Radio.stories.js +17 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/index.js +1 -0
- package/dist/components/Radio/types.d.ts +3 -0
- package/dist/components/Radio/types.js +1 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.js +6 -0
- package/dist/components/Select/Select.module.css +45 -0
- package/dist/components/Select/Select.stories.d.ts +7 -0
- package/dist/components/Select/Select.stories.js +22 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Select/types.d.ts +4 -0
- package/dist/components/Select/types.js +1 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.js +5 -0
- package/dist/components/Switch/Switch.module.css +58 -0
- package/dist/components/Switch/Switch.stories.d.ts +7 -0
- package/dist/components/Switch/Switch.stories.js +17 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Switch/types.d.ts +11 -0
- package/dist/components/Switch/types.js +1 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +13 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +11 -0
- package/dist/components/ThemeProvider/index.d.ts +2 -0
- package/dist/components/ThemeProvider/index.js +1 -0
- package/dist/components/ThemeProvider/types.d.ts +1 -0
- package/dist/components/ThemeProvider/types.js +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +15 -0
- package/dist/styles/base.css +0 -0
- package/dist/styles/font.css +23 -0
- package/dist/styles/globals.css +0 -0
- package/dist/styles/reset.css +99 -0
- package/dist/styles/tokens/index.css +2 -0
- package/dist/styles/tokens/theme-dark.css +64 -0
- package/dist/styles/tokens/theme-light.css +67 -0
- package/dist/styles/tokens.css +114 -0
- package/package.json +33 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from "./Button.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
export const Button = ({ variant = "default", size = "md", className, ...props }) => {
|
|
5
|
+
return (_jsx("button", { className: clsx(styles.button, styles[variant], styles[size], className), ...props }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
font-family: var(--font);
|
|
3
|
+
font-weight: 500;
|
|
4
|
+
border: none;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
|
|
7
|
+
border-radius: var(--radius-max);
|
|
8
|
+
|
|
9
|
+
box-shadow: var(--shadow-sm);
|
|
10
|
+
transition: box-shadow 0.2s ease, opacity 0.2s ease, background 0.25s ease-in-out,
|
|
11
|
+
color 0.25s ease;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* ===== Variant ===== */
|
|
15
|
+
.default {
|
|
16
|
+
background: var(--color-surface-container);
|
|
17
|
+
color: var(--color-on-surface);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.primary {
|
|
21
|
+
background: var(--color-primary-container);
|
|
22
|
+
color: var(--color-on-primary-container);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
.secondary {
|
|
27
|
+
background: var(--color-secondary-container);
|
|
28
|
+
color: var(--color-on-secondary-container);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
.error {
|
|
33
|
+
background: var(--color-error-container);
|
|
34
|
+
color: var(--color-on-error-container);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/* ===== Size ===== */
|
|
39
|
+
|
|
40
|
+
.sm {
|
|
41
|
+
padding: var(--space-xs) var(--space-lg);
|
|
42
|
+
font-size: 0.875rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.md {
|
|
46
|
+
padding: var(--space-sm) var(--space-2xl);
|
|
47
|
+
font-size: 1rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ===== State ===== */
|
|
51
|
+
|
|
52
|
+
.button:active:not(:disabled),
|
|
53
|
+
.button[data-state="pressed"] {
|
|
54
|
+
box-shadow: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.button:focus-visible {
|
|
58
|
+
outline: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.button:disabled {
|
|
62
|
+
opacity: 0.25;
|
|
63
|
+
cursor: not-allowed;
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Button } from "./Button";
|
|
3
|
+
declare const meta: Meta<typeof Button>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Button>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const State: Story;
|
|
8
|
+
export declare const Variants: Story;
|
|
9
|
+
export declare const Sizes: Story;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "./Button";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/Button",
|
|
5
|
+
component: Button,
|
|
6
|
+
args: {
|
|
7
|
+
children: "Button",
|
|
8
|
+
variant: "default",
|
|
9
|
+
size: "md",
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
variant: {
|
|
13
|
+
control: "radio",
|
|
14
|
+
options: ["default", "primary", "secondary", "error"],
|
|
15
|
+
description: "Buttonの表示バリエーション",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
control: "radio",
|
|
19
|
+
options: ["sm", "md"],
|
|
20
|
+
description: "Buttonのサイズ",
|
|
21
|
+
},
|
|
22
|
+
disabled: {
|
|
23
|
+
control: "boolean",
|
|
24
|
+
description: "無効状態",
|
|
25
|
+
},
|
|
26
|
+
onClick: {
|
|
27
|
+
action: "clicked",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export default meta;
|
|
32
|
+
export const Default = {};
|
|
33
|
+
export const State = {
|
|
34
|
+
render: () => (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 16 }, children: [_jsx(Button, { variant: "default", children: "Default" }), _jsx(Button, { variant: "default", "data-state": "pressed", children: "Pressed" }), _jsx(Button, { variant: "default", disabled: true, children: "Disabled" })] })),
|
|
35
|
+
};
|
|
36
|
+
export const Variants = {
|
|
37
|
+
render: () => (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 16 }, children: [_jsx(Button, { variant: "default", children: "Default" }), _jsx(Button, { variant: "primary", children: "Primary" }), _jsx(Button, { variant: "secondary", children: "Secondary" }), _jsx(Button, { variant: "error", children: "Error" })] })),
|
|
38
|
+
};
|
|
39
|
+
export const Sizes = {
|
|
40
|
+
render: () => (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 16 }, children: [_jsx(Button, { size: "sm", children: "Small" }), _jsx(Button, { size: "md", children: "Medium" })] })),
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styles from "./Checkbox.module.css";
|
|
3
|
+
export const Checkbox = ({ label, className, ...props }) => {
|
|
4
|
+
return (_jsxs("label", { className: styles.wrapper, children: [_jsx("input", { type: "checkbox", className: styles.input, ...props }), _jsx("span", { className: styles.control }), label && _jsx("span", { className: styles.label, children: label })] }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
:root{
|
|
2
|
+
--icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath fill='white' d='M28.6122 12.5595C29.4077 11.7934 30.6741 11.8169 31.4403 12.6122C32.2064 13.4078 32.1829 14.6742 31.3875 15.4404L17.8875 28.4404C17.1025 29.1963 15.8564 29.1846 15.0858 28.414L8.58579 21.914C7.80474 21.133 7.80474 19.8669 8.58579 19.0859C9.36684 18.3048 10.6329 18.3048 11.4139 19.0859L16.5252 24.1972L28.6122 12.5595Z'/%3E%3C/svg%3E");
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.wrapper {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: var(--space-sm);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
font-family: var(--font);
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
color: var(--color-on-surface);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.input {
|
|
16
|
+
position: absolute;
|
|
17
|
+
opacity: 0;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.control {
|
|
22
|
+
width: 32px;
|
|
23
|
+
height: 32px;
|
|
24
|
+
border-radius: var(--radius-sm);
|
|
25
|
+
background: var(--color-surface-container);
|
|
26
|
+
box-shadow: var(--shadow-sm-in);
|
|
27
|
+
position: relative;
|
|
28
|
+
background-repeat: no-repeat;
|
|
29
|
+
background-position: center;
|
|
30
|
+
background-size: 32px 32px;
|
|
31
|
+
transition: background-color 0.2s ease;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* checked */
|
|
35
|
+
.input:checked + .control {
|
|
36
|
+
background-color: var(--color-primary);
|
|
37
|
+
background-image: var(--icon-check);
|
|
38
|
+
}
|
|
39
|
+
/* focus */
|
|
40
|
+
.input:focus-visible + .control {
|
|
41
|
+
outline: 2px solid var(--color-primary-container);
|
|
42
|
+
outline-offset: 2px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* disabled */
|
|
46
|
+
.input:disabled + .control {
|
|
47
|
+
opacity: 0.25;
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.label {
|
|
52
|
+
font-size: 1rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Checkbox } from "./Checkbox";
|
|
3
|
+
declare const meta: Meta<typeof Checkbox>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const State: Story;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox } from "./Checkbox";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/Checkbox",
|
|
5
|
+
component: Checkbox,
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {};
|
|
9
|
+
export const State = {
|
|
10
|
+
render: () => {
|
|
11
|
+
return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [_jsx(Checkbox, { label: "\u975E\u9078\u629E\u72B6\u614B" }), _jsx(Checkbox, { label: "\u9078\u629E\u72B6\u614B", defaultChecked: true }), _jsx(Checkbox, { label: "\u7DE8\u96C6\u4E0D\u53EF", disabled: true })] }));
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from "./Checkbox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from "./Input.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
export const Input = ({ state = "default", className, ...props }) => {
|
|
5
|
+
return (_jsx("input", { className: clsx(styles.input, styles[state], className), ...props }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.input {
|
|
2
|
+
font-family: var(--font);
|
|
3
|
+
padding: var(--space-md) var(--space-lg);
|
|
4
|
+
border-radius: var(--radius-sm);
|
|
5
|
+
border: 2px solid var(--color-surface);
|
|
6
|
+
outline: none;
|
|
7
|
+
box-shadow: var(--shadow-sm-in), var(--shadow-sm);
|
|
8
|
+
|
|
9
|
+
background: var(--color-surface-container);
|
|
10
|
+
color: var(--color-on-surface);
|
|
11
|
+
|
|
12
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ===== Focus ===== */
|
|
16
|
+
|
|
17
|
+
.input:focus {
|
|
18
|
+
outline: none;
|
|
19
|
+
border: 2px solid var(--color-primary);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* ===== Error ===== */
|
|
23
|
+
|
|
24
|
+
.error {
|
|
25
|
+
border: 2px solid var(--color-error);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ===== Disabled ===== */
|
|
29
|
+
|
|
30
|
+
.input:disabled {
|
|
31
|
+
opacity: 0.5;
|
|
32
|
+
cursor: not-allowed;
|
|
33
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Input } from "./Input";
|
|
3
|
+
declare const meta: Meta<typeof Input>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Input>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const State: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from "./Input";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/Input",
|
|
5
|
+
component: Input,
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
placeholder: "入力してください",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export const State = {
|
|
14
|
+
render: () => {
|
|
15
|
+
return (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 16 }, children: [_jsx(Input, { placeholder: "Default State", state: "default" }), _jsx(Input, { placeholder: "Error State", state: "error" }), _jsx(Input, { placeholder: "Disabled State", disabled: true })] }));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from "./Modal.module.css";
|
|
3
|
+
export const Modal = ({ open, onClose, children }) => {
|
|
4
|
+
if (!open)
|
|
5
|
+
return null;
|
|
6
|
+
return (_jsx("div", { className: styles.overlay, onClick: onClose, children: _jsx("div", { className: styles.modal, onClick: (e) => e.stopPropagation(), children: children }) }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
background: var(--color-scrim);
|
|
5
|
+
backdrop-filter: var(--blur);
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
z-index: 1000;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.modal {
|
|
13
|
+
background: var(--color-surface);
|
|
14
|
+
color: var(--color-on-surface);
|
|
15
|
+
border-radius: var(--radius-md);
|
|
16
|
+
box-shadow: var(--shadow-md);
|
|
17
|
+
padding: var(--space-lg);
|
|
18
|
+
min-width: 320px;
|
|
19
|
+
max-width: 90vw;
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Modal } from "./Modal";
|
|
4
|
+
import { Button } from "../Button/Button";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Components/Feedback/Modal",
|
|
7
|
+
component: Modal,
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
export const Default = {
|
|
11
|
+
render: () => {
|
|
12
|
+
const [open, setOpen] = useState(false);
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setOpen(true), children: "Open Modal" }), _jsx(Modal, { open: open, onClose: () => setOpen(false), children: _jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 32 }, children: [_jsx("h2", { children: "Modal Title" }), _jsx("p", { children: "This is a modal content." }), _jsx(Button, { onClick: () => setOpen(false), children: "Close" })] }) })] }));
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import styles from "./Radio.module.css";
|
|
4
|
+
export const Radio = ({ label, className, ...props }) => {
|
|
5
|
+
return (_jsxs("label", { className: clsx(styles.wrapper, className), children: [_jsx("input", { type: "radio", className: styles.input, ...props }), _jsx("span", { className: styles.control }), label && _jsx("span", { className: styles.label, children: label })] }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
.wrapper {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--space-sm);
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
font-family: var(--font);
|
|
8
|
+
font-weight: 500;
|
|
9
|
+
color: var(--color-on-surface);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.input {
|
|
13
|
+
position: absolute;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.control {
|
|
19
|
+
width: 32px;
|
|
20
|
+
height: 32px;
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
background: var(--color-surface);
|
|
23
|
+
box-shadow: var(--shadow-sm-in);
|
|
24
|
+
position: relative;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* checked */
|
|
28
|
+
.input:checked + .control::after {
|
|
29
|
+
content: "";
|
|
30
|
+
position: absolute;
|
|
31
|
+
inset: 6px;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
background: var(--color-primary);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* focus */
|
|
37
|
+
.input:focus-visible + .control {
|
|
38
|
+
outline: 2px solid var(--color-primary-container);
|
|
39
|
+
outline-offset: 2px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* disabled */
|
|
43
|
+
.input:disabled + .control {
|
|
44
|
+
opacity: 0.5;
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.label {
|
|
49
|
+
font-size: 1rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Radio } from "./Radio";
|
|
3
|
+
declare const meta: Meta<typeof Radio>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Radio>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const State: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Radio } from "./Radio";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/Radio",
|
|
5
|
+
component: Radio,
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
checked: false,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export const State = {
|
|
14
|
+
render: () => {
|
|
15
|
+
return (_jsxs("div", { style: { display: "flex", flexDirection: "column", maxWidth: 300, gap: 16 }, children: [_jsx(Radio, { name: "option", value: "1", label: "\u672A\u9078\u629E", checked: false }), _jsx(Radio, { name: "option", value: "2", label: "\u9078\u629E\u6E08\u307F", checked: true }), _jsx(Radio, { name: "option", value: "3", label: "\u7DE8\u96C6\u4E0D\u53EF", checked: false, disabled: true })] }));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Radio } from "./Radio";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from "./Select.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
export const Select = ({ state = "default", className, children, ...props }) => {
|
|
5
|
+
return (_jsx("select", { className: clsx(styles.select, styles[state], className), ...props, children: children }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.select {
|
|
2
|
+
font-family: var(--font);
|
|
3
|
+
padding: var(--space-sm) var(--space-md);
|
|
4
|
+
border-radius: var(--radius-sm);
|
|
5
|
+
box-shadow: var(--shadow-sm);
|
|
6
|
+
|
|
7
|
+
background-color: var(--color-surface-container);
|
|
8
|
+
color: var(--color-on-surface);
|
|
9
|
+
|
|
10
|
+
appearance: none;
|
|
11
|
+
-webkit-appearance: none;
|
|
12
|
+
|
|
13
|
+
background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M6.5%209.5L12%2015L18%209.5%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
background-repeat: no-repeat;
|
|
17
|
+
background-position: right var(--space-sm) center;
|
|
18
|
+
background-size: 24px;
|
|
19
|
+
|
|
20
|
+
padding-right: calc(var(--space-md) + 32px + var(--space-sm));
|
|
21
|
+
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
select:has(option[value=""]:checked) {
|
|
26
|
+
color: var(--color-on-surface);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/* focus */
|
|
31
|
+
.select:focus {
|
|
32
|
+
outline: none;
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* error */
|
|
37
|
+
.error {
|
|
38
|
+
border: 2px solid var(--color-error);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* disabled */
|
|
42
|
+
.select:disabled {
|
|
43
|
+
opacity: 0.5;
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Select } from "./Select";
|
|
3
|
+
declare const meta: Meta<typeof Select>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Select>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const State: Story;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select } from "./Select";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/Select",
|
|
5
|
+
component: Select,
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
children: (_jsxs(_Fragment, { children: [_jsx("option", { value: "", children: "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044" }), _jsx("option", { value: "a", children: "Option A" }), _jsx("option", { value: "b", children: "Option B" })] })),
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export const State = {
|
|
14
|
+
render: () => {
|
|
15
|
+
return (_jsxs("div", { style: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
alignItems: "flex-start",
|
|
19
|
+
gap: 32,
|
|
20
|
+
}, children: [_jsxs(Select, { children: [_jsx("option", { value: "", children: "Default State" }), _jsx("option", { value: "a", children: "Option A" }), _jsx("option", { value: "b", children: "Option B" })] }), _jsxs(Select, { state: "error", required: true, children: [_jsx("option", { value: "", disabled: true, selected: true, hidden: true, children: "Error State" }), _jsx("option", { value: "a", children: "Option A" }), _jsx("option", { value: "b", children: "Option B" })] }), _jsxs(Select, { disabled: true, children: [_jsx("option", { value: "", children: "Disabled State" }), _jsx("option", { value: "a", children: "Option A" }), _jsx("option", { value: "b", children: "Option B" })] })] }));
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|