lucentia-ui 1.0.1 → 1.1.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 -2
- package/dist/components/Button/Button.module.css +1 -0
- package/dist/components/Checkbox/Checkbox.module.css +1 -0
- package/dist/components/Menu/Menu.module.css +1 -0
- package/dist/components/Radio/Radio.module.css +1 -0
- package/dist/components/Select/Select.module.css +3 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Textarea/Textarea.js +23 -2
- package/dist/components/Textarea/Textarea.module.css +1 -0
- package/dist/components/Textarea/types.d.ts +1 -0
- package/dist/components/Typography/typography.module.css +2 -2
- package/dist/styles/tokens.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ export default function Example() {
|
|
|
85
85
|
---
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
###
|
|
88
|
+
### Dark Theme
|
|
89
89
|
|
|
90
90
|
Use ThemeProvider only when enabling dark mode or theme switching.
|
|
91
91
|
|
|
@@ -104,7 +104,7 @@ export default function App({ children }: { children: React.ReactNode }) {
|
|
|
104
104
|
}
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
##
|
|
107
|
+
## Component Design Policy
|
|
108
108
|
|
|
109
109
|
- **Respect native HTML elements**
|
|
110
110
|
- **props extends HTMLAttributes**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TextareaProps } from "./types";
|
|
2
|
-
export declare const Textarea: ({ state, size, className, rows, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Textarea: ({ state, size, className, rows, autoResize, value, onChange, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
2
4
|
import styles from "./Textarea.module.css";
|
|
3
5
|
import clsx from "clsx";
|
|
4
|
-
export const Textarea = ({ state = "default", size = "md", className, rows = 3, ...props }) => {
|
|
5
|
-
|
|
6
|
+
export const Textarea = ({ state = "default", size = "md", className, rows = 3, autoResize = false, value, onChange, ...props }) => {
|
|
7
|
+
const textareaRef = useRef(null);
|
|
8
|
+
const resize = () => {
|
|
9
|
+
const el = textareaRef.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
el.style.height = "auto";
|
|
13
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
14
|
+
};
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (autoResize) {
|
|
17
|
+
resize();
|
|
18
|
+
}
|
|
19
|
+
}, [value, autoResize]);
|
|
20
|
+
const handleChange = (e) => {
|
|
21
|
+
if (autoResize) {
|
|
22
|
+
resize();
|
|
23
|
+
}
|
|
24
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
25
|
+
};
|
|
26
|
+
return (_jsx("textarea", { ref: textareaRef, rows: rows, value: value, onChange: handleChange, className: clsx(styles.textarea, styles[state], styles[size], className), ...props }));
|
|
6
27
|
};
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
|
|
61
61
|
.body-md {
|
|
62
62
|
font-size: var(--font-size-16);
|
|
63
|
-
line-height: var(--line-
|
|
63
|
+
line-height: var(--line-comfort);
|
|
64
64
|
font-weight: var(--font-weight-medium);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.body-sm {
|
|
68
68
|
font-size: var(--font-size-14);
|
|
69
|
-
line-height: var(--line-
|
|
69
|
+
line-height: var(--line-comfort);
|
|
70
70
|
font-weight: var(--font-weight-medium);
|
|
71
71
|
}
|
|
72
72
|
|
package/dist/styles/tokens.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lucentia-ui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "React UI design token and component system based on neumorphism, featuring two color themes: light and dark.",
|
|
5
5
|
"homepage": "https://lucentia.rikiyamatsuda.com/en",
|
|
6
6
|
"main": "dist/index.js",
|