Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compatibility with exactOptionalPropertyTypes #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/lib/vaul/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ export type Props = {
*
* @default false
*/
open?: CreateVaulProps["defaultOpen"] & {};
open?: (CreateVaulProps["defaultOpen"] & {}) | undefined;

/**
* A function called when the open state of the Drawer changes.
*/
onOpenChange?: OnChangeFn<boolean>;
onOpenChange?: OnChangeFn<boolean> | undefined;

/**
* Number between 0 and 1 that determines when the drawer should be closed.
*
* Example: threshold of 0.5 would close the drawer if the user swiped for
* 50% of the height of the drawer or more.
*/
closeThreshold?: CreateVaulProps["closeThreshold"] & {};
closeThreshold?: (CreateVaulProps["closeThreshold"] & {}) | undefined;

/**
* Duration in ms for which the drawer is not draggable after
* scrolling content inside of the drawer.
*
* @default 500
*/
scrollLockTimeout?: CreateVaulProps["scrollLockTimeout"] & {};
scrollLockTimeout?: (CreateVaulProps["scrollLockTimeout"] & {}) | undefined;

/**
* Array of numbers from 0 to 100 that corresponds to % of the screen a given
Expand All @@ -39,62 +39,62 @@ export type Props = {
* Example [0.2, 0.5, 0.8]. You can also use px values, which doesn't take
* screen height into account.
*/
snapPoints?: CreateVaulProps["snapPoints"] & {};
snapPoints?: (CreateVaulProps["snapPoints"] & {}) | undefined;

/**
* Index of a `snapPoint` from which the overlay fade should be applied.
*
* @default snapPoints[snapPoints.length - 1] (last snap point)
*/
fadeFromIndex?: CreateVaulProps["fadeFromIndex"] & {};
fadeFromIndex?: (CreateVaulProps["fadeFromIndex"] & {}) | undefined;

/**
* A callback function that is called when the drawer is dragged
*/
onDrag?: CreateVaulProps["onDrag"] & {};
onDrag?: (CreateVaulProps["onDrag"] & {}) | undefined;

/**
* A callback function that is called when the drawer is released
*/
onRelease?: CreateVaulProps["onRelease"] & {};
onRelease?: (CreateVaulProps["onRelease"] & {}) | undefined;

/**
* Whether this drawer is nested inside another drawer.
*
* @default false
*/
nested?: CreateVaulProps["nested"] & {};
nested?: (CreateVaulProps["nested"] & {}) | undefined;

/**
* A callback function that is called when the drawer is
* about to close.
*/
onClose?: CreateVaulProps["onClose"] & {};
onClose?: (CreateVaulProps["onClose"] & {}) | undefined;

/**
* Whether the background should scale down when the drawer is open.
*
* @default false
*/
shouldScaleBackground?: CreateVaulProps["shouldScaleBackground"] & {};
shouldScaleBackground?: (CreateVaulProps["shouldScaleBackground"] & {}) | undefined;

/**
* The background color of the body when the drawer is open and `shouldScaleBackground` is true.
*
* @default "black"
*/
backgroundColor?: CreateVaulProps["backgroundColor"] & {};
backgroundColor?: (CreateVaulProps["backgroundColor"] & {}) | undefined;

/**
* The active snap point of the drawer. You can bind to this value to
* programatically change the active snap point.
*/
activeSnapPoint?: CreateVaulProps["defaultActiveSnapPoint"];
activeSnapPoint?: CreateVaulProps["defaultActiveSnapPoint"] | undefined;

/**
* A function called when the active snap point of the Drawer changes.
*/
onActiveSnapPointChange?: OnChangeFn<number | string | null>;
onActiveSnapPointChange?: OnChangeFn<number | string | null> | undefined;

/**
* Whether the drawer is able to be dismissed naturally.
Expand All @@ -104,15 +104,15 @@ export type Props = {
*
* @default true
*/
dismissible?: boolean;
dismissible?: boolean | undefined;

/**
* The direction from which the drawer should open.
*
* @default 'bottom'
*
*/
direction?: DrawerDirection;
direction?: DrawerDirection | undefined;
} & DialogPrimitive.Props;

export type OverlayProps = DialogPrimitive.OverlayProps;
Expand Down