Files
aigc-home/calliope-web/src/lib/components/ui/ConfirmDialog.svelte
T
施工员andmultica-agent e42212a16f feat(ui): fusion design tokens and shared component reskin (HEL-651 A batch)
- app.css: HEL-649 §一 tokens (bg/line/accent/status/text/type/space/radius/shadow/motion), legacy names aliased, reduced-motion via prefers-reduced-motion and data-reduce
- shared .a-btn/.status-chip/.a-panel/inputs reskinned; new .a-tag/.a-progress/.a-sprocket/.a-stage/.a-float
- tailwind colors/radii reference the same CSS variables
- ui primitives (StatusChip/ProgressBar/Modal/Button/ConfirmDialog/Skeleton/Switch/Card/Toast) on tokens
- running state -> --run, awaiting confirm -> --warn, --cloud purple removed, old palette literals -> tokens

Co-authored-by: multica-agent <github@multica.ai>
2026-09-30 08:29:37 +08:00

64 lines
1.2 KiB
Svelte

<script lang="ts">
import Button from './Button.svelte';
import Modal from './Modal.svelte';
interface Props {
open?: boolean;
title: string;
message: string;
confirmLabel?: string;
cancelLabel?: string;
danger?: boolean;
onconfirm: () => void;
oncancel?: () => void;
}
let {
open = $bindable(false),
title,
message,
confirmLabel = 'Confirm',
cancelLabel = 'Cancel',
danger = false,
onconfirm,
oncancel,
}: Props = $props();
// Set when the user confirms, so the ensuing close is not reported as a cancel.
let confirmed = false;
function handleConfirm() {
confirmed = true;
open = false;
onconfirm();
}
function handleClose() {
if (confirmed) {
confirmed = false;
return;
}
oncancel?.();
}
</script>
<Modal bind:open {title} onclose={handleClose}>
<p class="confirm-message">{message}</p>
{#snippet footer()}
<Button variant="ghost" onclick={() => (open = false)}>{cancelLabel}</Button
>
<Button variant={danger ? 'danger-solid' : 'primary'} onclick={handleConfirm}
>{confirmLabel}</Button
>
{/snippet}
</Modal>
<style>
.confirm-message {
margin: 0;
font-size: 14px;
line-height: 1.5;
color: var(--text-secondary);
}
</style>