prometeo-design-system 6.4.0 → 6.4.4
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 +173 -173
- package/dist/DrawerDesktop.es.js +32 -30
- package/dist/DrawerMobile.es.js +33 -31
- package/dist/Icons/FormatListNumbered.d.ts +6 -0
- package/dist/Icons/FormatListNumbered.es.js +19 -0
- package/dist/Icons/FormatUnderlined.d.ts +6 -0
- package/dist/Icons/FormatUnderlined.es.js +19 -0
- package/dist/Icons/TicketRecurrente.d.ts +6 -0
- package/dist/Icons/TicketRecurrente.es.js +19 -0
- package/dist/Icons/components/FormatListNumbered.d.ts +4 -0
- package/dist/Icons/components/FormatUnderlined.d.ts +4 -0
- package/dist/Icons/components/TicketRecurrente.d.ts +4 -0
- package/dist/Icons/index.d.ts +3 -0
- package/dist/Icons/paths.json.d.ts +3 -0
- package/dist/Icons/registry.d.ts +5 -8
- package/dist/Icons.es.js +349 -340
- package/dist/components/Dialog/Dialog.d.ts +16 -7
- package/dist/components/Drawer/useDrawerControl.d.ts +22 -0
- package/dist/exports/DialogModal.d.ts +1 -1
- package/dist/exports/DrawerDesktop.d.ts +1 -1
- package/dist/exports/DrawerMobile.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/prometeo-design-system.es.js +103 -101
- package/dist/useDrawerControl-CTqQK4zm.js +64 -0
- package/package.json +1 -1
- package/dist/useDrawerControl-Cy-mkJxV.js +0 -38
package/dist/DialogModal.es.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { j as x } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
+
import { forwardRef as Ye, memo as W, useState as B, useRef as D, useCallback as X, useEffect as R, useImperativeHandle as De, Children as T, isValidElement as Q, createElement as S, cloneElement as xe } from "react";
|
|
3
3
|
import { createPortal as je } from "react-dom";
|
|
4
|
-
import { c as
|
|
5
|
-
import { c as
|
|
6
|
-
const
|
|
7
|
-
({ children:
|
|
8
|
-
const [
|
|
9
|
-
() => v ?
|
|
10
|
-
),
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}, []),
|
|
15
|
-
|
|
4
|
+
import { c as u } from "./cn-B6yFEsav.js";
|
|
5
|
+
import { c as Te } from "./index-BOQuZ0gG.js";
|
|
6
|
+
const Re = 50, ue = Ye(
|
|
7
|
+
function({ children: i, onClose: d, className: f, attachToParent: h = !1, zindex: c = 40, debugMode: n = !1, safeMarginSize: E = 24, title: b, scroll: P = "content", size: he = "medium", unmountChildrenOnClose: v = !0 }, me) {
|
|
8
|
+
const [g, Z] = B(!1), [F, z] = B(null), [Ee, O] = B(
|
|
9
|
+
() => v ? g : !0
|
|
10
|
+
), M = D(d), L = D(F), ee = D(null), p = D(null), H = D(/* @__PURE__ */ new Set());
|
|
11
|
+
M.current = d, L.current = F;
|
|
12
|
+
const te = X((r) => {
|
|
13
|
+
z(r ?? {}), Z(!0);
|
|
14
|
+
}, []), G = X(() => {
|
|
15
|
+
Z(!1), M.current?.(L.current);
|
|
16
16
|
}, []);
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
R(() => {
|
|
18
|
+
H.current.forEach((r) => {
|
|
19
19
|
try {
|
|
20
|
-
r(
|
|
20
|
+
r(g);
|
|
21
21
|
} catch {
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
}, [
|
|
25
|
-
|
|
24
|
+
}, [g]), De(
|
|
25
|
+
me,
|
|
26
26
|
() => ({
|
|
27
|
-
open:
|
|
28
|
-
close:
|
|
29
|
-
isOpen:
|
|
30
|
-
getContext: () =>
|
|
31
|
-
subscribeOpenChange: (r) => (
|
|
32
|
-
|
|
27
|
+
open: te,
|
|
28
|
+
close: G,
|
|
29
|
+
isOpen: g,
|
|
30
|
+
getContext: () => L.current,
|
|
31
|
+
subscribeOpenChange: (r) => (H.current.add(r), () => {
|
|
32
|
+
H.current.delete(r);
|
|
33
33
|
})
|
|
34
34
|
}),
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
-
v &&
|
|
38
|
-
}, [
|
|
35
|
+
[te, G, g]
|
|
36
|
+
), R(() => {
|
|
37
|
+
v && g && O(!0);
|
|
38
|
+
}, [g, v]), R(() => {
|
|
39
39
|
if (v) {
|
|
40
|
-
if (
|
|
41
|
-
|
|
40
|
+
if (g) {
|
|
41
|
+
p.current && (clearTimeout(p.current), p.current = null);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
44
|
+
return p.current && clearTimeout(p.current), p.current = setTimeout(() => {
|
|
45
|
+
O(!1), z(null), p.current = null;
|
|
46
|
+
}, Re), () => {
|
|
47
|
+
p.current && (clearTimeout(p.current), p.current = null);
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
}, [
|
|
50
|
+
}, [g, v]), R(() => {
|
|
51
51
|
if (!v) return;
|
|
52
|
-
const r =
|
|
52
|
+
const r = ee.current;
|
|
53
53
|
if (!r) return;
|
|
54
54
|
const e = (w) => {
|
|
55
|
-
const
|
|
56
|
-
w.target === r && (!["opacity", "display", "transform"].includes(w.propertyName) ||
|
|
55
|
+
const t = r.hasAttribute("open");
|
|
56
|
+
w.target === r && (!["opacity", "display", "transform"].includes(w.propertyName) || t || (p.current && (clearTimeout(p.current), p.current = null), O(!1), z(null)));
|
|
57
57
|
};
|
|
58
58
|
return r.addEventListener("transitionend", e), r.addEventListener("transitioncancel", e), () => {
|
|
59
59
|
r.removeEventListener("transitionend", e), r.removeEventListener("transitioncancel", e);
|
|
60
60
|
};
|
|
61
61
|
}, [v]);
|
|
62
|
-
const
|
|
62
|
+
const ge = Te("max-h-[calc(100%-80px)]", {
|
|
63
63
|
variants: {
|
|
64
64
|
size: {
|
|
65
65
|
medium: " max-w-[min(740px,calc(100%-32px))]",
|
|
@@ -67,9 +67,9 @@ const Te = 50, xe = Pe(
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
let
|
|
71
|
-
typeof
|
|
72
|
-
const
|
|
70
|
+
let k, _;
|
|
71
|
+
typeof i == "function" ? (k = i(F), _ = T.toArray(k)) : (k = i, _ = T.toArray(k));
|
|
72
|
+
const ye = (r) => {
|
|
73
73
|
const e = {
|
|
74
74
|
headerProps: null,
|
|
75
75
|
titleContent: null,
|
|
@@ -84,125 +84,125 @@ const Te = 50, xe = Pe(
|
|
|
84
84
|
footerExpandX: !1,
|
|
85
85
|
footerExpandY: !1
|
|
86
86
|
}
|
|
87
|
-
}, w = (
|
|
88
|
-
if (!
|
|
89
|
-
const
|
|
90
|
-
|
|
87
|
+
}, w = (t) => {
|
|
88
|
+
if (!Q(t)) return;
|
|
89
|
+
const o = t.props;
|
|
90
|
+
t.type === I ? (e.allExpandInfo.headerExpandX = e.allExpandInfo.headerExpandX || !!o?.expandX, e.allExpandInfo.headerExpandY = e.allExpandInfo.headerExpandY || !!o?.expandY) : t.type === C ? (e.allExpandInfo.contentExpandX = e.allExpandInfo.contentExpandX || !!o?.expandX, e.allExpandInfo.contentExpandY = e.allExpandInfo.contentExpandY || !!o?.expandY) : t.type === N && (e.allExpandInfo.footerExpandX = e.allExpandInfo.footerExpandX || !!o?.expandX, e.allExpandInfo.footerExpandY = e.allExpandInfo.footerExpandY || !!o?.expandY), o?.children && T.toArray(o.children).forEach(w);
|
|
91
91
|
};
|
|
92
|
-
return r.forEach((
|
|
93
|
-
if (w(
|
|
94
|
-
e.middleChildren.push(
|
|
92
|
+
return r.forEach((t) => {
|
|
93
|
+
if (w(t), !Q(t)) {
|
|
94
|
+
e.middleChildren.push(t);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
if (
|
|
98
|
-
e.titleContent =
|
|
97
|
+
if (t.type === j && !e.titleContent) {
|
|
98
|
+
e.titleContent = t;
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
e.headerProps =
|
|
101
|
+
if (t.type === I && !e.headerProps) {
|
|
102
|
+
const o = t.props;
|
|
103
|
+
e.headerProps = o;
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
e.contentProps =
|
|
106
|
+
if (t.type === C && !e.contentProps) {
|
|
107
|
+
const o = t.props;
|
|
108
|
+
e.contentProps = o;
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
112
|
-
const
|
|
113
|
-
e.footerProps =
|
|
111
|
+
if (t.type === N && !e.footerProps) {
|
|
112
|
+
const o = t.props;
|
|
113
|
+
e.footerProps = o;
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
e.middleChildren.push(
|
|
116
|
+
e.middleChildren.push(t);
|
|
117
117
|
}), e;
|
|
118
|
-
},
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
118
|
+
}, be = (r, e, w, t) => {
|
|
119
|
+
const o = (l, V) => {
|
|
120
|
+
if (!Q(l))
|
|
121
121
|
return l;
|
|
122
|
-
const s = l.props,
|
|
122
|
+
const s = l.props, Y = l.key ?? `dialog-child-${V}`;
|
|
123
123
|
if (l.type === j)
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
if (l.type === N)
|
|
126
|
-
return /* @__PURE__ */ A(N, { ...s, debugMode: t, expandWeight: e, key: P }, s.children);
|
|
127
|
-
if (l.type === C)
|
|
128
|
-
return /* @__PURE__ */ A(C, { ...s, debugMode: t, scroll: m, expandWeight: w, key: P }, s.children);
|
|
124
|
+
return /* @__PURE__ */ S(j, { ...s, debugMode: n, key: Y }, s.children);
|
|
129
125
|
if (l.type === I)
|
|
130
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ S(I, { ...s, debugMode: n, expandWeight: e, key: Y }, s.children);
|
|
127
|
+
if (l.type === C)
|
|
128
|
+
return /* @__PURE__ */ S(C, { ...s, debugMode: n, scroll: P, expandWeight: w, key: Y }, s.children);
|
|
129
|
+
if (l.type === N)
|
|
130
|
+
return /* @__PURE__ */ S(N, { ...s, debugMode: n, expandWeight: t, key: Y }, s.children);
|
|
131
131
|
if (l.type === "form") {
|
|
132
|
-
const
|
|
133
|
-
return
|
|
134
|
-
key:
|
|
132
|
+
const U = s?.children ? T.toArray(s.children).map((q, J) => o(q, J)) : [];
|
|
133
|
+
return xe(l, {
|
|
134
|
+
key: Y,
|
|
135
135
|
...s,
|
|
136
|
-
className:
|
|
137
|
-
}, ...
|
|
136
|
+
className: u(s?.className, "contents")
|
|
137
|
+
}, ...U);
|
|
138
138
|
}
|
|
139
139
|
if (s?.children) {
|
|
140
|
-
const
|
|
141
|
-
return
|
|
140
|
+
const U = T.toArray(s.children).map((q, J) => o(q, J));
|
|
141
|
+
return xe(l, { key: Y }, ...U);
|
|
142
142
|
}
|
|
143
143
|
return l;
|
|
144
144
|
};
|
|
145
|
-
return r.map((l,
|
|
145
|
+
return r.map((l, V) => o(l, V));
|
|
146
146
|
};
|
|
147
|
-
let { headerProps:
|
|
148
|
-
!
|
|
149
|
-
...
|
|
147
|
+
let { headerProps: ne, titleContent: A, contentProps: re, footerProps: oe, middleChildren: ve, allExpandInfo: m } = ye(_), y = ne ? { ...ne } : null, $ = re ? { ...re } : null, K = oe ? { ...oe } : null;
|
|
148
|
+
!y && b && (y = { title: b, children: null }, A = null), y && A && y.title && (y = {
|
|
149
|
+
...y,
|
|
150
150
|
title: "",
|
|
151
|
-
children:
|
|
152
|
-
},
|
|
153
|
-
const
|
|
154
|
-
"--safe-margin-size": `${
|
|
151
|
+
children: A
|
|
152
|
+
}, A = null);
|
|
153
|
+
const we = m.headerExpandX || m.contentExpandX || m.footerExpandX, ae = m.headerExpandY || m.contentExpandY || m.footerExpandY, Ce = [m.headerExpandY, m.contentExpandY, m.footerExpandY].filter(Boolean).length, le = m.contentExpandY ? Ce > 1 ? 2 : 1 : void 0, se = m.headerExpandY ? 1 : void 0, ie = m.footerExpandY ? 1 : void 0, de = be(ve, se, le, ie), Ie = y ? /* @__PURE__ */ x.jsx(I, { ...y, debugMode: n, expandWeight: se, children: y.children }) : null, fe = ($ ? /* @__PURE__ */ x.jsx(C, { ...$, debugMode: n, scroll: P, expandWeight: le, children: $.children }) : null) ?? (de.length ? de : null), Ne = K ? /* @__PURE__ */ x.jsx(N, { ...K, debugMode: n, expandWeight: ie, children: K.children }) : null, Pe = we ? "w-full" : "w-auto", ce = {
|
|
154
|
+
"--safe-margin-size": `${E}px`
|
|
155
155
|
};
|
|
156
|
-
|
|
157
|
-
const
|
|
156
|
+
ae && (ce.height = `calc(100% - ${E * 2}px)`);
|
|
157
|
+
const pe = /* @__PURE__ */ x.jsx(
|
|
158
158
|
"dialog",
|
|
159
159
|
{
|
|
160
|
-
ref:
|
|
161
|
-
open:
|
|
162
|
-
className:
|
|
160
|
+
ref: ee,
|
|
161
|
+
open: g,
|
|
162
|
+
className: u(
|
|
163
163
|
"prometeo-dialog fixed inset-0 w-screen h-screen z-50 flex items-center justify-center bg-black/30 backdrop-blur-[1.5px]",
|
|
164
164
|
"open:flex",
|
|
165
165
|
"hidden"
|
|
166
166
|
),
|
|
167
|
-
style: { zIndex:
|
|
168
|
-
onClick:
|
|
169
|
-
children: /* @__PURE__ */
|
|
167
|
+
style: { zIndex: c },
|
|
168
|
+
onClick: G,
|
|
169
|
+
children: /* @__PURE__ */ x.jsxs(
|
|
170
170
|
"div",
|
|
171
171
|
{
|
|
172
172
|
onClick: (r) => r.stopPropagation(),
|
|
173
|
-
className:
|
|
173
|
+
className: u(
|
|
174
174
|
"prometeo-dialog-panel bg-neutral-default-default rounded-lg shadow-lg border-neutral-strong-default border relative ",
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
Pe,
|
|
176
|
+
P === "content" ? "" : "prometeo-scrollbar-thin!",
|
|
177
177
|
// scroll === 'dialog' && 'overflow-auto ',
|
|
178
178
|
"flex flex-col ",
|
|
179
|
-
|
|
179
|
+
ge({ size: he })
|
|
180
180
|
// className
|
|
181
181
|
),
|
|
182
|
-
style:
|
|
182
|
+
style: ce,
|
|
183
183
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ x.jsx(
|
|
185
185
|
"div",
|
|
186
186
|
{
|
|
187
|
-
className:
|
|
187
|
+
className: u(
|
|
188
188
|
"absolute bg-transparent z-[-1] -top-(--safe-margin-size) -left-(--safe-margin-size) -right-(--safe-margin-size) -bottom-(--safe-margin-size)",
|
|
189
|
-
|
|
189
|
+
n && "after:content-['SECURE_MARGIN'] after:text-red-300 after:prometeo-fonts-label-small after:ml-2 "
|
|
190
190
|
),
|
|
191
191
|
style: {
|
|
192
|
-
background:
|
|
193
|
-
border:
|
|
192
|
+
background: n ? "#FF393973" : "auto",
|
|
193
|
+
border: n ? "solid 1px #FF3939" : ""
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
),
|
|
197
|
-
(!v ||
|
|
197
|
+
(!v || Ee) && /* @__PURE__ */ x.jsxs("div", { className: u(
|
|
198
198
|
"flex flex-col h-auto prometeo-scrollbar-thin!",
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
ae && "flex-1 min-h-0",
|
|
200
|
+
P === "dialog" && "overflow-auto *:min-w-max *:min-h-max",
|
|
201
|
+
P === "content" && "overflow-hidden",
|
|
202
|
+
f
|
|
203
203
|
), children: [
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
Ie,
|
|
205
|
+
P === "dialog" ? /* @__PURE__ */ x.jsx("div", { className: "flex flex-col flex-1", children: fe }) : fe,
|
|
206
206
|
Ne
|
|
207
207
|
] })
|
|
208
208
|
]
|
|
@@ -210,97 +210,97 @@ const Te = 50, xe = Pe(
|
|
|
210
210
|
)
|
|
211
211
|
}
|
|
212
212
|
);
|
|
213
|
-
return
|
|
213
|
+
return h ? pe : je(pe, document.body);
|
|
214
214
|
}
|
|
215
215
|
);
|
|
216
|
-
|
|
217
|
-
const C =
|
|
218
|
-
const
|
|
216
|
+
ue.displayName = "Dialog";
|
|
217
|
+
const C = W(({ children: a, className: i, debugMode: d, scroll: f, expandX: h, expandY: c, expandWeight: n }) => {
|
|
218
|
+
const E = u(
|
|
219
219
|
h && "w-full min-w-0",
|
|
220
|
-
|
|
221
|
-
),
|
|
222
|
-
return /* @__PURE__ */
|
|
220
|
+
c && "flex-1 min-h-0"
|
|
221
|
+
), b = c ? { flexGrow: n ?? 1, flexBasis: 0 } : void 0;
|
|
222
|
+
return /* @__PURE__ */ x.jsx("div", { style: b, className: u(
|
|
223
223
|
"flex flex-col p-4 prometeo-scrollbar-thin!",
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
d && "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 ",
|
|
225
|
+
E,
|
|
226
|
+
i,
|
|
227
227
|
// Para scroll='content', este componente necesita su propio scroll y altura mínima
|
|
228
|
-
|
|
228
|
+
f === "content" && "overflow-y-auto min-h-0 flex-1 ",
|
|
229
229
|
// Para scroll='dialog', el contenido debe ocupar todo el espacio disponible pero sin scroll
|
|
230
|
-
|
|
231
|
-
), children:
|
|
230
|
+
f === "dialog" && "flex-1 min-h-max "
|
|
231
|
+
), children: a });
|
|
232
232
|
});
|
|
233
233
|
C.displayName = "DialogContent";
|
|
234
|
-
const j =
|
|
235
|
-
const
|
|
236
|
-
|
|
234
|
+
const j = W(({ children: a, className: i, debugMode: d, expandX: f, expandY: h }) => {
|
|
235
|
+
const c = u(
|
|
236
|
+
f && "w-full min-w-0",
|
|
237
237
|
h && "flex-1 min-h-0"
|
|
238
238
|
);
|
|
239
|
-
return /* @__PURE__ */
|
|
239
|
+
return /* @__PURE__ */ x.jsx("h1", { className: u("prometeo-fonts-headline-small text-neutral-strong-default w-max", d && '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', c, i), children: a });
|
|
240
240
|
});
|
|
241
241
|
j.displayName = "DialogTitle";
|
|
242
|
-
const
|
|
243
|
-
const
|
|
242
|
+
const I = W(({ children: a, className: i, title: d, debugMode: f, expandX: h, expandY: c, expandWeight: n }) => {
|
|
243
|
+
const E = u(
|
|
244
244
|
h && "w-full min-w-0",
|
|
245
|
-
|
|
246
|
-
),
|
|
247
|
-
return /* @__PURE__ */
|
|
245
|
+
c && "flex-1 min-h-0"
|
|
246
|
+
), b = c ? { flexGrow: n ?? 1, flexBasis: 0 } : void 0;
|
|
247
|
+
return /* @__PURE__ */ x.jsxs("div", { style: b, className: u(
|
|
248
248
|
"px-6 pt-8 pb-4 flex flex-col",
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
E,
|
|
250
|
+
f && "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",
|
|
251
|
+
i
|
|
252
252
|
), children: [
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
d && /* @__PURE__ */ x.jsx(j, { debugMode: f, children: d }),
|
|
254
|
+
a
|
|
255
255
|
] });
|
|
256
256
|
});
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
-
|
|
257
|
+
I.displayName = "DialogHeader";
|
|
258
|
+
const N = W(({ children: a, className: i, debugMode: d, expandX: f, expandY: h, expandWeight: c }) => {
|
|
259
|
+
const n = u(
|
|
260
|
+
f && "w-full min-w-0",
|
|
261
261
|
h && "flex-1 min-h-0 flex-col"
|
|
262
|
-
),
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
|
|
262
|
+
), E = h ? { flexGrow: c ?? 1, flexBasis: 0 } : void 0;
|
|
263
|
+
return /* @__PURE__ */ x.jsx("div", { style: E, className: u(
|
|
264
|
+
d && "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",
|
|
265
265
|
"border-t border-neutral-strong-default p-4 w-full flex flex-row justify-end gap-4",
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
), children:
|
|
266
|
+
n,
|
|
267
|
+
i
|
|
268
|
+
), children: a });
|
|
269
269
|
});
|
|
270
|
-
|
|
271
|
-
const
|
|
270
|
+
N.displayName = "DialogFooter";
|
|
271
|
+
const Xe = Object.assign(ue, {
|
|
272
272
|
Content: C,
|
|
273
|
-
Header:
|
|
274
|
-
Footer:
|
|
273
|
+
Header: I,
|
|
274
|
+
Footer: N,
|
|
275
275
|
Title: j
|
|
276
276
|
});
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
}, []), h =
|
|
282
|
-
|
|
277
|
+
Xe.displayName = "DialogModal";
|
|
278
|
+
const ze = () => {
|
|
279
|
+
const a = D(null), [i, d] = B(!1), f = X((n) => {
|
|
280
|
+
a.current?.open(n);
|
|
281
|
+
}, []), h = X(() => {
|
|
282
|
+
a.current?.close();
|
|
283
283
|
}, []);
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
287
|
-
const
|
|
288
|
-
|
|
284
|
+
R(() => {
|
|
285
|
+
const n = a.current?.subscribeOpenChange;
|
|
286
|
+
if (!n) return;
|
|
287
|
+
const E = n((b) => {
|
|
288
|
+
d(b);
|
|
289
289
|
});
|
|
290
290
|
return () => {
|
|
291
|
-
|
|
291
|
+
E && E();
|
|
292
292
|
};
|
|
293
|
-
}, [
|
|
294
|
-
const
|
|
293
|
+
}, [a.current?.subscribeOpenChange]);
|
|
294
|
+
const c = X(() => a.current?.getContext() ?? null, []);
|
|
295
295
|
return {
|
|
296
|
-
ref:
|
|
297
|
-
open:
|
|
296
|
+
ref: a,
|
|
297
|
+
open: f,
|
|
298
298
|
close: h,
|
|
299
|
-
isOpen:
|
|
300
|
-
getContext:
|
|
299
|
+
isOpen: i,
|
|
300
|
+
getContext: c
|
|
301
301
|
};
|
|
302
302
|
};
|
|
303
303
|
export {
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
Xe as default,
|
|
305
|
+
ze as useDialogControl
|
|
306
306
|
};
|
package/dist/DrawerDesktop.es.js
CHANGED
|
@@ -2,54 +2,54 @@ import { j as l } from "./jsx-runtime-GkKLlHH4.js";
|
|
|
2
2
|
import { c as k } from "./cn-B6yFEsav.js";
|
|
3
3
|
import { c as R } from "./index-BOQuZ0gG.js";
|
|
4
4
|
import { createPortal as B } from "react-dom";
|
|
5
|
-
import { forwardRef as L, useRef as d, useState as
|
|
5
|
+
import { forwardRef as L, useRef as d, useState as D, useEffect as o, useCallback as N, useImperativeHandle as Y } from "react";
|
|
6
6
|
import F from "./Button.es.js";
|
|
7
7
|
import { Close as H } from "./Icons/Close.es.js";
|
|
8
|
-
import { u as Z } from "./useDrawerControl-
|
|
9
|
-
const
|
|
10
|
-
const c = d(null), [e, m] =
|
|
8
|
+
import { u as Z, b as _, a as ee } from "./useDrawerControl-CTqQK4zm.js";
|
|
9
|
+
const M = L((s, f) => {
|
|
10
|
+
const c = d(null), [e, m] = D(s.defaultOpen || !1), [t, y] = D(null), b = d(s.onClose), i = d(t), u = d(/* @__PURE__ */ new Set()), {
|
|
11
11
|
modal: p = !1,
|
|
12
12
|
children: a,
|
|
13
|
-
className:
|
|
13
|
+
className: v,
|
|
14
14
|
direction: C = "left",
|
|
15
15
|
attachToParent: x = !1,
|
|
16
16
|
closeOnOverlayClick: r = !1,
|
|
17
17
|
hideCloseButton: T = !1,
|
|
18
|
-
unmountChildrenOnClose:
|
|
18
|
+
unmountChildrenOnClose: w = !1,
|
|
19
19
|
zindex: S = 35
|
|
20
|
-
} = s, g = d(r),
|
|
20
|
+
} = s, g = d(r), O = d(e);
|
|
21
21
|
i.current = t;
|
|
22
|
-
const [V, P] =
|
|
22
|
+
const [V, P] = D(() => !w);
|
|
23
23
|
o(() => {
|
|
24
|
-
|
|
25
|
-
}, [e,
|
|
26
|
-
|
|
24
|
+
w && e && P(!0);
|
|
25
|
+
}, [e, w]), o(() => {
|
|
26
|
+
O.current = e;
|
|
27
27
|
}, [e]), o(() => {
|
|
28
28
|
i.current = t;
|
|
29
29
|
}, [t]), o(() => {
|
|
30
30
|
g.current = r;
|
|
31
31
|
}, [r]);
|
|
32
|
-
const
|
|
32
|
+
const j = (n) => {
|
|
33
33
|
if (!c.current)
|
|
34
34
|
return;
|
|
35
35
|
const E = c.current;
|
|
36
|
-
E && !E.contains(n.target) && g.current &&
|
|
36
|
+
E && !E.contains(n.target) && g.current && O.current && h();
|
|
37
37
|
};
|
|
38
38
|
o(() => {
|
|
39
39
|
if (!g.current || p || !e)
|
|
40
40
|
return;
|
|
41
41
|
const n = setTimeout(() => {
|
|
42
|
-
document.addEventListener("click",
|
|
42
|
+
document.addEventListener("click", j);
|
|
43
43
|
}, 0);
|
|
44
44
|
return () => {
|
|
45
|
-
clearTimeout(n), document.removeEventListener("click",
|
|
45
|
+
clearTimeout(n), document.removeEventListener("click", j);
|
|
46
46
|
};
|
|
47
47
|
}, [r, e, p]), o(() => {
|
|
48
48
|
b.current = s.onClose;
|
|
49
49
|
}, [s.onClose]);
|
|
50
|
-
const
|
|
50
|
+
const z = N((n) => {
|
|
51
51
|
y(n ?? null), m(!0);
|
|
52
|
-
}, []),
|
|
52
|
+
}, []), h = N(() => {
|
|
53
53
|
m(!1), b.current?.(i.current), setTimeout(() => y(null), 300);
|
|
54
54
|
}, []);
|
|
55
55
|
o(() => {
|
|
@@ -62,37 +62,37 @@ const $ = L((s, f) => {
|
|
|
62
62
|
}, [e]), Y(
|
|
63
63
|
f,
|
|
64
64
|
() => ({
|
|
65
|
-
open:
|
|
66
|
-
close:
|
|
65
|
+
open: z,
|
|
66
|
+
close: h,
|
|
67
67
|
isOpen: e,
|
|
68
68
|
subscribeOpenChange: (n) => (u.current.add(n), () => {
|
|
69
69
|
u.current.delete(n);
|
|
70
70
|
}),
|
|
71
71
|
getContext: () => i.current
|
|
72
72
|
}),
|
|
73
|
-
[e,
|
|
73
|
+
[e, z, h]
|
|
74
74
|
);
|
|
75
75
|
const I = /* @__PURE__ */ l.jsx(
|
|
76
|
-
|
|
76
|
+
$,
|
|
77
77
|
{
|
|
78
78
|
context: t,
|
|
79
79
|
ref: c,
|
|
80
80
|
isOpen: e,
|
|
81
|
-
close:
|
|
81
|
+
close: h,
|
|
82
82
|
direction: C,
|
|
83
83
|
modal: p,
|
|
84
|
-
className:
|
|
84
|
+
className: v,
|
|
85
85
|
attachToParent: x,
|
|
86
86
|
closeOnOverlayClick: r,
|
|
87
87
|
hideCloseButton: T,
|
|
88
88
|
zindex: S,
|
|
89
|
-
children: (!
|
|
89
|
+
children: (!w || V) && (typeof a == "function" ? a(t) : a)
|
|
90
90
|
}
|
|
91
91
|
);
|
|
92
92
|
return x ? I : B(I, document.body);
|
|
93
93
|
});
|
|
94
|
-
|
|
95
|
-
const
|
|
94
|
+
M.displayName = "DrawerDesktopV2";
|
|
95
|
+
const $ = ({
|
|
96
96
|
ref: s,
|
|
97
97
|
children: f,
|
|
98
98
|
direction: c = "left",
|
|
@@ -114,7 +114,7 @@ const q = ({
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
}, [e, t]);
|
|
117
|
-
const
|
|
117
|
+
const v = R("border-neutral-strong-default", {
|
|
118
118
|
variants: {
|
|
119
119
|
isOpen: {
|
|
120
120
|
true: "desktop-drawer-visible",
|
|
@@ -162,7 +162,7 @@ const q = ({
|
|
|
162
162
|
className: k(
|
|
163
163
|
"bg-neutral-strong-default h-full top-0 z-60 w-max overflow-y-auto",
|
|
164
164
|
b ? "absolute" : "fixed",
|
|
165
|
-
|
|
165
|
+
v({ isOpen: e, direction: c }),
|
|
166
166
|
!u && "p-4 pt-10",
|
|
167
167
|
y
|
|
168
168
|
),
|
|
@@ -197,6 +197,8 @@ const q = ({
|
|
|
197
197
|
] });
|
|
198
198
|
};
|
|
199
199
|
export {
|
|
200
|
-
|
|
201
|
-
Z as useDrawerControl
|
|
200
|
+
M as default,
|
|
201
|
+
Z as useDrawerControl,
|
|
202
|
+
_ as useDrawerDesktop,
|
|
203
|
+
ee as useDrawerMobile
|
|
202
204
|
};
|