@sprawlify/primitives 0.0.109 → 0.0.111
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/{aria-hidden-BX4SWNE_.mjs → aria-hidden-C72KtklN.mjs} +1 -1
- package/dist/{aria-hidden-BAGrxNHt.cjs → aria-hidden-CIBHXlCy.cjs} +1 -1
- package/dist/aria-hidden.cjs +2 -2
- package/dist/aria-hidden.mjs +2 -2
- package/dist/{auto-resize-B1BDDnp1.cjs → auto-resize-BTTNXiml.cjs} +1 -1
- package/dist/{auto-resize-CN2vAzdj.mjs → auto-resize-CbNgN0OO.mjs} +1 -1
- package/dist/auto-resize.cjs +2 -2
- package/dist/auto-resize.mjs +2 -2
- package/dist/collection.d.cts +2 -2
- package/dist/collection.d.mts +2 -2
- package/dist/{core-BmIEKqtP.mjs → core-Ci9Yu6QI.mjs} +1 -1
- package/dist/{core-nBg9RC_y.cjs → core-DwdPztGA.cjs} +1 -1
- package/dist/core.cjs +2 -2
- package/dist/core.mjs +2 -2
- package/dist/{dismissable-DWfZGIA7.mjs → dismissable-B9k5K6f9.mjs} +2 -2
- package/dist/{dismissable-ChwcJMHk.cjs → dismissable-DxjbwsOf.cjs} +2 -2
- package/dist/dismissable.cjs +3 -3
- package/dist/dismissable.mjs +3 -3
- package/dist/{dom-query-s2ESLR2U.mjs → dom-query-BFuRs3l4.mjs} +1 -1
- package/dist/{dom-query-Bd63cRVF.cjs → dom-query-BUO7rGsg.cjs} +1 -1
- package/dist/dom-query.cjs +1 -1
- package/dist/dom-query.mjs +1 -1
- package/dist/{focus-trap-fucc6OU_.cjs → focus-trap-BewqTQFt.cjs} +1 -1
- package/dist/{focus-trap-DzBvBlTH.mjs → focus-trap-Do8IUXYh.mjs} +1 -1
- package/dist/focus-trap.cjs +2 -2
- package/dist/focus-trap.mjs +2 -2
- package/dist/{focus-visible-D5qBaAOn.mjs → focus-visible-GXKbbuiq.mjs} +1 -1
- package/dist/{focus-visible-75XTctXf.cjs → focus-visible-JdJXqMic.cjs} +1 -1
- package/dist/focus-visible.cjs +2 -2
- package/dist/focus-visible.mjs +2 -2
- package/dist/{i18n-utils-DB-lUfrr.cjs → i18n-utils-BRLqoCq8.cjs} +1 -1
- package/dist/{i18n-utils-oWZyUib_.mjs → i18n-utils-DZs1CPj8.mjs} +1 -1
- package/dist/i18n-utils.cjs +2 -2
- package/dist/i18n-utils.mjs +2 -2
- package/dist/{interact-outside-2qkUnl4N.mjs → interact-outside-Ba50N1a5.mjs} +1 -1
- package/dist/{interact-outside-Cx4J0EBf.cjs → interact-outside-Bg-QSXqp.cjs} +1 -1
- package/dist/interact-outside.cjs +2 -2
- package/dist/interact-outside.mjs +2 -2
- package/dist/{list-collection-B_8BN0XB.d.cts → list-collection-Cjgbx_9l.d.cts} +1 -1
- package/dist/{list-collection-DkRA5LOq.d.mts → list-collection-IF510iNl.d.mts} +1 -1
- package/dist/machines/accordion/index.cjs +2 -2
- package/dist/machines/accordion/index.mjs +2 -2
- package/dist/machines/angle-slider/index.cjs +2 -2
- package/dist/machines/angle-slider/index.d.cts +1 -1
- package/dist/machines/angle-slider/index.d.mts +1 -1
- package/dist/machines/angle-slider/index.mjs +2 -2
- package/dist/machines/aspect-ratio/index.cjs +2 -2
- package/dist/machines/aspect-ratio/index.mjs +2 -2
- package/dist/machines/async-list/index.cjs +2 -2
- package/dist/machines/async-list/index.mjs +2 -2
- package/dist/machines/avatar/index.cjs +2 -2
- package/dist/machines/avatar/index.mjs +2 -2
- package/dist/machines/carousel/index.cjs +3 -3
- package/dist/machines/carousel/index.d.cts +1 -1
- package/dist/machines/carousel/index.d.mts +1 -1
- package/dist/machines/carousel/index.mjs +3 -3
- package/dist/machines/cascade-select/index.cjs +5 -5
- package/dist/machines/cascade-select/index.d.cts +2 -2
- package/dist/machines/cascade-select/index.d.mts +2 -2
- package/dist/machines/cascade-select/index.mjs +5 -5
- package/dist/machines/checkbox/index.cjs +3 -3
- package/dist/machines/checkbox/index.d.cts +1 -1
- package/dist/machines/checkbox/index.d.mts +1 -1
- package/dist/machines/checkbox/index.mjs +3 -3
- package/dist/machines/clipboard/index.cjs +2 -2
- package/dist/machines/clipboard/index.d.cts +1 -1
- package/dist/machines/clipboard/index.d.mts +1 -1
- package/dist/machines/clipboard/index.mjs +2 -2
- package/dist/machines/collapsible/index.cjs +2 -2
- package/dist/machines/collapsible/index.d.cts +1 -1
- package/dist/machines/collapsible/index.d.mts +1 -1
- package/dist/machines/collapsible/index.mjs +2 -2
- package/dist/machines/color-picker/index.cjs +5 -5
- package/dist/machines/color-picker/index.d.cts +1 -1
- package/dist/machines/color-picker/index.d.mts +1 -1
- package/dist/machines/color-picker/index.mjs +5 -5
- package/dist/machines/combobox/index.cjs +5 -5
- package/dist/machines/combobox/index.d.cts +2 -2
- package/dist/machines/combobox/index.d.mts +2 -2
- package/dist/machines/combobox/index.mjs +5 -5
- package/dist/machines/date-picker/index.cjs +5 -5
- package/dist/machines/date-picker/index.d.cts +1 -1
- package/dist/machines/date-picker/index.d.mts +1 -1
- package/dist/machines/date-picker/index.mjs +5 -5
- package/dist/machines/dialog/index.cjs +7 -7
- package/dist/machines/dialog/index.d.cts +1 -1
- package/dist/machines/dialog/index.d.mts +1 -1
- package/dist/machines/dialog/index.mjs +7 -7
- package/dist/machines/drawer/index.cjs +1934 -0
- package/dist/machines/drawer/index.d.cts +310 -0
- package/dist/machines/drawer/index.d.mts +310 -0
- package/dist/machines/drawer/index.mjs +1927 -0
- package/dist/machines/dropdown-menu/index.cjs +5 -5
- package/dist/machines/dropdown-menu/index.d.cts +1 -1
- package/dist/machines/dropdown-menu/index.d.mts +1 -1
- package/dist/machines/dropdown-menu/index.mjs +5 -5
- package/dist/machines/editable/index.cjs +3 -3
- package/dist/machines/editable/index.d.cts +1 -1
- package/dist/machines/editable/index.d.mts +1 -1
- package/dist/machines/editable/index.mjs +3 -3
- package/dist/machines/file-upload/index.cjs +3 -3
- package/dist/machines/file-upload/index.d.cts +1 -1
- package/dist/machines/file-upload/index.d.mts +1 -1
- package/dist/machines/file-upload/index.mjs +3 -3
- package/dist/machines/floating-panel/index.cjs +2 -2
- package/dist/machines/floating-panel/index.d.cts +1 -1
- package/dist/machines/floating-panel/index.d.mts +1 -1
- package/dist/machines/floating-panel/index.mjs +2 -2
- package/dist/machines/hover-card/index.cjs +5 -5
- package/dist/machines/hover-card/index.d.cts +1 -1
- package/dist/machines/hover-card/index.d.mts +1 -1
- package/dist/machines/hover-card/index.mjs +5 -5
- package/dist/machines/image-cropper/index.cjs +2 -2
- package/dist/machines/image-cropper/index.mjs +2 -2
- package/dist/machines/listbox/index.cjs +3 -3
- package/dist/machines/listbox/index.d.cts +3 -3
- package/dist/machines/listbox/index.d.mts +3 -3
- package/dist/machines/listbox/index.mjs +3 -3
- package/dist/machines/marquee/index.cjs +2 -2
- package/dist/machines/marquee/index.d.cts +3 -3
- package/dist/machines/marquee/index.d.mts +3 -3
- package/dist/machines/marquee/index.mjs +2 -2
- package/dist/machines/navigation-menu/index.cjs +4 -4
- package/dist/machines/navigation-menu/index.d.cts +1 -1
- package/dist/machines/navigation-menu/index.d.mts +1 -1
- package/dist/machines/navigation-menu/index.mjs +4 -4
- package/dist/machines/number-input/index.cjs +2 -2
- package/dist/machines/number-input/index.d.cts +1 -1
- package/dist/machines/number-input/index.d.mts +1 -1
- package/dist/machines/number-input/index.mjs +2 -2
- package/dist/machines/pagination/index.cjs +2 -2
- package/dist/machines/pagination/index.mjs +2 -2
- package/dist/machines/password-input/index.cjs +2 -2
- package/dist/machines/password-input/index.d.cts +1 -1
- package/dist/machines/password-input/index.d.mts +1 -1
- package/dist/machines/password-input/index.mjs +2 -2
- package/dist/machines/pin-input/index.cjs +2 -2
- package/dist/machines/pin-input/index.d.cts +1 -1
- package/dist/machines/pin-input/index.d.mts +1 -1
- package/dist/machines/pin-input/index.mjs +2 -2
- package/dist/machines/popover/index.cjs +8 -8
- package/dist/machines/popover/index.d.cts +1 -1
- package/dist/machines/popover/index.d.mts +1 -1
- package/dist/machines/popover/index.mjs +8 -8
- package/dist/machines/presence/index.cjs +2 -2
- package/dist/machines/presence/index.mjs +2 -2
- package/dist/machines/progress/index.cjs +2 -2
- package/dist/machines/progress/index.d.cts +1 -1
- package/dist/machines/progress/index.d.mts +1 -1
- package/dist/machines/progress/index.mjs +2 -2
- package/dist/machines/qr-code/index.cjs +2 -2
- package/dist/machines/qr-code/index.mjs +2 -2
- package/dist/machines/radio-group/index.cjs +3 -3
- package/dist/machines/radio-group/index.d.cts +1 -1
- package/dist/machines/radio-group/index.d.mts +1 -1
- package/dist/machines/radio-group/index.mjs +3 -3
- package/dist/machines/rating-group/index.cjs +2 -2
- package/dist/machines/rating-group/index.mjs +2 -2
- package/dist/machines/scroll-area/index.cjs +2 -2
- package/dist/machines/scroll-area/index.d.cts +1 -1
- package/dist/machines/scroll-area/index.d.mts +1 -1
- package/dist/machines/scroll-area/index.mjs +2 -2
- package/dist/machines/select/index.cjs +6 -6
- package/dist/machines/select/index.d.cts +2 -2
- package/dist/machines/select/index.d.mts +2 -2
- package/dist/machines/select/index.mjs +6 -6
- package/dist/machines/separator/index.cjs +2 -2
- package/dist/machines/separator/index.mjs +2 -2
- package/dist/machines/signature-pad/index.cjs +2 -2
- package/dist/machines/signature-pad/index.mjs +2 -2
- package/dist/machines/slider/index.cjs +2 -2
- package/dist/machines/slider/index.d.cts +1 -1
- package/dist/machines/slider/index.d.mts +1 -1
- package/dist/machines/slider/index.mjs +2 -2
- package/dist/machines/splitter/index.cjs +2 -2
- package/dist/machines/splitter/index.mjs +2 -2
- package/dist/machines/steps/index.cjs +2 -2
- package/dist/machines/steps/index.d.cts +1 -1
- package/dist/machines/steps/index.d.mts +1 -1
- package/dist/machines/steps/index.mjs +2 -2
- package/dist/machines/switch/index.cjs +3 -3
- package/dist/machines/switch/index.mjs +3 -3
- package/dist/machines/tabs/index.cjs +2 -2
- package/dist/machines/tabs/index.d.cts +1 -1
- package/dist/machines/tabs/index.d.mts +1 -1
- package/dist/machines/tabs/index.mjs +2 -2
- package/dist/machines/tags-input/index.cjs +4 -4
- package/dist/machines/tags-input/index.d.cts +1 -1
- package/dist/machines/tags-input/index.d.mts +1 -1
- package/dist/machines/tags-input/index.mjs +4 -4
- package/dist/machines/timer/index.cjs +2 -2
- package/dist/machines/timer/index.d.cts +1 -1
- package/dist/machines/timer/index.d.mts +1 -1
- package/dist/machines/timer/index.mjs +2 -2
- package/dist/machines/toast/index.cjs +4 -4
- package/dist/machines/toast/index.d.cts +1 -1
- package/dist/machines/toast/index.d.mts +1 -1
- package/dist/machines/toast/index.mjs +4 -4
- package/dist/machines/toggle/index.cjs +2 -2
- package/dist/machines/toggle/index.mjs +2 -2
- package/dist/machines/toggle-group/index.cjs +2 -2
- package/dist/machines/toggle-group/index.mjs +2 -2
- package/dist/machines/tooltip/index.cjs +4 -4
- package/dist/machines/tooltip/index.d.cts +1 -1
- package/dist/machines/tooltip/index.d.mts +1 -1
- package/dist/machines/tooltip/index.mjs +4 -4
- package/dist/machines/tour/index.cjs +6 -6
- package/dist/machines/tour/index.d.cts +1 -1
- package/dist/machines/tour/index.d.mts +1 -1
- package/dist/machines/tour/index.mjs +6 -6
- package/dist/machines/tree-view/index.cjs +2 -2
- package/dist/machines/tree-view/index.d.cts +1 -1
- package/dist/machines/tree-view/index.d.mts +1 -1
- package/dist/machines/tree-view/index.mjs +2 -2
- package/dist/{popper-BDy37WA0.mjs → popper-BlgbmdAn.mjs} +1 -1
- package/dist/{popper-Cx3KHzeT.cjs → popper-viCrafLC.cjs} +1 -1
- package/dist/popper.cjs +2 -2
- package/dist/popper.mjs +2 -2
- package/dist/{remove-scroll-D9FAOapi.cjs → remove-scroll-D4CMJmU2.cjs} +1 -1
- package/dist/{remove-scroll-HcSiTbd5.mjs → remove-scroll-D55GZoBb.mjs} +1 -1
- package/dist/{scroll-snap-DfSwN3As.mjs → scroll-snap-CdneVP31.mjs} +1 -1
- package/dist/{scroll-snap-Dp_2adEa.cjs → scroll-snap-vZ2q6dcN.cjs} +1 -1
- package/dist/scroll-snap.cjs +2 -2
- package/dist/scroll-snap.mjs +2 -2
- package/dist/{selection-DdNvrKbj.d.mts → selection-6urf-c8j.d.mts} +1 -1
- package/dist/{selection-Bb_ZSVxe.d.cts → selection-BmS2RDMq.d.cts} +1 -1
- package/package.json +11 -11
- package/dist/machines/bottom-sheet/index.cjs +0 -667
- package/dist/machines/bottom-sheet/index.d.cts +0 -239
- package/dist/machines/bottom-sheet/index.d.mts +0 -239
- package/dist/machines/bottom-sheet/index.mjs +0 -662
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { n as AnatomyInstance } from "../../create-anatomy-9eFQs7lO.cjs";
|
|
2
|
+
import { p as Machine, u as EventObject, y as Service } from "../../types-B24gMTKq.cjs";
|
|
3
|
+
import { C as JSX, b as NormalizeProps, g as RequiredBy, p as Point, r as DirectionProperty, s as MaybeElement, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
4
|
+
import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOutsideEvent } from "../../index-DzWGFhcS.cjs";
|
|
5
|
+
import { t as DismissableElementHandlers } from "../../dismissable-layer-ZgyqN8AD.cjs";
|
|
6
|
+
|
|
7
|
+
//#region src/machines/drawer/drawer.anatomy.d.ts
|
|
8
|
+
declare const anatomy: AnatomyInstance<"trigger" | "title" | "content" | "description" | "positioner" | "backdrop" | "closeTrigger" | "grabber" | "grabberIndicator" | "swipeArea">;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/machines/drawer/utils/session.d.ts
|
|
11
|
+
type GestureAxis = "x" | "y";
|
|
12
|
+
type PhysicalSwipeDirection = "up" | "down" | "left" | "right";
|
|
13
|
+
type SwipePointerType = "mouse" | "pen" | "touch";
|
|
14
|
+
interface SwipeMoveDetails {
|
|
15
|
+
point: Point;
|
|
16
|
+
target: Element | null;
|
|
17
|
+
event: PointerEvent | TouchEvent;
|
|
18
|
+
pointerType: SwipePointerType;
|
|
19
|
+
axis: GestureAxis;
|
|
20
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
21
|
+
}
|
|
22
|
+
interface SwipeEndDetails {
|
|
23
|
+
point: Point;
|
|
24
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
25
|
+
}
|
|
26
|
+
interface SwipeStartDetails {
|
|
27
|
+
point: Point;
|
|
28
|
+
target: Element | null;
|
|
29
|
+
event: PointerEvent | TouchEvent;
|
|
30
|
+
pointerType: SwipePointerType;
|
|
31
|
+
axis: GestureAxis;
|
|
32
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
33
|
+
}
|
|
34
|
+
interface SwipeInterruptDetails {
|
|
35
|
+
reason: "visibility-hidden" | "lost-pointer-capture";
|
|
36
|
+
event: Event | Document;
|
|
37
|
+
target: Element | null;
|
|
38
|
+
pointerType: SwipePointerType | null;
|
|
39
|
+
}
|
|
40
|
+
interface SwipeTrackingOptions {
|
|
41
|
+
getDoc: () => Document;
|
|
42
|
+
getSelectionTarget?: () => HTMLElement | null;
|
|
43
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
44
|
+
onStart?: (details: SwipeStartDetails) => void;
|
|
45
|
+
onMove: (details: SwipeMoveDetails) => void;
|
|
46
|
+
onEnd: (details: SwipeEndDetails) => void;
|
|
47
|
+
onCancel: () => void;
|
|
48
|
+
preventDefault?: (details: SwipeMoveDetails) => boolean;
|
|
49
|
+
cancelOnInterrupt?: (details: SwipeInterruptDetails) => boolean;
|
|
50
|
+
}
|
|
51
|
+
interface PendingSwipeOptions {
|
|
52
|
+
getWin: () => Window;
|
|
53
|
+
pointerId: number;
|
|
54
|
+
startPoint: Point;
|
|
55
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
56
|
+
onCommit: (point: Point) => void;
|
|
57
|
+
canCommit?: () => boolean;
|
|
58
|
+
onCancel?: () => void;
|
|
59
|
+
}
|
|
60
|
+
declare class SwipeSession {
|
|
61
|
+
private startPoint;
|
|
62
|
+
private velocity;
|
|
63
|
+
private samples;
|
|
64
|
+
private sampleStartIndex;
|
|
65
|
+
private gestureStartAxis;
|
|
66
|
+
private gestureStartTime;
|
|
67
|
+
private gestureSign;
|
|
68
|
+
private pendingSwipe;
|
|
69
|
+
setStartPoint(point: Point): void;
|
|
70
|
+
clearStartPoint(): void;
|
|
71
|
+
getStartPoint(): Point | null;
|
|
72
|
+
getGestureAxis(direction: PhysicalSwipeDirection): GestureAxis;
|
|
73
|
+
getGestureSign(direction: PhysicalSwipeDirection): number;
|
|
74
|
+
private getAxisValue;
|
|
75
|
+
getMainAxisDisplacement(point: Point, axis: GestureAxis, sign: number): number;
|
|
76
|
+
getCrossAxisDisplacement(point: Point, axis: GestureAxis): number;
|
|
77
|
+
track(point: Point, axis: GestureAxis, sign: number): void;
|
|
78
|
+
getReleaseVelocity(): number;
|
|
79
|
+
clearVelocityTracking(): void;
|
|
80
|
+
clear(): void;
|
|
81
|
+
startDeferredSwipe(options: PendingSwipeOptions): void;
|
|
82
|
+
cancelDeferredSwipe(): void;
|
|
83
|
+
bind(options: SwipeTrackingOptions): () => void;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/machines/drawer/utils/drawer-session.d.ts
|
|
87
|
+
interface ContentPointerDownOptions {
|
|
88
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
89
|
+
getDoc: () => Document;
|
|
90
|
+
getContentEl: () => HTMLElement | null;
|
|
91
|
+
getWin: () => Window;
|
|
92
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
93
|
+
canCommit: () => boolean;
|
|
94
|
+
onCommit: (point: Point) => void;
|
|
95
|
+
}
|
|
96
|
+
interface GrabberPointerDownOptions {
|
|
97
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
98
|
+
point: Point;
|
|
99
|
+
canCommit: () => boolean;
|
|
100
|
+
onCommit: (point: Point) => void;
|
|
101
|
+
}
|
|
102
|
+
declare class DrawerSwipeSession {
|
|
103
|
+
readonly session: SwipeSession;
|
|
104
|
+
private dragOffset;
|
|
105
|
+
private readonly preventDragOnScroll;
|
|
106
|
+
constructor(options: DrawerSwipeSessionOptions);
|
|
107
|
+
contentPointerDown(options: ContentPointerDownOptions): void;
|
|
108
|
+
grabberPointerDown(options: GrabberPointerDownOptions): void;
|
|
109
|
+
private adjustReleaseVelocityAgainstDisplacement;
|
|
110
|
+
private adjustReleaseVelocityForOpenSwipe;
|
|
111
|
+
beginSwipe(point: Point): void;
|
|
112
|
+
clearSwipeStart(): void;
|
|
113
|
+
getSwipeStart(): Point | null;
|
|
114
|
+
getDragOffset(): number | null;
|
|
115
|
+
resetDragOffset(): void;
|
|
116
|
+
resetVelocity(): void;
|
|
117
|
+
reset(): void;
|
|
118
|
+
setDragOffset(point: Point, resolvedActiveSnapPointOffset: number, direction: PhysicalSwipeDirection): void;
|
|
119
|
+
setSwipeOpenOffset(point: Point, contentSize: number, direction: PhysicalSwipeDirection): void;
|
|
120
|
+
canStartDrag(point: Point, target: EventTarget | null, container: HTMLElement | null, preventDragOnScroll: boolean, direction: PhysicalSwipeDirection): boolean;
|
|
121
|
+
resolveSnapPointOnRelease(snapPoints: ResolvedSnapPoint[], snapPoint: ResolvedSnapPoint | null, snapToSequentialPoints: boolean, contentSize: number): number | string | null;
|
|
122
|
+
shouldOpenOnRelease(contentSize: number | null, swipeVelocityThreshold: number, openThreshold: number): boolean;
|
|
123
|
+
shouldDismissOnRelease(contentSize: number | null, snapPoints: ResolvedSnapPoint[], resolvedSnapOffset: number): boolean;
|
|
124
|
+
getSwipeStrength(targetOffset: number, resolvedSnapOffset?: number | null): number;
|
|
125
|
+
bindDragTracking(options: DragTrackingOptions): () => void;
|
|
126
|
+
bindSwipeOpenTracking(options: SwipeOpenTrackingOptions): () => void;
|
|
127
|
+
}
|
|
128
|
+
interface DrawerSwipeSessionOptions {
|
|
129
|
+
preventDragOnScroll: () => boolean;
|
|
130
|
+
}
|
|
131
|
+
interface DragTrackingOptions {
|
|
132
|
+
getDoc: () => Document;
|
|
133
|
+
getContentEl: () => HTMLElement | null;
|
|
134
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
135
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
136
|
+
onMove: (details: {
|
|
137
|
+
point: Point;
|
|
138
|
+
target: Element | null;
|
|
139
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
140
|
+
}) => void;
|
|
141
|
+
onEnd: (details: {
|
|
142
|
+
point: Point;
|
|
143
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
144
|
+
}) => void;
|
|
145
|
+
onCancel: () => void;
|
|
146
|
+
}
|
|
147
|
+
interface SwipeOpenTrackingOptions {
|
|
148
|
+
getDoc: () => Document;
|
|
149
|
+
getContentEl: () => HTMLElement | null;
|
|
150
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
151
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
152
|
+
onMove: (details: {
|
|
153
|
+
point: Point;
|
|
154
|
+
}) => void;
|
|
155
|
+
onEnd: (details: {
|
|
156
|
+
point: Point;
|
|
157
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
158
|
+
}) => void;
|
|
159
|
+
onCancel: () => void;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/machines/drawer/drawer.types.d.ts
|
|
163
|
+
type SwipeDirection = "up" | "down" | "start" | "end";
|
|
164
|
+
type SnapPoint = number | string;
|
|
165
|
+
interface OpenChangeDetails {
|
|
166
|
+
open: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface ResolvedSnapPoint {
|
|
169
|
+
value: SnapPoint;
|
|
170
|
+
height: number;
|
|
171
|
+
offset: number;
|
|
172
|
+
}
|
|
173
|
+
interface SnapPointChangeDetails {
|
|
174
|
+
snapPoint: SnapPoint | null;
|
|
175
|
+
}
|
|
176
|
+
interface DrawerStackSnapshot {
|
|
177
|
+
active: boolean;
|
|
178
|
+
openCount: number;
|
|
179
|
+
swipeProgress: number;
|
|
180
|
+
frontmostHeight: number;
|
|
181
|
+
}
|
|
182
|
+
interface DrawerStack {
|
|
183
|
+
getSnapshot(): DrawerStackSnapshot;
|
|
184
|
+
subscribe(listener: () => void): () => void;
|
|
185
|
+
register(id: string): void;
|
|
186
|
+
unregister(id: string): void;
|
|
187
|
+
setOpen(id: string, open: boolean): void;
|
|
188
|
+
setHeight(id: string, height: number): void;
|
|
189
|
+
setSwipe(id: string, swiping: boolean, progress: number): void;
|
|
190
|
+
}
|
|
191
|
+
interface DrawerStackApi<T extends PropTypes = PropTypes> {
|
|
192
|
+
getIndentProps(): T["element"];
|
|
193
|
+
getIndentBackgroundProps(): T["element"];
|
|
194
|
+
}
|
|
195
|
+
type ElementIds = Partial<{
|
|
196
|
+
backdrop: string;
|
|
197
|
+
positioner: string;
|
|
198
|
+
content: string;
|
|
199
|
+
title: string;
|
|
200
|
+
description: string;
|
|
201
|
+
header: string;
|
|
202
|
+
trigger: string;
|
|
203
|
+
grabber: string;
|
|
204
|
+
grabberIndicator: string;
|
|
205
|
+
closeTrigger: string;
|
|
206
|
+
swipeArea: string;
|
|
207
|
+
}>;
|
|
208
|
+
interface DrawerProps extends DirectionProperty, CommonProperties, DismissableElementHandlers {
|
|
209
|
+
ids?: ElementIds;
|
|
210
|
+
trapFocus?: boolean | undefined;
|
|
211
|
+
preventScroll?: boolean | undefined;
|
|
212
|
+
modal?: boolean | undefined;
|
|
213
|
+
initialFocusEl?: (() => MaybeElement) | undefined;
|
|
214
|
+
finalFocusEl?: (() => MaybeElement) | undefined;
|
|
215
|
+
restoreFocus?: boolean | undefined;
|
|
216
|
+
role?: "dialog" | "alertdialog" | undefined;
|
|
217
|
+
open?: boolean | undefined;
|
|
218
|
+
defaultOpen?: boolean | undefined;
|
|
219
|
+
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
220
|
+
closeOnInteractOutside?: boolean | undefined;
|
|
221
|
+
closeOnEscape?: boolean | undefined;
|
|
222
|
+
snapPoints?: SnapPoint[] | undefined;
|
|
223
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
224
|
+
snapToSequentialPoints?: boolean | undefined;
|
|
225
|
+
swipeVelocityThreshold?: number;
|
|
226
|
+
closeThreshold?: number;
|
|
227
|
+
preventDragOnScroll?: boolean;
|
|
228
|
+
snapPoint?: SnapPoint | null | undefined;
|
|
229
|
+
defaultSnapPoint?: SnapPoint | null | undefined;
|
|
230
|
+
onSnapPointChange?: ((details: SnapPointChangeDetails) => void) | undefined;
|
|
231
|
+
stack?: DrawerStack | undefined;
|
|
232
|
+
}
|
|
233
|
+
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "trapFocus" | "restoreFocus" | "preventScroll" | "initialFocusEl" | "snapPoints" | "swipeDirection" | "snapToSequentialPoints" | "swipeVelocityThreshold" | "closeThreshold" | "preventDragOnScroll" | "defaultSnapPoint";
|
|
234
|
+
interface DrawerSchema {
|
|
235
|
+
props: RequiredBy<DrawerProps, PropsWithDefault>;
|
|
236
|
+
state: "open" | "closed" | "closing" | "swipe-area-dragging" | "swiping-open";
|
|
237
|
+
tag: "open" | "closed";
|
|
238
|
+
context: {
|
|
239
|
+
dragOffset: number | null;
|
|
240
|
+
snapPoint: SnapPoint | null;
|
|
241
|
+
resolvedActiveSnapPoint: ResolvedSnapPoint | null;
|
|
242
|
+
contentSize: number | null;
|
|
243
|
+
viewportSize: number;
|
|
244
|
+
rootFontSize: number;
|
|
245
|
+
swipeStrength: number;
|
|
246
|
+
rendered: {
|
|
247
|
+
title: boolean;
|
|
248
|
+
description: boolean;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
refs: {
|
|
252
|
+
swipeSession: DrawerSwipeSession;
|
|
253
|
+
};
|
|
254
|
+
computed: {
|
|
255
|
+
drawerId: string;
|
|
256
|
+
physicalSwipeDirection: PhysicalSwipeDirection;
|
|
257
|
+
resolvedSnapPoints: ResolvedSnapPoint[];
|
|
258
|
+
};
|
|
259
|
+
event: EventObject;
|
|
260
|
+
action: string;
|
|
261
|
+
guard: string;
|
|
262
|
+
effect: string;
|
|
263
|
+
}
|
|
264
|
+
type DrawerService = Service<DrawerSchema>;
|
|
265
|
+
type DrawerMachine = Machine<DrawerSchema>;
|
|
266
|
+
interface ContentProps {
|
|
267
|
+
draggable?: boolean | undefined;
|
|
268
|
+
}
|
|
269
|
+
interface SwipeAreaProps {
|
|
270
|
+
disabled?: boolean | undefined;
|
|
271
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
272
|
+
}
|
|
273
|
+
interface DrawerApi<T extends PropTypes = PropTypes> {
|
|
274
|
+
open: boolean;
|
|
275
|
+
dragging: boolean;
|
|
276
|
+
setOpen: (open: boolean) => void;
|
|
277
|
+
snapPoints: SnapPoint[];
|
|
278
|
+
swipeDirection: SwipeDirection;
|
|
279
|
+
snapPoint: SnapPoint | null;
|
|
280
|
+
setSnapPoint: (snapPoint: SnapPoint | null) => void;
|
|
281
|
+
getOpenPercentage: () => number;
|
|
282
|
+
getSnapPointIndex: () => number;
|
|
283
|
+
getContentSize: () => number | null;
|
|
284
|
+
getPositionerProps: () => T["element"];
|
|
285
|
+
getContentProps: (props?: ContentProps) => T["element"];
|
|
286
|
+
getTitleProps: () => T["element"];
|
|
287
|
+
getDescriptionProps: () => T["element"];
|
|
288
|
+
getTriggerProps: () => T["element"];
|
|
289
|
+
getBackdropProps: () => T["element"];
|
|
290
|
+
getGrabberProps: () => T["element"];
|
|
291
|
+
getGrabberIndicatorProps: () => T["element"];
|
|
292
|
+
getCloseTriggerProps: () => T["element"];
|
|
293
|
+
getSwipeAreaProps: (props?: SwipeAreaProps) => T["element"];
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/machines/drawer/drawer.connect.d.ts
|
|
297
|
+
declare function connect<T extends PropTypes>(service: DrawerService, normalize: NormalizeProps<T>): DrawerApi<T>;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/machines/drawer/drawer.machine.d.ts
|
|
300
|
+
declare const machine: Machine<DrawerSchema>;
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/machines/drawer/drawer.props.d.ts
|
|
303
|
+
declare const props: (keyof DrawerProps)[];
|
|
304
|
+
declare const splitProps: <Props extends Partial<DrawerProps>>(props: Props) => [Partial<DrawerProps>, Omit<Props, keyof DrawerProps>];
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/machines/drawer/drawer.stack.d.ts
|
|
307
|
+
declare function createStack(): DrawerStack;
|
|
308
|
+
declare function connectStack<T extends PropTypes>(snapshot: DrawerStackSnapshot, normalize: NormalizeProps<T>): DrawerStackApi<T>;
|
|
309
|
+
//#endregion
|
|
310
|
+
export { type DrawerApi as Api, type ContentProps, type DrawerStack, type DrawerStackApi, type DrawerStackSnapshot, type ElementIds, type FocusOutsideEvent, type InteractOutsideEvent, type DrawerMachine as Machine, type OpenChangeDetails, type PointerDownOutsideEvent, type DrawerProps as Props, type ResolvedSnapPoint, type DrawerService as Service, type SnapPoint, type SnapPointChangeDetails, type SwipeDirection, anatomy, connect, connectStack, createStack, machine, props, splitProps };
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { n as AnatomyInstance } from "../../create-anatomy-BedZVdg0.mjs";
|
|
2
|
+
import { p as Machine, u as EventObject, y as Service } from "../../types-DUM9rzfD.mjs";
|
|
3
|
+
import { C as JSX, b as NormalizeProps, g as RequiredBy, p as Point, r as DirectionProperty, s as MaybeElement, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
4
|
+
import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOutsideEvent } from "../../index-CGNNiDyE.mjs";
|
|
5
|
+
import { t as DismissableElementHandlers } from "../../dismissable-layer-h14gHVbJ.mjs";
|
|
6
|
+
|
|
7
|
+
//#region src/machines/drawer/drawer.anatomy.d.ts
|
|
8
|
+
declare const anatomy: AnatomyInstance<"trigger" | "title" | "content" | "description" | "positioner" | "backdrop" | "closeTrigger" | "grabber" | "grabberIndicator" | "swipeArea">;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/machines/drawer/utils/session.d.ts
|
|
11
|
+
type GestureAxis = "x" | "y";
|
|
12
|
+
type PhysicalSwipeDirection = "up" | "down" | "left" | "right";
|
|
13
|
+
type SwipePointerType = "mouse" | "pen" | "touch";
|
|
14
|
+
interface SwipeMoveDetails {
|
|
15
|
+
point: Point;
|
|
16
|
+
target: Element | null;
|
|
17
|
+
event: PointerEvent | TouchEvent;
|
|
18
|
+
pointerType: SwipePointerType;
|
|
19
|
+
axis: GestureAxis;
|
|
20
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
21
|
+
}
|
|
22
|
+
interface SwipeEndDetails {
|
|
23
|
+
point: Point;
|
|
24
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
25
|
+
}
|
|
26
|
+
interface SwipeStartDetails {
|
|
27
|
+
point: Point;
|
|
28
|
+
target: Element | null;
|
|
29
|
+
event: PointerEvent | TouchEvent;
|
|
30
|
+
pointerType: SwipePointerType;
|
|
31
|
+
axis: GestureAxis;
|
|
32
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
33
|
+
}
|
|
34
|
+
interface SwipeInterruptDetails {
|
|
35
|
+
reason: "visibility-hidden" | "lost-pointer-capture";
|
|
36
|
+
event: Event | Document;
|
|
37
|
+
target: Element | null;
|
|
38
|
+
pointerType: SwipePointerType | null;
|
|
39
|
+
}
|
|
40
|
+
interface SwipeTrackingOptions {
|
|
41
|
+
getDoc: () => Document;
|
|
42
|
+
getSelectionTarget?: () => HTMLElement | null;
|
|
43
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
44
|
+
onStart?: (details: SwipeStartDetails) => void;
|
|
45
|
+
onMove: (details: SwipeMoveDetails) => void;
|
|
46
|
+
onEnd: (details: SwipeEndDetails) => void;
|
|
47
|
+
onCancel: () => void;
|
|
48
|
+
preventDefault?: (details: SwipeMoveDetails) => boolean;
|
|
49
|
+
cancelOnInterrupt?: (details: SwipeInterruptDetails) => boolean;
|
|
50
|
+
}
|
|
51
|
+
interface PendingSwipeOptions {
|
|
52
|
+
getWin: () => Window;
|
|
53
|
+
pointerId: number;
|
|
54
|
+
startPoint: Point;
|
|
55
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
56
|
+
onCommit: (point: Point) => void;
|
|
57
|
+
canCommit?: () => boolean;
|
|
58
|
+
onCancel?: () => void;
|
|
59
|
+
}
|
|
60
|
+
declare class SwipeSession {
|
|
61
|
+
private startPoint;
|
|
62
|
+
private velocity;
|
|
63
|
+
private samples;
|
|
64
|
+
private sampleStartIndex;
|
|
65
|
+
private gestureStartAxis;
|
|
66
|
+
private gestureStartTime;
|
|
67
|
+
private gestureSign;
|
|
68
|
+
private pendingSwipe;
|
|
69
|
+
setStartPoint(point: Point): void;
|
|
70
|
+
clearStartPoint(): void;
|
|
71
|
+
getStartPoint(): Point | null;
|
|
72
|
+
getGestureAxis(direction: PhysicalSwipeDirection): GestureAxis;
|
|
73
|
+
getGestureSign(direction: PhysicalSwipeDirection): number;
|
|
74
|
+
private getAxisValue;
|
|
75
|
+
getMainAxisDisplacement(point: Point, axis: GestureAxis, sign: number): number;
|
|
76
|
+
getCrossAxisDisplacement(point: Point, axis: GestureAxis): number;
|
|
77
|
+
track(point: Point, axis: GestureAxis, sign: number): void;
|
|
78
|
+
getReleaseVelocity(): number;
|
|
79
|
+
clearVelocityTracking(): void;
|
|
80
|
+
clear(): void;
|
|
81
|
+
startDeferredSwipe(options: PendingSwipeOptions): void;
|
|
82
|
+
cancelDeferredSwipe(): void;
|
|
83
|
+
bind(options: SwipeTrackingOptions): () => void;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/machines/drawer/utils/drawer-session.d.ts
|
|
87
|
+
interface ContentPointerDownOptions {
|
|
88
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
89
|
+
getDoc: () => Document;
|
|
90
|
+
getContentEl: () => HTMLElement | null;
|
|
91
|
+
getWin: () => Window;
|
|
92
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
93
|
+
canCommit: () => boolean;
|
|
94
|
+
onCommit: (point: Point) => void;
|
|
95
|
+
}
|
|
96
|
+
interface GrabberPointerDownOptions {
|
|
97
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
98
|
+
point: Point;
|
|
99
|
+
canCommit: () => boolean;
|
|
100
|
+
onCommit: (point: Point) => void;
|
|
101
|
+
}
|
|
102
|
+
declare class DrawerSwipeSession {
|
|
103
|
+
readonly session: SwipeSession;
|
|
104
|
+
private dragOffset;
|
|
105
|
+
private readonly preventDragOnScroll;
|
|
106
|
+
constructor(options: DrawerSwipeSessionOptions);
|
|
107
|
+
contentPointerDown(options: ContentPointerDownOptions): void;
|
|
108
|
+
grabberPointerDown(options: GrabberPointerDownOptions): void;
|
|
109
|
+
private adjustReleaseVelocityAgainstDisplacement;
|
|
110
|
+
private adjustReleaseVelocityForOpenSwipe;
|
|
111
|
+
beginSwipe(point: Point): void;
|
|
112
|
+
clearSwipeStart(): void;
|
|
113
|
+
getSwipeStart(): Point | null;
|
|
114
|
+
getDragOffset(): number | null;
|
|
115
|
+
resetDragOffset(): void;
|
|
116
|
+
resetVelocity(): void;
|
|
117
|
+
reset(): void;
|
|
118
|
+
setDragOffset(point: Point, resolvedActiveSnapPointOffset: number, direction: PhysicalSwipeDirection): void;
|
|
119
|
+
setSwipeOpenOffset(point: Point, contentSize: number, direction: PhysicalSwipeDirection): void;
|
|
120
|
+
canStartDrag(point: Point, target: EventTarget | null, container: HTMLElement | null, preventDragOnScroll: boolean, direction: PhysicalSwipeDirection): boolean;
|
|
121
|
+
resolveSnapPointOnRelease(snapPoints: ResolvedSnapPoint[], snapPoint: ResolvedSnapPoint | null, snapToSequentialPoints: boolean, contentSize: number): number | string | null;
|
|
122
|
+
shouldOpenOnRelease(contentSize: number | null, swipeVelocityThreshold: number, openThreshold: number): boolean;
|
|
123
|
+
shouldDismissOnRelease(contentSize: number | null, snapPoints: ResolvedSnapPoint[], resolvedSnapOffset: number): boolean;
|
|
124
|
+
getSwipeStrength(targetOffset: number, resolvedSnapOffset?: number | null): number;
|
|
125
|
+
bindDragTracking(options: DragTrackingOptions): () => void;
|
|
126
|
+
bindSwipeOpenTracking(options: SwipeOpenTrackingOptions): () => void;
|
|
127
|
+
}
|
|
128
|
+
interface DrawerSwipeSessionOptions {
|
|
129
|
+
preventDragOnScroll: () => boolean;
|
|
130
|
+
}
|
|
131
|
+
interface DragTrackingOptions {
|
|
132
|
+
getDoc: () => Document;
|
|
133
|
+
getContentEl: () => HTMLElement | null;
|
|
134
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
135
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
136
|
+
onMove: (details: {
|
|
137
|
+
point: Point;
|
|
138
|
+
target: Element | null;
|
|
139
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
140
|
+
}) => void;
|
|
141
|
+
onEnd: (details: {
|
|
142
|
+
point: Point;
|
|
143
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
144
|
+
}) => void;
|
|
145
|
+
onCancel: () => void;
|
|
146
|
+
}
|
|
147
|
+
interface SwipeOpenTrackingOptions {
|
|
148
|
+
getDoc: () => Document;
|
|
149
|
+
getContentEl: () => HTMLElement | null;
|
|
150
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
151
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
152
|
+
onMove: (details: {
|
|
153
|
+
point: Point;
|
|
154
|
+
}) => void;
|
|
155
|
+
onEnd: (details: {
|
|
156
|
+
point: Point;
|
|
157
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
158
|
+
}) => void;
|
|
159
|
+
onCancel: () => void;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/machines/drawer/drawer.types.d.ts
|
|
163
|
+
type SwipeDirection = "up" | "down" | "start" | "end";
|
|
164
|
+
type SnapPoint = number | string;
|
|
165
|
+
interface OpenChangeDetails {
|
|
166
|
+
open: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface ResolvedSnapPoint {
|
|
169
|
+
value: SnapPoint;
|
|
170
|
+
height: number;
|
|
171
|
+
offset: number;
|
|
172
|
+
}
|
|
173
|
+
interface SnapPointChangeDetails {
|
|
174
|
+
snapPoint: SnapPoint | null;
|
|
175
|
+
}
|
|
176
|
+
interface DrawerStackSnapshot {
|
|
177
|
+
active: boolean;
|
|
178
|
+
openCount: number;
|
|
179
|
+
swipeProgress: number;
|
|
180
|
+
frontmostHeight: number;
|
|
181
|
+
}
|
|
182
|
+
interface DrawerStack {
|
|
183
|
+
getSnapshot(): DrawerStackSnapshot;
|
|
184
|
+
subscribe(listener: () => void): () => void;
|
|
185
|
+
register(id: string): void;
|
|
186
|
+
unregister(id: string): void;
|
|
187
|
+
setOpen(id: string, open: boolean): void;
|
|
188
|
+
setHeight(id: string, height: number): void;
|
|
189
|
+
setSwipe(id: string, swiping: boolean, progress: number): void;
|
|
190
|
+
}
|
|
191
|
+
interface DrawerStackApi<T extends PropTypes = PropTypes> {
|
|
192
|
+
getIndentProps(): T["element"];
|
|
193
|
+
getIndentBackgroundProps(): T["element"];
|
|
194
|
+
}
|
|
195
|
+
type ElementIds = Partial<{
|
|
196
|
+
backdrop: string;
|
|
197
|
+
positioner: string;
|
|
198
|
+
content: string;
|
|
199
|
+
title: string;
|
|
200
|
+
description: string;
|
|
201
|
+
header: string;
|
|
202
|
+
trigger: string;
|
|
203
|
+
grabber: string;
|
|
204
|
+
grabberIndicator: string;
|
|
205
|
+
closeTrigger: string;
|
|
206
|
+
swipeArea: string;
|
|
207
|
+
}>;
|
|
208
|
+
interface DrawerProps extends DirectionProperty, CommonProperties, DismissableElementHandlers {
|
|
209
|
+
ids?: ElementIds;
|
|
210
|
+
trapFocus?: boolean | undefined;
|
|
211
|
+
preventScroll?: boolean | undefined;
|
|
212
|
+
modal?: boolean | undefined;
|
|
213
|
+
initialFocusEl?: (() => MaybeElement) | undefined;
|
|
214
|
+
finalFocusEl?: (() => MaybeElement) | undefined;
|
|
215
|
+
restoreFocus?: boolean | undefined;
|
|
216
|
+
role?: "dialog" | "alertdialog" | undefined;
|
|
217
|
+
open?: boolean | undefined;
|
|
218
|
+
defaultOpen?: boolean | undefined;
|
|
219
|
+
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
220
|
+
closeOnInteractOutside?: boolean | undefined;
|
|
221
|
+
closeOnEscape?: boolean | undefined;
|
|
222
|
+
snapPoints?: SnapPoint[] | undefined;
|
|
223
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
224
|
+
snapToSequentialPoints?: boolean | undefined;
|
|
225
|
+
swipeVelocityThreshold?: number;
|
|
226
|
+
closeThreshold?: number;
|
|
227
|
+
preventDragOnScroll?: boolean;
|
|
228
|
+
snapPoint?: SnapPoint | null | undefined;
|
|
229
|
+
defaultSnapPoint?: SnapPoint | null | undefined;
|
|
230
|
+
onSnapPointChange?: ((details: SnapPointChangeDetails) => void) | undefined;
|
|
231
|
+
stack?: DrawerStack | undefined;
|
|
232
|
+
}
|
|
233
|
+
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "trapFocus" | "restoreFocus" | "preventScroll" | "initialFocusEl" | "snapPoints" | "swipeDirection" | "snapToSequentialPoints" | "swipeVelocityThreshold" | "closeThreshold" | "preventDragOnScroll" | "defaultSnapPoint";
|
|
234
|
+
interface DrawerSchema {
|
|
235
|
+
props: RequiredBy<DrawerProps, PropsWithDefault>;
|
|
236
|
+
state: "open" | "closed" | "closing" | "swipe-area-dragging" | "swiping-open";
|
|
237
|
+
tag: "open" | "closed";
|
|
238
|
+
context: {
|
|
239
|
+
dragOffset: number | null;
|
|
240
|
+
snapPoint: SnapPoint | null;
|
|
241
|
+
resolvedActiveSnapPoint: ResolvedSnapPoint | null;
|
|
242
|
+
contentSize: number | null;
|
|
243
|
+
viewportSize: number;
|
|
244
|
+
rootFontSize: number;
|
|
245
|
+
swipeStrength: number;
|
|
246
|
+
rendered: {
|
|
247
|
+
title: boolean;
|
|
248
|
+
description: boolean;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
refs: {
|
|
252
|
+
swipeSession: DrawerSwipeSession;
|
|
253
|
+
};
|
|
254
|
+
computed: {
|
|
255
|
+
drawerId: string;
|
|
256
|
+
physicalSwipeDirection: PhysicalSwipeDirection;
|
|
257
|
+
resolvedSnapPoints: ResolvedSnapPoint[];
|
|
258
|
+
};
|
|
259
|
+
event: EventObject;
|
|
260
|
+
action: string;
|
|
261
|
+
guard: string;
|
|
262
|
+
effect: string;
|
|
263
|
+
}
|
|
264
|
+
type DrawerService = Service<DrawerSchema>;
|
|
265
|
+
type DrawerMachine = Machine<DrawerSchema>;
|
|
266
|
+
interface ContentProps {
|
|
267
|
+
draggable?: boolean | undefined;
|
|
268
|
+
}
|
|
269
|
+
interface SwipeAreaProps {
|
|
270
|
+
disabled?: boolean | undefined;
|
|
271
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
272
|
+
}
|
|
273
|
+
interface DrawerApi<T extends PropTypes = PropTypes> {
|
|
274
|
+
open: boolean;
|
|
275
|
+
dragging: boolean;
|
|
276
|
+
setOpen: (open: boolean) => void;
|
|
277
|
+
snapPoints: SnapPoint[];
|
|
278
|
+
swipeDirection: SwipeDirection;
|
|
279
|
+
snapPoint: SnapPoint | null;
|
|
280
|
+
setSnapPoint: (snapPoint: SnapPoint | null) => void;
|
|
281
|
+
getOpenPercentage: () => number;
|
|
282
|
+
getSnapPointIndex: () => number;
|
|
283
|
+
getContentSize: () => number | null;
|
|
284
|
+
getPositionerProps: () => T["element"];
|
|
285
|
+
getContentProps: (props?: ContentProps) => T["element"];
|
|
286
|
+
getTitleProps: () => T["element"];
|
|
287
|
+
getDescriptionProps: () => T["element"];
|
|
288
|
+
getTriggerProps: () => T["element"];
|
|
289
|
+
getBackdropProps: () => T["element"];
|
|
290
|
+
getGrabberProps: () => T["element"];
|
|
291
|
+
getGrabberIndicatorProps: () => T["element"];
|
|
292
|
+
getCloseTriggerProps: () => T["element"];
|
|
293
|
+
getSwipeAreaProps: (props?: SwipeAreaProps) => T["element"];
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/machines/drawer/drawer.connect.d.ts
|
|
297
|
+
declare function connect<T extends PropTypes>(service: DrawerService, normalize: NormalizeProps<T>): DrawerApi<T>;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/machines/drawer/drawer.machine.d.ts
|
|
300
|
+
declare const machine: Machine<DrawerSchema>;
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/machines/drawer/drawer.props.d.ts
|
|
303
|
+
declare const props: (keyof DrawerProps)[];
|
|
304
|
+
declare const splitProps: <Props extends Partial<DrawerProps>>(props: Props) => [Partial<DrawerProps>, Omit<Props, keyof DrawerProps>];
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/machines/drawer/drawer.stack.d.ts
|
|
307
|
+
declare function createStack(): DrawerStack;
|
|
308
|
+
declare function connectStack<T extends PropTypes>(snapshot: DrawerStackSnapshot, normalize: NormalizeProps<T>): DrawerStackApi<T>;
|
|
309
|
+
//#endregion
|
|
310
|
+
export { type DrawerApi as Api, type ContentProps, type DrawerStack, type DrawerStackApi, type DrawerStackSnapshot, type ElementIds, type FocusOutsideEvent, type InteractOutsideEvent, type DrawerMachine as Machine, type OpenChangeDetails, type PointerDownOutsideEvent, type DrawerProps as Props, type ResolvedSnapPoint, type DrawerService as Service, type SnapPoint, type SnapPointChangeDetails, type SwipeDirection, anatomy, connect, connectStack, createStack, machine, props, splitProps };
|