lucentia-ui 1.0.0 → 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 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**
@@ -3,6 +3,7 @@
3
3
  height: fit-content;
4
4
  font-family: var(--font);
5
5
  font-weight: var(--font-weight-medium);
6
+ line-height: var(--line-normal);
6
7
  border: 2px solid transparent;
7
8
  border-radius: var(--radius-sm);
8
9
  cursor: pointer;
@@ -9,6 +9,7 @@
9
9
  cursor: pointer;
10
10
  font-family: var(--font);
11
11
  font-weight: var(--font-weight-medium);
12
+ line-height: var(--line-normal);
12
13
  color: var(--color-on-surface);
13
14
  }
14
15
 
@@ -22,6 +22,7 @@
22
22
 
23
23
  font-family: var(--font);
24
24
  font-weight: var(--font-weight-medium);
25
+ line-height: var(--line-normal);
25
26
  text-decoration: none;
26
27
  color: var(--color-on-surface);
27
28
 
@@ -5,6 +5,7 @@
5
5
  cursor: pointer;
6
6
  font-family: var(--font);
7
7
  font-weight: var(--font-weight-medium);
8
+ line-height: var(--line-normal);
8
9
  color: var(--color-on-surface);
9
10
  }
10
11
 
@@ -12,7 +12,9 @@
12
12
  color: inherit;
13
13
  border: none;
14
14
  padding: 0;
15
- font: inherit;
15
+ font-family: var(--font);
16
+ font-weight: var(--font-weight-medium);
17
+ line-height: var(--line-normal);
16
18
  cursor: pointer;
17
19
  outline: none;
18
20
  /* 以降、既存のスタイルを調整 */
@@ -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
- return (_jsx("textarea", { rows: rows, className: clsx(styles.textarea, styles[state], styles[size], className), ...props }));
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
  };
@@ -1,5 +1,6 @@
1
1
  .textarea {
2
2
  font-family: var(--font);
3
+ line-height: var(--line-normal);
3
4
  padding: var(--space-md) var(--space-lg);
4
5
  border-radius: var(--radius-sm);
5
6
  border: 2px solid var(--color-surface);
@@ -3,4 +3,5 @@ export type size = "sm" | "md";
3
3
  export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
4
4
  state?: TextareaState;
5
5
  size?: size;
6
+ autoResize?: boolean;
6
7
  }
@@ -4,4 +4,4 @@ export type AsProp<E extends React.ElementType> = {
4
4
  };
5
5
  export type PolymorphicProps<E extends React.ElementType, P> = P & AsProp<E> & Omit<React.ComponentPropsWithoutRef<E>, keyof P | "as">;
6
6
  export type TypographyVariant = "display-lg" | "display-md" | "display-sm" | "heading-xl" | "heading-lg" | "heading-md" | "heading-sm" | "heading-xs" | "body-md" | "body-sm" | "label-md" | "label-sm";
7
- export type TypographyColor = "default" | "muted" | "primary" | "secondary" | "error" | "success";
7
+ export type TypographyColor = "default" | "surface" | "muted" | "primary" | "secondary" | "error" | "success";
@@ -60,13 +60,13 @@
60
60
 
61
61
  .body-md {
62
62
  font-size: var(--font-size-16);
63
- line-height: var(--line-normal);
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-normal);
69
+ line-height: var(--line-comfort);
70
70
  font-weight: var(--font-weight-medium);
71
71
  }
72
72
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  --line-tight: 1.2;
15
15
  --line-snug: 1.35;
16
- --line-normal: 1.6;
16
+ --line-comfort: 1.7;
17
17
 
18
18
  --font-weight-regular: 400;
19
19
  --font-weight-medium: 500;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucentia-ui",
3
- "version": "1.0.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",