prometeo-design-system 2.7.5 → 2.7.6
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/TextArea.es.js
CHANGED
|
@@ -1,54 +1,66 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { c as
|
|
3
|
-
import * as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
import { j as k } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
+
import { c as A } from "./cn-B6yFEsav.js";
|
|
3
|
+
import * as a from "react";
|
|
4
|
+
import { forwardRef as E } from "react";
|
|
5
|
+
const M = E(
|
|
6
|
+
({
|
|
7
|
+
className: f,
|
|
8
|
+
autoResize: r = !1,
|
|
9
|
+
userResize: c = !0,
|
|
10
|
+
minRows: l = 3,
|
|
11
|
+
maxRows: n,
|
|
12
|
+
placeholder: d,
|
|
13
|
+
onChange: m,
|
|
14
|
+
value: h,
|
|
15
|
+
rows: p,
|
|
16
|
+
disabled: x = !1,
|
|
17
|
+
...g
|
|
18
|
+
// ← Para pasar las props nativas
|
|
19
|
+
}, t) => {
|
|
20
|
+
const o = a.useRef(null), b = a.useCallback(
|
|
21
|
+
(e) => {
|
|
22
|
+
o.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
|
|
23
|
+
},
|
|
24
|
+
[t]
|
|
25
|
+
), s = a.useCallback(() => {
|
|
26
|
+
const e = o.current;
|
|
27
|
+
if (!e || !r) return;
|
|
28
|
+
e.style.height = "auto";
|
|
29
|
+
const C = e.scrollHeight, i = Number.parseInt(getComputedStyle(e).lineHeight) || 20, j = l * i + 16;
|
|
30
|
+
let u = Math.max(C, j);
|
|
31
|
+
if (n) {
|
|
32
|
+
const N = n * i + 16;
|
|
33
|
+
u = Math.min(u, N);
|
|
34
|
+
}
|
|
35
|
+
e.style.height = `${u}px`;
|
|
36
|
+
}, [r, l, n]), y = (e) => {
|
|
37
|
+
m?.(e), s();
|
|
38
|
+
};
|
|
39
|
+
a.useEffect(() => {
|
|
40
|
+
s();
|
|
41
|
+
}, [s]);
|
|
42
|
+
const H = () => c ? r ? "resize-x" : "resize" : "resize-none";
|
|
43
|
+
return /* @__PURE__ */ k.jsx(
|
|
44
|
+
"textarea",
|
|
45
|
+
{
|
|
46
|
+
ref: b,
|
|
47
|
+
"data-slot": "textarea",
|
|
48
|
+
className: A(
|
|
49
|
+
"placeholder:text-neutral-medium-default text-neutral-default-default appearance-none border border-neutral-default-default focus:border-primary-default-default flex w-full rounded-md px-3 py-2 outline-none disabled:cursor-default disabled:opacity-50 md:text-sm",
|
|
50
|
+
H(),
|
|
51
|
+
f
|
|
52
|
+
),
|
|
53
|
+
onChange: y,
|
|
54
|
+
rows: r ? l : p,
|
|
55
|
+
value: h,
|
|
56
|
+
placeholder: d,
|
|
57
|
+
disabled: x,
|
|
58
|
+
...g
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
M.displayName = "TextArea";
|
|
52
64
|
export {
|
|
53
|
-
|
|
65
|
+
M as default
|
|
54
66
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export interface TextAreaProps {
|
|
2
|
+
export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
|
|
3
3
|
autoResize?: boolean;
|
|
4
4
|
userResize?: boolean;
|
|
5
5
|
minRows?: number;
|
|
@@ -11,5 +11,5 @@ export interface TextAreaProps {
|
|
|
11
11
|
rows?: number;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
}
|
|
14
|
-
declare
|
|
14
|
+
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
15
15
|
export default TextArea;
|