From 44068e66c36b9ad33af3c9fb6947523030c31526 Mon Sep 17 00:00:00 2001 From: Seth Sharp <58869086+SethSharp@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:30:03 +1000 Subject: [PATCH 1/2] add prop --- app/pages/components/ConfirmDialog.vue | 2 ++ src/components/alert-dialog/AlertDialogAction.vue | 10 +++++++--- src/components/alert-dialog/AlertDialogCancel.vue | 15 ++++++++++++--- src/components/confirm-dialog/ConfirmDialog.vue | 4 ++-- .../confirm-dialog/use-confirm-dialog.ts | 2 ++ 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/app/pages/components/ConfirmDialog.vue b/app/pages/components/ConfirmDialog.vue index 18951e8..e660587 100644 --- a/app/pages/components/ConfirmDialog.vue +++ b/app/pages/components/ConfirmDialog.vue @@ -37,6 +37,7 @@ const customDialog = () => { "You can also provide a full object with label and handler to fully customise the confirm dialog.", cancelAction: { label: "Cancel Me!", + variant: "ghost", handler: () => { alert("Wow a custom cancel!") close() @@ -44,6 +45,7 @@ const customDialog = () => { }, action: { label: "Confirm Me!", + variant: "destructive", handler: () => { alert("Wow a custom action!") close() diff --git a/src/components/alert-dialog/AlertDialogAction.vue b/src/components/alert-dialog/AlertDialogAction.vue index c559d6d..b5aa76b 100644 --- a/src/components/alert-dialog/AlertDialogAction.vue +++ b/src/components/alert-dialog/AlertDialogAction.vue @@ -2,9 +2,13 @@ import { type HTMLAttributes, computed } from "vue" import { AlertDialogAction, type AlertDialogActionProps } from "radix-vue" import { cn } from "@/lib/utils" -import { buttonVariants } from "@/components/button" +import { buttonVariants, type ButtonVariants } from "@/components/button" -const props = defineProps() +const props = defineProps< + AlertDialogActionProps & { + class?: HTMLAttributes["class"] + variant?: ButtonVariants["variant"] +}>() const delegatedProps = computed(() => { const { class: _, ...delegated } = props @@ -14,7 +18,7 @@ const delegatedProps = computed(() => { diff --git a/src/components/alert-dialog/AlertDialogCancel.vue b/src/components/alert-dialog/AlertDialogCancel.vue index 5a131fd..60dcd02 100644 --- a/src/components/alert-dialog/AlertDialogCancel.vue +++ b/src/components/alert-dialog/AlertDialogCancel.vue @@ -2,9 +2,18 @@ import { type HTMLAttributes, computed } from "vue" import { AlertDialogCancel, type AlertDialogCancelProps } from "radix-vue" import { cn } from "@/lib/utils" -import { buttonVariants } from "@/components/button" +import { type ButtonVariants, buttonVariants } from "@/components/button" -const props = defineProps() +const props = withDefaults( + defineProps< + AlertDialogCancelProps & { + class?: HTMLAttributes["class"] + variant?: ButtonVariants["variant"] + } + >(), { + variant: "outline" + } +) const delegatedProps = computed(() => { const { class: _, ...delegated } = props @@ -16,7 +25,7 @@ const delegatedProps = computed(() => {