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