feat: enhance AlertDialog and ConfirmDialog providers with customizable message defaults#9
Conversation
…le message defaults
Greptile SummaryThis PR adds opt-in Confidence Score: 5/5Safe to merge; all open concerns are P2 and were flagged in prior review threads. No new P0 or P1 issues found. The || → ?? migration is correct, DEFAULT_*_MESSAGES constants are well-structured, and the per-call override precedence is implemented correctly throughout. The two previously flagged concerns (missing useMemo on resolvedMessages and the stale JSDoc) remain P2 and are already tracked. registry/radix-nova/confirm-provider.tsx and registry/radix-nova/alert-provider.tsx — useMemo on resolvedMessages (tracked in prior review thread).
|
| Filename | Overview |
|---|---|
| registry/radix-nova/confirm-provider.tsx | Adds ConfirmDialogMessages interface, DEFAULT_CONFIRM_MESSAGES constant, and messages/defaultVariant props; switches fallbacks from |
| registry/radix-nova/alert-provider.tsx | Adds AlertDialogMessages interface, DEFAULT_ALERT_MESSAGES constant, and messages prop; resolvedMessages is computed inline (no useMemo), previously flagged. |
| registry/radix-nova/confirm-dialog.tsx | Adds requireConfirmationLabel as a required prop, removes hardcoded default string, and falls back to the provider-supplied label. JSDoc on label still references old hardcoded default (previously flagged). |
| components/docs/interactive-examples/confirm-dialog.tsx | Moves per-call confirmButtonText/cancelButtonText/label to the provider messages prop to showcase the new feature; minor provider-scope mismatch for "Keep item" but acceptable for a demo. |
| components/docs/interactive-examples/alert-dialog.tsx | Moves buttonLabel from per-call to the provider messages prop; clean, no issues. |
| content/docs/components/confirm.mdx | Adds Provider Defaults section, Next.js + next-intl usage guide, and updated configuration tables; accurate and helpful. |
| content/docs/components/alert-provider.mdx | Adds Provider Defaults section and updated configuration table; accurate and well-structured. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["alert(options) / confirm(options)"] --> B{options.field\nnot undefined?}
B -- Yes --> C["Use per-call value"]
B -- No --> D{messages prop\nprovided to provider?}
D -- Yes --> E["Use messages.field"]
D -- No --> F["Use DEFAULT_*_MESSAGES\nhardcoded fallback"]
subgraph confirmOnly["ConfirmDialog only"]
G["requireConfirmationInput.label?"] -- present --> H["Use per-call label"]
G -- absent --> I["Use resolvedMessages\n.requireConfirmationLabel"]
I --> J["Split on {{confirmTerm}}\nrender bold placeholder"]
end
C & E & F --> confirmOnly
Reviews (2): Last reviewed commit: "refactor: replace getRequireConfirmation..." | Re-trigger Greptile
…nLabel for consistent message handling in ConfirmDialog
No description provided.