prometeo-design-system 4.6.2 → 4.6.3
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/DrawerDesktop.es.js +35 -33
- package/package.json +1 -1
package/dist/DrawerDesktop.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as m } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
2
|
import { c as R } from "./cn-B6yFEsav.js";
|
|
3
3
|
import { c as j } from "./index-BOQuZ0gG.js";
|
|
4
4
|
import { createPortal as B } from "react-dom";
|
|
5
|
-
import { forwardRef as L, useRef as
|
|
5
|
+
import { forwardRef as L, useRef as p, useState as v, useEffect as a, useCallback as x, 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
8
|
const $ = L((t, i) => {
|
|
9
|
-
const l =
|
|
10
|
-
modal:
|
|
11
|
-
children:
|
|
9
|
+
const l = p(null), [e, u] = v(t.defaultOpen || !1), [r, s] = v(null), d = p(t.onClose), c = p(r), b = p(/* @__PURE__ */ new Set()), {
|
|
10
|
+
modal: y = !1,
|
|
11
|
+
children: f,
|
|
12
12
|
className: g,
|
|
13
13
|
direction: O = "left",
|
|
14
14
|
attachToParent: h = !1,
|
|
@@ -16,7 +16,7 @@ const $ = L((t, i) => {
|
|
|
16
16
|
hideCloseButton: N = !1,
|
|
17
17
|
unmountChildrenOnClose: C = !1,
|
|
18
18
|
zindex: T = 499
|
|
19
|
-
} = t, k =
|
|
19
|
+
} = t, k = p(n), D = p(e);
|
|
20
20
|
c.current = r;
|
|
21
21
|
const [V, P] = v(() => !C);
|
|
22
22
|
a(() => {
|
|
@@ -28,31 +28,31 @@ const $ = L((t, i) => {
|
|
|
28
28
|
}, [r]), a(() => {
|
|
29
29
|
k.current = n;
|
|
30
30
|
}, [n]);
|
|
31
|
-
const
|
|
31
|
+
const I = (o) => {
|
|
32
32
|
if (!l.current)
|
|
33
33
|
return;
|
|
34
34
|
const E = l.current;
|
|
35
35
|
E && !E.contains(o.target) && k.current && D.current && w();
|
|
36
36
|
};
|
|
37
37
|
a(() => {
|
|
38
|
-
if (!k.current ||
|
|
38
|
+
if (!k.current || y || !e)
|
|
39
39
|
return;
|
|
40
40
|
const o = setTimeout(() => {
|
|
41
|
-
document.addEventListener("click",
|
|
41
|
+
document.addEventListener("click", I);
|
|
42
42
|
}, 0);
|
|
43
43
|
return () => {
|
|
44
|
-
clearTimeout(o), document.removeEventListener("click",
|
|
44
|
+
clearTimeout(o), document.removeEventListener("click", I);
|
|
45
45
|
};
|
|
46
|
-
}, [n, e,
|
|
46
|
+
}, [n, e, y]), a(() => {
|
|
47
47
|
d.current = t.onClose;
|
|
48
48
|
}, [t.onClose]);
|
|
49
|
-
const
|
|
49
|
+
const z = x((o) => {
|
|
50
50
|
s(o ?? null), u(!0);
|
|
51
51
|
}, []), w = x(() => {
|
|
52
52
|
u(!1), d.current?.(c.current), setTimeout(() => s(null), 300);
|
|
53
53
|
}, []);
|
|
54
54
|
a(() => {
|
|
55
|
-
|
|
55
|
+
b.current.forEach((o) => {
|
|
56
56
|
try {
|
|
57
57
|
o(e);
|
|
58
58
|
} catch {
|
|
@@ -61,17 +61,17 @@ const $ = L((t, i) => {
|
|
|
61
61
|
}, [e]), Y(
|
|
62
62
|
i,
|
|
63
63
|
() => ({
|
|
64
|
-
open:
|
|
64
|
+
open: z,
|
|
65
65
|
close: w,
|
|
66
66
|
isOpen: e,
|
|
67
|
-
subscribeOpenChange: (o) => (
|
|
68
|
-
|
|
67
|
+
subscribeOpenChange: (o) => (b.current.add(o), () => {
|
|
68
|
+
b.current.delete(o);
|
|
69
69
|
}),
|
|
70
70
|
getContext: () => c.current
|
|
71
71
|
}),
|
|
72
|
-
[e,
|
|
72
|
+
[e, z, w]
|
|
73
73
|
);
|
|
74
|
-
const S = /* @__PURE__ */
|
|
74
|
+
const S = /* @__PURE__ */ m.jsx(
|
|
75
75
|
q,
|
|
76
76
|
{
|
|
77
77
|
context: r,
|
|
@@ -79,13 +79,13 @@ const $ = L((t, i) => {
|
|
|
79
79
|
isOpen: e,
|
|
80
80
|
close: w,
|
|
81
81
|
direction: O,
|
|
82
|
-
modal:
|
|
82
|
+
modal: y,
|
|
83
83
|
className: g,
|
|
84
84
|
attachToParent: h,
|
|
85
85
|
closeOnOverlayClick: n,
|
|
86
86
|
hideCloseButton: N,
|
|
87
87
|
zindex: T,
|
|
88
|
-
children: (!C || V) && (typeof
|
|
88
|
+
children: (!C || V) && (typeof f == "function" ? f(r) : f)
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
return h ? S : B(S, document.body);
|
|
@@ -101,9 +101,9 @@ const q = ({
|
|
|
101
101
|
className: s,
|
|
102
102
|
attachToParent: d = !1,
|
|
103
103
|
closeOnOverlayClick: c = !1,
|
|
104
|
-
hideCloseButton:
|
|
105
|
-
context:
|
|
106
|
-
zindex:
|
|
104
|
+
hideCloseButton: b = !1,
|
|
105
|
+
context: y,
|
|
106
|
+
zindex: f = 499
|
|
107
107
|
}) => {
|
|
108
108
|
a(() => {
|
|
109
109
|
if (e && r) {
|
|
@@ -142,19 +142,19 @@ const q = ({
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
r && /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
|
|
146
|
+
r && /* @__PURE__ */ m.jsx(
|
|
147
147
|
"div",
|
|
148
148
|
{
|
|
149
149
|
className: R(O({ isOpen: e })),
|
|
150
|
-
style: { zIndex:
|
|
150
|
+
style: { zIndex: f },
|
|
151
151
|
onClick: (n) => {
|
|
152
152
|
n.preventDefault(), n.stopPropagation(), c && u();
|
|
153
153
|
},
|
|
154
154
|
"aria-hidden": "true"
|
|
155
155
|
}
|
|
156
156
|
),
|
|
157
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ m.jsxs(
|
|
158
158
|
"div",
|
|
159
159
|
{
|
|
160
160
|
ref: t,
|
|
@@ -162,16 +162,17 @@ const q = ({
|
|
|
162
162
|
"bg-neutral-strong-default h-full top-0 z-60 w-max overflow-y-auto",
|
|
163
163
|
d ? "absolute" : "fixed",
|
|
164
164
|
g({ isOpen: e, direction: l }),
|
|
165
|
-
!
|
|
165
|
+
!b && "p-4 pt-10",
|
|
166
166
|
s
|
|
167
167
|
),
|
|
168
168
|
role: "dialog",
|
|
169
169
|
"aria-modal": r,
|
|
170
|
+
style: { zIndex: f + 1 },
|
|
170
171
|
children: [
|
|
171
|
-
!
|
|
172
|
+
!b && /* @__PURE__ */ m.jsx(
|
|
172
173
|
F,
|
|
173
174
|
{
|
|
174
|
-
icon: /* @__PURE__ */
|
|
175
|
+
icon: /* @__PURE__ */ m.jsx(H, { size: 24 }),
|
|
175
176
|
animate: !1,
|
|
176
177
|
animateIcon: !1,
|
|
177
178
|
type: "button",
|
|
@@ -184,16 +185,17 @@ const q = ({
|
|
|
184
185
|
"absolute top-0 z-50",
|
|
185
186
|
h({ direction: l })
|
|
186
187
|
),
|
|
187
|
-
"aria-label": "Close drawer"
|
|
188
|
+
"aria-label": "Close drawer",
|
|
189
|
+
style: { zIndex: f + 2 }
|
|
188
190
|
}
|
|
189
191
|
),
|
|
190
|
-
typeof i == "function" ? i(
|
|
192
|
+
typeof i == "function" ? i(y) : i
|
|
191
193
|
]
|
|
192
194
|
}
|
|
193
195
|
)
|
|
194
196
|
] });
|
|
195
197
|
}, W = () => {
|
|
196
|
-
const t =
|
|
198
|
+
const t = p(null), [i, l] = v(!1), e = x((s) => {
|
|
197
199
|
t.current?.open(s);
|
|
198
200
|
}, []), u = x(() => {
|
|
199
201
|
t.current?.close();
|