prometeo-design-system 4.5.0 → 4.6.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/dist/Header.es.js CHANGED
@@ -1,34 +1,34 @@
1
1
  import { j as t } from "./jsx-runtime-GkKLlHH4.js";
2
- import { c as i } from "./cn-B6yFEsav.js";
2
+ import { c as a } from "./cn-B6yFEsav.js";
3
3
  import { motion as n } from "framer-motion";
4
4
  import { memo as f } from "react";
5
- const c = ({ title: e, subtitle: s, children: l, className: m, subtitleClassName: r, titleClassName: d, mainActionSlot: a }) => /* @__PURE__ */ t.jsxs(
5
+ const c = ({ title: e, subtitle: l, children: s, className: r, subtitleClassName: d, titleClassName: m, mainActionSlot: i }) => /* @__PURE__ */ t.jsxs(
6
6
  n.header,
7
7
  {
8
8
  initial: { opacity: 0, y: -10 },
9
9
  animate: { opacity: 1, y: 0 },
10
10
  transition: { duration: 0.6, ease: "easeOut" },
11
- className: i(
11
+ className: a(
12
12
  "flex items-center sm:min-h-20 md:min-h-24 lg:min-h-28 xl:min-h-32 2xl:min-h-36 overflow-hidden px-4 md:px-0 py-2 md:py-3",
13
- "flex justify-between items-center w-full",
14
- a && "px-1",
15
- m
13
+ "flex justify-between items-center w-full max-w-full overflow-hidden",
14
+ i && "px-1",
15
+ r
16
16
  ),
17
17
  children: [
18
- /* @__PURE__ */ t.jsxs("div", { className: i(
19
- "flex items-center md:items-start md:flex-col leading-6 h-full justify-center min-w-max",
20
- a && "justify-start gap-1"
18
+ /* @__PURE__ */ t.jsxs("div", { className: a(
19
+ "flex items-center md:items-start md:flex-col leading-6 h-full justify-center overflow-hidden p-1 ",
20
+ i && "justify-start gap-1 w-full"
21
21
  ), children: [
22
- a && /* @__PURE__ */ t.jsx("div", { className: "md:px-3", children: typeof a == "function" ? a() : a }),
23
- /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col leading-6 justify-center md:px-6", children: [
24
- s && /* @__PURE__ */ t.jsx("h3", { className: i(" prometeo-fonts-body-medium text-neutral-medium-default ", r), children: s }),
25
- e && /* @__PURE__ */ t.jsx("h1", { className: i("prometeo-fonts-headline-small text-neutral-strong-default", d), children: e })
22
+ i && /* @__PURE__ */ t.jsx("div", { className: "md:px-3", children: typeof i == "function" ? i() : i }),
23
+ /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col leading-6 justify-center md:px-6 relative overflow-hidden ", children: [
24
+ l && /* @__PURE__ */ t.jsx("h3", { className: a(" prometeo-fonts-body-medium text-neutral-medium-default line-clamp-1 text-nowrap overflow-hidden text-ellipsis w-full", d), children: l }),
25
+ e && /* @__PURE__ */ t.jsx("h1", { className: a("prometeo-fonts-headline-small text-neutral-strong-default line-clamp-1 text-nowrap overflow-hidden text-ellipsis w-full wrap-break-word", m), children: e })
26
26
  ] })
27
27
  ] }),
28
- l && /* @__PURE__ */ t.jsx("div", { className: "bg-red-400 px-2", children: l })
28
+ s && /* @__PURE__ */ t.jsx("div", { className: "shrink relative", children: s })
29
29
  ]
30
30
  }
31
- ), u = f(c, (e, s) => e.title !== s.title || e.subtitle !== s.subtitle || e.className !== s.className ? !1 : e.children !== s.children ? !e.children && !s.children : !0);
31
+ ), u = f(c, (e, l) => e.title !== l.title || e.subtitle !== l.subtitle || e.className !== l.className ? !1 : e.children !== l.children ? !e.children && !l.children : !0);
32
32
  u.displayName = "Header";
33
33
  export {
34
34
  u as default
@@ -1,66 +1,108 @@
1
- import { j as k } from "./jsx-runtime-GkKLlHH4.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(
1
+ import { j as o } from "./jsx-runtime-GkKLlHH4.js";
2
+ import { c as i } from "./cn-B6yFEsav.js";
3
+ import * as s from "react";
4
+ import { forwardRef as V, Children as _, isValidElement as $ } from "react";
5
+ const b = V(
6
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
7
+ className: t,
8
+ autoResize: a = !0,
9
+ userResize: f = !1,
10
+ minRows: d = 1,
11
+ maxRows: u,
12
+ placeholder: H,
13
+ onChange: v,
14
+ value: S,
15
+ rows: n,
16
+ disabled: k = !1,
17
+ children: m,
18
+ ...A
18
19
  // ← Para pasar las props nativas
19
- }, t) => {
20
- const o = a.useRef(null), b = a.useCallback(
20
+ }, l) => {
21
+ const y = s.useRef(null), r = s.useRef(null), L = s.useCallback(
21
22
  (e) => {
22
- o.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
23
+ y.current = e, typeof l == "function" ? l(e) : l && (l.current = e);
23
24
  },
24
- [t]
25
- ), s = a.useCallback(() => {
26
- const e = o.current;
27
- if (!e || !r) return;
25
+ [l]
26
+ ), h = s.useCallback(() => {
27
+ const e = y.current;
28
+ if (!e || !a) return;
28
29
  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);
30
+ const F = e.scrollHeight, x = Number.parseInt(getComputedStyle(e).lineHeight) || 16, I = Math.min((n ?? d) * x, r.current?.clientHeight || 0);
31
+ let c = Math.max(F, I);
32
+ if (u || n) {
33
+ const O = (u || n || 1) * x;
34
+ c = Math.min(c, O);
34
35
  }
35
- e.style.height = `${u}px`;
36
- }, [r, l, n]), y = (e) => {
37
- m?.(e), s();
36
+ e.style.height = `${c}px`, c > x + 12 && (e.style.alignContent = "start");
37
+ }, [a, d, u]), R = () => {
38
+ r.current?.classList.remove("border-neutral-default-default"), r.current?.classList.add("border-primary-default-default");
39
+ }, E = () => {
40
+ r.current?.classList.remove("border-primary-default-default"), r.current?.classList.add("border-neutral-default-default");
41
+ }, z = (e) => {
42
+ v?.(e), h();
38
43
  };
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
44
+ s.useEffect(() => {
45
+ h();
46
+ }, [h]);
47
+ const M = () => f ? a ? "resize-x" : "resize" : "resize-none", T = typeof m == "function" ? m() : m, B = _.toArray(T);
48
+ let g = null, p = null;
49
+ return B.forEach((e) => {
50
+ if ($(e)) {
51
+ if (e.type === j && !g) {
52
+ g = e;
53
+ return;
54
+ }
55
+ if (e.type === C && !p) {
56
+ p = e;
57
+ return;
58
+ }
59
59
  }
60
- );
60
+ }), /* @__PURE__ */ o.jsxs("div", { ref: r, className: i(
61
+ "transition-all duration-300 ease-in-out",
62
+ "border border-neutral-default-default px-3 rounded-lg",
63
+ "flex gap-1 items-stretch",
64
+ "relative",
65
+ "overflow-auto prometeo-scrollbar-thin-weak"
66
+ ), children: [
67
+ g,
68
+ /* @__PURE__ */ o.jsx(
69
+ "textarea",
70
+ {
71
+ ref: L,
72
+ "data-slot": "textarea",
73
+ className: i(
74
+ // 'border border-amber-400/30',
75
+ "flex-2 shrink-0 min-w-min h-fit my-3 ",
76
+ "prometeo-fonts-body-large resize-none",
77
+ "placeholder:text-neutral-medium-default text-neutral-default-default appearance-none",
78
+ "content-center",
79
+ "outline-none",
80
+ "prometeo-scrollbar-thin-weak",
81
+ M(),
82
+ t
83
+ ),
84
+ onChange: z,
85
+ onFocus: R,
86
+ onBlur: E,
87
+ rows: n ?? d,
88
+ value: S,
89
+ placeholder: H,
90
+ disabled: k,
91
+ ...A
92
+ }
93
+ ),
94
+ p
95
+ ] });
61
96
  }
