diff --git a/src/App.vue b/src/App.vue
index d1d3642e..b48b849e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -19,6 +19,7 @@
+
diff --git a/src/components/ui/alert-dialog/AlertDialog.vue b/src/components/ui/alert-dialog/AlertDialog.vue
index 1ecf9284..77512dd0 100644
--- a/src/components/ui/alert-dialog/AlertDialog.vue
+++ b/src/components/ui/alert-dialog/AlertDialog.vue
@@ -1,6 +1,8 @@
-
+
diff --git a/src/components/ui/alert-dialog/AlertDialogStateProvider.vue b/src/components/ui/alert-dialog/AlertDialogStateProvider.vue
new file mode 100644
index 00000000..d44bcade
--- /dev/null
+++ b/src/components/ui/alert-dialog/AlertDialogStateProvider.vue
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/src/components/ui/alert-dialog/context.js b/src/components/ui/alert-dialog/context.js
new file mode 100644
index 00000000..23308fc2
--- /dev/null
+++ b/src/components/ui/alert-dialog/context.js
@@ -0,0 +1 @@
+export const ALERT_DIALOG_OPEN_INJECTION_KEY = Symbol('vrcx-alert-dialog-open');
diff --git a/src/components/ui/dialog/Dialog.vue b/src/components/ui/dialog/Dialog.vue
index 7fe5e9e0..5ba63051 100644
--- a/src/components/ui/dialog/Dialog.vue
+++ b/src/components/ui/dialog/Dialog.vue
@@ -1,6 +1,8 @@
-
+
import { DialogClose, DialogContent, DialogOverlay, DialogPortal, useForwardPropsEmits } from 'reka-ui';
+ import { inject, onBeforeUnmount, ref, watch } from 'vue';
import { X } from 'lucide-vue-next';
+ import { acquireModalPortalLayer } from '@/lib/modalPortalLayers';
import { cn } from '@/lib/utils';
import { reactiveOmit } from '@vueuse/core';
+ import { DIALOG_OPEN_INJECTION_KEY } from './context';
+
defineOptions({
inheritAttrs: false
});
@@ -27,10 +31,30 @@
const delegatedProps = reactiveOmit(props, 'class');
const forwarded = useForwardPropsEmits(delegatedProps, emits);
+
+ const injectedOpen = inject(DIALOG_OPEN_INJECTION_KEY, null);
+ const open = injectedOpen ?? ref(true);
+
+ const portalLayer = acquireModalPortalLayer();
+ const portalTo = portalLayer.element;
+
+ watch(
+ open,
+ (isOpen) => {
+ if (isOpen) {
+ portalLayer.bringToFront();
+ }
+ },
+ { immediate: true }
+ );
+
+ onBeforeUnmount(() => {
+ portalLayer.release();
+ });
-
+
+ import { provide, toRef } from 'vue';
+
+ import { DIALOG_OPEN_INJECTION_KEY } from './context';
+
+ const props = defineProps({
+ open: { type: Boolean, required: true }
+ });
+
+ provide(DIALOG_OPEN_INJECTION_KEY, toRef(props, 'open'));
+
+
+
+
+
diff --git a/src/components/ui/dialog/PromptDialogModal.vue b/src/components/ui/dialog/PromptDialogModal.vue
index 0189734c..6f210ac2 100644
--- a/src/components/ui/dialog/PromptDialogModal.vue
+++ b/src/components/ui/dialog/PromptDialogModal.vue
@@ -29,7 +29,7 @@
promptErrorMessage
} = storeToRefs(modalStore);
- const { handleSubmit, resetForm, setValues, values } = useForm({
+ const { handleSubmit, resetForm, values } = useForm({
initialValues: {
value: ''
}
@@ -88,7 +88,11 @@
[promptOpen, promptInputValue],
([open, inputValue]) => {
if (open) {
- setValues({ value: inputValue ?? '' });
+ resetForm({
+ values: {
+ value: inputValue ?? ''
+ }
+ });
return;
}
@@ -110,12 +114,19 @@
@pointerDownOutside="onPointerDownOutside"
@interactOutside="onInteractOutside">