lucentia-ui 0.1.7 → 0.1.9

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 CHANGED
@@ -96,20 +96,15 @@ ThemeProvider は:
96
96
 
97
97
  という役割を持ちます。
98
98
 
99
- ### テーマ切り替え例(Next.js)
99
+ ## テーマ設定例
100
100
 
101
101
  ```tsx
102
- import { useState } from "react";
103
102
  import { ThemeProvider, Button } from "lucentia-ui";
104
103
 
105
104
  export default function App() {
106
- const [theme, setTheme] = useState<"light" | "dark">("light");
107
-
108
105
  return (
109
- <ThemeProvider theme={theme}>
110
- <Button onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
111
- Toggle theme
112
- </Button>
106
+ <ThemeProvider theme="dark">
107
+ {children}
113
108
  </ThemeProvider>
114
109
  );
115
110
  }
@@ -0,0 +1,2 @@
1
+ import type { DividerProps } from "./types";
2
+ export declare const Divider: React.FC<DividerProps>;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styles from "./Divider.module.css";
3
+ export const Divider = ({ orientation = "horizontal", variant = "default", className, }) => {
4
+ return (_jsx("div", { role: "separator", "aria-orientation": orientation, "data-orientation": orientation, "data-variant": variant, className: [styles.divider, className].filter(Boolean).join(" ") }));
5
+ };
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Divider } from "./Divider";
3
+ declare const meta: Meta<typeof Divider>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Divider>;
6
+ export declare const Default: Story;
7
+ export declare const Groove: Story;
8
+ export declare const Vertical: Story;
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Divider } from "./Divider";
3
+ const meta = {
4
+ title: "Components/Divider",
5
+ component: Divider,
6
+ args: {
7
+ orientation: "horizontal",
8
+ variant: "default",
9
+ },
10
+ argTypes: {
11
+ orientation: {
12
+ control: "radio",
13
+ options: ["horizontal", "vertical"],
14
+ },
15
+ variant: {
16
+ control: "radio",
17
+ options: ["default", "groove"],
18
+ },
19
+ },
20
+ };
21
+ export default meta;
22
+ /**
23
+ * 共通レンダラー
24
+ * - vertical / horizontal 両方確認できるサイズ
25
+ * - flex + shrink防止前提
26
+ */
27
+ const renderDivider = (args) => (_jsx("div", { style: {
28
+ display: "flex",
29
+ width: "200px",
30
+ height: "200px",
31
+ alignItems: "center",
32
+ justifyContent: "center",
33
+ }, children: _jsx(Divider, { ...args }) }));
34
+ export const Default = {
35
+ render: renderDivider,
36
+ };
37
+ export const Groove = {
38
+ render: renderDivider,
39
+ args: {
40
+ variant: "groove",
41
+ },
42
+ };
43
+ export const Vertical = {
44
+ render: renderDivider,
45
+ args: {
46
+ orientation: "vertical",
47
+ },
48
+ };
@@ -0,0 +1,2 @@
1
+ export { Divider } from "./Divider";
2
+ export type { DividerProps, DividerOrientation, DividerVariant } from "./types";
@@ -0,0 +1 @@
1
+ export { Divider } from "./Divider";
@@ -0,0 +1,7 @@
1
+ export type DividerOrientation = "horizontal" | "vertical";
2
+ export type DividerVariant = "default" | "groove";
3
+ export interface DividerProps {
4
+ orientation?: DividerOrientation;
5
+ variant?: DividerVariant;
6
+ className?: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import styles from "./ThemeProvider.module.css";
3
3
  export function ThemeProvider({ theme = "light", children, }) {
4
- return (_jsx("div", { className: `${styles.theme} ${theme === "dark" ? styles.dark : styles.light}`, children: children }));
4
+ return (_jsx("main", { className: `${styles.theme} ${theme === "dark" ? styles.dark : styles.light}`, children: children }));
5
5
  }
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";
@@ -36,10 +36,13 @@ html {
36
36
  body {
37
37
  line-height: 1.5;
38
38
  font-family: var(--font, system-ui, -apple-system, sans-serif);
39
- color: var(--color-on-background, #161d1d);
40
- background-color: var(--color-background, #f4fbfa);
41
39
  padding: 0;
42
- }
40
+ }
41
+
42
+ main {
43
+ min-height: 100vh;
44
+ background: var(--color-background);
45
+ }
43
46
 
44
47
  /* リスト */
45
48
  ul,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucentia-ui",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
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,8 @@
23
23
  "react": ">=18"
24
24
  },
25
25
  "scripts": {
26
- "build": "tsc -p tsconfig.json && cpy 'src/**/*.css' dist"
26
+ "build": "tsc -p tsconfig.json && npm run copy:assets",
27
+ "copy:assets": "cpy 'src/styles/*.css' dist/styles && cpy 'src/fonts/*' dist/fonts"
27
28
  },
28
29
  "license": "MIT",
29
30
  "dependencies": {
@@ -32,4 +33,4 @@
32
33
  "devDependencies": {
33
34
  "cpy-cli": "^6.0.0"
34
35
  }
35
- }
36
+ }
@@ -1,82 +0,0 @@
1
- .button {
2
- font-family: var(--font);
3
- font-weight: 500;
4
- border: 2px solid transparent;
5
- cursor: pointer;
6
-
7
- border-radius: var(--radius-sm);
8
-
9
-
10
- transition: box-shadow 0.2s ease, opacity 0.2s ease,
11
- background 0.25s ease-in-out, color 0.25s ease;
12
- }
13
-
14
- /* ===== Variant ===== */
15
- .default {
16
- background: var(--color-surface-container);
17
- color: var(--color-on-surface);
18
- }
19
- .default:hover:not(:disabled) {
20
- border: 2px solid var(--color-border);
21
- box-shadow: 0 0 4px var(--color-border), 0 0 8px var(--color-border);
22
- }
23
-
24
- .primary {
25
- background: var(--color-primary-container);
26
- color: var(--color-on-primary-container);
27
- }
28
-
29
- .primary:hover:not(:disabled) {
30
- border: 2px solid var(--color-primary);
31
- box-shadow: 0 0 4px var(--color-primary), 0 0 8px var(--color-primary);
32
- }
33
-
34
- .secondary {
35
- background: var(--color-secondary-container);
36
- color: var(--color-on-secondary-container);
37
- }
38
-
39
- .secondary:hover:not(:disabled) {
40
- border: 2px solid var(--color-secondary);
41
- box-shadow: 0 0 4px var(--color-secondary), 0 0 8px var(--color-secondary);
42
- }
43
-
44
- .error {
45
- background: var(--color-error-container);
46
- color: var(--color-on-error-container);
47
- }
48
-
49
- .error:hover:not(:disabled) {
50
- border: 2px solid var(--color-error);
51
- box-shadow: 0 0 4px var(--color-error), 0 0 8px var(--color-error);
52
- }
53
-
54
- /* ===== Size ===== */
55
-
56
- .sm {
57
- padding: var(--space-xs) var(--space-lg);
58
- font-size: 0.875rem;
59
- box-shadow: var(--shadow-sm);
60
- }
61
-
62
- .md {
63
- padding: var(--space-sm) var(--space-2xl);
64
- font-size: 1rem;
65
- box-shadow: var(--shadow-md);
66
- }
67
-
68
- /* ===== State ===== */
69
-
70
- .button:active:not(:disabled),
71
- .button[data-state="pressed"] {
72
- box-shadow: none;
73
- }
74
-
75
- .button:focus-visible {
76
- outline: none;
77
- }
78
-
79
- .button:disabled {
80
- opacity: 0.5;
81
- cursor: not-allowed;
82
- }
@@ -1,53 +0,0 @@
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-md-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
- }
@@ -1,20 +0,0 @@
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-lg);
17
- padding: var(--space-lg);
18
- min-width: 320px;
19
- max-width: 90vw;
20
- }
@@ -1,52 +0,0 @@
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
- background: var(--color-surface-container);
8
- color: var(--color-on-surface);
9
-
10
- transition: border-color 0.2s ease, box-shadow 0.2s ease;
11
- }
12
-
13
- /* ===== Focus ===== */
14
- .input:focus {
15
- outline: none;
16
- border: 2px solid var(--color-primary);
17
- }
18
-
19
-
20
- /* ===== Readonly ===== */
21
- .input:read-only:not(:disabled) {
22
- box-shadow: none;
23
- cursor: text;
24
- }
25
-
26
- .input:read-only:not(:disabled) :focus {
27
- border: 2px solid var(--color-surface);
28
- }
29
-
30
- /* ===== Error ===== */
31
- .error {
32
- border: 2px solid var(--color-error);
33
- }
34
-
35
- /* ===== Disabled ===== */
36
- .input:disabled {
37
- opacity: 0.5;
38
- cursor: not-allowed;
39
- }
40
-
41
- /* ===== size ===== */
42
- .sm {
43
- font-size: 0.875rem;
44
- padding: var(--space-sm) var(--space-md);
45
- box-shadow: var(--shadow-sm-in);
46
- }
47
-
48
- .md {
49
- font-size: 1rem;
50
- padding: var(--space-md) var(--space-lg);
51
- box-shadow: var(--shadow-md-in);
52
- }
@@ -1,49 +0,0 @@
1
- .wrapper {
2
- display: inline-flex;
3
- align-items: center;
4
- gap: var(--space-sm);
5
- cursor: pointer;
6
- font-family: var(--font);
7
- font-weight: 500;
8
- color: var(--color-on-surface);
9
- }
10
-
11
- .input {
12
- position: absolute;
13
- opacity: 0;
14
- pointer-events: none;
15
- }
16
-
17
- .control {
18
- width: 32px;
19
- height: 32px;
20
- border-radius: 50%;
21
- background: var(--color-surface);
22
- box-shadow: var(--shadow-md-in);
23
- position: relative;
24
- }
25
-
26
- /* checked */
27
- .input:checked + .control::after {
28
- content: "";
29
- position: absolute;
30
- inset: 6px;
31
- border-radius: 50%;
32
- background: var(--color-primary);
33
- }
34
-
35
- /* focus */
36
- .input:focus-visible + .control {
37
- outline: 2px solid var(--color-primary-container);
38
- outline-offset: 2px;
39
- }
40
-
41
- /* disabled */
42
- .input:disabled + .control {
43
- opacity: 0.5;
44
- cursor: not-allowed;
45
- }
46
-
47
- .label {
48
- font-size: 1rem;
49
- }
@@ -1,43 +0,0 @@
1
- .select {
2
- font-family: var(--font);
3
- padding: var(--space-sm) var(--space-md);
4
- border: 2px solid transparent;
5
- border-radius: var(--radius-sm);
6
- box-shadow: var(--shadow-md);
7
-
8
- background: var(--color-surface-container);
9
- color: var(--color-on-surface);
10
-
11
- appearance: none;
12
- -webkit-appearance: none;
13
-
14
- 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");
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
- /* focus */
30
- .select:focus {
31
- outline: none;
32
- }
33
-
34
- /* error */
35
- .error {
36
- border: 2px solid var(--color-error);
37
- }
38
-
39
- /* disabled */
40
- .select:disabled {
41
- opacity: 0.5;
42
- cursor: not-allowed;
43
- }
@@ -1,58 +0,0 @@
1
- .switch {
2
- position: relative;
3
- display: inline-block;
4
- width: 72px;
5
- height: 40px;
6
- }
7
-
8
- /* input は見えなくするが状態は保持 */
9
- .switch input {
10
- opacity: 0;
11
- width: 0;
12
- height: 0;
13
- }
14
-
15
- /* ===== Track ===== */
16
- .slider {
17
- position: absolute;
18
- inset: 0;
19
- background: var(--color-surface-container);
20
- border-radius: var(--radius-max);
21
- box-shadow: var(--shadow-md-in);
22
- transition: background 0.2s ease;
23
- cursor: pointer;
24
- }
25
-
26
- /* ===== Knob ===== */
27
- .slider::before {
28
- content: "";
29
- position: absolute;
30
- height: 24px;
31
- width: 24px;
32
- left: 8px;
33
- top: 8px;
34
- background: var(--color-on-primary);
35
- box-shadow: var(--shadow-md);
36
- border-radius: var(--radius-max);
37
- transition: transform 0.2s ease;
38
- }
39
-
40
- /* ===== Checked ===== */
41
- .switch input:checked + .slider {
42
- background: var(--color-primary);
43
- }
44
-
45
- .switch input:checked + .slider::before {
46
- transform: translateX(32px);
47
- }
48
-
49
- /* ===== Focus ===== */
50
- .switch input:focus-visible + .slider {
51
- outline: none;
52
- }
53
-
54
- /* ===== Disabled ===== */
55
- .switch input:disabled + .slider {
56
- opacity: 0.25;
57
- cursor: not-allowed;
58
- }
@@ -1,41 +0,0 @@
1
- .textarea {
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-md-in);
8
-
9
- background: var(--color-surface-container);
10
- color: var(--color-on-surface);
11
- resize: none;
12
- scrollbar-width: none;
13
- transition: border-color 0.2s ease, box-shadow 0.2s ease;
14
- }
15
-
16
- /* ===== Focus ===== */
17
- .textarea:focus {
18
- outline: none;
19
- border: 2px solid var(--color-primary);
20
- }
21
-
22
- /* ===== Error ===== */
23
- .error {
24
- border: 2px solid var(--color-error);
25
- }
26
-
27
- /* ===== Readonly ===== */
28
- .textarea:read-only {
29
- box-shadow: none;
30
- cursor: text;
31
- }
32
-
33
- .textarea:read-only:focus {
34
- border: 2px solid var(--color-surface);
35
- }
36
-
37
- /* ===== Disabled ===== */
38
- .textarea:disabled {
39
- opacity: 0.5;
40
- cursor: not-allowed;
41
- }
@@ -1,124 +0,0 @@
1
- .theme {
2
- min-height: 100%;
3
- /* font */
4
- --font: "Noto Sans JP", sans-serif;
5
-
6
- /* ===== Radius ===== */
7
- --radius-sm: 8px;
8
- --radius-md: 16px;
9
- --radius-max: 999px;
10
-
11
- /* ===== Space ===== */
12
- --space-xs: 4px;
13
- --space-sm: 8px;
14
- --space-md: 12px;
15
- --space-lg: 16px;
16
- --space-xl: 24px;
17
- --space-2xl: 32px;
18
- --space-3xl: 48px;
19
- --space-4xl: 64px;
20
- --space-5xl: 96px;
21
- --gap: 32px;
22
-
23
- /* ===== Layout ===== */
24
- --container: 1120px;
25
- }
26
-
27
- .light {
28
- /* ===== Color ===== */
29
- --color-primary: #00a1a1;
30
- --color-on-primary: #ffffff;
31
- --color-primary-container: #9cf1f0;
32
- --color-on-primary-container: #004f4f;
33
-
34
- --color-secondary: #7b9695;
35
- --color-on-secondary: #ffffff;
36
- --color-secondary-container: #cce8e7;
37
- --color-on-secondary-container: #324b4b;
38
-
39
- --color-error: #ff5449;
40
- --color-on-error: #ffffff;
41
- --color-error-container: #ffdad6;
42
- --color-on-error-container: #93000a;
43
-
44
- --color-background: #f4fbfa;
45
- --color-on-background: #161d1d;
46
-
47
- --color-surface: #f4fbfabf;
48
- --color-on-surface: #161d1d;
49
- --color-on-surface-variant: #161d1d80;
50
- --color-surface-container: #e9efeebf;
51
-
52
- --color-border: #bbcccc;
53
- --color-scrim: rgba(129, 129, 129, 0.25);
54
-
55
- --color-shadow-l: rgba(255, 255, 255, 1);
56
- --color-shadow-d: rgba(0, 0, 0, 0.2);
57
-
58
- /* ===== Effect ===== */
59
- --blur: blur(8px);
60
-
61
- --shadow-sm: -2px -2px 2px 1px var(--color-shadow-l),
62
- 2px 2px 2px 1px var(--color-shadow-d);
63
-
64
- --shadow-sm-in: inset -2px -2px 2px 1px var(--color-shadow-l),
65
- inset 2px 2px 2px 1px var(--color-shadow-d);
66
-
67
- --shadow-md: -2px -2px 4px 2px var(--color-shadow-l),
68
- 2px 2px 4px 2px var(--color-shadow-d);
69
-
70
- --shadow-md-in: inset -4px -4px 4px var(--color-shadow-l),
71
- inset 4px 4px 4px var(--color-shadow-d);
72
-
73
- --shadow-lg: -4px -4px 16px 8px var(--color-shadow-l),
74
- 4px 4px 16px 8px var(--color-shadow-d);
75
- }
76
-
77
- .dark {
78
- --color-primary: #80d5d4;
79
- --color-on-primary: #003737;
80
- --color-primary-container: #004f4f;
81
- --color-on-primary-container: #9cf1f0;
82
-
83
- --color-secondary: #b0cccb;
84
- --color-on-secondary: #1b3534;
85
- --color-secondary-container: #324b4b;
86
- --color-on-secondary-container: #cce8e7;
87
-
88
- --color-error: #ffb4ab;
89
- --color-on-error: #690005;
90
- --color-error-container: #93000a;
91
- --color-on-error-container: #ffdad6;
92
-
93
- --color-background: #2b3a38;
94
- --color-on-background: #dde4e3;
95
-
96
- --color-surface: #1a2120bf;
97
- --color-on-surface: #dde4e3;
98
- --color-on-surface-variant: #dde4e380;
99
- --color-surface-container: #262d2d;
100
-
101
- --color-border: #889392;
102
- --color-scrim: rgba(0, 0, 0, 0.25);
103
-
104
- --color-shadow-l: rgba(255, 255, 255, 0.25);
105
- --color-shadow-d: rgba(0, 0, 0, 1);
106
-
107
- /* ===== Effect ===== */
108
- --blur: blur(8px);
109
-
110
- --shadow-sm: -2px -2px 2px 1px var(--color-shadow-l),
111
- 2px 2px 2px 1px var(--color-shadow-d);
112
-
113
- --shadow-sm-in: inset -2px -2px 2px 1px var(--color-shadow-l),
114
- inset 2px 2px 2px 1px var(--color-shadow-d);
115
-
116
- --shadow-md: -2px -2px 4px 2px var(--color-shadow-l),
117
- 2px 2px 4px 2px var(--color-shadow-d);
118
-
119
- --shadow-md-in: inset -4px -4px 4px var(--color-shadow-l),
120
- inset 4px 4px 4px var(--color-shadow-d);
121
-
122
- --shadow-lg: -4px -4px 16px 8px var(--color-shadow-l),
123
- 4px 4px 16px 8px var(--color-shadow-d);
124
- }