base-vaul 0.0.2 → 1.0.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/package.json CHANGED
@@ -1,26 +1,21 @@
1
1
  {
2
2
  "name": "base-vaul",
3
- "version": "0.0.2",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "description": "Drawer component for React made with Base-UI.",
9
- "main": "./dist/index.js",
9
+ "main": "./dist/index.mjs",
10
10
  "module": "./dist/index.mjs",
11
11
  "types": "./dist/index.d.ts",
12
12
  "files": [
13
- "dist",
14
- "style.css"
13
+ "dist"
15
14
  ],
16
15
  "exports": {
17
16
  "import": {
18
17
  "types": "./dist/index.d.mts",
19
18
  "default": "./dist/index.mjs"
20
- },
21
- "require": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
24
19
  }
25
20
  },
26
21
  "keywords": [
@@ -40,17 +35,20 @@
40
35
  "url": "https://github.com/ntatoud/base-vaul/issues"
41
36
  },
42
37
  "devDependencies": {
38
+ "@arethetypeswrong/core": "^0.18.2",
39
+ "@bosh-code/tsdown-plugin-inject-css": "^2.0.0",
43
40
  "@playwright/test": "1.57.0",
44
41
  "@types/node": "20.5.7",
45
42
  "@types/react": "^19.2.7",
46
43
  "@types/react-dom": "^19.2.3",
47
- "bunchee": "^5.1.5",
48
44
  "eslint": "9.39.1",
49
45
  "prettier": "^2.5.1",
50
46
  "react": "^19.2.2",
51
47
  "react-dom": "^19.2.2",
48
+ "tsdown": "^0.18.1",
52
49
  "turbo": "2.6.3",
53
50
  "typescript": "5.9.2",
51
+ "unplugin-lightningcss": "^0.4.3",
54
52
  "@repo/typescript-config": "0.0.0",
55
53
  "@repo/eslint-config": "0.0.1"
56
54
  },
@@ -62,9 +60,8 @@
62
60
  "@base-ui/react": "1.0.0"
63
61
  },
