base-vaul 0.0.1 → 0.1.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/dist/index.cjs +1314 -0
- package/dist/index.css +256 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +186 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +170 -131
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1181 -1540
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -27
- package/dist/index.d.ts +0 -147
- package/dist/index.js +0 -1668
package/dist/index.d.mts
CHANGED
|
@@ -1,147 +1,186 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Dialog } from
|
|
3
|
-
import React from
|
|
1
|
+
import * as _base_ui_react0 from "@base-ui/react";
|
|
2
|
+
import { Dialog } from "@base-ui/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
5
|
|
|
6
|
+
//#region src/context.d.ts
|
|
5
7
|
type BaseUIMouseEvent = React.MouseEvent<HTMLDivElement> & {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
preventBaseUIHandler: () => void;
|
|
9
|
+
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
8
10
|
};
|
|
9
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/index.d.ts
|
|
10
13
|
interface WithFadeFromProps {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.
|
|
16
|
+
* Should go from least visible. Example `[0.2, 0.5, 0.8]`.
|
|
17
|
+
* You can also use px values, which doesn't take screen height into account.
|
|
18
|
+
*/
|
|
19
|
+
snapPoints: (number | string)[];
|
|
20
|
+
/**
|
|
21
|
+
* Index of a `snapPoint` from which the overlay fade should be applied. Defaults to the last snap point.
|
|
22
|
+
*/
|
|
23
|
+
fadeFromIndex: number;
|
|
21
24
|
}
|
|
22
25
|
interface WithoutFadeFromProps {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.
|
|
28
|
+
* Should go from least visible. Example `[0.2, 0.5, 0.8]`.
|
|
29
|
+
* You can also use px values, which doesn't take screen height into account.
|
|
30
|
+
*/
|
|
31
|
+
snapPoints?: (number | string)[];
|
|
32
|
+
fadeFromIndex?: never;
|
|
30
33
|
}
|
|
31
34
|
type DialogProps = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
35
|
+
activeSnapPoint?: number | string | null;
|
|
36
|
+
setActiveSnapPoint?: (snapPoint: number | string | null) => void;
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
open?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Number between 0 and 1 that determines when the drawer should be closed.
|
|
41
|
+
* Example: threshold of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.
|
|
42
|
+
* @default 0.25
|
|
43
|
+
*/
|
|
44
|
+
closeThreshold?: number;
|
|
45
|
+
/**
|
|
46
|
+
* When `true` the `body` doesn't get any styles assigned from Vaul
|
|
47
|
+
*/
|
|
48
|
+
noBodyStyles?: boolean;
|
|
49
|
+
onOpenChange?: (open: boolean) => void;
|
|
50
|
+
shouldScaleBackground?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When `false` we don't change body's background color when the drawer is open.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
setBackgroundColorOnScale?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Duration for which the drawer is not draggable after scrolling content inside of the drawer.
|
|
58
|
+
* @default 500ms
|
|
59
|
+
*/
|
|
60
|
+
scrollLockTimeout?: number;
|
|
61
|
+
/**
|
|
62
|
+
* When `true`, don't move the drawer upwards if there's space, but rather only change it's height so it's fully scrollable when the keyboard is open
|
|
63
|
+
*/
|
|
64
|
+
fixed?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* When `true` only allows the drawer to be dragged by the `<Drawer.Handle />` component.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
handleOnly?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* When `false` dragging, clicking outside, pressing esc, etc. will not close the drawer.
|
|
72
|
+
* Use this in comination with the `open` prop, otherwise you won't be able to open/close the drawer.
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
dismissible?: boolean;
|
|
76
|
+
onDrag?: (event: BaseUIMouseEvent, percentageDragged: number) => void;
|
|
77
|
+
onRelease?: (event: BaseUIMouseEvent, open: boolean) => void;
|
|
78
|
+
/**
|
|
79
|
+
* When `false` it allows to interact with elements outside of the drawer without closing it.
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
modal?: boolean;
|
|
83
|
+
nested?: boolean;
|
|
84
|
+
onClose?: () => void;
|
|
85
|
+
/**
|
|
86
|
+
* Direction of the drawer. Can be `top` or `bottom`, `left`, `right`.
|
|
87
|
+
* @default 'bottom'
|
|
88
|
+
*/
|
|
89
|
+
direction?: "top" | "bottom" | "left" | "right";
|
|
90
|
+
/**
|
|
91
|
+
* Opened by default, skips initial enter animation. Still reacts to `open` state changes
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
defaultOpen?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* When set to `true` prevents scrolling on the document body on mount, and restores it on unmount.
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
disablePreventScroll?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* When `true` Vaul will reposition inputs rather than scroll then into view if the keyboard is in the way.
|
|
102
|
+
* Setting it to `false` will fall back to the default browser behavior.
|
|
103
|
+
* @default true when {@link snapPoints} is defined
|
|
104
|
+
*/
|
|
105
|
+
repositionInputs?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Disabled velocity based swiping for snap points.
|
|
108
|
+
* This means that a snap point won't be skipped even if the velocity is high enough.
|
|
109
|
+
* Useful if each snap point in a drawer is equally important.
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
snapToSequentialPoint?: boolean;
|
|
113
|
+
container?: HTMLElement | null;
|
|
114
|
+
/**
|
|
115
|
+
* Gets triggered after the open or close animation ends, it receives an `open` argument with the `open` state of the drawer by the time the function was triggered.
|
|
116
|
+
* Useful to revert any state changes for example.
|
|
117
|
+
*/
|
|
118
|
+
onAnimationEnd?: (open: boolean) => void;
|
|
119
|
+
preventScrollRestoration?: boolean;
|
|
120
|
+
autoFocus?: boolean;
|
|
118
121
|
} & (WithFadeFromProps | WithoutFadeFromProps);
|
|
119
|
-
declare function Root({
|
|
120
|
-
|
|
122
|
+
declare function Root({
|
|
123
|
+
open: openProp,
|
|
124
|
+
onOpenChange,
|
|
125
|
+
children,
|
|
126
|
+
onDrag: onDragProp,
|
|
127
|
+
onRelease: onReleaseProp,
|
|
128
|
+
snapPoints,
|
|
129
|
+
shouldScaleBackground,
|
|
130
|
+
setBackgroundColorOnScale,
|
|
131
|
+
closeThreshold,
|
|
132
|
+
scrollLockTimeout,
|
|
133
|
+
dismissible,
|
|
134
|
+
handleOnly,
|
|
135
|
+
fadeFromIndex,
|
|
136
|
+
activeSnapPoint: activeSnapPointProp,
|
|
137
|
+
setActiveSnapPoint: setActiveSnapPointProp,
|
|
138
|
+
fixed,
|
|
139
|
+
modal,
|
|
140
|
+
onClose,
|
|
141
|
+
nested,
|
|
142
|
+
noBodyStyles,
|
|
143
|
+
direction,
|
|
144
|
+
defaultOpen,
|
|
145
|
+
disablePreventScroll,
|
|
146
|
+
snapToSequentialPoint,
|
|
147
|
+
preventScrollRestoration,
|
|
148
|
+
repositionInputs,
|
|
149
|
+
onAnimationEnd,
|
|
150
|
+
container,
|
|
151
|
+
autoFocus
|
|
152
|
+
}: DialogProps): react_jsx_runtime0.JSX.Element;
|
|
153
|
+
declare const Overlay: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogBackdropProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
121
154
|
type ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Popup>;
|
|
122
|
-
declare const Content: React.ForwardRefExoticComponent<Omit<
|
|
123
|
-
type HandleProps = React.ComponentPropsWithoutRef<
|
|
124
|
-
|
|
155
|
+
declare const Content: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogPopupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
156
|
+
type HandleProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
157
|
+
preventCycle?: boolean;
|
|
125
158
|
};
|
|
126
159
|
declare const Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
127
|
-
|
|
160
|
+
preventCycle?: boolean;
|
|
128
161
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
129
|
-
declare function NestedRoot({
|
|
162
|
+
declare function NestedRoot({
|
|
163
|
+
onDrag,
|
|
164
|
+
onOpenChange,
|
|
165
|
+
open: nestedIsOpen,
|
|
166
|
+
...rest
|
|
167
|
+
}: DialogProps): react_jsx_runtime0.JSX.Element;
|
|
130
168
|
type PortalProps = React.ComponentPropsWithoutRef<typeof Dialog.Portal>;
|
|
131
|
-
declare function Portal(props: PortalProps):
|
|
169
|
+
declare function Portal(props: PortalProps): react_jsx_runtime0.JSX.Element;
|
|
132
170
|
declare const Drawer: {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
171
|
+
Root: typeof Root;
|
|
172
|
+
NestedRoot: typeof NestedRoot;
|
|
173
|
+
Content: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogPopupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
174
|
+
Overlay: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogBackdropProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
175
|
+
Trigger: Dialog.Trigger;
|
|
176
|
+
Portal: typeof Portal;
|
|
177
|
+
Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
178
|
+
preventCycle?: boolean;
|
|
179
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
180
|
+
Close: React.ForwardRefExoticComponent<_base_ui_react0.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
181
|
+
Title: React.ForwardRefExoticComponent<_base_ui_react0.DialogTitleProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
182
|
+
Description: React.ForwardRefExoticComponent<_base_ui_react0.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
145
183
|
};
|
|
146
|
-
|
|
147
|
-
export { Content,
|
|
184
|
+
//#endregion
|
|
185
|
+
export { Content, ContentProps, DialogProps, Drawer, Handle, HandleProps, NestedRoot, Overlay, Portal, Root, WithFadeFromProps, WithoutFadeFromProps };
|
|
186
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/context.ts","../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;KAIY,gBAAA,GAAmB,KAAA,CAAM,WAAW;;;;;;UC6B/B,iBAAA;;AD7BjB;;;;EC6BiB,UAAA,EAAA,CAAA,MAAA,GAAiB,MAAA,CAAA,EAAA;EAajB;AAUjB;;EA0CmB,aAAA,EAAA,MAAA;;AAqCL,UAzFG,oBAAA,CAyFH;EAQT;;;AAEL;;EAEE,UAAA,CAAA,EAAA,CAAA,MAAA,GAAA,MAAA,CAAA,EAAA;EACA,aAAA,CAAA,EAAA,KAAA;;AAEW,KA9FD,WAAA,GA8FC;EACX,eAAA,CAAA,EAAA,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