prometeo-design-system 4.5.0 → 4.6.1
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/DialogModal.es.js +47 -44
- package/dist/Header.es.js +15 -15
- package/dist/TextArea.es.js +97 -55
- package/dist/components/Dialog/Dialog.d.ts +1 -0
- package/dist/components/TextArea/TextArea.d.ts +12 -2
- package/package.json +1 -1
package/dist/DialogModal.es.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { j as o } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
f
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { forwardRef as w, memo as r, useState as C, useRef as x, useCallback as n, useImperativeHandle as R } from "react";
|
|
3
|
+
import { createPortal as O } from "react-dom";
|
|
4
|
+
import { c as b } from "./cn-B6yFEsav.js";
|
|
5
|
+
const y = w(
|
|
6
|
+
({ children: e, onClose: t, className: s, attachToParent: c = !1 }, i) => {
|
|
7
|
+
const [l, g] = C(!1), [u, f] = C(null), m = x(t), d = x(u);
|
|
8
|
+
m.current = t, d.current = u;
|
|
9
|
+
const D = n((a) => {
|
|
10
|
+
f(a ?? null), g(!0);
|
|
11
|
+
}, []), p = n(() => {
|
|
12
|
+
g(!1), m.current?.(d.current), setTimeout(() => f(null), 300);
|
|
12
13
|
}, []);
|
|
13
|
-
|
|
14
|
+
R(
|
|
14
15
|
i,
|
|
15
16
|
() => ({
|
|
16
|
-
open:
|
|
17
|
-
close:
|
|
18
|
-
isOpen:
|
|
19
|
-
getContext: () =>
|
|
17
|
+
open: D,
|
|
18
|
+
close: p,
|
|
19
|
+
isOpen: l,
|
|
20
|
+
getContext: () => d.current
|
|
20
21
|
}),
|
|
21
|
-
[
|
|
22
|
-
)
|
|
22
|
+
[D, p, l]
|
|
23
|
+
);
|
|
24
|
+
const j = /* @__PURE__ */ o.jsx(o.Fragment, { children: l && /* @__PURE__ */ o.jsxs(
|
|
23
25
|
"div",
|
|
24
26
|
{
|
|
25
27
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-[1.5px]",
|
|
26
|
-
onClick:
|
|
28
|
+
onClick: p,
|
|
27
29
|
children: [
|
|
28
30
|
/* @__PURE__ */ o.jsx(
|
|
29
31
|
"div",
|
|
@@ -36,9 +38,9 @@ const C = y(
|
|
|
36
38
|
"div",
|
|
37
39
|
{
|
|
38
40
|
onClick: (a) => a.stopPropagation(),
|
|
39
|
-
className:
|
|
41
|
+
className: b(
|
|
40
42
|
"bg-neutral-default-default w-3/4 h-3/4 xl:w-3/4 xl:h-10/12 rounded-lg shadow-lg border-neutral-strong-default border relative p-6",
|
|
41
|
-
|
|
43
|
+
s
|
|
42
44
|
),
|
|
43
45
|
children: typeof e == "function" ? e(u) : e
|
|
44
46
|
}
|
|
@@ -46,39 +48,40 @@ const C = y(
|
|
|
46
48
|
]
|
|
47
49
|
}
|
|
48
50
|
) });
|
|
51
|
+
return c ? j : O(j, document.body);
|
|
49
52
|
}
|
|
50
53
|
);
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const h = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
|
|
57
|
-
h.displayName = "DialogHeader";
|
|
54
|
+
y.displayName = "Dialog";
|
|
55
|
+
const N = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: /* @__PURE__ */ o.jsx("div", { className: b("flex flex-col gap-4 h-full"), children: e }) }));
|
|
56
|
+
N.displayName = "DialogContent";
|
|
57
|
+
const h = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("h1", { className: t, children: e }));
|
|
58
|
+
h.displayName = "DialogTitle";
|
|
58
59
|
const v = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
|
|
59
|
-
v.displayName = "
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
v.displayName = "DialogHeader";
|
|
61
|
+
const k = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
|
|
62
|
+
k.displayName = "DialogFooter";
|
|
63
|
+
const F = Object.assign(y, {
|
|
64
|
+
Content: N,
|
|
65
|
+
Header: v,
|
|
66
|
+
Footer: k,
|
|
67
|
+
Title: h
|
|
65
68
|
});
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const e = x(null), t =
|
|
69
|
-
e.current?.open(
|
|
70
|
-
}, []),
|
|
69
|
+
F.displayName = "DialogModal";
|
|
70
|
+
const I = () => {
|
|
71
|
+
const e = x(null), t = n((l) => {
|
|
72
|
+
e.current?.open(l);
|
|
73
|
+
}, []), s = n(() => {
|
|
71
74
|
e.current?.close();
|
|
72
|
-
}, []),
|
|
75
|
+
}, []), c = n(() => e.current?.isOpen ?? !1, []), i = n(() => e.current?.getContext() ?? null, []);
|
|
73
76
|
return {
|
|
74
77
|
ref: e,
|
|
75
78
|
open: t,
|
|
76
|
-
close:
|
|
77
|
-
isOpen:
|
|
78
|
-
getContext:
|
|
79
|
+
close: s,
|
|
80
|
+
isOpen: c,
|
|
81
|
+
getContext: i
|
|
79
82
|
};
|
|
80
83
|
};
|
|
81
84
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
F as default,
|
|
86
|
+
I as useDialogControl
|
|
84
87
|
};
|
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
|
|
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:
|
|
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:
|
|
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
|
-
|
|
15
|
-
|
|
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:
|
|
19
|
-
"flex items-center md:items-start md:flex-col leading-6 h-full justify-center
|
|
20
|
-
|
|
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
|
-
|
|
23
|
-
/* @__PURE__ */ t.jsxs("div", { className: "flex flex-col leading-6 justify-center md:px-6", children: [
|
|
24
|
-
|
|
25
|
-
e && /* @__PURE__ */ t.jsx("h1", { className:
|
|
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
|
-
|
|
28
|
+
s && /* @__PURE__ */ t.jsx("div", { className: "shrink relative", children: s })
|
|
29
29
|
]
|
|
30
30
|
}
|
|
31
|
-
), u = f(c, (e,
|
|
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
|
package/dist/TextArea.es.js
CHANGED
|
@@ -1,66 +1,108 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { c as
|
|
3
|
-
import * as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
const
|
|
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:
|
|
8
|
-
autoResize:
|
|
9
|
-
userResize:
|
|
10
|
-
minRows:
|
|
11
|
-
maxRows:
|
|
12
|
-
placeholder:
|
|
13
|
-
onChange:
|
|
14
|
-
value:
|
|
15
|
-
rows:
|
|
16
|
-
disabled:
|
|
17
|
-
|
|
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
|
-
},
|
|
20
|
-
const
|
|
20
|
+
}, l) => {
|
|
21
|
+
const y = s.useRef(null), r = s.useRef(null), L = s.useCallback(
|
|
21
22
|
(e) => {
|
|
22
|
-
|
|
23
|
+
y.current = e, typeof l == "function" ? l(e) : l && (l.current = e);
|
|
23
24
|
},
|
|
24
|
-
[
|
|
25
|
-
),
|
|
26
|
-
const e =
|
|
27
|
-
if (!e || !
|
|
25
|
+
[l]
|
|
26
|
+
), h = s.useCallback(() => {
|
|
27
|
+
const e = y.current;
|
|
28
|
+
if (!e || !a) return;
|
|
28
29
|
e.style.height = "auto";
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
if (n) {
|
|
32
|
-
const
|
|
33
|
-
|
|
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 = `${
|
|
36
|
-
}, [
|
|
37
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
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
|
-
|
|
107
|
+
q as default
|
|
66
108
|
};
|
|
@@ -3,6 +3,7 @@ interface DialogProps<TContext = unknown> {
|
|
|
3
3
|
children: React.ReactNode | ((context: TContext | null) => React.ReactNode);
|
|
4
4
|
onClose?: (context: TContext | null) => void;
|
|
5
5
|
className?: string;
|
|
6
|
+
attachToParent?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface DialogHandle<TContext = unknown> {
|
|
8
9
|
open: (context?: TContext) => void;
|
|
@@ -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
|
-
|
|
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;
|