@godxjp/ui-mcp 0.14.0 → 0.15.0
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.
- package/dist/index.js +91 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2407,35 +2407,24 @@ export function InvoiceDueDateField() {
|
|
|
2407
2407
|
{
|
|
2408
2408
|
name: "Dialog",
|
|
2409
2409
|
group: "feedback",
|
|
2410
|
-
tagline:
|
|
2410
|
+
tagline: "Compound modal. Controlled via open + onOpenChange. Parts available flat (DialogTrigger/DialogContent/\u2026) or as Dialog.Trigger/Dialog.Content. Rendered with role=dialog.",
|
|
2411
2411
|
props: [
|
|
2412
2412
|
{ name: "open", type: "boolean", description: "Controlled open state." },
|
|
2413
2413
|
{
|
|
2414
2414
|
name: "onOpenChange",
|
|
2415
2415
|
type: "(open: boolean) => void",
|
|
2416
2416
|
description: "Open-state change handler."
|
|
2417
|
-
},
|
|
2418
|
-
{
|
|
2419
|
-
name: "mode",
|
|
2420
|
-
type: '"form" | "confirm"',
|
|
2421
|
-
defaultValue: '"form"',
|
|
2422
|
-
description: "form = Radix Dialog (\xD7 close); confirm = AlertDialog (no \xD7)."
|
|
2423
2417
|
}
|
|
2424
2418
|
],
|
|
2425
2419
|
usage: [
|
|
2426
|
-
|
|
2427
|
-
"DO use `Dialog.Confirm` (or `DialogConfirm`) as the pre-built preset for confirm flows: pass `open`, `onOpenChange`, `title`, `description`, `onConfirm`, `pending`, and optionally `confirmPhrase` for type-to-confirm friction (GitHub/Stripe style). This eliminates boilerplate for the most common confirm pattern.",
|
|
2420
|
+
"Use `Dialog` for form-style or wizard-style modal flows that need freeform content and a close action.",
|
|
2428
2421
|
"DO always control open state via `open` + `onOpenChange`. Dialog has no uncontrolled shortcut \u2014 omitting `open` means the trigger alone drives state, which is fine for simple trigger-only cases, but any async submission flow must use controlled state so you can hold the dialog open while `pending=true` and close it only on success.",
|
|
2429
|
-
"DO include `DialogHeader` with `DialogTitle` (and optionally `DialogDescription`) inside every `DialogContent`. Radix requires an accessible title for screen readers; omitting it triggers a console warning and breaks a11y.
|
|
2430
|
-
"DON'T put `DialogContent` outside a `Dialog` (or `DialogRoot`) \u2014 the `mode` context won't be set and the sub-parts will render as the wrong Radix primitive (dialog vs alertdialog), breaking keyboard focus trap and role semantics.",
|
|
2431
|
-
'DON\'T add a manual \xD7 close button in confirm mode \u2014 `DialogContent` only renders the `X` button when `mode="form"` (`showCloseButton` defaults to `true`). For confirm flows, pass `showCloseButton={false}` or use `mode="confirm"`, which suppresses it automatically. Pressing Escape still closes both modes via Radix defaults.'
|
|
2422
|
+
"DO include `DialogHeader` with `DialogTitle` (and optionally `DialogDescription`) inside every `DialogContent`. Radix requires an accessible title for screen readers; omitting it triggers a console warning and breaks a11y."
|
|
2432
2423
|
],
|
|
2433
2424
|
useCases: [
|
|
2434
|
-
|
|
2435
|
-
"
|
|
2436
|
-
"Wizard / multi-step flow \u2014 step through entity setup (legal entity \u2192 fiscal year \u2192 opening balances) using a single Dialog whose `DialogContent` conditionally renders different step panels. Control which step is shown in local state
|
|
2437
|
-
'Read-only detail popup \u2014 show a full transaction audit trail, attachment preview, or approval history in a modal without leaving the list page. Use `mode="form"` with no `DialogFooter` action buttons, just a close trigger.',
|
|
2438
|
-
"Batch action confirmation \u2014 confirm bulk-approve or bulk-archive of selected rows. Use `Dialog.Confirm` wired to a selection count message; pass `pending` from the mutation to disable the confirm button while the batch runs."
|
|
2425
|
+
"Inline form dialog \u2014 create or edit a record (invoice line, supplier, coupon) without navigating away. Place `FormField`/`Input`/`Select` inside `DialogContent`, wire the submit button to your mutation, and hold `open` while `pending` to prevent double-submit.",
|
|
2426
|
+
"Read-only detail popup \u2014 show a full transaction audit trail, attachment preview, or approval history in a modal without leaving the list page. Use `Dialog` with no `DialogFooter` action buttons, just a close trigger.",
|
|
2427
|
+
"Wizard / multi-step flow \u2014 step through entity setup (legal entity \u2192 fiscal year \u2192 opening balances) using a single Dialog whose `DialogContent` conditionally renders different step panels. Control which step is shown in local state."
|
|
2439
2428
|
],
|
|
2440
2429
|
related: [
|
|
2441
2430
|
"Sheet \u2014 use Sheet instead of Dialog when the content is a slide-in panel (filters, detail sidebar, settings drawer). Sheet uses `side` prop and is better suited for wide filter forms or contextual detail panels that don't demand full focus interruption.",
|
|
@@ -2469,6 +2458,91 @@ function CreateDialog() {
|
|
|
2469
2458
|
storyPath: "feedback/Dialog.stories.tsx",
|
|
2470
2459
|
rules: [23, 3]
|
|
2471
2460
|
},
|
|
2461
|
+
{
|
|
2462
|
+
name: "AlertDialog",
|
|
2463
|
+
group: "feedback",
|
|
2464
|
+
tagline: 'Canonical modal confirmation flow (destructive / high-stakes decisions). Preserves confirm semantics with `role="alertdialog"` and built-in cancel/confirm handling.',
|
|
2465
|
+
props: [
|
|
2466
|
+
{ name: "open", type: "boolean", description: "Controlled open state." },
|
|
2467
|
+
{
|
|
2468
|
+
name: "onOpenChange",
|
|
2469
|
+
type: "(open: boolean) => void",
|
|
2470
|
+
description: "Open-state change handler."
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
name: "title",
|
|
2474
|
+
type: "string",
|
|
2475
|
+
required: true,
|
|
2476
|
+
description: "Accessible title/announcement for the alertdialog."
|
|
2477
|
+
},
|
|
2478
|
+
{ name: "description", type: "string", description: "Optional supporting explanatory text." },
|
|
2479
|
+
{
|
|
2480
|
+
name: "confirmLabel",
|
|
2481
|
+
type: "string",
|
|
2482
|
+
description: "Primary action label (defaults to translated continue)."
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
name: "cancelLabel",
|
|
2486
|
+
type: "string",
|
|
2487
|
+
description: "Dismiss action label (defaults to translated cancel)."
|
|
2488
|
+
},
|
|
2489
|
+
{
|
|
2490
|
+
name: "variant",
|
|
2491
|
+
type: '"default" | "destructive"',
|
|
2492
|
+
defaultValue: '"default"',
|
|
2493
|
+
description: "Variant passed through to the confirm button."
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
name: "confirmPhrase",
|
|
2497
|
+
type: "string",
|
|
2498
|
+
description: "Optional type-to-confirm phrase to prevent accidental confirm."
|
|
2499
|
+
},
|
|
2500
|
+
{
|
|
2501
|
+
name: "onConfirm",
|
|
2502
|
+
type: "() => Promise<void> | void",
|
|
2503
|
+
description: "Primary action handler."
|
|
2504
|
+
},
|
|
2505
|
+
{
|
|
2506
|
+
name: "keepOpenOnConfirm",
|
|
2507
|
+
type: "boolean",
|
|
2508
|
+
description: "Keep modal open after confirm when true."
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
name: "pending",
|
|
2512
|
+
type: "boolean",
|
|
2513
|
+
description: "Disable actions while async work is running."
|
|
2514
|
+
}
|
|
2515
|
+
],
|
|
2516
|
+
usage: [
|
|
2517
|
+
"Use `AlertDialog` for destructive/irreversible actions (delete, void, unpublish, archive, etc.).",
|
|
2518
|
+
"Use `confirmPhrase` for high-friction operations (e.g. requiring `DELETE`) to reduce accidental confirmation.",
|
|
2519
|
+
"Pass `keepOpenOnConfirm` when the confirm handler advances a multi-step flow and should not close immediately."
|
|
2520
|
+
],
|
|
2521
|
+
useCases: [
|
|
2522
|
+
"Dangerous delete or irreversible workflow confirmation that should block the background UI.",
|
|
2523
|
+
"Destructive batch operations that should remain modal and explicit until action is intentionally confirmed."
|
|
2524
|
+
],
|
|
2525
|
+
related: [
|
|
2526
|
+
"Dialog \u2014 use for form-style and non-destructive modal flows, no confirm preset behavior."
|
|
2527
|
+
],
|
|
2528
|
+
example: `import { AlertDialog } from "@godxjp/ui/feedback";
|
|
2529
|
+
|
|
2530
|
+
<AlertDialog
|
|
2531
|
+
open={open}
|
|
2532
|
+
onOpenChange={setOpen}
|
|
2533
|
+
title="Delete project"
|
|
2534
|
+
description="This action cannot be undone."
|
|
2535
|
+
confirmLabel="Delete"
|
|
2536
|
+
cancelLabel="Cancel"
|
|
2537
|
+
onConfirm={async () => {
|
|
2538
|
+
await deleteProject();
|
|
2539
|
+
setOpen(false);
|
|
2540
|
+
}}
|
|
2541
|
+
variant="destructive"
|
|
2542
|
+
/>`,
|
|
2543
|
+
storyPath: "feedback/AlertDialog.stories.tsx",
|
|
2544
|
+
rules: [23, 3]
|
|
2545
|
+
},
|
|
2472
2546
|
{
|
|
2473
2547
|
name: "Sheet",
|
|
2474
2548
|
group: "feedback",
|