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.
@@ -1,54 +1,66 @@
1
- import { j as C } from "./jsx-runtime-DKDX3adD.js";
2
- import { c as j } from "./cn-B6yFEsav.js";
3
- import * as s from "react";
4
- function N({
5
- className: i,
6
- autoResize: t = !1,
7
- userResize: f = !0,
8
- minRows: r = 3,
9
- maxRows: a,
10
- placeholder: d,
11
- onChange: c,
12
- value: h,
13
- rows: m,
14
- disabled: x = !1
15
- }) {
16
- const u = s.useRef(null), l = s.useCallback(() => {
17
- const e = u.current;
18
- if (!e || !t) return;
19
- e.style.height = "auto";
20
- const H = e.scrollHeight, o = Number.parseInt(getComputedStyle(e).lineHeight) || 20, b = r * o + 16;
21
- let n = Math.max(H, b);
22
- if (a) {
23
- const y = a * o + 16;
24
- n = Math.min(n, y);
25
- }
26
- e.style.height = `${n}px`;
27
- }, [t, r, a]), p = (e) => {
28
- c?.(e), l();
29
- };
30
- s.useEffect(() => {
31
- l();
32
- }, [l]);
33
- const g = () => f ? t ? "resize-x" : "resize" : "resize-none";
34
- return /* @__PURE__ */ C.jsx(
35
- "textarea",
36
- {
37
- ref: u,
38
- "data-slot": "textarea",
39
- className: j(
40
- "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",
41
- g(),
42
- i
43
- ),
44
- onChange: p,
45
- rows: t ? r : m,
46
- value: h,
47
- placeholder: d,
48
- disabled: x
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
- N as default
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 function TextArea({ className, autoResize, userResize, minRows, maxRows, placeholder, onChange, value, rows, disabled }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
14
+ declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
15
15
  export default TextArea;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prometeo-design-system",
3
3
  "private": false,
4
- "version": "2.7.5",
4
+ "version": "2.7.6",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",