@surdeddd/bottom-sheet 0.2.0 → 0.4.0
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/README.md +51 -21
- package/dist/{BottomSheetEngine-CIT9Htti.d.cts → BottomSheetEngine-BJrH7qY3.d.cts} +105 -3
- package/dist/{BottomSheetEngine-Df9MwBbm.d.ts → BottomSheetEngine-L05jGZvU.d.ts} +105 -3
- package/dist/element.cjs +1170 -196
- package/dist/element.d.cts +29 -5
- package/dist/element.d.ts +29 -5
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +1170 -196
- package/dist/index.cjs +1051 -220
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +1049 -221
- package/dist/integrations/formik.d.cts +1 -1
- package/dist/integrations/formik.d.ts +1 -1
- package/dist/integrations/react-hook-form.d.cts +1 -1
- package/dist/integrations/react-hook-form.d.ts +1 -1
- package/dist/overlay.cjs +181 -37
- package/dist/overlay.d.cts +13 -0
- package/dist/overlay.d.ts +13 -0
- package/dist/overlay.js +181 -37
- package/dist/preact.d.cts +1 -1
- package/dist/preact.d.ts +1 -1
- package/dist/qwik.cjs +966 -195
- package/dist/qwik.d.cts +4 -2
- package/dist/qwik.d.ts +4 -2
- package/dist/qwik.js +967 -196
- package/dist/react.cjs +1242 -272
- package/dist/react.d.cts +47 -5
- package/dist/react.d.ts +47 -5
- package/dist/react.js +1242 -272
- package/dist/solid.cjs +992 -236
- package/dist/solid.d.cts +299 -4
- package/dist/solid.d.ts +299 -4
- package/dist/solid.js +993 -237
- package/dist/solid.source.jsx +3476 -0
- package/dist/styles.css +67 -66
- package/dist/svelte-core.cjs +3415 -0
- package/dist/svelte-core.js +3413 -0
- package/dist/svelte-src/BottomSheet.svelte +308 -0
- package/dist/svelte-src/index.js +2 -0
- package/dist/svelte.cjs +1034 -207
- package/dist/svelte.d.cts +121 -0
- package/dist/svelte.d.ts +28 -3
- package/dist/svelte.js +1035 -208
- package/dist/vue.cjs +1191 -205
- package/dist/vue.d.cts +127 -0
- package/dist/vue.d.ts +57 -4
- package/dist/vue.js +1192 -206
- package/package.json +105 -45
package/dist/vue.d.cts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { DefineComponent } from "vue";
|
|
2
|
+
import type {
|
|
3
|
+
AnchorOptions,
|
|
4
|
+
BottomSheetEngine,
|
|
5
|
+
CloseReason,
|
|
6
|
+
EngineOptions,
|
|
7
|
+
EngineState,
|
|
8
|
+
SheetEventMap,
|
|
9
|
+
SheetMode,
|
|
10
|
+
SnapPoint,
|
|
11
|
+
SnapPointDef,
|
|
12
|
+
ScrimStagesOptions,
|
|
13
|
+
ScrimUpdate,
|
|
14
|
+
ScrimOverlayOptions,
|
|
15
|
+
} from "./index.cjs";
|
|
16
|
+
|
|
17
|
+
export type UseBottomSheetVueOptions<TId extends string = string> = Omit<
|
|
18
|
+
EngineOptions,
|
|
19
|
+
| "element"
|
|
20
|
+
| "handle"
|
|
21
|
+
| "scrollContainer"
|
|
22
|
+
| "backdrop"
|
|
23
|
+
| "scrim"
|
|
24
|
+
| "snapPoints"
|
|
25
|
+
| "allowed"
|
|
26
|
+
| "initial"
|
|
27
|
+
> & {
|
|
28
|
+
snapPoints: SnapPointDef<TId>[] | ReadonlyArray<SnapPointDef<TId>>;
|
|
29
|
+
allowed?: TId[] | ReadonlyArray<TId>;
|
|
30
|
+
initial?: TId;
|
|
31
|
+
onSnap?: (id: TId) => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type UseBottomSheetVueReturn<TId extends string = string> = {
|
|
35
|
+
sheetRef: { value: HTMLElement | null };
|
|
36
|
+
handleRef: { value: HTMLElement | null };
|
|
37
|
+
contentRef: { value: HTMLElement | null };
|
|
38
|
+
backdropRef: { value: HTMLElement | null };
|
|
39
|
+
screenRef: { value: HTMLElement | null };
|
|
40
|
+
state: EngineState & { activeId: TId };
|
|
41
|
+
snapTo: (id: TId) => Promise<void>;
|
|
42
|
+
open: (id?: TId) => Promise<void>;
|
|
43
|
+
close: (reason?: CloseReason) => Promise<void>;
|
|
44
|
+
setAllowed: (ids: TId[], snap?: TId) => void;
|
|
45
|
+
setSnapPoints: (
|
|
46
|
+
points: EngineOptions["snapPoints"],
|
|
47
|
+
allowed?: string[],
|
|
48
|
+
) => void;
|
|
49
|
+
setScrim: (opts: ScrimUpdate) => void;
|
|
50
|
+
setScrimOverlay: (opts: ScrimOverlayOptions) => () => void;
|
|
51
|
+
addAnchor: (opts: AnchorOptions) => () => void;
|
|
52
|
+
setScrimStages: (opts: ScrimStagesOptions | null) => () => void;
|
|
53
|
+
recompute: () => void;
|
|
54
|
+
setScrimColor: (color: string | undefined | null) => void;
|
|
55
|
+
setBackdropRange: (range: [number, number]) => void;
|
|
56
|
+
setRadius: (r: string | number) => void;
|
|
57
|
+
setMaxHeight: (h: string | number) => void;
|
|
58
|
+
expand: () => Promise<void>;
|
|
59
|
+
collapse: () => Promise<void>;
|
|
60
|
+
isTop: () => boolean;
|
|
61
|
+
depth: () => number;
|
|
62
|
+
canDismiss: () => boolean;
|
|
63
|
+
on: <K extends keyof SheetEventMap>(
|
|
64
|
+
event: K,
|
|
65
|
+
fn: (payload: SheetEventMap[K]) => void,
|
|
66
|
+
) => () => void;
|
|
67
|
+
getEngine: () => BottomSheetEngine | null;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function useBottomSheet<TId extends string = string>(
|
|
71
|
+
opts: UseBottomSheetVueOptions<TId>,
|
|
72
|
+
): UseBottomSheetVueReturn<TId>;
|
|
73
|
+
|
|
74
|
+
export type VueAnchor<TId extends string = string> = Omit<
|
|
75
|
+
AnchorOptions,
|
|
76
|
+
"element"
|
|
77
|
+
> & { id: string };
|
|
78
|
+
|
|
79
|
+
export type BottomSheetProps<TId extends string = string> =
|
|
80
|
+
UseBottomSheetVueOptions<TId> & {
|
|
81
|
+
backdrop?: boolean;
|
|
82
|
+
closeOnBackdrop?: boolean;
|
|
83
|
+
ariaLabel?: string;
|
|
84
|
+
open?: boolean;
|
|
85
|
+
snap?: TId;
|
|
86
|
+
teleport?: boolean;
|
|
87
|
+
teleportTo?: string | HTMLElement;
|
|
88
|
+
anchors?: VueAnchor<TId>[];
|
|
89
|
+
scrimStages?: ScrimStagesOptions | null;
|
|
90
|
+
backdropColor?: string;
|
|
91
|
+
backdropOpacity?: number;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const BottomSheet: DefineComponent<
|
|
95
|
+
BottomSheetProps,
|
|
96
|
+
Record<string, never>,
|
|
97
|
+
Record<string, never>,
|
|
98
|
+
Record<string, never>,
|
|
99
|
+
Record<string, never>,
|
|
100
|
+
Record<string, never>,
|
|
101
|
+
Record<string, never>,
|
|
102
|
+
{
|
|
103
|
+
change: (state: EngineState) => void;
|
|
104
|
+
snap: (id: string) => void;
|
|
105
|
+
open: (id: string) => void;
|
|
106
|
+
close: () => void;
|
|
107
|
+
opened: (id: string) => void;
|
|
108
|
+
closed: () => void;
|
|
109
|
+
"before-close": (payload: {
|
|
110
|
+
reason: CloseReason;
|
|
111
|
+
cancel: () => void;
|
|
112
|
+
}) => void;
|
|
113
|
+
"drag-start": (payload: { size: number }) => void;
|
|
114
|
+
"drag-end": (payload: { size: number; velocity: number }) => void;
|
|
115
|
+
"update:open": (open: boolean) => void;
|
|
116
|
+
"update:snap": (id: string) => void;
|
|
117
|
+
}
|
|
118
|
+
>;
|
|
119
|
+
|
|
120
|
+
export type {
|
|
121
|
+
SnapPoint,
|
|
122
|
+
SnapPointDef,
|
|
123
|
+
SheetMode,
|
|
124
|
+
EngineState,
|
|
125
|
+
EngineOptions,
|
|
126
|
+
CloseReason,
|
|
127
|
+
};
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import type { DefineComponent } from "vue";
|
|
2
2
|
import type {
|
|
3
|
+
AnchorOptions,
|
|
4
|
+
BottomSheetEngine,
|
|
5
|
+
CloseReason,
|
|
3
6
|
EngineOptions,
|
|
4
7
|
EngineState,
|
|
5
8
|
SheetEventMap,
|
|
6
9
|
SheetMode,
|
|
7
10
|
SnapPoint,
|
|
8
11
|
SnapPointDef,
|
|
12
|
+
ScrimStagesOptions,
|
|
9
13
|
ScrimUpdate,
|
|
10
14
|
ScrimOverlayOptions,
|
|
11
|
-
} from "
|
|
12
|
-
import type { BottomSheetEngine } from "../core/BottomSheetEngine";
|
|
15
|
+
} from "./index.js";
|
|
13
16
|
|
|
14
17
|
export type UseBottomSheetVueOptions<TId extends string = string> = Omit<
|
|
15
18
|
EngineOptions,
|
|
@@ -37,7 +40,7 @@ export type UseBottomSheetVueReturn<TId extends string = string> = {
|
|
|
37
40
|
state: EngineState & { activeId: TId };
|
|
38
41
|
snapTo: (id: TId) => Promise<void>;
|
|
39
42
|
open: (id?: TId) => Promise<void>;
|
|
40
|
-
close: () => Promise<void>;
|
|
43
|
+
close: (reason?: CloseReason) => Promise<void>;
|
|
41
44
|
setAllowed: (ids: TId[], snap?: TId) => void;
|
|
42
45
|
setSnapPoints: (
|
|
43
46
|
points: EngineOptions["snapPoints"],
|
|
@@ -45,6 +48,18 @@ export type UseBottomSheetVueReturn<TId extends string = string> = {
|
|
|
45
48
|
) => void;
|
|
46
49
|
setScrim: (opts: ScrimUpdate) => void;
|
|
47
50
|
setScrimOverlay: (opts: ScrimOverlayOptions) => () => void;
|
|
51
|
+
addAnchor: (opts: AnchorOptions) => () => void;
|
|
52
|
+
setScrimStages: (opts: ScrimStagesOptions | null) => () => void;
|
|
53
|
+
recompute: () => void;
|
|
54
|
+
setScrimColor: (color: string | undefined | null) => void;
|
|
55
|
+
setBackdropRange: (range: [number, number]) => void;
|
|
56
|
+
setRadius: (r: string | number) => void;
|
|
57
|
+
setMaxHeight: (h: string | number) => void;
|
|
58
|
+
expand: () => Promise<void>;
|
|
59
|
+
collapse: () => Promise<void>;
|
|
60
|
+
isTop: () => boolean;
|
|
61
|
+
depth: () => number;
|
|
62
|
+
canDismiss: () => boolean;
|
|
48
63
|
on: <K extends keyof SheetEventMap>(
|
|
49
64
|
event: K,
|
|
50
65
|
fn: (payload: SheetEventMap[K]) => void,
|
|
@@ -56,14 +71,51 @@ export function useBottomSheet<TId extends string = string>(
|
|
|
56
71
|
opts: UseBottomSheetVueOptions<TId>,
|
|
57
72
|
): UseBottomSheetVueReturn<TId>;
|
|
58
73
|
|
|
74
|
+
export type VueAnchor<TId extends string = string> = Omit<
|
|
75
|
+
AnchorOptions,
|
|
76
|
+
"element"
|
|
77
|
+
> & { id: string };
|
|
78
|
+
|
|
59
79
|
export type BottomSheetProps<TId extends string = string> =
|
|
60
80
|
UseBottomSheetVueOptions<TId> & {
|
|
61
81
|
backdrop?: boolean;
|
|
62
82
|
closeOnBackdrop?: boolean;
|
|
63
83
|
ariaLabel?: string;
|
|
84
|
+
open?: boolean;
|
|
85
|
+
snap?: TId;
|
|
86
|
+
teleport?: boolean;
|
|
87
|
+
teleportTo?: string | HTMLElement;
|
|
88
|
+
anchors?: VueAnchor<TId>[];
|
|
89
|
+
scrimStages?: ScrimStagesOptions | null;
|
|
90
|
+
backdropColor?: string;
|
|
91
|
+
backdropOpacity?: number;
|
|
64
92
|
};
|
|
65
93
|
|
|
66
|
-
export const BottomSheet: DefineComponent<
|
|
94
|
+
export const BottomSheet: DefineComponent<
|
|
95
|
+
BottomSheetProps,
|
|
96
|
+
Record<string, never>,
|
|
97
|
+
Record<string, never>,
|
|
98
|
+
Record<string, never>,
|
|
99
|
+
Record<string, never>,
|
|
100
|
+
Record<string, never>,
|
|
101
|
+
Record<string, never>,
|
|
102
|
+
{
|
|
103
|
+
change: (state: EngineState) => void;
|
|
104
|
+
snap: (id: string) => void;
|
|
105
|
+
open: (id: string) => void;
|
|
106
|
+
close: () => void;
|
|
107
|
+
opened: (id: string) => void;
|
|
108
|
+
closed: () => void;
|
|
109
|
+
"before-close": (payload: {
|
|
110
|
+
reason: CloseReason;
|
|
111
|
+
cancel: () => void;
|
|
112
|
+
}) => void;
|
|
113
|
+
"drag-start": (payload: { size: number }) => void;
|
|
114
|
+
"drag-end": (payload: { size: number; velocity: number }) => void;
|
|
115
|
+
"update:open": (open: boolean) => void;
|
|
116
|
+
"update:snap": (id: string) => void;
|
|
117
|
+
}
|
|
118
|
+
>;
|
|
67
119
|
|
|
68
120
|
export type {
|
|
69
121
|
SnapPoint,
|
|
@@ -71,4 +123,5 @@ export type {
|
|
|
71
123
|
SheetMode,
|
|
72
124
|
EngineState,
|
|
73
125
|
EngineOptions,
|
|
126
|
+
CloseReason,
|
|
74
127
|
};
|