mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-16 04:02:15 +01:00
add modal focus trap & fix design bug in project billable section
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, onUnmounted, watch } from 'vue';
|
import { computed, nextTick, onMounted, onUnmounted, watch } from 'vue';
|
||||||
import { useId } from 'radix-vue';
|
import { useId } from 'radix-vue';
|
||||||
import { isLastLayer, layers } from '@/packages/ui/src/utils/dismissableLayer';
|
import { isLastLayer, layers } from '@/packages/ui/src/utils/dismissableLayer';
|
||||||
|
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: {
|
show: {
|
||||||
@@ -74,6 +76,23 @@ const maxWidthClass = computed(() => {
|
|||||||
'2xl': 'sm:max-w-2xl',
|
'2xl': 'sm:max-w-2xl',
|
||||||
}[props.maxWidth];
|
}[props.maxWidth];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const target = ref();
|
||||||
|
const { activate, deactivate } = useFocusTrap(target);
|
||||||
|
watch(
|
||||||
|
() => props.show,
|
||||||
|
(value) => {
|
||||||
|
if (value) {
|
||||||
|
nextTick(() => {
|
||||||
|
activate();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
nextTick(() => {
|
||||||
|
deactivate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -109,6 +128,7 @@ const maxWidthClass = computed(() => {
|
|||||||
<div
|
<div
|
||||||
v-show="show"
|
v-show="show"
|
||||||
role="dialog"
|
role="dialog"
|
||||||
|
ref="target"
|
||||||
class="mb-6 bg-default-background border border-card-border rounded-lg shadow-xl transform transition-all sm:w-full sm:mx-auto"
|
class="mb-6 bg-default-background border border-card-border rounded-lg shadow-xl transform transition-all sm:w-full sm:mx-auto"
|
||||||
:class="maxWidthClass">
|
:class="maxWidthClass">
|
||||||
<slot v-if="show" />
|
<slot v-if="show" />
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const emit = defineEmits(['submit']);
|
|||||||
<template>
|
<template>
|
||||||
<div class="sm:flex items-center space-y-2 sm:space-y-0 sm:space-x-4 pt-6">
|
<div class="sm:flex items-center space-y-2 sm:space-y-0 sm:space-x-4 pt-6">
|
||||||
<div>
|
<div>
|
||||||
<div class="flex items-center space-x-1">
|
<div class="flex items-center space-x-1 mb-2">
|
||||||
<BillableIcon
|
<BillableIcon
|
||||||
class="text-text-quaternary h-4 ml-1 mr-0.5"></BillableIcon>
|
class="text-text-quaternary h-4 ml-1 mr-0.5"></BillableIcon>
|
||||||
<InputLabel for="billable" value="Billable Default" />
|
<InputLabel for="billable" value="Billable Default" />
|
||||||
|
|||||||
Reference in New Issue
Block a user