Skip to content

Commit 0cbb45b

Browse files
committed
fix: document scroll on dragging;
fix: update package references to use @douxcode/vue-spring-bottom-sheet and adjust README instructions;
1 parent 6120442 commit 0cbb45b

File tree

10 files changed

+30
-20
lines changed

10 files changed

+30
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ npm install @douxcode/vue-spring-bottom-sheet
1313
```
1414

1515
```
16-
bun i @douxcode/vue-spring-bottom-sheet
16+
bun install @douxcode/vue-spring-bottom-sheet
1717
```
1818

1919
# Getting started

playground/nuxt/components/NavigationBar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<style scoped>
1313
.navbar {
1414
background-color: #e6e6e6;
15+
font-size: 14px;
1516
}
1617
1718
.nav-list {

playground/nuxt/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22
export default defineNuxtConfig({
33
compatibilityDate: '2024-11-01',
4-
devtools: { enabled: true },
4+
devtools: { enabled: false },
55
})

playground/nuxt/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"build": "nuxt build",
77
"dev": "nuxt dev",
8+
"dev:host": "nuxt dev --host",
89
"generate": "nuxt generate",
910
"preview": "nuxt preview",
1011
"postinstall": "nuxt prepare"
@@ -14,6 +15,6 @@
1415
"nuxt": "^3.14.1592",
1516
"vue": "latest",
1617
"vue-router": "latest",
17-
"vue-spring-bottom-sheet": "link:vue-spring-bottom-sheet"
18+
"@douxcode/vue-spring-bottom-sheet": "link:@douxcode/vue-spring-bottom-sheet"
1819
}
1920
}

playground/nuxt/pages/blocking.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
22
import { ref, version } from 'vue'
33
4-
import BottomSheet from 'vue-spring-bottom-sheet'
5-
import 'vue-spring-bottom-sheet/dist/style.css'
4+
import BottomSheet from '@douxcode/vue-spring-bottom-sheet'
5+
import '@douxcode/vue-spring-bottom-sheet/dist/style.css'
66
77
const bottomSheet = ref<InstanceType<typeof BottomSheet>>()
88
const open = ref(false)

playground/nuxt/pages/index.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
22
import { ref, version } from 'vue'
33
4-
import BottomSheet from 'vue-spring-bottom-sheet'
5-
import 'vue-spring-bottom-sheet/dist/style.css'
4+
import BottomSheet from '@douxcode/vue-spring-bottom-sheet'
5+
import '@douxcode/vue-spring-bottom-sheet/dist/style.css'
66
77
const bottomSheet = ref<InstanceType<typeof BottomSheet>>()
88
@@ -23,8 +23,9 @@ const close = () => {
2323
<ClientOnly>
2424
<BottomSheet ref="bottomSheet">
2525
<p class="mb-4">
26-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias atque error dignissimos impedit iure facilis ipsam sit cum molestias,
27-
natus, cupiditate molestiae, id exercitationem eaque obcaecati a animi. Accusamus, pariatur.
26+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias atque error dignissimos
27+
impedit iure facilis ipsam sit cum molestias, natus, cupiditate molestiae, id exercitationem
28+
eaque obcaecati a animi. Accusamus, pariatur.
2829
</p>
2930
<details class="mb-4">
3031
<summary>Tap to expand</summary>

playground/nuxt/pages/snap.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
22
import { ref, version } from 'vue'
33
4-
import BottomSheet from 'vue-spring-bottom-sheet'
5-
import 'vue-spring-bottom-sheet/dist/style.css'
4+
import BottomSheet from '@douxcode/vue-spring-bottom-sheet'
5+
import '@douxcode/vue-spring-bottom-sheet/dist/style.css'
66
77
const bottomSheet = ref<InstanceType<typeof BottomSheet>>()
88
const maxHeight = ref(0)
@@ -38,12 +38,16 @@ const snapToPoint = (snapPoint: number) => {
3838
<button type="button" @click="snapToPoint(maxHeight / 1.5)">Middle</button>
3939
<button type="button" @click="snapToPoint(maxHeight / 3)">Bottom</button>
4040
</div>
41-
<button type="button" style="margin-bottom: 1rem" @click="expandOnContentDrag = !expandOnContentDrag">
41+
<button
42+
type="button"
43+
style="margin-bottom: 1rem"
44+
@click="expandOnContentDrag = !expandOnContentDrag"
45+
>
4246
{{ expandOnContentDrag ? 'Enable' : 'Disable' }} expand on content drag
4347
</button>
4448
<p v-for="i in 14" :key="i">
45-
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Iste aperiam, accusamus amet veniam officiis libero necessitatibus ipsum,
46-
reprehenderit eveniet neque ad delectus fugit!
49+
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Iste aperiam, accusamus amet
50+
veniam officiis libero necessitatibus ipsum, reprehenderit eveniet neque ad delectus fugit!
4751
</p>
4852
</BottomSheet>
4953
</ClientOnly>

playground/nuxt/pages/sticky.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
22
import { ref, version } from 'vue'
33
4-
import BottomSheet from 'vue-spring-bottom-sheet'
5-
import 'vue-spring-bottom-sheet/dist/style.css'
4+
import BottomSheet from '@douxcode/vue-spring-bottom-sheet'
5+
import '@douxcode/vue-spring-bottom-sheet/dist/style.css'
66
77
const bottomSheet = ref<InstanceType<typeof BottomSheet>>()
88
@@ -26,8 +26,8 @@ const close = () => {
2626
<h1 style="font-size: 24px; margin: 0; text-align: center">Header</h1>
2727
</template>
2828
<p v-for="i in 5" :key="i">
29-
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Iste aperiam, accusamus amet veniam officiis libero necessitatibus ipsum,
30-
reprehenderit eveniet neque ad delectus fugit!
29+
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Iste aperiam, accusamus amet
30+
veniam officiis libero necessitatibus ipsum, reprehenderit eveniet neque ad delectus fugit!
3131
</p>
3232
<template #footer>
3333
<button type="button" @click="close">Close bottom sheet</button>

playground/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"vue": "3.3.0",
1313
"vue-router": "^4.5.0",
14-
"vue-spring-bottom-sheet": "link:vue-spring-bottom-sheet"
14+
"@douxcode/vue-spring-bottom-sheet": "link:@douxcode/vue-spring-bottom-sheet"
1515
},
1616
"devDependencies": {
1717
"@vitejs/plugin-vue": "^5.2.1",

src/BottomSheet.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const { height: sheetContentHeight } = useElementBounding(sheetContent)
5757
5858
const { activate, deactivate } = useFocusTrap([sheet, backdrop], { immediate: false })
5959
60-
// Computed minimum height
60+
// Computed values
6161
const minHeightComputed = computed(() =>
6262
Math.ceil(sheetContentHeight.value + sheetHeaderHeight.value + sheetFooterHeight.value),
6363
)
@@ -86,6 +86,7 @@ const {
8686
} = useSnapPoints(snapPointsRef, height)
8787
8888
const isWindowScrollLocked = useScrollLock(document.body)
89+
const isWindowRootScrollLocked = useScrollLock(document.documentElement)
8990
9091
// Keyboard event handler
9192
const handleEscapeKey = (e: KeyboardEvent) => {
@@ -105,6 +106,7 @@ const open = () => {
105106
push('y', 0, motionProperties, { type: 'tween', easings: 'easeInOut', bounce: 0, duration: 300 })
106107
showSheet.value = true
107108
isWindowScrollLocked.value = true
109+
isWindowRootScrollLocked.value = true
108110
109111
window.addEventListener('keydown', handleEscapeKey)
110112
@@ -125,6 +127,7 @@ const close = () => {
125127
126128
showSheet.value = false
127129
isWindowScrollLocked.value = false
130+
isWindowRootScrollLocked.value = false
128131
129132
if (props.blocking) {
130133
deactivate()

0 commit comments

Comments
 (0)