Skip to content

Commit c80457f

Browse files
committed
preparing for publishing
1 parent 3a036f0 commit c80457f

36 files changed

+649
-67
lines changed

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"singleQuote": true,
44
"tabWidth": 2,
55
"printWidth": 140
6-
}
6+
}

README.md

Lines changed: 108 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,110 @@
1-
# Vue 3 + TypeScript + Vite
1+
# Vue Spring Bottom Sheet
22

3-
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
3+
**vue-spring-bottom-sheet** is built on top of **[@vueuse/gesture]** and **[@vueuse/motion]**.
44

5-
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
5+
😎 **Modern** and 🚀 **Performant** Bottom Sheet for Vue.js
6+
7+
- **Fluid Transitions:** Snap points ensure smooth and performant animations.
8+
- **Optimized for Accessibility:** Keyboard support for a seamless user experience.
9+
- **Adaptable Interaction Models:** Blocking and non-blocking for different use cases.
10+
11+
# Installation
12+
13+
```
14+
npm install @douxcode/vue-bottom-sheet
15+
```
16+
17+
# Getting started
18+
19+
## Basic usage
20+
21+
```vue
22+
<script setup>
23+
import VueBottomSheet from '@douxcode/vue-bottom-sheet'
24+
import '@douxcode/vue-bottom-sheet/dist/style.css'
25+
import { ref } from 'vue'
26+
27+
const myBottomSheet = ref(null)
28+
29+
const open = () => {
30+
myBottomSheet.value.open()
31+
}
32+
33+
const close = () => {
34+
myBottomSheet.value.close()
35+
}
36+
</script>
37+
38+
<template>
39+
<BottomSheet ref="myBottomSheet"> Your awesome content </BottomSheet>
40+
</template>
41+
```
42+
43+
## Basic usage `setup` + TS
44+
45+
```vue
46+
<script setup lang="ts">
47+
import VueBottomSheet from '@douxcode/vue-bottom-sheet'
48+
import '@douxcode/vue-bottom-sheet/dist/style.css'
49+
import { ref } from 'vue'
50+
51+
const myBottomSheet = ref<InstanceType<typeof VueBottomSheet>>()
52+
53+
const open = () => {
54+
myBottomSheet.value.open()
55+
}
56+
57+
const close = () => {
58+
myBottomSheet.value.close()
59+
}
60+
</script>
61+
62+
<template>
63+
<BottomSheet ref="myBottomSheet"> Your content </BottomSheet>
64+
</template>
65+
```
66+
67+
## Usage in Nuxt 3
68+
69+
For Nuxt 3, just wrap component in `<client-only>`
70+
71+
```vue
72+
<template>
73+
<ClientOnly>
74+
<template>
75+
<BottomSheet ref="myBottomSheet"> Your awesome content </BottomSheet>
76+
</template>
77+
</ClientOnly>
78+
</template>
79+
```
80+
81+
## Props
82+
83+
| Prop | Type | Description | Example | Defaults |
84+
| ------------------- | ------- | -------------------------------------------------------------------------------- | --------------------------------------- | --------- |
85+
| snapPoints | Number | Define custom snapping positions for the bottom sheet | `:default-breakpoint="[300, 600, 900]"` | true |
86+
| defaultBreakpoint | Number | Specify the default breakpoint | `:default-breakpoint="600"` | true |
87+
| blocking | Boolean | Control whether the bottom sheet blocks interactions with the underlying content | `:blocking="true"` | true |
88+
| canSwipeClose | Boolean | Enable or disable swiping gestures to close the sheet | `:can-swipe-close="true"` | true |
89+
| canOverlayClose | Boolean | Allow tapping on overlay to close it | `:can-overlay-close="false"` | true |
90+
| expandOnContentDrag | Boolean | Enable expanding the sheet by dragging its content | `:expand-on-content-drag="#0000004D"` | #0000004D |
91+
92+
## Exposed methods
93+
94+
| Method | Description | Example |
95+
| ----------- | ------------------------------------------------------------------------ | ----------------------------------- |
96+
| snapToPoint | Fire when card component is opened | `myBottomSheet.value.snapToPoint()` |
97+
| open | Fires when min-height of sheet has changed and passes it as an argument | `myBottomSheet.value.open()` |
98+
| close | Fires when max-height of window has changed and passes it as an argument | `myBottomSheet.value.close()` |
99+
100+
## Events
101+
102+
| Event | Description | Example |
103+
| ---------- | ------------------------------------------------------------------------ | ------------------------- |
104+
| min-height | Fires when min-height of sheet has changed and passes it as an argument | `@min-height="(n) => {}"` |
105+
| max-height | Fires when max-height of window has changed and passes it as an argument | `@max-height="(n) => {}"` |
106+
| opened | Fire when card component is opened | `@opened="() => {}"` |
107+
| closed | Fire when card component is closed | `@closed="() => {}"` |
108+
109+
[@vueuse/gesture]: https://gesture.vueuse.org/
110+
[@vueuse/motion]: https://motion.vueuse.org/

