@douxcode/vue-spring-bottom-sheet 2.0.0 → 2.0.2

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 ADDED
@@ -0,0 +1,155 @@
1
+ # Vue Spring Bottom Sheet
2
+
3
+ **vue-spring-bottom-sheet** is built on top of **[motion-v]**.
4
+
5
+ 😎 **Modern** and 🚀 **Performant** Bottom Sheet for Vue.js
6
+
7
+ [Demo](https://vue-spring-bottom-sheet.douxcode.com/) 👀
8
+
9
+ | ![](https://vue-spring-bottom-sheet.douxcode.com/example_basic.png) | ![](https://vue-spring-bottom-sheet.douxcode.com/example_snap.png) | ![](https://vue-spring-bottom-sheet.douxcode.com/example_blocking.png) | ![](https://vue-spring-bottom-sheet.douxcode.com/example_sticky.png) |
10
+ | :-----------------------------------------------------------------: | :----------------------------------------------------------------: | :--------------------------------------------------------------------: | :------------------------------------------------------------------: |
11
+
12
+ # Installation
13
+
14
+ ```
15
+ npm install @douxcode/vue-spring-bottom-sheet
16
+ ```
17
+
18
+ ```
19
+ bun install @douxcode/vue-spring-bottom-sheet
20
+ ```
21
+
22
+ # Getting started
23
+
24
+ ## Basic usage
25
+
26
+ ```vue
27
+ <script setup>
28
+ import BottomSheet from '@douxcode/vue-spring-bottom-sheet'
29
+ import '@douxcode/vue-spring-bottom-sheet/dist/style.css'
30
+ import { ref } from 'vue'
31
+
32
+ const bottomSheet = ref(null)
33
+
34
+ const open = () => {
35
+ bottomSheet.value.open()
36
+ }
37
+
38
+ const close = () => {
39
+ bottomSheet.value.close()
40
+ }
41
+ </script>
42
+
43
+ <template>
44
+ <BottomSheet ref="bottomSheet"> Your awesome content </BottomSheet>
45
+ </template>
46
+ ```
47
+
48
+ ## Basic usage `setup` + TS
49
+
50
+ ```vue
51
+ <script setup lang="ts">
52
+ import BottomSheet from '@douxcode/vue-spring-bottom-sheet'
53
+ import '@douxcode/vue-spring-bottom-sheet/dist/style.css'
54
+ import { ref } from 'vue'
55
+
56
+ const bottomSheet = ref<InstanceType<typeof BottomSheet>>()
57
+
58
+ /* For vue 3.5+ you can use useTemplateRef() */
59
+ const bottomSheet = useTemplateRef('bottomSheet')
60
+
61
+ const open = () => {
62
+ bottomSheet.value.open()
63
+ }
64
+
65
+ const close = () => {
66
+ bottomSheet.value.close()
67
+ }
68
+ </script>
69
+
70
+ <template>
71
+ <BottomSheet ref="bottomSheet"> Your content </BottomSheet>
72
+ </template>
73
+ ```
74
+
75
+ ## Usage in Nuxt 3
76
+
77
+ For Nuxt 3, just wrap component in `<ClientOnly>`
78
+
79
+ ```vue
80
+ <template>
81
+ <ClientOnly>
82
+ <BottomSheet ref="bottomSheet"> Your awesome content </BottomSheet>
83
+ </ClientOnly>
84
+ </template>
85
+ ```
86
+
87
+ ## Slots
88
+
89
+ ```vue
90
+ <template>
91
+ <BottomSheet ref="bottomSheet">
92
+ <template #header> Header </template>
93
+ <div>Your content</div>
94
+ <template #footer> Footer </template>
95
+ </BottomSheet>
96
+ </template>
97
+ ```
98
+
99
+ ## CSS Custom Properties
100
+
101
+ ```css
102
+ --vsbs-backdrop-bg: rgba(0, 0, 0, 0.5);
103
+ --vsbs-shadow-color: rgba(89, 89, 89, 0.2);
104
+ --vsbs-background: #fff;
105
+ --vsbs-border-radius: 16px;
106
+ --vsbs-max-width: 640px;
107
+ --vsbs-border-color: rgba(46, 59, 66, 0.125);
108
+ --vsbs-padding-x: 16px;
109
+ --vsbs-handle-background: rgba(0, 0, 0, 0.28);
110
+ ```
111
+
112
+ ## Props
113
+
114
+ ### Prop Definitions
115
+
116
+ | Prop | Type | Default | Description |
117
+ | ------------------- | --------------------- | ---------------- | ------------------------------------------ |
118
+ | duration | Number | 250 | Animation duration in milliseconds |
119
+ | snapPoints | Array<number\|string> | [instinctHeight] | Custom snapping positions |
120
+ | initialSnapPoint | Number | minHeight | Initial snap point index |
121
+ | blocking | Boolean | true | Block interactions with underlying content |
122
+ | canSwipeClose | Boolean | true | Enable swipe-to-close gesture |
123
+ | canBackdropClose | Boolean | true | Allow closing by tapping backdrop |
124
+ | expandOnContentDrag | Boolean | true | Enable expanding by dragging content |
125
+
126
+ ## Exposed methods
127
+
128
+ Assuming there is `const bottomSheet = ref()`
129
+
130
+ | Method | Description | Example |
131
+ | ----------- | ------------------------------- | ---------------------------------- |
132
+ | open | Opens the bottom sheet | `bottomSheet.value.open()` |
133
+ | close | Closes the bottom sheet | `bottomSheet.value.close()` |
134
+ | snapToPoint | Snaps to an index of snapPoints | `bottomSheet.value.snapToPoint(1)` |
135
+
136
+ ## Events
137
+
138
+ | Event | Description | Payload |
139
+ | -------------- | -------------------------------------- | --------------- |
140
+ | opened | Emitted when sheet finishes opening | - |
141
+ | closed | Emitted when sheet finishes closing | - |
142
+ | dragging-up | Emitted when user drags sheet upward | - |
143
+ | dragging-down | Emitted when user drags sheet downward | - |
144
+ | instinctHeight | Emitted when content height changes | height (number) |
145
+
146
+ ## Acknowledgments
147
+
148
+ This project was inspired by the following:
149
+
150
+ - [react-spring-bottom-sheet]: Accessible ♿️, Delightful ✨, & Fast 🚀
151
+ - [@webzlodimir/vue-bottom-sheet]: 🔥 A nice clean and touch-friendly bottom sheet component based on Vue.js and Hammer.js for Vue 3
152
+
153
+ [motion-v]: https://motion.unovue.com/
154
+ [react-spring-bottom-sheet]: https://react-spring.bottom-sheet.dev/
155
+ [@webzlodimir/vue-bottom-sheet]: https://github.com/vaban-ru/vue-bottom-sheet
package/dist/index.mjs CHANGED
@@ -90,9 +90,7 @@ const Ve = { "data-vsbs-container": "" }, ze = /* @__PURE__ */ xe({
90
90
  },
91
91
  emits: ["opened", "closed", "ready", "dragging-up", "dragging-down", "instinctHeight"],
92
92
  setup(n, { expose: a, emit: o }) {
93
- const e = n, v = o, S = y(!1), i = y(), p = y(null), f = y(null), g = y(null), x = y(null), D = y(null), H = y(null), r = y(e.expandOnContentDrag), { height: d } = Ee({
94
- type: "visual"
95
- }), { height: w } = N(i), { height: W } = N(p), { height: ne } = N(D), { height: oe } = N(f), G = B({
93
+ const e = n, v = o, S = y(!1), i = y(), p = y(null), f = y(null), g = y(null), x = y(null), D = y(null), H = y(null), r = y(e.expandOnContentDrag), { height: d } = Ee(), { height: w } = N(i), { height: W } = N(p), { height: ne } = N(D), { height: oe } = N(f), G = B({
96
94
  get() {
97
95
  return m(
98
96
  Math.ceil(ne.value + W.value + oe.value),
@@ -377,7 +375,7 @@ const Ve = { "data-vsbs-container": "" }, ze = /* @__PURE__ */ xe({
377
375
  for (const [e, v] of a)
378
376
  o[e] = v;
379
377
  return o;
380
- }, Ke = /* @__PURE__ */ je(ze, [["__scopeId", "data-v-92db83a2"]]);
378
+ }, Ke = /* @__PURE__ */ je(ze, [["__scopeId", "data-v-609b94ed"]]);
381
379
  export {
382
380
  Ke as default
383
381
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- [data-vsbs-container][data-v-92db83a2]{position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden;pointer-events:none;z-index:9999;visibility:visible}[data-vsbs-backdrop][data-v-92db83a2]{background-color:var(--vsbs-backdrop-bg, rgba(0, 0, 0, .5));top:0;right:0;bottom:0;left:0;pointer-events:auto;position:fixed;-webkit-user-select:none;user-select:none;will-change:opacity;z-index:1}[data-vsbs-shadow=true][data-v-92db83a2]:before{content:"";z-index:-1;position:absolute;top:0;height:100lvh;width:100%;border-radius:var(--vsbs-border-radius, 16px);box-shadow:0 -5px 60px 0 var(--vsbs-shadow-color, rgba(89, 89, 89, .2))}[data-vsbs-sheet][data-v-92db83a2]{background-color:var(--vsbs-background, #fff);border-top-left-radius:var(--vsbs-border-radius, 16px);border-top-right-radius:var(--vsbs-border-radius, 16px);bottom:0;display:flex;flex-direction:column;left:0;margin-left:auto;margin-right:auto;max-height:inherit;max-width:var(--vsbs-max-width, 640px);pointer-events:all;position:fixed;right:0;width:100%;will-change:height;z-index:2}[data-vsbs-sheet-show=true][data-v-92db83a2]{visibility:visible}[data-vsbs-header][data-v-92db83a2]{box-shadow:0 1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-shrink:0;padding:20px var(--vsbs-padding-x, 16px) 8px;-webkit-user-select:none;user-select:none;z-index:3}[data-vsbs-header][data-v-92db83a2]:before{background-color:var(--vsbs-handle-background, rgba(0, 0, 0, .28));border-radius:2px;content:"";display:block;height:4px;left:50%;position:absolute;top:8px;transform:translate(-50%);width:36px}[data-vsbs-header][data-v-92db83a2]:empty{box-shadow:none;padding:14px var(--vsbs-padding-x, 16px) 10px}[data-vsbs-footer][data-v-92db83a2]{box-shadow:0 -1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-grow:0;flex-shrink:0;padding:16px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}[data-vsbs-footer][data-v-92db83a2]:empty{display:none}[data-vsbs-scroll][data-v-92db83a2]{flex-grow:1;overflow-y:auto;overscroll-behavior:contain}[data-vsbs-content-wrapper][data-v-92db83a2]{height:100%}[data-vsbs-content][data-v-92db83a2]{display:grid;padding:8px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}
1
+ [data-vsbs-container][data-v-609b94ed]{position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden;pointer-events:none;z-index:9999;visibility:visible}[data-vsbs-backdrop][data-v-609b94ed]{background-color:var(--vsbs-backdrop-bg, rgba(0, 0, 0, .5));top:0;right:0;bottom:0;left:0;pointer-events:auto;position:fixed;-webkit-user-select:none;user-select:none;will-change:opacity;z-index:1}[data-vsbs-shadow=true][data-v-609b94ed]:before{content:"";z-index:-1;position:absolute;top:0;height:100lvh;width:100%;border-radius:var(--vsbs-border-radius, 16px);box-shadow:0 -5px 60px 0 var(--vsbs-shadow-color, rgba(89, 89, 89, .2))}[data-vsbs-sheet][data-v-609b94ed]{background-color:var(--vsbs-background, #fff);border-top-left-radius:var(--vsbs-border-radius, 16px);border-top-right-radius:var(--vsbs-border-radius, 16px);bottom:0;display:flex;flex-direction:column;left:0;margin-left:auto;margin-right:auto;max-height:inherit;max-width:var(--vsbs-max-width, 640px);pointer-events:all;position:fixed;right:0;width:100%;will-change:height;z-index:2}[data-vsbs-sheet-show=true][data-v-609b94ed]{visibility:visible}[data-vsbs-header][data-v-609b94ed]{box-shadow:0 1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-shrink:0;padding:20px var(--vsbs-padding-x, 16px) 8px;-webkit-user-select:none;user-select:none;z-index:3}[data-vsbs-header][data-v-609b94ed]:before{background-color:var(--vsbs-handle-background, rgba(0, 0, 0, .28));border-radius:2px;content:"";display:block;height:4px;left:50%;position:absolute;top:8px;transform:translate(-50%);width:36px}[data-vsbs-header][data-v-609b94ed]:empty{box-shadow:none;padding:14px var(--vsbs-padding-x, 16px) 10px}[data-vsbs-footer][data-v-609b94ed]{box-shadow:0 -1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-grow:0;flex-shrink:0;padding:16px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}[data-vsbs-footer][data-v-609b94ed]:empty{display:none}[data-vsbs-scroll][data-v-609b94ed]{flex-grow:1;overflow-y:auto;overscroll-behavior:contain}[data-vsbs-content-wrapper][data-v-609b94ed]{height:100%}[data-vsbs-content][data-v-609b94ed]{display:grid;padding:8px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}
package/package.json CHANGED
@@ -1,91 +1,91 @@
1
- {
2
- "name": "@douxcode/vue-spring-bottom-sheet",
3
- "description": "Modern and Performant Bottom Sheet for Vue.js",
4
- "keywords": [
5
- "animation",
6
- "bottom-drawer",
7
- "bottom-sheet",
8
- "bottomsheet",
9
- "dialog",
10
- "drag-drop",
11
- "draggableview",
12
- "drawer",
13
- "gesture-control",
14
- "modal",
15
- "motion",
16
- "overlay",
17
- "popup",
18
- "vue",
19
- "vueuse/motion",
20
- "vueuse/gesture",
21
- "sheet",
22
- "typescript"
23
- ],
24
- "author": "Arion Paul",
25
- "license": "MIT",
26
- "repository": {
27
- "type": "git",
28
- "url": "https://github.com/megaarmos/vue-spring-bottom-sheet.git"
29
- },
30
- "homepage": "https://vue-spring-bottom-sheet.douxcode.com/",
31
- "bugs": {
32
- "url": "https://github.com/megaarmos/vue-spring-bottom-sheet/issues"
33
- },
34
- "private": false,
35
- "version": "2.0.0",
36
- "type": "module",
37
- "exports": {
38
- ".": {
39
- "types": "./dist/index.d.ts",
40
- "import": "./dist/index.mjs"
41
- },
42
- "./dist/style.css": {
43
- "import": "./dist/style.css",
44
- "require": "./dist/style.css"
45
- }
46
- },
47
- "main": "./dist/index.mjs",
48
- "types": "dist/index.d.ts",
49
- "scripts": {
50
- "build": "vue-tsc -b && vite build",
51
- "dev": "vite build --watch",
52
- "type-check": "vue-tsc --build",
53
- "lint": "eslint . --fix",
54
- "format": "prettier --write src/",
55
- "release": "npm run build && npm publish --access public"
56
- },
57
- "peerDependencies": {
58
- "vue": ">=3.3"
59
- },
60
- "dependencies": {
61
- "@vueuse/core": "^13.0.0",
62
- "@vueuse/integrations": "^13.0.0",
63
- "focus-trap": "^7.6.4",
64
- "motion-v": "0.13.1",
65
- "remeda": "^2.21.2",
66
- "vue": "^3.5.13"
67
- },
68
- "devDependencies": {
69
- "@types/node": "^22.13.11",
70
- "@vitejs/plugin-vue": "^5.2.1",
71
- "@vue/eslint-config-prettier": "^10.2.0",
72
- "@vue/eslint-config-typescript": "^14.5.0",
73
- "@vue/tsconfig": "^0.7.0",
74
- "ajv": "^8.17.1",
75
- "eslint": "^9.23.0",
76
- "eslint-plugin-vue": "^10.0.0",
77
- "prettier": "^3.5.3",
78
- "typescript": "~5.6.3",
79
- "vite": "^6.2.2",
80
- "vite-plugin-dts": "4.5.3",
81
- "vue-tsc": "^2.2.8"
82
- },
83
- "files": [
84
- "dist",
85
- "README.md",
86
- "LICENSE"
87
- ],
88
- "publishConfig": {
89
- "access": "public"
90
- }
91
- }
1
+ {
2
+ "name": "@douxcode/vue-spring-bottom-sheet",
3
+ "description": "Modern and Performant Bottom Sheet for Vue.js",
4
+ "keywords": [
5
+ "animation",
6
+ "bottom-drawer",
7
+ "bottom-sheet",
8
+ "bottomsheet",
9
+ "dialog",
10
+ "drag-drop",
11
+ "draggableview",
12
+ "drawer",
13
+ "gesture-control",
14
+ "modal",
15
+ "motion",
16
+ "overlay",
17
+ "popup",
18
+ "vue",
19
+ "vueuse/motion",
20
+ "vueuse/gesture",
21
+ "sheet",
22
+ "typescript"
23
+ ],
24
+ "author": "Arion Paul",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/megaarmos/vue-spring-bottom-sheet.git"
29
+ },
30
+ "homepage": "https://vue-spring-bottom-sheet.douxcode.com/",
31
+ "bugs": {
32
+ "url": "https://github.com/megaarmos/vue-spring-bottom-sheet/issues"
33
+ },
34
+ "private": false,
35
+ "version": "2.0.2",
36
+ "type": "module",
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/index.d.ts",
40
+ "import": "./dist/index.mjs"
41
+ },
42
+ "./dist/style.css": {
43
+ "import": "./dist/style.css",
44
+ "require": "./dist/style.css"
45
+ }
46
+ },
47
+ "main": "./dist/index.mjs",
48
+ "types": "dist/index.d.ts",
49
+ "scripts": {
50
+ "build": "vue-tsc -b && vite build",
51
+ "dev": "vite build --watch",
52
+ "type-check": "vue-tsc --build",
53
+ "lint": "eslint . --fix",
54
+ "format": "prettier --write src/",
55
+ "release": "cp ../../README.md . && npm run build && npm publish --access public"
56
+ },
57
+ "peerDependencies": {
58
+ "vue": ">=3.3"
59
+ },
60
+ "dependencies": {
61
+ "@vueuse/core": "^13.0.0",
62
+ "@vueuse/integrations": "^13.0.0",
63
+ "focus-trap": "^7.6.4",
64
+ "motion-v": "^0.13.1",
65
+ "remeda": "^2.21.2",
66
+ "vue": "^3.5.13"
67
+ },
68
+ "devDependencies": {
69
+ "@types/node": "^22.13.11",
70
+ "@vitejs/plugin-vue": "^5.2.1",
71
+ "@vue/eslint-config-prettier": "^10.2.0",
72
+ "@vue/eslint-config-typescript": "^14.5.0",
73
+ "@vue/tsconfig": "^0.7.0",
74
+ "ajv": "^8.17.1",
75
+ "eslint": "^9.23.0",
76
+ "eslint-plugin-vue": "^10.0.0",
77
+ "prettier": "^3.5.3",
78
+ "typescript": "~5.6.3",
79
+ "vite": "^6.2.2",
80
+ "vite-plugin-dts": "4.5.3",
81
+ "vue-tsc": "^2.2.8"
82
+ },
83
+ "files": [
84
+ "dist",
85
+ "README.md",
86
+ "LICENSE"
87
+ ],
88
+ "publishConfig": {
89
+ "access": "public"
90
+ }
91
+ }