@citizenplane/pimp 18.9.21 → 18.9.23
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/dist/components/CpBottomSheet.vue.d.ts +6 -0
- package/dist/components/CpBottomSheet.vue.d.ts.map +1 -1
- package/dist/components/CpDynamicDialog.vue.d.ts +5 -0
- package/dist/components/CpDynamicDialog.vue.d.ts.map +1 -1
- package/dist/pimp.es.js +41 -19
- package/dist/pimp.umd.js +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpBottomSheet.vue +20 -4
- package/src/components/CpDynamicDialog.vue +10 -0
- package/src/stories/CpBottomSheet.stories.ts +24 -0
package/package.json
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
:can-backdrop-close="canBackdropClose"
|
|
5
5
|
:can-swipe-close="canSwipeClose"
|
|
6
6
|
:duration="animationDuration"
|
|
7
|
-
expand-on-content-drag
|
|
7
|
+
:expand-on-content-drag="expandOnContentDrag"
|
|
8
8
|
:swipe-close-threshold="swipeCloseThreshold"
|
|
9
9
|
teleport-defer
|
|
10
|
+
:snap-points="resolvedSnapPoints"
|
|
10
11
|
@closed="onBottomSheetClosed"
|
|
11
12
|
@opened="onBottomSheetOpened"
|
|
12
13
|
>
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
|
|
25
26
|
<script setup lang="ts">
|
|
26
27
|
import VueBottomSheet from '@douxcode/vue-spring-bottom-sheet'
|
|
27
|
-
import { useTemplateRef, watch } from 'vue'
|
|
28
|
+
import { computed, useTemplateRef, watch } from 'vue'
|
|
28
29
|
|
|
29
30
|
interface Emits {
|
|
30
31
|
(e: 'close' | 'open'): void
|
|
@@ -34,13 +35,19 @@ interface Props {
|
|
|
34
35
|
animationDuration?: number
|
|
35
36
|
canBackdropClose?: boolean
|
|
36
37
|
canSwipeClose?: boolean
|
|
38
|
+
expandOnContentDrag?: boolean
|
|
39
|
+
halfAndExpand?: boolean
|
|
37
40
|
preventClose?: boolean
|
|
41
|
+
snapPoints?: Array<number | `${number}%`>
|
|
38
42
|
swipeCloseThreshold?: string
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
const props = withDefaults(defineProps<Props>(), {
|
|
42
46
|
animationDuration: 300,
|
|
43
|
-
|
|
47
|
+
expandOnContentDrag: true,
|
|
48
|
+
halfAndExpand: false,
|
|
49
|
+
snapPoints: () => [],
|
|
50
|
+
swipeCloseThreshold: '40%',
|
|
44
51
|
})
|
|
45
52
|
|
|
46
53
|
const emit = defineEmits<Emits>()
|
|
@@ -48,6 +55,11 @@ const emit = defineEmits<Emits>()
|
|
|
48
55
|
const bottomSheetRef = useTemplateRef('bottomSheetRef')
|
|
49
56
|
const isVisibleModel = defineModel<boolean>()
|
|
50
57
|
|
|
58
|
+
const resolvedSnapPoints = computed((): Array<number | `${number}%`> | undefined => {
|
|
59
|
+
if (props.snapPoints?.length) return props.snapPoints
|
|
60
|
+
return props.halfAndExpand ? ([`${50}%`, `${100}%`] as Array<number | `${number}%`>) : undefined
|
|
61
|
+
})
|
|
62
|
+
|
|
51
63
|
// Set right before syncing a self-close down to the model, so the resulting
|
|
52
64
|
// watch trigger doesn't re-issue a close() the underlying sheet already ran.
|
|
53
65
|
let skipNextToggle = false
|
|
@@ -123,7 +135,7 @@ defineExpose({
|
|
|
123
135
|
|
|
124
136
|
[data-vsbs-sheet] {
|
|
125
137
|
overflow: hidden;
|
|
126
|
-
max-height: calc(100% - 65px) !important;
|
|
138
|
+
max-height: var(--cp-bottomsheet-max-height, calc(100% - 65px - env(safe-area-inset-top, 0px))) !important;
|
|
127
139
|
}
|
|
128
140
|
|
|
129
141
|
[data-vsbs-scroll] {
|
|
@@ -132,6 +144,10 @@ defineExpose({
|
|
|
132
144
|
overscroll-behavior: unset !important;
|
|
133
145
|
}
|
|
134
146
|
|
|
147
|
+
[data-vsbs-footer] {
|
|
148
|
+
padding-bottom: var(--cp-bottomsheet-footer-padding-bottom, calc(16px + env(safe-area-inset-bottom, 0px))) !important;
|
|
149
|
+
}
|
|
150
|
+
|
|
135
151
|
[data-vsbs-footer]:is(.vsbs-enter-active) {
|
|
136
152
|
pointer-events: none;
|
|
137
153
|
}
|
|
@@ -42,12 +42,17 @@ import { Breakpoints } from '@/constants/layout'
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
interface Props {
|
|
45
|
+
animationDuration?: number
|
|
45
46
|
breakpoint?: number
|
|
46
47
|
class?: string
|
|
48
|
+
expandOnContentDrag?: boolean
|
|
49
|
+
halfAndExpand?: boolean
|
|
47
50
|
isClosableOnClickOutside?: boolean
|
|
48
51
|
maxWidth?: number | undefined
|
|
49
52
|
preventClose?: boolean
|
|
53
|
+
snapPoints?: Array<number | `${number}%`>
|
|
50
54
|
subtitle?: string
|
|
55
|
+
swipeCloseThreshold?: string
|
|
51
56
|
title?: string
|
|
52
57
|
}
|
|
53
58
|
|
|
@@ -83,7 +88,12 @@ const dynamicComponentProps = computed(() => {
|
|
|
83
88
|
contentClass: props.class,
|
|
84
89
|
canBackdropClose: !props.preventClose,
|
|
85
90
|
canSwipeClose: !props.preventClose,
|
|
91
|
+
expandOnContentDrag: props.expandOnContentDrag,
|
|
86
92
|
preventClose: props.preventClose,
|
|
93
|
+
halfAndExpand: props.halfAndExpand,
|
|
94
|
+
snapPoints: props.snapPoints,
|
|
95
|
+
swipeCloseThreshold: props.swipeCloseThreshold,
|
|
96
|
+
animationDuration: props.animationDuration,
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
|
|
@@ -66,6 +66,30 @@ export const Default: Story = {
|
|
|
66
66
|
>
|
|
67
67
|
<template #header><strong>Header slot</strong></template>
|
|
68
68
|
<p>This is the default slot content. You can put any content here.</p>
|
|
69
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
70
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
71
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
72
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
73
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
74
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
75
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
76
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
77
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
78
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
79
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
80
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
81
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
82
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
83
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
84
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
85
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
86
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
87
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
88
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
89
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
90
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
91
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
92
|
+
<p>This is the default slot content. You can put any content here.</p>
|
|
69
93
|
<template #footer>
|
|
70
94
|
<CpButton @click="isVisible = false">Close</CpButton>
|
|
71
95
|
</template>
|