prometeo-design-system 4.6.1 → 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/DialogModal.es.js
CHANGED
|
@@ -1,87 +1,88 @@
|
|
|
1
1
|
import { j as o } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
6
|
-
({ children: e, onClose: t, className:
|
|
7
|
-
const [
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
}, []),
|
|
12
|
-
|
|
2
|
+
import { forwardRef as R, memo as a, useState as b, useRef as g, useCallback as n, useImperativeHandle as O } from "react";
|
|
3
|
+
import { createPortal as F } from "react-dom";
|
|
4
|
+
import { c as y } from "./cn-B6yFEsav.js";
|
|
5
|
+
const N = R(
|
|
6
|
+
({ children: e, onClose: t, className: r, attachToParent: s = !1, zindex: c = 500 }, i) => {
|
|
7
|
+
const [u, f] = b(!1), [d, m] = b(null), D = g(t), p = g(d);
|
|
8
|
+
D.current = t, p.current = d;
|
|
9
|
+
const j = n((l) => {
|
|
10
|
+
m(l ?? null), f(!0);
|
|
11
|
+
}, []), x = n(() => {
|
|
12
|
+
f(!1), D.current?.(p.current), setTimeout(() => m(null), 300);
|
|
13
13
|
}, []);
|
|
14
|
-
|
|
14
|
+
O(
|
|
15
15
|
i,
|
|
16
16
|
() => ({
|
|
17
|
-
open:
|
|
18
|
-
close:
|
|
19
|
-
isOpen:
|
|
20
|
-
getContext: () =>
|
|
17
|
+
open: j,
|
|
18
|
+
close: x,
|
|
19
|
+
isOpen: u,
|
|
20
|
+
getContext: () => p.current
|
|
21
21
|
}),
|
|
22
|
-
[
|
|
22
|
+
[j, x, u]
|
|
23
23
|
);
|
|
24
|
-
const
|
|
24
|
+
const C = /* @__PURE__ */ o.jsx(o.Fragment, { children: u && /* @__PURE__ */ o.jsxs(
|
|
25
25
|
"div",
|
|
26
26
|
{
|
|
27
27
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-[1.5px]",
|
|
28
|
-
|
|
28
|
+
style: { zIndex: c },
|
|
29
|
+
onClick: x,
|
|
29
30
|
children: [
|
|
30
31
|
/* @__PURE__ */ o.jsx(
|
|
31
32
|
"div",
|
|
32
33
|
{
|
|
33
|
-
onClick: (
|
|
34
|
+
onClick: (l) => l.stopPropagation(),
|
|
34
35
|
className: "absolute bg-transparent z-[-1] w-[calc(75%+10px)] h-[calc(75%+10px)] xl:w-[calc(75%+30px)] xl:h-[calc(83.33%+30px)] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 "
|
|
35
36
|
}
|
|
36
37
|
),
|
|
37
38
|
/* @__PURE__ */ o.jsx(
|
|
38
39
|
"div",
|
|
39
40
|
{
|
|
40
|
-
onClick: (
|
|
41
|
-
className:
|
|
41
|
+
onClick: (l) => l.stopPropagation(),
|
|
42
|
+
className: y(
|
|
42
43
|
"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",
|
|
43
|
-
|
|
44
|
+
r
|
|
44
45
|
),
|
|
45
|
-
children: typeof e == "function" ? e(
|
|
46
|
+
children: typeof e == "function" ? e(d) : e
|
|
46
47
|
}
|
|
47
48
|
)
|
|
48
49
|
]
|
|
49
50
|
}
|
|
50
51
|
) });
|
|
51
|
-
return
|
|
52
|
+
return s ? C : F(C, document.body);
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
Content:
|
|
65
|
-
Header:
|
|
66
|
-
Footer:
|
|
67
|
-
Title:
|
|
55
|
+
N.displayName = "Dialog";
|
|
56
|
+
const h = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: /* @__PURE__ */ o.jsx("div", { className: y("flex flex-col gap-4 h-full"), children: e }) }));
|
|
57
|
+
h.displayName = "DialogContent";
|
|
58
|
+
const v = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("h1", { className: t, children: e }));
|
|
59
|
+
v.displayName = "DialogTitle";
|
|
60
|
+
const k = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
|
|
61
|
+
k.displayName = "DialogHeader";
|
|
62
|
+
const w = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
|
|
63
|
+
w.displayName = "DialogFooter";
|
|
64
|
+
const H = Object.assign(N, {
|
|
65
|
+
Content: h,
|
|
66
|
+
Header: k,
|
|
67
|
+
Footer: w,
|
|
68
|
+
Title: v
|
|
68
69
|
});
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
const e =
|
|
72
|
-
e.current?.open(
|
|
73
|
-
}, []),
|
|
70
|
+
H.displayName = "DialogModal";
|
|
71
|
+
const M = () => {
|
|
72
|
+
const e = g(null), t = n((i) => {
|
|
73
|
+
e.current?.open(i);
|
|
74
|
+
}, []), r = n(() => {
|
|
74
75
|
e.current?.close();
|
|
75
|
-
}, []),
|
|
76
|
+
}, []), s = n(() => e.current?.isOpen ?? !1, []), c = n(() => e.current?.getContext() ?? null, []);
|
|
76
77
|
return {
|
|
77
78
|
ref: e,
|
|
78
79
|
open: t,
|
|
79
|
-
close:
|
|
80
|
-
isOpen:
|
|
81
|
-
getContext:
|
|
80
|
+
close: r,
|
|
81
|
+
isOpen: s,
|
|
82
|
+
getContext: c
|
|
82
83
|
};
|
|
83
84
|
};
|
|
84
85
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
H as default,
|
|
87
|
+
M as useDialogControl
|
|
87
88
|
};
|
package/dist/DrawerDesktop.es.js
CHANGED
|
@@ -1,116 +1,119 @@
|
|
|
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
|
-
import { createPortal as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
import
|
|
7
|
-
import { Close as
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
modal:
|
|
11
|
-
children:
|
|
4
|
+
import { createPortal as B } from "react-dom";
|
|
5
|
+
import { forwardRef as L, useRef as p, useState as v, useEffect as a, useCallback as x, useImperativeHandle as Y } from "react";
|
|
6
|
+
import F from "./Button.es.js";
|
|
7
|
+
import { Close as H } from "./Icons/Close.es.js";
|
|
8
|
+
const $ = L((t, i) => {
|
|
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
|
-
attachToParent:
|
|
15
|
-
closeOnOverlayClick:
|
|
14
|
+
attachToParent: h = !1,
|
|
15
|
+
closeOnOverlayClick: n = !1,
|
|
16
16
|
hideCloseButton: N = !1,
|
|
17
|
-
unmountChildrenOnClose:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
unmountChildrenOnClose: C = !1,
|
|
18
|
+
zindex: T = 499
|
|
19
|
+
} = t, k = p(n), D = p(e);
|
|
20
|
+
c.current = r;
|
|
21
|
+
const [V, P] = v(() => !C);
|
|
22
|
+
a(() => {
|
|
23
|
+
C && e && P(!0);
|
|
24
|
+
}, [e, C]), a(() => {
|
|
24
25
|
D.current = e;
|
|
25
|
-
}, [e]),
|
|
26
|
-
|
|
27
|
-
}, [r]),
|
|
28
|
-
k.current =
|
|
29
|
-
}, [
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
26
|
+
}, [e]), a(() => {
|
|
27
|
+
c.current = r;
|
|
28
|
+
}, [r]), a(() => {
|
|
29
|
+
k.current = n;
|
|
30
|
+
}, [n]);
|
|
31
|
+
const I = (o) => {
|
|
32
|
+
if (!l.current)
|
|
32
33
|
return;
|
|
33
|
-
const
|
|
34
|
-
|
|
34
|
+
const E = l.current;
|
|
35
|
+
E && !E.contains(o.target) && k.current && D.current && w();
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
-
if (!k.current ||
|
|
37
|
+
a(() => {
|
|
38
|
+
if (!k.current || y || !e)
|
|
38
39
|
return;
|
|
39
|
-
const
|
|
40
|
-
document.addEventListener("click",
|
|
40
|
+
const o = setTimeout(() => {
|
|
41
|
+
document.addEventListener("click", I);
|
|
41
42
|
}, 0);
|
|
42
43
|
return () => {
|
|
43
|
-
clearTimeout(
|
|
44
|
+
clearTimeout(o), document.removeEventListener("click", I);
|
|
44
45
|
};
|
|
45
|
-
}, [
|
|
46
|
+
}, [n, e, y]), a(() => {
|
|
46
47
|
d.current = t.onClose;
|
|
47
48
|
}, [t.onClose]);
|
|
48
|
-
const z =
|
|
49
|
-
o
|
|
50
|
-
}, []), w =
|
|
51
|
-
u(!1), d.current?.(
|
|
49
|
+
const z = x((o) => {
|
|
50
|
+
s(o ?? null), u(!0);
|
|
51
|
+
}, []), w = x(() => {
|
|
52
|
+
u(!1), d.current?.(c.current), setTimeout(() => s(null), 300);
|
|
52
53
|
}, []);
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
a(() => {
|
|
55
|
+
b.current.forEach((o) => {
|
|
55
56
|
try {
|
|
56
|
-
|
|
57
|
+
o(e);
|
|
57
58
|
} catch {
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
|
-
}, [e]),
|
|
61
|
+
}, [e]), Y(
|
|
61
62
|
i,
|
|
62
63
|
() => ({
|
|
63
64
|
open: z,
|
|
64
65
|
close: w,
|
|
65
66
|
isOpen: e,
|
|
66
|
-
subscribeOpenChange: (
|
|
67
|
-
|
|
67
|
+
subscribeOpenChange: (o) => (b.current.add(o), () => {
|
|
68
|
+
b.current.delete(o);
|
|
68
69
|
}),
|
|
69
|
-
getContext: () =>
|
|
70
|
+
getContext: () => c.current
|
|
70
71
|
}),
|
|
71
72
|
[e, z, w]
|
|
72
73
|
);
|
|
73
|
-
const
|
|
74
|
-
|
|
74
|
+
const S = /* @__PURE__ */ m.jsx(
|
|
75
|
+
q,
|
|
75
76
|
{
|
|
76
77
|
context: r,
|
|
77
|
-
ref:
|
|
78
|
+
ref: l,
|
|
78
79
|
isOpen: e,
|
|
79
80
|
close: w,
|
|
80
81
|
direction: O,
|
|
81
|
-
modal:
|
|
82
|
+
modal: y,
|
|
82
83
|
className: g,
|
|
83
|
-
attachToParent:
|
|
84
|
-
closeOnOverlayClick:
|
|
84
|
+
attachToParent: h,
|
|
85
|
+
closeOnOverlayClick: n,
|
|
85
86
|
hideCloseButton: N,
|
|
86
|
-
|
|
87
|
+
zindex: T,
|
|
88
|
+
children: (!C || V) && (typeof f == "function" ? f(r) : f)
|
|
87
89
|
}
|
|
88
90
|
);
|
|
89
|
-
return
|
|
91
|
+
return h ? S : B(S, document.body);
|
|
90
92
|
});
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
+
$.displayName = "DrawerDesktopV2";
|
|
94
|
+
const q = ({
|
|
93
95
|
ref: t,
|
|
94
96
|
children: i,
|
|
95
|
-
direction:
|
|
97
|
+
direction: l = "left",
|
|
96
98
|
isOpen: e,
|
|
97
99
|
close: u,
|
|
98
100
|
modal: r = !1,
|
|
99
|
-
className:
|
|
101
|
+
className: s,
|
|
100
102
|
attachToParent: d = !1,
|
|
101
|
-
closeOnOverlayClick:
|
|
102
|
-
hideCloseButton:
|
|
103
|
-
context:
|
|
103
|
+
closeOnOverlayClick: c = !1,
|
|
104
|
+
hideCloseButton: b = !1,
|
|
105
|
+
context: y,
|
|
106
|
+
zindex: f = 499
|
|
104
107
|
}) => {
|
|
105
|
-
|
|
108
|
+
a(() => {
|
|
106
109
|
if (e && r) {
|
|
107
|
-
const
|
|
108
|
-
return document.body.style.position = "fixed", document.body.style.top = `-${
|
|
109
|
-
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0,
|
|
110
|
+
const n = window.scrollY;
|
|
111
|
+
return document.body.style.position = "fixed", document.body.style.top = `-${n}px`, document.body.style.width = "100%", () => {
|
|
112
|
+
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, n);
|
|
110
113
|
};
|
|
111
114
|
}
|
|
112
115
|
}, [e, r]);
|
|
113
|
-
const
|
|
116
|
+
const g = j("border-neutral-strong-default", {
|
|
114
117
|
variants: {
|
|
115
118
|
isOpen: {
|
|
116
119
|
true: "desktop-drawer-visible",
|
|
@@ -121,7 +124,7 @@ const $ = ({
|
|
|
121
124
|
right: "right-0 border-l-[1px] border-r-0"
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
|
-
}),
|
|
127
|
+
}), O = j(
|
|
125
128
|
"fixed inset-0 bg-black/60 z-[55] cursor-default",
|
|
126
129
|
{
|
|
127
130
|
variants: {
|
|
@@ -131,7 +134,7 @@ const $ = ({
|
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
|
-
),
|
|
137
|
+
), h = j("", {
|
|
135
138
|
variants: {
|
|
136
139
|
direction: {
|
|
137
140
|
left: "right-0",
|
|
@@ -139,35 +142,37 @@ const $ = ({
|
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
});
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
r && /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
|
|
146
|
+
r && /* @__PURE__ */ m.jsx(
|
|
144
147
|
"div",
|
|
145
148
|
{
|
|
146
|
-
className: R(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
className: R(O({ isOpen: e })),
|
|
150
|
+
style: { zIndex: f },
|
|
151
|
+
onClick: (n) => {
|
|
152
|
+
n.preventDefault(), n.stopPropagation(), c && u();
|
|
149
153
|
},
|
|
150
154
|
"aria-hidden": "true"
|
|
151
155
|
}
|
|
152
156
|
),
|
|
153
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ m.jsxs(
|
|
154
158
|
"div",
|
|
155
159
|
{
|
|
156
160
|
ref: t,
|
|
157
161
|
className: R(
|
|
158
162
|
"bg-neutral-strong-default h-full top-0 z-60 w-max overflow-y-auto",
|
|
159
163
|
d ? "absolute" : "fixed",
|
|
160
|
-
|
|
161
|
-
!
|
|
162
|
-
|
|
164
|
+
g({ isOpen: e, direction: l }),
|
|
165
|
+
!b && "p-4 pt-10",
|
|
166
|
+
s
|
|
163
167
|
),
|
|
164
168
|
role: "dialog",
|
|
165
169
|
"aria-modal": r,
|
|
170
|
+
style: { zIndex: f + 1 },
|
|
166
171
|
children: [
|
|
167
|
-
!
|
|
168
|
-
|
|
172
|
+
!b && /* @__PURE__ */ m.jsx(
|
|
173
|
+
F,
|
|
169
174
|
{
|
|
170
|
-
icon: /* @__PURE__ */
|
|
175
|
+
icon: /* @__PURE__ */ m.jsx(H, { size: 24 }),
|
|
171
176
|
animate: !1,
|
|
172
177
|
animateIcon: !1,
|
|
173
178
|
type: "button",
|
|
@@ -178,27 +183,28 @@ const $ = ({
|
|
|
178
183
|
color: "secondary",
|
|
179
184
|
className: R(
|
|
180
185
|
"absolute top-0 z-50",
|
|
181
|
-
|
|
186
|
+
h({ direction: l })
|
|
182
187
|
),
|
|
183
|
-
"aria-label": "Close drawer"
|
|
188
|
+
"aria-label": "Close drawer",
|
|
189
|
+
style: { zIndex: f + 2 }
|
|
184
190
|
}
|
|
185
191
|
),
|
|
186
|
-
typeof i == "function" ? i(
|
|
192
|
+
typeof i == "function" ? i(y) : i
|
|
187
193
|
]
|
|
188
194
|
}
|
|
189
195
|
)
|
|
190
196
|
] });
|
|
191
|
-
},
|
|
192
|
-
const t =
|
|
193
|
-
t.current?.open(
|
|
194
|
-
}, []), u =
|
|
197
|
+
}, W = () => {
|
|
198
|
+
const t = p(null), [i, l] = v(!1), e = x((s) => {
|
|
199
|
+
t.current?.open(s);
|
|
200
|
+
}, []), u = x(() => {
|
|
195
201
|
t.current?.close();
|
|
196
|
-
}, []), r =
|
|
197
|
-
return
|
|
198
|
-
const
|
|
199
|
-
if (!
|
|
200
|
-
const d =
|
|
201
|
-
|
|
202
|
+
}, []), r = x(() => t.current?.getContext() ?? null, []);
|
|
203
|
+
return a(() => {
|
|
204
|
+
const s = t.current?.subscribeOpenChange;
|
|
205
|
+
if (!s) return;
|
|
206
|
+
const d = s((c) => {
|
|
207
|
+
l(c);
|
|
202
208
|
});
|
|
203
209
|
return () => {
|
|
204
210
|
d && d();
|
|
@@ -212,6 +218,6 @@ const $ = ({
|
|
|
212
218
|
};
|
|
213
219
|
};
|
|
214
220
|
export {
|
|
215
|
-
|
|
216
|
-
|
|
221
|
+
$ as default,
|
|
222
|
+
W as useDrawerDesktop
|
|
217
223
|
};
|
|
@@ -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
|
+
zindex?: number;
|
|
6
7
|
attachToParent?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface DialogHandle<TContext = unknown> {
|
|
@@ -16,6 +16,7 @@ export interface DrawerDesktopProps<TContext = unknown> {
|
|
|
16
16
|
closeOnOverlayClick?: boolean;
|
|
17
17
|
hideCloseButton?: boolean;
|
|
18
18
|
unmountChildrenOnClose?: boolean;
|
|
19
|
+
zindex?: number;
|
|
19
20
|
}
|
|
20
21
|
declare const DrawerDesktop: import('react').ForwardRefExoticComponent<DrawerDesktopProps<any> & import('react').RefAttributes<DrawerDesktopHandle<any>>>;
|
|
21
22
|
export default DrawerDesktop;
|