@maas/vue-equipment 0.24.5 → 0.24.7
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/nuxt/module.json +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +29 -8
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +1 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +2 -2
- package/dist/plugins/MagicDrawer/src/composables/useDrawerApi.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/composables/useDrawerApi.mjs +6 -2
- package/dist/plugins/MagicDrawer/src/types/index.d.ts +2 -0
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.mjs +4 -2
- package/dist/plugins/MagicModal/src/utils/defaultOptions.mjs +2 -1
- package/package.json +1 -1
package/dist/nuxt/module.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
:class="[
|
|
13
13
|
toValue(props.class),
|
|
14
14
|
`-${mappedOptions.position}`,
|
|
15
|
-
{ '-dragging': dragging },
|
|
15
|
+
{ '-dragging': dragging, '-disabled': disabled },
|
|
16
16
|
]"
|
|
17
17
|
aria-modal="true"
|
|
18
18
|
>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<div
|
|
24
24
|
v-show="innerActive"
|
|
25
25
|
class="magic-drawer__backdrop"
|
|
26
|
-
@click.self="
|
|
26
|
+
@click.self="guardedClose"
|
|
27
27
|
>
|
|
28
28
|
<slot name="backdrop" />
|
|
29
29
|
</div>
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
ref="elRef"
|
|
46
46
|
class="magic-drawer__drag"
|
|
47
47
|
:style="style"
|
|
48
|
-
@pointerdown="
|
|
49
|
-
@click="
|
|
48
|
+
@pointerdown="guardedPointerdown"
|
|
49
|
+
@click="guardedClick"
|
|
50
50
|
>
|
|
51
51
|
<component
|
|
52
52
|
v-if="component"
|
|
53
53
|
v-bind="props"
|
|
54
54
|
:is="component"
|
|
55
|
-
@close="
|
|
55
|
+
@close="guardedClose"
|
|
56
56
|
/>
|
|
57
57
|
<slot v-else />
|
|
58
58
|
<div v-if="hasDragged" class="magic-drawer__overlay" />
|
|
@@ -209,6 +209,15 @@ const contentTransition = computed(() => {
|
|
|
209
209
|
: mappedOptions.transitions?.content
|
|
210
210
|
})
|
|
211
211
|
|
|
212
|
+
// Make sure this is reactive
|
|
213
|
+
const disabled = computed(() => {
|
|
214
|
+
if (props.options.disabled === undefined) {
|
|
215
|
+
return defaultOptions.disabled
|
|
216
|
+
} else {
|
|
217
|
+
return props.options.disabled
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
|
|
212
221
|
// Private functions
|
|
213
222
|
function convertToPixels(value: string) {
|
|
214
223
|
const regex = /^(\d*\.?\d+)\s*(rem|px)$/
|
|
@@ -246,8 +255,20 @@ function onClose() {
|
|
|
246
255
|
}
|
|
247
256
|
|
|
248
257
|
// Public functions
|
|
249
|
-
function
|
|
250
|
-
if (
|
|
258
|
+
function guardedPointerdown(event: PointerEvent) {
|
|
259
|
+
if (!disabled.value) {
|
|
260
|
+
onPointerdown(event)
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function guardedClick(event: PointerEvent) {
|
|
265
|
+
if (!disabled.value) {
|
|
266
|
+
onClick(event)
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function guardedClose() {
|
|
271
|
+
if (canClose && !disabled.value) {
|
|
251
272
|
close()
|
|
252
273
|
}
|
|
253
274
|
}
|
|
@@ -297,5 +318,5 @@ onBeforeUnmount(() => {
|
|
|
297
318
|
</script>
|
|
298
319
|
|
|
299
320
|
<style>
|
|
300
|
-
:root{--magic-drawer-height:75svh;--magic-drawer-width:100%;--magic-drawer-z-index:999;--magic-drawer-justify-content:center;--magic-drawer-align-items:flex-end;--magic-drawer-backdrop-color:rgba(0,0,0,.5);--magic-drawer-backdrop-filter:unset;--magic-drawer-content-overflow-x:hidden;--magic-drawer-content-overflow-y:hidden;--magic-drawer-enter-animation:slide-btt-in 300ms ease;--magic-drawer-leave-animation:slide-btt-out 300ms ease;--magic-drawer-drag-overshoot:4rem;--magic-drawer-padding:0px}.magic-drawer{--magic-drawer-drag-overshoot-x:0px;--magic-drawer-drag-overshoot-y:0px;align-items:var(--magic-drawer-align-items);background:transparent;border:none;color:inherit;display:flex;height:100%;inset:0;justify-content:var(--magic-drawer-justify-content);padding:0;pointer-events:none;position:fixed;width:100%;z-index:var(--magic-drawer-z-index)}.magic-drawer.-bottom{--magic-drawer-drag-overshoot-y:var(--magic-drawer-drag-overshoot);--magic-drawer-padding:0 0 var(--magic-drawer-drag-overshoot-y) 0}.magic-drawer.-bottom>.magic-drawer__wrapper{height:calc(var(--magic-drawer-height, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer.-top{--magic-drawer-enter-animation:slide-ttb-in 300ms ease;--magic-drawer-leave-animation:slide-ttb-out 300ms ease;--magic-drawer-align-items:flex-start;--magic-drawer-drag-overshoot-y:calc(var(--magic-drawer-drag-overshoot)*-1);--magic-drawer-padding:var(--magic-drawer-drag-overshoot-y) 0 0 0}.magic-drawer.-top>.magic-drawer__wrapper{height:calc(var(--magic-drawer-height, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer.-right{--magic-drawer-enter-animation:slide-rtl-in 300ms ease;--magic-drawer-leave-animation:slide-rtl-out 300ms ease;--magic-drawer-align-items:center;--magic-drawer-justify-content:flex-end;--magic-drawer-drag-overshoot-x:var(--magic-drawer-drag-overshoot);--magic-drawer-padding:0 var(--magic-drawer-drag-overshoot-x) 0 0}.magic-drawer.-right>.magic-drawer__wrapper{width:calc(var(--magic-drawer-width, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer.-left{--magic-drawer-enter-animation:slide-ltr-in 300ms ease;--magic-drawer-leave-animation:slide-ltr-out 300ms ease;--magic-drawer-align-items:center;--magic-drawer-justify-content:flex-start;--magic-drawer-drag-overshoot-x:calc(var(--magic-drawer-drag-overshoot)*-1);--magic-drawer-padding:0 0 0 var(--magic-drawer-drag-overshoot-x)}.magic-drawer.-left>.magic-drawer__wrapper{width:calc(var(--magic-drawer-width, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer__wrapper{height:var(--magic-drawer-height);pointer-events:none;transform:translate(var(--magic-drawer-drag-overshoot-x),var(--magic-drawer-drag-overshoot-y));width:var(--magic-drawer-width)}.magic-drawer__content{height:100%;max-height:100%;position:relative;width:100%}.magic-drawer__drag{-webkit-overflow-scrolling:touch;align-items:var(--magic-drawer-align-items);cursor:grab;display:flex;height:100%;justify-content:var(--magic-drawer-justify-content);overflow-x:var(--magic-drawer-content-overflow-x);overflow-y:var(--magic-drawer-content-overflow-y);pointer-events:auto;position:relative;scroll-behavior:smooth;width:100%}dialog.magic-drawer__drag{background:transparent;border:0;margin:0;outline:0;padding:0}dialog.magic-drawer__drag::backdrop{background-color:transparent}.magic-drawer.-dragging .magic-drawer__drag{cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;user-select:none}.magic-drawer__drag>*{padding:var(--magic-drawer-padding)}.magic-drawer__overlay{inset:0;position:absolute;z-index:9999}.magic-drawer__backdrop{-webkit-backdrop-filter:var(--magic-drawer-backdrop-filter);backdrop-filter:var(--magic-drawer-backdrop-filter);background-color:var(--magic-drawer-backdrop-color);bottom:0;height:100%;left:0;pointer-events:auto;position:fixed;right:0;top:0;width:100%;z-index:-1}.magic-drawer--content-enter-active{animation:var(--magic-drawer-enter-animation)}.magic-drawer--content-leave-active{animation:var(--magic-drawer-leave-animation)}.magic-drawer--backdrop-enter-active{animation:fade-in .3s ease}.magic-drawer--backdrop-leave-active{animation:fade-out .3s ease}
|
|
321
|
+
:root{--magic-drawer-height:75svh;--magic-drawer-width:100%;--magic-drawer-z-index:999;--magic-drawer-justify-content:center;--magic-drawer-align-items:flex-end;--magic-drawer-backdrop-color:rgba(0,0,0,.5);--magic-drawer-backdrop-filter:unset;--magic-drawer-content-overflow-x:hidden;--magic-drawer-content-overflow-y:hidden;--magic-drawer-enter-animation:slide-btt-in 300ms ease;--magic-drawer-leave-animation:slide-btt-out 300ms ease;--magic-drawer-drag-overshoot:4rem;--magic-drawer-padding:0px}.magic-drawer{--magic-drawer-drag-overshoot-x:0px;--magic-drawer-drag-overshoot-y:0px;align-items:var(--magic-drawer-align-items);background:transparent;border:none;color:inherit;display:flex;height:100%;inset:0;justify-content:var(--magic-drawer-justify-content);padding:0;pointer-events:none;position:fixed;width:100%;z-index:var(--magic-drawer-z-index)}.magic-drawer.-bottom{--magic-drawer-drag-overshoot-y:var(--magic-drawer-drag-overshoot);--magic-drawer-padding:0 0 var(--magic-drawer-drag-overshoot-y) 0}.magic-drawer.-bottom>.magic-drawer__wrapper{height:calc(var(--magic-drawer-height, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer.-top{--magic-drawer-enter-animation:slide-ttb-in 300ms ease;--magic-drawer-leave-animation:slide-ttb-out 300ms ease;--magic-drawer-align-items:flex-start;--magic-drawer-drag-overshoot-y:calc(var(--magic-drawer-drag-overshoot)*-1);--magic-drawer-padding:var(--magic-drawer-drag-overshoot-y) 0 0 0}.magic-drawer.-top>.magic-drawer__wrapper{height:calc(var(--magic-drawer-height, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer.-right{--magic-drawer-enter-animation:slide-rtl-in 300ms ease;--magic-drawer-leave-animation:slide-rtl-out 300ms ease;--magic-drawer-align-items:center;--magic-drawer-justify-content:flex-end;--magic-drawer-drag-overshoot-x:var(--magic-drawer-drag-overshoot);--magic-drawer-padding:0 var(--magic-drawer-drag-overshoot-x) 0 0}.magic-drawer.-right>.magic-drawer__wrapper{width:calc(var(--magic-drawer-width, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer.-left{--magic-drawer-enter-animation:slide-ltr-in 300ms ease;--magic-drawer-leave-animation:slide-ltr-out 300ms ease;--magic-drawer-align-items:center;--magic-drawer-justify-content:flex-start;--magic-drawer-drag-overshoot-x:calc(var(--magic-drawer-drag-overshoot)*-1);--magic-drawer-padding:0 0 0 var(--magic-drawer-drag-overshoot-x)}.magic-drawer.-left>.magic-drawer__wrapper{width:calc(var(--magic-drawer-width, 0px) + var(--magic-drawer-drag-overshoot, 0px))}.magic-drawer__wrapper{height:var(--magic-drawer-height);pointer-events:none;transform:translate(var(--magic-drawer-drag-overshoot-x),var(--magic-drawer-drag-overshoot-y));width:var(--magic-drawer-width)}.magic-drawer__content{height:100%;max-height:100%;position:relative;width:100%}.magic-drawer__drag{-webkit-overflow-scrolling:touch;align-items:var(--magic-drawer-align-items);cursor:grab;display:flex;height:100%;justify-content:var(--magic-drawer-justify-content);overflow-x:var(--magic-drawer-content-overflow-x);overflow-y:var(--magic-drawer-content-overflow-y);pointer-events:auto;position:relative;scroll-behavior:smooth;width:100%}dialog.magic-drawer__drag{background:transparent;border:0;margin:0;outline:0;padding:0}dialog.magic-drawer__drag::backdrop{background-color:transparent}.magic-drawer.-dragging .magic-drawer__drag{cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;user-select:none}.magic-drawer.-disabled .magic-drawer__drag{cursor:auto}.magic-drawer__drag>*{padding:var(--magic-drawer-padding)}.magic-drawer__overlay{inset:0;position:absolute;z-index:9999}.magic-drawer__backdrop{-webkit-backdrop-filter:var(--magic-drawer-backdrop-filter);backdrop-filter:var(--magic-drawer-backdrop-filter);background-color:var(--magic-drawer-backdrop-color);bottom:0;height:100%;left:0;pointer-events:auto;position:fixed;right:0;top:0;width:100%;z-index:-1}.magic-drawer.-disabled .magic-drawer__backdrop{pointer-events:none}.magic-drawer--content-enter-active{animation:var(--magic-drawer-enter-animation)}.magic-drawer--content-leave-active{animation:var(--magic-drawer-leave-animation)}.magic-drawer--backdrop-enter-active{animation:fade-in .3s ease}.magic-drawer--backdrop-leave-active{animation:fade-out .3s ease}
|
|
301
322
|
</style>
|
|
@@ -148,7 +148,7 @@ export function useDrawerSnap(args) {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
async function snapTo(args2) {
|
|
151
|
-
const { snapPoint, interpolate: interpolate2, duration
|
|
151
|
+
const { snapPoint, interpolate: interpolate2, duration } = args2;
|
|
152
152
|
await nextTick();
|
|
153
153
|
switch (position) {
|
|
154
154
|
case "top":
|
|
@@ -189,7 +189,7 @@ export function useDrawerSnap(args) {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
async function interpolateDragged(args2) {
|
|
192
|
-
const { to, duration =
|
|
192
|
+
const { to, duration = toValue(snap).duration } = args2;
|
|
193
193
|
const snapPoint = snapPointsMap.value[to];
|
|
194
194
|
useDrawerEmitter().emit("beforeSnap", { id: toValue(id), snapPoint });
|
|
195
195
|
switch (position) {
|
|
@@ -13,7 +13,7 @@ export declare function useDrawerApi(id?: MaybeRef<string>, options?: UseDrawerA
|
|
|
13
13
|
}>;
|
|
14
14
|
open: () => void;
|
|
15
15
|
close: () => void;
|
|
16
|
-
snapTo: (snapPoint: SnapPoint) => void;
|
|
16
|
+
snapTo: (snapPoint: SnapPoint, duration: number) => void;
|
|
17
17
|
trapFocus: () => void;
|
|
18
18
|
releaseFocus: () => void;
|
|
19
19
|
lockScroll: () => void;
|
|
@@ -37,8 +37,12 @@ export function useDrawerApi(id, options) {
|
|
|
37
37
|
function close() {
|
|
38
38
|
removeInstance(mappedId.value);
|
|
39
39
|
}
|
|
40
|
-
function snapTo(snapPoint) {
|
|
41
|
-
useDrawerEmitter().emit("snapTo", {
|
|
40
|
+
function snapTo(snapPoint, duration) {
|
|
41
|
+
useDrawerEmitter().emit("snapTo", {
|
|
42
|
+
id: mappedId.value,
|
|
43
|
+
snapPoint,
|
|
44
|
+
duration
|
|
45
|
+
});
|
|
42
46
|
}
|
|
43
47
|
function trapFocus() {
|
|
44
48
|
if (focusTrap) {
|
|
@@ -32,6 +32,7 @@ export interface DrawerOptions {
|
|
|
32
32
|
initial?: SnapPoint;
|
|
33
33
|
};
|
|
34
34
|
canClose?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
35
36
|
}
|
|
36
37
|
export type DrawerEvents = {
|
|
37
38
|
beforeEnter: string;
|
|
@@ -47,6 +48,7 @@ export type DrawerEvents = {
|
|
|
47
48
|
snapTo: {
|
|
48
49
|
id: string;
|
|
49
50
|
snapPoint: SnapPoint;
|
|
51
|
+
duration?: number;
|
|
50
52
|
};
|
|
51
53
|
afterSnap: {
|
|
52
54
|
id: string;
|
|
@@ -3,7 +3,8 @@ const defaultOptions = {
|
|
|
3
3
|
backdrop: true,
|
|
4
4
|
focusTrap: {
|
|
5
5
|
initialFocus: false,
|
|
6
|
-
setReturnFocus: false
|
|
6
|
+
setReturnFocus: false,
|
|
7
|
+
allowOutsideClick: true
|
|
7
8
|
},
|
|
8
9
|
scrollLock: true,
|
|
9
10
|
scrollLockPadding: true,
|
|
@@ -32,6 +33,7 @@ const defaultOptions = {
|
|
|
32
33
|
duration: 200,
|
|
33
34
|
initial: 1
|
|
34
35
|
},
|
|
35
|
-
canClose: true
|
|
36
|
+
canClose: true,
|
|
37
|
+
disabled: false
|
|
36
38
|
};
|
|
37
39
|
export { defaultOptions };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "A magic collection of Vue composables, plugins, components and directives",
|
|
4
|
-
"version": "0.24.
|
|
4
|
+
"version": "0.24.7",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@antfu/ni": "^0.21.12",
|