@orsetra/shared-ui 1.12.0 → 1.12.1
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.
|
@@ -33,6 +33,14 @@ export interface ConfirmationDialogProps {
|
|
|
33
33
|
}
|
|
34
34
|
open?: boolean
|
|
35
35
|
onOpenChange?: (open: boolean) => void
|
|
36
|
+
/**
|
|
37
|
+
* Keeps the confirm button disabled whatever is typed: the action is blocked by a
|
|
38
|
+
* precondition that is checked once the dialog is open, or is still being checked. Say why
|
|
39
|
+
* in `children`.
|
|
40
|
+
*/
|
|
41
|
+
confirmDisabled?: boolean
|
|
42
|
+
/** Shown under the description: what stands in the way of the action, or what it implies. */
|
|
43
|
+
children?: ReactNode
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
export function ConfirmationDialog({
|
|
@@ -47,6 +55,8 @@ export function ConfirmationDialog({
|
|
|
47
55
|
requireTextConfirmation,
|
|
48
56
|
open: controlledOpen,
|
|
49
57
|
onOpenChange: controlledOnOpenChange,
|
|
58
|
+
confirmDisabled = false,
|
|
59
|
+
children,
|
|
50
60
|
}: ConfirmationDialogProps) {
|
|
51
61
|
const { alert, showSuccess, showError, hideAlert } = useAlertBanner()
|
|
52
62
|
const [loading, setLoading] = useState(false)
|
|
@@ -59,6 +69,7 @@ export function ConfirmationDialog({
|
|
|
59
69
|
|
|
60
70
|
const isConfirmDisabled =
|
|
61
71
|
loading ||
|
|
72
|
+
confirmDisabled ||
|
|
62
73
|
(requireTextConfirmation &&
|
|
63
74
|
confirmationText !== requireTextConfirmation.expectedText)
|
|
64
75
|
|
|
@@ -109,6 +120,8 @@ export function ConfirmationDialog({
|
|
|
109
120
|
/>
|
|
110
121
|
)}
|
|
111
122
|
|
|
123
|
+
{children}
|
|
124
|
+
|
|
112
125
|
{requireTextConfirmation && (
|
|
113
126
|
<div className="space-y-2">
|
|
114
127
|
<Label htmlFor="confirmation-input">
|