prometeo-design-system 7.4.2 → 7.4.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/DesktopModal.es.js +2 -2
- package/dist/DialogModal.es.js +1 -1
- package/dist/DrawerMobile-D8KsbqMY.js +552 -0
- package/dist/DrawerMobile.es.js +1 -1
- package/dist/Menu.es.js +1 -1
- package/dist/Modal.es.js +118 -126
- package/dist/TabSwitch.es.js +1 -1
- package/dist/components/Drawer/DrawerSlotContext.d.ts +0 -2
- package/dist/components/Modal/DesktopModal.d.ts +2 -8
- package/dist/components/Modal/Modal.d.ts +2 -6
- package/dist/prometeo-design-system.es.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/{useModalControl-3Dx1Wop_.js → useModalControl-wMqv8xVn.js} +126 -128
- package/package.json +1 -1
- package/src/styles/base.css +1 -123
- package/src/styles/intellisense.css +5 -3
- package/src/styles/utilities/scrollbar.css +100 -0
- package/src/styles/utilities.css +36 -50
- package/dist/DrawerMobile-BzwNbhK7.js +0 -566
package/dist/DesktopModal.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as o, a as t } from "./useModalControl-
|
|
2
|
-
import { D as u } from "./useModalControl-
|
|
1
|
+
import { u as o, a as t } from "./useModalControl-wMqv8xVn.js";
|
|
2
|
+
import { D as u } from "./useModalControl-wMqv8xVn.js";
|
|
3
3
|
const e = o, s = t;
|
|
4
4
|
export {
|
|
5
5
|
u as default,
|
package/dist/DialogModal.es.js
CHANGED
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { j as i } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
+
import $e, { useContext as ht, createContext as mt, useRef as f, useState as ge, useMemo as me, useCallback as n, useLayoutEffect as ne, useEffect as P, forwardRef as gt, useImperativeHandle as pt } from "react";
|
|
3
|
+
import { createPortal as yt } from "react-dom";
|
|
4
|
+
import { c as M } from "./cn-B6yFEsav.js";
|
|
5
|
+
import xt from "./Divider.es.js";
|
|
6
|
+
import bt from "./IconButton.es.js";
|
|
7
|
+
import { Close as vt } from "./Icons/Close.es.js";
|
|
8
|
+
const ke = mt(
|
|
9
|
+
null
|
|
10
|
+
);
|
|
11
|
+
function _t() {
|
|
12
|
+
const u = ht(ke);
|
|
13
|
+
if (!u)
|
|
14
|
+
throw new Error(
|
|
15
|
+
"Drawer slot components must be used inside <DrawerMobile> or <DrawerPanel>"
|
|
16
|
+
);
|
|
17
|
+
return u;
|
|
18
|
+
}
|
|
19
|
+
function wt(u, a) {
|
|
20
|
+
return {
|
|
21
|
+
title: a.title,
|
|
22
|
+
headerChildren: a.header,
|
|
23
|
+
headerActions: a.headerActions,
|
|
24
|
+
headerClassName: a.classNameHeader,
|
|
25
|
+
content: u,
|
|
26
|
+
contentClassName: a.classNameContent,
|
|
27
|
+
footer: a.footer,
|
|
28
|
+
footerClassName: a.classNameFooter
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const Oe = "0.5s cubic-bezier(0.32, 0.72, 0, 1)", Ht = `transform ${Oe}`, St = `height ${Oe}`, Et = 24, Rt = 0.05, Ct = 5;
|
|
32
|
+
function Ge(u, a, X) {
|
|
33
|
+
if (typeof u == "string" && u.endsWith("%")) {
|
|
34
|
+
const S = parseFloat(u);
|
|
35
|
+
return S <= 0 ? X : S > 100 ? a : Math.min(S, 100) / 100 * a;
|
|
36
|
+
}
|
|
37
|
+
return typeof u == "string" && u.endsWith("px") ? parseFloat(u) : typeof u == "number" ? u >= 0 && u <= 1 ? u * a : u : 0;
|
|
38
|
+
}
|
|
39
|
+
function Dt({
|
|
40
|
+
children: u,
|
|
41
|
+
attachToParent: a = !1,
|
|
42
|
+
className: X,
|
|
43
|
+
classNameContent: S,
|
|
44
|
+
classNameFooter: J,
|
|
45
|
+
classNameHeader: K,
|
|
46
|
+
isOpen: y,
|
|
47
|
+
applySnapRef: _,
|
|
48
|
+
onSnapChange: v,
|
|
49
|
+
snapPoints: oe = [0, "auto", 1],
|
|
50
|
+
hideOnClose: Q = !1,
|
|
51
|
+
unmountChildrenOnClose: g = !1,
|
|
52
|
+
header: j,
|
|
53
|
+
headerActions: Z,
|
|
54
|
+
modal: B = !1,
|
|
55
|
+
closeOnOverlayClick: V = !1,
|
|
56
|
+
context: E,
|
|
57
|
+
footer: $,
|
|
58
|
+
zIndex: R = 60,
|
|
59
|
+
chromeHeightGetterRef: A,
|
|
60
|
+
hideCloseButton: se = !1,
|
|
61
|
+
title: w,
|
|
62
|
+
onRequestClose: G
|
|
63
|
+
}) {
|
|
64
|
+
const C = typeof u == "function" ? u(E) : u, H = !!(w || j || $), x = H ? wt(C, {
|
|
65
|
+
title: w,
|
|
66
|
+
header: j,
|
|
67
|
+
headerActions: Z,
|
|
68
|
+
footer: $,
|
|
69
|
+
classNameHeader: K,
|
|
70
|
+
classNameContent: S,
|
|
71
|
+
classNameFooter: J
|
|
72
|
+
}) : null, ee = x?.title ?? w, s = x?.headerChildren ?? j, D = x?.headerActions ?? Z, b = x?.footer ?? $, We = M(K, x?.headerClassName), qe = M(S, x?.contentClassName), ze = M(J, x?.footerClassName), Ue = x?.content ?? null, Xe = () => s ? typeof s == "string" ? /* @__PURE__ */ i.jsx(
|
|
73
|
+
"p",
|
|
74
|
+
{
|
|
75
|
+
style: { zIndex: R + 2 },
|
|
76
|
+
className: "pyrion-fonts-body-small text-neutral-secondary-default w-full text-balance",
|
|
77
|
+
children: s
|
|
78
|
+
}
|
|
79
|
+
) : typeof s == "function" ? s(E) : $e.isValidElement(s) ? s : typeof s == "object" && "$$typeof" in s ? $e.createElement(
|
|
80
|
+
s,
|
|
81
|
+
{ context: E }
|
|
82
|
+
) : s : null, Je = () => D ? typeof D == "function" ? D(E) : D : null, Ke = () => b ? typeof b == "function" ? b(E) : b : null, c = f(null), ce = f(null), pe = f(null), k = f(0), ye = f("0%"), De = {
|
|
83
|
+
header: null,
|
|
84
|
+
headerTitle: null,
|
|
85
|
+
headerActions: null,
|
|
86
|
+
headerBody: null,
|
|
87
|
+
content: null,
|
|
88
|
+
footer: null
|
|
89
|
+
}, O = f({ ...De }), [xe, Qe] = ge(De), W = me(() => {
|
|
90
|
+
const e = (r) => (t) => {
|
|
91
|
+
O.current[r] !== t && (O.current[r] = t, Qe(
|
|
92
|
+
(o) => o[r] === t ? o : { ...o, [r]: t }
|
|
93
|
+
));
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
header: e("header"),
|
|
97
|
+
headerTitle: e("headerTitle"),
|
|
98
|
+
headerActions: e("headerActions"),
|
|
99
|
+
headerBody: e("headerBody"),
|
|
100
|
+
content: e("content"),
|
|
101
|
+
footer: e("footer")
|
|
102
|
+
};
|
|
103
|
+
}, []), Ze = me(
|
|
104
|
+
() => ({ regions: xe }),
|
|
105
|
+
[xe]
|
|
106
|
+
), le = n(() => O.current.header, []), m = n(() => O.current.content, []), q = n(() => O.current.footer, []), L = f(null), ie = f(null), be = f(0), ve = f(!0), we = f(null), He = f(null), d = n(() => Q ? 0 : pe.current?.offsetHeight ?? 0, [Q]), N = n(() => {
|
|
107
|
+
if (!c.current) return 0;
|
|
108
|
+
const e = getComputedStyle(c.current);
|
|
109
|
+
return parseFloat(e.paddingTop) + parseFloat(e.paddingBottom);
|
|
110
|
+
}, []), p = n(() => c.current && a && c.current.parentElement?.offsetHeight || window.innerHeight, [a]), z = n(() => {
|
|
111
|
+
if (!c.current) return 0;
|
|
112
|
+
const e = p(), t = c.current.style.transform.match(/translateY\(([^)]+)px\)/);
|
|
113
|
+
return t ? e - parseFloat(t[1]) : 0;
|
|
114
|
+
}, [p]), ae = n((e, r) => {
|
|
115
|
+
const t = [e > 0, !0, r > 0].filter(Boolean).length;
|
|
116
|
+
return Et * Math.max(0, t - 1);
|
|
117
|
+
}, []), Se = n(() => {
|
|
118
|
+
const e = N(), r = le()?.offsetHeight ?? 0, t = q()?.offsetHeight ?? 0, o = ae(r, t);
|
|
119
|
+
return e + r + t + o;
|
|
120
|
+
}, [ae, N, q, le]), U = n(() => {
|
|
121
|
+
const e = N(), r = le()?.offsetHeight ?? 0, t = m()?.scrollHeight ?? 0, o = q()?.offsetHeight ?? 0, l = ae(r, o);
|
|
122
|
+
return e + r + t + o + l;
|
|
123
|
+
}, [ae, N, m, q, le]);
|
|
124
|
+
ne(() => {
|
|
125
|
+
A && (A.current = Se);
|
|
126
|
+
}, [A, Se]);
|
|
127
|
+
const Ne = n(() => {
|
|
128
|
+
if (!c.current) return [];
|
|
129
|
+
const e = p(), r = d();
|
|
130
|
+
return oe?.map((t) => t === "auto" ? U() : typeof t == "string" && t.endsWith("%") ? parseFloat(t) > 100 ? e : parseFloat(t) / 100 * e : typeof t == "string" && t.endsWith("px") ? parseFloat(t) : typeof t == "number" && t >= 0 && t <= 1 ? t * e : t === 0 ? r : typeof t == "number" ? t : 0) || [];
|
|
131
|
+
}, [oe, p, d, U]), ue = n((e, r) => {
|
|
132
|
+
if (!ce.current) return;
|
|
133
|
+
const t = we.current ?? N(), o = He.current ?? d(), l = Math.max(0, e - t), h = e <= o, I = h ? be.current : l;
|
|
134
|
+
ce.current.style.transition = r ? St : "none", ce.current.style.height = `${I}px`, h || (be.current = I);
|
|
135
|
+
}, [N, d]), Te = n((e) => {
|
|
136
|
+
const r = m();
|
|
137
|
+
r && (r.classList.toggle("drawer-mobile-content--open", e), r.classList.toggle("drawer-mobile-content--closed", !e));
|
|
138
|
+
}, [m]), Ve = () => {
|
|
139
|
+
m()?.classList.remove("prometeo-scrollbar-none");
|
|
140
|
+
}, et = () => {
|
|
141
|
+
m()?.classList.add("prometeo-scrollbar-none");
|
|
142
|
+
}, Me = n((e, r) => {
|
|
143
|
+
const t = Ne();
|
|
144
|
+
if (t.length === 0) return e;
|
|
145
|
+
const o = d();
|
|
146
|
+
if (Math.abs(r) > Rt) {
|
|
147
|
+
if (r > 0) {
|
|
148
|
+
const h = t.filter((I) => I < e);
|
|
149
|
+
return h.length > 0 ? Math.max(...h) : o;
|
|
150
|
+
}
|
|
151
|
+
const l = t.filter((h) => h > e);
|
|
152
|
+
if (l.length > 0)
|
|
153
|
+
return Math.min(...l);
|
|
154
|
+
}
|
|
155
|
+
return t.reduce(
|
|
156
|
+
(l, h) => Math.abs(h - e) < Math.abs(l - e) ? h : l
|
|
157
|
+
);
|
|
158
|
+
}, [Ne, d]), je = n((e) => {
|
|
159
|
+
const r = d(), t = e <= r ? "0%" : e;
|
|
160
|
+
v(t);
|
|
161
|
+
}, [v, d]), tt = (e, r) => {
|
|
162
|
+
const t = Se(), o = e - t;
|
|
163
|
+
r > o ? Ve() : et();
|
|
164
|
+
}, T = n((e, r = !0) => {
|
|
165
|
+
if (!c.current) return;
|
|
166
|
+
const t = p(), o = Math.max(0, t - e);
|
|
167
|
+
ue(e, r), c.current.style.transition = Ht, c.current.style.transform = `translateY(${o}px)`;
|
|
168
|
+
const l = k.current || m()?.scrollHeight || 0;
|
|
169
|
+
tt(e, l);
|
|
170
|
+
}, [p, ue, m]), te = n((e) => {
|
|
171
|
+
if (!c.current) return;
|
|
172
|
+
const r = p(), t = Math.max(0, r - e);
|
|
173
|
+
c.current.style.transition = "none", c.current.style.transform = `translateY(${t}px)`, ue(e, !1);
|
|
174
|
+
}, [p, ue]), Ae = n(() => {
|
|
175
|
+
if (ie.current && a) {
|
|
176
|
+
const { scrollY: e } = ie.current;
|
|
177
|
+
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, e), ie.current = null;
|
|
178
|
+
}
|
|
179
|
+
}, [a]), Le = n(() => {
|
|
180
|
+
if (!a) return;
|
|
181
|
+
const e = window.scrollY;
|
|
182
|
+
ie.current = { scrollY: e }, document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.width = "100%";
|
|
183
|
+
}, [a]), fe = n(() => {
|
|
184
|
+
we.current = N(), He.current = d();
|
|
185
|
+
}, [N, d]), Fe = n(() => {
|
|
186
|
+
we.current = null, He.current = null;
|
|
187
|
+
}, []), Ee = n((e) => {
|
|
188
|
+
if (!c.current) return;
|
|
189
|
+
fe();
|
|
190
|
+
const r = e.touches[0], t = z();
|
|
191
|
+
L.current = {
|
|
192
|
+
isDragging: !1,
|
|
193
|
+
startY: r.clientY,
|
|
194
|
+
startHeight: t,
|
|
195
|
+
lastY: r.clientY,
|
|
196
|
+
lastTime: Date.now(),
|
|
197
|
+
velocity: 0
|
|
198
|
+
};
|
|
199
|
+
}, [z, fe]), Ye = n((e) => {
|
|
200
|
+
if (!c.current) return;
|
|
201
|
+
fe();
|
|
202
|
+
const r = z();
|
|
203
|
+
L.current = {
|
|
204
|
+
isDragging: !1,
|
|
205
|
+
startY: e.clientY,
|
|
206
|
+
startHeight: r,
|
|
207
|
+
lastY: e.clientY,
|
|
208
|
+
lastTime: Date.now(),
|
|
209
|
+
velocity: 0
|
|
210
|
+
};
|
|
211
|
+
}, [z, fe]), de = n((e, r) => {
|
|
212
|
+
if (!L.current || !c.current) return;
|
|
213
|
+
const t = L.current, o = t.startY - e, l = t.isDragging || Math.abs(o) > Ct;
|
|
214
|
+
if (!t.isDragging && l && (t.isDragging = !0, Le()), !l) return;
|
|
215
|
+
r.preventDefault();
|
|
216
|
+
const h = Date.now(), I = h - t.lastTime;
|
|
217
|
+
if (I > 0) {
|
|
218
|
+
const dt = (e - t.lastY) / I;
|
|
219
|
+
t.velocity = t.velocity * 0.8 + dt * 0.2;
|
|
220
|
+
}
|
|
221
|
+
t.lastY = e, t.lastTime = h;
|
|
222
|
+
const at = t.startHeight + o, ut = p(), ft = Math.max(0, Math.min(at, ut));
|
|
223
|
+
te(ft);
|
|
224
|
+
}, [Le, p, te]), Re = n((e) => {
|
|
225
|
+
de(e.touches[0].clientY, e);
|
|
226
|
+
}, [de]), Ie = n((e) => {
|
|
227
|
+
de(e.clientY, e);
|
|
228
|
+
}, [de]), F = n(() => {
|
|
229
|
+
if (L.current?.isDragging && c.current) {
|
|
230
|
+
Ae();
|
|
231
|
+
const e = z(), r = Me(e, L.current.velocity);
|
|
232
|
+
je(r);
|
|
233
|
+
}
|
|
234
|
+
L.current = null, Fe();
|
|
235
|
+
}, [Me, je, Ae, z, Fe]), Ce = n((e) => {
|
|
236
|
+
Ye(e);
|
|
237
|
+
const r = (o) => Ie(o), t = () => {
|
|
238
|
+
document.removeEventListener("mousemove", r, { capture: !0 }), document.removeEventListener("mouseup", t, { capture: !0 }), F();
|
|
239
|
+
};
|
|
240
|
+
document.addEventListener("mousemove", r, { passive: !1, capture: !0 }), document.addEventListener("mouseup", t, { capture: !0 });
|
|
241
|
+
}, [Ye, Ie, F]);
|
|
242
|
+
P(() => {
|
|
243
|
+
const e = pe.current;
|
|
244
|
+
if (e)
|
|
245
|
+
return e.addEventListener("touchstart", Ee, { passive: !1 }), e.addEventListener("touchmove", Re, { passive: !1 }), e.addEventListener("touchend", F), e.addEventListener("touchcancel", F), e.addEventListener("mousedown", Ce, { passive: !1 }), () => {
|
|
246
|
+
e.removeEventListener("touchstart", Ee), e.removeEventListener("touchmove", Re), e.removeEventListener("touchend", F), e.removeEventListener("touchcancel", F), e.removeEventListener("mousedown", Ce);
|
|
247
|
+
};
|
|
248
|
+
}, [Ee, Re, F, Ce]);
|
|
249
|
+
const [Y, Pe] = ge(() => g ? y : !0);
|
|
250
|
+
g && y && !Y && Pe(!0);
|
|
251
|
+
const re = f(null);
|
|
252
|
+
P(() => {
|
|
253
|
+
if (!g) return;
|
|
254
|
+
const e = c.current;
|
|
255
|
+
if (!e) return;
|
|
256
|
+
const r = (t) => {
|
|
257
|
+
t.propertyName === "transform" && (y || Pe(!1));
|
|
258
|
+
};
|
|
259
|
+
return e.addEventListener("transitionend", r), () => e.removeEventListener("transitionend", r);
|
|
260
|
+
}, [y, g]);
|
|
261
|
+
const _e = n((e) => {
|
|
262
|
+
const r = e === "0%";
|
|
263
|
+
!r && ve.current && (be.current = d()), ve.current = r;
|
|
264
|
+
}, [d]), Be = n(() => {
|
|
265
|
+
c.current && (c.current.style.visibility = "hidden", te(d()), requestAnimationFrame(() => {
|
|
266
|
+
requestAnimationFrame(() => {
|
|
267
|
+
if (!c.current) return;
|
|
268
|
+
const e = q(), r = !b || e != null && e.children.length >= 0, t = m(), o = t && t.children.length > 0;
|
|
269
|
+
t && o && r ? (k.current = t.scrollHeight, T(U(), !1), c.current.style.visibility = "") : (r && te(d()), c.current.style.visibility = "");
|
|
270
|
+
});
|
|
271
|
+
}));
|
|
272
|
+
}, [
|
|
273
|
+
b,
|
|
274
|
+
te,
|
|
275
|
+
d,
|
|
276
|
+
T,
|
|
277
|
+
U,
|
|
278
|
+
m,
|
|
279
|
+
q
|
|
280
|
+
]), he = n((e) => {
|
|
281
|
+
if (!e) return;
|
|
282
|
+
if (ye.current = e, g && !Y && e !== "0%") {
|
|
283
|
+
re.current = e;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
re.current = null, Te(e !== "0%"), Y && m() && k.current === 0 && (k.current = m()?.scrollHeight ?? 0);
|
|
287
|
+
const r = e !== "0%" && ve.current;
|
|
288
|
+
if (_e(e), e === "auto") {
|
|
289
|
+
Be();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const t = p(), o = d(), l = Ge(e, t, o);
|
|
293
|
+
T(l, !r);
|
|
294
|
+
}, [
|
|
295
|
+
g,
|
|
296
|
+
Y,
|
|
297
|
+
_e,
|
|
298
|
+
Be,
|
|
299
|
+
T,
|
|
300
|
+
p,
|
|
301
|
+
d,
|
|
302
|
+
Te,
|
|
303
|
+
m
|
|
304
|
+
]);
|
|
305
|
+
ne(() => {
|
|
306
|
+
if (!y) return;
|
|
307
|
+
const e = ye.current;
|
|
308
|
+
if (!e || e === "0%") return;
|
|
309
|
+
const r = m();
|
|
310
|
+
if (r) {
|
|
311
|
+
const h = r.scrollHeight;
|
|
312
|
+
h > 0 && (k.current = h);
|
|
313
|
+
}
|
|
314
|
+
const t = p(), o = d(), l = Ge(e, t, o);
|
|
315
|
+
T(l, !1);
|
|
316
|
+
}, [y, p, d, T, m]), ne(() => {
|
|
317
|
+
if (!y) return;
|
|
318
|
+
const e = O.current.content;
|
|
319
|
+
if (!e) return;
|
|
320
|
+
let r = 0;
|
|
321
|
+
const t = () => {
|
|
322
|
+
if (ye.current !== "auto") return;
|
|
323
|
+
const l = e.scrollHeight;
|
|
324
|
+
l <= 0 || l === r || (r = l, k.current = l, T(U(), !0));
|
|
325
|
+
};
|
|
326
|
+
t();
|
|
327
|
+
const o = new ResizeObserver(t);
|
|
328
|
+
return o.observe(e), () => o.disconnect();
|
|
329
|
+
}, [y, xe.content, T, U]), ne(() => (_.current = he, () => {
|
|
330
|
+
_.current = null;
|
|
331
|
+
}), [he]), ne(() => {
|
|
332
|
+
if (Y && re.current) {
|
|
333
|
+
const e = re.current;
|
|
334
|
+
re.current = null, he(e);
|
|
335
|
+
}
|
|
336
|
+
}, [Y, he]);
|
|
337
|
+
const rt = me(
|
|
338
|
+
() => navigator.userAgent.includes("iPhone") || navigator.userAgent.includes("iPad") || navigator.userAgent.includes("iPod"),
|
|
339
|
+
[]
|
|
340
|
+
), nt = me(() => window.matchMedia("(display-mode: standalone)").matches, []), ot = Q ? 0 : d(), st = /* @__PURE__ */ i.jsxs(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
ref: W.header,
|
|
344
|
+
className: M(
|
|
345
|
+
"pb-4 flex flex-col gap-3 items-start justify-start border-b border-neutral-default-default",
|
|
346
|
+
We
|
|
347
|
+
),
|
|
348
|
+
children: [
|
|
349
|
+
/* @__PURE__ */ i.jsxs("div", { className: "pl-4 pr-2 gap-1 flex items-end w-full", children: [
|
|
350
|
+
/* @__PURE__ */ i.jsx(
|
|
351
|
+
"div",
|
|
352
|
+
{
|
|
353
|
+
ref: W.headerTitle,
|
|
354
|
+
className: "flex-1 min-w-0 flex items-end",
|
|
355
|
+
children: H && ee ? /* @__PURE__ */ i.jsx("h4", { className: "pyrion-fonts-headline-small text-neutral-primary-default flex-1 truncate", children: ee }) : null
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
/* @__PURE__ */ i.jsx(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
ref: W.headerActions,
|
|
362
|
+
className: "flex shrink-0 pl-4 pr-2 gap-1 items-end",
|
|
363
|
+
children: H ? Je() : null
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
!se && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
367
|
+
/* @__PURE__ */ i.jsx(xt, { orientation: "vertical" }),
|
|
368
|
+
/* @__PURE__ */ i.jsx(
|
|
369
|
+
bt,
|
|
370
|
+
{
|
|
371
|
+
icon: vt,
|
|
372
|
+
variant: "text",
|
|
373
|
+
color: "neutral",
|
|
374
|
+
size: "small",
|
|
375
|
+
onClick: G
|
|
376
|
+
}
|
|
377
|
+
)
|
|
378
|
+
] })
|
|
379
|
+
] }),
|
|
380
|
+
/* @__PURE__ */ i.jsx("div", { ref: W.headerBody, className: "w-full", children: H ? Xe() : null })
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
), ct = /* @__PURE__ */ i.jsx(
|
|
384
|
+
"div",
|
|
385
|
+
{
|
|
386
|
+
ref: W.content,
|
|
387
|
+
className: M(
|
|
388
|
+
"drawer-mobile-content pyrion-scrollbar-thin-weak",
|
|
389
|
+
y ? "drawer-mobile-content--open" : "drawer-mobile-content--closed",
|
|
390
|
+
"w-full flex-1 min-h-0 overflow-y-auto",
|
|
391
|
+
"flex flex-col gap-6 px-4 items-start justify-start",
|
|
392
|
+
qe
|
|
393
|
+
),
|
|
394
|
+
children: (!g || Y) && (H ? Ue : C)
|
|
395
|
+
}
|
|
396
|
+
), lt = /* @__PURE__ */ i.jsx(
|
|
397
|
+
"div",
|
|
398
|
+
{
|
|
399
|
+
ref: W.footer,
|
|
400
|
+
className: M(
|
|
401
|
+
"w-full flex px-4 pt-4 gap-4 pb-0 items-center justify-center",
|
|
402
|
+
"border-t border-neutral-default-default",
|
|
403
|
+
"shrink-0",
|
|
404
|
+
nt && rt && "pb-8",
|
|
405
|
+
ze
|
|
406
|
+
),
|
|
407
|
+
children: H && b ? Ke() : null
|
|
408
|
+
}
|
|
409
|
+
), it = /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
410
|
+
ct,
|
|
411
|
+
lt
|
|
412
|
+
] });
|
|
413
|
+
return /* @__PURE__ */ i.jsx(ke.Provider, { value: Ze, children: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
414
|
+
(B || V) && /* @__PURE__ */ i.jsx(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
style: { zIndex: R },
|
|
418
|
+
className: M(
|
|
419
|
+
y ? "fixed inset-0 cursor-default" : "hidden",
|
|
420
|
+
B && "bg-black/40"
|
|
421
|
+
),
|
|
422
|
+
onClick: (e) => {
|
|
423
|
+
e.preventDefault(), e.stopPropagation(), V && G();
|
|
424
|
+
},
|
|
425
|
+
"aria-hidden": "true"
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ i.jsxs(
|
|
429
|
+
"div",
|
|
430
|
+
{
|
|
431
|
+
ref: c,
|
|
432
|
+
style: { zIndex: R, transform: "translateY(100%)" },
|
|
433
|
+
className: M(
|
|
434
|
+
"h-full",
|
|
435
|
+
a ? "absolute" : "fixed",
|
|
436
|
+
"bottom-0 w-full overflow-hidden",
|
|
437
|
+
"bg-neutral-default-default",
|
|
438
|
+
"border-t border-neutral-default-default rounded-t-300",
|
|
439
|
+
"flex flex-col items-center pt-7 pb-6 gap-2",
|
|
440
|
+
"touch-none select-none will-change-transform",
|
|
441
|
+
X
|
|
442
|
+
),
|
|
443
|
+
children: [
|
|
444
|
+
/* @__PURE__ */ i.jsx(
|
|
445
|
+
"div",
|
|
446
|
+
{
|
|
447
|
+
ref: pe,
|
|
448
|
+
style: { zIndex: R + 1 },
|
|
449
|
+
className: "w-full absolute top-0 pt-4 pb-2 flex items-end justify-center cursor-grab active:cursor-grabbing bg-inherit!",
|
|
450
|
+
children: /* @__PURE__ */ i.jsx("span", { className: "w-12 h-1 rounded-full bg-neutral-tertiary-default" })
|
|
451
|
+
}
|
|
452
|
+
),
|
|
453
|
+
/* @__PURE__ */ i.jsxs(
|
|
454
|
+
"div",
|
|
455
|
+
{
|
|
456
|
+
ref: ce,
|
|
457
|
+
style: { height: `${ot}px` },
|
|
458
|
+
className: "w-full flex flex-col min-h-0 overflow-hidden gap-6",
|
|
459
|
+
children: [
|
|
460
|
+
st,
|
|
461
|
+
it
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
)
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
)
|
|
468
|
+
] }) });
|
|
469
|
+
}
|
|
470
|
+
const Nt = Dt, Tt = 300, Mt = gt(function(a, X) {
|
|
471
|
+
const {
|
|
472
|
+
children: S,
|
|
473
|
+
defaultOpen: J = !1,
|
|
474
|
+
onClose: K,
|
|
475
|
+
snapPoints: y = ["auto"],
|
|
476
|
+
setSnap: _,
|
|
477
|
+
snap: v,
|
|
478
|
+
attachToParent: oe = !1,
|
|
479
|
+
classNameHeader: Q
|
|
480
|
+
} = a, g = f(v || "0%"), [j, Z] = ge(!1), [B, V] = ge(null), E = f(K), $ = f(_), R = f(B), A = f(/* @__PURE__ */ new Set()), se = f(() => 0), w = f(null), G = f(null);
|
|
481
|
+
E.current = K, R.current = B, P(() => {
|
|
482
|
+
$.current = _;
|
|
483
|
+
}, [_]);
|
|
484
|
+
const C = n((s) => {
|
|
485
|
+
const D = g.current !== "0%";
|
|
486
|
+
g.current = s;
|
|
487
|
+
const b = s !== "0%";
|
|
488
|
+
D !== b && Z(b), $.current?.(s), G.current?.(s);
|
|
489
|
+
}, []);
|
|
490
|
+
P(() => {
|
|
491
|
+
if (v == null || v === g.current) return;
|
|
492
|
+
g.current = v, Z(v !== "0%"), G.current?.(v);
|
|
493
|
+
}, [v]), P(() => {
|
|
494
|
+
J && x();
|
|
495
|
+
}, [J]);
|
|
496
|
+
const H = n(() => {
|
|
497
|
+
C("0%"), E.current?.(R.current), w.current && clearTimeout(w.current), w.current = setTimeout(() => {
|
|
498
|
+
V(null), w.current = null;
|
|
499
|
+
}, Tt);
|
|
500
|
+
}, [C]);
|
|
501
|
+
P(() => () => {
|
|
502
|
+
w.current && clearTimeout(w.current);
|
|
503
|
+
}, []);
|
|
504
|
+
const x = n(
|
|
505
|
+
(s, D) => {
|
|
506
|
+
const b = D || y[0] || "60%";
|
|
507
|
+
V(s ?? null), C(b);
|
|
508
|
+
},
|
|
509
|
+
[y, C]
|
|
510
|
+
);
|
|
511
|
+
P(() => {
|
|
512
|
+
A.current.forEach((s) => {
|
|
513
|
+
try {
|
|
514
|
+
s(j);
|
|
515
|
+
} catch {
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}, [j]), pt(
|
|
519
|
+
X,
|
|
520
|
+
() => ({
|
|
521
|
+
open: x,
|
|
522
|
+
close: H,
|
|
523
|
+
get isOpen() {
|
|
524
|
+
return g.current !== "0%";
|
|
525
|
+
},
|
|
526
|
+
subscribeOpenChange: (s) => (A.current.add(s), s(g.current !== "0%"), () => A.current.delete(s)),
|
|
527
|
+
getContext: () => R.current,
|
|
528
|
+
getChromeHeight: () => se.current()
|
|
529
|
+
}),
|
|
530
|
+
[x, H]
|
|
531
|
+
);
|
|
532
|
+
const ee = /* @__PURE__ */ i.jsx(
|
|
533
|
+
Nt,
|
|
534
|
+
{
|
|
535
|
+
...a,
|
|
536
|
+
classNameHeader: Q,
|
|
537
|
+
isOpen: j,
|
|
538
|
+
applySnapRef: G,
|
|
539
|
+
onSnapChange: C,
|
|
540
|
+
context: B,
|
|
541
|
+
chromeHeightGetterRef: se,
|
|
542
|
+
onRequestClose: H,
|
|
543
|
+
children: S
|
|
544
|
+
}
|
|
545
|
+
);
|
|
546
|
+
return oe ? ee : yt(ee, document.body);
|
|
547
|
+
});
|
|
548
|
+
Mt.displayName = "DrawerMobile";
|
|
549
|
+
export {
|
|
550
|
+
Mt as D,
|
|
551
|
+
_t as u
|
|
552
|
+
};
|
package/dist/DrawerMobile.es.js
CHANGED
package/dist/Menu.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import J from "./CardBackground.es.js";
|
|
|
4
4
|
import { c as w } from "./cn-B6yFEsav.js";
|
|
5
5
|
import { u as Q } from "./useDevice-S7cYqLVh.js";
|
|
6
6
|
import { M as W } from "./MenuFloating-CZ7dqXy2.js";
|
|
7
|
-
import { D as Z } from "./DrawerMobile-
|
|
7
|
+
import { D as Z } from "./DrawerMobile-D8KsbqMY.js";
|
|
8
8
|
const $ = {
|
|
9
9
|
color: "neutral",
|
|
10
10
|
variant: "primary",
|