@spear-ai/spectral 1.3.40 → 1.3.42
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/Drawer.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type DrawerProps = {
|
|
|
8
8
|
trigger: ReactNode;
|
|
9
9
|
open?: boolean;
|
|
10
10
|
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
asChild?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare const Drawer: ({ trigger, title, description, children, direction, size }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Drawer: ({ trigger, title, description, children, direction, size, asChild, }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
//# sourceMappingURL=Drawer.d.ts.map
|
package/dist/Drawer.js
CHANGED
|
@@ -12,8 +12,8 @@ var Tt = "Dialog", [oe, er] = Ge(Tt), [on, q] = oe(Tt), ie = (t) => {
|
|
|
12
12
|
open: a,
|
|
13
13
|
defaultOpen: o,
|
|
14
14
|
onOpenChange: r,
|
|
15
|
-
modal:
|
|
16
|
-
} = t, s = O.useRef(null), v = O.useRef(null), [D,
|
|
15
|
+
modal: u = !0
|
|
16
|
+
} = t, s = O.useRef(null), v = O.useRef(null), [D, f] = Qe({
|
|
17
17
|
prop: a,
|
|
18
18
|
defaultProp: o ?? !1,
|
|
19
19
|
onChange: r,
|
|
@@ -29,9 +29,9 @@ var Tt = "Dialog", [oe, er] = Ge(Tt), [on, q] = oe(Tt), ie = (t) => {
|
|
|
29
29
|
titleId: Pt(),
|
|
30
30
|
descriptionId: Pt(),
|
|
31
31
|
open: D,
|
|
32
|
-
onOpenChange:
|
|
33
|
-
onOpenToggle: O.useCallback(() =>
|
|
34
|
-
modal:
|
|
32
|
+
onOpenChange: f,
|
|
33
|
+
onOpenToggle: O.useCallback(() => f((g) => !g), [f]),
|
|
34
|
+
modal: u,
|
|
35
35
|
children: e
|
|
36
36
|
}
|
|
37
37
|
);
|
|
@@ -60,7 +60,7 @@ var Bt = "DialogPortal", [sn, ue] = oe(Bt, {
|
|
|
60
60
|
forceMount: void 0
|
|
61
61
|
}), ce = (t) => {
|
|
62
62
|
const { __scopeDialog: n, forceMount: e, children: a, container: o } = t, r = q(Bt, n);
|
|
63
|
-
return /* @__PURE__ */ S(sn, { scope: n, forceMount: e, children: O.Children.map(a, (
|
|
63
|
+
return /* @__PURE__ */ S(sn, { scope: n, forceMount: e, children: O.Children.map(a, (u) => /* @__PURE__ */ S(kt, { present: e || r.open, children: /* @__PURE__ */ S(tn, { asChild: !0, container: o, children: u }) })) });
|
|
64
64
|
};
|
|
65
65
|
ce.displayName = Bt;
|
|
66
66
|
var St = "DialogOverlay", de = O.forwardRef(
|
|
@@ -111,8 +111,8 @@ var cn = O.forwardRef(
|
|
|
111
111
|
r.preventDefault(), e.triggerRef.current?.focus();
|
|
112
112
|
}),
|
|
113
113
|
onPointerDownOutside: ht(t.onPointerDownOutside, (r) => {
|
|
114
|
-
const
|
|
115
|
-
(
|
|
114
|
+
const u = r.detail.originalEvent, s = u.button === 0 && u.ctrlKey === !0;
|
|
115
|
+
(u.button === 2 || s) && r.preventDefault();
|
|
116
116
|
}),
|
|
117
117
|
onFocusOutside: ht(
|
|
118
118
|
t.onFocusOutside,
|
|
@@ -136,15 +136,15 @@ var cn = O.forwardRef(
|
|
|
136
136
|
},
|
|
137
137
|
onInteractOutside: (r) => {
|
|
138
138
|
t.onInteractOutside?.(r), r.defaultPrevented || (a.current = !0, r.detail.originalEvent.type === "pointerdown" && (o.current = !0));
|
|
139
|
-
const
|
|
140
|
-
e.triggerRef.current?.contains(
|
|
139
|
+
const u = r.target;
|
|
140
|
+
e.triggerRef.current?.contains(u) && r.preventDefault(), r.detail.originalEvent.type === "focusin" && o.current && r.preventDefault();
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
), pe = O.forwardRef(
|
|
146
146
|
(t, n) => {
|
|
147
|
-
const { __scopeDialog: e, trapFocus: a, onOpenAutoFocus: o, onCloseAutoFocus: r, ...
|
|
147
|
+
const { __scopeDialog: e, trapFocus: a, onOpenAutoFocus: o, onCloseAutoFocus: r, ...u } = t, s = q(at, e), v = O.useRef(null), D = Ht(n, v);
|
|
148
148
|
return rn(), /* @__PURE__ */ gt(te, { children: [
|
|
149
149
|
/* @__PURE__ */ S(
|
|
150
150
|
an,
|
|
@@ -162,7 +162,7 @@ var cn = O.forwardRef(
|
|
|
162
162
|
"aria-describedby": s.descriptionId,
|
|
163
163
|
"aria-labelledby": s.titleId,
|
|
164
164
|
"data-state": Ut(s.open),
|
|
165
|
-
...
|
|
165
|
+
...u,
|
|
166
166
|
ref: D,
|
|
167
167
|
onDismiss: () => s.onOpenChange(!1)
|
|
168
168
|
}
|
|
@@ -353,22 +353,22 @@ function Pn(t = {}) {
|
|
|
353
353
|
]);
|
|
354
354
|
}
|
|
355
355
|
function Nn() {
|
|
356
|
-
let t, n = 0, e = (
|
|
357
|
-
t = Ee(
|
|
358
|
-
}, a = (
|
|
356
|
+
let t, n = 0, e = (g) => {
|
|
357
|
+
t = Ee(g.target), !(t === document.documentElement && t === document.body) && (n = g.changedTouches[0].pageY);
|
|
358
|
+
}, a = (g) => {
|
|
359
359
|
if (!t || t === document.documentElement || t === document.body) {
|
|
360
|
-
|
|
360
|
+
g.preventDefault();
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
let h =
|
|
364
|
-
H !== 0 && ((W <= 0 && h > n || W >= H && h < n) &&
|
|
365
|
-
}, o = (
|
|
366
|
-
let h =
|
|
367
|
-
Lt(h) && h !== document.activeElement && (
|
|
363
|
+
let h = g.changedTouches[0].pageY, W = t.scrollTop, H = t.scrollHeight - t.clientHeight;
|
|
364
|
+
H !== 0 && ((W <= 0 && h > n || W >= H && h < n) && g.preventDefault(), n = h);
|
|
365
|
+
}, o = (g) => {
|
|
366
|
+
let h = g.target;
|
|
367
|
+
Lt(h) && h !== document.activeElement && (g.preventDefault(), h.style.transform = "translateY(-2000px)", h.focus(), requestAnimationFrame(() => {
|
|
368
368
|
h.style.transform = "";
|
|
369
369
|
}));
|
|
370
|
-
}, r = (
|
|
371
|
-
let h =
|
|
370
|
+
}, r = (g) => {
|
|
371
|
+
let h = g.target;
|
|
372
372
|
Lt(h) && (h.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
|
373
373
|
h.style.transform = "", Nt && (Nt.height < window.innerHeight ? requestAnimationFrame(() => {
|
|
374
374
|
ae(h);
|
|
@@ -376,11 +376,11 @@ function Nn() {
|
|
|
376
376
|
once: !0
|
|
377
377
|
}));
|
|
378
378
|
}));
|
|
379
|
-
},
|
|
379
|
+
}, u = () => {
|
|
380
380
|
window.scrollTo(0, 0);
|
|
381
381
|
}, s = window.pageXOffset, v = window.pageYOffset, D = ne($n(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
|
|
382
382
|
window.scrollTo(0, 0);
|
|
383
|
-
let
|
|
383
|
+
let f = ne(pt(document, "touchstart", e, {
|
|
384
384
|
passive: !1,
|
|
385
385
|
capture: !0
|
|
386
386
|
}), pt(document, "touchmove", a, {
|
|
@@ -389,9 +389,9 @@ function Nn() {
|
|
|
389
389
|
}), pt(document, "touchend", o, {
|
|
390
390
|
passive: !1,
|
|
391
391
|
capture: !0
|
|
392
|
-
}), pt(document, "focus", r, !0), pt(window, "scroll",
|
|
392
|
+
}), pt(document, "focus", r, !0), pt(window, "scroll", u));
|
|
393
393
|
return () => {
|
|
394
|
-
D(),
|
|
394
|
+
D(), f(), window.scrollTo(s, v);
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
397
|
function $n(t, n, e) {
|
|
@@ -411,8 +411,8 @@ function ae(t) {
|
|
|
411
411
|
let e = Ee(t);
|
|
412
412
|
if (e !== document.documentElement && e !== document.body && e !== t) {
|
|
413
413
|
let a = e.getBoundingClientRect().top, o = t.getBoundingClientRect().top, r = t.getBoundingClientRect().bottom;
|
|
414
|
-
const
|
|
415
|
-
r >
|
|
414
|
+
const u = e.getBoundingClientRect().bottom + On;
|
|
415
|
+
r > u && (e.scrollTop += o - a);
|
|
416
416
|
}
|
|
417
417
|
t = e.parentElement;
|
|
418
418
|
}
|
|
@@ -515,10 +515,10 @@ function _e({ prop: t, defaultProp: n, onChange: e = () => {
|
|
|
515
515
|
const [a, o] = Wn({
|
|
516
516
|
defaultProp: n,
|
|
517
517
|
onChange: e
|
|
518
|
-
}), r = t !== void 0,
|
|
518
|
+
}), r = t !== void 0, u = r ? t : a, s = Oe(e), v = i.useCallback((D) => {
|
|
519
519
|
if (r) {
|
|
520
|
-
const
|
|
521
|
-
|
|
520
|
+
const g = typeof D == "function" ? D(t) : D;
|
|
521
|
+
g !== t && s(g);
|
|
522
522
|
} else
|
|
523
523
|
o(D);
|
|
524
524
|
}, [
|
|
@@ -528,12 +528,12 @@ function _e({ prop: t, defaultProp: n, onChange: e = () => {
|
|
|
528
528
|
s
|
|
529
529
|
]);
|
|
530
530
|
return [
|
|
531
|
-
|
|
531
|
+
u,
|
|
532
532
|
v
|
|
533
533
|
];
|
|
534
534
|
}
|
|
535
|
-
function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e, drawerRef: a, overlayRef: o, fadeFromIndex: r, onSnapPointChange:
|
|
536
|
-
const [
|
|
535
|
+
function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e, drawerRef: a, overlayRef: o, fadeFromIndex: r, onSnapPointChange: u, direction: s = "bottom", container: v, snapToSequentialPoint: D }) {
|
|
536
|
+
const [f, g] = _e({
|
|
537
537
|
prop: t,
|
|
538
538
|
defaultProp: e?.[0],
|
|
539
539
|
onChange: n
|
|
@@ -550,16 +550,16 @@ function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e,
|
|
|
550
550
|
}
|
|
551
551
|
return window.addEventListener("resize", d), () => window.removeEventListener("resize", d);
|
|
552
552
|
}, []);
|
|
553
|
-
const H = i.useMemo(() =>
|
|
553
|
+
const H = i.useMemo(() => f === e?.[e.length - 1] || null, [
|
|
554
554
|
e,
|
|
555
|
-
|
|
555
|
+
f
|
|
556
556
|
]), x = i.useMemo(() => {
|
|
557
557
|
var d;
|
|
558
|
-
return (d = e?.findIndex((R) => R ===
|
|
558
|
+
return (d = e?.findIndex((R) => R === f)) != null ? d : null;
|
|
559
559
|
}, [
|
|
560
560
|
e,
|
|
561
|
-
|
|
562
|
-
]), U = e && e.length > 0 && (r || r === 0) && !Number.isNaN(r) && e[r] ===
|
|
561
|
+
f
|
|
562
|
+
]), U = e && e.length > 0 && (r || r === 0) && !Number.isNaN(r) && e[r] === f || !e, w = i.useMemo(() => {
|
|
563
563
|
const d = v ? {
|
|
564
564
|
width: v.getBoundingClientRect().width,
|
|
565
565
|
height: v.getBoundingClientRect().height
|
|
@@ -591,7 +591,7 @@ function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e,
|
|
|
591
591
|
]), N = i.useCallback((d) => {
|
|
592
592
|
var R;
|
|
593
593
|
const b = (R = w?.findIndex((L) => L === d)) != null ? R : null;
|
|
594
|
-
|
|
594
|
+
u(b), P(a.current, {
|
|
595
595
|
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
596
596
|
transform: A(s) ? `translate3d(0, ${d}px, 0)` : `translate3d(${d}px, 0, 0)`
|
|
597
597
|
}), w && b !== w.length - 1 && r !== void 0 && b !== r && b < r ? P(o.current, {
|
|
@@ -600,29 +600,29 @@ function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e,
|
|
|
600
600
|
}) : P(o.current, {
|
|
601
601
|
transition: `opacity ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
602
602
|
opacity: "1"
|
|
603
|
-
}),
|
|
603
|
+
}), g(e?.[Math.max(b, 0)]);
|
|
604
604
|
}, [
|
|
605
605
|
a.current,
|
|
606
606
|
e,
|
|
607
607
|
w,
|
|
608
608
|
r,
|
|
609
609
|
o,
|
|
610
|
-
|
|
610
|
+
g
|
|
611
611
|
]);
|
|
612
612
|
i.useEffect(() => {
|
|
613
|
-
if (
|
|
613
|
+
if (f || t) {
|
|
614
614
|
var d;
|
|
615
|
-
const R = (d = e?.findIndex((b) => b === t || b ===
|
|
615
|
+
const R = (d = e?.findIndex((b) => b === t || b === f)) != null ? d : -1;
|
|
616
616
|
w && R !== -1 && typeof w[R] == "number" && N(w[R]);
|
|
617
617
|
}
|
|
618
618
|
}, [
|
|
619
|
-
|
|
619
|
+
f,
|
|
620
620
|
t,
|
|
621
621
|
e,
|
|
622
622
|
w,
|
|
623
623
|
N
|
|
624
624
|
]);
|
|
625
|
-
function
|
|
625
|
+
function p({ draggedDistance: d, closeDrawer: R, velocity: b, dismissible: L }) {
|
|
626
626
|
if (r === void 0) return;
|
|
627
627
|
const M = s === "bottom" || s === "right" ? ($ ?? 0) - d : ($ ?? 0) + d, z = x === r - 1, c = x === 0, V = d > 0;
|
|
628
628
|
if (z && P(o.current, {
|
|
@@ -667,12 +667,12 @@ function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e,
|
|
|
667
667
|
}
|
|
668
668
|
return {
|
|
669
669
|
isLastSnapPoint: H,
|
|
670
|
-
activeSnapPoint:
|
|
670
|
+
activeSnapPoint: f,
|
|
671
671
|
shouldFade: U,
|
|
672
672
|
getPercentageDragged: et,
|
|
673
|
-
setActiveSnapPoint:
|
|
673
|
+
setActiveSnapPoint: g,
|
|
674
674
|
activeSnapPointIndex: x,
|
|
675
|
-
onRelease:
|
|
675
|
+
onRelease: p,
|
|
676
676
|
onDrag: X,
|
|
677
677
|
snapPointsOffset: w
|
|
678
678
|
};
|
|
@@ -680,7 +680,7 @@ function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e,
|
|
|
680
680
|
const Vn = () => () => {
|
|
681
681
|
};
|
|
682
682
|
function zn() {
|
|
683
|
-
const { direction: t, isOpen: n, shouldScaleBackground: e, setBackgroundColorOnScale: a, noBodyStyles: o } = vt(), r = i.useRef(null),
|
|
683
|
+
const { direction: t, isOpen: n, shouldScaleBackground: e, setBackgroundColorOnScale: a, noBodyStyles: o } = vt(), r = i.useRef(null), u = je(() => document.body.style.backgroundColor, []);
|
|
684
684
|
function s() {
|
|
685
685
|
return (window.innerWidth - Ft) / window.innerWidth;
|
|
686
686
|
}
|
|
@@ -708,19 +708,19 @@ function zn() {
|
|
|
708
708
|
});
|
|
709
709
|
return () => {
|
|
710
710
|
D(), r.current = window.setTimeout(() => {
|
|
711
|
-
|
|
711
|
+
u ? document.body.style.background = u : document.body.style.removeProperty("background");
|
|
712
712
|
}, C.DURATION * 1e3);
|
|
713
713
|
};
|
|
714
714
|
}
|
|
715
715
|
}, [
|
|
716
716
|
n,
|
|
717
717
|
e,
|
|
718
|
-
|
|
718
|
+
u
|
|
719
719
|
]);
|
|
720
720
|
}
|
|
721
721
|
let mt = null;
|
|
722
722
|
function Yn({ isOpen: t, modal: n, nested: e, hasBeenOpened: a, preventScrollRestoration: o, noBodyStyles: r }) {
|
|
723
|
-
const [
|
|
723
|
+
const [u, s] = i.useState(() => typeof window < "u" ? window.location.href : ""), v = i.useRef(0), D = i.useCallback(() => {
|
|
724
724
|
if (ee() && mt === null && t && !r) {
|
|
725
725
|
mt = {
|
|
726
726
|
position: document.body.style.position,
|
|
@@ -729,10 +729,10 @@ function Yn({ isOpen: t, modal: n, nested: e, hasBeenOpened: a, preventScrollRes
|
|
|
729
729
|
height: document.body.style.height,
|
|
730
730
|
right: "unset"
|
|
731
731
|
};
|
|
732
|
-
const { scrollX:
|
|
732
|
+
const { scrollX: g, innerHeight: h } = window;
|
|
733
733
|
document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
|
|
734
734
|
top: `${-v.current}px`,
|
|
735
|
-
left: `${-
|
|
735
|
+
left: `${-g}px`,
|
|
736
736
|
right: "0px",
|
|
737
737
|
height: "auto"
|
|
738
738
|
}), window.setTimeout(() => window.requestAnimationFrame(() => {
|
|
@@ -742,74 +742,74 @@ function Yn({ isOpen: t, modal: n, nested: e, hasBeenOpened: a, preventScrollRes
|
|
|
742
742
|
}
|
|
743
743
|
}, [
|
|
744
744
|
t
|
|
745
|
-
]),
|
|
745
|
+
]), f = i.useCallback(() => {
|
|
746
746
|
if (ee() && mt !== null && !r) {
|
|
747
|
-
const
|
|
747
|
+
const g = -parseInt(document.body.style.top, 10), h = -parseInt(document.body.style.left, 10);
|
|
748
748
|
Object.assign(document.body.style, mt), window.requestAnimationFrame(() => {
|
|
749
|
-
if (o &&
|
|
749
|
+
if (o && u !== window.location.href) {
|
|
750
750
|
s(window.location.href);
|
|
751
751
|
return;
|
|
752
752
|
}
|
|
753
|
-
window.scrollTo(h,
|
|
753
|
+
window.scrollTo(h, g);
|
|
754
754
|
}), mt = null;
|
|
755
755
|
}
|
|
756
756
|
}, [
|
|
757
|
-
|
|
757
|
+
u
|
|
758
758
|
]);
|
|
759
759
|
return i.useEffect(() => {
|
|
760
|
-
function
|
|
760
|
+
function g() {
|
|
761
761
|
v.current = window.scrollY;
|
|
762
762
|
}
|
|
763
|
-
return
|
|
764
|
-
window.removeEventListener("scroll",
|
|
763
|
+
return g(), window.addEventListener("scroll", g), () => {
|
|
764
|
+
window.removeEventListener("scroll", g);
|
|
765
765
|
};
|
|
766
766
|
}, []), i.useEffect(() => {
|
|
767
767
|
if (n)
|
|
768
768
|
return () => {
|
|
769
|
-
typeof document > "u" || document.querySelector("[data-vaul-drawer]") ||
|
|
769
|
+
typeof document > "u" || document.querySelector("[data-vaul-drawer]") || f();
|
|
770
770
|
};
|
|
771
771
|
}, [
|
|
772
772
|
n,
|
|
773
|
-
|
|
773
|
+
f
|
|
774
774
|
]), i.useEffect(() => {
|
|
775
775
|
e || !a || (t ? (!window.matchMedia("(display-mode: standalone)").matches && D(), n || window.setTimeout(() => {
|
|
776
|
-
|
|
777
|
-
}, 500)) :
|
|
776
|
+
f();
|
|
777
|
+
}, 500)) : f());
|
|
778
778
|
}, [
|
|
779
779
|
t,
|
|
780
780
|
a,
|
|
781
|
-
|
|
781
|
+
u,
|
|
782
782
|
n,
|
|
783
783
|
e,
|
|
784
784
|
D,
|
|
785
|
-
|
|
785
|
+
f
|
|
786
786
|
]), {
|
|
787
|
-
restorePositionSetting:
|
|
787
|
+
restorePositionSetting: f
|
|
788
788
|
};
|
|
789
789
|
}
|
|
790
|
-
function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, snapPoints: r, shouldScaleBackground:
|
|
790
|
+
function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, snapPoints: r, shouldScaleBackground: u = !1, setBackgroundColorOnScale: s = !0, closeThreshold: v = Hn, scrollLockTimeout: D = Bn, dismissible: f = !0, handleOnly: g = !1, fadeFromIndex: h = r && r.length - 1, activeSnapPoint: W, setActiveSnapPoint: H, fixed: x, modal: U = !0, onClose: w, nested: $, noBodyStyles: N = !1, direction: p = "bottom", defaultOpen: X = !1, disablePreventScroll: et = !0, snapToSequentialPoint: d = !1, preventScrollRestoration: R = !1, repositionInputs: b = !0, onAnimationEnd: L, container: M, autoFocus: z = !1 }) {
|
|
791
791
|
var c, V;
|
|
792
792
|
const [F = !1, Y] = _e({
|
|
793
793
|
defaultProp: X,
|
|
794
794
|
prop: t,
|
|
795
|
-
onChange: (
|
|
796
|
-
n?.(
|
|
797
|
-
L?.(
|
|
798
|
-
}, C.DURATION * 1e3),
|
|
795
|
+
onChange: (l) => {
|
|
796
|
+
n?.(l), !l && !$ && ke(), setTimeout(() => {
|
|
797
|
+
L?.(l);
|
|
798
|
+
}, C.DURATION * 1e3), l && !U && typeof window < "u" && window.requestAnimationFrame(() => {
|
|
799
799
|
document.body.style.pointerEvents = "auto";
|
|
800
|
-
}),
|
|
800
|
+
}), l || (document.body.style.pointerEvents = "auto");
|
|
801
801
|
}
|
|
802
|
-
}), [I, K] = i.useState(!1), [J, lt] = i.useState(!1), [Ne, zt] = i.useState(!1), ot = i.useRef(null), yt = i.useRef(null), xt = i.useRef(null), Ct = i.useRef(null), ut = i.useRef(null), ct = i.useRef(!1), Ot = i.useRef(null), _t = i.useRef(0), it = i.useRef(!1), Yt = i.useRef(!X), jt = i.useRef(0),
|
|
803
|
-
r &&
|
|
802
|
+
}), [I, K] = i.useState(!1), [J, lt] = i.useState(!1), [Ne, zt] = i.useState(!1), ot = i.useRef(null), yt = i.useRef(null), xt = i.useRef(null), Ct = i.useRef(null), ut = i.useRef(null), ct = i.useRef(!1), Ot = i.useRef(null), _t = i.useRef(0), it = i.useRef(!1), Yt = i.useRef(!X), jt = i.useRef(0), m = i.useRef(null), qt = i.useRef(((c = m.current) == null ? void 0 : c.getBoundingClientRect().height) || 0), Xt = i.useRef(((V = m.current) == null ? void 0 : V.getBoundingClientRect().width) || 0), At = i.useRef(0), $e = i.useCallback((l) => {
|
|
803
|
+
r && l === dt.length - 1 && (yt.current = /* @__PURE__ */ new Date());
|
|
804
804
|
}, []), { activeSnapPoint: Me, activeSnapPointIndex: st, setActiveSnapPoint: Gt, onRelease: Ie, snapPointsOffset: dt, onDrag: Le, shouldFade: Kt, getPercentageDragged: Fe } = Un({
|
|
805
805
|
snapPoints: r,
|
|
806
806
|
activeSnapPointProp: W,
|
|
807
807
|
setActiveSnapPointProp: H,
|
|
808
|
-
drawerRef:
|
|
808
|
+
drawerRef: m,
|
|
809
809
|
fadeFromIndex: h,
|
|
810
810
|
overlayRef: ot,
|
|
811
811
|
onSnapPointChange: $e,
|
|
812
|
-
direction:
|
|
812
|
+
direction: p,
|
|
813
813
|
container: M,
|
|
814
814
|
snapToSequentialPoint: d
|
|
815
815
|
});
|
|
@@ -827,23 +827,23 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
827
827
|
function bt() {
|
|
828
828
|
return (window.innerWidth - Ft) / window.innerWidth;
|
|
829
829
|
}
|
|
830
|
-
function He(
|
|
830
|
+
function He(l) {
|
|
831
831
|
var E, T;
|
|
832
|
-
!
|
|
832
|
+
!f && !r || m.current && !m.current.contains(l.target) || (qt.current = ((E = m.current) == null ? void 0 : E.getBoundingClientRect().height) || 0, Xt.current = ((T = m.current) == null ? void 0 : T.getBoundingClientRect().width) || 0, lt(!0), xt.current = /* @__PURE__ */ new Date(), Re() && window.addEventListener("touchend", () => ct.current = !1, {
|
|
833
833
|
once: !0
|
|
834
|
-
}),
|
|
834
|
+
}), l.target.setPointerCapture(l.pointerId), _t.current = A(p) ? l.pageY : l.pageX);
|
|
835
835
|
}
|
|
836
|
-
function Jt(
|
|
836
|
+
function Jt(l, E) {
|
|
837
837
|
var T;
|
|
838
|
-
let y =
|
|
839
|
-
const _ = (T = window.getSelection()) == null ? void 0 : T.toString(), B =
|
|
838
|
+
let y = l;
|
|
839
|
+
const _ = (T = window.getSelection()) == null ? void 0 : T.toString(), B = m.current ? Et(m.current, p) : null, k = /* @__PURE__ */ new Date();
|
|
840
840
|
if (y.tagName === "SELECT" || y.hasAttribute("data-vaul-no-drag") || y.closest("[data-vaul-no-drag]"))
|
|
841
841
|
return !1;
|
|
842
|
-
if (
|
|
842
|
+
if (p === "right" || p === "left")
|
|
843
843
|
return !0;
|
|
844
844
|
if (yt.current && k.getTime() - yt.current.getTime() < 500)
|
|
845
845
|
return !1;
|
|
846
|
-
if (B !== null && (
|
|
846
|
+
if (B !== null && (p === "bottom" ? B > 0 : B < 0))
|
|
847
847
|
return !0;
|
|
848
848
|
if (_ && _.length > 0)
|
|
849
849
|
return !1;
|
|
@@ -860,15 +860,15 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
860
860
|
}
|
|
861
861
|
return !0;
|
|
862
862
|
}
|
|
863
|
-
function Be(
|
|
864
|
-
if (
|
|
865
|
-
const E =
|
|
863
|
+
function Be(l) {
|
|
864
|
+
if (m.current && J) {
|
|
865
|
+
const E = p === "bottom" || p === "right" ? 1 : -1, T = (_t.current - (A(p) ? l.pageY : l.pageX)) * E, y = T > 0, _ = r && !f && !y;
|
|
866
866
|
if (_ && st === 0) return;
|
|
867
|
-
const B = Math.abs(T), k = document.querySelector("[data-vaul-drawer-wrapper]"), Z =
|
|
867
|
+
const B = Math.abs(T), k = document.querySelector("[data-vaul-drawer-wrapper]"), Z = p === "bottom" || p === "top" ? qt.current : Xt.current;
|
|
868
868
|
let j = B / Z;
|
|
869
869
|
const nt = Fe(B, y);
|
|
870
|
-
if (nt !== null && (j = nt), _ && j >= 1 || !ct.current && !Jt(
|
|
871
|
-
if (
|
|
870
|
+
if (nt !== null && (j = nt), _ && j >= 1 || !ct.current && !Jt(l.target, y)) return;
|
|
871
|
+
if (m.current.classList.add(It), ct.current = !0, P(m.current, {
|
|
872
872
|
transition: "none"
|
|
873
873
|
}), P(ot.current, {
|
|
874
874
|
transition: "none"
|
|
@@ -876,27 +876,27 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
876
876
|
draggedDistance: T
|
|
877
877
|
}), y && !r) {
|
|
878
878
|
const G = Fn(T), Dt = Math.min(G * -1, 0) * E;
|
|
879
|
-
P(
|
|
880
|
-
transform: A(
|
|
879
|
+
P(m.current, {
|
|
880
|
+
transform: A(p) ? `translate3d(0, ${Dt}px, 0)` : `translate3d(${Dt}px, 0, 0)`
|
|
881
881
|
});
|
|
882
882
|
return;
|
|
883
883
|
}
|
|
884
884
|
const Q = 1 - j;
|
|
885
|
-
if ((Kt || h && st === h - 1) && (a?.(
|
|
885
|
+
if ((Kt || h && st === h - 1) && (a?.(l, j), P(ot.current, {
|
|
886
886
|
opacity: `${Q}`,
|
|
887
887
|
transition: "none"
|
|
888
|
-
}, !0)), k && ot.current &&
|
|
888
|
+
}, !0)), k && ot.current && u) {
|
|
889
889
|
const G = Math.min(bt() + j * (1 - bt()), 1), Dt = 8 - j * 8, Qt = Math.max(0, 14 - j * 14);
|
|
890
890
|
P(k, {
|
|
891
891
|
borderRadius: `${Dt}px`,
|
|
892
|
-
transform: A(
|
|
892
|
+
transform: A(p) ? `scale(${G}) translate3d(0, ${Qt}px, 0)` : `scale(${G}) translate3d(${Qt}px, 0, 0)`,
|
|
893
893
|
transition: "none"
|
|
894
894
|
}, !0);
|
|
895
895
|
}
|
|
896
896
|
if (!r) {
|
|
897
897
|
const G = B * E;
|
|
898
|
-
P(
|
|
899
|
-
transform: A(
|
|
898
|
+
P(m.current, {
|
|
899
|
+
transform: A(p) ? `translate3d(0, ${G}px, 0)` : `translate3d(${G}px, 0, 0)`
|
|
900
900
|
});
|
|
901
901
|
}
|
|
902
902
|
}
|
|
@@ -906,30 +906,30 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
906
906
|
Yt.current = !0;
|
|
907
907
|
});
|
|
908
908
|
}, []), i.useEffect(() => {
|
|
909
|
-
var
|
|
909
|
+
var l;
|
|
910
910
|
function E() {
|
|
911
|
-
if (!
|
|
911
|
+
if (!m.current || !b) return;
|
|
912
912
|
const T = document.activeElement;
|
|
913
913
|
if (Lt(T) || it.current) {
|
|
914
914
|
var y;
|
|
915
915
|
const _ = ((y = window.visualViewport) == null ? void 0 : y.height) || 0, B = window.innerHeight;
|
|
916
916
|
let k = B - _;
|
|
917
|
-
const Z =
|
|
917
|
+
const Z = m.current.getBoundingClientRect().height || 0, j = Z > B * 0.8;
|
|
918
918
|
At.current || (At.current = Z);
|
|
919
|
-
const nt =
|
|
919
|
+
const nt = m.current.getBoundingClientRect().top;
|
|
920
920
|
if (Math.abs(jt.current - k) > 60 && (it.current = !it.current), r && r.length > 0 && dt && st) {
|
|
921
921
|
const Q = dt[st] || 0;
|
|
922
922
|
k += Q;
|
|
923
923
|
}
|
|
924
924
|
if (jt.current = k, Z > _ || it.current) {
|
|
925
|
-
const Q =
|
|
925
|
+
const Q = m.current.getBoundingClientRect().height;
|
|
926
926
|
let G = Q;
|
|
927
|
-
Q > _ && (G = _ - (j ? nt : Ft)), x ?
|
|
928
|
-
} else Sn() || (
|
|
929
|
-
r && r.length > 0 && !it.current ?
|
|
927
|
+
Q > _ && (G = _ - (j ? nt : Ft)), x ? m.current.style.height = `${Q - Math.max(k, 0)}px` : m.current.style.height = `${Math.max(G, _ - nt)}px`;
|
|
928
|
+
} else Sn() || (m.current.style.height = `${At.current}px`);
|
|
929
|
+
r && r.length > 0 && !it.current ? m.current.style.bottom = "0px" : m.current.style.bottom = `${Math.max(k, 0)}px`;
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
return (
|
|
932
|
+
return (l = window.visualViewport) == null || l.addEventListener("resize", E), () => {
|
|
933
933
|
var T;
|
|
934
934
|
return (T = window.visualViewport) == null ? void 0 : T.removeEventListener("resize", E);
|
|
935
935
|
};
|
|
@@ -938,24 +938,24 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
938
938
|
r,
|
|
939
939
|
dt
|
|
940
940
|
]);
|
|
941
|
-
function ft(
|
|
942
|
-
We(), w?.(),
|
|
941
|
+
function ft(l) {
|
|
942
|
+
We(), w?.(), l || Y(!1), setTimeout(() => {
|
|
943
943
|
r && Gt(r[0]);
|
|
944
944
|
}, C.DURATION * 1e3);
|
|
945
945
|
}
|
|
946
946
|
function Zt() {
|
|
947
|
-
if (!
|
|
948
|
-
const
|
|
949
|
-
P(
|
|
947
|
+
if (!m.current) return;
|
|
948
|
+
const l = document.querySelector("[data-vaul-drawer-wrapper]"), E = Et(m.current, p);
|
|
949
|
+
P(m.current, {
|
|
950
950
|
transform: "translate3d(0, 0, 0)",
|
|
951
951
|
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`
|
|
952
952
|
}), P(ot.current, {
|
|
953
953
|
transition: `opacity ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
954
954
|
opacity: "1"
|
|
955
|
-
}),
|
|
955
|
+
}), u && E && E > 0 && F && P(l, {
|
|
956
956
|
borderRadius: `${Ce}px`,
|
|
957
957
|
overflow: "hidden",
|
|
958
|
-
...A(
|
|
958
|
+
...A(p) ? {
|
|
959
959
|
transform: `scale(${bt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
|
|
960
960
|
transformOrigin: "top"
|
|
961
961
|
} : {
|
|
@@ -968,42 +968,42 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
968
968
|
}, !0);
|
|
969
969
|
}
|
|
970
970
|
function We() {
|
|
971
|
-
!J || !
|
|
971
|
+
!J || !m.current || (m.current.classList.remove(It), ct.current = !1, lt(!1), Ct.current = /* @__PURE__ */ new Date());
|
|
972
972
|
}
|
|
973
|
-
function Ue(
|
|
974
|
-
if (!J || !
|
|
975
|
-
|
|
976
|
-
const E = Et(
|
|
977
|
-
if (!
|
|
978
|
-
const T = Ct.current.getTime() - xt.current.getTime(), y = _t.current - (A(
|
|
973
|
+
function Ue(l) {
|
|
974
|
+
if (!J || !m.current) return;
|
|
975
|
+
m.current.classList.remove(It), ct.current = !1, lt(!1), Ct.current = /* @__PURE__ */ new Date();
|
|
976
|
+
const E = Et(m.current, p);
|
|
977
|
+
if (!l || !Jt(l.target, !1) || !E || Number.isNaN(E) || xt.current === null) return;
|
|
978
|
+
const T = Ct.current.getTime() - xt.current.getTime(), y = _t.current - (A(p) ? l.pageY : l.pageX), _ = Math.abs(y) / T;
|
|
979
979
|
if (_ > 0.05 && (zt(!0), setTimeout(() => {
|
|
980
980
|
zt(!1);
|
|
981
981
|
}, 200)), r) {
|
|
982
982
|
Ie({
|
|
983
|
-
draggedDistance: y * (
|
|
983
|
+
draggedDistance: y * (p === "bottom" || p === "right" ? 1 : -1),
|
|
984
984
|
closeDrawer: ft,
|
|
985
985
|
velocity: _,
|
|
986
|
-
dismissible:
|
|
987
|
-
}), o?.(
|
|
986
|
+
dismissible: f
|
|
987
|
+
}), o?.(l, !0);
|
|
988
988
|
return;
|
|
989
989
|
}
|
|
990
|
-
if (
|
|
991
|
-
Zt(), o?.(
|
|
990
|
+
if (p === "bottom" || p === "right" ? y > 0 : y < 0) {
|
|
991
|
+
Zt(), o?.(l, !0);
|
|
992
992
|
return;
|
|
993
993
|
}
|
|
994
994
|
if (_ > xe) {
|
|
995
|
-
ft(), o?.(
|
|
995
|
+
ft(), o?.(l, !1);
|
|
996
996
|
return;
|
|
997
997
|
}
|
|
998
998
|
var B;
|
|
999
|
-
const k = Math.min((B =
|
|
999
|
+
const k = Math.min((B = m.current.getBoundingClientRect().height) != null ? B : 0, window.innerHeight);
|
|
1000
1000
|
var Z;
|
|
1001
|
-
const j = Math.min((Z =
|
|
1001
|
+
const j = Math.min((Z = m.current.getBoundingClientRect().width) != null ? Z : 0, window.innerWidth), nt = p === "left" || p === "right";
|
|
1002
1002
|
if (Math.abs(E) >= (nt ? j : k) * v) {
|
|
1003
|
-
ft(), o?.(
|
|
1003
|
+
ft(), o?.(l, !1);
|
|
1004
1004
|
return;
|
|
1005
1005
|
}
|
|
1006
|
-
o?.(
|
|
1006
|
+
o?.(l, !0), Zt();
|
|
1007
1007
|
}
|
|
1008
1008
|
i.useEffect(() => (F && (P(document.documentElement, {
|
|
1009
1009
|
scrollBehavior: "auto"
|
|
@@ -1012,32 +1012,32 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
1012
1012
|
}), [
|
|
1013
1013
|
F
|
|
1014
1014
|
]);
|
|
1015
|
-
function Ve(
|
|
1016
|
-
const E =
|
|
1017
|
-
Ot.current && window.clearTimeout(Ot.current), P(
|
|
1015
|
+
function Ve(l) {
|
|
1016
|
+
const E = l ? (window.innerWidth - rt) / window.innerWidth : 1, T = l ? -rt : 0;
|
|
1017
|
+
Ot.current && window.clearTimeout(Ot.current), P(m.current, {
|
|
1018
1018
|
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
1019
|
-
transform: A(
|
|
1020
|
-
}), !
|
|
1021
|
-
const y = Et(
|
|
1022
|
-
P(
|
|
1019
|
+
transform: A(p) ? `scale(${E}) translate3d(0, ${T}px, 0)` : `scale(${E}) translate3d(${T}px, 0, 0)`
|
|
1020
|
+
}), !l && m.current && (Ot.current = setTimeout(() => {
|
|
1021
|
+
const y = Et(m.current, p);
|
|
1022
|
+
P(m.current, {
|
|
1023
1023
|
transition: "none",
|
|
1024
|
-
transform: A(
|
|
1024
|
+
transform: A(p) ? `translate3d(0, ${y}px, 0)` : `translate3d(${y}px, 0, 0)`
|
|
1025
1025
|
});
|
|
1026
1026
|
}, 500));
|
|
1027
1027
|
}
|
|
1028
|
-
function ze(
|
|
1028
|
+
function ze(l, E) {
|
|
1029
1029
|
if (E < 0) return;
|
|
1030
1030
|
const T = (window.innerWidth - rt) / window.innerWidth, y = T + E * (1 - T), _ = -rt + E * rt;
|
|
1031
|
-
P(
|
|
1032
|
-
transform: A(
|
|
1031
|
+
P(m.current, {
|
|
1032
|
+
transform: A(p) ? `scale(${y}) translate3d(0, ${_}px, 0)` : `scale(${y}) translate3d(${_}px, 0, 0)`,
|
|
1033
1033
|
transition: "none"
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
|
-
function Ye(
|
|
1037
|
-
const T = A(
|
|
1038
|
-
E && P(
|
|
1036
|
+
function Ye(l, E) {
|
|
1037
|
+
const T = A(p) ? window.innerHeight : window.innerWidth, y = E ? (T - rt) / T : 1, _ = E ? -rt : 0;
|
|
1038
|
+
E && P(m.current, {
|
|
1039
1039
|
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
1040
|
-
transform: A(
|
|
1040
|
+
transform: A(p) ? `scale(${y}) translate3d(0, ${_}px, 0)` : `scale(${y}) translate3d(${_}px, 0, 0)`
|
|
1041
1041
|
});
|
|
1042
1042
|
}
|
|
1043
1043
|
return i.useEffect(() => {
|
|
@@ -1048,8 +1048,8 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
1048
1048
|
U
|
|
1049
1049
|
]), /* @__PURE__ */ i.createElement(gn, {
|
|
1050
1050
|
defaultOpen: X,
|
|
1051
|
-
onOpenChange: (
|
|
1052
|
-
!
|
|
1051
|
+
onOpenChange: (l) => {
|
|
1052
|
+
!f && !l || (l ? K(!0) : ft(!0), Y(l));
|
|
1053
1053
|
},
|
|
1054
1054
|
open: F
|
|
1055
1055
|
}, /* @__PURE__ */ i.createElement(De.Provider, {
|
|
@@ -1057,15 +1057,15 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
1057
1057
|
activeSnapPoint: Me,
|
|
1058
1058
|
snapPoints: r,
|
|
1059
1059
|
setActiveSnapPoint: Gt,
|
|
1060
|
-
drawerRef:
|
|
1060
|
+
drawerRef: m,
|
|
1061
1061
|
overlayRef: ot,
|
|
1062
1062
|
onOpenChange: n,
|
|
1063
1063
|
onPress: He,
|
|
1064
1064
|
onRelease: Ue,
|
|
1065
1065
|
onDrag: Be,
|
|
1066
|
-
dismissible:
|
|
1066
|
+
dismissible: f,
|
|
1067
1067
|
shouldAnimate: Yt,
|
|
1068
|
-
handleOnly:
|
|
1068
|
+
handleOnly: g,
|
|
1069
1069
|
isOpen: F,
|
|
1070
1070
|
isDragging: J,
|
|
1071
1071
|
shouldFade: Kt,
|
|
@@ -1077,8 +1077,8 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
1077
1077
|
modal: U,
|
|
1078
1078
|
snapPointsOffset: dt,
|
|
1079
1079
|
activeSnapPointIndex: st,
|
|
1080
|
-
direction:
|
|
1081
|
-
shouldScaleBackground:
|
|
1080
|
+
direction: p,
|
|
1081
|
+
shouldScaleBackground: u,
|
|
1082
1082
|
setBackgroundColorOnScale: s,
|
|
1083
1083
|
noBodyStyles: N,
|
|
1084
1084
|
container: M,
|
|
@@ -1087,25 +1087,25 @@ function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, sn
|
|
|
1087
1087
|
}, e));
|
|
1088
1088
|
}
|
|
1089
1089
|
const Ae = /* @__PURE__ */ i.forwardRef(function({ ...t }, n) {
|
|
1090
|
-
const { overlayRef: e, snapPoints: a, onRelease: o, shouldFade: r, isOpen:
|
|
1090
|
+
const { overlayRef: e, snapPoints: a, onRelease: o, shouldFade: r, isOpen: u, modal: s, shouldAnimate: v } = vt(), D = Se(n, e), f = a && a.length > 0;
|
|
1091
1091
|
if (!s)
|
|
1092
1092
|
return null;
|
|
1093
|
-
const
|
|
1093
|
+
const g = i.useCallback((h) => o(h), [
|
|
1094
1094
|
o
|
|
1095
1095
|
]);
|
|
1096
1096
|
return /* @__PURE__ */ i.createElement(vn, {
|
|
1097
|
-
onMouseUp:
|
|
1097
|
+
onMouseUp: g,
|
|
1098
1098
|
ref: D,
|
|
1099
1099
|
"data-vaul-overlay": "",
|
|
1100
|
-
"data-vaul-snap-points":
|
|
1101
|
-
"data-vaul-snap-points-overlay":
|
|
1100
|
+
"data-vaul-snap-points": u && f ? "true" : "false",
|
|
1101
|
+
"data-vaul-snap-points-overlay": u && r ? "true" : "false",
|
|
1102
1102
|
"data-vaul-animate": v?.current ? "true" : "false",
|
|
1103
1103
|
...t
|
|
1104
1104
|
});
|
|
1105
1105
|
});
|
|
1106
1106
|
Ae.displayName = "Drawer.Overlay";
|
|
1107
1107
|
const Pe = /* @__PURE__ */ i.forwardRef(function({ onPointerDownOutside: t, style: n, onOpenAutoFocus: e, ...a }, o) {
|
|
1108
|
-
const { drawerRef: r, onPress:
|
|
1108
|
+
const { drawerRef: r, onPress: u, onRelease: s, onDrag: v, keyboardIsOpen: D, snapPointsOffset: f, activeSnapPointIndex: g, modal: h, isOpen: W, direction: H, snapPoints: x, container: U, handleOnly: w, shouldAnimate: $, autoFocus: N } = vt(), [p, X] = i.useState(!1), et = Se(o, r), d = i.useRef(null), R = i.useRef(null), b = i.useRef(!1), L = x && x.length > 0;
|
|
1109
1109
|
zn();
|
|
1110
1110
|
const M = (c, V, F = 0) => {
|
|
1111
1111
|
if (b.current) return !0;
|
|
@@ -1131,21 +1131,21 @@ const Pe = /* @__PURE__ */ i.forwardRef(function({ onPointerDownOutside: t, styl
|
|
|
1131
1131
|
return /* @__PURE__ */ i.createElement(yn, {
|
|
1132
1132
|
"data-vaul-drawer-direction": H,
|
|
1133
1133
|
"data-vaul-drawer": "",
|
|
1134
|
-
"data-vaul-delayed-snap-points":
|
|
1134
|
+
"data-vaul-delayed-snap-points": p ? "true" : "false",
|
|
1135
1135
|
"data-vaul-snap-points": W && L ? "true" : "false",
|
|
1136
1136
|
"data-vaul-custom-container": U ? "true" : "false",
|
|
1137
1137
|
"data-vaul-animate": $?.current ? "true" : "false",
|
|
1138
1138
|
...a,
|
|
1139
1139
|
ref: et,
|
|
1140
|
-
style:
|
|
1141
|
-
"--snap-point-height": `${g
|
|
1140
|
+
style: f && f.length > 0 ? {
|
|
1141
|
+
"--snap-point-height": `${f[g ?? 0]}px`,
|
|
1142
1142
|
...n
|
|
1143
1143
|
} : n,
|
|
1144
1144
|
onPointerDown: (c) => {
|
|
1145
1145
|
w || (a.onPointerDown == null || a.onPointerDown.call(a, c), d.current = {
|
|
1146
1146
|
x: c.pageX,
|
|
1147
1147
|
y: c.pageY
|
|
1148
|
-
},
|
|
1148
|
+
}, u(c));
|
|
1149
1149
|
},
|
|
1150
1150
|
onOpenAutoFocus: (c) => {
|
|
1151
1151
|
e?.(c), N || c.preventDefault();
|
|
@@ -1184,7 +1184,7 @@ const Pe = /* @__PURE__ */ i.forwardRef(function({ onPointerDownOutside: t, styl
|
|
|
1184
1184
|
});
|
|
1185
1185
|
Pe.displayName = "Drawer.Content";
|
|
1186
1186
|
const qn = 250, Xn = 120, Gn = /* @__PURE__ */ i.forwardRef(function({ preventCycle: t = !1, children: n, ...e }, a) {
|
|
1187
|
-
const { closeDrawer: o, isDragging: r, snapPoints:
|
|
1187
|
+
const { closeDrawer: o, isDragging: r, snapPoints: u, activeSnapPoint: s, setActiveSnapPoint: v, dismissible: D, handleOnly: f, isOpen: g, onPress: h, onDrag: W } = vt(), H = i.useRef(null), x = i.useRef(!1);
|
|
1188
1188
|
function U() {
|
|
1189
1189
|
if (x.current) {
|
|
1190
1190
|
N();
|
|
@@ -1199,17 +1199,17 @@ const qn = 250, Xn = 120, Gn = /* @__PURE__ */ i.forwardRef(function({ preventCy
|
|
|
1199
1199
|
N();
|
|
1200
1200
|
return;
|
|
1201
1201
|
}
|
|
1202
|
-
if (N(), !
|
|
1202
|
+
if (N(), !u || u.length === 0) {
|
|
1203
1203
|
D || o();
|
|
1204
1204
|
return;
|
|
1205
1205
|
}
|
|
1206
|
-
if (s ===
|
|
1206
|
+
if (s === u[u.length - 1] && D) {
|
|
1207
1207
|
o();
|
|
1208
1208
|
return;
|
|
1209
1209
|
}
|
|
1210
|
-
const X =
|
|
1210
|
+
const X = u.findIndex((d) => d === s);
|
|
1211
1211
|
if (X === -1) return;
|
|
1212
|
-
const et =
|
|
1212
|
+
const et = u[X + 1];
|
|
1213
1213
|
v(et);
|
|
1214
1214
|
}
|
|
1215
1215
|
function $() {
|
|
@@ -1223,15 +1223,15 @@ const qn = 250, Xn = 120, Gn = /* @__PURE__ */ i.forwardRef(function({ preventCy
|
|
|
1223
1223
|
return /* @__PURE__ */ i.createElement("div", {
|
|
1224
1224
|
onClick: U,
|
|
1225
1225
|
onPointerCancel: N,
|
|
1226
|
-
onPointerDown: (
|
|
1227
|
-
|
|
1226
|
+
onPointerDown: (p) => {
|
|
1227
|
+
f && h(p), $();
|
|
1228
1228
|
},
|
|
1229
|
-
onPointerMove: (
|
|
1230
|
-
|
|
1229
|
+
onPointerMove: (p) => {
|
|
1230
|
+
f && W(p);
|
|
1231
1231
|
},
|
|
1232
1232
|
// onPointerUp is already handled by the content component
|
|
1233
1233
|
ref: a,
|
|
1234
|
-
"data-vaul-drawer-visible":
|
|
1234
|
+
"data-vaul-drawer-visible": g ? "true" : "false",
|
|
1235
1235
|
"data-vaul-handle": "",
|
|
1236
1236
|
"aria-hidden": "true",
|
|
1237
1237
|
...e
|
|
@@ -1257,34 +1257,42 @@ const tt = {
|
|
|
1257
1257
|
Close: Rn,
|
|
1258
1258
|
Title: bn,
|
|
1259
1259
|
Description: Dn
|
|
1260
|
-
}, rr = ({
|
|
1261
|
-
|
|
1260
|
+
}, rr = ({
|
|
1261
|
+
trigger: t,
|
|
1262
|
+
title: n,
|
|
1263
|
+
description: e,
|
|
1264
|
+
children: a,
|
|
1265
|
+
direction: o = "right",
|
|
1266
|
+
size: r = "380px",
|
|
1267
|
+
asChild: u = !1
|
|
1268
|
+
}) => {
|
|
1269
|
+
const s = "!font-sans fixed", v = {
|
|
1262
1270
|
left: {
|
|
1263
|
-
className: `${
|
|
1271
|
+
className: `${s} top-0 bottom-0 left-0 shadow-[20px_0_20px_rgba(0,0,0,0.4)]`,
|
|
1264
1272
|
style: { width: r }
|
|
1265
1273
|
},
|
|
1266
1274
|
right: {
|
|
1267
|
-
className: `${
|
|
1275
|
+
className: `${s} top-0 bottom-0 right-0 shadow-[-20px_0_20px_rgba(0,0,0,0.4)]`,
|
|
1268
1276
|
style: { width: r }
|
|
1269
1277
|
},
|
|
1270
1278
|
top: {
|
|
1271
|
-
className: `${
|
|
1279
|
+
className: `${s} top-0 left-0 right-0 shadow-[0_20px_20px_rgba(0,0,0,0.4)]`,
|
|
1272
1280
|
style: { height: r }
|
|
1273
1281
|
},
|
|
1274
1282
|
bottom: {
|
|
1275
|
-
className: `${
|
|
1283
|
+
className: `${s} bottom-0 left-0 right-0 shadow-[0_-20px_20px_rgba(0,0,0,0.4)]`,
|
|
1276
1284
|
style: { height: r }
|
|
1277
1285
|
}
|
|
1278
|
-
}, { className:
|
|
1286
|
+
}, { className: D, style: f } = v[o];
|
|
1279
1287
|
return /* @__PURE__ */ gt(tt.Root, { direction: o, children: [
|
|
1280
|
-
/* @__PURE__ */ S(tt.Trigger, { children: t }),
|
|
1288
|
+
/* @__PURE__ */ S(tt.Trigger, { ...u && { asChild: u }, children: t }),
|
|
1281
1289
|
/* @__PURE__ */ gt(tt.Portal, { children: [
|
|
1282
1290
|
/* @__PURE__ */ S(tt.Overlay, { className: "fixed inset-0 bg-transparent" }),
|
|
1283
1291
|
/* @__PURE__ */ gt(
|
|
1284
1292
|
tt.Content,
|
|
1285
1293
|
{
|
|
1286
|
-
className: `bg-drawer-bg z-10 flex flex-col outline-none [&_*]:box-border ${
|
|
1287
|
-
style:
|
|
1294
|
+
className: `bg-drawer-bg z-10 flex flex-col outline-none [&_*]:box-border ${D}`,
|
|
1295
|
+
style: f,
|
|
1288
1296
|
children: [
|
|
1289
1297
|
/* @__PURE__ */ S(tt.Close, {}),
|
|
1290
1298
|
/* @__PURE__ */ S(tt.Title, { className: "text-text-primary px-3 text-lg font-medium", children: n }),
|
|
@@ -15,7 +15,7 @@ const u = ({ className: e, ariaHidden: n, title: i = "Zoom All", description: d,
|
|
|
15
15
|
"aria-hidden": n,
|
|
16
16
|
ref: c,
|
|
17
17
|
children: [
|
|
18
|
-
/* @__PURE__ */ t("g", {
|
|
18
|
+
/* @__PURE__ */ t("g", { clipPath: `url(#${r}-clip0)`, children: [
|
|
19
19
|
/* @__PURE__ */ o("path", { d: "M21 19L10 19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20
20
|
/* @__PURE__ */ o(
|
|
21
21
|
"path",
|
package/dist/Tooltip.js
CHANGED
|
@@ -338,7 +338,7 @@ function Ee(e) {
|
|
|
338
338
|
return t.pop(), o.length === 1 && t.length === 1 && o[0].x === t[0].x && o[0].y === t[0].y ? o : o.concat(t);
|
|
339
339
|
}
|
|
340
340
|
var Re = Y, _e = $, De = B, Oe = U, Ae = q, Le = K;
|
|
341
|
-
const ke = ({ delayDuration: e = 0, ...o }) => /* @__PURE__ */ u(Re, { "data-slot": "tooltip-provider", delayDuration: e, ...o }), je = ({ ...e }) => /* @__PURE__ */ u(ke, { children: /* @__PURE__ */ u(_e, { "data-slot": "tooltip", ...e }) }), Ge = ({ ...e }) => /* @__PURE__ */ u(De, {
|
|
341
|
+
const ke = ({ delayDuration: e = 0, ...o }) => /* @__PURE__ */ u(Re, { "data-slot": "tooltip-provider", delayDuration: e, ...o }), je = ({ ...e }) => /* @__PURE__ */ u(ke, { children: /* @__PURE__ */ u(_e, { "data-slot": "tooltip", ...e }) }), Ge = ({ ...e }) => /* @__PURE__ */ u(De, { "data-slot": "tooltip-trigger", ...e }), ze = ({
|
|
342
342
|
className: e,
|
|
343
343
|
children: o,
|
|
344
344
|
sideOffset: t = 0,
|
|
@@ -8,6 +8,7 @@ export type DrawerProps = {
|
|
|
8
8
|
trigger: ReactNode;
|
|
9
9
|
open?: boolean;
|
|
10
10
|
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
asChild?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare const Drawer: ({ trigger, title, description, children, direction, size }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Drawer: ({ trigger, title, description, children, direction, size, asChild, }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAA;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAA;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,sEAQpB,WAAW,4CA2Cb,CAAA"}
|