@luciodale/swipe-bar 1.2.0 → 1.2.1
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/swipe-bar.es.js +155 -155
- package/dist/swipe-bar.umd.js +4 -4
- package/package.json +1 -1
package/dist/swipe-bar.es.js
CHANGED
|
@@ -74,14 +74,14 @@ function mt() {
|
|
|
74
74
|
case C:
|
|
75
75
|
return (o._context.displayName || "Context") + ".Consumer";
|
|
76
76
|
case D:
|
|
77
|
-
var
|
|
78
|
-
return o = o.displayName, o || (o =
|
|
77
|
+
var p = o.render;
|
|
78
|
+
return o = o.displayName, o || (o = p.displayName || p.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
|
|
79
79
|
case w:
|
|
80
|
-
return
|
|
80
|
+
return p = o.displayName || null, p !== null ? p : e(o.type) || "Memo";
|
|
81
81
|
case O:
|
|
82
|
-
|
|
82
|
+
p = o._payload, o = o._init;
|
|
83
83
|
try {
|
|
84
|
-
return e(o(
|
|
84
|
+
return e(o(p));
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -93,15 +93,15 @@ function mt() {
|
|
|
93
93
|
function r(o) {
|
|
94
94
|
try {
|
|
95
95
|
t(o);
|
|
96
|
-
var
|
|
96
|
+
var p = !1;
|
|
97
97
|
} catch {
|
|
98
|
-
|
|
98
|
+
p = !0;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
var I =
|
|
100
|
+
if (p) {
|
|
101
|
+
p = console;
|
|
102
|
+
var I = p.error, L = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
103
103
|
return I.call(
|
|
104
|
-
|
|
104
|
+
p,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
106
|
L
|
|
107
107
|
), t(o);
|
|
@@ -112,8 +112,8 @@ function mt() {
|
|
|
112
112
|
if (typeof o == "object" && o !== null && o.$$typeof === O)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
|
-
var
|
|
116
|
-
return
|
|
115
|
+
var p = e(o);
|
|
116
|
+
return p ? "<" + p + ">" : "<...>";
|
|
117
117
|
} catch {
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
@@ -127,16 +127,16 @@ function mt() {
|
|
|
127
127
|
}
|
|
128
128
|
function u(o) {
|
|
129
129
|
if (G.call(o, "key")) {
|
|
130
|
-
var
|
|
131
|
-
if (
|
|
130
|
+
var p = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
131
|
+
if (p && p.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
133
|
return o.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function s(o,
|
|
135
|
+
function s(o, p) {
|
|
136
136
|
function I() {
|
|
137
137
|
V || (V = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
-
|
|
139
|
+
p
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
142
|
I.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
@@ -150,12 +150,12 @@ function mt() {
|
|
|
150
150
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
151
|
)), o = this.props.ref, o !== void 0 ? o : null;
|
|
152
152
|
}
|
|
153
|
-
function c(o,
|
|
153
|
+
function c(o, p, I, L, oe, J) {
|
|
154
154
|
var X = I.ref;
|
|
155
155
|
return o = {
|
|
156
156
|
$$typeof: A,
|
|
157
157
|
type: o,
|
|
158
|
-
key:
|
|
158
|
+
key: p,
|
|
159
159
|
props: I,
|
|
160
160
|
_owner: L
|
|
161
161
|
}, (X !== void 0 ? X : null) !== null ? Object.defineProperty(o, "ref", {
|
|
@@ -183,22 +183,22 @@ function mt() {
|
|
|
183
183
|
value: J
|
|
184
184
|
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
var X =
|
|
186
|
+
function b(o, p, I, L, oe, J) {
|
|
187
|
+
var X = p.children;
|
|
188
188
|
if (X !== void 0)
|
|
189
189
|
if (L)
|
|
190
190
|
if (H(X)) {
|
|
191
191
|
for (L = 0; L < X.length; L++)
|
|
192
|
-
|
|
192
|
+
v(X[L]);
|
|
193
193
|
Object.freeze && Object.freeze(X);
|
|
194
194
|
} else
|
|
195
195
|
console.error(
|
|
196
196
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
197
|
);
|
|
198
|
-
else
|
|
199
|
-
if (G.call(
|
|
198
|
+
else v(X);
|
|
199
|
+
if (G.call(p, "key")) {
|
|
200
200
|
X = e(o);
|
|
201
|
-
var ne = Object.keys(
|
|
201
|
+
var ne = Object.keys(p).filter(function(me) {
|
|
202
202
|
return me !== "key";
|
|
203
203
|
});
|
|
204
204
|
L = 0 < ne.length ? "{key: someKey, " + ne.join(": ..., ") + ": ...}" : "{key: someKey}", _[X + L] || (ne = 0 < ne.length ? "{" + ne.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
@@ -214,11 +214,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
214
214
|
X
|
|
215
215
|
), _[X + L] = !0);
|
|
216
216
|
}
|
|
217
|
-
if (X = null, I !== void 0 && (r(I), X = "" + I), u(
|
|
217
|
+
if (X = null, I !== void 0 && (r(I), X = "" + I), u(p) && (r(p.key), X = "" + p.key), "key" in p) {
|
|
218
218
|
I = {};
|
|
219
|
-
for (var le in
|
|
220
|
-
le !== "key" && (I[le] =
|
|
221
|
-
} else I =
|
|
219
|
+
for (var le in p)
|
|
220
|
+
le !== "key" && (I[le] = p[le]);
|
|
221
|
+
} else I = p;
|
|
222
222
|
return X && s(
|
|
223
223
|
I,
|
|
224
224
|
typeof o == "function" ? o.displayName || o.name || "Unknown" : o
|
|
@@ -231,7 +231,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
231
231
|
J
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function v(o) {
|
|
235
235
|
x(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === O && (o._payload.status === "fulfilled" ? x(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
|
|
236
236
|
}
|
|
237
237
|
function x(o) {
|
|
@@ -249,21 +249,21 @@ React keys must be passed directly to JSX without using spread:
|
|
|
249
249
|
m,
|
|
250
250
|
i
|
|
251
251
|
)(), F = U(n(i)), _ = {};
|
|
252
|
-
fe.Fragment = Y, fe.jsx = function(o,
|
|
252
|
+
fe.Fragment = Y, fe.jsx = function(o, p, I) {
|
|
253
253
|
var L = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
254
|
-
return
|
|
254
|
+
return b(
|
|
255
255
|
o,
|
|
256
|
-
|
|
256
|
+
p,
|
|
257
257
|
I,
|
|
258
258
|
!1,
|
|
259
259
|
L ? Error("react-stack-top-frame") : y,
|
|
260
260
|
L ? U(n(o)) : F
|
|
261
261
|
);
|
|
262
|
-
}, fe.jsxs = function(o,
|
|
262
|
+
}, fe.jsxs = function(o, p, I) {
|
|
263
263
|
var L = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
264
|
-
return
|
|
264
|
+
return b(
|
|
265
265
|
o,
|
|
266
|
-
|
|
266
|
+
p,
|
|
267
267
|
I,
|
|
268
268
|
!0,
|
|
269
269
|
L ? Error("react-stack-top-frame") : y,
|
|
@@ -274,9 +274,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
274
274
|
}
|
|
275
275
|
process.env.NODE_ENV === "production" ? we.exports = ht() : we.exports = mt();
|
|
276
276
|
var R = we.exports;
|
|
277
|
-
const Ze = ft(null),
|
|
277
|
+
const Ze = ft(null), be = (e) => {
|
|
278
278
|
throw new Error(`Unhandled sidebar side: ${e}`);
|
|
279
|
-
},
|
|
279
|
+
}, pe = { isOpen: !1, anchorState: "closed" }, rr = ({
|
|
280
280
|
children: e,
|
|
281
281
|
sidebarWidthPx: t,
|
|
282
282
|
transitionMs: r,
|
|
@@ -287,8 +287,8 @@ const Ze = ft(null), pe = (e) => {
|
|
|
287
287
|
overlayBackgroundColor: s,
|
|
288
288
|
toggleIconColor: d,
|
|
289
289
|
toggleIconSizePx: c,
|
|
290
|
-
toggleIconEdgeDistancePx:
|
|
291
|
-
showToggle:
|
|
290
|
+
toggleIconEdgeDistancePx: b,
|
|
291
|
+
showToggle: v,
|
|
292
292
|
mediaQueryWidth: x,
|
|
293
293
|
swipeBarZIndex: m,
|
|
294
294
|
toggleZIndex: A,
|
|
@@ -297,22 +297,22 @@ const Ze = ft(null), pe = (e) => {
|
|
|
297
297
|
fadeContentTransitionMs: $
|
|
298
298
|
}) => {
|
|
299
299
|
var Ie, Me;
|
|
300
|
-
const [j, C] = re(null), [N, D] = re(!1), [M, f] = re(!1), [w, O] = re({}), [P, q] = re({}), k = W(null), G = W(null), H = W(null), U = W(null), [V, Q] = re({}), [y, F] = re({}), _ = W(/* @__PURE__ */ new Map()), o = W(null),
|
|
300
|
+
const [j, C] = re(null), [N, D] = re(!1), [M, f] = re(!1), [w, O] = re({}), [P, q] = re({}), k = W(null), G = W(null), H = W(null), U = W(null), [V, Q] = re({}), [y, F] = re({}), _ = W(/* @__PURE__ */ new Map()), o = W(null), p = W([]), I = ((Ie = V.primary) == null ? void 0 : Ie.isOpen) ?? !1, L = ((Me = V.primary) == null ? void 0 : Me.anchorState) ?? "closed", oe = Ue(
|
|
301
301
|
() => Object.values(V).some((l) => l.isOpen),
|
|
302
302
|
[V]
|
|
303
303
|
), J = _.current.get("primary"), X = (J == null ? void 0 : J.sidebarRef) ?? { current: null }, ne = (J == null ? void 0 : J.toggleRef) ?? { current: null }, le = y.primary ?? {}, [me, Je] = re({
|
|
304
304
|
sidebarWidthPx: t ?? wt,
|
|
305
305
|
sidebarHeightPx: Le,
|
|
306
|
-
transitionMs: r ??
|
|
307
|
-
edgeActivationWidthPx: n ??
|
|
308
|
-
dragActivationDeltaPx: a ??
|
|
306
|
+
transitionMs: r ?? bt,
|
|
307
|
+
edgeActivationWidthPx: n ?? pt,
|
|
308
|
+
dragActivationDeltaPx: a ?? vt,
|
|
309
309
|
showOverlay: i ?? St,
|
|
310
310
|
isAbsolute: u ?? yt,
|
|
311
311
|
overlayBackgroundColor: s ?? ze,
|
|
312
312
|
toggleIconColor: d ?? xt,
|
|
313
313
|
toggleIconSizePx: c ?? Rt,
|
|
314
|
-
toggleIconEdgeDistancePx:
|
|
315
|
-
showToggle:
|
|
314
|
+
toggleIconEdgeDistancePx: b ?? Tt,
|
|
315
|
+
showToggle: v ?? Et,
|
|
316
316
|
mediaQueryWidth: x ?? Se,
|
|
317
317
|
swipeBarZIndex: m ?? At,
|
|
318
318
|
toggleZIndex: A ?? Ot,
|
|
@@ -325,7 +325,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
325
325
|
midAnchorPointPx: Le / 3,
|
|
326
326
|
disabled: !1
|
|
327
327
|
}), Ke = Z((l, g) => {
|
|
328
|
-
_.current.set(l, g), Q((h) => h[l] ? h : { ...h, [l]: { ...
|
|
328
|
+
_.current.set(l, g), Q((h) => h[l] ? h : { ...h, [l]: { ...pe } });
|
|
329
329
|
}, []), et = Z((l) => {
|
|
330
330
|
_.current.delete(l), Q((g) => {
|
|
331
331
|
const h = { ...g };
|
|
@@ -338,12 +338,12 @@ const Ze = ft(null), pe = (e) => {
|
|
|
338
338
|
F((h) => h[l] === g ? h : { ...h, [l]: g });
|
|
339
339
|
}, []), ee = Z((l, g) => {
|
|
340
340
|
Q((h) => {
|
|
341
|
-
const S = h[l] ??
|
|
341
|
+
const S = h[l] ?? pe;
|
|
342
342
|
return S.isOpen === g ? h : { ...h, [l]: { ...S, isOpen: g } };
|
|
343
343
|
});
|
|
344
344
|
}, []), te = Z((l, g) => {
|
|
345
345
|
Q((h) => {
|
|
346
|
-
const S = h[l] ??
|
|
346
|
+
const S = h[l] ?? pe;
|
|
347
347
|
return S.anchorState === g ? h : { ...h, [l]: { ...S, anchorState: g } };
|
|
348
348
|
});
|
|
349
349
|
}, []);
|
|
@@ -372,17 +372,17 @@ const Ze = ft(null), pe = (e) => {
|
|
|
372
372
|
const nt = Z((l) => {
|
|
373
373
|
Je((g) => ({ ...g, ...l }));
|
|
374
374
|
}, []), ae = Z((l) => {
|
|
375
|
-
const g =
|
|
375
|
+
const g = p.current, h = g.indexOf(l);
|
|
376
376
|
h !== -1 && g.splice(h, 1), g.push(l), C("bottom");
|
|
377
377
|
}, []), Pe = Z((l) => {
|
|
378
|
-
const g =
|
|
378
|
+
const g = p.current, h = g.indexOf(l);
|
|
379
379
|
h !== -1 && g.splice(h, 1), Q((S) => (Object.entries(S).some(
|
|
380
380
|
([B, ie]) => B !== l && ie.isOpen
|
|
381
381
|
) || C(null), S));
|
|
382
382
|
}, []), it = Z(
|
|
383
383
|
(l, g) => {
|
|
384
384
|
const h = (S, E, B, ie) => {
|
|
385
|
-
|
|
385
|
+
ve({
|
|
386
386
|
side: l,
|
|
387
387
|
ref: S,
|
|
388
388
|
options: E,
|
|
@@ -409,7 +409,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
409
409
|
afterApply: () => {
|
|
410
410
|
ee(S, !0), te(S, "midAnchor"), ae(S);
|
|
411
411
|
}
|
|
412
|
-
}) :
|
|
412
|
+
}) : ve({
|
|
413
413
|
side: l,
|
|
414
414
|
ref: B.sidebarRef,
|
|
415
415
|
options: E,
|
|
@@ -419,7 +419,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
419
419
|
}
|
|
420
420
|
});
|
|
421
421
|
} else
|
|
422
|
-
|
|
422
|
+
be(l);
|
|
423
423
|
},
|
|
424
424
|
[w, P, y, ee, te, ae]
|
|
425
425
|
), ot = Z(
|
|
@@ -440,7 +440,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
440
440
|
(l, g) => {
|
|
441
441
|
if (l !== "bottom") return;
|
|
442
442
|
const h = (g == null ? void 0 : g.id) ?? "primary", S = y[h], E = _.current.get(h);
|
|
443
|
-
!S || !E || S.disabled ||
|
|
443
|
+
!S || !E || S.disabled || ve({
|
|
444
444
|
side: l,
|
|
445
445
|
ref: E.sidebarRef,
|
|
446
446
|
options: S,
|
|
@@ -483,7 +483,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
483
483
|
}
|
|
484
484
|
});
|
|
485
485
|
} else
|
|
486
|
-
|
|
486
|
+
be(l);
|
|
487
487
|
},
|
|
488
488
|
[w, P, y, ee, te, Pe]
|
|
489
489
|
), ct = Z(
|
|
@@ -512,7 +512,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
512
512
|
translateY: g
|
|
513
513
|
});
|
|
514
514
|
} else
|
|
515
|
-
|
|
515
|
+
be(l);
|
|
516
516
|
},
|
|
517
517
|
[w, P, y]
|
|
518
518
|
);
|
|
@@ -539,7 +539,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
539
539
|
unregisterBottomSidebar: et,
|
|
540
540
|
getBottomSidebarRefs: tt,
|
|
541
541
|
activeBottomDragIdRef: o,
|
|
542
|
-
bottomFocusStackRef:
|
|
542
|
+
bottomFocusStackRef: p,
|
|
543
543
|
// Functions
|
|
544
544
|
openSidebar: it,
|
|
545
545
|
openSidebarFully: at,
|
|
@@ -564,7 +564,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
564
564
|
if (!e)
|
|
565
565
|
throw new Error("useSwipeBarContext must be used within SwipeBarProvider");
|
|
566
566
|
return e;
|
|
567
|
-
},
|
|
567
|
+
}, bt = 300, pt = 40, vt = 20, wt = 320, Le = window.innerHeight, St = !0, yt = !1, ze = "rgba(0, 0, 0, 0.5)", ye = "rgb(36,36,36)", xt = "white", Rt = 40, Tt = 40, Et = !0, Se = 640, At = 30, Ot = 15, Pt = 20, Xe = 0.6, It = 200, Mt = 100, _t = !1, Ct = !0, Dt = !0, Lt = !1, se = "cubic-bezier(0.22, 1, 0.36, 1)", qe = {
|
|
568
568
|
width: 0,
|
|
569
569
|
top: 0,
|
|
570
570
|
bottom: 0,
|
|
@@ -639,7 +639,7 @@ const Ze = ft(null), pe = (e) => {
|
|
|
639
639
|
}, ge = (e) => {
|
|
640
640
|
var t;
|
|
641
641
|
return (t = e.current) == null ? void 0 : t.firstElementChild;
|
|
642
|
-
},
|
|
642
|
+
}, ve = ({
|
|
643
643
|
ref: e,
|
|
644
644
|
side: t,
|
|
645
645
|
options: r,
|
|
@@ -651,14 +651,14 @@ const Ze = ft(null), pe = (e) => {
|
|
|
651
651
|
let s, d;
|
|
652
652
|
t === "left" || t === "right" ? (s = "width", d = r.sidebarWidthPx, i && d && (i.style.minWidth = `${d}px`)) : t === "bottom" ? (s = "height", d = r.sidebarHeightPx, i && d && (i.style.minHeight = `${d}px`)) : xe(t), requestAnimationFrame(() => {
|
|
653
653
|
if (!e.current) return;
|
|
654
|
-
const c = `transform ${r.transitionMs}ms ${se}`,
|
|
655
|
-
e.current.style.transition = `${c}${
|
|
654
|
+
const c = `transform ${r.transitionMs}ms ${se}`, b = r.isAbsolute ? "" : `, ${s} ${r.transitionMs}ms ${se}`;
|
|
655
|
+
e.current.style.transition = `${c}${b}`, i && r.fadeContent && (i.style.transition = `opacity ${r.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
|
|
656
656
|
if (e.current) {
|
|
657
657
|
if (e.current.style.transform = t === "bottom" ? "translateY(0px)" : "translateX(0px)", !r.isAbsolute)
|
|
658
658
|
e.current.style[s] = `${d}px`;
|
|
659
659
|
else if (e.current.style[s] !== `${d}px`) {
|
|
660
|
-
const
|
|
661
|
-
e.current.style.transition = c, e.current.style[s] = `${d}px`, e.current.style.transition =
|
|
660
|
+
const v = e.current.style.transition;
|
|
661
|
+
e.current.style.transition = c, e.current.style[s] = `${d}px`, e.current.style.transition = v;
|
|
662
662
|
}
|
|
663
663
|
n.current && d && (n.current.style.opacity = "1", t === "left" ? n.current.style.transform = `translateY(-50%) translateX(${d}px)` : t === "right" ? n.current.style.transform = `translateY(-50%) translateX(-${d}px)` : t === "bottom" && (n.current.style.transform = `translateX(-50%) translateY(-${d}px)`)), i && r.fadeContent && setTimeout(() => {
|
|
664
664
|
i.style.opacity = "1";
|
|
@@ -695,12 +695,12 @@ const Ze = ft(null), pe = (e) => {
|
|
|
695
695
|
const u = `transform ${t.transitionMs}ms ${se}`, s = t.isAbsolute ? "" : `, height ${t.transitionMs}ms ${se}`;
|
|
696
696
|
e.current.style.transition = `${u}${s}`, a && t.fadeContent && (a.style.transition = `opacity ${t.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
|
|
697
697
|
if (!e.current) return;
|
|
698
|
-
const d = t.midAnchorPointPx ?? 0, c = t.sidebarHeightPx ?? 0,
|
|
699
|
-
if (e.current.style.transform = `translateY(${
|
|
698
|
+
const d = t.midAnchorPointPx ?? 0, c = t.sidebarHeightPx ?? 0, b = c - d;
|
|
699
|
+
if (e.current.style.transform = `translateY(${b}px)`, !t.isAbsolute)
|
|
700
700
|
e.current.style.height = `${c}px`;
|
|
701
701
|
else if (e.current.style.height !== `${c}px`) {
|
|
702
|
-
const
|
|
703
|
-
e.current.style.transition = u, e.current.style.height = `${c}px`, e.current.style.transition =
|
|
702
|
+
const v = e.current.style.transition;
|
|
703
|
+
e.current.style.transition = u, e.current.style.height = `${c}px`, e.current.style.transition = v;
|
|
704
704
|
}
|
|
705
705
|
r.current && (r.current.style.opacity = "1", r.current.style.transform = `translateX(-50%) translateY(-${d}px)`), a && t.fadeContent && setTimeout(() => {
|
|
706
706
|
a.style.opacity = "1";
|
|
@@ -788,8 +788,8 @@ const Ze = ft(null), pe = (e) => {
|
|
|
788
788
|
sidebarWidthPx: s,
|
|
789
789
|
sidebarHeightPx: d,
|
|
790
790
|
transitionMs: c,
|
|
791
|
-
edgeActivationWidthPx:
|
|
792
|
-
dragActivationDeltaPx:
|
|
791
|
+
edgeActivationWidthPx: b,
|
|
792
|
+
dragActivationDeltaPx: v,
|
|
793
793
|
showOverlay: x,
|
|
794
794
|
isAbsolute: m,
|
|
795
795
|
overlayBackgroundColor: A,
|
|
@@ -814,8 +814,8 @@ const Ze = ft(null), pe = (e) => {
|
|
|
814
814
|
sidebarWidthPx: s ?? n.sidebarWidthPx,
|
|
815
815
|
sidebarHeightPx: U,
|
|
816
816
|
transitionMs: c ?? n.transitionMs,
|
|
817
|
-
edgeActivationWidthPx:
|
|
818
|
-
dragActivationDeltaPx:
|
|
817
|
+
edgeActivationWidthPx: b ?? n.edgeActivationWidthPx,
|
|
818
|
+
dragActivationDeltaPx: v ?? n.dragActivationDeltaPx,
|
|
819
819
|
showOverlay: x ?? n.showOverlay,
|
|
820
820
|
isAbsolute: m ?? n.isAbsolute,
|
|
821
821
|
overlayBackgroundColor: A ?? n.overlayBackgroundColor,
|
|
@@ -839,8 +839,8 @@ const Ze = ft(null), pe = (e) => {
|
|
|
839
839
|
s,
|
|
840
840
|
d,
|
|
841
841
|
c,
|
|
842
|
-
p,
|
|
843
842
|
b,
|
|
843
|
+
v,
|
|
844
844
|
x,
|
|
845
845
|
m,
|
|
846
846
|
A,
|
|
@@ -993,21 +993,21 @@ const je = ({
|
|
|
993
993
|
return;
|
|
994
994
|
}
|
|
995
995
|
n();
|
|
996
|
-
const
|
|
996
|
+
const b = i.sidebarHeightPx, v = i.midAnchorPointPx, x = i.midAnchorPoint && !i.swipeToOpen && v < b;
|
|
997
997
|
if (s)
|
|
998
998
|
if (x) {
|
|
999
999
|
const m = t.getBottomAnchorState();
|
|
1000
1000
|
if (m === "open") {
|
|
1001
1001
|
const A = Math.max(
|
|
1002
1002
|
0,
|
|
1003
|
-
Math.min(
|
|
1003
|
+
Math.min(b, u - i.dragActivationDeltaPx)
|
|
1004
1004
|
);
|
|
1005
1005
|
t.dragSidebar(A);
|
|
1006
1006
|
} else if (m === "midAnchor") {
|
|
1007
|
-
const A =
|
|
1007
|
+
const A = b - v, T = Math.max(
|
|
1008
1008
|
0,
|
|
1009
1009
|
Math.min(
|
|
1010
|
-
|
|
1010
|
+
b,
|
|
1011
1011
|
A + u - i.dragActivationDeltaPx
|
|
1012
1012
|
)
|
|
1013
1013
|
);
|
|
@@ -1016,17 +1016,17 @@ const je = ({
|
|
|
1016
1016
|
} else {
|
|
1017
1017
|
const m = Math.max(
|
|
1018
1018
|
0,
|
|
1019
|
-
Math.min(
|
|
1019
|
+
Math.min(b, u - i.dragActivationDeltaPx)
|
|
1020
1020
|
);
|
|
1021
1021
|
t.dragSidebar(m);
|
|
1022
1022
|
}
|
|
1023
1023
|
else if (e.draggingRef.current.startY >= d - i.edgeActivationWidthPx)
|
|
1024
1024
|
if (x) {
|
|
1025
|
-
const m =
|
|
1025
|
+
const m = b - v, A = Math.max(
|
|
1026
1026
|
m,
|
|
1027
1027
|
Math.min(
|
|
1028
|
-
|
|
1029
|
-
|
|
1028
|
+
b,
|
|
1029
|
+
b + u + i.dragActivationDeltaPx
|
|
1030
1030
|
)
|
|
1031
1031
|
);
|
|
1032
1032
|
t.dragSidebar(A);
|
|
@@ -1034,8 +1034,8 @@ const je = ({
|
|
|
1034
1034
|
const m = Math.max(
|
|
1035
1035
|
0,
|
|
1036
1036
|
Math.min(
|
|
1037
|
-
|
|
1038
|
-
|
|
1037
|
+
b,
|
|
1038
|
+
b + u + i.dragActivationDeltaPx
|
|
1039
1039
|
)
|
|
1040
1040
|
);
|
|
1041
1041
|
t.dragSidebar(m);
|
|
@@ -1048,13 +1048,13 @@ const je = ({
|
|
|
1048
1048
|
}
|
|
1049
1049
|
const a = e.currentYRef.current ?? e.draggingRef.current.startY, i = e.prevYRef.current ?? e.draggingRef.current.startY, u = e.draggingRef.current.startY, s = t.getIsOpen(), d = window.innerHeight;
|
|
1050
1050
|
e.draggingRef.current = null, e.currentYRef.current = null, e.prevYRef.current = null, n();
|
|
1051
|
-
const c = a < i,
|
|
1051
|
+
const c = a < i, b = a >= i, v = u >= d - r.edgeActivationWidthPx, x = r.midAnchorPointPx, m = r.sidebarHeightPx, A = r.midAnchorPoint && !r.swipeToOpen && x < m;
|
|
1052
1052
|
if (s)
|
|
1053
1053
|
if (A) {
|
|
1054
1054
|
const T = t.getBottomAnchorState(), Y = m - x;
|
|
1055
1055
|
if (T === "open") {
|
|
1056
1056
|
const $ = Math.max(0, a - u);
|
|
1057
|
-
|
|
1057
|
+
b ? $ > Y ? t.closeSidebar() : t.openToMidAnchor() : $ < Y ? t.openSidebarFully() : t.openToMidAnchor(), t.dragSidebar(null);
|
|
1058
1058
|
} else if (T === "midAnchor") {
|
|
1059
1059
|
const $ = m - x, j = Math.max(
|
|
1060
1060
|
0,
|
|
@@ -1069,8 +1069,8 @@ const je = ({
|
|
|
1069
1069
|
t.dragSidebar(null);
|
|
1070
1070
|
}
|
|
1071
1071
|
} else
|
|
1072
|
-
|
|
1073
|
-
else
|
|
1072
|
+
b ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null);
|
|
1073
|
+
else v && c ? (A ? t.openToMidAnchor() : t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
|
|
1074
1074
|
};
|
|
1075
1075
|
function qt(e, t) {
|
|
1076
1076
|
var C, N;
|
|
@@ -1082,14 +1082,14 @@ function qt(e, t) {
|
|
|
1082
1082
|
openSidebarFully: s,
|
|
1083
1083
|
closeSidebar: d,
|
|
1084
1084
|
dragSidebar: c,
|
|
1085
|
-
openSidebarToMidAnchor:
|
|
1086
|
-
activeBottomDragIdRef:
|
|
1085
|
+
openSidebarToMidAnchor: b,
|
|
1086
|
+
activeBottomDragIdRef: v,
|
|
1087
1087
|
bottomFocusStackRef: x
|
|
1088
1088
|
} = K(), m = ((C = i[t]) == null ? void 0 : C.isOpen) ?? !1, A = ((N = i[t]) == null ? void 0 : N.anchorState) ?? "closed", T = W(null), Y = W(null), $ = W(null), j = W(A);
|
|
1089
1089
|
z(() => {
|
|
1090
1090
|
j.current = A;
|
|
1091
1091
|
}, [A]), z(() => {
|
|
1092
|
-
if (!r || n
|
|
1092
|
+
if (!r || n && n !== "bottom" || e.disabled) return;
|
|
1093
1093
|
const D = {
|
|
1094
1094
|
getIsOpen: () => m,
|
|
1095
1095
|
openSidebar: () => u("bottom", { id: t }),
|
|
@@ -1097,12 +1097,12 @@ function qt(e, t) {
|
|
|
1097
1097
|
closeSidebar: () => d("bottom", { id: t }),
|
|
1098
1098
|
dragSidebar: (y) => c("bottom", y, { id: t }),
|
|
1099
1099
|
getBottomAnchorState: () => j.current,
|
|
1100
|
-
openToMidAnchor: () =>
|
|
1100
|
+
openToMidAnchor: () => b("bottom", { id: t })
|
|
1101
1101
|
}, M = {
|
|
1102
1102
|
draggingRef: T,
|
|
1103
1103
|
currentYRef: Y,
|
|
1104
1104
|
prevYRef: $
|
|
1105
|
-
}, f = () =>
|
|
1105
|
+
}, f = () => v.current !== null && v.current !== t, w = () => {
|
|
1106
1106
|
const y = x.current;
|
|
1107
1107
|
return y.length === 0 ? !0 : y[y.length - 1] === t;
|
|
1108
1108
|
}, O = () => {
|
|
@@ -1110,14 +1110,14 @@ function qt(e, t) {
|
|
|
1110
1110
|
T.current = null;
|
|
1111
1111
|
return;
|
|
1112
1112
|
}
|
|
1113
|
-
|
|
1113
|
+
v.current = t, a("bottom");
|
|
1114
1114
|
}, P = () => {
|
|
1115
|
-
|
|
1115
|
+
v.current === t && (v.current = null);
|
|
1116
1116
|
};
|
|
1117
1117
|
function q(y) {
|
|
1118
|
-
if (n
|
|
1119
|
-
const F = y.changedTouches[0], _ = window.innerHeight, o = D.getIsOpen(),
|
|
1120
|
-
o && !e.swipeToClose || !o && !e.swipeToOpen || (o ||
|
|
1118
|
+
if (n && n !== "bottom" || f() || !w() || ce(y.target) || y.changedTouches.length === 0) return;
|
|
1119
|
+
const F = y.changedTouches[0], _ = window.innerHeight, o = D.getIsOpen(), p = F.clientY >= _ - e.edgeActivationWidthPx;
|
|
1120
|
+
o && !e.swipeToClose || !o && !e.swipeToOpen || (o || p) && Be({
|
|
1121
1121
|
refs: M,
|
|
1122
1122
|
clientX: F.clientX,
|
|
1123
1123
|
clientY: F.clientY,
|
|
@@ -1126,7 +1126,7 @@ function qt(e, t) {
|
|
|
1126
1126
|
});
|
|
1127
1127
|
}
|
|
1128
1128
|
function k(y) {
|
|
1129
|
-
if (n
|
|
1129
|
+
if (n && n !== "bottom") return;
|
|
1130
1130
|
if (f()) {
|
|
1131
1131
|
T.current = null;
|
|
1132
1132
|
return;
|
|
@@ -1143,7 +1143,7 @@ function qt(e, t) {
|
|
|
1143
1143
|
});
|
|
1144
1144
|
}
|
|
1145
1145
|
function G(y) {
|
|
1146
|
-
if (n
|
|
1146
|
+
if (n && n !== "bottom" || !T.current || T.current.isMouse) return;
|
|
1147
1147
|
const F = T.current.activeTouchId;
|
|
1148
1148
|
Te(y.changedTouches, F) && Ne({
|
|
1149
1149
|
refs: M,
|
|
@@ -1153,7 +1153,7 @@ function qt(e, t) {
|
|
|
1153
1153
|
});
|
|
1154
1154
|
}
|
|
1155
1155
|
function H() {
|
|
1156
|
-
n
|
|
1156
|
+
n && n !== "bottom" || !T.current || T.current.isMouse || (P(), Zt({
|
|
1157
1157
|
refs: M,
|
|
1158
1158
|
dragSidebar: D.dragSidebar,
|
|
1159
1159
|
onDeactivate: () => {
|
|
@@ -1161,7 +1161,7 @@ function qt(e, t) {
|
|
|
1161
1161
|
}));
|
|
1162
1162
|
}
|
|
1163
1163
|
function U(y) {
|
|
1164
|
-
if (n
|
|
1164
|
+
if (n && n !== "bottom" || f() || !w() || ce(y.target) || y.button !== 0) return;
|
|
1165
1165
|
const F = window.innerHeight, _ = D.getIsOpen(), o = y.clientY >= F - e.edgeActivationWidthPx;
|
|
1166
1166
|
_ && !e.swipeToClose || !_ && !e.swipeToOpen || (_ || o) && Be({
|
|
1167
1167
|
refs: M,
|
|
@@ -1172,7 +1172,7 @@ function qt(e, t) {
|
|
|
1172
1172
|
});
|
|
1173
1173
|
}
|
|
1174
1174
|
function V(y) {
|
|
1175
|
-
if (!(n
|
|
1175
|
+
if (!(n && n !== "bottom")) {
|
|
1176
1176
|
if (f()) {
|
|
1177
1177
|
T.current = null;
|
|
1178
1178
|
return;
|
|
@@ -1188,7 +1188,7 @@ function qt(e, t) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
1190
|
function Q() {
|
|
1191
|
-
n
|
|
1191
|
+
n && n !== "bottom" || !T.current || !T.current.isMouse || Ne({
|
|
1192
1192
|
refs: M,
|
|
1193
1193
|
callbacks: D,
|
|
1194
1194
|
options: e,
|
|
@@ -1209,8 +1209,8 @@ function qt(e, t) {
|
|
|
1209
1209
|
n,
|
|
1210
1210
|
a,
|
|
1211
1211
|
e,
|
|
1212
|
-
p,
|
|
1213
1212
|
b,
|
|
1213
|
+
v,
|
|
1214
1214
|
x
|
|
1215
1215
|
]);
|
|
1216
1216
|
}
|
|
@@ -1229,29 +1229,29 @@ function nr({
|
|
|
1229
1229
|
closeSidebar: u,
|
|
1230
1230
|
registerBottomSidebar: s,
|
|
1231
1231
|
unregisterBottomSidebar: d
|
|
1232
|
-
} = K(), c = W(null),
|
|
1233
|
-
z(() => (s(e, { sidebarRef: c, toggleRef:
|
|
1234
|
-
const
|
|
1235
|
-
qt(
|
|
1232
|
+
} = K(), c = W(null), b = W(null);
|
|
1233
|
+
z(() => (s(e, { sidebarRef: c, toggleRef: b }), () => d(e)), [e, s, d]);
|
|
1234
|
+
const v = Ee("bottom", a, e), x = ue(v.mediaQueryWidth);
|
|
1235
|
+
qt(v, e);
|
|
1236
1236
|
const m = ((A = i[e]) == null ? void 0 : A.isOpen) ?? !1;
|
|
1237
1237
|
return /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
|
|
1238
|
-
|
|
1238
|
+
v.showOverlay && /* @__PURE__ */ R.jsx(
|
|
1239
1239
|
Ae,
|
|
1240
1240
|
{
|
|
1241
1241
|
isCollapsed: !m,
|
|
1242
1242
|
setCollapsed: () => u("bottom", { id: e }),
|
|
1243
|
-
transitionMs:
|
|
1244
|
-
overlayBackgroundColor:
|
|
1245
|
-
overlayZIndex:
|
|
1243
|
+
transitionMs: v.transitionMs,
|
|
1244
|
+
overlayBackgroundColor: v.overlayBackgroundColor,
|
|
1245
|
+
overlayZIndex: v.overlayZIndex
|
|
1246
1246
|
}
|
|
1247
1247
|
),
|
|
1248
1248
|
/* @__PURE__ */ R.jsx(
|
|
1249
1249
|
zt,
|
|
1250
1250
|
{
|
|
1251
1251
|
id: e,
|
|
1252
|
-
toggleRef:
|
|
1253
|
-
options:
|
|
1254
|
-
showToggle:
|
|
1252
|
+
toggleRef: b,
|
|
1253
|
+
options: v,
|
|
1254
|
+
showToggle: v.showToggle,
|
|
1255
1255
|
ToggleComponent: n
|
|
1256
1256
|
}
|
|
1257
1257
|
),
|
|
@@ -1262,9 +1262,9 @@ function nr({
|
|
|
1262
1262
|
style: {
|
|
1263
1263
|
...Bt,
|
|
1264
1264
|
...jt,
|
|
1265
|
-
...
|
|
1265
|
+
...v.isAbsolute || x ? Nt : {},
|
|
1266
1266
|
...t ? {} : { backgroundColor: ye },
|
|
1267
|
-
zIndex:
|
|
1267
|
+
zIndex: v.swipeBarZIndex
|
|
1268
1268
|
},
|
|
1269
1269
|
className: t,
|
|
1270
1270
|
children: r
|
|
@@ -1323,23 +1323,23 @@ const Fe = ({
|
|
|
1323
1323
|
n();
|
|
1324
1324
|
const c = i.sidebarWidthPx;
|
|
1325
1325
|
if (s) {
|
|
1326
|
-
const
|
|
1326
|
+
const b = Math.min(
|
|
1327
1327
|
0,
|
|
1328
1328
|
Math.max(
|
|
1329
1329
|
-c,
|
|
1330
1330
|
u + i.dragActivationDeltaPx
|
|
1331
1331
|
)
|
|
1332
1332
|
);
|
|
1333
|
-
t.dragSidebar(
|
|
1333
|
+
t.dragSidebar(b);
|
|
1334
1334
|
} else if (e.draggingRef.current.startX <= i.edgeActivationWidthPx) {
|
|
1335
|
-
const
|
|
1335
|
+
const b = Math.min(
|
|
1336
1336
|
0,
|
|
1337
1337
|
Math.max(
|
|
1338
1338
|
-c,
|
|
1339
1339
|
-c + u - i.dragActivationDeltaPx
|
|
1340
1340
|
)
|
|
1341
1341
|
);
|
|
1342
|
-
t.dragSidebar(
|
|
1342
|
+
t.dragSidebar(b);
|
|
1343
1343
|
}
|
|
1344
1344
|
}, ke = ({
|
|
1345
1345
|
refs: e,
|
|
@@ -1365,9 +1365,9 @@ function Qt(e) {
|
|
|
1365
1365
|
closeSidebar: u,
|
|
1366
1366
|
dragSidebar: s,
|
|
1367
1367
|
leftSidebarRef: d
|
|
1368
|
-
} = K(), c = W(null),
|
|
1368
|
+
} = K(), c = W(null), b = W(null), v = W(null);
|
|
1369
1369
|
z(() => {
|
|
1370
|
-
if (!t || r
|
|
1370
|
+
if (!t || r && r !== "left" || e.disabled) return;
|
|
1371
1371
|
const x = {
|
|
1372
1372
|
getIsOpen: () => a,
|
|
1373
1373
|
openSidebar: () => i("left"),
|
|
@@ -1375,11 +1375,11 @@ function Qt(e) {
|
|
|
1375
1375
|
dragSidebar: (f) => s("left", f)
|
|
1376
1376
|
}, m = {
|
|
1377
1377
|
draggingRef: c,
|
|
1378
|
-
currentXRef:
|
|
1379
|
-
prevXRef:
|
|
1378
|
+
currentXRef: b,
|
|
1379
|
+
prevXRef: v
|
|
1380
1380
|
}, A = () => n("left"), T = () => n(null);
|
|
1381
1381
|
function Y(f) {
|
|
1382
|
-
if (r
|
|
1382
|
+
if (r && r !== "left" || ce(f.target) || f.changedTouches.length === 0) return;
|
|
1383
1383
|
const w = f.changedTouches[0], O = x.getIsOpen(), P = w.clientX <= e.edgeActivationWidthPx;
|
|
1384
1384
|
O && !e.swipeToClose || !O && !e.swipeToOpen || (O || P) && he({
|
|
1385
1385
|
refs: m,
|
|
@@ -1390,7 +1390,7 @@ function Qt(e) {
|
|
|
1390
1390
|
});
|
|
1391
1391
|
}
|
|
1392
1392
|
function $(f) {
|
|
1393
|
-
if (r
|
|
1393
|
+
if (r && r !== "left" || !c.current || c.current.isMouse) return;
|
|
1394
1394
|
const w = c.current.activeTouchId, O = Re(f.changedTouches, w);
|
|
1395
1395
|
O && Fe({
|
|
1396
1396
|
refs: m,
|
|
@@ -1402,7 +1402,7 @@ function Qt(e) {
|
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
function j(f) {
|
|
1405
|
-
if (r
|
|
1405
|
+
if (r && r !== "left" || !c.current || c.current.isMouse) return;
|
|
1406
1406
|
const w = c.current.activeTouchId;
|
|
1407
1407
|
Te(f.changedTouches, w) && ke({
|
|
1408
1408
|
refs: m,
|
|
@@ -1411,14 +1411,14 @@ function Qt(e) {
|
|
|
1411
1411
|
});
|
|
1412
1412
|
}
|
|
1413
1413
|
function C() {
|
|
1414
|
-
r !== "
|
|
1414
|
+
r && r !== "left" || !c.current || c.current.isMouse || Qe({
|
|
1415
1415
|
refs: m,
|
|
1416
1416
|
dragSidebar: x.dragSidebar,
|
|
1417
1417
|
onDeactivate: T
|
|
1418
|
-
})
|
|
1418
|
+
});
|
|
1419
1419
|
}
|
|
1420
1420
|
function N(f) {
|
|
1421
|
-
if (r
|
|
1421
|
+
if (r && r !== "left" || ce(f.target) || f.button !== 0) return;
|
|
1422
1422
|
const w = x.getIsOpen(), O = f.clientX <= e.edgeActivationWidthPx;
|
|
1423
1423
|
w && !e.swipeToClose || !w && !e.swipeToOpen || (w || O) && he({
|
|
1424
1424
|
refs: m,
|
|
@@ -1429,21 +1429,21 @@ function Qt(e) {
|
|
|
1429
1429
|
});
|
|
1430
1430
|
}
|
|
1431
1431
|
function D(f) {
|
|
1432
|
-
r !== "
|
|
1432
|
+
r && r !== "left" || !c.current || !c.current.isMouse || Fe({
|
|
1433
1433
|
refs: m,
|
|
1434
1434
|
callbacks: x,
|
|
1435
1435
|
currentX: f.clientX,
|
|
1436
1436
|
preventDefault: () => f.preventDefault(),
|
|
1437
1437
|
lockPane: A,
|
|
1438
1438
|
options: e
|
|
1439
|
-
})
|
|
1439
|
+
});
|
|
1440
1440
|
}
|
|
1441
1441
|
function M() {
|
|
1442
|
-
r !== "
|
|
1442
|
+
r && r !== "left" || !c.current || !c.current.isMouse || ke({
|
|
1443
1443
|
refs: m,
|
|
1444
1444
|
callbacks: x,
|
|
1445
1445
|
options: e
|
|
1446
|
-
})
|
|
1446
|
+
});
|
|
1447
1447
|
}
|
|
1448
1448
|
return window.addEventListener("touchstart", Y, { passive: !0 }), window.addEventListener("touchmove", $, { passive: !1 }), window.addEventListener("touchend", j, { passive: !0 }), window.addEventListener("touchcancel", C, { passive: !0 }), window.addEventListener("mousedown", N, { passive: !0 }), window.addEventListener("mousemove", D, { passive: !1 }), window.addEventListener("mouseup", M, { passive: !0 }), () => {
|
|
1449
1449
|
window.removeEventListener("touchstart", Y), window.removeEventListener("touchmove", $), window.removeEventListener("touchend", j), window.removeEventListener("touchcancel", C), window.removeEventListener("mousedown", N), window.removeEventListener("mousemove", D), window.removeEventListener("mouseup", M);
|
|
@@ -1551,15 +1551,15 @@ const He = ({
|
|
|
1551
1551
|
const u = window.innerWidth, s = r - e.draggingRef.current.startX, d = e.draggingRef.current.startX >= u - i.edgeActivationWidthPx, c = e.draggingRef.current.isActivated;
|
|
1552
1552
|
if (!c && Math.abs(s) >= i.dragActivationDeltaPx && (e.draggingRef.current.isActivated = !0, a()), !c) return;
|
|
1553
1553
|
e.prevXRef.current = e.currentXRef.current, e.currentXRef.current = r;
|
|
1554
|
-
const
|
|
1555
|
-
let
|
|
1556
|
-
if ((
|
|
1554
|
+
const b = t.getIsOpen();
|
|
1555
|
+
let v = !1;
|
|
1556
|
+
if ((b || d) && (v = !0), !v) {
|
|
1557
1557
|
e.draggingRef.current = null, t.dragSidebar(null);
|
|
1558
1558
|
return;
|
|
1559
1559
|
}
|
|
1560
1560
|
n();
|
|
1561
1561
|
const x = i.sidebarWidthPx;
|
|
1562
|
-
if (
|
|
1562
|
+
if (b) {
|
|
1563
1563
|
const m = Math.max(
|
|
1564
1564
|
0,
|
|
1565
1565
|
Math.min(x, s - i.dragActivationDeltaPx)
|
|
@@ -1583,8 +1583,8 @@ const He = ({
|
|
|
1583
1583
|
}
|
|
1584
1584
|
const n = e.currentXRef.current ?? e.draggingRef.current.startX, a = e.prevXRef.current ?? e.draggingRef.current.startX, i = e.draggingRef.current.startX, u = t.getIsOpen(), s = window.innerWidth;
|
|
1585
1585
|
e.draggingRef.current = null, e.currentXRef.current = null, e.prevXRef.current = null;
|
|
1586
|
-
const d = n > a, c = n < a,
|
|
1587
|
-
u ? (d ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null)) :
|
|
1586
|
+
const d = n > a, c = n < a, b = i >= s - r.edgeActivationWidthPx;
|
|
1587
|
+
u ? (d ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null)) : b && c ? (t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
|
|
1588
1588
|
};
|
|
1589
1589
|
function Kt(e) {
|
|
1590
1590
|
const t = ue(e.mediaQueryWidth), {
|
|
@@ -1595,9 +1595,9 @@ function Kt(e) {
|
|
|
1595
1595
|
closeSidebar: u,
|
|
1596
1596
|
dragSidebar: s,
|
|
1597
1597
|
rightSidebarRef: d
|
|
1598
|
-
} = K(), c = W(null),
|
|
1598
|
+
} = K(), c = W(null), b = W(null), v = W(null);
|
|
1599
1599
|
z(() => {
|
|
1600
|
-
if (!t || r
|
|
1600
|
+
if (!t || r && r !== "right" || e.disabled) return;
|
|
1601
1601
|
const x = {
|
|
1602
1602
|
getIsOpen: () => a,
|
|
1603
1603
|
openSidebar: () => i("right"),
|
|
@@ -1605,11 +1605,11 @@ function Kt(e) {
|
|
|
1605
1605
|
dragSidebar: (f) => s("right", f)
|
|
1606
1606
|
}, m = {
|
|
1607
1607
|
draggingRef: c,
|
|
1608
|
-
currentXRef:
|
|
1609
|
-
prevXRef:
|
|
1608
|
+
currentXRef: b,
|
|
1609
|
+
prevXRef: v
|
|
1610
1610
|
}, A = () => n("right"), T = () => n(null);
|
|
1611
1611
|
function Y(f) {
|
|
1612
|
-
if (r
|
|
1612
|
+
if (r && r !== "right" || ce(f.target) || f.changedTouches.length === 0) return;
|
|
1613
1613
|
const w = f.changedTouches[0], O = window.innerWidth, P = x.getIsOpen(), q = w.clientX >= O - e.edgeActivationWidthPx;
|
|
1614
1614
|
P && !e.swipeToClose || !P && !e.swipeToOpen || (P || q) && he({
|
|
1615
1615
|
refs: m,
|
|
@@ -1620,7 +1620,7 @@ function Kt(e) {
|
|
|
1620
1620
|
});
|
|
1621
1621
|
}
|
|
1622
1622
|
function $(f) {
|
|
1623
|
-
if (r
|
|
1623
|
+
if (r && r !== "right" || !c.current || c.current.isMouse) return;
|
|
1624
1624
|
const w = c.current.activeTouchId, O = Re(f.changedTouches, w);
|
|
1625
1625
|
O && He({
|
|
1626
1626
|
refs: m,
|
|
@@ -1632,7 +1632,7 @@ function Kt(e) {
|
|
|
1632
1632
|
});
|
|
1633
1633
|
}
|
|
1634
1634
|
function j(f) {
|
|
1635
|
-
if (r
|
|
1635
|
+
if (r && r !== "right" || !c.current || c.current.isMouse) return;
|
|
1636
1636
|
const w = c.current.activeTouchId;
|
|
1637
1637
|
Te(f.changedTouches, w) && Ge({
|
|
1638
1638
|
refs: m,
|
|
@@ -1641,14 +1641,14 @@ function Kt(e) {
|
|
|
1641
1641
|
});
|
|
1642
1642
|
}
|
|
1643
1643
|
function C() {
|
|
1644
|
-
r !== "
|
|
1644
|
+
r && r !== "right" || !c.current || c.current.isMouse || Qe({
|
|
1645
1645
|
refs: m,
|
|
1646
1646
|
dragSidebar: x.dragSidebar,
|
|
1647
1647
|
onDeactivate: T
|
|
1648
|
-
})
|
|
1648
|
+
});
|
|
1649
1649
|
}
|
|
1650
1650
|
function N(f) {
|
|
1651
|
-
if (r
|
|
1651
|
+
if (r && r !== "right" || ce(f.target) || f.button !== 0) return;
|
|
1652
1652
|
const w = window.innerWidth, O = x.getIsOpen(), P = f.clientX >= w - e.edgeActivationWidthPx;
|
|
1653
1653
|
O && !e.swipeToClose || !O && !e.swipeToOpen || (O || P) && he({
|
|
1654
1654
|
refs: m,
|
|
@@ -1659,21 +1659,21 @@ function Kt(e) {
|
|
|
1659
1659
|
});
|
|
1660
1660
|
}
|
|
1661
1661
|
function D(f) {
|
|
1662
|
-
r !== "
|
|
1662
|
+
r && r !== "right" || !c.current || !c.current.isMouse || He({
|
|
1663
1663
|
refs: m,
|
|
1664
1664
|
callbacks: x,
|
|
1665
1665
|
currentX: f.clientX,
|
|
1666
1666
|
preventDefault: () => f.preventDefault(),
|
|
1667
1667
|
lockPane: A,
|
|
1668
1668
|
options: e
|
|
1669
|
-
})
|
|
1669
|
+
});
|
|
1670
1670
|
}
|
|
1671
1671
|
function M() {
|
|
1672
|
-
r !== "
|
|
1672
|
+
r && r !== "right" || !c.current || !c.current.isMouse || Ge({
|
|
1673
1673
|
refs: m,
|
|
1674
1674
|
callbacks: x,
|
|
1675
1675
|
options: e
|
|
1676
|
-
})
|
|
1676
|
+
});
|
|
1677
1677
|
}
|
|
1678
1678
|
return window.addEventListener("touchstart", Y, { passive: !0 }), window.addEventListener("touchmove", $, { passive: !1 }), window.addEventListener("touchend", j, { passive: !0 }), window.addEventListener("touchcancel", C, { passive: !0 }), window.addEventListener("mousedown", N, { passive: !0 }), window.addEventListener("mousemove", D, { passive: !1 }), window.addEventListener("mouseup", M, { passive: !0 }), () => {
|
|
1679
1679
|
window.removeEventListener("touchstart", Y), window.removeEventListener("touchmove", $), window.removeEventListener("touchend", j), window.removeEventListener("touchcancel", C), window.removeEventListener("mousedown", N), window.removeEventListener("mousemove", D), window.removeEventListener("mouseup", M);
|
package/dist/swipe-bar.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(F,
|
|
1
|
+
(function(F,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],l):(F=typeof globalThis<"u"?globalThis:F||self,l(F.LucioDaleSwipeBar={},F.React))})(this,function(F,l){"use strict";var he={exports:{}},ce={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ae;function $e(){if(Ae)return ce;Ae=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var
|
|
9
|
+
*/var Ae;function $e(){if(Ae)return ce;Ae=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var u=null;if(i!==void 0&&(u=""+i),a.key!==void 0&&(u=""+a.key),"key"in a){i={};for(var s in a)s!=="key"&&(i[s]=a[s])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:i}}return ce.Fragment=t,ce.jsx=n,ce.jsxs=n,ce}var ue={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Oe;function qe(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===V?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case B:return"Fragment";case k:return"Profiler";case W:return"StrictMode";case M:return"Suspense";case g:return"SuspenseList";case I:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case E:return"Portal";case N:return o.displayName||"Context";case L:return(o._context.displayName||"Context")+".Consumer";case D:var v=o.render;return o=o.displayName,o||(o=v.displayName||v.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case S:return v=o.displayName||null,v!==null?v:e(o.type)||"Memo";case P:v=o._payload,o=o._init;try{return e(o(v))}catch{}}return null}function t(o){return""+o}function n(o){try{t(o);var v=!1}catch{v=!0}if(v){v=console;var C=v.error,X=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return C.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",X),t(o)}}function r(o){if(o===B)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===P)return"<...>";try{var v=e(o);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function a(){var o=G.A;return o===null?null:o.getOwner()}function i(){return Error("react-stack-top-frame")}function
|
|
17
|
+
*/var Oe;function qe(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===V?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case B:return"Fragment";case k:return"Profiler";case W:return"StrictMode";case M:return"Suspense";case g:return"SuspenseList";case I:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case E:return"Portal";case N:return o.displayName||"Context";case L:return(o._context.displayName||"Context")+".Consumer";case D:var v=o.render;return o=o.displayName,o||(o=v.displayName||v.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case S:return v=o.displayName||null,v!==null?v:e(o.type)||"Memo";case P:v=o._payload,o=o._init;try{return e(o(v))}catch{}}return null}function t(o){return""+o}function n(o){try{t(o);var v=!1}catch{v=!0}if(v){v=console;var C=v.error,X=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return C.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",X),t(o)}}function r(o){if(o===B)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===P)return"<...>";try{var v=e(o);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function a(){var o=G.A;return o===null?null:o.getOwner()}function i(){return Error("react-stack-top-frame")}function u(o){if(Z.call(o,"key")){var v=Object.getOwnPropertyDescriptor(o,"key").get;if(v&&v.isReactWarning)return!1}return o.key!==void 0}function s(o,v){function C(){J||(J=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",v))}C.isReactWarning=!0,Object.defineProperty(o,"key",{get:C,configurable:!0})}function f(){var o=e(this.type);return K[o]||(K[o]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),o=this.props.ref,o!==void 0?o:null}function c(o,v,C,X,ie,$){var Y=C.ref;return o={$$typeof:O,type:o,key:v,props:C,_owner:X},(Y!==void 0?Y:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:f}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ie}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function p(o,v,C,X,ie,$){var Y=v.children;if(Y!==void 0)if(X)if(U(Y)){for(X=0;X<Y.length;X++)w(Y[X]);Object.freeze&&Object.freeze(Y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(Y);if(Z.call(v,"key")){Y=e(o);var te=Object.keys(v).filter(function(Ee){return Ee!=="key"});X=0<te.length?"{key: someKey, "+te.join(": ..., ")+": ...}":"{key: someKey}",_[Y+X]||(te=0<te.length?"{"+te.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,X,Y,te,Y),_[Y+X]=!0)}if(Y=null,C!==void 0&&(n(C),Y=""+C),l(v)&&(n(v.key),Y=""+v.key),"key"in v){C={};for(var de in v)de!=="key"&&(C[de]=v[de])}else C=v;return Y&&s(C,typeof o=="function"?o.displayName||o.name||"Unknown":o),c(o,Y,C,a(),ie,$)}function w(o){R(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===P&&(o._payload.status==="fulfilled"?R(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function R(o){return typeof o=="object"&&o!==null&&o.$$typeof===O}var b=u,O=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),G=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,U=Array.isArray,z=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(o){return o()}};var J,K={},x=b.react_stack_bottom_frame.bind(b,i)(),H=z(r(i)),_={};le.Fragment=B,le.jsx=function(o,v,C){var X=1e4>G.recentlyCreatedOwnerStacks++;return p(o,v,C,!1,X?Error("react-stack-top-frame"):x,X?z(r(o)):H)},le.jsxs=function(o,v,C){var X=1e4>G.recentlyCreatedOwnerStacks++;return p(o,v,C,!0,X?Error("react-stack-top-frame"):x,X?z(r(o)):H)}}()),le}process.env.NODE_ENV==="production"?he.exports=$e():he.exports=qe();var T=he.exports;const Pe=u.createContext(null),me=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},be={isOpen:!1,anchorState:"closed"},et=({children:e,sidebarWidthPx:t,transitionMs:n,edgeActivationWidthPx:r,dragActivationDeltaPx:a,showOverlay:i,isAbsolute:l,overlayBackgroundColor:s,toggleIconColor:f,toggleIconSizePx:c,toggleIconEdgeDistancePx:p,showToggle:w,mediaQueryWidth:R,swipeBarZIndex:b,toggleZIndex:O,overlayZIndex:E,fadeContent:B,fadeContentTransitionMs:W})=>{var Ve,Je;const[k,L]=u.useState(null),[N,D]=u.useState(!1),[M,g]=u.useState(!1),[S,P]=u.useState({}),[I,V]=u.useState({}),G=u.useRef(null),Z=u.useRef(null),U=u.useRef(null),z=u.useRef(null),[J,K]=u.useState({}),[x,H]=u.useState({}),_=u.useRef(new Map),o=u.useRef(null),v=u.useRef([]),C=((Ve=J.primary)==null?void 0:Ve.isOpen)??!1,X=((Je=J.primary)==null?void 0:Je.anchorState)??"closed",ie=u.useMemo(()=>Object.values(J).some(d=>d.isOpen),[J]),$=_.current.get("primary"),Y=($==null?void 0:$.sidebarRef)??{current:null},te=($==null?void 0:$.toggleRef)??{current:null},de=x.primary??{},[Ee,jt]=u.useState({sidebarWidthPx:t??it,sidebarHeightPx:Ie,transitionMs:n??tt,edgeActivationWidthPx:r??nt,dragActivationDeltaPx:a??rt,showOverlay:i??ot,isAbsolute:l??at,overlayBackgroundColor:s??Ce,toggleIconColor:f??st,toggleIconSizePx:c??ct,toggleIconEdgeDistancePx:p??lt,showToggle:w??ut,mediaQueryWidth:R??ve,swipeBarZIndex:b??dt,toggleZIndex:O??ft,overlayZIndex:E??gt,fadeContent:B??bt,fadeContentTransitionMs:W??mt,swipeToOpen:pt,swipeToClose:vt,midAnchorPoint:wt,midAnchorPointPx:Ie/3,disabled:!1}),kt=u.useCallback((d,h)=>{_.current.set(d,h),K(m=>m[d]?m:{...m,[d]:{...be}})},[]),Nt=u.useCallback(d=>{_.current.delete(d),K(h=>{const m={...h};return delete m[d],m}),H(h=>{const m={...h};return delete m[d],m})},[]),Ft=u.useCallback(d=>_.current.get(d),[]),Ht=u.useCallback((d,h)=>{H(m=>m[d]===h?m:{...m,[d]:h})},[]),q=u.useCallback((d,h)=>{K(m=>{const y=m[d]??be;return y.isOpen===h?m:{...m,[d]:{...y,isOpen:h}}})},[]),ee=u.useCallback((d,h)=>{K(m=>{const y=m[d]??be;return y.anchorState===h?m:{...m,[d]:{...y,anchorState:h}}})},[]);u.useEffect(()=>(N||M||ie?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[N,M,ie]),u.useEffect(()=>{var d;if(S.fadeContent===!1){const h=(d=G.current)==null?void 0:d.firstElementChild;h&&(h.style.opacity="1")}},[S.fadeContent]),u.useEffect(()=>{var d;if(I.fadeContent===!1){const h=(d=Z.current)==null?void 0:d.firstElementChild;h&&(h.style.opacity="1")}},[I.fadeContent]),u.useEffect(()=>{var d;for(const[h,m]of Object.entries(x))if(m.fadeContent===!1){const y=_.current.get(h),A=(d=y==null?void 0:y.sidebarRef.current)==null?void 0:d.firstElementChild;A&&(A.style.opacity="1")}},[x]);const Gt=u.useCallback(d=>{jt(h=>({...h,...d}))},[]),oe=u.useCallback(d=>{const h=v.current,m=h.indexOf(d);m!==-1&&h.splice(m,1),h.push(d),L("bottom")},[]),Qe=u.useCallback(d=>{const h=v.current,m=h.indexOf(d);m!==-1&&h.splice(m,1),K(y=>(Object.entries(y).some(([j,ne])=>j!==d&&ne.isOpen)||L(null),y))},[]),Ut=u.useCallback((d,h)=>{const m=(y,A,j,ne)=>{Se({side:d,ref:y,options:A,toggleRef:j,afterApply:()=>{ne(!0),L(d)}})};if(d==="left"){if(S.disabled)return;m(G,S,U,D)}else if(d==="right"){if(I.disabled)return;m(Z,I,z,g)}else if(d==="bottom"){const y=(h==null?void 0:h.id)??"primary",A=x[y],j=_.current.get(y);if(!A||!j||A.disabled)return;const ne=A.sidebarHeightPx??0,Jt=A.mediaQueryWidth??640,Ke=window.innerWidth<Jt,Kt=Ke?A.midAnchorPointPx??0:ne;Ke&&A.midAnchorPoint&&!A.swipeToOpen&&Kt<ne?Xe({ref:j.sidebarRef,options:A,toggleRef:j.toggleRef,afterApply:()=>{q(y,!0),ee(y,"midAnchor"),oe(y)}}):Se({side:d,ref:j.sidebarRef,options:A,toggleRef:j.toggleRef,afterApply:()=>{q(y,!0),ee(y,"open"),oe(y)}})}else me(d)},[S,I,x,q,ee,oe]),Zt=u.useCallback((d,h)=>{if(d!=="bottom")return;const m=(h==null?void 0:h.id)??"primary",y=x[m],A=_.current.get(m);!y||!A||y.disabled||Xe({ref:A.sidebarRef,options:y,toggleRef:A.toggleRef,afterApply:()=>{q(m,!0),ee(m,"midAnchor"),oe(m)}})},[x,q,ee,oe]),zt=u.useCallback((d,h)=>{if(d!=="bottom")return;const m=(h==null?void 0:h.id)??"primary",y=x[m],A=_.current.get(m);!y||!A||y.disabled||Se({side:d,ref:A.sidebarRef,options:y,toggleRef:A.toggleRef,afterApply:()=>{q(m,!0),ee(m,"open"),oe(m)}})},[x,q,ee,oe]),Qt=u.useCallback((d,h)=>{const m=(y,A,j,ne)=>{De({ref:y,options:A,toggleRef:j,side:d,afterApply:()=>{ne(!1),L(null)}})};if(d==="left"){if(S.disabled)return;m(G,S,U,D)}else if(d==="right"){if(I.disabled)return;m(Z,I,z,g)}else if(d==="bottom"){const y=(h==null?void 0:h.id)??"primary",A=x[y],j=_.current.get(y);if(!A||!j||A.disabled)return;De({ref:j.sidebarRef,options:A,toggleRef:j.toggleRef,side:d,afterApply:()=>{q(y,!1),ee(y,"closed"),Qe(y)}})}else me(d)},[S,I,x,q,ee,Qe]),Vt=u.useCallback((d,h,m)=>{if(d==="left")Ye({ref:G,toggleRef:U,options:S,translateX:h});else if(d==="right")Ye({ref:Z,toggleRef:z,options:I,translateX:h});else if(d==="bottom"){const y=(m==null?void 0:m.id)??"primary",A=x[y],j=_.current.get(y);if(!A||!j)return;Mt({ref:j.sidebarRef,toggleRef:j.toggleRef,options:A,translateY:h})}else me(d)},[S,I,x]);return T.jsx(Pe.Provider,{value:{lockedSidebar:k,setLockedSidebar:L,leftSidebarRef:G,rightSidebarRef:Z,isLeftOpen:N,isRightOpen:M,isBottomOpen:C,bottomAnchorState:X,bottomSidebarRef:Y,bottomToggleRef:te,bottomSidebarOptions:de,bottomSidebars:J,bottomSidebarOptionsMap:x,registerBottomSidebar:kt,unregisterBottomSidebar:Nt,getBottomSidebarRefs:Ft,activeBottomDragIdRef:o,bottomFocusStackRef:v,openSidebar:Ut,openSidebarFully:zt,openSidebarToMidAnchor:Zt,closeSidebar:Qt,dragSidebar:Vt,globalOptions:Ee,setGlobalOptions:Gt,leftSidebarOptions:S,rightSidebarOptions:I,setLeftSidebarOptions:P,setRightSidebarOptions:V,setBottomSidebarOptionsById:Ht,leftToggleRef:U,rightToggleRef:z},children:e})},Q=()=>{const e=u.useContext(Pe);if(!e)throw new Error("useSwipeBarContext must be used within SwipeBarProvider");return e},tt=300,nt=40,rt=20,it=320,Ie=window.innerHeight,ot=!0,at=!1,Ce="rgba(0, 0, 0, 0.5)",pe="rgb(36,36,36)",st="white",ct=40,lt=40,ut=!0,ve=640,dt=30,ft=15,gt=20,Me=.6,ht=200,mt=100,bt=!1,pt=!0,vt=!0,wt=!1,ae="cubic-bezier(0.22, 1, 0.36, 1)",_e={width:0,top:0,bottom:0,flexShrink:0,overflowX:"hidden",willChange:"transform"},St={transform:"translateX(-100%)"},yt={transform:"translateX(100%)"},xt={position:"fixed",left:0,top:0,bottom:0},Rt={position:"fixed",right:0,top:0,bottom:0},Tt={height:0,left:0,right:0,flexShrink:0,overflowY:"hidden",willChange:"transform"},Et={transform:"translateY(100%)"},At={position:"fixed",bottom:0,left:0,right:0},Ot={position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:Ce,transitionProperty:"opacity",pointerEvents:"none",opacity:0},Pt={opacity:1,pointerEvents:"auto"},Le={position:"fixed",top:"50%",transform:"translateY(-50%)",width:"1px",display:"flex",justifyContent:"center"},It={position:"fixed",bottom:0,left:"50%",transform:"translateX(-50%)",height:"1px",display:"flex",alignItems:"center"},Ct={position:"relative",cursor:"pointer",display:"flex",height:"72px",alignItems:"center",justifyContent:"center"},we=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},ue=e=>{var t;return(t=e.current)==null?void 0:t.firstElementChild},Se=({ref:e,side:t,options:n,toggleRef:r,afterApply:a})=>{const i=ue(e),l=n.transitionMs?n.transitionMs/2:0;i&&n.fadeContent&&(i.style.opacity="0");let s,f;t==="left"||t==="right"?(s="width",f=n.sidebarWidthPx,i&&f&&(i.style.minWidth=`${f}px`)):t==="bottom"?(s="height",f=n.sidebarHeightPx,i&&f&&(i.style.minHeight=`${f}px`)):we(t),requestAnimationFrame(()=>{if(!e.current)return;const c=`transform ${n.transitionMs}ms ${ae}`,p=n.isAbsolute?"":`, ${s} ${n.transitionMs}ms ${ae}`;e.current.style.transition=`${c}${p}`,i&&n.fadeContent&&(i.style.transition=`opacity ${n.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(e.current){if(e.current.style.transform=t==="bottom"?"translateY(0px)":"translateX(0px)",!n.isAbsolute)e.current.style[s]=`${f}px`;else if(e.current.style[s]!==`${f}px`){const w=e.current.style.transition;e.current.style.transition=c,e.current.style[s]=`${f}px`,e.current.style.transition=w}r.current&&f&&(r.current.style.opacity="1",t==="left"?r.current.style.transform=`translateY(-50%) translateX(${f}px)`:t==="right"?r.current.style.transform=`translateY(-50%) translateX(-${f}px)`:t==="bottom"&&(r.current.style.transform=`translateX(-50%) translateY(-${f}px)`)),i&&n.fadeContent&&setTimeout(()=>{i.style.opacity="1"},l),a()}})}),setTimeout(()=>{},0)},De=({ref:e,options:t,side:n,toggleRef:r,afterApply:a})=>{const i=ue(e);let l;n==="left"||n==="right"?(l="width",i&&t.sidebarWidthPx&&(i.style.minWidth=`${t.sidebarWidthPx}px`)):n==="bottom"?(l="height",i&&t.sidebarHeightPx&&(i.style.minHeight=`${t.sidebarHeightPx}px`)):we(n),requestAnimationFrame(()=>{if(!e.current)return;const s=`transform ${t.transitionMs}ms ${ae}`,f=t.isAbsolute?"":`, ${l} ${t.transitionMs}ms ${ae}`;e.current.style.transition=`${s}${f}`,i&&t.fadeContent&&(i.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{e.current&&(n==="left"?(e.current.style.transform="translateX(-100%)",t.isAbsolute||(e.current.style.width="0px")):n==="right"?(e.current.style.transform="translateX(100%)",t.isAbsolute||(e.current.style.width="0px")):n==="bottom"&&(e.current.style.transform="translateY(100%)",t.isAbsolute||(e.current.style.height="0px")),r.current&&(r.current.style.opacity="1",n==="left"||n==="right"?r.current.style.transform="translateY(-50%)":n==="bottom"&&(r.current.style.transform="translateX(-50%)")),i&&t.fadeContent&&(i.style.opacity="0"),a())})})},Xe=({ref:e,options:t,toggleRef:n,afterApply:r})=>{const a=ue(e),i=t.transitionMs?t.transitionMs/2:0;a&&t.fadeContent&&(a.style.opacity="0"),a&&t.midAnchorPointPx&&(a.style.minHeight=`${t.sidebarHeightPx}px`),requestAnimationFrame(()=>{if(!e.current)return;const l=`transform ${t.transitionMs}ms ${ae}`,s=t.isAbsolute?"":`, height ${t.transitionMs}ms ${ae}`;e.current.style.transition=`${l}${s}`,a&&t.fadeContent&&(a.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(!e.current)return;const f=t.midAnchorPointPx??0,c=t.sidebarHeightPx??0,p=c-f;if(e.current.style.transform=`translateY(${p}px)`,!t.isAbsolute)e.current.style.height=`${c}px`;else if(e.current.style.height!==`${c}px`){const w=e.current.style.transition;e.current.style.transition=l,e.current.style.height=`${c}px`,e.current.style.transition=w}n.current&&(n.current.style.opacity="1",n.current.style.transform=`translateX(-50%) translateY(-${f}px)`),a&&t.fadeContent&&setTimeout(()=>{a.style.opacity="1"},i),r()})}),setTimeout(()=>{},0)},Ye=({ref:e,toggleRef:t,options:n,translateX:r})=>{!e.current||r===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const a=ue(e);if(e.current){if(a&&n.fadeContent&&(a.style.opacity="0"),a&&n.sidebarWidthPx&&(a.style.minWidth=`${n.sidebarWidthPx}px`),!n.isAbsolute){const i=`${n.sidebarWidthPx}px`;e.current.style.width!==i&&(e.current.style.width=i)}e.current.style.transform=`translateX(${r}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateY(-50%) translateX(${r}px)`)}}))},Mt=({ref:e,toggleRef:t,options:n,translateY:r})=>{!e.current||r===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const a=ue(e);if(e.current){if(a&&n.fadeContent&&(a.style.opacity="0"),a&&n.sidebarHeightPx&&(a.style.minHeight=`${n.sidebarHeightPx}px`),!n.isAbsolute){const i=`${n.sidebarHeightPx}px`;e.current.style.height!==i&&(e.current.style.height=i)}e.current.style.transform=`translateY(${r}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateX(-50%) translateY(${r}px)`)}}))},fe=({refs:e,clientX:t,clientY:n,touchId:r,isMouse:a})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:r,isMouse:a,isActivated:!1},e.currentXRef.current=t,e.prevXRef.current=t},Be=({refs:e,clientX:t,clientY:n,touchId:r,isMouse:a})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:r,isMouse:a,isActivated:!1},e.currentYRef.current=n,e.prevYRef.current=n},We=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null,t(null),n()},_t=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,t(null)},se=e=>e instanceof Element?!!e.closest("input, textarea, [contenteditable='true']"):!1,ye=(e,t)=>{for(let n=0;n<e.length;n++){const r=e[n];if(t==null||r.identifier===t)return r}return null},xe=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n].identifier===t)return!0;return!1},Re=(e,t,n)=>{const{globalOptions:r,setLeftSidebarOptions:a,setRightSidebarOptions:i,setBottomSidebarOptionsById:l}=Q(),{sidebarWidthPx:s,sidebarHeightPx:f,transitionMs:c,edgeActivationWidthPx:p,dragActivationDeltaPx:w,showOverlay:R,isAbsolute:b,overlayBackgroundColor:O,toggleIconColor:E,toggleIconSizePx:B,toggleIconEdgeDistancePx:W,showToggle:k,mediaQueryWidth:L,swipeBarZIndex:N,toggleZIndex:D,overlayZIndex:M,fadeContent:g,fadeContentTransitionMs:S,swipeToOpen:P,swipeToClose:I,midAnchorPoint:V,midAnchorPointPx:G,disabled:Z}=t,U=u.useMemo(()=>{const z=f??r.sidebarHeightPx;return{sidebarWidthPx:s??r.sidebarWidthPx,sidebarHeightPx:z,transitionMs:c??r.transitionMs,edgeActivationWidthPx:p??r.edgeActivationWidthPx,dragActivationDeltaPx:w??r.dragActivationDeltaPx,showOverlay:R??r.showOverlay,isAbsolute:b??r.isAbsolute,overlayBackgroundColor:O??r.overlayBackgroundColor,toggleIconColor:E??r.toggleIconColor,toggleIconSizePx:B??r.toggleIconSizePx,toggleIconEdgeDistancePx:W??r.toggleIconEdgeDistancePx,showToggle:k??r.showToggle,mediaQueryWidth:L??r.mediaQueryWidth,swipeBarZIndex:N??r.swipeBarZIndex,toggleZIndex:D??r.toggleZIndex,overlayZIndex:M??r.overlayZIndex,fadeContent:g??r.fadeContent,fadeContentTransitionMs:S??r.fadeContentTransitionMs,swipeToOpen:P??r.swipeToOpen,swipeToClose:I??r.swipeToClose,midAnchorPoint:V??r.midAnchorPoint,midAnchorPointPx:G??r.midAnchorPointPx??Math.floor(z/3),disabled:Z??r.disabled}},[s,f,c,p,w,R,b,O,E,B,W,k,r,L,N,D,M,g,S,P,I,V,G,Z]);return u.useEffect(()=>{e==="left"?a(U):e==="right"?i(U):e==="bottom"?l(n??"primary",U):we(e)},[e,n,U,a,i,l]),U};function ge({isCollapsed:e,setCollapsed:t,closeSidebarOnClick:n=!0,transitionMs:r,overlayBackgroundColor:a,overlayZIndex:i}){return T.jsx("div",{style:{transitionDuration:`${r}ms`,...Ot,...e?{}:Pt,...a?{backgroundColor:a}:{},zIndex:i},onMouseDown:l=>{n&&(l.stopPropagation(),t())}})}function Te({size:e,color:t}){const n=u.useRef(null);return u.useEffect(()=>{const r=()=>{n.current&&(n.current.style.opacity="1")},a=()=>{n.current&&(n.current.style.opacity=`${Me}`)};n.current&&(n.current.addEventListener("mouseenter",r),n.current.addEventListener("mouseleave",a))},[]),T.jsx("div",{style:{...Ct},children:T.jsxs("svg",{style:{transition:`opacity ${ht}ms ease`,opacity:`${Me}`},ref:n,"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,children:[T.jsx("g",{strokeWidth:"0"}),T.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("g",{children:T.jsx("path",{clipRule:"evenodd",d:"m9.46967 5.46967c.29289-.29289.76773-.29289 1.06063 0l2.6286 2.62858c.5748.57477 1.0384 1.03835 1.3831 1.44443.355.41812.6278.82432.7818 1.29852.2447.7531.2447 1.5645 0 2.3176-.154.4742-.4268.8804-.7818 1.2985-.3447.4061-.8083.8697-1.3831 1.4444l-2.6286 2.6286c-.2929.2929-.76774.2929-1.06063 0s-.29289-.7677 0-1.0606l2.60593-2.6059c.6027-.6028 1.0225-1.0234 1.3229-1.3773.2947-.3471.4302-.5804.4987-.7912.1469-.4519.1469-.9387 0-1.3906-.0685-.2108-.204-.4441-.4987-.7912-.3004-.3539-.7202-.77451-1.3229-1.37728l-2.60593-2.60589c-.29289-.29289-.29289-.76777 0-1.06066z",fill:t,fillRule:"evenodd"})})})]})})}function je({id:e,toggleRef:t,options:n,showToggle:r=!0,ToggleComponent:a}){var c;const{openSidebar:i,closeSidebar:l,bottomSidebars:s}=Q(),f=((c=s[e])==null?void 0:c.isOpen)??!1;return r?T.jsx("div",{ref:t,style:{...It,transition:`transform ${n.transitionMs}ms ease, opacity ${n.transitionMs}ms ease`,zIndex:n.toggleZIndex},children:(!f||f&&!n.showOverlay)&&T.jsx("button",{type:"button",onClick:()=>{n.disabled||(f?l("bottom",{id:e}):i("bottom",{id:e}))},disabled:n.disabled,style:{marginBottom:`${n.toggleIconEdgeDistancePx}px`,transform:f?"rotate(90deg)":"rotate(-90deg)"},children:a??T.jsx(Te,{size:n.toggleIconSizePx,color:n.toggleIconColor})})}):null}function re(e=ve){const t=`(max-width: ${Math.min(e,ve)}px)`,n=()=>typeof window>"u"||typeof window.matchMedia>"u"?!1:window.matchMedia(t).matches,[r,a]=u.useState(n);return u.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia>"u")return;const i=window.matchMedia(t),l=()=>a(i.matches);return l(),i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[t]),r}const ke=({refs:e,callbacks:t,currentY:n,preventDefault:r,lockPane:a,options:i})=>{if(!e.draggingRef.current)return;const l=n-e.draggingRef.current.startY;if(!e.draggingRef.current.isActivated&&Math.abs(l)>=i.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!e.draggingRef.current.isActivated)return;e.prevYRef.current=e.currentYRef.current,e.currentYRef.current=n;const s=t.getIsOpen(),f=window.innerHeight;let c=!1;if((s||e.draggingRef.current.startY>=f-i.edgeActivationWidthPx)&&(c=!0),!c){e.draggingRef.current=null,t.dragSidebar(null);return}r();const p=i.sidebarHeightPx,w=i.midAnchorPointPx,R=i.midAnchorPoint&&!i.swipeToOpen&&w<p;if(s)if(R){const b=t.getBottomAnchorState();if(b==="open"){const O=Math.max(0,Math.min(p,l-i.dragActivationDeltaPx));t.dragSidebar(O)}else if(b==="midAnchor"){const O=p-w,E=Math.max(0,Math.min(p,O+l-i.dragActivationDeltaPx));t.dragSidebar(E)}}else{const b=Math.max(0,Math.min(p,l-i.dragActivationDeltaPx));t.dragSidebar(b)}else if(e.draggingRef.current.startY>=f-i.edgeActivationWidthPx)if(R){const b=p-w,O=Math.max(b,Math.min(p,p+l+i.dragActivationDeltaPx));t.dragSidebar(O)}else{const b=Math.max(0,Math.min(p,p+l+i.dragActivationDeltaPx));t.dragSidebar(b)}},Ne=({refs:e,callbacks:t,options:n,onDragEnd:r})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null;return}const a=e.currentYRef.current??e.draggingRef.current.startY,i=e.prevYRef.current??e.draggingRef.current.startY,l=e.draggingRef.current.startY,s=t.getIsOpen(),f=window.innerHeight;e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,r();const c=a<i,p=a>=i,w=l>=f-n.edgeActivationWidthPx,R=n.midAnchorPointPx,b=n.sidebarHeightPx,O=n.midAnchorPoint&&!n.swipeToOpen&&R<b;if(s)if(O){const E=t.getBottomAnchorState(),B=b-R;if(E==="open"){const W=Math.max(0,a-l);p?W>B?t.closeSidebar():t.openToMidAnchor():W<B?t.openSidebarFully():t.openToMidAnchor(),t.dragSidebar(null)}else if(E==="midAnchor"){const W=b-R,k=Math.max(0,Math.min(b,W+(a-l)));if(c)k<B?t.openSidebarFully():t.openToMidAnchor();else{const L=(b+W)/2;k>L?t.closeSidebar():t.openToMidAnchor()}t.dragSidebar(null)}}else p?t.closeSidebar():t.openSidebar(),t.dragSidebar(null);else w&&c?(O?t.openToMidAnchor():t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Lt(e,t){var L,N;const n=re(e.mediaQueryWidth),{lockedSidebar:r,setLockedSidebar:a,bottomSidebars:i,openSidebar:l,openSidebarFully:s,closeSidebar:f,dragSidebar:c,openSidebarToMidAnchor:p,activeBottomDragIdRef:w,bottomFocusStackRef:R}=Q(),b=((L=i[t])==null?void 0:L.isOpen)??!1,O=((N=i[t])==null?void 0:N.anchorState)??"closed",E=u.useRef(null),B=u.useRef(null),W=u.useRef(null),k=u.useRef(O);u.useEffect(()=>{k.current=O},[O]),u.useEffect(()=>{if(!n||r==="left"||r==="right"||e.disabled)return;const D={getIsOpen:()=>b,openSidebar:()=>l("bottom",{id:t}),openSidebarFully:()=>s("bottom",{id:t}),closeSidebar:()=>f("bottom",{id:t}),dragSidebar:x=>c("bottom",x,{id:t}),getBottomAnchorState:()=>k.current,openToMidAnchor:()=>p("bottom",{id:t})},M={draggingRef:E,currentYRef:B,prevYRef:W},g=()=>w.current!==null&&w.current!==t,S=()=>{const x=R.current;return x.length===0?!0:x[x.length-1]===t},P=()=>{if(g()){E.current=null;return}w.current=t,a("bottom")},I=()=>{w.current===t&&(w.current=null)};function V(x){if(r==="left"||r==="right"||g()||!S()||se(x.target)||x.changedTouches.length===0)return;const H=x.changedTouches[0],_=window.innerHeight,o=D.getIsOpen(),v=H.clientY>=_-e.edgeActivationWidthPx;o&&!e.swipeToClose||!o&&!e.swipeToOpen||(o||v)&&Be({refs:M,clientX:H.clientX,clientY:H.clientY,touchId:H.identifier,isMouse:!1})}function G(x){if(r==="left"||r==="right")return;if(g()){E.current=null;return}if(!E.current||E.current.isMouse)return;const H=E.current.activeTouchId,_=ye(x.changedTouches,H);_&&ke({refs:M,callbacks:D,currentY:_.clientY,preventDefault:()=>x.preventDefault(),lockPane:P,options:e})}function Z(x){if(r==="left"||r==="right"||!E.current||E.current.isMouse)return;const H=E.current.activeTouchId;xe(x.changedTouches,H)&&Ne({refs:M,callbacks:D,options:e,onDragEnd:I})}function U(){r==="left"||r==="right"||!E.current||E.current.isMouse||(I(),_t({refs:M,dragSidebar:D.dragSidebar,onDeactivate:()=>{}}))}function z(x){if(r==="left"||r==="right"||g()||!S()||se(x.target)||x.button!==0)return;const H=window.innerHeight,_=D.getIsOpen(),o=x.clientY>=H-e.edgeActivationWidthPx;_&&!e.swipeToClose||!_&&!e.swipeToOpen||(_||o)&&Be({refs:M,clientX:x.clientX,clientY:x.clientY,touchId:null,isMouse:!0})}function J(x){if(!(r==="left"||r==="right")){if(g()){E.current=null;return}!E.current||!E.current.isMouse||ke({refs:M,callbacks:D,currentY:x.clientY,preventDefault:()=>x.preventDefault(),lockPane:P,options:e})}}function K(){r==="left"||r==="right"||!E.current||!E.current.isMouse||Ne({refs:M,callbacks:D,options:e,onDragEnd:I})}return window.addEventListener("touchstart",V,{passive:!0}),window.addEventListener("touchmove",G,{passive:!1}),window.addEventListener("touchend",Z,{passive:!0}),window.addEventListener("touchcancel",U,{passive:!0}),window.addEventListener("mousedown",z,{passive:!0}),window.addEventListener("mousemove",J,{passive:!1}),window.addEventListener("mouseup",K,{passive:!0}),()=>{window.removeEventListener("touchstart",V),window.removeEventListener("touchmove",G),window.removeEventListener("touchend",Z),window.removeEventListener("touchcancel",U),window.removeEventListener("mousedown",z),window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",K)}},[t,n,b,l,s,f,c,r,a,e,p,w,R])}function Dt({id:e="primary",className:t,children:n,ToggleComponent:r,...a}){var O;if((n==null?void 0:n.type)===T.Fragment)throw new Error("Fragments is not allowed in SwipeBarBottom");const{bottomSidebars:i,closeSidebar:l,registerBottomSidebar:s,unregisterBottomSidebar:f}=Q(),c=u.useRef(null),p=u.useRef(null);u.useEffect(()=>(s(e,{sidebarRef:c,toggleRef:p}),()=>f(e)),[e,s,f]);const w=Re("bottom",a,e),R=re(w.mediaQueryWidth);Lt(w,e);const b=((O=i[e])==null?void 0:O.isOpen)??!1;return T.jsxs(T.Fragment,{children:[w.showOverlay&&T.jsx(ge,{isCollapsed:!b,setCollapsed:()=>l("bottom",{id:e}),transitionMs:w.transitionMs,overlayBackgroundColor:w.overlayBackgroundColor,overlayZIndex:w.overlayZIndex}),T.jsx(je,{id:e,toggleRef:p,options:w,showToggle:w.showToggle,ToggleComponent:r}),T.jsx("div",{ref:c,style:{...Tt,...Et,...w.isAbsolute||R?At:{},...t?{}:{backgroundColor:pe},zIndex:w.swipeBarZIndex},className:t,children:n})]})}function Fe({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:r,leftToggleRef:a,isLeftOpen:i,closeSidebar:l}=Q();return t?T.jsx("div",{ref:a,style:{...Le,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,left:0,zIndex:e.toggleZIndex},children:(!i||i&&!e.showOverlay)&&T.jsx("button",{type:"button",onClick:()=>{e.disabled||(i?l("left"):r("left"))},disabled:e.disabled,style:{marginLeft:`${e.toggleIconEdgeDistancePx}px`,...i?{transform:"rotate(180deg)"}:{}},children:n??T.jsx(Te,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const He=({refs:e,callbacks:t,currentX:n,preventDefault:r,lockPane:a,options:i})=>{if(!e.draggingRef.current)return;const l=n-e.draggingRef.current.startX;if(!e.draggingRef.current.isActivated&&Math.abs(l)>=i.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!e.draggingRef.current.isActivated)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const s=t.getIsOpen();let f=!1;if((s||e.draggingRef.current.startX<=i.edgeActivationWidthPx)&&(f=!0),!f){e.draggingRef.current=null,t.dragSidebar(null);return}r();const c=i.sidebarWidthPx;if(s){const p=Math.min(0,Math.max(-c,l+i.dragActivationDeltaPx));t.dragSidebar(p)}else if(e.draggingRef.current.startX<=i.edgeActivationWidthPx){const p=Math.min(0,Math.max(-c,-c+l-i.dragActivationDeltaPx));t.dragSidebar(p)}},Ge=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const r=e.currentXRef.current??e.draggingRef.current.startX,a=e.prevXRef.current??e.draggingRef.current.startX,i=e.draggingRef.current.startX,l=t.getIsOpen();e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const s=r>=a,f=r<a,c=i<=n.edgeActivationWidthPx;l?(f?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):c&&s?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Xt(e){const t=re(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:r,isLeftOpen:a,openSidebar:i,closeSidebar:l,dragSidebar:s,leftSidebarRef:f}=Q(),c=u.useRef(null),p=u.useRef(null),w=u.useRef(null);u.useEffect(()=>{if(!t||n==="right"||e.disabled)return;const R={getIsOpen:()=>a,openSidebar:()=>i("left"),closeSidebar:()=>l("left"),dragSidebar:g=>s("left",g)},b={draggingRef:c,currentXRef:p,prevXRef:w},O=()=>r("left"),E=()=>r(null);function B(g){if(n==="right"||se(g.target)||g.changedTouches.length===0)return;const S=g.changedTouches[0],P=R.getIsOpen(),I=S.clientX<=e.edgeActivationWidthPx;P&&!e.swipeToClose||!P&&!e.swipeToOpen||(P||I)&&fe({refs:b,clientX:S.clientX,clientY:S.clientY,touchId:S.identifier,isMouse:!1})}function W(g){if(n==="right"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId,P=ye(g.changedTouches,S);P&&He({refs:b,callbacks:R,currentX:P.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e})}function k(g){if(n==="right"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId;xe(g.changedTouches,S)&&Ge({refs:b,callbacks:R,options:e})}function L(){n!=="right"&&(!c.current||c.current.isMouse||We({refs:b,dragSidebar:R.dragSidebar,onDeactivate:E}))}function N(g){if(n==="right"||se(g.target)||g.button!==0)return;const S=R.getIsOpen(),P=g.clientX<=e.edgeActivationWidthPx;S&&!e.swipeToClose||!S&&!e.swipeToOpen||(S||P)&&fe({refs:b,clientX:g.clientX,clientY:g.clientY,touchId:null,isMouse:!0})}function D(g){n!=="right"&&(!c.current||!c.current.isMouse||He({refs:b,callbacks:R,currentX:g.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e}))}function M(){n!=="right"&&(!c.current||!c.current.isMouse||Ge({refs:b,callbacks:R,options:e}))}return window.addEventListener("touchstart",B,{passive:!0}),window.addEventListener("touchmove",W,{passive:!1}),window.addEventListener("touchend",k,{passive:!0}),window.addEventListener("touchcancel",L,{passive:!0}),window.addEventListener("mousedown",N,{passive:!0}),window.addEventListener("mousemove",D,{passive:!1}),window.addEventListener("mouseup",M,{passive:!0}),()=>{window.removeEventListener("touchstart",B),window.removeEventListener("touchmove",W),window.removeEventListener("touchend",k),window.removeEventListener("touchcancel",L),window.removeEventListener("mousedown",N),window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",M)}},[t,a,i,l,s,n,r,f,e])}function Yt({className:e,children:t,ToggleComponent:n,...r}){if((t==null?void 0:t.type)===T.Fragment)throw new Error("Fragments is not allowed in SwipeBarLeft");const{isLeftOpen:a,closeSidebar:i,leftSidebarRef:l}=Q(),s=Re("left",r),f=re(s.mediaQueryWidth);return Xt(s),T.jsxs(T.Fragment,{children:[s.showOverlay&&T.jsx(ge,{isCollapsed:!a,setCollapsed:()=>i("left"),transitionMs:s.transitionMs,overlayBackgroundColor:s.overlayBackgroundColor,overlayZIndex:s.overlayZIndex}),T.jsx(Fe,{options:s,showToggle:s.showToggle,ToggleComponent:n}),T.jsx("div",{ref:l,style:{..._e,...St,...s.isAbsolute||f?xt:{},...e?{}:{backgroundColor:pe},zIndex:s.swipeBarZIndex},className:e,children:t})]})}function Ue({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:r,rightToggleRef:a,isRightOpen:i,closeSidebar:l}=Q();return t?T.jsx("div",{ref:a,style:{...Le,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,right:0,zIndex:e.toggleZIndex},children:(!i||i&&!e.showOverlay)&&T.jsx("button",{type:"button",onClick:()=>{e.disabled||(i?l("right"):r("right"))},disabled:e.disabled,style:{marginRight:`${e.toggleIconEdgeDistancePx}px`,...i?{}:{transform:"rotate(180deg)"}},children:n??T.jsx(Te,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const Ze=({refs:e,callbacks:t,currentX:n,preventDefault:r,lockPane:a,options:i})=>{if(!e.draggingRef.current)return;const l=window.innerWidth,s=n-e.draggingRef.current.startX,f=e.draggingRef.current.startX>=l-i.edgeActivationWidthPx,c=e.draggingRef.current.isActivated;if(!c&&Math.abs(s)>=i.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!c)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const p=t.getIsOpen();let w=!1;if((p||f)&&(w=!0),!w){e.draggingRef.current=null,t.dragSidebar(null);return}r();const R=i.sidebarWidthPx;if(p){const b=Math.max(0,Math.min(R,s-i.dragActivationDeltaPx));t.dragSidebar(b)}else{const b=Math.max(0,Math.min(R,R+s+i.dragActivationDeltaPx));t.dragSidebar(b)}},ze=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const r=e.currentXRef.current??e.draggingRef.current.startX,a=e.prevXRef.current??e.draggingRef.current.startX,i=e.draggingRef.current.startX,l=t.getIsOpen(),s=window.innerWidth;e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const f=r>a,c=r<a,p=i>=s-n.edgeActivationWidthPx;l?(f?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):p&&c?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Bt(e){const t=re(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:r,isRightOpen:a,openSidebar:i,closeSidebar:l,dragSidebar:s,rightSidebarRef:f}=Q(),c=u.useRef(null),p=u.useRef(null),w=u.useRef(null);u.useEffect(()=>{if(!t||n==="left"||e.disabled)return;const R={getIsOpen:()=>a,openSidebar:()=>i("right"),closeSidebar:()=>l("right"),dragSidebar:g=>s("right",g)},b={draggingRef:c,currentXRef:p,prevXRef:w},O=()=>r("right"),E=()=>r(null);function B(g){if(n==="left"||se(g.target)||g.changedTouches.length===0)return;const S=g.changedTouches[0],P=window.innerWidth,I=R.getIsOpen(),V=S.clientX>=P-e.edgeActivationWidthPx;I&&!e.swipeToClose||!I&&!e.swipeToOpen||(I||V)&&fe({refs:b,clientX:S.clientX,clientY:S.clientY,touchId:S.identifier,isMouse:!1})}function W(g){if(n==="left"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId,P=ye(g.changedTouches,S);P&&Ze({refs:b,callbacks:R,currentX:P.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e})}function k(g){if(n==="left"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId;xe(g.changedTouches,S)&&ze({refs:b,callbacks:R,options:e})}function L(){n!=="left"&&(!c.current||c.current.isMouse||We({refs:b,dragSidebar:R.dragSidebar,onDeactivate:E}))}function N(g){if(n==="left"||se(g.target)||g.button!==0)return;const S=window.innerWidth,P=R.getIsOpen(),I=g.clientX>=S-e.edgeActivationWidthPx;P&&!e.swipeToClose||!P&&!e.swipeToOpen||(P||I)&&fe({refs:b,clientX:g.clientX,clientY:g.clientY,touchId:null,isMouse:!0})}function D(g){n!=="left"&&(!c.current||!c.current.isMouse||Ze({refs:b,callbacks:R,currentX:g.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e}))}function M(){n!=="left"&&(!c.current||!c.current.isMouse||ze({refs:b,callbacks:R,options:e}))}return window.addEventListener("touchstart",B,{passive:!0}),window.addEventListener("touchmove",W,{passive:!1}),window.addEventListener("touchend",k,{passive:!0}),window.addEventListener("touchcancel",L,{passive:!0}),window.addEventListener("mousedown",N,{passive:!0}),window.addEventListener("mousemove",D,{passive:!1}),window.addEventListener("mouseup",M,{passive:!0}),()=>{window.removeEventListener("touchstart",B),window.removeEventListener("touchmove",W),window.removeEventListener("touchend",k),window.removeEventListener("touchcancel",L),window.removeEventListener("mousedown",N),window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",M)}},[t,a,i,l,s,n,r,f,e])}function Wt({className:e,children:t,ToggleComponent:n,...r}){if((t==null?void 0:t.type)===T.Fragment)throw new Error("Fragments is not allowed in SwipeBarRight");const{isRightOpen:a,closeSidebar:i,rightSidebarRef:l}=Q(),s=Re("right",r),f=re(s.mediaQueryWidth);return Bt(s),T.jsxs(T.Fragment,{children:[s.showOverlay&&T.jsx(ge,{isCollapsed:!a,setCollapsed:()=>i("right"),transitionMs:s.transitionMs,overlayBackgroundColor:s.overlayBackgroundColor,overlayZIndex:s.overlayZIndex}),T.jsx(Ue,{options:s,showToggle:s.showToggle,ToggleComponent:n}),T.jsx("div",{ref:l,style:{..._e,...yt,...s.isAbsolute||f?Rt:{},...e?{}:{backgroundColor:pe},zIndex:s.swipeBarZIndex},className:e,children:t})]})}F.Overlay=ge,F.SwipeBarBottom=Dt,F.SwipeBarLeft=Yt,F.SwipeBarProvider=et,F.SwipeBarRight=Wt,F.ToggleBottom=je,F.ToggleLeft=Fe,F.ToggleRight=Ue,F.useMediaQuery=re,F.useSwipeBarContext=Q,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
<%s key={someKey} {...props} />`,X,Y,te,Y),_[Y+X]=!0)}if(Y=null,C!==void 0&&(n(C),Y=""+C),u(v)&&(n(v.key),Y=""+v.key),"key"in v){C={};for(var de in v)de!=="key"&&(C[de]=v[de])}else C=v;return Y&&s(C,typeof o=="function"?o.displayName||o.name||"Unknown":o),c(o,Y,C,a(),ie,$)}function w(o){R(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===P&&(o._payload.status==="fulfilled"?R(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function R(o){return typeof o=="object"&&o!==null&&o.$$typeof===O}var b=l,O=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),G=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,U=Array.isArray,z=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(o){return o()}};var J,K={},x=b.react_stack_bottom_frame.bind(b,i)(),H=z(r(i)),_={};ue.Fragment=B,ue.jsx=function(o,v,C){var X=1e4>G.recentlyCreatedOwnerStacks++;return p(o,v,C,!1,X?Error("react-stack-top-frame"):x,X?z(r(o)):H)},ue.jsxs=function(o,v,C){var X=1e4>G.recentlyCreatedOwnerStacks++;return p(o,v,C,!0,X?Error("react-stack-top-frame"):x,X?z(r(o)):H)}}()),ue}process.env.NODE_ENV==="production"?he.exports=$e():he.exports=qe();var T=he.exports;const Pe=l.createContext(null),me=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},be={isOpen:!1,anchorState:"closed"},et=({children:e,sidebarWidthPx:t,transitionMs:n,edgeActivationWidthPx:r,dragActivationDeltaPx:a,showOverlay:i,isAbsolute:u,overlayBackgroundColor:s,toggleIconColor:f,toggleIconSizePx:c,toggleIconEdgeDistancePx:p,showToggle:w,mediaQueryWidth:R,swipeBarZIndex:b,toggleZIndex:O,overlayZIndex:E,fadeContent:B,fadeContentTransitionMs:W})=>{var Ve,Je;const[k,L]=l.useState(null),[N,D]=l.useState(!1),[M,g]=l.useState(!1),[S,P]=l.useState({}),[I,V]=l.useState({}),G=l.useRef(null),Z=l.useRef(null),U=l.useRef(null),z=l.useRef(null),[J,K]=l.useState({}),[x,H]=l.useState({}),_=l.useRef(new Map),o=l.useRef(null),v=l.useRef([]),C=((Ve=J.primary)==null?void 0:Ve.isOpen)??!1,X=((Je=J.primary)==null?void 0:Je.anchorState)??"closed",ie=l.useMemo(()=>Object.values(J).some(d=>d.isOpen),[J]),$=_.current.get("primary"),Y=($==null?void 0:$.sidebarRef)??{current:null},te=($==null?void 0:$.toggleRef)??{current:null},de=x.primary??{},[Ee,jt]=l.useState({sidebarWidthPx:t??it,sidebarHeightPx:Ie,transitionMs:n??tt,edgeActivationWidthPx:r??nt,dragActivationDeltaPx:a??rt,showOverlay:i??ot,isAbsolute:u??at,overlayBackgroundColor:s??Ce,toggleIconColor:f??st,toggleIconSizePx:c??ct,toggleIconEdgeDistancePx:p??ut,showToggle:w??lt,mediaQueryWidth:R??ve,swipeBarZIndex:b??dt,toggleZIndex:O??ft,overlayZIndex:E??gt,fadeContent:B??bt,fadeContentTransitionMs:W??mt,swipeToOpen:pt,swipeToClose:vt,midAnchorPoint:wt,midAnchorPointPx:Ie/3,disabled:!1}),kt=l.useCallback((d,h)=>{_.current.set(d,h),K(m=>m[d]?m:{...m,[d]:{...be}})},[]),Nt=l.useCallback(d=>{_.current.delete(d),K(h=>{const m={...h};return delete m[d],m}),H(h=>{const m={...h};return delete m[d],m})},[]),Ft=l.useCallback(d=>_.current.get(d),[]),Ht=l.useCallback((d,h)=>{H(m=>m[d]===h?m:{...m,[d]:h})},[]),q=l.useCallback((d,h)=>{K(m=>{const y=m[d]??be;return y.isOpen===h?m:{...m,[d]:{...y,isOpen:h}}})},[]),ee=l.useCallback((d,h)=>{K(m=>{const y=m[d]??be;return y.anchorState===h?m:{...m,[d]:{...y,anchorState:h}}})},[]);l.useEffect(()=>(N||M||ie?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[N,M,ie]),l.useEffect(()=>{var d;if(S.fadeContent===!1){const h=(d=G.current)==null?void 0:d.firstElementChild;h&&(h.style.opacity="1")}},[S.fadeContent]),l.useEffect(()=>{var d;if(I.fadeContent===!1){const h=(d=Z.current)==null?void 0:d.firstElementChild;h&&(h.style.opacity="1")}},[I.fadeContent]),l.useEffect(()=>{var d;for(const[h,m]of Object.entries(x))if(m.fadeContent===!1){const y=_.current.get(h),A=(d=y==null?void 0:y.sidebarRef.current)==null?void 0:d.firstElementChild;A&&(A.style.opacity="1")}},[x]);const Gt=l.useCallback(d=>{jt(h=>({...h,...d}))},[]),oe=l.useCallback(d=>{const h=v.current,m=h.indexOf(d);m!==-1&&h.splice(m,1),h.push(d),L("bottom")},[]),Qe=l.useCallback(d=>{const h=v.current,m=h.indexOf(d);m!==-1&&h.splice(m,1),K(y=>(Object.entries(y).some(([j,ne])=>j!==d&&ne.isOpen)||L(null),y))},[]),Ut=l.useCallback((d,h)=>{const m=(y,A,j,ne)=>{Se({side:d,ref:y,options:A,toggleRef:j,afterApply:()=>{ne(!0),L(d)}})};if(d==="left"){if(S.disabled)return;m(G,S,U,D)}else if(d==="right"){if(I.disabled)return;m(Z,I,z,g)}else if(d==="bottom"){const y=(h==null?void 0:h.id)??"primary",A=x[y],j=_.current.get(y);if(!A||!j||A.disabled)return;const ne=A.sidebarHeightPx??0,Jt=A.mediaQueryWidth??640,Ke=window.innerWidth<Jt,Kt=Ke?A.midAnchorPointPx??0:ne;Ke&&A.midAnchorPoint&&!A.swipeToOpen&&Kt<ne?Xe({ref:j.sidebarRef,options:A,toggleRef:j.toggleRef,afterApply:()=>{q(y,!0),ee(y,"midAnchor"),oe(y)}}):Se({side:d,ref:j.sidebarRef,options:A,toggleRef:j.toggleRef,afterApply:()=>{q(y,!0),ee(y,"open"),oe(y)}})}else me(d)},[S,I,x,q,ee,oe]),Zt=l.useCallback((d,h)=>{if(d!=="bottom")return;const m=(h==null?void 0:h.id)??"primary",y=x[m],A=_.current.get(m);!y||!A||y.disabled||Xe({ref:A.sidebarRef,options:y,toggleRef:A.toggleRef,afterApply:()=>{q(m,!0),ee(m,"midAnchor"),oe(m)}})},[x,q,ee,oe]),zt=l.useCallback((d,h)=>{if(d!=="bottom")return;const m=(h==null?void 0:h.id)??"primary",y=x[m],A=_.current.get(m);!y||!A||y.disabled||Se({side:d,ref:A.sidebarRef,options:y,toggleRef:A.toggleRef,afterApply:()=>{q(m,!0),ee(m,"open"),oe(m)}})},[x,q,ee,oe]),Qt=l.useCallback((d,h)=>{const m=(y,A,j,ne)=>{De({ref:y,options:A,toggleRef:j,side:d,afterApply:()=>{ne(!1),L(null)}})};if(d==="left"){if(S.disabled)return;m(G,S,U,D)}else if(d==="right"){if(I.disabled)return;m(Z,I,z,g)}else if(d==="bottom"){const y=(h==null?void 0:h.id)??"primary",A=x[y],j=_.current.get(y);if(!A||!j||A.disabled)return;De({ref:j.sidebarRef,options:A,toggleRef:j.toggleRef,side:d,afterApply:()=>{q(y,!1),ee(y,"closed"),Qe(y)}})}else me(d)},[S,I,x,q,ee,Qe]),Vt=l.useCallback((d,h,m)=>{if(d==="left")Ye({ref:G,toggleRef:U,options:S,translateX:h});else if(d==="right")Ye({ref:Z,toggleRef:z,options:I,translateX:h});else if(d==="bottom"){const y=(m==null?void 0:m.id)??"primary",A=x[y],j=_.current.get(y);if(!A||!j)return;Mt({ref:j.sidebarRef,toggleRef:j.toggleRef,options:A,translateY:h})}else me(d)},[S,I,x]);return T.jsx(Pe.Provider,{value:{lockedSidebar:k,setLockedSidebar:L,leftSidebarRef:G,rightSidebarRef:Z,isLeftOpen:N,isRightOpen:M,isBottomOpen:C,bottomAnchorState:X,bottomSidebarRef:Y,bottomToggleRef:te,bottomSidebarOptions:de,bottomSidebars:J,bottomSidebarOptionsMap:x,registerBottomSidebar:kt,unregisterBottomSidebar:Nt,getBottomSidebarRefs:Ft,activeBottomDragIdRef:o,bottomFocusStackRef:v,openSidebar:Ut,openSidebarFully:zt,openSidebarToMidAnchor:Zt,closeSidebar:Qt,dragSidebar:Vt,globalOptions:Ee,setGlobalOptions:Gt,leftSidebarOptions:S,rightSidebarOptions:I,setLeftSidebarOptions:P,setRightSidebarOptions:V,setBottomSidebarOptionsById:Ht,leftToggleRef:U,rightToggleRef:z},children:e})},Q=()=>{const e=l.useContext(Pe);if(!e)throw new Error("useSwipeBarContext must be used within SwipeBarProvider");return e},tt=300,nt=40,rt=20,it=320,Ie=window.innerHeight,ot=!0,at=!1,Ce="rgba(0, 0, 0, 0.5)",pe="rgb(36,36,36)",st="white",ct=40,ut=40,lt=!0,ve=640,dt=30,ft=15,gt=20,Me=.6,ht=200,mt=100,bt=!1,pt=!0,vt=!0,wt=!1,ae="cubic-bezier(0.22, 1, 0.36, 1)",_e={width:0,top:0,bottom:0,flexShrink:0,overflowX:"hidden",willChange:"transform"},St={transform:"translateX(-100%)"},yt={transform:"translateX(100%)"},xt={position:"fixed",left:0,top:0,bottom:0},Rt={position:"fixed",right:0,top:0,bottom:0},Tt={height:0,left:0,right:0,flexShrink:0,overflowY:"hidden",willChange:"transform"},Et={transform:"translateY(100%)"},At={position:"fixed",bottom:0,left:0,right:0},Ot={position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:Ce,transitionProperty:"opacity",pointerEvents:"none",opacity:0},Pt={opacity:1,pointerEvents:"auto"},Le={position:"fixed",top:"50%",transform:"translateY(-50%)",width:"1px",display:"flex",justifyContent:"center"},It={position:"fixed",bottom:0,left:"50%",transform:"translateX(-50%)",height:"1px",display:"flex",alignItems:"center"},Ct={position:"relative",cursor:"pointer",display:"flex",height:"72px",alignItems:"center",justifyContent:"center"},we=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},le=e=>{var t;return(t=e.current)==null?void 0:t.firstElementChild},Se=({ref:e,side:t,options:n,toggleRef:r,afterApply:a})=>{const i=le(e),u=n.transitionMs?n.transitionMs/2:0;i&&n.fadeContent&&(i.style.opacity="0");let s,f;t==="left"||t==="right"?(s="width",f=n.sidebarWidthPx,i&&f&&(i.style.minWidth=`${f}px`)):t==="bottom"?(s="height",f=n.sidebarHeightPx,i&&f&&(i.style.minHeight=`${f}px`)):we(t),requestAnimationFrame(()=>{if(!e.current)return;const c=`transform ${n.transitionMs}ms ${ae}`,p=n.isAbsolute?"":`, ${s} ${n.transitionMs}ms ${ae}`;e.current.style.transition=`${c}${p}`,i&&n.fadeContent&&(i.style.transition=`opacity ${n.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(e.current){if(e.current.style.transform=t==="bottom"?"translateY(0px)":"translateX(0px)",!n.isAbsolute)e.current.style[s]=`${f}px`;else if(e.current.style[s]!==`${f}px`){const w=e.current.style.transition;e.current.style.transition=c,e.current.style[s]=`${f}px`,e.current.style.transition=w}r.current&&f&&(r.current.style.opacity="1",t==="left"?r.current.style.transform=`translateY(-50%) translateX(${f}px)`:t==="right"?r.current.style.transform=`translateY(-50%) translateX(-${f}px)`:t==="bottom"&&(r.current.style.transform=`translateX(-50%) translateY(-${f}px)`)),i&&n.fadeContent&&setTimeout(()=>{i.style.opacity="1"},u),a()}})}),setTimeout(()=>{},0)},De=({ref:e,options:t,side:n,toggleRef:r,afterApply:a})=>{const i=le(e);let u;n==="left"||n==="right"?(u="width",i&&t.sidebarWidthPx&&(i.style.minWidth=`${t.sidebarWidthPx}px`)):n==="bottom"?(u="height",i&&t.sidebarHeightPx&&(i.style.minHeight=`${t.sidebarHeightPx}px`)):we(n),requestAnimationFrame(()=>{if(!e.current)return;const s=`transform ${t.transitionMs}ms ${ae}`,f=t.isAbsolute?"":`, ${u} ${t.transitionMs}ms ${ae}`;e.current.style.transition=`${s}${f}`,i&&t.fadeContent&&(i.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{e.current&&(n==="left"?(e.current.style.transform="translateX(-100%)",t.isAbsolute||(e.current.style.width="0px")):n==="right"?(e.current.style.transform="translateX(100%)",t.isAbsolute||(e.current.style.width="0px")):n==="bottom"&&(e.current.style.transform="translateY(100%)",t.isAbsolute||(e.current.style.height="0px")),r.current&&(r.current.style.opacity="1",n==="left"||n==="right"?r.current.style.transform="translateY(-50%)":n==="bottom"&&(r.current.style.transform="translateX(-50%)")),i&&t.fadeContent&&(i.style.opacity="0"),a())})})},Xe=({ref:e,options:t,toggleRef:n,afterApply:r})=>{const a=le(e),i=t.transitionMs?t.transitionMs/2:0;a&&t.fadeContent&&(a.style.opacity="0"),a&&t.midAnchorPointPx&&(a.style.minHeight=`${t.sidebarHeightPx}px`),requestAnimationFrame(()=>{if(!e.current)return;const u=`transform ${t.transitionMs}ms ${ae}`,s=t.isAbsolute?"":`, height ${t.transitionMs}ms ${ae}`;e.current.style.transition=`${u}${s}`,a&&t.fadeContent&&(a.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(!e.current)return;const f=t.midAnchorPointPx??0,c=t.sidebarHeightPx??0,p=c-f;if(e.current.style.transform=`translateY(${p}px)`,!t.isAbsolute)e.current.style.height=`${c}px`;else if(e.current.style.height!==`${c}px`){const w=e.current.style.transition;e.current.style.transition=u,e.current.style.height=`${c}px`,e.current.style.transition=w}n.current&&(n.current.style.opacity="1",n.current.style.transform=`translateX(-50%) translateY(-${f}px)`),a&&t.fadeContent&&setTimeout(()=>{a.style.opacity="1"},i),r()})}),setTimeout(()=>{},0)},Ye=({ref:e,toggleRef:t,options:n,translateX:r})=>{!e.current||r===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const a=le(e);if(e.current){if(a&&n.fadeContent&&(a.style.opacity="0"),a&&n.sidebarWidthPx&&(a.style.minWidth=`${n.sidebarWidthPx}px`),!n.isAbsolute){const i=`${n.sidebarWidthPx}px`;e.current.style.width!==i&&(e.current.style.width=i)}e.current.style.transform=`translateX(${r}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateY(-50%) translateX(${r}px)`)}}))},Mt=({ref:e,toggleRef:t,options:n,translateY:r})=>{!e.current||r===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const a=le(e);if(e.current){if(a&&n.fadeContent&&(a.style.opacity="0"),a&&n.sidebarHeightPx&&(a.style.minHeight=`${n.sidebarHeightPx}px`),!n.isAbsolute){const i=`${n.sidebarHeightPx}px`;e.current.style.height!==i&&(e.current.style.height=i)}e.current.style.transform=`translateY(${r}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateX(-50%) translateY(${r}px)`)}}))},fe=({refs:e,clientX:t,clientY:n,touchId:r,isMouse:a})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:r,isMouse:a,isActivated:!1},e.currentXRef.current=t,e.prevXRef.current=t},Be=({refs:e,clientX:t,clientY:n,touchId:r,isMouse:a})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:r,isMouse:a,isActivated:!1},e.currentYRef.current=n,e.prevYRef.current=n},We=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null,t(null),n()},_t=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,t(null)},se=e=>e instanceof Element?!!e.closest("input, textarea, [contenteditable='true']"):!1,ye=(e,t)=>{for(let n=0;n<e.length;n++){const r=e[n];if(t==null||r.identifier===t)return r}return null},xe=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n].identifier===t)return!0;return!1},Re=(e,t,n)=>{const{globalOptions:r,setLeftSidebarOptions:a,setRightSidebarOptions:i,setBottomSidebarOptionsById:u}=Q(),{sidebarWidthPx:s,sidebarHeightPx:f,transitionMs:c,edgeActivationWidthPx:p,dragActivationDeltaPx:w,showOverlay:R,isAbsolute:b,overlayBackgroundColor:O,toggleIconColor:E,toggleIconSizePx:B,toggleIconEdgeDistancePx:W,showToggle:k,mediaQueryWidth:L,swipeBarZIndex:N,toggleZIndex:D,overlayZIndex:M,fadeContent:g,fadeContentTransitionMs:S,swipeToOpen:P,swipeToClose:I,midAnchorPoint:V,midAnchorPointPx:G,disabled:Z}=t,U=l.useMemo(()=>{const z=f??r.sidebarHeightPx;return{sidebarWidthPx:s??r.sidebarWidthPx,sidebarHeightPx:z,transitionMs:c??r.transitionMs,edgeActivationWidthPx:p??r.edgeActivationWidthPx,dragActivationDeltaPx:w??r.dragActivationDeltaPx,showOverlay:R??r.showOverlay,isAbsolute:b??r.isAbsolute,overlayBackgroundColor:O??r.overlayBackgroundColor,toggleIconColor:E??r.toggleIconColor,toggleIconSizePx:B??r.toggleIconSizePx,toggleIconEdgeDistancePx:W??r.toggleIconEdgeDistancePx,showToggle:k??r.showToggle,mediaQueryWidth:L??r.mediaQueryWidth,swipeBarZIndex:N??r.swipeBarZIndex,toggleZIndex:D??r.toggleZIndex,overlayZIndex:M??r.overlayZIndex,fadeContent:g??r.fadeContent,fadeContentTransitionMs:S??r.fadeContentTransitionMs,swipeToOpen:P??r.swipeToOpen,swipeToClose:I??r.swipeToClose,midAnchorPoint:V??r.midAnchorPoint,midAnchorPointPx:G??r.midAnchorPointPx??Math.floor(z/3),disabled:Z??r.disabled}},[s,f,c,p,w,R,b,O,E,B,W,k,r,L,N,D,M,g,S,P,I,V,G,Z]);return l.useEffect(()=>{e==="left"?a(U):e==="right"?i(U):e==="bottom"?u(n??"primary",U):we(e)},[e,n,U,a,i,u]),U};function ge({isCollapsed:e,setCollapsed:t,closeSidebarOnClick:n=!0,transitionMs:r,overlayBackgroundColor:a,overlayZIndex:i}){return T.jsx("div",{style:{transitionDuration:`${r}ms`,...Ot,...e?{}:Pt,...a?{backgroundColor:a}:{},zIndex:i},onMouseDown:u=>{n&&(u.stopPropagation(),t())}})}function Te({size:e,color:t}){const n=l.useRef(null);return l.useEffect(()=>{const r=()=>{n.current&&(n.current.style.opacity="1")},a=()=>{n.current&&(n.current.style.opacity=`${Me}`)};n.current&&(n.current.addEventListener("mouseenter",r),n.current.addEventListener("mouseleave",a))},[]),T.jsx("div",{style:{...Ct},children:T.jsxs("svg",{style:{transition:`opacity ${ht}ms ease`,opacity:`${Me}`},ref:n,"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,children:[T.jsx("g",{strokeWidth:"0"}),T.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("g",{children:T.jsx("path",{clipRule:"evenodd",d:"m9.46967 5.46967c.29289-.29289.76773-.29289 1.06063 0l2.6286 2.62858c.5748.57477 1.0384 1.03835 1.3831 1.44443.355.41812.6278.82432.7818 1.29852.2447.7531.2447 1.5645 0 2.3176-.154.4742-.4268.8804-.7818 1.2985-.3447.4061-.8083.8697-1.3831 1.4444l-2.6286 2.6286c-.2929.2929-.76774.2929-1.06063 0s-.29289-.7677 0-1.0606l2.60593-2.6059c.6027-.6028 1.0225-1.0234 1.3229-1.3773.2947-.3471.4302-.5804.4987-.7912.1469-.4519.1469-.9387 0-1.3906-.0685-.2108-.204-.4441-.4987-.7912-.3004-.3539-.7202-.77451-1.3229-1.37728l-2.60593-2.60589c-.29289-.29289-.29289-.76777 0-1.06066z",fill:t,fillRule:"evenodd"})})})]})})}function je({id:e,toggleRef:t,options:n,showToggle:r=!0,ToggleComponent:a}){var c;const{openSidebar:i,closeSidebar:u,bottomSidebars:s}=Q(),f=((c=s[e])==null?void 0:c.isOpen)??!1;return r?T.jsx("div",{ref:t,style:{...It,transition:`transform ${n.transitionMs}ms ease, opacity ${n.transitionMs}ms ease`,zIndex:n.toggleZIndex},children:(!f||f&&!n.showOverlay)&&T.jsx("button",{type:"button",onClick:()=>{n.disabled||(f?u("bottom",{id:e}):i("bottom",{id:e}))},disabled:n.disabled,style:{marginBottom:`${n.toggleIconEdgeDistancePx}px`,transform:f?"rotate(90deg)":"rotate(-90deg)"},children:a??T.jsx(Te,{size:n.toggleIconSizePx,color:n.toggleIconColor})})}):null}function re(e=ve){const t=`(max-width: ${Math.min(e,ve)}px)`,n=()=>typeof window>"u"||typeof window.matchMedia>"u"?!1:window.matchMedia(t).matches,[r,a]=l.useState(n);return l.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia>"u")return;const i=window.matchMedia(t),u=()=>a(i.matches);return u(),i.addEventListener("change",u),()=>i.removeEventListener("change",u)},[t]),r}const ke=({refs:e,callbacks:t,currentY:n,preventDefault:r,lockPane:a,options:i})=>{if(!e.draggingRef.current)return;const u=n-e.draggingRef.current.startY;if(!e.draggingRef.current.isActivated&&Math.abs(u)>=i.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!e.draggingRef.current.isActivated)return;e.prevYRef.current=e.currentYRef.current,e.currentYRef.current=n;const s=t.getIsOpen(),f=window.innerHeight;let c=!1;if((s||e.draggingRef.current.startY>=f-i.edgeActivationWidthPx)&&(c=!0),!c){e.draggingRef.current=null,t.dragSidebar(null);return}r();const p=i.sidebarHeightPx,w=i.midAnchorPointPx,R=i.midAnchorPoint&&!i.swipeToOpen&&w<p;if(s)if(R){const b=t.getBottomAnchorState();if(b==="open"){const O=Math.max(0,Math.min(p,u-i.dragActivationDeltaPx));t.dragSidebar(O)}else if(b==="midAnchor"){const O=p-w,E=Math.max(0,Math.min(p,O+u-i.dragActivationDeltaPx));t.dragSidebar(E)}}else{const b=Math.max(0,Math.min(p,u-i.dragActivationDeltaPx));t.dragSidebar(b)}else if(e.draggingRef.current.startY>=f-i.edgeActivationWidthPx)if(R){const b=p-w,O=Math.max(b,Math.min(p,p+u+i.dragActivationDeltaPx));t.dragSidebar(O)}else{const b=Math.max(0,Math.min(p,p+u+i.dragActivationDeltaPx));t.dragSidebar(b)}},Ne=({refs:e,callbacks:t,options:n,onDragEnd:r})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null;return}const a=e.currentYRef.current??e.draggingRef.current.startY,i=e.prevYRef.current??e.draggingRef.current.startY,u=e.draggingRef.current.startY,s=t.getIsOpen(),f=window.innerHeight;e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,r();const c=a<i,p=a>=i,w=u>=f-n.edgeActivationWidthPx,R=n.midAnchorPointPx,b=n.sidebarHeightPx,O=n.midAnchorPoint&&!n.swipeToOpen&&R<b;if(s)if(O){const E=t.getBottomAnchorState(),B=b-R;if(E==="open"){const W=Math.max(0,a-u);p?W>B?t.closeSidebar():t.openToMidAnchor():W<B?t.openSidebarFully():t.openToMidAnchor(),t.dragSidebar(null)}else if(E==="midAnchor"){const W=b-R,k=Math.max(0,Math.min(b,W+(a-u)));if(c)k<B?t.openSidebarFully():t.openToMidAnchor();else{const L=(b+W)/2;k>L?t.closeSidebar():t.openToMidAnchor()}t.dragSidebar(null)}}else p?t.closeSidebar():t.openSidebar(),t.dragSidebar(null);else w&&c?(O?t.openToMidAnchor():t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Lt(e,t){var L,N;const n=re(e.mediaQueryWidth),{lockedSidebar:r,setLockedSidebar:a,bottomSidebars:i,openSidebar:u,openSidebarFully:s,closeSidebar:f,dragSidebar:c,openSidebarToMidAnchor:p,activeBottomDragIdRef:w,bottomFocusStackRef:R}=Q(),b=((L=i[t])==null?void 0:L.isOpen)??!1,O=((N=i[t])==null?void 0:N.anchorState)??"closed",E=l.useRef(null),B=l.useRef(null),W=l.useRef(null),k=l.useRef(O);l.useEffect(()=>{k.current=O},[O]),l.useEffect(()=>{if(!n||r&&r!=="bottom"||e.disabled)return;const D={getIsOpen:()=>b,openSidebar:()=>u("bottom",{id:t}),openSidebarFully:()=>s("bottom",{id:t}),closeSidebar:()=>f("bottom",{id:t}),dragSidebar:x=>c("bottom",x,{id:t}),getBottomAnchorState:()=>k.current,openToMidAnchor:()=>p("bottom",{id:t})},M={draggingRef:E,currentYRef:B,prevYRef:W},g=()=>w.current!==null&&w.current!==t,S=()=>{const x=R.current;return x.length===0?!0:x[x.length-1]===t},P=()=>{if(g()){E.current=null;return}w.current=t,a("bottom")},I=()=>{w.current===t&&(w.current=null)};function V(x){if(r&&r!=="bottom"||g()||!S()||se(x.target)||x.changedTouches.length===0)return;const H=x.changedTouches[0],_=window.innerHeight,o=D.getIsOpen(),v=H.clientY>=_-e.edgeActivationWidthPx;o&&!e.swipeToClose||!o&&!e.swipeToOpen||(o||v)&&Be({refs:M,clientX:H.clientX,clientY:H.clientY,touchId:H.identifier,isMouse:!1})}function G(x){if(r&&r!=="bottom")return;if(g()){E.current=null;return}if(!E.current||E.current.isMouse)return;const H=E.current.activeTouchId,_=ye(x.changedTouches,H);_&&ke({refs:M,callbacks:D,currentY:_.clientY,preventDefault:()=>x.preventDefault(),lockPane:P,options:e})}function Z(x){if(r&&r!=="bottom"||!E.current||E.current.isMouse)return;const H=E.current.activeTouchId;xe(x.changedTouches,H)&&Ne({refs:M,callbacks:D,options:e,onDragEnd:I})}function U(){r&&r!=="bottom"||!E.current||E.current.isMouse||(I(),_t({refs:M,dragSidebar:D.dragSidebar,onDeactivate:()=>{}}))}function z(x){if(r&&r!=="bottom"||g()||!S()||se(x.target)||x.button!==0)return;const H=window.innerHeight,_=D.getIsOpen(),o=x.clientY>=H-e.edgeActivationWidthPx;_&&!e.swipeToClose||!_&&!e.swipeToOpen||(_||o)&&Be({refs:M,clientX:x.clientX,clientY:x.clientY,touchId:null,isMouse:!0})}function J(x){if(!(r&&r!=="bottom")){if(g()){E.current=null;return}!E.current||!E.current.isMouse||ke({refs:M,callbacks:D,currentY:x.clientY,preventDefault:()=>x.preventDefault(),lockPane:P,options:e})}}function K(){r&&r!=="bottom"||!E.current||!E.current.isMouse||Ne({refs:M,callbacks:D,options:e,onDragEnd:I})}return window.addEventListener("touchstart",V,{passive:!0}),window.addEventListener("touchmove",G,{passive:!1}),window.addEventListener("touchend",Z,{passive:!0}),window.addEventListener("touchcancel",U,{passive:!0}),window.addEventListener("mousedown",z,{passive:!0}),window.addEventListener("mousemove",J,{passive:!1}),window.addEventListener("mouseup",K,{passive:!0}),()=>{window.removeEventListener("touchstart",V),window.removeEventListener("touchmove",G),window.removeEventListener("touchend",Z),window.removeEventListener("touchcancel",U),window.removeEventListener("mousedown",z),window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",K)}},[t,n,b,u,s,f,c,r,a,e,p,w,R])}function Dt({id:e="primary",className:t,children:n,ToggleComponent:r,...a}){var O;if((n==null?void 0:n.type)===T.Fragment)throw new Error("Fragments is not allowed in SwipeBarBottom");const{bottomSidebars:i,closeSidebar:u,registerBottomSidebar:s,unregisterBottomSidebar:f}=Q(),c=l.useRef(null),p=l.useRef(null);l.useEffect(()=>(s(e,{sidebarRef:c,toggleRef:p}),()=>f(e)),[e,s,f]);const w=Re("bottom",a,e),R=re(w.mediaQueryWidth);Lt(w,e);const b=((O=i[e])==null?void 0:O.isOpen)??!1;return T.jsxs(T.Fragment,{children:[w.showOverlay&&T.jsx(ge,{isCollapsed:!b,setCollapsed:()=>u("bottom",{id:e}),transitionMs:w.transitionMs,overlayBackgroundColor:w.overlayBackgroundColor,overlayZIndex:w.overlayZIndex}),T.jsx(je,{id:e,toggleRef:p,options:w,showToggle:w.showToggle,ToggleComponent:r}),T.jsx("div",{ref:c,style:{...Tt,...Et,...w.isAbsolute||R?At:{},...t?{}:{backgroundColor:pe},zIndex:w.swipeBarZIndex},className:t,children:n})]})}function Fe({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:r,leftToggleRef:a,isLeftOpen:i,closeSidebar:u}=Q();return t?T.jsx("div",{ref:a,style:{...Le,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,left:0,zIndex:e.toggleZIndex},children:(!i||i&&!e.showOverlay)&&T.jsx("button",{type:"button",onClick:()=>{e.disabled||(i?u("left"):r("left"))},disabled:e.disabled,style:{marginLeft:`${e.toggleIconEdgeDistancePx}px`,...i?{transform:"rotate(180deg)"}:{}},children:n??T.jsx(Te,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const He=({refs:e,callbacks:t,currentX:n,preventDefault:r,lockPane:a,options:i})=>{if(!e.draggingRef.current)return;const u=n-e.draggingRef.current.startX;if(!e.draggingRef.current.isActivated&&Math.abs(u)>=i.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!e.draggingRef.current.isActivated)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const s=t.getIsOpen();let f=!1;if((s||e.draggingRef.current.startX<=i.edgeActivationWidthPx)&&(f=!0),!f){e.draggingRef.current=null,t.dragSidebar(null);return}r();const c=i.sidebarWidthPx;if(s){const p=Math.min(0,Math.max(-c,u+i.dragActivationDeltaPx));t.dragSidebar(p)}else if(e.draggingRef.current.startX<=i.edgeActivationWidthPx){const p=Math.min(0,Math.max(-c,-c+u-i.dragActivationDeltaPx));t.dragSidebar(p)}},Ge=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const r=e.currentXRef.current??e.draggingRef.current.startX,a=e.prevXRef.current??e.draggingRef.current.startX,i=e.draggingRef.current.startX,u=t.getIsOpen();e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const s=r>=a,f=r<a,c=i<=n.edgeActivationWidthPx;u?(f?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):c&&s?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Xt(e){const t=re(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:r,isLeftOpen:a,openSidebar:i,closeSidebar:u,dragSidebar:s,leftSidebarRef:f}=Q(),c=l.useRef(null),p=l.useRef(null),w=l.useRef(null);l.useEffect(()=>{if(!t||n&&n!=="left"||e.disabled)return;const R={getIsOpen:()=>a,openSidebar:()=>i("left"),closeSidebar:()=>u("left"),dragSidebar:g=>s("left",g)},b={draggingRef:c,currentXRef:p,prevXRef:w},O=()=>r("left"),E=()=>r(null);function B(g){if(n&&n!=="left"||se(g.target)||g.changedTouches.length===0)return;const S=g.changedTouches[0],P=R.getIsOpen(),I=S.clientX<=e.edgeActivationWidthPx;P&&!e.swipeToClose||!P&&!e.swipeToOpen||(P||I)&&fe({refs:b,clientX:S.clientX,clientY:S.clientY,touchId:S.identifier,isMouse:!1})}function W(g){if(n&&n!=="left"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId,P=ye(g.changedTouches,S);P&&He({refs:b,callbacks:R,currentX:P.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e})}function k(g){if(n&&n!=="left"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId;xe(g.changedTouches,S)&&Ge({refs:b,callbacks:R,options:e})}function L(){n&&n!=="left"||!c.current||c.current.isMouse||We({refs:b,dragSidebar:R.dragSidebar,onDeactivate:E})}function N(g){if(n&&n!=="left"||se(g.target)||g.button!==0)return;const S=R.getIsOpen(),P=g.clientX<=e.edgeActivationWidthPx;S&&!e.swipeToClose||!S&&!e.swipeToOpen||(S||P)&&fe({refs:b,clientX:g.clientX,clientY:g.clientY,touchId:null,isMouse:!0})}function D(g){n&&n!=="left"||!c.current||!c.current.isMouse||He({refs:b,callbacks:R,currentX:g.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e})}function M(){n&&n!=="left"||!c.current||!c.current.isMouse||Ge({refs:b,callbacks:R,options:e})}return window.addEventListener("touchstart",B,{passive:!0}),window.addEventListener("touchmove",W,{passive:!1}),window.addEventListener("touchend",k,{passive:!0}),window.addEventListener("touchcancel",L,{passive:!0}),window.addEventListener("mousedown",N,{passive:!0}),window.addEventListener("mousemove",D,{passive:!1}),window.addEventListener("mouseup",M,{passive:!0}),()=>{window.removeEventListener("touchstart",B),window.removeEventListener("touchmove",W),window.removeEventListener("touchend",k),window.removeEventListener("touchcancel",L),window.removeEventListener("mousedown",N),window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",M)}},[t,a,i,u,s,n,r,f,e])}function Yt({className:e,children:t,ToggleComponent:n,...r}){if((t==null?void 0:t.type)===T.Fragment)throw new Error("Fragments is not allowed in SwipeBarLeft");const{isLeftOpen:a,closeSidebar:i,leftSidebarRef:u}=Q(),s=Re("left",r),f=re(s.mediaQueryWidth);return Xt(s),T.jsxs(T.Fragment,{children:[s.showOverlay&&T.jsx(ge,{isCollapsed:!a,setCollapsed:()=>i("left"),transitionMs:s.transitionMs,overlayBackgroundColor:s.overlayBackgroundColor,overlayZIndex:s.overlayZIndex}),T.jsx(Fe,{options:s,showToggle:s.showToggle,ToggleComponent:n}),T.jsx("div",{ref:u,style:{..._e,...St,...s.isAbsolute||f?xt:{},...e?{}:{backgroundColor:pe},zIndex:s.swipeBarZIndex},className:e,children:t})]})}function Ue({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:r,rightToggleRef:a,isRightOpen:i,closeSidebar:u}=Q();return t?T.jsx("div",{ref:a,style:{...Le,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,right:0,zIndex:e.toggleZIndex},children:(!i||i&&!e.showOverlay)&&T.jsx("button",{type:"button",onClick:()=>{e.disabled||(i?u("right"):r("right"))},disabled:e.disabled,style:{marginRight:`${e.toggleIconEdgeDistancePx}px`,...i?{}:{transform:"rotate(180deg)"}},children:n??T.jsx(Te,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const Ze=({refs:e,callbacks:t,currentX:n,preventDefault:r,lockPane:a,options:i})=>{if(!e.draggingRef.current)return;const u=window.innerWidth,s=n-e.draggingRef.current.startX,f=e.draggingRef.current.startX>=u-i.edgeActivationWidthPx,c=e.draggingRef.current.isActivated;if(!c&&Math.abs(s)>=i.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!c)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const p=t.getIsOpen();let w=!1;if((p||f)&&(w=!0),!w){e.draggingRef.current=null,t.dragSidebar(null);return}r();const R=i.sidebarWidthPx;if(p){const b=Math.max(0,Math.min(R,s-i.dragActivationDeltaPx));t.dragSidebar(b)}else{const b=Math.max(0,Math.min(R,R+s+i.dragActivationDeltaPx));t.dragSidebar(b)}},ze=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const r=e.currentXRef.current??e.draggingRef.current.startX,a=e.prevXRef.current??e.draggingRef.current.startX,i=e.draggingRef.current.startX,u=t.getIsOpen(),s=window.innerWidth;e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const f=r>a,c=r<a,p=i>=s-n.edgeActivationWidthPx;u?(f?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):p&&c?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Bt(e){const t=re(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:r,isRightOpen:a,openSidebar:i,closeSidebar:u,dragSidebar:s,rightSidebarRef:f}=Q(),c=l.useRef(null),p=l.useRef(null),w=l.useRef(null);l.useEffect(()=>{if(!t||n&&n!=="right"||e.disabled)return;const R={getIsOpen:()=>a,openSidebar:()=>i("right"),closeSidebar:()=>u("right"),dragSidebar:g=>s("right",g)},b={draggingRef:c,currentXRef:p,prevXRef:w},O=()=>r("right"),E=()=>r(null);function B(g){if(n&&n!=="right"||se(g.target)||g.changedTouches.length===0)return;const S=g.changedTouches[0],P=window.innerWidth,I=R.getIsOpen(),V=S.clientX>=P-e.edgeActivationWidthPx;I&&!e.swipeToClose||!I&&!e.swipeToOpen||(I||V)&&fe({refs:b,clientX:S.clientX,clientY:S.clientY,touchId:S.identifier,isMouse:!1})}function W(g){if(n&&n!=="right"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId,P=ye(g.changedTouches,S);P&&Ze({refs:b,callbacks:R,currentX:P.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e})}function k(g){if(n&&n!=="right"||!c.current||c.current.isMouse)return;const S=c.current.activeTouchId;xe(g.changedTouches,S)&&ze({refs:b,callbacks:R,options:e})}function L(){n&&n!=="right"||!c.current||c.current.isMouse||We({refs:b,dragSidebar:R.dragSidebar,onDeactivate:E})}function N(g){if(n&&n!=="right"||se(g.target)||g.button!==0)return;const S=window.innerWidth,P=R.getIsOpen(),I=g.clientX>=S-e.edgeActivationWidthPx;P&&!e.swipeToClose||!P&&!e.swipeToOpen||(P||I)&&fe({refs:b,clientX:g.clientX,clientY:g.clientY,touchId:null,isMouse:!0})}function D(g){n&&n!=="right"||!c.current||!c.current.isMouse||Ze({refs:b,callbacks:R,currentX:g.clientX,preventDefault:()=>g.preventDefault(),lockPane:O,options:e})}function M(){n&&n!=="right"||!c.current||!c.current.isMouse||ze({refs:b,callbacks:R,options:e})}return window.addEventListener("touchstart",B,{passive:!0}),window.addEventListener("touchmove",W,{passive:!1}),window.addEventListener("touchend",k,{passive:!0}),window.addEventListener("touchcancel",L,{passive:!0}),window.addEventListener("mousedown",N,{passive:!0}),window.addEventListener("mousemove",D,{passive:!1}),window.addEventListener("mouseup",M,{passive:!0}),()=>{window.removeEventListener("touchstart",B),window.removeEventListener("touchmove",W),window.removeEventListener("touchend",k),window.removeEventListener("touchcancel",L),window.removeEventListener("mousedown",N),window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",M)}},[t,a,i,u,s,n,r,f,e])}function Wt({className:e,children:t,ToggleComponent:n,...r}){if((t==null?void 0:t.type)===T.Fragment)throw new Error("Fragments is not allowed in SwipeBarRight");const{isRightOpen:a,closeSidebar:i,rightSidebarRef:u}=Q(),s=Re("right",r),f=re(s.mediaQueryWidth);return Bt(s),T.jsxs(T.Fragment,{children:[s.showOverlay&&T.jsx(ge,{isCollapsed:!a,setCollapsed:()=>i("right"),transitionMs:s.transitionMs,overlayBackgroundColor:s.overlayBackgroundColor,overlayZIndex:s.overlayZIndex}),T.jsx(Ue,{options:s,showToggle:s.showToggle,ToggleComponent:n}),T.jsx("div",{ref:u,style:{..._e,...yt,...s.isAbsolute||f?Rt:{},...e?{}:{backgroundColor:pe},zIndex:s.swipeBarZIndex},className:e,children:t})]})}F.Overlay=ge,F.SwipeBarBottom=Dt,F.SwipeBarLeft=Yt,F.SwipeBarProvider=et,F.SwipeBarRight=Wt,F.ToggleBottom=je,F.ToggleLeft=Fe,F.ToggleRight=Ue,F.useMediaQuery=re,F.useSwipeBarContext=Q,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|