From 3ab5db90ad740e5a74bdf0ca2e8cac826d25af22 Mon Sep 17 00:00:00 2001 From: Developing-Gamer Date: Wed, 27 May 2026 12:31:14 -0700 Subject: [PATCH] Refresh action dialog chrome. Co-authored-by: Cursor --- .../src/components/ui/action-dialog.tsx | 135 +++++++++--------- 1 file changed, 66 insertions(+), 69 deletions(-) diff --git a/apps/dashboard/src/components/ui/action-dialog.tsx b/apps/dashboard/src/components/ui/action-dialog.tsx index c002a3591..b74eed732 100644 --- a/apps/dashboard/src/components/ui/action-dialog.tsx +++ b/apps/dashboard/src/components/ui/action-dialog.tsx @@ -2,11 +2,14 @@ import type { Icon as PhosphorIcon } from "@phosphor-icons/react"; import { InfoIcon, WarningCircleIcon } from "@phosphor-icons/react"; +import { + DesignButton, + DesignDialog, + type DesignDialogSize, +} from "@stackframe/dashboard-ui-components"; import React, { Suspense, useId } from "react"; import { Alert } from "./alert"; -import { Button } from "./button"; import { Checkbox } from "./checkbox"; -import { Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./dialog"; import { Label } from "./label"; import { Skeleton } from "./skeleton"; @@ -22,12 +25,12 @@ export type ActionDialogProps = { okButton?: boolean | Readonly<{ label?: string, onClick?: () => Promise<"prevent-close" | undefined | void>, - props?: Partial>, + props?: Partial>, }>, cancelButton?: boolean | Readonly<{ label?: string, onClick?: () => Promise<"prevent-close" | undefined | void>, - props?: Partial>, + props?: Partial>, }>, confirmText?: string, children?: React.ReactNode, @@ -43,6 +46,7 @@ export type ActionDialogProps = { * (border, ring, bg, shadow, padding, rounded, etc.). */ contentClassName?: string, + size?: DesignDialogSize, }; export function ActionDialog(props: ActionDialogProps) { @@ -62,75 +66,43 @@ export function ActionDialog(props: ActionDialogProps) { const blockDismissOnOutside = !!(props.preventClose || props.keepOpenOnOutsideInteraction); - const onOpenChange = (open: boolean) => { - if (!open) { + const onOpenChange = (nextOpen: boolean) => { + if (!nextOpen) { props.onClose?.(); setConfirmed(false); } else { setInvalidationCount(invalidationCount + 1); } - setOpenState(open); - props.onOpenChange?.(open); + setOpenState(nextOpen); + props.onOpenChange?.(nextOpen); }; + const trigger = props.trigger != null && React.isValidElement(props.trigger) + ? props.trigger + : undefined; + return ( - - {props.trigger && - {props.trigger} - } - - e.preventDefault() : undefined} - onPointerDownOutside={blockDismissOnOutside ? (e) => e.preventDefault() : undefined} - onFocusOutside={blockDismissOnOutside ? (e) => e.preventDefault() : undefined} - className={[ - props.preventClose ? "[&>button]:hidden" : "", - props.contentClassName ?? "", - ].filter(Boolean).join(" ")} - > - - - - {title} - - - {props.description} - - - - -
- - - - - - - - - - - - }> - {props.children} - -
- - {props.confirmText && - - } -
- - - {anyButton && + e.preventDefault() : undefined, + onPointerDownOutside: blockDismissOnOutside ? (e) => e.preventDefault() : undefined, + onFocusOutside: blockDismissOnOutside ? (e) => e.preventDefault() : undefined, + }} + footer={anyButton ? ( +
{cancelButton && ( - + )} {okButton && ( - + )} - } - -
+ + ) : undefined} + > + + + + + + + + + + + + }> + {props.children} + + + {props.confirmText && ( + + + + )} + ); }