bun.lockb

19.5 KB
Binary file not shown.

package.json

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,44 @@
11
{
2-
"name": "vue-spring-bottom-sheet",
3-
"private": true,
4-
"version": "0.0.0",
2+
"name": "@douxcode/vue-spring-bottom-sheet",
3+
"description": "A modern and performant bottom sheet component for Vue 3 with animations and snap points.",
4+
"keywords": [
5+
"vue",
6+
"vue3",
7+
"bottom-sheet",
8+
"spring",
9+
"animation"
10+
],
11+
"author": "Arion Paul",
12+
"license": "MIT",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/megaarmos/vue-spring-bottom-sheet.git"
16+
},
17+
"private": false,
18+
"version": "1.0.0",
519
"type": "module",
20+
"exports": {
21+
".": {
22+
"types": "./dist/index.d.ts",
23+
"import": "./dist/index.mjs"
24+
},
25+
"./dist/style.css": {
26+
"import": "./dist/style.css",
27+
"require": "./dist/style.css"
28+
}
29+
},
30+
"main": "./dist/index.mjs",
31+
"types": "dist/index.d.ts",
632
"scripts": {
7-
"dev": "vite --host",
833
"build": "vue-tsc -b && vite build",
34+
"build:watch": "vite build --watch",
935
"preview": "vite preview"
1036
},
37+
"peerDependencies": {
38+
"vue": ">=3.3",
39+
"@vueuse/gesture": "^2.0.0",
40+
"@vueuse/motion": "^2.2.6"
41+
},
1142
"dependencies": {
1243
"@vueuse/core": "^12.0.0",
1344
"@vueuse/gesture": "^2.0.0",
@@ -17,11 +48,18 @@
1748
"vue": "^3.5.13"
1849
},
1950
"devDependencies": {
20-
"prettier": "^3.4.2",
51+
"@types/node": "^22.10.2",
2152
"@vitejs/plugin-vue": "^5.2.1",
53+
"@vue/tsconfig": "^0.7.0",
54+
"prettier": "^3.4.2",
2255
"typescript": "~5.6.2",
2356
"vite": "^6.0.1",
24-
"vue-tsc": "^2.1.10",
25-
"vue-component-type-helpers": "^2.1.10"
26-
}
57+
"vite-plugin-dts": "^4.3.0",
58+
"vue-tsc": "^2.1.10"
59+
},
60+
"files": [
61+
"dist",
62+
"README.md",
63+
"LICENSE"
64+
]
2765
}

playground/nuxt/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example

playground/nuxt/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nuxt Minimal Starter
2+
3+
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
4+
5+
## Setup
6+
7+
Make sure to install dependencies:
8+
9+
```bash
10+
# npm
11+
npm install
12+
13+
# pnpm
14+
pnpm install
15+
16+
# yarn
17+
yarn install
18+
19+
# bun
20+
bun install
21+
```
22+
23+
## Development Server
24+
25+
Start the development server on `http://localhost:3000`:
26+
27+
```bash
28+
# npm
29+
npm run dev
30+
31+
# pnpm
32+
pnpm dev
33+
34+
# yarn
35+
yarn dev
36+
37+
# bun
38+
bun run dev
39+
```
40+
41+
## Production
42+
43+
Build the application for production:
44+
45+
```bash
46+
# npm
47+
npm run build
48+
49+
# pnpm
50+
pnpm build
51+
52+
# yarn
53+
yarn build
54+
55+
# bun
56+
bun run build
57+
```
58+
59+
Locally preview production build:
60+
61+
```bash
62+
# npm
63+
npm run preview
64+
65+
# pnpm
66+
pnpm preview
67+
68+
# yarn
69+
yarn preview
70+
71+
# bun
72+
bun run preview
73+
```
74+
75+
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

0 commit comments

Comments
 (0)