@ttt-productions/ui-core 0.11.4 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The inline required-reason config. The caller OWNS the reason value/onChange (draft state lives at
3
+ * the call site). Any `minLength`/`maxLength` the caller supplies MUST come from a caller-owned
4
+ * constant — this component declares no business numbers and no copy; it only derives the gate + the
5
+ * Textarea `maxLength` from the values it is handed.
6
+ */
7
+ export interface ConsequenceDialogReason {
8
+ required?: boolean;
9
+ minLength?: number;
10
+ maxLength?: number;
11
+ placeholder?: string;
12
+ label?: React.ReactNode;
13
+ value: string;
14
+ onChange: (value: string) => void;
15
+ rows?: number;
16
+ }
17
+ /**
18
+ * The exact-match typed-confirmation gate. `phrase` is business copy owned by the CALLER; the
19
+ * component only compares the typed value against it.
20
+ */
21
+ export interface ConsequenceDialogTypedConfirmation {
22
+ phrase: string;
23
+ label?: React.ReactNode;
24
+ }
25
+ export interface ConsequenceDialogProps {
26
+ /** Uncontrolled open model: the element that opens the dialog (rendered `asChild`). */
27
+ trigger?: React.ReactNode;
28
+ /** Controlled open model. Provide with `onOpenChange`. */
29
+ open?: boolean;
30
+ onOpenChange?: (open: boolean) => void;
31
+ /** Heading — a string or node so callers can interpolate amounts / names. */
32
+ title: React.ReactNode;
33
+ /** SLOT 1 — what happens right now (e.g. "initiates a Stripe refund of $X now"). */
34
+ immediateEffect?: React.ReactNode;
35
+ /** SLOT 2 — what settles later, out of band (webhook / worker / async confirmation). */
36
+ delayedEffect?: React.ReactNode;
37
+ /** SLOT 3 — whether/how this can be undone or superseded. */
38
+ reversibility?: React.ReactNode;
39
+ /** Inline required-reason field. Optional. */
40
+ reason?: ConsequenceDialogReason;
41
+ /** Exact-phrase typed-confirmation gate. Optional. */
42
+ typedConfirmation?: ConsequenceDialogTypedConfirmation;
43
+ confirmLabel: React.ReactNode;
44
+ cancelLabel?: React.ReactNode;
45
+ /** `true` styles the confirm button with `bg-destructive`. */
46
+ destructive?: boolean;
47
+ /**
48
+ * Runs on confirm. May be async — while it is pending the dialog STAYS OPEN, both buttons disable,
49
+ * and a `Loader2` spins in the confirm button. Closes on resolve. If it rejects the dialog
50
+ * stays open so the caller's own surface (error toast, TOTP step-up) can show and the operator can
51
+ * retry or cancel. This component takes no Sentry/monitoring dependency — every error path
52
+ * belongs to the caller's `onConfirm`.
53
+ */
54
+ onConfirm: () => void | Promise<void>;
55
+ }
56
+ /**
57
+ * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled
58
+ * consequence slots (immediate / afterward / reversibility), an optional inline required-reason field,
59
+ * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives
60
+ * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /
61
+ * `onOpenChange` (controlled).
62
+ *
63
+ * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not
64
+ * auto-close on click; open state is managed here so the dialog stays open with a visible spinner
65
+ * until `onConfirm` resolves.
66
+ */
67
+ export declare function ConsequenceDialog({ trigger, open, onOpenChange, title, immediateEffect, delayedEffect, reversibility, reason, typedConfirmation, confirmLabel, cancelLabel, destructive, onConfirm, }: ConsequenceDialogProps): import("react").JSX.Element;
68
+ //# sourceMappingURL=consequence-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consequence-dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KA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}
@@ -0,0 +1,80 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCallback, useId, useState } from 'react';
4
+ import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, } from './alert-dialog.js';
5
+ import { Button } from './button.js';
6
+ import { Textarea } from './textarea.js';
7
+ import { Input } from './input.js';
8
+ import { Label } from './label.js';
9
+ import { Loader2, Zap, Clock, RotateCcw } from 'lucide-react';
10
+ const SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';
11
+ function ConsequenceRow({ icon: Icon, label, children, }) {
12
+ return (_jsxs("span", { className: "flex items-start gap-2", children: [_jsx(Icon, { className: SLOT_ICON_CLASS, "aria-hidden": "true" }), _jsxs("span", { className: "stack-1 min-w-0", children: [_jsx("span", { className: "text-caption font-medium uppercase tracking-wide text-muted-foreground", children: label }), _jsx("span", { className: "text-small text-foreground", children: children })] })] }));
13
+ }
14
+ /**
15
+ * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled
16
+ * consequence slots (immediate / afterward / reversibility), an optional inline required-reason field,
17
+ * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives
18
+ * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /
19
+ * `onOpenChange` (controlled).
20
+ *
21
+ * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not
22
+ * auto-close on click; open state is managed here so the dialog stays open with a visible spinner
23
+ * until `onConfirm` resolves.
24
+ */
25
+ export function ConsequenceDialog({ trigger, open, onOpenChange, title, immediateEffect, delayedEffect, reversibility, reason, typedConfirmation, confirmLabel, cancelLabel = 'Cancel', destructive = false, onConfirm, }) {
26
+ const isControlled = open !== undefined;
27
+ const [internalOpen, setInternalOpen] = useState(false);
28
+ const [typedValue, setTypedValue] = useState('');
29
+ const [pending, setPending] = useState(false);
30
+ const actualOpen = isControlled ? open : internalOpen;
31
+ const reasonId = useId();
32
+ const typedId = useId();
33
+ const setOpenState = useCallback((next) => {
34
+ if (isControlled)
35
+ onOpenChange?.(next);
36
+ else
37
+ setInternalOpen(next);
38
+ }, [isControlled, onOpenChange]);
39
+ // Never allow an open-state change (Escape, cancel, controlled parent) to fight the pending action.
40
+ const handleOpenChange = useCallback((next) => {
41
+ if (pending)
42
+ return;
43
+ setTypedValue(''); // reset the typed gate on every open/close
44
+ setOpenState(next);
45
+ }, [pending, setOpenState]);
46
+ const handleConfirm = useCallback(async () => {
47
+ if (pending)
48
+ return;
49
+ setPending(true);
50
+ try {
51
+ await onConfirm();
52
+ setTypedValue('');
53
+ setOpenState(false);
54
+ }
55
+ catch {
56
+ // Keep the dialog open — the caller's onConfirm surfaced the error (toast / step-up). The
57
+ // operator can retry or cancel. Never rethrow, never monitor here.
58
+ }
59
+ finally {
60
+ setPending(false);
61
+ }
62
+ }, [pending, onConfirm, setOpenState]);
63
+ const reasonTrimmedLength = reason ? reason.value.trim().length : 0;
64
+ const reasonProvided = reasonTrimmedLength > 0;
65
+ const reasonOk = !reason
66
+ ? true
67
+ : reason.required && !reasonProvided
68
+ ? false
69
+ : !reasonProvided
70
+ ? true // optional + empty is fine
71
+ : (reason.minLength === undefined || reasonTrimmedLength >= reason.minLength) &&
72
+ (reason.maxLength === undefined || reason.value.length <= reason.maxLength);
73
+ const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;
74
+ const confirmDisabled = pending || !reasonOk || !typedOk;
75
+ return (_jsxs(AlertDialog, { open: actualOpen, onOpenChange: handleOpenChange, children: [trigger ? _jsx(AlertDialogTrigger, { asChild: true, children: trigger }) : null, _jsxs(AlertDialogContent, { onEscapeKeyDown: (e) => {
76
+ if (pending)
77
+ e.preventDefault();
78
+ }, children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), _jsx(AlertDialogDescription, { asChild: true, children: _jsxs("span", { className: "stack-3", children: [immediateEffect ? (_jsx(ConsequenceRow, { icon: Zap, label: "Immediately", children: immediateEffect })) : null, delayedEffect ? (_jsx(ConsequenceRow, { icon: Clock, label: "Afterward", children: delayedEffect })) : null, reversibility ? (_jsx(ConsequenceRow, { icon: RotateCcw, label: "Reversibility", children: reversibility })) : null] }) })] }), reason ? (_jsxs("div", { className: "stack-2", children: [_jsx(Label, { htmlFor: reasonId, children: reason.label ?? 'Reason' }), _jsx(Textarea, { id: reasonId, value: reason.value, onChange: (e) => reason.onChange(e.target.value), placeholder: reason.placeholder, maxLength: reason.maxLength, rows: reason.rows ?? 3, disabled: pending })] })) : null, typedConfirmation ? (_jsxs("div", { className: "stack-2", children: [_jsx(Label, { htmlFor: typedId, children: typedConfirmation.label ?? (_jsxs(_Fragment, { children: ["Type ", _jsx("span", { className: "font-mono", children: typedConfirmation.phrase }), " to confirm"] })) }), _jsx(Input, { id: typedId, value: typedValue, onChange: (e) => setTypedValue(e.target.value), placeholder: typedConfirmation.phrase, disabled: pending, autoComplete: "off" })] })) : null, _jsxs(AlertDialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => handleOpenChange(false), disabled: pending, children: cancelLabel }), _jsxs(Button, { variant: destructive ? 'destructive' : 'default', onClick: handleConfirm, disabled: confirmDisabled, "aria-busy": pending, children: [pending ? _jsx(Loader2, { className: "mr-2 spinner-xs", "aria-hidden": "true" }) : null, confirmLabel] })] })] })] }));
79
+ }
80
+ //# sourceMappingURL=consequence-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consequence-dialog.js","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB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AAiB,CAAC,MAAM,EACrC,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAC,KAAK,GAClB,IACE,CACP,CAAC,CAAC,CAAC,IAAI,EAER,MAAC,iBAAiB,eAChB,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACtC,QAAQ,EAAE,OAAO,YAEhB,WAAW,GACL,EACT,MAAC,MAAM,IACL,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAChD,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,eAAe,eACd,OAAO,aAEjB,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,iBAAa,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAC3E,YAAY,IACN,IACS,IACD,IACT,CACf,CAAC;AACJ,CAAC"}
@@ -38,6 +38,8 @@ export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetConten
38
38
  export { Collapsible, CollapsibleTrigger, CollapsibleContent } from "./components/collapsible.js";
