Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/cms/src/temporary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const {
HasInputOptions,
InlineEditForm,
RelatedItem,
ConfirmationModal,
RevisionHistory,
RestoreRevision,
RevisionPreview,
Expand Down
1 change: 1 addition & 0 deletions packages/cms/src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const {
CodeEditor,
Combobox,
CommandPaletteItem,
ConfirmationModal,
Context,
ContextFooter,
ContextHeader,
Expand Down
1 change: 0 additions & 1 deletion resources/js/bootstrap/cms/temporary.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export { default as HasInputOptions } from '../../components/fieldtypes/HasInputOptions.js';
export { default as InlineEditForm } from '../../components/inputs/relationship/InlineEditForm.vue';
export { default as RelatedItem } from '../../components/inputs/relationship/Item.vue';
export { default as ConfirmationModal } from '../../components/modals/ConfirmationModal.vue';
export { default as RevisionHistory } from '../../components/revision-history/History.vue';
export { default as RestoreRevision } from '../../components/revision-history/Restore.vue';
export { default as RevisionPreview } from '../../components/revision-history/Preview.vue';
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/cms/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
CodeEditor,
Combobox,
CommandPaletteItem,
ConfirmationModal,
Context,
ContextFooter,
ContextHeader,
Expand Down
2 changes: 1 addition & 1 deletion resources/js/bootstrap/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Slugify from '../components/slugs/Slugify.vue';
import ElementContainer from '../components/ElementContainer.vue';
import CreateEntryButton from '../components/entries/CreateEntryButton.vue';
import Portal from '../components/portals/Portal.vue';
import ConfirmationModal from '../components/modals/ConfirmationModal.vue';
import ConfirmationModal from '../components/ui/Modal/ConfirmationModal.vue';
import FieldActionModal from '../components/field-actions/FieldActionModal.vue';
import ElevatedSessionModal from '../components/modals/ElevatedSessionModal.vue';
import ResourceDeleter from '../components/ResourceDeleter.vue';
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/ResourceDeleter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<confirmation-modal
v-if="deleting"
:open="deleting"
:title="modalTitle"
:bodyText="modalBody"
:buttonText="__('Delete')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/actions/ConfirmableAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ defineExpose({

<template>
<confirmation-modal
v-if="confirming"
v-model:open="confirming"
:title="action.title"
:danger="action.dangerous"
:submittable="action.runnable"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/assets/Editor/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
/>

<confirmation-modal
v-if="closingWithChanges"
v-model:open="closingWithChanges"
:title="__('Unsaved Changes')"
:body-text="__('Are you sure? Unsaved changes will be lost.')"
:button-text="__('Discard Changes')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/assets/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


<confirmation-modal
v-if="showNewFilenameModal"
:open="showNewFilenameModal"
:title="__('New Filename')"
@cancel="showNewFilenameModal = false"
@confirm="confirmNewFilename"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/blueprints/BlueprintResetter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<confirmation-modal
v-if="resetting"
:open="resetting"
:title="modalTitle"
:bodyText="modalBody"
:buttonText="__('Reset')"
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/entries/PublishForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
/>

<confirmation-modal
v-if="selectingOrigin"
:open="selectingOrigin"
:title="__('Create Localization')"
:buttonText="__('Create')"
@cancel="cancelLocalization()"
Expand All @@ -234,7 +234,7 @@
</confirmation-modal>

<confirmation-modal
v-if="pendingLocalization"
:open="pendingLocalization"
:title="__('Unsaved Changes')"
:body-text="__('Are you sure? Unsaved changes will be lost.')"
:button-text="__('Continue')"
Expand Down
1 change: 1 addition & 0 deletions resources/js/components/field-actions/FieldActionModal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div>
<confirmation-modal
open
:title="title"
:danger="dangerous"
:buttonText="buttonText"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fieldsets/FieldsetDeleter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<confirmation-modal
v-if="deleting"
:open="deleting"
:title="modalTitle"
:buttonText="__('Delete')"
:danger="true"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fieldsets/FieldsetResetter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<confirmation-modal
v-if="resetting"
:open="resetting"
:title="modalTitle"
:bodyText="modalBody"
:buttonText="__('Reset')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fieldtypes/ArrayFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</div>

<confirmation-modal
v-if="deleting !== false"
:open="deleting !== false"
:title="__('Delete Row')"
:bodyText="__('Are you sure you want to delete this row?')"
:buttonText="__('Delete')"
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/fieldtypes/TableFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</section>

<confirmation-modal
v-if="deletingRow !== false"
:open="deletingRow !== false"
:title="__('Delete Row')"
:bodyText="__('Are you sure you want to delete this row?')"
:buttonText="__('Delete')"
Expand All @@ -72,7 +72,7 @@
</confirmation-modal>

<confirmation-modal
v-if="deletingColumn !== false"
:open="deletingColumn !== false"
:title="__('Delete Column')"
:bodyText="__('Are you sure you want to delete this column?')"
:buttonText="__('Delete')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fieldtypes/grid/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</element-container>

<confirmation-modal
v-if="deletingRow !== null"
:open="deletingRow !== null"
:title="__('Delete Row')"
:body-text="__('Are you sure?')"
:button-text="__('Delete')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fieldtypes/replicator/Set.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function onAnimationComplete() {
</div>

<confirmation-modal
v-if="deletingSet"
:open="deletingSet"
:title="__('Delete Set')"
:body-text="__('Are you sure?')"
:button-text="__('Delete')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/globals/PublishForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
/>

<confirmation-modal
v-if="pendingLocalization"
:open="pendingLocalization"
:title="__('Unsaved Changes')"
:body-text="__('Are you sure? Unsaved changes will be lost.')"
:button-text="__('Continue')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</Stack>

<confirmation-modal
v-if="closingWithChanges"
:open="closingWithChanges"
:title="__('Unsaved Changes')"
:body-text="__('Are you sure? Unsaved changes will be lost.')"
:button-text="__('Discard Changes')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/revision-history/Restore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Button @click="confirming = true" :text="__('Restore')" />

<confirmation-modal
v-if="confirming"
:open="confirming"
:title="__('Restore Revision')"
:buttonText="__('Restore')"
@confirm="restore"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/structures/PageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>

<confirmation-modal
v-if="closingWithChanges"
:open="closingWithChanges"
:title="__('Unsaved Changes')"
:body-text="__('Are you sure? Unsaved changes will be lost.')"
:button-text="__('Discard Changes')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/structures/PageTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</ui-panel>

<confirmation-modal
v-if="discardingChanges"
:open="discardingChanges"
:title="__('Discard Changes')"
:body-text="__('Are you sure?')"
:button-text="__('Discard Changes')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/terms/PublishForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</PublishContainer>

<confirmation-modal
v-if="pendingLocalization"
:open="pendingLocalization"
:title="__('Unsaved Changes')"
:body-text="__('Are you sure? Unsaved changes will be lost.')"
:button-text="__('Continue')"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/two-factor/RecoveryCodesModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function copyToClipboard() {
</Modal>

<confirmation-modal
v-if="confirming"
:open="confirming"
:danger="true"
:title="__('Are you sure?')"
@cancel="confirming = false"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/two-factor/TwoFactor.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import { ref, watch } from 'vue';
import ConfirmationModal from '@/components/modals/ConfirmationModal.vue';
import { ConfirmationModal } from '@ui';
import TwoFactorSetup from './Setup.vue';
import TwoFactorRecoveryCodesModal from './RecoveryCodesModal.vue';
import { requireElevatedSession } from '@/components/elevated-sessions';
Expand Down
6 changes: 3 additions & 3 deletions resources/js/components/ui/Listing/Presets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function deletePreset() {
</div>

<confirmation-modal
v-if="isCreating"
:open="isCreating"
:title="__('Create New View')"
:buttonText="__('Create')"
@cancel="isCreating = false"
Expand All @@ -222,7 +222,7 @@ function deletePreset() {
</confirmation-modal>

<confirmation-modal
v-if="isRenaming"
:open="isRenaming"
:title="__('Rename View')"
:buttonText="__('Rename')"
@cancel="isRenaming = false"
Expand All @@ -242,7 +242,7 @@ function deletePreset() {
</confirmation-modal>

<confirmation-modal
v-if="isConfirmingDeletion"
:open="isConfirmingDeletion"
:title="__('Delete View')"
:bodyText="__('Are you sure you want to delete this view?')"
:buttonText="__('Delete')"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<script setup>
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
import { computed, onBeforeUnmount, onMounted, ref, useSlots } from 'vue';
import { Modal, ModalClose, Button, Icon } from '@/components/ui';

const emit = defineEmits(['opened', 'confirm', 'cancel']);
const emit = defineEmits([
'update:open',
'opened',
'confirm',
'cancel'
]);

const props = defineProps({
/** The controlled open state of the modal. */
open: { type: Boolean, default: false },
title: {
type: String,
},
Expand Down Expand Up @@ -36,21 +43,17 @@ const props = defineProps({
default: false,
},
busy: {
type: Boolean,
default: false,
type: [Boolean, undefined],
default: undefined,
},
});

onMounted(() => emit('opened'));

const modalOpen = ref(true);

function updateModalOpen(open) {
if (! open && props.busy) {
return;
}

modalOpen.value = open;
emit('update:open', open);

if (! open) emit('cancel');
}
Expand All @@ -59,11 +62,27 @@ function submit() {
if (props.busy) return;

emit('confirm');

if (shouldCloseOnSubmit.value) {
updateModalOpen(false);
}
}

const shouldCloseOnSubmit = computed(() => {
// If the busy prop is provided, we will assume they will handle the open state externally.
return props.busy === undefined;
});
</script>

<template>
<Modal ref="modal" :title="__(title)" :open="modalOpen" @update:open="updateModalOpen">
<Modal
ref="modal"
:title="__(title)"
:open="open"
:dismissible="cancellable"
@update:open="updateModalOpen"
@opened="emit('opened')"
>
<div
v-if="busy"
class="pointer-events-none absolute inset-0 flex select-none items-center justify-center bg-white bg-opacity-75 dark:bg-gray-850"
Expand All @@ -78,9 +97,8 @@ function submit() {

<template v-if="cancellable || submittable" #footer>
<div class="flex items-center justify-end space-x-3 pt-3 pb-1">
<ModalClose asChild>
<ModalClose asChild v-if="cancellable">
<Button
v-if="cancellable"
variant="ghost"
:disabled="busy"
:text="__(cancelText)"
Expand Down
1 change: 1 addition & 0 deletions resources/js/components/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export { default as Checkbox } from './Checkbox/Item.vue';
export { default as CheckboxGroup } from './Checkbox/Group.vue';
export { default as CodeEditor } from './CodeEditor.vue';
export { default as Combobox } from './Combobox/Combobox.vue';
export { default as ConfirmationModal } from './Modal/ConfirmationModal.vue';
export { default as Context } from './Context/Context.vue';
export { default as ContextFooter } from './Context/Footer.vue';
export { default as ContextHeader } from './Context/Header.vue';
Expand Down
2 changes: 1 addition & 1 deletion resources/js/pages/layout/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ provide('layout', {
/>

<confirmation-modal
v-if="$root.copyToClipboardModalUrl"
:open="$root.copyToClipboardModalUrl !== null"
:cancellable="false"
:button-text="__('OK')"
:title="__('Copy to clipboard')"
Expand Down
4 changes: 2 additions & 2 deletions resources/js/pages/preferences/nav/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
/>

<confirmation-modal
v-if="confirmingReset"
:open="confirmingReset"
:title="__('Reset')"
:bodyText="__('Are you sure you want to reset nav customizations?')"
:buttonText="__('Reset')"
Expand All @@ -189,7 +189,7 @@
/>

<confirmation-modal
v-if="confirmingRemoval"
:open="confirmingRemoval"
:title="__('Remove')"
:bodyText="__('Are you sure you want to remove this section and all of its children?')"
:buttonText="__('Remove')"
Expand Down
3 changes: 1 addition & 2 deletions resources/js/pages/users/Passkeys.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { startRegistration, browserSupportsWebAuthn } from '@simplewebauthn/brow
import { router } from '@inertiajs/vue3';
import axios from 'axios'
import Head from '@/pages/layout/Head.vue';
import { Header, Button, EmptyStateMenu, EmptyStateItem, Listing, DropdownItem, Modal, Input, ModalClose, Field } from '@ui';
import ConfirmationModal from '@/components/modals/ConfirmationModal.vue';
import { Header, Button, EmptyStateMenu, EmptyStateItem, Listing, DropdownItem, Modal, ConfirmationModal, Input, ModalClose, Field } from '@ui';
import { toggleArchitecturalBackground } from '@/pages/layout/architectural-background.js';

const props = defineProps([
Expand Down
Loading