@x-plat/design-system 0.5.63 → 0.5.65
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/AutoResizeTextArea/index.cjs +118 -0
- package/dist/components/AutoResizeTextArea/index.css +46 -0
- package/dist/components/AutoResizeTextArea/index.d.cts +10 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +10 -0
- package/dist/components/AutoResizeTextArea/index.js +81 -0
- package/dist/components/ChatInput/index.cjs +72 -30
- package/dist/components/ChatInput/index.css +47 -0
- package/dist/components/ChatInput/index.js +71 -29
- package/dist/components/CheckBox/index.css +1 -0
- package/dist/components/Radio/index.css +1 -0
- package/dist/components/TextArea/index.cjs +16 -44
- package/dist/components/TextArea/index.css +26 -28
- package/dist/components/TextArea/index.d.cts +8 -1
- package/dist/components/TextArea/index.d.ts +8 -1
- package/dist/components/TextArea/index.js +16 -44
- package/dist/components/index.cjs +561 -545
- package/dist/components/index.css +75 -28
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +508 -493
- package/dist/index.cjs +585 -569
- package/dist/index.css +75 -28
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +530 -515
- package/package.json +1 -1
|
@@ -57,51 +57,23 @@ var clsx_default = clsx;
|
|
|
57
57
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
58
|
var TextArea = import_react.default.forwardRef(
|
|
59
59
|
(props, ref) => {
|
|
60
|
-
const {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
const handleOnChange = (e) => {
|
|
72
|
-
const val = e.target.value;
|
|
73
|
-
if (onChange) {
|
|
74
|
-
const event = {
|
|
75
|
-
...e,
|
|
76
|
-
target: { value: val }
|
|
77
|
-
};
|
|
78
|
-
onChange(event);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
import_react.default.useEffect(() => {
|
|
82
|
-
const el = localRef.current;
|
|
83
|
-
if (!el) return;
|
|
84
|
-
el.style.height = "0px";
|
|
85
|
-
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
86
|
-
el.style.height = `${nextHeight}px`;
|
|
87
|
-
}, [value]);
|
|
88
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrapper", className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
"div",
|
|
60
|
+
const {
|
|
61
|
+
className,
|
|
62
|
+
size = "md",
|
|
63
|
+
resize = "vertical",
|
|
64
|
+
rows = 3,
|
|
65
|
+
disabled,
|
|
66
|
+
...textareaProps
|
|
67
|
+
} = props;
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
"textarea",
|
|
90
70
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
...textareaProps,
|
|
99
|
-
ref: setRefs,
|
|
100
|
-
disabled,
|
|
101
|
-
value,
|
|
102
|
-
onChange: handleOnChange
|
|
103
|
-
}
|
|
104
|
-
)
|
|
71
|
+
...textareaProps,
|
|
72
|
+
ref,
|
|
73
|
+
rows,
|
|
74
|
+
disabled,
|
|
75
|
+
className: clsx_default("lib-xplat-textarea", size, disabled && "disabled"),
|
|
76
|
+
style: { resize }
|
|
105
77
|
}
|
|
106
78
|
) });
|
|
107
79
|
}
|
|
@@ -1,48 +1,46 @@
|
|
|
1
1
|
/* src/components/TextArea/textArea.scss */
|
|
2
|
-
.lib-xplat-textarea-
|
|
2
|
+
.lib-xplat-textarea-wrap {
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
|
|
5
|
+
width: 100%;
|
|
6
6
|
}
|
|
7
|
-
.lib-xplat-textarea-
|
|
8
|
-
|
|
9
|
-
align-items: center;
|
|
7
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea {
|
|
8
|
+
width: 100%;
|
|
10
9
|
border: 1px solid var(--semantic-border-default);
|
|
11
10
|
border-radius: var(--spacing-radius-md);
|
|
12
|
-
min-height: var(--spacing-control-height-md);
|
|
13
|
-
overflow: hidden;
|
|
14
11
|
background-color: var(--semantic-surface-neutral-default);
|
|
15
|
-
|
|
12
|
+
color: var(--semantic-text-subtle);
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
outline: none;
|
|
16
15
|
transition: border-color 0.15s, box-shadow 0.15s;
|
|
17
16
|
}
|
|
18
|
-
.lib-xplat-textarea-
|
|
17
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea.sm {
|
|
18
|
+
padding: var(--spacing-space-2) var(--spacing-space-3);
|
|
19
|
+
font-size: var(--semantic-typo-caption-1-r-size);
|
|
20
|
+
line-height: var(--semantic-typo-caption-1-r-lh);
|
|
21
|
+
}
|
|
22
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea.md {
|
|
23
|
+
padding: var(--spacing-space-2) var(--spacing-space-4);
|
|
24
|
+
font-size: var(--semantic-typo-label-2-m-size);
|
|
25
|
+
line-height: var(--semantic-typo-label-2-m-lh);
|
|
26
|
+
}
|
|
27
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea.lg {
|
|
28
|
+
padding: var(--spacing-space-3) var(--spacing-space-4);
|
|
29
|
+
font-size: var(--semantic-typo-label-1-m-size);
|
|
30
|
+
line-height: var(--semantic-typo-label-1-m-lh);
|
|
31
|
+
}
|
|
32
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea:hover:not(.disabled):not(:focus) {
|
|
19
33
|
border-color: var(--semantic-border-strong);
|
|
20
34
|
}
|
|
21
|
-
.lib-xplat-textarea-
|
|
35
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea:focus {
|
|
22
36
|
border-color: var(--semantic-interaction-focus-ring);
|
|
23
37
|
box-shadow: 0 0 0 2px var(--semantic-interaction-overlay-10);
|
|
24
38
|
}
|
|
25
|
-
.lib-xplat-textarea-
|
|
39
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea:not(:placeholder-shown):not(:focus) {
|
|
26
40
|
border-color: var(--semantic-border-strong);
|
|
27
41
|
}
|
|
28
|
-
.lib-xplat-textarea-
|
|
42
|
+
.lib-xplat-textarea-wrap .lib-xplat-textarea.disabled {
|
|
29
43
|
background-color: var(--semantic-surface-neutral-disabled);
|
|
30
44
|
cursor: not-allowed;
|
|
31
|
-
}
|
|
32
|
-
.lib-xplat-textarea-wrapper .lib-xplat-textarea > textarea {
|
|
33
|
-
border: none;
|
|
34
|
-
outline: none;
|
|
35
|
-
flex: 1;
|
|
36
|
-
padding-left: var(--spacing-space-4);
|
|
37
|
-
padding-right: var(--spacing-space-4);
|
|
38
|
-
width: 100%;
|
|
39
|
-
color: var(--semantic-text-subtle);
|
|
40
45
|
resize: none;
|
|
41
|
-
height: 1.5em;
|
|
42
|
-
font-size: var(--semantic-typo-label-2-m-size);
|
|
43
|
-
line-height: var(--semantic-typo-label-2-m-lh);
|
|
44
|
-
font-family: inherit;
|
|
45
|
-
}
|
|
46
|
-
.lib-xplat-textarea-wrapper .lib-xplat-textarea > textarea:disabled {
|
|
47
|
-
cursor: not-allowed;
|
|
48
46
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { T as TextareaAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type TextAreaSize = "sm" | "md" | "lg";
|
|
5
|
+
type TextAreaResize = "none" | "vertical" | "horizontal" | "both";
|
|
6
|
+
interface TextAreaProps extends Omit<TextareaAttributes, "size"> {
|
|
7
|
+
size?: TextAreaSize;
|
|
8
|
+
resize?: TextAreaResize;
|
|
9
|
+
rows?: number;
|
|
10
|
+
}
|
|
11
|
+
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
5
12
|
|
|
6
13
|
export { TextArea };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { T as TextareaAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type TextAreaSize = "sm" | "md" | "lg";
|
|
5
|
+
type TextAreaResize = "none" | "vertical" | "horizontal" | "both";
|
|
6
|
+
interface TextAreaProps extends Omit<TextareaAttributes, "size"> {
|
|
7
|
+
size?: TextAreaSize;
|
|
8
|
+
resize?: TextAreaResize;
|
|
9
|
+
rows?: number;
|
|
10
|
+
}
|
|
11
|
+
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
5
12
|
|
|
6
13
|
export { TextArea };
|
|
@@ -21,51 +21,23 @@ var clsx_default = clsx;
|
|
|
21
21
|
import { jsx } from "react/jsx-runtime";
|
|
22
22
|
var TextArea = React.forwardRef(
|
|
23
23
|
(props, ref) => {
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
const handleOnChange = (e) => {
|
|
36
|
-
const val = e.target.value;
|
|
37
|
-
if (onChange) {
|
|
38
|
-
const event = {
|
|
39
|
-
...e,
|
|
40
|
-
target: { value: val }
|
|
41
|
-
};
|
|
42
|
-
onChange(event);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
React.useEffect(() => {
|
|
46
|
-
const el = localRef.current;
|
|
47
|
-
if (!el) return;
|
|
48
|
-
el.style.height = "0px";
|
|
49
|
-
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
50
|
-
el.style.height = `${nextHeight}px`;
|
|
51
|
-
}, [value]);
|
|
52
|
-
return /* @__PURE__ */ jsx("div", { className: clsx_default("lib-xplat-textarea-wrapper", className), children: /* @__PURE__ */ jsx(
|
|
53
|
-
"div",
|
|
24
|
+
const {
|
|
25
|
+
className,
|
|
26
|
+
size = "md",
|
|
27
|
+
resize = "vertical",
|
|
28
|
+
rows = 3,
|
|
29
|
+
disabled,
|
|
30
|
+
...textareaProps
|
|
31
|
+
} = props;
|
|
32
|
+
return /* @__PURE__ */ jsx("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ jsx(
|
|
33
|
+
"textarea",
|
|
54
34
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
...textareaProps,
|
|
63
|
-
ref: setRefs,
|
|
64
|
-
disabled,
|
|
65
|
-
value,
|
|
66
|
-
onChange: handleOnChange
|
|
67
|
-
}
|
|
68
|
-
)
|
|
35
|
+
...textareaProps,
|
|
36
|
+
ref,
|
|
37
|
+
rows,
|
|
38
|
+
disabled,
|
|
39
|
+
className: clsx_default("lib-xplat-textarea", size, disabled && "disabled"),
|
|
40
|
+
style: { resize }
|
|
69
41
|
}
|
|
70
42
|
) });
|
|
71
43
|
}
|