import { useState } from "react"; import { AlertDialog } from "@godxjp/ui/feedback"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display"; import { Button } from "@godxjp/ui/general"; import { Flex, PageContainer } from "@godxjp/ui/layout"; /** * DangerConfirm recipe (godxui#193) — high-stakes deletion built on the AlertDialog preset. * No new component: `challenge` gates the confirm button behind an exact typed slug, and `stepUp` * runs an async passkey / 2FA re-auth before onConfirm fires. Both force the destructive shape * (button + leading status glyph, untinted surface — antd `Modal.confirm` parity). * Mirrors DXS SCR-203 (org delete by slug) and SCR-209 (refund with step-up). */ export default function Demo() { const [orgOpen, setOrgOpen] = useState(false); const [refundOpen, setRefundOpen] = useState(false); return ( Organization delete · typed slug challenge The confirm button stays disabled until the operator types the exact organization slug (acme-inc). A typed challenge always forces the destructive shape: the destructive confirm button and antd’s leading status glyph. The header surface stays untinted — the glyph is the signal, exactly as Modal.confirm does it. { await new Promise((r) => setTimeout(r, 800)); setOrgOpen(false); }} /> Refund · step-up re-authentication A privileged action guarded by stepUp: the async passkey / 2FA check runs first, the button shows a verifying state, and a failed check keeps the dialog open with an announced error. onConfirm only fires after step-up resolves truthy. { // A real consumer triggers a passkey / WebAuthn or TOTP challenge here. await new Promise((r) => setTimeout(r, 600)); return true; }} onConfirm={async () => { await new Promise((r) => setTimeout(r, 500)); setRefundOpen(false); }} /> ); }