39
39
  export type { SearchDropdownProps } from "./components/search-dropdown.js";
40
40
  export { SearchDropdown } from "./components/search-dropdown.js";
41
+ export type { ConsequenceDialogProps, ConsequenceDialogReason, ConsequenceDialogTypedConfirmation } from "./components/consequence-dialog.js";
42
+ export { ConsequenceDialog } from "./components/consequence-dialog.js";
41
43
  export type { MaxWidthOption, ScreenAdaptiveViewProps } from "./components/layout/screen-adaptive-view.js";
42
44
  export { ScreenAdaptiveView } from "./components/layout/screen-adaptive-view.js";
43
45
  export { useMediaQuery } from "./hooks/use-media-query.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,cAAc,EAA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AY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzK,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAClG,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,oCAAoC,CAAC;AAC9I,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,YAAY,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAC3G,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,YAAY,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,YAAY,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,YAAY,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC"}
@@ -33,6 +33,7 @@ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableC
33
33
  export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from "./components/sheet.js";
34
34
  export { Collapsible, CollapsibleTrigger, CollapsibleContent } from "./components/collapsible.js";
35
35
  export { SearchDropdown } from "./components/search-dropdown.js";
36
+ export { ConsequenceDialog } from "./components/consequence-dialog.js";
36
37
  export { ScreenAdaptiveView } from "./components/layout/screen-adaptive-view.js";
