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