prometeo-design-system 5.2.1 → 5.3.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/DialogModal.es.js +124 -124
- package/dist/PyrionLayout.es.js +869 -892
- package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +3 -0
- package/dist/components/NavigationDrawer/NavigationDrawerLeftSlot.d.ts +3 -0
- package/dist/components/PyrionNavigationDrawer/PLHeader.d.ts +1 -5
- package/dist/components/PyrionNavigationDrawer/PLayoutBase.d.ts +1 -0
- package/dist/components/PyrionNavigationDrawer/PyrionLayout.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/DialogModal.es.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { j as a } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { c as
|
|
5
|
-
import { c as
|
|
6
|
-
const
|
|
7
|
-
({ children: r, onClose:
|
|
8
|
-
const [
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
}, []),
|
|
13
|
-
|
|
2
|
+
import { forwardRef as ye, memo as X, useState as ae, useRef as $, useCallback as w, useImperativeHandle as Ce, Children as P, isValidElement as G, createElement as D, cloneElement as le } from "react";
|
|
3
|
+
import { createPortal as be } from "react-dom";
|
|
4
|
+
import { c as u } from "./cn-B6yFEsav.js";
|
|
5
|
+
import { c as ve } from "./index-BOQuZ0gG.js";
|
|
6
|
+
const se = ye(
|
|
7
|
+
({ children: r, onClose: i, className: f, attachToParent: d = !1, zindex: p = 40, debugMode: t = !1, safeMarginSize: m = 24, title: E, scroll: c = "content", size: de = "medium" }, ie) => {
|
|
8
|
+
const [k, V] = ae(!1), [W, K] = ae(null), L = $(i), B = $(W);
|
|
9
|
+
L.current = i, B.current = W;
|
|
10
|
+
const U = w((g) => {
|
|
11
|
+
K(g ?? null), V(!0);
|
|
12
|
+
}, []), F = w(() => {
|
|
13
|
+
V(!1), L.current?.(B.current), setTimeout(() => K(null), 300);
|
|
14
14
|
}, []);
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
Ce(
|
|
16
|
+
ie,
|
|
17
17
|
() => ({
|
|
18
|
-
open:
|
|
19
|
-
close:
|
|
20
|
-
isOpen:
|
|
21
|
-
getContext: () =>
|
|
18
|
+
open: U,
|
|
19
|
+
close: F,
|
|
20
|
+
isOpen: k,
|
|
21
|
+
getContext: () => B.current
|
|
22
22
|
}),
|
|
23
|
-
[
|
|
23
|
+
[U, F, k]
|
|
24
24
|
);
|
|
25
|
-
const
|
|
25
|
+
const fe = ve("max-h-[calc(100%-80px)]", {
|
|
26
26
|
variants: {
|
|
27
27
|
size: {
|
|
28
28
|
medium: " max-w-[min(740px,calc(100%-32px))]",
|
|
@@ -30,9 +30,9 @@ const oe = he(
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
let
|
|
34
|
-
typeof r == "function" ? (
|
|
35
|
-
const
|
|
33
|
+
let I, R;
|
|
34
|
+
typeof r == "function" ? (I = r(W), R = P.toArray(I)) : (I = r, R = P.toArray(I));
|
|
35
|
+
const pe = (g) => {
|
|
36
36
|
const e = {
|
|
37
37
|
headerProps: null,
|
|
38
38
|
titleContent: null,
|
|
@@ -47,17 +47,17 @@ const oe = he(
|
|
|
47
47
|
footerExpandX: !1,
|
|
48
48
|
footerExpandY: !1
|
|
49
49
|
}
|
|
50
|
-
},
|
|
51
|
-
if (!
|
|
50
|
+
}, j = (n) => {
|
|
51
|
+
if (!G(n)) return;
|
|
52
52
|
const o = n.props;
|
|
53
|
-
n.type === C ? (e.allExpandInfo.headerExpandX = e.allExpandInfo.headerExpandX || !!o?.expandX, e.allExpandInfo.headerExpandY = e.allExpandInfo.headerExpandY || !!o?.expandY) : n.type === y ? (e.allExpandInfo.contentExpandX = e.allExpandInfo.contentExpandX || !!o?.expandX, e.allExpandInfo.contentExpandY = e.allExpandInfo.contentExpandY || !!o?.expandY) : n.type === b && (e.allExpandInfo.footerExpandX = e.allExpandInfo.footerExpandX || !!o?.expandX, e.allExpandInfo.footerExpandY = e.allExpandInfo.footerExpandY || !!o?.expandY), o?.children &&
|
|
53
|
+
n.type === C ? (e.allExpandInfo.headerExpandX = e.allExpandInfo.headerExpandX || !!o?.expandX, e.allExpandInfo.headerExpandY = e.allExpandInfo.headerExpandY || !!o?.expandY) : n.type === y ? (e.allExpandInfo.contentExpandX = e.allExpandInfo.contentExpandX || !!o?.expandX, e.allExpandInfo.contentExpandY = e.allExpandInfo.contentExpandY || !!o?.expandY) : n.type === b && (e.allExpandInfo.footerExpandX = e.allExpandInfo.footerExpandX || !!o?.expandX, e.allExpandInfo.footerExpandY = e.allExpandInfo.footerExpandY || !!o?.expandY), o?.children && P.toArray(o.children).forEach(j);
|
|
54
54
|
};
|
|
55
55
|
return g.forEach((n) => {
|
|
56
|
-
if (
|
|
56
|
+
if (j(n), !G(n)) {
|
|
57
57
|
e.middleChildren.push(n);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
if (n.type ===
|
|
60
|
+
if (n.type === N && !e.titleContent) {
|
|
61
61
|
e.titleContent = n;
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
@@ -78,71 +78,71 @@ const oe = he(
|
|
|
78
78
|
}
|
|
79
79
|
e.middleChildren.push(n);
|
|
80
80
|
}), e;
|
|
81
|
-
},
|
|
82
|
-
const o = (
|
|
83
|
-
if (!
|
|
84
|
-
return
|
|
85
|
-
const l =
|
|
86
|
-
if (
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
if (
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
if (
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
if (
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
if (
|
|
95
|
-
const
|
|
96
|
-
return
|
|
97
|
-
key:
|
|
98
|
-
...
|
|
99
|
-
className:
|
|
100
|
-
}, ...
|
|
81
|
+
}, ce = (g, e, j, n) => {
|
|
82
|
+
const o = (l, T) => {
|
|
83
|
+
if (!G(l))
|
|
84
|
+
return l;
|
|
85
|
+
const s = l.props, v = l.key ?? `dialog-child-${T}`;
|
|
86
|
+
if (l.type === N)
|
|
87
|
+
return /* @__PURE__ */ D(N, { ...s, debugMode: t, key: v }, s.children);
|
|
88
|
+
if (l.type === C)
|
|
89
|
+
return /* @__PURE__ */ D(C, { ...s, debugMode: t, expandWeight: e, key: v }, s.children);
|
|
90
|
+
if (l.type === y)
|
|
91
|
+
return /* @__PURE__ */ D(y, { ...s, debugMode: t, scroll: c, expandWeight: j, key: v }, s.children);
|
|
92
|
+
if (l.type === b)
|
|
93
|
+
return /* @__PURE__ */ D(b, { ...s, debugMode: t, expandWeight: n, key: v }, s.children);
|
|
94
|
+
if (l.type === "form") {
|
|
95
|
+
const A = s?.children ? P.toArray(s.children).map((H, S) => o(H, S)) : [];
|
|
96
|
+
return le(l, {
|
|
97
|
+
key: v,
|
|
98
|
+
...s,
|
|
99
|
+
className: u(s?.className, "contents")
|
|
100
|
+
}, ...A);
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
104
|
-
return
|
|
102
|
+
if (s?.children) {
|
|
103
|
+
const A = P.toArray(s.children).map((H, S) => o(H, S));
|
|
104
|
+
return le(l, { key: v }, ...A);
|
|
105
105
|
}
|
|
106
|
-
return
|
|
106
|
+
return l;
|
|
107
107
|
};
|
|
108
|
-
return g.map(o);
|
|
108
|
+
return g.map((l, T) => o(l, T));
|
|
109
109
|
};
|
|
110
|
-
let { headerProps:
|
|
111
|
-
!h && E && (h = { title: E, children: null },
|
|
110
|
+
let { headerProps: _, titleContent: Y, contentProps: q, footerProps: J, middleChildren: xe, allExpandInfo: x } = pe(R), h = _ ? { ..._ } : null, z = q ? { ...q } : null, O = J ? { ...J } : null;
|
|
111
|
+
!h && E && (h = { title: E, children: null }, Y = null), h && Y && h.title && (h = {
|
|
112
112
|
...h,
|
|
113
113
|
title: "",
|
|
114
|
-
children:
|
|
115
|
-
},
|
|
116
|
-
const
|
|
114
|
+
children: Y
|
|
115
|
+
}, Y = null);
|
|
116
|
+
const ue = x.headerExpandX || x.contentExpandX || x.footerExpandX, Q = x.headerExpandY || x.contentExpandY || x.footerExpandY, he = [x.headerExpandY, x.contentExpandY, x.footerExpandY].filter(Boolean).length, Z = x.contentExpandY ? he > 1 ? 2 : 1 : void 0, M = x.headerExpandY ? 1 : void 0, ee = x.footerExpandY ? 1 : void 0, te = ce(xe, M, Z, ee), me = h ? /* @__PURE__ */ a.jsx(C, { ...h, debugMode: t, expandWeight: M, children: h.children }) : null, ne = (z ? /* @__PURE__ */ a.jsx(y, { ...z, debugMode: t, scroll: c, expandWeight: Z, children: z.children }) : null) ?? (te.length ? te : null), Ee = O ? /* @__PURE__ */ a.jsx(b, { ...O, debugMode: t, expandWeight: ee, children: O.children }) : null, ge = ue ? "w-full" : "w-auto", oe = {
|
|
117
117
|
"--safe-margin-size": `${m}px`
|
|
118
118
|
};
|
|
119
|
-
|
|
120
|
-
const
|
|
119
|
+
Q && (oe.height = `calc(100% - ${m * 2}px)`);
|
|
120
|
+
const re = /* @__PURE__ */ a.jsx(a.Fragment, { children: k && /* @__PURE__ */ a.jsx(
|
|
121
121
|
"div",
|
|
122
122
|
{
|
|
123
123
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-[1.5px]",
|
|
124
|
-
style: { zIndex:
|
|
125
|
-
onClick:
|
|
124
|
+
style: { zIndex: p },
|
|
125
|
+
onClick: F,
|
|
126
126
|
children: /* @__PURE__ */ a.jsxs(
|
|
127
127
|
"div",
|
|
128
128
|
{
|
|
129
129
|
onClick: (g) => g.stopPropagation(),
|
|
130
|
-
className:
|
|
130
|
+
className: u(
|
|
131
131
|
"bg-neutral-default-default rounded-lg shadow-lg border-neutral-strong-default border relative ",
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
ge,
|
|
133
|
+
c === "content" ? "" : "prometeo-scrollbar-thin!",
|
|
134
|
+
c === "dialog" && "overflow-auto ",
|
|
135
|
+
c === "content" && "",
|
|
136
136
|
"flex flex-col ",
|
|
137
|
-
|
|
137
|
+
fe({ size: de })
|
|
138
138
|
// className
|
|
139
139
|
),
|
|
140
|
-
style:
|
|
140
|
+
style: oe,
|
|
141
141
|
children: [
|
|
142
142
|
/* @__PURE__ */ a.jsx(
|
|
143
143
|
"div",
|
|
144
144
|
{
|
|
145
|
-
className:
|
|
145
|
+
className: u(
|
|
146
146
|
"absolute bg-transparent z-[-1] -top-(--safe-margin-size) -left-(--safe-margin-size) -right-(--safe-margin-size) -bottom-(--safe-margin-size)",
|
|
147
147
|
t && "after:content-['SECURE_MARGIN'] after:text-red-300 after:prometeo-fonts-label-small after:ml-2 "
|
|
148
148
|
),
|
|
@@ -152,102 +152,102 @@ const oe = he(
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
),
|
|
155
|
-
/* @__PURE__ */ a.jsxs("div", { className:
|
|
155
|
+
/* @__PURE__ */ a.jsxs("div", { className: u(
|
|
156
156
|
"flex flex-col h-auto prometeo-scrollbar-thin!",
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
Q && "flex-1 min-h-0",
|
|
158
|
+
c === "dialog" && "overflow-hidden min-w-max min-h-max",
|
|
159
|
+
c === "content" && "overflow-hidden",
|
|
160
|
+
f
|
|
161
161
|
), children: [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
me,
|
|
163
|
+
c === "dialog" ? /* @__PURE__ */ a.jsx("div", { className: "flex flex-col flex-1", children: ne }) : ne,
|
|
164
|
+
Ee
|
|
165
165
|
] })
|
|
166
166
|
]
|
|
167
167
|
}
|
|
168
168
|
)
|
|
169
169
|
}
|
|
170
170
|
) });
|
|
171
|
-
return
|
|
171
|
+
return d ? re : be(re, document.body);
|
|
172
172
|
}
|
|
173
173
|
);
|
|
174
|
-
|
|
175
|
-
const y =
|
|
176
|
-
const E =
|
|
177
|
-
|
|
174
|
+
se.displayName = "Dialog";
|
|
175
|
+
const y = X(({ children: r, className: i, debugMode: f, scroll: d, expandX: p, expandY: t, expandWeight: m }) => {
|
|
176
|
+
const E = u(
|
|
177
|
+
p && "w-full min-w-0",
|
|
178
178
|
t && "flex-1 min-h-0"
|
|
179
|
-
),
|
|
180
|
-
return /* @__PURE__ */ a.jsx("div", { style:
|
|
179
|
+
), c = t ? { flexGrow: m ?? 1, flexBasis: 0 } : void 0;
|
|
180
|
+
return /* @__PURE__ */ a.jsx("div", { style: c, className: u(
|
|
181
181
|
"flex flex-col p-4 prometeo-scrollbar-thin!",
|
|
182
|
-
|
|
182
|
+
f && "border-2 border-dashed border-red-500 bg-red-200/40 relative after:content-['CONTENT'] after:absolute after:top-2 after:left-1/2 after:w-max after:h-full after:text-red-500 ",
|
|
183
183
|
E,
|
|
184
|
-
|
|
184
|
+
i,
|
|
185
185
|
// Para scroll='content', este componente necesita su propio scroll y altura mínima
|
|
186
|
-
|
|
186
|
+
d === "content" && "overflow-y-auto min-h-0 flex-1 ",
|
|
187
187
|
// Para scroll='dialog', el contenido debe ocupar todo el espacio disponible pero sin scroll
|
|
188
|
-
|
|
188
|
+
d === "dialog" && "flex-1 min-h-max "
|
|
189
189
|
), children: r });
|
|
190
190
|
});
|
|
191
191
|
y.displayName = "DialogContent";
|
|
192
|
-
const
|
|
193
|
-
const t =
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
const N = X(({ children: r, className: i, debugMode: f, expandX: d, expandY: p }) => {
|
|
193
|
+
const t = u(
|
|
194
|
+
d && "w-full min-w-0",
|
|
195
|
+
p && "flex-1 min-h-0"
|
|
196
196
|
);
|
|
197
|
-
return /* @__PURE__ */ a.jsx("h1", { className:
|
|
197
|
+
return /* @__PURE__ */ a.jsx("h1", { className: u("prometeo-fonts-headline-small text-neutral-strong-default w-max", f && 'bg-red-400/40 relative after:content-["TITLE"] after:absolute after:top-0 after:-translate-y-5 after:left-0 after:w-max after:h-full after:text-red-500 after:prometeo-fonts-label-large', t, i), children: r });
|
|
198
198
|
});
|
|
199
|
-
|
|
200
|
-
const C =
|
|
201
|
-
const E =
|
|
202
|
-
|
|
199
|
+
N.displayName = "DialogTitle";
|
|
200
|
+
const C = X(({ children: r, className: i, title: f, debugMode: d, expandX: p, expandY: t, expandWeight: m }) => {
|
|
201
|
+
const E = u(
|
|
202
|
+
p && "w-full min-w-0",
|
|
203
203
|
t && "flex-1 min-h-0"
|
|
204
|
-
),
|
|
205
|
-
return /* @__PURE__ */ a.jsxs("div", { style:
|
|
204
|
+
), c = t ? { flexGrow: m ?? 1, flexBasis: 0 } : void 0;
|
|
205
|
+
return /* @__PURE__ */ a.jsxs("div", { style: c, className: u(
|
|
206
206
|
"px-6 pt-8 pb-4 flex flex-col",
|
|
207
207
|
E,
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
d && "border-2 border-dashed border-red-600 bg-red-200/40! relative after:content-['HEADER'] after:absolute after:top-1 after:left-1/2 after:w-max after:h-full after:text-red-500",
|
|
209
|
+
i
|
|
210
210
|
), children: [
|
|
211
|
-
|
|
211
|
+
f && /* @__PURE__ */ a.jsx(N, { debugMode: d, children: f }),
|
|
212
212
|
r
|
|
213
213
|
] });
|
|
214
214
|
});
|
|
215
215
|
C.displayName = "DialogHeader";
|
|
216
|
-
const b =
|
|
217
|
-
const m =
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
), E =
|
|
221
|
-
return /* @__PURE__ */ a.jsx("div", { style: E, className:
|
|
222
|
-
|
|
216
|
+
const b = X(({ children: r, className: i, debugMode: f, expandX: d, expandY: p, expandWeight: t }) => {
|
|
217
|
+
const m = u(
|
|
218
|
+
d && "w-full min-w-0",
|
|
219
|
+
p && "flex-1 min-h-0 flex-col"
|
|
220
|
+
), E = p ? { flexGrow: t ?? 1, flexBasis: 0 } : void 0;
|
|
221
|
+
return /* @__PURE__ */ a.jsx("div", { style: E, className: u(
|
|
222
|
+
f && "border-2 border-dashed border-red-600 bg-red-200/40! relative after:content-['FOOTER'] after:absolute after:top-1 after:left-1/2 after:w-max after:h-full after:text-red-500",
|
|
223
223
|
"border-t border-neutral-strong-default p-4 w-full flex flex-row justify-end gap-4",
|
|
224
224
|
m,
|
|
225
|
-
|
|
225
|
+
i
|
|
226
226
|
), children: r });
|
|
227
227
|
});
|
|
228
228
|
b.displayName = "DialogFooter";
|
|
229
|
-
const
|
|
229
|
+
const we = Object.assign(se, {
|
|
230
230
|
Content: y,
|
|
231
231
|
Header: C,
|
|
232
232
|
Footer: b,
|
|
233
|
-
Title:
|
|
233
|
+
Title: N
|
|
234
234
|
});
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
const r =
|
|
235
|
+
we.displayName = "DialogModal";
|
|
236
|
+
const Xe = () => {
|
|
237
|
+
const r = $(null), i = w((t) => {
|
|
238
238
|
r.current?.open(t);
|
|
239
|
-
}, []),
|
|
239
|
+
}, []), f = w(() => {
|
|
240
240
|
r.current?.close();
|
|
241
|
-
}, []),
|
|
241
|
+
}, []), d = w(() => r.current?.isOpen ?? !1, []), p = w(() => r.current?.getContext() ?? null, []);
|
|
242
242
|
return {
|
|
243
243
|
ref: r,
|
|
244
|
-
open:
|
|
245
|
-
close:
|
|
246
|
-
isOpen:
|
|
247
|
-
getContext:
|
|
244
|
+
open: i,
|
|
245
|
+
close: f,
|
|
246
|
+
isOpen: d,
|
|
247
|
+
getContext: p
|
|
248
248
|
};
|
|
249
249
|
};
|
|
250
250
|
export {
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
we as default,
|
|
252
|
+
Xe as useDialogControl
|
|
253
253
|
};
|