64
62
  "scripts": {
65
- "build": "pnpm run lint && bunchee && pnpm copy-assets",
66
- "copy-assets": "cp -r ./src/style.css ./style.css",
67
- "dev": "bunchee --watch",
63
+ "build": "tsdown",
64
+ "dev": "tsdown --watch",
68
65
  "format": "prettier --write .",
69
66
  "lint": "pnpm run --parallel --stream '/^lint:/'",
70
67
  "lint:ts": "tsc --noEmit",
package/dist/index.d.ts DELETED
@@ -1,148 +0,0 @@
1
- import * as _base_ui_react from '@base-ui/react';
2
- import { Dialog } from '@base-ui/react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import React from 'react';
5
-
6
- type BaseUIMouseEvent = React.MouseEvent<HTMLDivElement> & {
7
- preventBaseUIHandler: () => void;
8
- readonly baseUIHandlerPrevented?: boolean | undefined;
9
- };
10
-
11
- interface WithFadeFromProps {
12
- /**
13
- * Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.
14
- * Should go from least visible. Example `[0.2, 0.5, 0.8]`.
15
- * You can also use px values, which doesn't take screen height into account.
16
- */
17
- snapPoints: (number | string)[];
18
- /**
19
- * Index of a `snapPoint` from which the overlay fade should be applied. Defaults to the last snap point.
20
- */
21
- fadeFromIndex: number;
22
- }
23
- interface WithoutFadeFromProps {
24
- /**
25
- * Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.
26
- * Should go from least visible. Example `[0.2, 0.5, 0.8]`.
27
- * You can also use px values, which doesn't take screen height into account.
28
- */
29
- snapPoints?: (number | string)[];
30
- fadeFromIndex?: never;
31
- }
32
- type DialogProps = {
33
- activeSnapPoint?: number | string | null;
34
- setActiveSnapPoint?: (snapPoint: number | string | null) => void;
35
- children?: React.ReactNode;
36
- open?: boolean;
37
- /**
38
- * Number between 0 and 1 that determines when the drawer should be closed.
39
- * Example: threshold of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.
40
- * @default 0.25
41
- */
42
- closeThreshold?: number;
43
- /**
44
- * When `true` the `body` doesn't get any styles assigned from Vaul
45
- */
46
- noBodyStyles?: boolean;
47
- onOpenChange?: (open: boolean) => void;
48
- shouldScaleBackground?: boolean;
49
- /**
50
- * When `false` we don't change body's background color when the drawer is open.
51
- * @default true
52
- */
53
- setBackgroundColorOnScale?: boolean;
54
- /**
55
- * Duration for which the drawer is not draggable after scrolling content inside of the drawer.
56
- * @default 500ms
57
- */
58
- scrollLockTimeout?: number;
59
- /**
60
- * 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
61
- */
62
- fixed?: boolean;
63
- /**
64
- * When `true` only allows the drawer to be dragged by the `<Drawer.Handle />` component.
65
- * @default false
66
- */
67
- handleOnly?: boolean;
68
- /**
69
- * When `false` dragging, clicking outside, pressing esc, etc. will not close the drawer.
70
- * Use this in comination with the `open` prop, otherwise you won't be able to open/close the drawer.
71
- * @default true
72
- */
73
- dismissible?: boolean;
74
- onDrag?: (event: BaseUIMouseEvent, percentageDragged: number) => void;
75
- onRelease?: (event: BaseUIMouseEvent, open: boolean) => void;
76
- /**
77
- * When `false` it allows to interact with elements outside of the drawer without closing it.
78
- * @default true
79
- */
80
- modal?: boolean;
81
- nested?: boolean;
82
- onClose?: () => void;
83
- /**
84
- * Direction of the drawer. Can be `top` or `bottom`, `left`, `right`.
85
- * @default 'bottom'
86
- */
87
- direction?: "top" | "bottom" | "left" | "right";
88
- /**
89
- * Opened by default, skips initial enter animation. Still reacts to `open` state changes
90
- * @default false
91
- */
92
- defaultOpen?: boolean;
93
- /**
94
- * When set to `true` prevents scrolling on the document body on mount, and restores it on unmount.
95
- * @default false
96
- */
97
- disablePreventScroll?: boolean;
98
- /**
99
- * When `true` Vaul will reposition inputs rather than scroll then into view if the keyboard is in the way.
100
- * Setting it to `false` will fall back to the default browser behavior.
101
- * @default true when {@link snapPoints} is defined
102
- */
103
- repositionInputs?: boolean;
104
- /**
105
- * Disabled velocity based swiping for snap points.
106
- * This means that a snap point won't be skipped even if the velocity is high enough.
107
- * Useful if each snap point in a drawer is equally important.
108
- * @default false
109
- */
110
- snapToSequentialPoint?: boolean;
111
- container?: HTMLElement | null;
112
- /**
113
- * 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.
114
- * Useful to revert any state changes for example.
115
- */
116
- onAnimationEnd?: (open: boolean) => void;
117
- preventScrollRestoration?: boolean;
118
- autoFocus?: boolean;
119
- } & (WithFadeFromProps | WithoutFadeFromProps);
120
- declare function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRelease: onReleaseProp, snapPoints, shouldScaleBackground, setBackgroundColorOnScale, closeThreshold, scrollLockTimeout, dismissible, handleOnly, fadeFromIndex, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal, onClose, nested, noBodyStyles, direction, defaultOpen, disablePreventScroll, snapToSequentialPoint, preventScrollRestoration, repositionInputs, onAnimationEnd, container, autoFocus, }: DialogProps): react_jsx_runtime.JSX.Element;
121
- declare const Overlay: React.ForwardRefExoticComponent<Omit<_base_ui_react.DialogBackdropProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
122
- type ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Popup>;
123
- declare const Content: React.ForwardRefExoticComponent<Omit<_base_ui_react.DialogPopupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
124
- type HandleProps = React.ComponentPropsWithoutRef<"div"> & {
125
- preventCycle?: boolean;
126
- };
127
- declare const Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
128
- preventCycle?: boolean;
129
- } & React.RefAttributes<HTMLDivElement>>;
130
- declare function NestedRoot({ onDrag, onOpenChange, open: nestedIsOpen, ...rest }: DialogProps): react_jsx_runtime.JSX.Element;
131
- type PortalProps = React.ComponentPropsWithoutRef<typeof Dialog.Portal>;
132
- declare function Portal(props: PortalProps): react_jsx_runtime.JSX.Element;
133
- declare const Drawer: {
134
- Root: typeof Root;
135
- NestedRoot: typeof NestedRoot;
136
- Content: React.ForwardRefExoticComponent<Omit<_base_ui_react.DialogPopupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
137
- Overlay: React.ForwardRefExoticComponent<Omit<_base_ui_react.DialogBackdropProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
138
- Trigger: Dialog.Trigger;
139
- Portal: typeof Portal;
140
- Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
141
- preventCycle?: boolean;
142
- } & React.RefAttributes<HTMLDivElement>>;
143
- Close: React.ForwardRefExoticComponent<_base_ui_react.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
144
- Title: React.ForwardRefExoticComponent<_base_ui_react.DialogTitleProps & React.RefAttributes<HTMLParagraphElement>>;
145
- Description: React.ForwardRefExoticComponent<_base_ui_react.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
146
- };
147
-
148
- export { Content, type ContentProps, type DialogProps, Drawer, Handle, type HandleProps, NestedRoot, Overlay, Portal, Root, type WithFadeFromProps, type WithoutFadeFromProps };