diff --git a/resources/js/components/SessionExpiry.vue b/resources/js/components/SessionExpiry.vue index 032812449ba..be75e8331a0 100644 --- a/resources/js/components/SessionExpiry.vue +++ b/resources/js/components/SessionExpiry.vue @@ -2,129 +2,116 @@
+
+
+
- - - -
-
- {{ __('Resume Your Session') }} -
- -
-
-
- + +
+ - - diff --git a/resources/js/components/collections/DeleteLocalizationConfirmation.vue b/resources/js/components/collections/DeleteLocalizationConfirmation.vue index 8c81c2a4b82..2e8ce9da0dd 100644 --- a/resources/js/components/collections/DeleteLocalizationConfirmation.vue +++ b/resources/js/components/collections/DeleteLocalizationConfirmation.vue @@ -1,63 +1,57 @@ + + diff --git a/resources/js/components/modals/ElevatedSessionModal.vue b/resources/js/components/modals/ElevatedSessionModal.vue index 7012fec1174..e008935b261 100644 --- a/resources/js/components/modals/ElevatedSessionModal.vue +++ b/resources/js/components/modals/ElevatedSessionModal.vue @@ -1,73 +1,73 @@
-
+ + - - diff --git a/resources/js/components/two-factor/RecoveryCodesModal.vue b/resources/js/components/two-factor/RecoveryCodesModal.vue index 283dc6289ea..8d955c4bbd6 100644 --- a/resources/js/components/two-factor/RecoveryCodesModal.vue +++ b/resources/js/components/two-factor/RecoveryCodesModal.vue @@ -2,6 +2,7 @@ import { ref, onMounted } from 'vue'; import LoadingGraphic from '@statamic/components/LoadingGraphic.vue'; import axios from 'axios'; +import { Modal, Button } from '@statamic/ui'; const emit = defineEmits(['cancel', 'close']); @@ -46,20 +47,13 @@ function copyToClipboard() { diff --git a/resources/js/components/ui/Modal/Modal.vue b/resources/js/components/ui/Modal/Modal.vue index 074f3824590..ad845bd98f9 100644 --- a/resources/js/components/ui/Modal/Modal.vue +++ b/resources/js/components/ui/Modal/Modal.vue @@ -2,9 +2,13 @@ import { cva } from 'cva'; import { hasComponent } from '@statamic/composables/has-component.js'; import { DialogContent, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger } from 'reka-ui'; +import { getCurrentInstance, ref, watch } from 'vue'; + +const emit = defineEmits(['update:open']); const props = defineProps({ title: { type: String, default: '' }, + open: { type: Boolean, default: false }, }); const hasModalTitleComponent = hasComponent('ModalTitle'); @@ -22,10 +26,32 @@ const modalClasses = cva({ 'slide-in-from-top-2', ], })({}); + +const instance = getCurrentInstance(); +const isUsingOpenProp = instance && 'open' in instance.vnode.props; + +const open = ref(props.open); + +watch( + () => props.open, + (value) => open.value = value, +); + +// When the parent component controls the open state, emit an update event +// so it can update its state, which eventually gets passed down as a prop. +// Otherwise, just update the local state. +function updateOpen(value) { + if (isUsingOpenProp) { + emit('update:open', value); + return; + } + + open.value = value; +}