prometeo-design-system 5.8.2 → 5.8.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/DrawerMobile.es.js
CHANGED
|
@@ -1,86 +1,96 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { c as
|
|
3
|
-
import
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
6
|
-
const { children:
|
|
7
|
-
E.current =
|
|
8
|
-
|
|
9
|
-
}, [
|
|
10
|
-
y.current =
|
|
11
|
-
}, [
|
|
12
|
-
const
|
|
13
|
-
u("0%"), E.current?.(H.current), setTimeout(() =>
|
|
14
|
-
}, []),
|
|
15
|
-
u(a || o[0] || "60%"),
|
|
16
|
-
}, [o]), x =
|
|
1
|
+
import { j as b } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
+
import { c as _ } from "./cn-B6yFEsav.js";
|
|
3
|
+
import ue, { forwardRef as me, useState as G, useRef as m, useEffect as D, useCallback as c, useMemo as fe, useImperativeHandle as pe, useLayoutEffect as we } from "react";
|
|
4
|
+
import { createPortal as be } from "react-dom";
|
|
5
|
+
const $ = 44, ve = "height 0.5s cubic-bezier(0.32, 0.72, 0, 1)", Ee = me((g, l) => {
|
|
6
|
+
const { children: j, defaultOpen: F = !1, onClose: N, snapPoints: o = ["auto"], setSnap: h, snap: d, attachToParent: C = !1 } = g, [p, u] = G(d || "0%"), [T, A] = G(null), E = m(N), y = m(h), H = m(T), M = m(/* @__PURE__ */ new Set()), r = m(() => $);
|
|
7
|
+
E.current = N, H.current = T, D(() => {
|
|
8
|
+
F && Y();
|
|
9
|
+
}, [F]), D(() => {
|
|
10
|
+
y.current = h;
|
|
11
|
+
}, [h]);
|
|
12
|
+
const w = c(() => {
|
|
13
|
+
u("0%"), E.current?.(H.current), setTimeout(() => A(null), 300);
|
|
14
|
+
}, []), Y = c((a, R) => {
|
|
15
|
+
u(a || o[0] || "60%"), A(R ?? null);
|
|
16
|
+
}, [o]), x = fe(() => p !== "0%", [p]);
|
|
17
17
|
D(() => {
|
|
18
|
-
|
|
18
|
+
M.current.forEach((a) => {
|
|
19
19
|
try {
|
|
20
20
|
a(x);
|
|
21
21
|
} catch {
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
}, [x]),
|
|
25
|
-
open:
|
|
26
|
-
close:
|
|
24
|
+
}, [x]), pe(l, () => ({
|
|
25
|
+
open: Y,
|
|
26
|
+
close: w,
|
|
27
27
|
isOpen: x,
|
|
28
|
-
subscribeOpenChange: (a) => (
|
|
29
|
-
|
|
28
|
+
subscribeOpenChange: (a) => (M.current.add(a), () => {
|
|
29
|
+
M.current.delete(a);
|
|
30
30
|
}),
|
|
31
|
-
getContext: () => H.current
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
getContext: () => H.current,
|
|
32
|
+
getChromeHeight: () => r.current()
|
|
33
|
+
}), [Y, w, x, r]);
|
|
34
|
+
const k = d || p;
|
|
35
|
+
return C ? /* @__PURE__ */ b.jsx(ae, { ...g, snap: k, setSnap: u, context: T, chromeHeightGetterRef: r, children: j }) : be(/* @__PURE__ */ b.jsx(ae, { ...g, snap: k, setSnap: u, context: T, chromeHeightGetterRef: r, children: j }), document.body);
|
|
36
|
+
}), ae = ({ children: g, attachToParent: l = !1, className: j, classNameContent: F, classNameFooter: N, snap: o, snapPoints: h = [0, "auto", 1], setSnap: d, hideOnClose: C = !1, unmountChildrenOnClose: p = !1, header: u, modal: T = !1, closeOnOverlayClick: A = !1, context: E, footer: y, zIndex: H = 60, chromeHeightGetterRef: M }) => {
|
|
37
|
+
const r = m(null), w = m(null), Y = m(null), x = m(null), k = m(null), B = m(0), a = m(null), R = m(null), ee = c(() => {
|
|
37
38
|
if (!r.current) return [];
|
|
38
39
|
const e = l && r.current.parentElement?.offsetHeight || window.innerHeight;
|
|
39
|
-
return
|
|
40
|
+
return h?.map((t) => {
|
|
40
41
|
if (t === "auto") {
|
|
41
|
-
const n =
|
|
42
|
-
return parseFloat(
|
|
42
|
+
const n = B.current, f = q(), i = W(), s = te(), v = V(e, n, f, i, s);
|
|
43
|
+
return parseFloat(v) / 100 * e;
|
|
43
44
|
}
|
|
44
45
|
return 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 : typeof t == "number" ? t : 0;
|
|
45
46
|
}) || [];
|
|
46
|
-
}, [
|
|
47
|
-
const e =
|
|
47
|
+
}, [h, l]), q = c(() => 46, []), U = c(() => w.current?.scrollHeight ?? 0, []), W = c(() => {
|
|
48
|
+
const e = Y.current?.scrollHeight ?? 0;
|
|
48
49
|
return e > 0 ? e + 2 : 0;
|
|
49
|
-
}, []),
|
|
50
|
-
const s = n +
|
|
51
|
-
return `${Math.round(
|
|
52
|
-
}, []),
|
|
53
|
-
|
|
50
|
+
}, []), te = c(() => x.current?.scrollHeight ?? 0, []), V = c((e, t, n, f, i) => {
|
|
51
|
+
const s = n + i + t + f, v = Math.min(100, s / e * 100);
|
|
52
|
+
return `${Math.round(v)}%`;
|
|
53
|
+
}, []), ne = c(() => {
|
|
54
|
+
if (!r.current || !w.current)
|
|
55
|
+
return $;
|
|
56
|
+
const e = r.current.getBoundingClientRect(), t = w.current.getBoundingClientRect(), n = Math.max(0, t.top - e.top), f = W();
|
|
57
|
+
return $ + n + f;
|
|
58
|
+
}, [W]);
|
|
59
|
+
we(() => {
|
|
60
|
+
M && (M.current = ne);
|
|
61
|
+
}, [M, ne]);
|
|
62
|
+
const re = c((e, t) => {
|
|
63
|
+
const n = ee();
|
|
54
64
|
if (n.length === 0) return e;
|
|
55
65
|
if (Math.abs(t) > 0.05)
|
|
56
66
|
if (t > 0) {
|
|
57
|
-
const
|
|
58
|
-
return
|
|
67
|
+
const i = n.filter((s) => s < e);
|
|
68
|
+
return i.length > 0 ? Math.max(...i) : C ? 0 : $;
|
|
59
69
|
} else {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
return Math.min(...
|
|
70
|
+
const i = n.filter((s) => s > e);
|
|
71
|
+
if (i.length > 0)
|
|
72
|
+
return Math.min(...i);
|
|
63
73
|
}
|
|
64
|
-
return n.reduce((
|
|
65
|
-
}, [
|
|
66
|
-
if (
|
|
67
|
-
const t = l && r.current?.parentElement?.offsetHeight || window.innerHeight, n = e <=
|
|
68
|
-
|
|
74
|
+
return n.reduce((i, s) => Math.abs(s - e) < Math.abs(i - e) ? s : i);
|
|
75
|
+
}, [ee]), z = c((e) => {
|
|
76
|
+
if (d && h) {
|
|
77
|
+
const t = l && r.current?.parentElement?.offsetHeight || window.innerHeight, n = e <= $ ? "0%" : `${Math.round(e / t * 100)}%`;
|
|
78
|
+
d(n);
|
|
69
79
|
}
|
|
70
|
-
}, [
|
|
71
|
-
r.current && (r.current.style.transition =
|
|
72
|
-
}, [
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
t > e ?
|
|
78
|
-
},
|
|
79
|
-
if (
|
|
80
|
-
const { scrollY: e } =
|
|
81
|
-
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, e),
|
|
80
|
+
}, [d, h, l]), oe = c((e) => {
|
|
81
|
+
r.current && (r.current.style.transition = ve, r.current.style.height = `${e}px`, he(e, B.current || U()));
|
|
82
|
+
}, [d, h, l]), de = () => {
|
|
83
|
+
w.current?.classList.remove("prometeo-scrollbar-none");
|
|
84
|
+
}, ge = () => {
|
|
85
|
+
w.current?.classList.add("prometeo-scrollbar-none");
|
|
86
|
+
}, he = (e, t) => {
|
|
87
|
+
t > e ? de() : ge();
|
|
88
|
+
}, se = c(() => {
|
|
89
|
+
if (R.current && l) {
|
|
90
|
+
const { scrollY: e } = R.current;
|
|
91
|
+
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, e), R.current = null;
|
|
82
92
|
}
|
|
83
|
-
}, [l]),
|
|
93
|
+
}, [l]), J = c((e) => {
|
|
84
94
|
if (!r.current) return;
|
|
85
95
|
const t = e.touches[0], n = r.current.offsetHeight;
|
|
86
96
|
a.current = {
|
|
@@ -91,7 +101,7 @@ const X = 44, pe = "height 0.5s cubic-bezier(0.32, 0.72, 0, 1)", He = ge((d, l)
|
|
|
91
101
|
lastTime: Date.now(),
|
|
92
102
|
velocity: 0
|
|
93
103
|
};
|
|
94
|
-
}, []),
|
|
104
|
+
}, []), ce = c((e) => {
|
|
95
105
|
if (!r.current) return;
|
|
96
106
|
const t = e, n = r.current.offsetHeight;
|
|
97
107
|
a.current = {
|
|
@@ -102,183 +112,183 @@ const X = 44, pe = "height 0.5s cubic-bezier(0.32, 0.72, 0, 1)", He = ge((d, l)
|
|
|
102
112
|
lastTime: Date.now(),
|
|
103
113
|
velocity: 0
|
|
104
114
|
};
|
|
105
|
-
}, []),
|
|
115
|
+
}, []), K = c((e) => {
|
|
106
116
|
if (!a.current || !r.current) return;
|
|
107
|
-
const t = e.touches[0], n = a.current,
|
|
108
|
-
if (!n.isDragging &&
|
|
117
|
+
const t = e.touches[0], n = a.current, f = n.startY - t.clientY, i = n.isDragging || Math.abs(f) > 5;
|
|
118
|
+
if (!n.isDragging && i && (n.isDragging = !0, l)) {
|
|
109
119
|
const s = window.scrollY;
|
|
110
|
-
|
|
120
|
+
R.current = { scrollY: s }, document.body.style.position = "fixed", document.body.style.top = `-${s}px`, document.body.style.width = "100%";
|
|
111
121
|
}
|
|
112
|
-
if (
|
|
122
|
+
if (i) {
|
|
113
123
|
e.preventDefault();
|
|
114
|
-
const s = Date.now(),
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
n.velocity = n.velocity * 0.8 +
|
|
124
|
+
const s = Date.now(), v = s - n.lastTime;
|
|
125
|
+
if (v > 0) {
|
|
126
|
+
const P = (t.clientY - n.lastY) / v;
|
|
127
|
+
n.velocity = n.velocity * 0.8 + P * 0.2;
|
|
118
128
|
}
|
|
119
129
|
n.lastY = t.clientY, n.lastTime = s;
|
|
120
|
-
const
|
|
121
|
-
r.current.style.transition = "none", r.current.style.height = `${
|
|
130
|
+
const I = n.startHeight + f, O = l && r.current.parentElement?.offsetHeight || window.innerHeight, Z = Math.max(0, Math.min(I, O));
|
|
131
|
+
r.current.style.transition = "none", r.current.style.height = `${Z}px`;
|
|
122
132
|
}
|
|
123
|
-
}, [l]),
|
|
133
|
+
}, [l]), ie = c((e) => {
|
|
124
134
|
if (!a.current || !r.current) return;
|
|
125
|
-
const t = e, n = a.current,
|
|
126
|
-
if (!n.isDragging &&
|
|
135
|
+
const t = e, n = a.current, f = n.startY - t.clientY, i = n.isDragging || Math.abs(f) > 5;
|
|
136
|
+
if (!n.isDragging && i && (n.isDragging = !0, l)) {
|
|
127
137
|
const s = window.scrollY;
|
|
128
|
-
|
|
138
|
+
R.current = { scrollY: s }, document.body.style.position = "fixed", document.body.style.top = `-${s}px`, document.body.style.width = "100%";
|
|
129
139
|
}
|
|
130
|
-
if (
|
|
140
|
+
if (i) {
|
|
131
141
|
e.preventDefault();
|
|
132
|
-
const s = Date.now(),
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
n.velocity = n.velocity * 0.8 +
|
|
142
|
+
const s = Date.now(), v = s - n.lastTime;
|
|
143
|
+
if (v > 0) {
|
|
144
|
+
const P = (t.clientY - n.lastY) / v;
|
|
145
|
+
n.velocity = n.velocity * 0.8 + P * 0.2;
|
|
136
146
|
}
|
|
137
147
|
n.lastY = t.clientY, n.lastTime = s;
|
|
138
|
-
const
|
|
139
|
-
r.current.style.transition = "none", r.current.style.height = `${
|
|
148
|
+
const I = n.startHeight + f, O = l && r.current.parentElement?.offsetHeight || window.innerHeight, Z = Math.max(0, Math.min(I, O));
|
|
149
|
+
r.current.style.transition = "none", r.current.style.height = `${Z}px`;
|
|
140
150
|
}
|
|
141
|
-
}, [l]), S =
|
|
151
|
+
}, [l]), S = c(() => {
|
|
142
152
|
if (!a.current || !r.current) return;
|
|
143
153
|
const e = a.current;
|
|
144
154
|
if (e.isDragging) {
|
|
145
|
-
|
|
146
|
-
const t = r.current.offsetHeight, n =
|
|
147
|
-
|
|
155
|
+
se();
|
|
156
|
+
const t = r.current.offsetHeight, n = re(t, e.velocity);
|
|
157
|
+
z(n);
|
|
148
158
|
}
|
|
149
159
|
a.current = null;
|
|
150
|
-
}, [
|
|
151
|
-
|
|
152
|
-
const t = (
|
|
160
|
+
}, [re, z, se]), Q = c((e) => {
|
|
161
|
+
ce(e);
|
|
162
|
+
const t = (f) => ie(f), n = () => {
|
|
153
163
|
document.removeEventListener("mousemove", t, { capture: !0 }), document.removeEventListener("mouseup", n, { capture: !0 }), S();
|
|
154
164
|
};
|
|
155
165
|
document.addEventListener("mousemove", t, { passive: !1, capture: !0 }), document.addEventListener("mouseup", n, { capture: !0 });
|
|
156
|
-
}, [
|
|
166
|
+
}, [ce, ie, S]);
|
|
157
167
|
D(() => {
|
|
158
|
-
const e =
|
|
168
|
+
const e = k.current;
|
|
159
169
|
if (e)
|
|
160
|
-
return e.addEventListener("touchstart",
|
|
161
|
-
e.removeEventListener("touchstart",
|
|
170
|
+
return e.addEventListener("touchstart", J, { passive: !1 }), e.addEventListener("touchmove", K, { passive: !1 }), e.addEventListener("touchend", S), e.addEventListener("touchcancel", S), e.addEventListener("mousedown", Q, { passive: !1 }), () => {
|
|
171
|
+
e.removeEventListener("touchstart", J), e.removeEventListener("touchmove", K), e.removeEventListener("touchend", S), e.removeEventListener("touchcancel", S), e.removeEventListener("mousedown", Q);
|
|
162
172
|
};
|
|
163
|
-
}, [
|
|
164
|
-
const
|
|
173
|
+
}, [J, K, S, Q]);
|
|
174
|
+
const L = fe(() => o !== "0%", [o]), [X, le] = G(() => p ? o !== "0%" : !0);
|
|
165
175
|
return D(() => {
|
|
166
|
-
p &&
|
|
167
|
-
}, [
|
|
176
|
+
p && L && le(!0);
|
|
177
|
+
}, [L, p]), D(() => {
|
|
168
178
|
if (!p) return;
|
|
169
179
|
const e = r.current;
|
|
170
180
|
if (!e) return;
|
|
171
181
|
const t = (n) => {
|
|
172
|
-
n.propertyName === "height" && !
|
|
182
|
+
n.propertyName === "height" && !L && o === "0%" && le(!1);
|
|
173
183
|
};
|
|
174
184
|
return e.addEventListener("transitionend", t), () => {
|
|
175
185
|
e.removeEventListener("transitionend", t);
|
|
176
186
|
};
|
|
177
|
-
}, [
|
|
187
|
+
}, [L, o, p]), D(() => {
|
|
178
188
|
if (!r.current || !o) return;
|
|
179
189
|
const e = l && r.current.parentElement?.offsetHeight || window.innerHeight;
|
|
180
190
|
if (o === "auto") {
|
|
181
|
-
if (p && !
|
|
182
|
-
|
|
191
|
+
if (p && !X) return;
|
|
192
|
+
oe(e), requestAnimationFrame(() => {
|
|
183
193
|
requestAnimationFrame(() => {
|
|
184
|
-
const n = !y ||
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
const s =
|
|
189
|
-
|
|
190
|
-
} else n &&
|
|
194
|
+
const n = !y || Y.current, f = w.current && w.current.children.length > 0;
|
|
195
|
+
if (w.current && f && n) {
|
|
196
|
+
const i = U();
|
|
197
|
+
B.current = i;
|
|
198
|
+
const s = q(), v = W(), I = te(), O = V(e, i, s, v, I);
|
|
199
|
+
d(O);
|
|
200
|
+
} else n && d("100%");
|
|
191
201
|
});
|
|
192
202
|
});
|
|
193
203
|
return;
|
|
194
204
|
}
|
|
195
205
|
let t = 0;
|
|
196
|
-
typeof o == "string" && o.endsWith("%") ? parseFloat(o) <= 0 ? t =
|
|
197
|
-
}, [o, l,
|
|
198
|
-
T && /* @__PURE__ */
|
|
206
|
+
typeof o == "string" && o.endsWith("%") ? parseFloat(o) <= 0 ? t = C ? 0 : $ : t = parseFloat(o) / 100 * e : typeof o == "string" && o.endsWith("px") ? t = parseFloat(o) : typeof o == "number" && (o >= 0 && o <= 1 ? t = o * e : t = o), oe(t);
|
|
207
|
+
}, [o, l, U, q, V, d, X, y, p]), /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
|
|
208
|
+
T && /* @__PURE__ */ b.jsx(
|
|
199
209
|
"div",
|
|
200
210
|
{
|
|
201
211
|
style: { zIndex: H },
|
|
202
|
-
className:
|
|
212
|
+
className: _(L ? "fixed inset-0 bg-black/40 cursor-default" : "hidden"),
|
|
203
213
|
onClick: (e) => {
|
|
204
|
-
e.preventDefault(), e.stopPropagation(),
|
|
214
|
+
e.preventDefault(), e.stopPropagation(), A && z(0);
|
|
205
215
|
},
|
|
206
216
|
"aria-hidden": "true"
|
|
207
217
|
}
|
|
208
218
|
),
|
|
209
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ b.jsxs(
|
|
210
220
|
"div",
|
|
211
221
|
{
|
|
212
222
|
ref: r,
|
|
213
223
|
style: { zIndex: H },
|
|
214
|
-
className:
|
|
224
|
+
className: _(
|
|
215
225
|
"h-0",
|
|
216
226
|
l ? "absolute" : "fixed",
|
|
217
227
|
"bottom-0 w-full overflow-hidden",
|
|
218
228
|
"bg-neutral-default-default",
|
|
219
229
|
"border-t border-neutral-strong-default rounded-t-[12px]",
|
|
220
|
-
|
|
221
|
-
|
|
230
|
+
L ? "" : "border-neutral-weak",
|
|
231
|
+
j,
|
|
222
232
|
"flex flex-col items-center",
|
|
223
233
|
"touch-none select-none"
|
|
224
234
|
),
|
|
225
235
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ b.jsx(
|
|
227
237
|
"div",
|
|
228
238
|
{
|
|
229
|
-
ref:
|
|
239
|
+
ref: k,
|
|
230
240
|
style: { zIndex: H + 1 },
|
|
231
241
|
className: "w-full absolute top-0 h-11 flex items-center justify-center cursor-grab active:cursor-grabbing bg-inherit! ",
|
|
232
|
-
children: /* @__PURE__ */
|
|
242
|
+
children: /* @__PURE__ */ b.jsx("span", { className: "w-12 h-1 rounded-full bg-neutral-weak-default" })
|
|
233
243
|
}
|
|
234
244
|
),
|
|
235
|
-
typeof u == "string" ? /* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */
|
|
245
|
+
typeof u == "string" ? /* @__PURE__ */ b.jsx("p", { ref: x, style: { zIndex: H + 2 }, className: " prometeo-fonts-headline-small text-neutral-default-default w-full min-h-11 bg-inherit mt-11 px-4 text-balance", children: u }) : /* @__PURE__ */ b.jsx("div", { ref: x, className: "w-full mt-11", children: typeof u == "function" ? u(E) : ue.isValidElement(u) ? u : u && typeof u == "object" && "$$typeof" in u ? ue.createElement(u, { context: E }) : u }),
|
|
246
|
+
/* @__PURE__ */ b.jsx(
|
|
237
247
|
"div",
|
|
238
248
|
{
|
|
239
|
-
ref:
|
|
240
|
-
className:
|
|
249
|
+
ref: w,
|
|
250
|
+
className: _(
|
|
241
251
|
"drawer-mobile-content prometeo-scrollbar-thin-weak ",
|
|
242
|
-
|
|
252
|
+
L ? "drawer-mobile-content--open" : "drawer-mobile-content--closed",
|
|
243
253
|
"w-full h-full",
|
|
244
|
-
|
|
254
|
+
F
|
|
245
255
|
),
|
|
246
|
-
children: (!p ||
|
|
256
|
+
children: (!p || X) && (typeof g == "function" ? g(E) : g)
|
|
247
257
|
}
|
|
248
258
|
),
|
|
249
|
-
y && /* @__PURE__ */
|
|
259
|
+
y && /* @__PURE__ */ b.jsx("div", { ref: Y, className: _(
|
|
250
260
|
"w-full mt-0 flex items-center justify-center p-0",
|
|
251
261
|
"border-t border-neutral-strong-default",
|
|
252
|
-
|
|
262
|
+
N
|
|
253
263
|
), children: typeof y == "function" ? y(E) : y })
|
|
254
264
|
]
|
|
255
265
|
}
|
|
256
266
|
)
|
|
257
267
|
] });
|
|
258
|
-
},
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
}, []),
|
|
262
|
-
|
|
263
|
-
}, []), o =
|
|
268
|
+
}, Me = () => {
|
|
269
|
+
const g = m(null), [l, j] = G(!1), F = c((h, d) => {
|
|
270
|
+
g.current?.open(h, d);
|
|
271
|
+
}, []), N = c(() => {
|
|
272
|
+
g.current?.close();
|
|
273
|
+
}, []), o = c(() => g.current?.getContext() ?? null, []);
|
|
264
274
|
return D(() => {
|
|
265
|
-
const
|
|
266
|
-
if (!
|
|
267
|
-
const
|
|
268
|
-
|
|
275
|
+
const h = g.current?.subscribeOpenChange;
|
|
276
|
+
if (!h) return;
|
|
277
|
+
const d = h((C) => {
|
|
278
|
+
j(C);
|
|
269
279
|
});
|
|
270
280
|
return () => {
|
|
271
|
-
|
|
281
|
+
d && d();
|
|
272
282
|
};
|
|
273
|
-
}, [
|
|
283
|
+
}, [g.current?.subscribeOpenChange]), {
|
|
274
284
|
isOpen: l,
|
|
275
|
-
open:
|
|
276
|
-
close:
|
|
277
|
-
drawerRef:
|
|
285
|
+
open: F,
|
|
286
|
+
close: N,
|
|
287
|
+
drawerRef: g,
|
|
278
288
|
getContext: o
|
|
279
289
|
};
|
|
280
290
|
};
|
|
281
291
|
export {
|
|
282
|
-
|
|
283
|
-
|
|
292
|
+
Ee as default,
|
|
293
|
+
Me as useDrawerMobile
|
|
284
294
|
};
|
|
@@ -23,6 +23,12 @@ export interface DrawerMobileHandle<TContext = unknown> {
|
|
|
23
23
|
close: () => void;
|
|
24
24
|
isOpen: boolean;
|
|
25
25
|
getContext: () => TContext | null;
|
|
26
|
+
/**
|
|
27
|
+
* Altura fija (dragger, header y footer) que queda fuera del área scrollable del contenido.
|
|
28
|
+
* Sirve para calcular `calc(100vh - getChromeHeight())` u otros `calc(<altura padre> - ...)`,
|
|
29
|
+
* especialmente cuando se usa `attachToParent` y el drawer no llena todo el viewport.
|
|
30
|
+
*/
|
|
31
|
+
getChromeHeight: () => number;
|
|
26
32
|
subscribeOpenChange: (cb: (open: boolean) => void) => () => void;
|
|
27
33
|
}
|
|
28
34
|
declare const DrawerMobile: <TContext = unknown>(props: DrawerMobileProps<TContext> & {
|