37
38
  export { useMediaQuery } from "./hooks/use-media-query.js";
38
39
  // Shared building blocks
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACpL,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC1W,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,g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EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAGzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttt-productions/ui-core",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "Shared UI components for TTT Productions projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,7 +49,7 @@
49
49
  "react-dom": ">=19.0.0",
50
50
  "react-hook-form": ">=7.0.0",
51
51
  "@hookform/resolvers": ">=3.0.0",
52
- "@ttt-productions/firebase-helpers": "^0.12.0"
52
+ "@ttt-productions/firebase-helpers": "^0.12.1"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "react": {
@@ -99,7 +99,7 @@
99
99
  "typescript": "^5.8.3",
100
100
  "react-hook-form": "^7.69.0",
101
101
  "@hookform/resolvers": "^5.2.2",
102
- "@ttt-productions/firebase-helpers": "^0.12.0"
102
+ "@ttt-productions/firebase-helpers": "^0.12.1"
103
103
  },
104
104
  "author": "DJ (TTT Productions)",
105
105
  "license": "MIT"
@@ -0,0 +1,276 @@
1
+ 'use client';
2
+
3
+ import { useCallback, useId, useState } from 'react';
4
+ import {
5
+ AlertDialog,
6
+ AlertDialogTrigger,
7
+ AlertDialogContent,
8
+ AlertDialogHeader,
9
+ AlertDialogFooter,
10
+ AlertDialogTitle,
11
+ AlertDialogDescription,
12
+ } from './alert-dialog.js';
13
+ import { Button } from './button.js';
14
+ import { Textarea } from './textarea.js';
15
+ import { Input } from './input.js';
16
+ import { Label } from './label.js';
17
+ import { Loader2, Zap, Clock, RotateCcw } from 'lucide-react';
18
+
19
+ /**
20
+ * The inline required-reason config. The caller OWNS the reason value/onChange (draft state lives at
21
+ * the call site). Any `minLength`/`maxLength` the caller supplies MUST come from a caller-owned
22
+ * constant — this component declares no business numbers and no copy; it only derives the gate + the
23
+ * Textarea `maxLength` from the values it is handed.
24
+ */
25
+ export interface ConsequenceDialogReason {
26
+ required?: boolean;
27
+ minLength?: number;
28
+ maxLength?: number;
29
+ placeholder?: string;
30
+ label?: React.ReactNode;
31
+ value: string;
32
+ onChange: (value: string) => void;
33
+ rows?: number;
34
+ }
35
+
36
+ /**
37
+ * The exact-match typed-confirmation gate. `phrase` is business copy owned by the CALLER; the
38
+ * component only compares the typed value against it.
39
+ */
40
+ export interface ConsequenceDialogTypedConfirmation {
41
+ phrase: string;
42
+ label?: React.ReactNode;
43
+ }
44
+
45
+ export interface ConsequenceDialogProps {
46
+ /** Uncontrolled open model: the element that opens the dialog (rendered `asChild`). */
47
+ trigger?: React.ReactNode;
48
+ /** Controlled open model. Provide with `onOpenChange`. */
49
+ open?: boolean;
50
+ onOpenChange?: (open: boolean) => void;
51
+
52
+ /** Heading — a string or node so callers can interpolate amounts / names. */
53
+ title: React.ReactNode;
54
+
55
+ /** SLOT 1 — what happens right now (e.g. "initiates a Stripe refund of $X now"). */
56
+ immediateEffect?: React.ReactNode;
57
+ /** SLOT 2 — what settles later, out of band (webhook / worker / async confirmation). */
58
+ delayedEffect?: React.ReactNode;
59
+ /** SLOT 3 — whether/how this can be undone or superseded. */
60
+ reversibility?: React.ReactNode;
61
+
62
+ /** Inline required-reason field. Optional. */
63
+ reason?: ConsequenceDialogReason;
64
+ /** Exact-phrase typed-confirmation gate. Optional. */
65
+ typedConfirmation?: ConsequenceDialogTypedConfirmation;
66
+
67
+ confirmLabel: React.ReactNode;
68
+ cancelLabel?: React.ReactNode;
69
+ /** `true` styles the confirm button with `bg-destructive`. */
70
+ destructive?: boolean;
71
+
72
+ /**
73
+ * Runs on confirm. May be async — while it is pending the dialog STAYS OPEN, both buttons disable,
74
+ * and a `Loader2` spins in the confirm button. Closes on resolve. If it rejects the dialog
75
+ * stays open so the caller's own surface (error toast, TOTP step-up) can show and the operator can
76
+ * retry or cancel. This component takes no Sentry/monitoring dependency — every error path
77
+ * belongs to the caller's `onConfirm`.
78
+ */
79
+ onConfirm: () => void | Promise<void>;
80
+ }
81
+
82
+ const SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';
83
+
84
+ function ConsequenceRow({
85
+ icon: Icon,
86
+ label,
87
+ children,
88
+ }: {
89
+ icon: typeof Zap;
90
+ label: string;
91
+ children: React.ReactNode;
92
+ }) {
93
+ return (
94
+ <span className="flex items-start gap-2">
95
+ <Icon className={SLOT_ICON_CLASS} aria-hidden="true" />
96
+ <span className="stack-1 min-w-0">
97
+ <span className="text-caption font-medium uppercase tracking-wide text-muted-foreground">
98
+ {label}
99
+ </span>
100
+ <span className="text-small text-foreground">{children}</span>
101
+ </span>
102
+ </span>
103
+ );
104
+ }
105
+
106
+ /**
107
+ * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled
108
+ * consequence slots (immediate / afterward / reversibility), an optional inline required-reason field,
109
+ * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives
110
+ * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /
111
+ * `onOpenChange` (controlled).
112
+ *
113
+ * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not
114
+ * auto-close on click; open state is managed here so the dialog stays open with a visible spinner
115
+ * until `onConfirm` resolves.
116
+ */
117
+ export function ConsequenceDialog({
118
+ trigger,
119
+ open,
120
+ onOpenChange,
121
+ title,
122
+ immediateEffect,
123
+ delayedEffect,
124
+ reversibility,
125
+ reason,
126
+ typedConfirmation,
127
+ confirmLabel,
128
+ cancelLabel = 'Cancel',
129
+ destructive = false,
130
+ onConfirm,
131
+ }: ConsequenceDialogProps) {
132
+ const isControlled = open !== undefined;
133
+ const [internalOpen, setInternalOpen] = useState(false);
134
+ const [typedValue, setTypedValue] = useState('');
135
+ const [pending, setPending] = useState(false);
136
+
137
+ const actualOpen = isControlled ? open : internalOpen;
138
+
139
+ const reasonId = useId();
140
+ const typedId = useId();
141
+
142
+ const setOpenState = useCallback(
143
+ (next: boolean) => {
144
+ if (isControlled) onOpenChange?.(next);
145
+ else setInternalOpen(next);
146
+ },
147
+ [isControlled, onOpenChange],
148
+ );
149
+
150
+ // Never allow an open-state change (Escape, cancel, controlled parent) to fight the pending action.
151
+ const handleOpenChange = useCallback(
152
+ (next: boolean) => {
153
+ if (pending) return;
154
+ setTypedValue(''); // reset the typed gate on every open/close
155
+ setOpenState(next);
156
+ },
157
+ [pending, setOpenState],
158
+ );
159
+
160
+ const handleConfirm = useCallback(async () => {
161
+ if (pending) return;
162
+ setPending(true);
163
+ try {
164
+ await onConfirm();
165
+ setTypedValue('');
166
+ setOpenState(false);
167
+ } catch {
168
+ // Keep the dialog open — the caller's onConfirm surfaced the error (toast / step-up). The
169
+ // operator can retry or cancel. Never rethrow, never monitor here.
170
+ } finally {
171
+ setPending(false);
172
+ }
173
+ }, [pending, onConfirm, setOpenState]);
174
+
175
+ const reasonTrimmedLength = reason ? reason.value.trim().length : 0;
176
+ const reasonProvided = reasonTrimmedLength > 0;
177
+ const reasonOk = !reason
178
+ ? true
179
+ : reason.required && !reasonProvided
180
+ ? false
181
+ : !reasonProvided
182
+ ? true // optional + empty is fine
183
+ : (reason.minLength === undefined || reasonTrimmedLength >= reason.minLength) &&
184
+ (reason.maxLength === undefined || reason.value.length <= reason.maxLength);
185
+
186
+ const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;
187
+ const confirmDisabled = pending || !reasonOk || !typedOk;
188
+
189
+ return (
190
+ <AlertDialog open={actualOpen} onOpenChange={handleOpenChange}>
191
+ {trigger ? <AlertDialogTrigger asChild>{trigger}</AlertDialogTrigger> : null}
192
+ <AlertDialogContent
193
+ onEscapeKeyDown={(e) => {
194
+ if (pending) e.preventDefault();
195
+ }}
196
+ >
197
+ <AlertDialogHeader>
198
+ <AlertDialogTitle>{title}</AlertDialogTitle>
199
+ <AlertDialogDescription asChild>
200
+ <span className="stack-3">
201
+ {immediateEffect ? (
202
+ <ConsequenceRow icon={Zap} label="Immediately">
203
+ {immediateEffect}
204
+ </ConsequenceRow>
205
+ ) : null}
206
+ {delayedEffect ? (
207
+ <ConsequenceRow icon={Clock} label="Afterward">
208
+ {delayedEffect}
209
+ </ConsequenceRow>
210
+ ) : null}
211
+ {reversibility ? (
212
+ <ConsequenceRow icon={RotateCcw} label="Reversibility">
213
+ {reversibility}
214
+ </ConsequenceRow>
215
+ ) : null}
216
+ </span>
217
+ </AlertDialogDescription>
218
+ </AlertDialogHeader>
219
+
220
+ {reason ? (
221
+ <div className="stack-2">
222
+ <Label htmlFor={reasonId}>{reason.label ?? 'Reason'}</Label>
223
+ <Textarea
224
+ id={reasonId}
225
+ value={reason.value}
226
+ onChange={(e) => reason.onChange(e.target.value)}
227
+ placeholder={reason.placeholder}
228
+ maxLength={reason.maxLength}
229
+ rows={reason.rows ?? 3}
230
+ disabled={pending}
231
+ />
232
+ </div>
233
+ ) : null}
234
+
235
+ {typedConfirmation ? (
236
+ <div className="stack-2">
237
+ <Label htmlFor={typedId}>
238
+ {typedConfirmation.label ?? (
239
+ <>
240
+ Type <span className="font-mono">{typedConfirmation.phrase}</span> to confirm
241
+ </>
242
+ )}
243
+ </Label>
244
+ <Input
245
+ id={typedId}
246
+ value={typedValue}
247
+ onChange={(e) => setTypedValue(e.target.value)}
248
+ placeholder={typedConfirmation.phrase}
249
+ disabled={pending}
250
+ autoComplete="off"
251
+ />
252
+ </div>
253
+ ) : null}
254
+
255
+ <AlertDialogFooter>
256
+ <Button
257
+ variant="outline"
258
+ onClick={() => handleOpenChange(false)}
259
+ disabled={pending}
260
+ >
261
+ {cancelLabel}
262
+ </Button>
263
+ <Button
264
+ variant={destructive ? 'destructive' : 'default'}
265
+ onClick={handleConfirm}
266
+ disabled={confirmDisabled}
267
+ aria-busy={pending}
268
+ >
269
+ {pending ? <Loader2 className="mr-2 spinner-xs" aria-hidden="true" /> : null}
270
+ {confirmLabel}
271
+ </Button>
272
+ </AlertDialogFooter>
273
+ </AlertDialogContent>
274
+ </AlertDialog>
275
+ );
276
+ }
@@ -41,6 +41,9 @@ export { Collapsible, CollapsibleTrigger, CollapsibleContent } from "./component
41
41
  export type { SearchDropdownProps } from "./components/search-dropdown.js";
42
42
  export { SearchDropdown } from "./components/search-dropdown.js";
43
43
 
44
+ export type { ConsequenceDialogProps, ConsequenceDialogReason, ConsequenceDialogTypedConfirmation } from "./components/consequence-dialog.js";
45
+ export { ConsequenceDialog } from "./components/consequence-dialog.js";
46
+
44
47
  export type { MaxWidthOption, ScreenAdaptiveViewProps } from "./components/layout/screen-adaptive-view.js";
45
48
  export { ScreenAdaptiveView } from "./components/layout/screen-adaptive-view.js";
46
49