62
- );
63
- M.displayName = "TextArea";
97
+ ), N = (t) => {
98
+ const { children: a, className: f } = t;
99
+ return /* @__PURE__ */ o.jsx("div", { className: i("slot", f), children: a });
100
+ }, j = (t) => /* @__PURE__ */ o.jsx(N, { ...t, className: i("left-slot flex gap-1 items-center py-3", t?.className) }), C = (t) => /* @__PURE__ */ o.jsx(N, { ...t, className: i("right-slot flex gap-1 items-end py-3", t?.className) }), q = Object.assign(b, {
101
+ Root: b,
102
+ LeftSlot: j,
103
+ RightSlot: C
104
+ });
105
+ q.displayName = "TextArea";
64
106
  export {
65
- M as default
107
+ q as default
66
108
  };
@@ -1,5 +1,6 @@
1
+ import { ReactNode } from 'react';
1
2
  import * as React from "react";
2
- export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
3
+ export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "children"> {
3
4
  autoResize?: boolean;
4
5
  userResize?: boolean;
5
6
  minRows?: number;
@@ -10,6 +11,15 @@ export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTex
10
11
  placeholder?: string;
11
12
  rows?: number;
12
13
  disabled?: boolean;
14
+ children?: ReactNode | (() => ReactNode);
13
15
  }
14
- declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
16
+ type SlotProps = {
17
+ children: React.ReactNode;
18
+ className?: string;
19
+ };
20
+ declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>> & {
21
+ Root: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
22
+ LeftSlot: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
23
+ RightSlot: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
24
+ };
15
25
  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": "4.5.0",
4
+ "version": "4.6.0",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",