lucentia-ui 0.1.8 → 0.2.0
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/README.md +2 -148
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.module.css +52 -16
- package/dist/components/Button/Button.stories.js +20 -5
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.module.css +5 -5
- package/dist/fonts/NotoSansJP-Bold.woff2 +0 -0
- package/dist/fonts/NotoSansJP-Medium.woff2 +0 -0
- package/dist/fonts/NotoSansJP-Regular.woff2 +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -3
- /package/dist/{styles → styels}/base.css +0 -0
- /package/dist/{styles → styels}/font.css +0 -0
package/README.md
CHANGED
|
@@ -1,151 +1,5 @@
|
|
|
1
1
|
# lucentia-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React UI design token and component system based on neumorphism, featuring two color themes: light and dark.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## インストール方法
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install lucentia-ui
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
or
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
yarn add lucentia-ui
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Requirements
|
|
22
|
-
|
|
23
|
-
- React 18+
|
|
24
|
-
- CSS Modules 対応環境(Next.js / Vite / CRA など)
|
|
25
|
-
|
|
26
|
-
## 基本の使い方
|
|
27
|
-
|
|
28
|
-
### 1.ThemeProvider をアプリのルートに配置
|
|
29
|
-
|
|
30
|
-
※lucentia-ui は ThemeProvider が必須です
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
import { ThemeProvider } from "lucentia-ui";
|
|
34
|
-
|
|
35
|
-
export default function App() {
|
|
36
|
-
return <ThemeProvider theme="light">{/* your app */}</ThemeProvider>;
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## 利用可能なテーマ
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
type Theme = "light" | "dark";
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
<ThemeProvider theme="dark">
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## 追加CSSのFont.css、Base.cssの導入は任意
|
|
52
|
-
- `base` : reset, box-sizing, typography base, color tokens
|
|
53
|
-
- `font` : Noto Sans JP font-face definitions
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
import "lucentia-ui/styles/base";
|
|
57
|
-
import "lucentia-ui/styles/font";
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### 2.コンポーネントをそのまま使う
|
|
62
|
-
|
|
63
|
-
```tsx
|
|
64
|
-
import { Button, Checkbox, Radio } from "lucentia-ui";
|
|
65
|
-
|
|
66
|
-
export default function Example() {
|
|
67
|
-
return (
|
|
68
|
-
<>
|
|
69
|
-
<Button variant="primary">Save</Button>
|
|
70
|
-
<Checkbox label="Accept terms" />
|
|
71
|
-
<Radio label="Option A" />
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
- ThemeProvider 配下であればスタイルは自動適用
|
|
78
|
-
|
|
79
|
-
### ThemeProvider は必須
|
|
80
|
-
|
|
81
|
-
lucentia-ui のコンポーネントは
|
|
82
|
-
CSS Variables(Design Tokens) に依存しています。
|
|
83
|
-
|
|
84
|
-
```css
|
|
85
|
-
.theme.light {
|
|
86
|
-
--color-background: #ffffff;
|
|
87
|
-
--color-text: #111111;
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
ThemeProvider は:
|
|
92
|
-
|
|
93
|
-
- .theme.light / .theme.dark を付与
|
|
94
|
-
- CSS Variables を有効化
|
|
95
|
-
- コンポーネント CSS を安全に動作させる
|
|
96
|
-
|
|
97
|
-
という役割を持ちます。
|
|
98
|
-
|
|
99
|
-
## テーマ設定例
|
|
100
|
-
|
|
101
|
-
```tsx
|
|
102
|
-
import { ThemeProvider, Button } from "lucentia-ui";
|
|
103
|
-
|
|
104
|
-
export default function App() {
|
|
105
|
-
return (
|
|
106
|
-
<ThemeProvider theme="dark">
|
|
107
|
-
{children}
|
|
108
|
-
</ThemeProvider>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
## コンポーネント設計方針
|
|
116
|
-
|
|
117
|
-
- **HTML ネイティブ要素を尊重**
|
|
118
|
-
- **props extends HTMLAttributes**
|
|
119
|
-
- **状態・色・サイズは Design Tokens に依存**
|
|
120
|
-
- **Tailwind / inline style 不使用**
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## 提供コンポーネント
|
|
125
|
-
|
|
126
|
-
- Button
|
|
127
|
-
- Checkbox
|
|
128
|
-
- Radio
|
|
129
|
-
- Input
|
|
130
|
-
- Select
|
|
131
|
-
- Switch
|
|
132
|
-
- Textarea
|
|
133
|
-
- Modal
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## 注意事項
|
|
139
|
-
|
|
140
|
-
- **ThemeProvider を使わない場合**
|
|
141
|
-
→ CSS Variables が未定義になり表示が崩れます
|
|
142
|
-
|
|
143
|
-
- **CSS の上書きは非推奨**
|
|
144
|
-
(Tokens 拡張を想定)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## License
|
|
150
|
-
|
|
151
|
-
MIT
|
|
5
|
+
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import styles from "./Button.module.css";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
export const Button = ({ variant = "
|
|
4
|
+
export const Button = ({ variant = "ghost", size = "md", className, ...props }) => {
|
|
5
5
|
return (_jsx("button", { className: clsx(styles.button, styles[variant], styles[size], className), ...props }));
|
|
6
6
|
};
|
|
@@ -6,19 +6,20 @@
|
|
|
6
6
|
|
|
7
7
|
border-radius: var(--radius-sm);
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
transition:
|
|
10
|
+
box-shadow 0.2s ease,
|
|
11
|
+
opacity 0.2s ease,
|
|
12
|
+
background 0.25s ease-in-out,
|
|
13
|
+
color 0.25s ease;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/* ===== Variant ===== */
|
|
15
|
-
.
|
|
16
|
-
background: var(--color-surface
|
|
17
|
+
.ghost {
|
|
18
|
+
background: var(--color-surface);
|
|
17
19
|
color: var(--color-on-surface);
|
|
18
20
|
}
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
box-shadow: 0 0 4px var(--color-border), 0 0 8px var(--color-border);
|
|
21
|
+
.ghost:hover:not(:disabled) {
|
|
22
|
+
background: var(--color-surface-container);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.primary {
|
|
@@ -26,9 +27,25 @@
|
|
|
26
27
|
color: var(--color-on-primary-container);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
.primary:hover:not(:disabled) {
|
|
30
|
+
.sm.primary:hover:not(:disabled) {
|
|
31
|
+
border: 2px solid var(--color-primary);
|
|
32
|
+
box-shadow:
|
|
33
|
+
0 0 2px var(--color-primary),
|
|
34
|
+
0 0 4px var(--color-primary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.md.primary:hover:not(:disabled) {
|
|
38
|
+
border: 2px solid var(--color-primary);
|
|
39
|
+
box-shadow:
|
|
40
|
+
0 0 4px var(--color-primary),
|
|
41
|
+
0 0 8px var(--color-primary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.md.primary:hover:not(:disabled) {
|
|
30
45
|
border: 2px solid var(--color-primary);
|
|
31
|
-
box-shadow:
|
|
46
|
+
box-shadow:
|
|
47
|
+
0 0 4px var(--color-primary),
|
|
48
|
+
0 0 8px var(--color-primary);
|
|
32
49
|
}
|
|
33
50
|
|
|
34
51
|
.secondary {
|
|
@@ -36,21 +53,40 @@
|
|
|
36
53
|
color: var(--color-on-secondary-container);
|
|
37
54
|
}
|
|
38
55
|
|
|
39
|
-
.secondary:hover:not(:disabled) {
|
|
56
|
+
.sm.secondary:hover:not(:disabled) {
|
|
57
|
+
border: 2px solid var(--color-secondary);
|
|
58
|
+
box-shadow:
|
|
59
|
+
0 0 2px var(--color-secondary),
|
|
60
|
+
0 0 4px var(--color-secondary);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.md.secondary:hover:not(:disabled) {
|
|
40
64
|
border: 2px solid var(--color-secondary);
|
|
41
|
-
box-shadow:
|
|
65
|
+
box-shadow:
|
|
66
|
+
0 0 4px var(--color-secondary),
|
|
67
|
+
0 0 8px var(--color-secondary);
|
|
42
68
|
}
|
|
43
69
|
|
|
44
|
-
.
|
|
70
|
+
.danger {
|
|
45
71
|
background: var(--color-error-container);
|
|
46
72
|
color: var(--color-on-error-container);
|
|
47
73
|
}
|
|
48
74
|
|
|
49
|
-
.
|
|
75
|
+
.sm.danger:hover:not(:disabled) {
|
|
50
76
|
border: 2px solid var(--color-error);
|
|
51
|
-
box-shadow:
|
|
77
|
+
box-shadow:
|
|
78
|
+
0 0 2px var(--color-error),
|
|
79
|
+
0 0 4px var(--color-error);
|
|
52
80
|
}
|
|
53
81
|
|
|
82
|
+
.md.danger:hover:not(:disabled) {
|
|
83
|
+
border: 2px solid var(--color-error);
|
|
84
|
+
box-shadow:
|
|
85
|
+
0 0 4px var(--color-error),
|
|
86
|
+
0 0 8px var(--color-error);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
54
90
|
/* ===== Size ===== */
|
|
55
91
|
|
|
56
92
|
.sm {
|
|
@@ -62,7 +98,7 @@
|
|
|
62
98
|
.md {
|
|
63
99
|
padding: var(--space-sm) var(--space-2xl);
|
|
64
100
|
font-size: 1rem;
|
|
65
|
-
|
|
101
|
+
box-shadow: var(--shadow-md);
|
|
66
102
|
}
|
|
67
103
|
|
|
68
104
|
/* ===== State ===== */
|
|
@@ -5,13 +5,13 @@ const meta = {
|
|
|
5
5
|
component: Button,
|
|
6
6
|
args: {
|
|
7
7
|
children: "Button",
|
|
8
|
-
variant: "
|
|
8
|
+
variant: "ghost",
|
|
9
9
|
size: "md",
|
|
10
10
|
},
|
|
11
11
|
argTypes: {
|
|
12
12
|
variant: {
|
|
13
13
|
control: "radio",
|
|
14
|
-
options: ["
|
|
14
|
+
options: ["ghost", "primary", "secondary", "danger"],
|
|
15
15
|
description: "Buttonの表示バリエーション",
|
|
16
16
|
},
|
|
17
17
|
size: {
|
|
@@ -31,11 +31,26 @@ const meta = {
|
|
|
31
31
|
export default meta;
|
|
32
32
|
export const Default = {};
|
|
33
33
|
export const State = {
|
|
34
|
-
render: () => (_jsxs("div", { style: {
|
|
34
|
+
render: () => (_jsxs("div", { style: {
|
|
35
|
+
display: "flex",
|
|
36
|
+
flexDirection: "column",
|
|
37
|
+
alignItems: "flex-start",
|
|
38
|
+
gap: 32,
|
|
39
|
+
}, children: [_jsx(Button, { variant: "ghost", children: "Default" }), _jsx(Button, { variant: "ghost", "data-state": "pressed", children: "Pressed" }), _jsx(Button, { variant: "ghost", disabled: true, children: "Disabled" })] })),
|
|
35
40
|
};
|
|
36
41
|
export const Variants = {
|
|
37
|
-
render: () => (_jsxs("div", { style: {
|
|
42
|
+
render: () => (_jsxs("div", { style: {
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
alignItems: "flex-start",
|
|
46
|
+
gap: 32,
|
|
47
|
+
}, children: [_jsx(Button, { variant: "ghost", children: "Ghost" }), _jsx(Button, { variant: "primary", children: "Primary" }), _jsx(Button, { variant: "secondary", children: "Secondary" }), _jsx(Button, { variant: "danger", children: "Danger" })] })),
|
|
38
48
|
};
|
|
39
49
|
export const Sizes = {
|
|
40
|
-
render: () => (_jsxs("div", { style: {
|
|
50
|
+
render: () => (_jsxs("div", { style: {
|
|
51
|
+
display: "flex",
|
|
52
|
+
flexDirection: "column",
|
|
53
|
+
alignItems: "flex-start",
|
|
54
|
+
gap: 32,
|
|
55
|
+
}, children: [_jsx(Button, { size: "sm", children: "Small" }), _jsx(Button, { size: "md", children: "Medium" })] })),
|
|
41
56
|
};
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
--shadow-sm: -2px -2px 2px 1px var(--color-shadow-l),
|
|
63
63
|
2px 2px 2px 1px var(--color-shadow-d);
|
|
64
64
|
|
|
65
|
-
--shadow-sm-in: inset -2px -2px 2px
|
|
66
|
-
inset 2px 2px 2px
|
|
65
|
+
--shadow-sm-in: inset -2px -2px 2px var(--color-shadow-l),
|
|
66
|
+
inset 2px 2px 2px var(--color-shadow-d);
|
|
67
67
|
|
|
68
68
|
--shadow-md: -2px -2px 4px 2px var(--color-shadow-l),
|
|
69
69
|
2px 2px 4px 2px var(--color-shadow-d);
|
|
@@ -108,11 +108,11 @@
|
|
|
108
108
|
/* ===== Effect ===== */
|
|
109
109
|
--blur: blur(8px);
|
|
110
110
|
|
|
111
|
-
--shadow-sm: -2px -2px 2px
|
|
111
|
+
--shadow-sm: -2px -2px 2px var(--color-shadow-l),
|
|
112
112
|
2px 2px 2px 1px var(--color-shadow-d);
|
|
113
113
|
|
|
114
|
-
--shadow-sm-in: inset -2px -2px 2px
|
|
115
|
-
inset 2px 2px 2px
|
|
114
|
+
--shadow-sm-in: inset -2px -2px 2px var(--color-shadow-l),
|
|
115
|
+
inset 2px 2px 2px var(--color-shadow-d);
|
|
116
116
|
|
|
117
117
|
--shadow-md: -2px -2px 4px 2px var(--color-shadow-l),
|
|
118
118
|
2px 2px 4px 2px var(--color-shadow-d);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { ThemeProvider } from "./components/ThemeProvider";
|
|
|
2
2
|
export type { Theme } from "./components/ThemeProvider";
|
|
3
3
|
export * from "./components/Button";
|
|
4
4
|
export * from "./components/Checkbox";
|
|
5
|
+
export * from "./components/Divider";
|
|
5
6
|
export * from "./components/Radio";
|
|
6
7
|
export * from "./components/Input";
|
|
7
8
|
export * from "./components/Textarea";
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { ThemeProvider } from "./components/ThemeProvider";
|
|
|
3
3
|
/* ===== Components ===== */
|
|
4
4
|
export * from "./components/Button";
|
|
5
5
|
export * from "./components/Checkbox";
|
|
6
|
+
export * from "./components/Divider";
|
|
6
7
|
export * from "./components/Radio";
|
|
7
8
|
export * from "./components/Input";
|
|
8
9
|
export * from "./components/Textarea";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lucentia-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React UI design token and component system based on neumorphism, featuring two color themes: light and dark.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"react": ">=18"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "tsc -p tsconfig.json &&
|
|
26
|
+
"build": "tsc -p tsconfig.json && npm run copy:assets",
|
|
27
|
+
"copy:assets": "cpy \"**/*.module.css\" ../dist --cwd=src --parents",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
27
29
|
},
|
|
28
30
|
"license": "MIT",
|
|
29
31
|
"dependencies": {
|
|
@@ -32,4 +34,4 @@
|
|
|
32
34
|
"devDependencies": {
|
|
33
35
|
"cpy-cli": "^6.0.0"
|
|
34
36
|
}
|
|
35
|
-
}
|
|
37
|
+
}
|
|
File without changes
|
|
File without changes
|