@nadicodeai/ui 12.1.206 → 12.1.207
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/components/account-menu.d.ts.map +1 -1
- package/dist/components/account-menu.js +7 -5
- package/dist/components/action-menu.d.ts +119 -23
- package/dist/components/action-menu.d.ts.map +1 -1
- package/dist/components/action-menu.js +52 -24
- package/dist/components/catalog-entry.d.ts +3 -2
- package/dist/components/catalog-entry.d.ts.map +1 -1
- package/dist/components/collection-page.d.ts +6 -3
- package/dist/components/collection-page.d.ts.map +1 -1
- package/dist/components/collection-page.js +4 -3
- package/dist/components/confirm-dialog.d.ts +37 -10
- package/dist/components/confirm-dialog.d.ts.map +1 -1
- package/dist/components/confirm-dialog.js +63 -11
- package/dist/components/data-table.d.ts +2 -2
- package/dist/components/data-table.d.ts.map +1 -1
- package/dist/components/data-table.js +7 -2
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/message-notice.js +1 -1
- package/dist/components/notice-banner.d.ts +1 -1
- package/dist/components/notice-banner.js +1 -1
- package/dist/components/object-page.d.ts +4 -1
- package/dist/components/object-page.d.ts.map +1 -1
- package/dist/components/object-page.js +3 -2
- package/dist/components/overview-page.d.ts +4 -1
- package/dist/components/overview-page.d.ts.map +1 -1
- package/dist/components/overview-page.js +3 -2
- package/dist/components/page-actions.d.ts +12 -61
- package/dist/components/page-actions.d.ts.map +1 -1
- package/dist/components/page-actions.js +27 -35
- package/dist/components/record-commands.d.ts +71 -0
- package/dist/components/record-commands.d.ts.map +1 -0
- package/dist/components/record-commands.js +92 -0
- package/dist/components/record-list.d.ts +32 -64
- package/dist/components/record-list.d.ts.map +1 -1
- package/dist/components/record-list.js +53 -61
- package/dist/components/record-sheet.d.ts +3 -3
- package/dist/components/record-sheet.d.ts.map +1 -1
- package/dist/components/settings-page.d.ts +5 -2
- package/dist/components/settings-page.d.ts.map +1 -1
- package/dist/components/settings-page.js +4 -3
- package/dist/internal/catalog-list.d.ts.map +1 -1
- package/dist/internal/catalog-list.js +2 -4
- package/dist/internal/command-runner.d.ts +13 -0
- package/dist/internal/command-runner.d.ts.map +1 -0
- package/dist/internal/command-runner.js +67 -0
- package/dist/internal/page-command-button.d.ts +83 -0
- package/dist/internal/page-command-button.d.ts.map +1 -0
- package/dist/internal/page-command-button.js +47 -0
- package/dist/internal/record-menu-items.d.ts +7 -5
- package/dist/internal/record-menu-items.d.ts.map +1 -1
- package/dist/internal/record-menu-items.js +1 -9
- package/dist/showcase/samples.d.ts +9 -2
- package/dist/showcase/samples.d.ts.map +1 -1
- package/dist/showcase/samples.js +15 -1
- package/dist/showcase/specimens/actions.d.ts +2 -0
- package/dist/showcase/specimens/actions.d.ts.map +1 -1
- package/dist/showcase/specimens/actions.js +4 -1
- package/dist/showcase/specimens/compositions.d.ts.map +1 -1
- package/dist/showcase/specimens/compositions.js +17 -14
- package/dist/showcase/specimens/index.d.ts +2 -0
- package/dist/showcase/specimens/index.d.ts.map +1 -1
- package/dist/showcase/specimens/menus.d.ts.map +1 -1
- package/dist/showcase/specimens/menus.js +4 -3
- package/dist/showcase/usage.generated.d.ts +1 -1
- package/dist/showcase/usage.generated.d.ts.map +1 -1
- package/dist/showcase/usage.generated.js +51 -29
- package/package.json +2 -2
|
@@ -12,8 +12,7 @@ export type ConfirmDialogProps = {
|
|
|
12
12
|
/** Repeats the verb and the noun: "Remove mailbox". */
|
|
13
13
|
confirmLabel: string;
|
|
14
14
|
/** The confirm's word while the action runs, its label in the -ing form: "Removing mailbox". */
|
|
15
|
-
confirmPendingLabel?: string;
|
|
16
|
-
cancelLabel: string;
|
|
15
|
+
confirmPendingLabel?: string | undefined;
|
|
17
16
|
destructive?: boolean;
|
|
18
17
|
/** The action is running: both buttons hold and the field turns read-only. */
|
|
19
18
|
loading?: boolean;
|
|
@@ -25,28 +24,56 @@ export type ConfirmDialogProps = {
|
|
|
25
24
|
verify?: {
|
|
26
25
|
phrase: string;
|
|
27
26
|
prompt: string;
|
|
28
|
-
};
|
|
27
|
+
} | undefined;
|
|
29
28
|
/**
|
|
30
29
|
* What cannot be undone, as a sentence naming the action and the record and ending in
|
|
31
30
|
* "cannot be undone": "Removing pec@acme.it cannot be undone." Drawn as a red note above the
|
|
32
31
|
* field. Left out when the action can be reversed: its absence is what says so.
|
|
33
32
|
*/
|
|
34
|
-
irreversible?: string;
|
|
33
|
+
irreversible?: string | undefined;
|
|
35
34
|
/**
|
|
36
35
|
* Why the confirmed action did not happen, from the product's catalogue,
|
|
37
36
|
* with the message's own actions, such as signing in, under it.
|
|
38
37
|
*/
|
|
39
38
|
error?: ResolvedMessage | null;
|
|
40
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* The product's word for the dismissal every confirmation offers, from its catalogue: "Cancel",
|
|
42
|
+
* "Annulla". Mounted once at the product's root; without it the word is "Cancel".
|
|
43
|
+
*/
|
|
44
|
+
export declare function ConfirmWordsProvider({ cancel, children, }: {
|
|
45
|
+
cancel: string;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
}): import("react").JSX.Element;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a confirmation is open anywhere in the window, so a product holds back an overlay of its
|
|
50
|
+
* own (a request that would open a dialog) until it closes, and one overlay never opens over another.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useConfirmationOpen(): boolean;
|
|
41
53
|
/**
|
|
42
54
|
* A consequence confirmed before it happens, in a blocking alert dialog.
|
|
43
55
|
*
|
|
44
56
|
* @family Compositions
|
|
45
|
-
* @when "Reach for this over `Modal` when the action is destructive and warrants friction: delete, rotate, revoke, disconnect, downgrade, disable a security setting. The typed gate forces deliberate intent." (https://vercel.com/geist/destructive-action-modal)
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
49
|
-
*
|
|
57
|
+
* @when "Reach for this over `Modal` when the action is destructive and warrants friction: delete, rotate, revoke, disconnect, downgrade, disable a security setting. The typed gate forces deliberate intent." (https://vercel.com/geist/destructive-action-modal)
|
|
58
|
+
* Ours: Geist's DestructiveActionModal. A command's `confirm` opens it: `RecordList`, `RecordCommands`, `PageActions` and `AccountMenu` open it from the command they draw, keep it open and busy while the command runs, and show its failure in it, so a product passes the words and never mounts it for a command (nadicode decision). A product mounts it itself only for a confirmation that is no command of theirs, such as a settings card's delete or discarding a form (nadicode decision).
|
|
59
|
+
* @instead "Don't use for routine confirmations (save draft, discard changes, close without saving). The typed gate reads as melodrama when the stakes are low — use a plain `Modal` instead." (https://vercel.com/geist/destructive-action-modal)
|
|
60
|
+
* "Confirm destructive actions in a Modal. `Drawer` and `Sheet` don’t fully dim the page, so they read as too soft for a delete or revoke." (https://vercel.com/geist/modal)
|
|
61
|
+
* Ours: a destructive command the system can honestly reverse runs at once and offers its Undo in a toast (the command's `undo`), and one it cannot reverse asks here first (its `confirm`); a form of a few fields is a `FormDialog`; a choice from a catalogue is a `CatalogDrawer` (nadicode decision).
|
|
62
|
+
* @behaviour "The verification input gets focus on open so the user can start typing immediately. Submit stays disabled until the value matches `verificationPhrase` exactly." (https://vercel.com/geist/destructive-action-modal)
|
|
63
|
+
* "Enter submits only when the gate is open; it's a no-op otherwise. Cancel, outside-click, and Escape all dismiss." (https://vercel.com/geist/destructive-action-modal)
|
|
64
|
+
* "`loading` disables both buttons. The caller owns `open` — do not self-dismiss from `onConfirm`. Close the modal after the API settles (success or error), or keep it open on error so the user can retry." (https://vercel.com/geist/destructive-action-modal)
|
|
65
|
+
* "Default focus to `Cancel` on any destructive Modal. Enter must never trigger the destructive action without a typed confirmation." (https://vercel.com/geist/modal)
|
|
66
|
+
* Ours: `title`, `description` and `confirmLabel` are required; `irreversible` and `verify` are optional, and the absence of `irreversible` is what marks the action reversible. Geist's `irreversibleDescription` is `irreversible`, `verificationPhrase` and `verificationLabel` are `verify.phrase` and `verify.prompt`, and `error` is the catalogue's message (nadicode decision). The record's name is typed (`verify`) only to delete a record that holds others and cannot be restored: an Agent, a workspace, a company (owner, 2026-11-06). 480 px wide over a scrim; the title and the description, then the body in a 24 px column: the `irreversible` note, the `verify` field, the failure under it. `irreversible` is a flat red note with a red mark and red words; besides it the only red is the failure and the enabled destructive confirm. While `loading` the field turns read-only and keeps focus, Escape does not close it, and the confirm says `confirmPendingLabel`, which falls back to its label. A press outside does not close it, so a stray click never discards a typed phrase or an action in flight; Escape and Cancel do. The footer stays at the bottom while a tall confirmation scrolls, and is a row on a phone too (nadicode decision).
|
|
67
|
+
* @words "`title` is Title Case, `Verb + Noun`, a statement — never a question. `Delete Project`, not `Delete this project?`." (https://vercel.com/geist/destructive-action-modal)
|
|
68
|
+
* "`description` is sentence case, names the consequence, and interpolates the specific resource when relevant." (https://vercel.com/geist/destructive-action-modal)
|
|
69
|
+
* "`confirmLabel` matches the title 1:1. Never generic (`Confirm`, `OK`, `Continue`), never a bare verb (`Delete`)." (https://vercel.com/geist/destructive-action-modal)
|
|
70
|
+
* "Cancel literal stays `Cancel`. Acknowledgment-only Modals (after a key reveal, after a one-time-show) use `Done`, never `OK` or `Close`." (https://vercel.com/geist/modal)
|
|
71
|
+
* "`irreversibleDescription` names the specific action and resource and ends with `cannot be undone.` — `Deleting my-project cannot be undone.` rather than the generic `This cannot be undone.`." (https://vercel.com/geist/destructive-action-modal)
|
|
72
|
+
* "Pair the post-confirm success toast verb 1:1 with the primary button: `Delete Project` button, `Project deleted` toast. Never `Project removed`." (https://vercel.com/geist/destructive-action-modal)
|
|
73
|
+
* Ours: sentence case. The title names the verb and the record, "Remove pec@acme.it"; the confirm repeats the verb with its noun, "Remove mailbox", and a confirm of one word throws in development and tests; the dismissal has no prop: it is the product's catalogue word for Cancel, given once at its root by `ConfirmWordsProvider` ("Annulla"); the success toast uses the same verb, "Mailbox removed" (owner, 2026-11-06).
|
|
74
|
+
* @access "The verification input is associated with its prompt via `aria-labelledby` + `htmlFor`." (https://vercel.com/geist/destructive-action-modal)
|
|
75
|
+
* "Keep the Cancel button literally `Cancel` so screen-reader users hear a stable dismissal label across destructive flows." (https://vercel.com/geist/modal)
|
|
76
|
+
* Ours: `role="alertdialog"` named by its title and described by its consequence; the note is `role="note"` with its icon hidden; focus starts on Cancel, or in the field with `verify` (nadicode decision).
|
|
50
77
|
*/
|
|
51
|
-
export declare function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel, confirmPendingLabel,
|
|
78
|
+
export declare function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel, confirmPendingLabel, destructive, loading, verify, irreversible, error, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
52
79
|
//# sourceMappingURL=confirm-dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../src/components/confirm-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../src/components/confirm-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAiBf,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAErF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,uIAAuI;IACvI,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,WAAW,EAAE,SAAS,CAAC;IACvB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,gGAAgG;IAChG,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACxD;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAChC,CAAC;AAIF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAGA;AAID;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,WAAmB,EACnB,OAAe,EACf,MAAM,EACN,YAAY,EACZ,KAAK,GACN,EAAE,kBAAkB,+BAiCpB"}
|
|
@@ -1,32 +1,84 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useId, useRef, useState } from "react";
|
|
3
|
+
import { createContext, useContext, useEffect, useId, useMemo, useRef, useState, } from "react";
|
|
4
|
+
import { createStore, useStore } from "zustand";
|
|
4
5
|
import { OctagonAlertIcon } from "lucide-react";
|
|
5
6
|
import { AlertDialog, AlertDialogBody, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "./alert-dialog.js";
|
|
6
7
|
import { Button } from "./button.js";
|
|
7
8
|
import { Field, FieldError, FieldLabel } from "./field.js";
|
|
8
9
|
import { Input } from "./input.js";
|
|
9
|
-
import { PageCommandButton } from "
|
|
10
|
+
import { PageCommandButton } from "../internal/page-command-button.js";
|
|
10
11
|
import { bodyBeyondTitle } from "./product-message.js";
|
|
12
|
+
const ConfirmWords = createContext({ cancel: "Cancel" });
|
|
13
|
+
/**
|
|
14
|
+
* The product's word for the dismissal every confirmation offers, from its catalogue: "Cancel",
|
|
15
|
+
* "Annulla". Mounted once at the product's root; without it the word is "Cancel".
|
|
16
|
+
*/
|
|
17
|
+
export function ConfirmWordsProvider({ cancel, children, }) {
|
|
18
|
+
const words = useMemo(() => ({ cancel }), [cancel]);
|
|
19
|
+
return _jsx(ConfirmWords, { value: words, children: children });
|
|
20
|
+
}
|
|
21
|
+
const openConfirmations = createStore(() => ({ count: 0 }));
|
|
22
|
+
/**
|
|
23
|
+
* Whether a confirmation is open anywhere in the window, so a product holds back an overlay of its
|
|
24
|
+
* own (a request that would open a dialog) until it closes, and one overlay never opens over another.
|
|
25
|
+
*/
|
|
26
|
+
export function useConfirmationOpen() {
|
|
27
|
+
return useStore(openConfirmations, (state) => state.count > 0);
|
|
28
|
+
}
|
|
29
|
+
function useCountedOpen(open) {
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!open)
|
|
32
|
+
return;
|
|
33
|
+
openConfirmations.setState((state) => ({ count: state.count + 1 }));
|
|
34
|
+
return () => openConfirmations.setState((state) => ({ count: state.count - 1 }));
|
|
35
|
+
}, [open]);
|
|
36
|
+
}
|
|
37
|
+
function refuseBareVerb(confirmLabel) {
|
|
38
|
+
if (typeof process === "undefined" || process.env.NODE_ENV === "production")
|
|
39
|
+
return;
|
|
40
|
+
if (confirmLabel.trim().split(/\s+/).length < 2) {
|
|
41
|
+
throw new Error(`ConfirmDialog's confirm "${confirmLabel}" is one word; it names the verb and the noun, as its title does: "Remove mailbox".`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
11
44
|
/**
|
|
12
45
|
* A consequence confirmed before it happens, in a blocking alert dialog.
|
|
13
46
|
*
|
|
14
47
|
* @family Compositions
|
|
15
|
-
* @when "Reach for this over `Modal` when the action is destructive and warrants friction: delete, rotate, revoke, disconnect, downgrade, disable a security setting. The typed gate forces deliberate intent." (https://vercel.com/geist/destructive-action-modal)
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
*
|
|
19
|
-
*
|
|
48
|
+
* @when "Reach for this over `Modal` when the action is destructive and warrants friction: delete, rotate, revoke, disconnect, downgrade, disable a security setting. The typed gate forces deliberate intent." (https://vercel.com/geist/destructive-action-modal)
|
|
49
|
+
* Ours: Geist's DestructiveActionModal. A command's `confirm` opens it: `RecordList`, `RecordCommands`, `PageActions` and `AccountMenu` open it from the command they draw, keep it open and busy while the command runs, and show its failure in it, so a product passes the words and never mounts it for a command (nadicode decision). A product mounts it itself only for a confirmation that is no command of theirs, such as a settings card's delete or discarding a form (nadicode decision).
|
|
50
|
+
* @instead "Don't use for routine confirmations (save draft, discard changes, close without saving). The typed gate reads as melodrama when the stakes are low — use a plain `Modal` instead." (https://vercel.com/geist/destructive-action-modal)
|
|
51
|
+
* "Confirm destructive actions in a Modal. `Drawer` and `Sheet` don’t fully dim the page, so they read as too soft for a delete or revoke." (https://vercel.com/geist/modal)
|
|
52
|
+
* Ours: a destructive command the system can honestly reverse runs at once and offers its Undo in a toast (the command's `undo`), and one it cannot reverse asks here first (its `confirm`); a form of a few fields is a `FormDialog`; a choice from a catalogue is a `CatalogDrawer` (nadicode decision).
|
|
53
|
+
* @behaviour "The verification input gets focus on open so the user can start typing immediately. Submit stays disabled until the value matches `verificationPhrase` exactly." (https://vercel.com/geist/destructive-action-modal)
|
|
54
|
+
* "Enter submits only when the gate is open; it's a no-op otherwise. Cancel, outside-click, and Escape all dismiss." (https://vercel.com/geist/destructive-action-modal)
|
|
55
|
+
* "`loading` disables both buttons. The caller owns `open` — do not self-dismiss from `onConfirm`. Close the modal after the API settles (success or error), or keep it open on error so the user can retry." (https://vercel.com/geist/destructive-action-modal)
|
|
56
|
+
* "Default focus to `Cancel` on any destructive Modal. Enter must never trigger the destructive action without a typed confirmation." (https://vercel.com/geist/modal)
|
|
57
|
+
* Ours: `title`, `description` and `confirmLabel` are required; `irreversible` and `verify` are optional, and the absence of `irreversible` is what marks the action reversible. Geist's `irreversibleDescription` is `irreversible`, `verificationPhrase` and `verificationLabel` are `verify.phrase` and `verify.prompt`, and `error` is the catalogue's message (nadicode decision). The record's name is typed (`verify`) only to delete a record that holds others and cannot be restored: an Agent, a workspace, a company (owner, 2026-11-06). 480 px wide over a scrim; the title and the description, then the body in a 24 px column: the `irreversible` note, the `verify` field, the failure under it. `irreversible` is a flat red note with a red mark and red words; besides it the only red is the failure and the enabled destructive confirm. While `loading` the field turns read-only and keeps focus, Escape does not close it, and the confirm says `confirmPendingLabel`, which falls back to its label. A press outside does not close it, so a stray click never discards a typed phrase or an action in flight; Escape and Cancel do. The footer stays at the bottom while a tall confirmation scrolls, and is a row on a phone too (nadicode decision).
|
|
58
|
+
* @words "`title` is Title Case, `Verb + Noun`, a statement — never a question. `Delete Project`, not `Delete this project?`." (https://vercel.com/geist/destructive-action-modal)
|
|
59
|
+
* "`description` is sentence case, names the consequence, and interpolates the specific resource when relevant." (https://vercel.com/geist/destructive-action-modal)
|
|
60
|
+
* "`confirmLabel` matches the title 1:1. Never generic (`Confirm`, `OK`, `Continue`), never a bare verb (`Delete`)." (https://vercel.com/geist/destructive-action-modal)
|
|
61
|
+
* "Cancel literal stays `Cancel`. Acknowledgment-only Modals (after a key reveal, after a one-time-show) use `Done`, never `OK` or `Close`." (https://vercel.com/geist/modal)
|
|
62
|
+
* "`irreversibleDescription` names the specific action and resource and ends with `cannot be undone.` — `Deleting my-project cannot be undone.` rather than the generic `This cannot be undone.`." (https://vercel.com/geist/destructive-action-modal)
|
|
63
|
+
* "Pair the post-confirm success toast verb 1:1 with the primary button: `Delete Project` button, `Project deleted` toast. Never `Project removed`." (https://vercel.com/geist/destructive-action-modal)
|
|
64
|
+
* Ours: sentence case. The title names the verb and the record, "Remove pec@acme.it"; the confirm repeats the verb with its noun, "Remove mailbox", and a confirm of one word throws in development and tests; the dismissal has no prop: it is the product's catalogue word for Cancel, given once at its root by `ConfirmWordsProvider` ("Annulla"); the success toast uses the same verb, "Mailbox removed" (owner, 2026-11-06).
|
|
65
|
+
* @access "The verification input is associated with its prompt via `aria-labelledby` + `htmlFor`." (https://vercel.com/geist/destructive-action-modal)
|
|
66
|
+
* "Keep the Cancel button literally `Cancel` so screen-reader users hear a stable dismissal label across destructive flows." (https://vercel.com/geist/modal)
|
|
67
|
+
* Ours: `role="alertdialog"` named by its title and described by its consequence; the note is `role="note"` with its icon hidden; focus starts on Cancel, or in the field with `verify` (nadicode decision).
|
|
20
68
|
*/
|
|
21
|
-
export function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel, confirmPendingLabel,
|
|
69
|
+
export function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel, confirmPendingLabel, destructive = false, loading = false, verify, irreversible, error, }) {
|
|
70
|
+
if (open)
|
|
71
|
+
refuseBareVerb(confirmLabel);
|
|
72
|
+
useCountedOpen(open);
|
|
22
73
|
const cancel = useRef(null);
|
|
23
74
|
const phraseField = useRef(null);
|
|
24
75
|
return (_jsx(AlertDialog, { open: open, onOpenChange: (nextOpen) => {
|
|
25
76
|
if (!nextOpen && !loading)
|
|
26
77
|
onCancel();
|
|
27
|
-
}, children: _jsxs(AlertDialogContent, { initialFocus: verify ? phraseField : cancel, children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), _jsx(AlertDialogDescription, { children: description })] }), _jsx(ConfirmDialogPanel, { cancel: cancel,
|
|
78
|
+
}, children: _jsxs(AlertDialogContent, { initialFocus: verify ? phraseField : cancel, children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), _jsx(AlertDialogDescription, { children: description })] }), _jsx(ConfirmDialogPanel, { cancel: cancel, confirmLabel: confirmLabel, confirmPendingLabel: confirmPendingLabel, destructive: destructive, error: error, irreversible: irreversible, loading: loading, onCancel: onCancel, onConfirm: onConfirm, phraseField: phraseField, verify: verify })] }) }));
|
|
28
79
|
}
|
|
29
|
-
function ConfirmDialogPanel({ cancel, phraseField, onConfirm, onCancel, confirmLabel, confirmPendingLabel,
|
|
80
|
+
function ConfirmDialogPanel({ cancel, phraseField, onConfirm, onCancel, confirmLabel, confirmPendingLabel, destructive = false, loading = false, verify, irreversible, error, }) {
|
|
81
|
+
const words = useContext(ConfirmWords);
|
|
30
82
|
const [typed, setTyped] = useState("");
|
|
31
83
|
const phraseId = useId();
|
|
32
84
|
const phraseLabelId = useId();
|
|
@@ -36,7 +88,7 @@ function ConfirmDialogPanel({ cancel, phraseField, onConfirm, onCancel, confirmL
|
|
|
36
88
|
return (_jsxs(_Fragment, { children: [hasBody ? (_jsxs(AlertDialogBody, { children: [irreversible ? (_jsxs("p", { className: "flex items-start gap-3 rounded-sm border border-destructive/15 bg-destructive-soft px-nadicode-sm py-1.5 text-body-sm text-destructive-soft-foreground", "data-slot": "confirm-dialog-irreversible", role: "note", children: [_jsx(OctagonAlertIcon, { "aria-hidden": "true", className: "h-5 w-3.5 shrink-0" }), irreversible] })) : null, verify ? (_jsxs(Field, { children: [_jsx(FieldLabel, { className: "text-label leading-5 text-foreground", htmlFor: phraseId, id: phraseLabelId, children: _jsx(VerifyPrompt, { phrase: verify.phrase, prompt: verify.prompt }) }), _jsx(Input, { "aria-labelledby": phraseLabelId, autoCapitalize: "none", autoComplete: "off", id: phraseId, onChange: (event) => setTyped(event.target.value), onKeyDown: (event) => {
|
|
37
89
|
if (event.key === "Enter" && confirmable && !loading)
|
|
38
90
|
onConfirm();
|
|
39
|
-
}, readOnly: loading, ref: phraseField, spellCheck: false, value: typed })] })) : null, error ? (_jsxs(FieldError, { className: "text-body-sm wrap-break-word", "data-message-code": error.code, children: [_jsx("span", { className: "block", children: error.title }), errorBody ? (_jsxs(_Fragment, { children: [" ", _jsx("span", { className: "block", children: errorBody })] })) : null] })) : null, error?.actions.length ? (_jsx("div", { className: "flex flex-wrap items-center gap-2", "data-message-actions": true, children: error.actions.map((action) => (_jsx(PageCommandButton, { command: action, variant: "outline" }, action.label))) })) : null] })) : null, _jsxs(AlertDialogFooter, { children: [_jsx(Button, { disabled: loading, onClick: onCancel, ref: cancel, variant: "outline", children:
|
|
91
|
+
}, readOnly: loading, ref: phraseField, spellCheck: false, value: typed })] })) : null, error ? (_jsxs(FieldError, { className: "text-body-sm wrap-break-word", "data-message-code": error.code, children: [_jsx("span", { className: "block", children: error.title }), errorBody ? (_jsxs(_Fragment, { children: [" ", _jsx("span", { className: "block", children: errorBody })] })) : null] })) : null, error?.actions.length ? (_jsx("div", { className: "flex flex-wrap items-center gap-2", "data-message-actions": true, children: error.actions.map((action) => (_jsx(PageCommandButton, { command: action, variant: "outline" }, action.label))) })) : null] })) : null, _jsxs(AlertDialogFooter, { children: [_jsx(Button, { disabled: loading, onClick: onCancel, ref: cancel, variant: "outline", children: words.cancel }), _jsx(Button, { disabled: !confirmable, loading: loading, loadingLabel: confirmPendingLabel ?? confirmLabel, onClick: onConfirm, variant: destructive ? "destructive" : "default", children: confirmLabel })] })] }));
|
|
40
92
|
}
|
|
41
93
|
function VerifyPrompt({ phrase, prompt }) {
|
|
42
94
|
const at = prompt.indexOf(phrase);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { columnFilteringFeature, columnSizingFeature, columnVisibilityFeature, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, filterFn_arrIncludes, filterFn_equals, filterFn_inDateRange, filterFn_includesString, filterFn_inNumberRange, filterFn_weakEquals, rowPaginationFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_datetime, sortFn_text, type CellData, type Column, type ColumnDef, type RowData } from "@tanstack/react-table";
|
|
3
3
|
import type { CollectionNote } from "../internal/collection-note.js";
|
|
4
|
-
import { type
|
|
4
|
+
import { type ActionContextMenuProps } from "./action-menu.js";
|
|
5
5
|
import { type EmptyStateProps } from "./empty-state.js";
|
|
6
6
|
type DataTableFeatures = {
|
|
7
7
|
columnFilteringFeature: typeof columnFilteringFeature;
|
|
@@ -218,7 +218,7 @@ type EntityRowEditor<TData extends RowData> = {
|
|
|
218
218
|
type EntityTableProps<TData extends RowData> = DataTableProps<TData> & {
|
|
219
219
|
rowEditor?: EntityRowEditor<TData>;
|
|
220
220
|
/** The record's menu, opened from its row by a right-click as from its three dots. */
|
|
221
|
-
rowMenu?: (row: TData) =>
|
|
221
|
+
rowMenu?: (row: TData) => Omit<ActionContextMenuProps, "children"> | null;
|
|
222
222
|
/** Controls drawn under the record's name, outside the row's link, so pressing one never opens the record. */
|
|
223
223
|
rowUnderName?: (row: TData) => React.ReactNode;
|
|
224
224
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/components/data-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EAGnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,WAAW,EAIX,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,SAAS,EAGd,KAAK,OAAO,EAGb,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqB,KAAK,
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/components/data-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EAGnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EAC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GAAG;IACrE,SAAS,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IACnC,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;IAC1E,8GAA8G;IAC9G,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,KAAK,CAAC,SAAS,CAAC;CAChD,CAAC;AA4EF,wBAAgB,eAAe,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM,SAAS,QAAQ,GAAG,QAAQ,EACvF,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG;IACnD,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;CACxE,GACA,MAAM,CAGR;AAwJD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,SAAS,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,qBAE5E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,SAAS,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,qBAEhF"}
|
|
@@ -124,7 +124,11 @@ function collapseTrackClass(column, primaryColumns, compactLayout) {
|
|
|
124
124
|
const layout = collapseLayout(column, primaryColumns, compactLayout);
|
|
125
125
|
return layout ? tableCompactLayouts[layout].track : undefined;
|
|
126
126
|
}
|
|
127
|
-
const NO_ROW_MENU = {
|
|
127
|
+
const NO_ROW_MENU = {
|
|
128
|
+
label: "",
|
|
129
|
+
record: "",
|
|
130
|
+
commands: [],
|
|
131
|
+
};
|
|
128
132
|
function useShownLayout() {
|
|
129
133
|
const [shownLayout, setShownLayout] = React.useState("both");
|
|
130
134
|
const probeRef = React.useCallback((probe) => {
|
|
@@ -314,7 +318,8 @@ function RecordsTable({ kind, columns, data, getRowId, filterColumnId, filterPla
|
|
|
314
318
|
? (event) => {
|
|
315
319
|
const target = event.target;
|
|
316
320
|
if (!(target instanceof Element) ||
|
|
317
|
-
|
|
321
|
+
!event.currentTarget.contains(target) ||
|
|
322
|
+
target.closest("a, button, input, select, textarea, label, [role='button'], [role='checkbox']")) {
|
|
318
323
|
return;
|
|
319
324
|
}
|
|
320
325
|
event.currentTarget.querySelector("a[data-row-link]")?.click();
|
|
@@ -38,7 +38,7 @@ declare function InputGroup({ className, size, rounded, ...props }: React.Compon
|
|
|
38
38
|
rounded?: boolean;
|
|
39
39
|
}): React.JSX.Element;
|
|
40
40
|
declare const inputGroupAddonVariants: (props?: ({
|
|
41
|
-
align?: "inline-
|
|
41
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
42
42
|
look?: "plain" | "segment" | null | undefined;
|
|
43
43
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
44
44
|
declare function InputGroupAddon({ className, align, look, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { OctagonAlert } from "lucide-react";
|
|
|
4
4
|
import { Alert } from "./alert.js";
|
|
5
5
|
import { closedSentence, NOTICE_EDGE, NoticeLink, NoticeMark, } from "../internal/notice.js";
|
|
6
6
|
import { cn } from "../lib/utils.js";
|
|
7
|
-
import { PageCommandButton } from "
|
|
7
|
+
import { PageCommandButton } from "../internal/page-command-button.js";
|
|
8
8
|
import { bodyBeyondTitle } from "./product-message.js";
|
|
9
9
|
const TONE_TEXT = {
|
|
10
10
|
neutral: "text-muted-foreground",
|
|
@@ -25,7 +25,7 @@ export type NoticeBannerProps = {
|
|
|
25
25
|
* A condition of the page's own object, with the fix the page offers.
|
|
26
26
|
*
|
|
27
27
|
* @family Feedback
|
|
28
|
-
* @when "A prominent message that spans the full width of its container to announce important information." (https://vercel.com/geist/banner) "Used for temporary, project-wide notifications that require resolution" (https://vercel.com/geist/project-banner) "Use Project Banner for project-wide states that need resolution: overdue billing, an active rollback, attack mitigation, an expiring trial blocking deploys." (https://vercel.com/geist/project-banner) "Match `variant` to severity: `error` for critical downtime or payment-blocking states, `warning` for an exceptional state with non-immediate action, `success` for a positive temporary mitigation, `gray` for routine project-wide notices." (https://vercel.com/geist/project-banner) Ours: a condition of the page's own object that the page itself resolves, with that resolving action on the banner: a past-due subscription on its billing page, a failed refresh of the page's own reading. The `tone` is the `variant`: `destructive` is `error`, `warning` is `warning`, `info` is `success` and `neutral` is `gray`.
|
|
28
|
+
* @when "A prominent message that spans the full width of its container to announce important information." (https://vercel.com/geist/banner) "Used for temporary, project-wide notifications that require resolution" (https://vercel.com/geist/project-banner) "Use Project Banner for project-wide states that need resolution: overdue billing, an active rollback, attack mitigation, an expiring trial blocking deploys." (https://vercel.com/geist/project-banner) "Match `variant` to severity: `error` for critical downtime or payment-blocking states, `warning` for an exceptional state with non-immediate action, `success` for a positive temporary mitigation, `gray` for routine project-wide notices." (https://vercel.com/geist/project-banner) Ours: a condition of the page's own object that the page itself resolves, with that resolving action on the banner: a past-due subscription on its billing page, a failed refresh of the page's own reading. The `tone` is the `variant`: `destructive` is `error`, `warning` is `warning`, `info` is `success` and `neutral` is `gray`. A page gives it to its composition's `notice` (`CollectionPage`, `ObjectPage`, `OverviewPage`, `SettingsPage`), which places it under the title; a product never renders it, which `nadicodeai/page-composition` refuses (nadicode decision).
|
|
29
29
|
* @instead "Pick `Note` for inline contextual messages tied to a single field or card, `Toast` for transient acknowledgments, `Modal` for confirmations." (https://vercel.com/geist/project-banner) Ours: there is no announcement strip. `Note` is `MessageNotice` (`placement="section"`), `Toast` is `showMessageToast` and `Modal` is `ConfirmDialog`. For a measured level use a `KpiCard` with its tone; crossing a threshold is a notification in the inbox, not a banner. A condition of the system, the setup or the staff (a connection, a stored secret, a failing job, anything a staff member fixes in settings) is a notification in the product's inbox, never a banner on a page, and the page that fixes it shows the state in its own section: "The Vercel dashboard displays a popover, which contains all relevant notifications" (https://vercel.com/docs/notifications), and the Portal's System health raises it through Knock to the bell at the sidebar's foot.
|
|
30
30
|
* @behaviour "Project Banner is non-dismissible by design. If the message can be dismissed without resolving the underlying state, it isn’t banner-worthy; move it to a `Note`." (https://vercel.com/geist/project-banner) "Show one Project Banner at a time. Stacking competing banners drowns the most urgent state." (https://vercel.com/geist/project-banner) "Always pass a `callToAction` that resolves the state. A banner with no route is a dead end." (https://vercel.com/geist/project-banner) Ours: a strip as wide as its container: a filled ground with a line on its top and bottom edge only, no corners, 40 px high and centred, with the mark, the sentence and the fix on one row; under 768 px the fix drops under the sentence, aligned with its text. The title and the description run on as one passage: the title closed by a full stop when it has none of its own, leading in semibold when a description follows and at regular weight alone, the description after it on the same line, and a description that repeats the title not shown. `detail` takes its own row under the passage. Colour sits on the whole strip (ground, both lines, mark and text); the fix is an underlined link in the darkest step of the same hue (neutral: `text-foreground`) and returns to the strip's text on hover. Neutral and info take the Info mark, warning and destructive the TriangleAlert. `action` is the `callToAction`: one command, never two, never a ready-made button, and there is no close button. Required: `action`, `title`, `tone` and `liveRegion`; the mark is always drawn, and `icon` swaps the tone's mark for another lucide icon.
|
|
31
31
|
* @words "`label` is one sentence in sentence case that names the impact: `Your Pro trial expires in 3 days.` Don’t open with `Heads up` or apologetic preambles." (https://vercel.com/geist/project-banner) "`callToAction.label` is Title Case `Verb + Noun` and points at the resolver: `Update Payment Method`, `Reactivate Project`, `Review Tokens`." (https://vercel.com/geist/project-banner) "Name the affected entity when the project context isn’t obvious from the surrounding chrome (`Production deployments are paused on my-project`)." (https://vercel.com/geist/project-banner) "Don’t encode severity in the copy with emoji or interjections; the variant carries that signal." (https://vercel.com/geist/project-banner) "`NoteLabel` is a 1–2 word Title Case prefix that names the topic: `Region Change`, `Rate Limit`, `Plan Limit`. Cut hedges like `Heads Up`, `FYI`, and `Note`." (https://vercel.com/geist/note) Ours: the `title` is the `label`: the one sentence, naming the condition, its impact and the object. A `description` only adds what the title leaves out, in one more sentence. Our `label` is the `NoteLabel` topic prefix. The action is sentence case, verb and noun, pointing at the resolver: "Update payment method", "Try again". No "Please". The words come from the product's catalogue code.
|
|
@@ -9,7 +9,7 @@ const LIVE_REGION_ROLE = { assertive: "alert", polite: "status", off: "note" };
|
|
|
9
9
|
* A condition of the page's own object, with the fix the page offers.
|
|
10
10
|
*
|
|
11
11
|
* @family Feedback
|
|
12
|
-
* @when "A prominent message that spans the full width of its container to announce important information." (https://vercel.com/geist/banner) "Used for temporary, project-wide notifications that require resolution" (https://vercel.com/geist/project-banner) "Use Project Banner for project-wide states that need resolution: overdue billing, an active rollback, attack mitigation, an expiring trial blocking deploys." (https://vercel.com/geist/project-banner) "Match `variant` to severity: `error` for critical downtime or payment-blocking states, `warning` for an exceptional state with non-immediate action, `success` for a positive temporary mitigation, `gray` for routine project-wide notices." (https://vercel.com/geist/project-banner) Ours: a condition of the page's own object that the page itself resolves, with that resolving action on the banner: a past-due subscription on its billing page, a failed refresh of the page's own reading. The `tone` is the `variant`: `destructive` is `error`, `warning` is `warning`, `info` is `success` and `neutral` is `gray`.
|
|
12
|
+
* @when "A prominent message that spans the full width of its container to announce important information." (https://vercel.com/geist/banner) "Used for temporary, project-wide notifications that require resolution" (https://vercel.com/geist/project-banner) "Use Project Banner for project-wide states that need resolution: overdue billing, an active rollback, attack mitigation, an expiring trial blocking deploys." (https://vercel.com/geist/project-banner) "Match `variant` to severity: `error` for critical downtime or payment-blocking states, `warning` for an exceptional state with non-immediate action, `success` for a positive temporary mitigation, `gray` for routine project-wide notices." (https://vercel.com/geist/project-banner) Ours: a condition of the page's own object that the page itself resolves, with that resolving action on the banner: a past-due subscription on its billing page, a failed refresh of the page's own reading. The `tone` is the `variant`: `destructive` is `error`, `warning` is `warning`, `info` is `success` and `neutral` is `gray`. A page gives it to its composition's `notice` (`CollectionPage`, `ObjectPage`, `OverviewPage`, `SettingsPage`), which places it under the title; a product never renders it, which `nadicodeai/page-composition` refuses (nadicode decision).
|
|
13
13
|
* @instead "Pick `Note` for inline contextual messages tied to a single field or card, `Toast` for transient acknowledgments, `Modal` for confirmations." (https://vercel.com/geist/project-banner) Ours: there is no announcement strip. `Note` is `MessageNotice` (`placement="section"`), `Toast` is `showMessageToast` and `Modal` is `ConfirmDialog`. For a measured level use a `KpiCard` with its tone; crossing a threshold is a notification in the inbox, not a banner. A condition of the system, the setup or the staff (a connection, a stored secret, a failing job, anything a staff member fixes in settings) is a notification in the product's inbox, never a banner on a page, and the page that fixes it shows the state in its own section: "The Vercel dashboard displays a popover, which contains all relevant notifications" (https://vercel.com/docs/notifications), and the Portal's System health raises it through Knock to the bell at the sidebar's foot.
|
|
14
14
|
* @behaviour "Project Banner is non-dismissible by design. If the message can be dismissed without resolving the underlying state, it isn’t banner-worthy; move it to a `Note`." (https://vercel.com/geist/project-banner) "Show one Project Banner at a time. Stacking competing banners drowns the most urgent state." (https://vercel.com/geist/project-banner) "Always pass a `callToAction` that resolves the state. A banner with no route is a dead end." (https://vercel.com/geist/project-banner) Ours: a strip as wide as its container: a filled ground with a line on its top and bottom edge only, no corners, 40 px high and centred, with the mark, the sentence and the fix on one row; under 768 px the fix drops under the sentence, aligned with its text. The title and the description run on as one passage: the title closed by a full stop when it has none of its own, leading in semibold when a description follows and at regular weight alone, the description after it on the same line, and a description that repeats the title not shown. `detail` takes its own row under the passage. Colour sits on the whole strip (ground, both lines, mark and text); the fix is an underlined link in the darkest step of the same hue (neutral: `text-foreground`) and returns to the strip's text on hover. Neutral and info take the Info mark, warning and destructive the TriangleAlert. `action` is the `callToAction`: one command, never two, never a ready-made button, and there is no close button. Required: `action`, `title`, `tone` and `liveRegion`; the mark is always drawn, and `icon` swaps the tone's mark for another lucide icon.
|
|
15
15
|
* @words "`label` is one sentence in sentence case that names the impact: `Your Pro trial expires in 3 days.` Don’t open with `Heads up` or apologetic preambles." (https://vercel.com/geist/project-banner) "`callToAction.label` is Title Case `Verb + Noun` and points at the resolver: `Update Payment Method`, `Reactivate Project`, `Review Tokens`." (https://vercel.com/geist/project-banner) "Name the affected entity when the project context isn’t obvious from the surrounding chrome (`Production deployments are paused on my-project`)." (https://vercel.com/geist/project-banner) "Don’t encode severity in the copy with emoji or interjections; the variant carries that signal." (https://vercel.com/geist/project-banner) "`NoteLabel` is a 1–2 word Title Case prefix that names the topic: `Region Change`, `Rate Limit`, `Plan Limit`. Cut hedges like `Heads Up`, `FYI`, and `Note`." (https://vercel.com/geist/note) Ours: the `title` is the `label`: the one sentence, naming the condition, its impact and the object. A `description` only adds what the title leaves out, in one more sentence. Our `label` is the `NoteLabel` topic prefix. The action is sentence case, verb and noun, pointing at the resolver: "Update payment method", "Try again". No "Please". The words come from the product's catalogue code.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { type NoticeBannerProps } from "./notice-banner.js";
|
|
2
3
|
import { type IdentityMarkProps } from "./identity-mark.js";
|
|
3
4
|
import { type CardActions } from "./page-actions.js";
|
|
4
5
|
type ObjectPageFact = {
|
|
@@ -37,6 +38,8 @@ export type ObjectPageProps = {
|
|
|
37
38
|
description?: ReactNode;
|
|
38
39
|
/** Key facts as labelled values in one row. Left out only while the object does not exist yet, such as an account with no plan. */
|
|
39
40
|
facts?: readonly [ObjectPageFact, ...ObjectPageFact[]];
|
|
41
|
+
/** A condition of the object that the page fixes, above its card: one `NoticeBanner`. */
|
|
42
|
+
notice?: NoticeBannerProps;
|
|
40
43
|
/** The object's commands on its header bar: a secondary, the primary, then the three dots. */
|
|
41
44
|
actions?: CardActions;
|
|
42
45
|
/** Rows that open under the facts, each one part of the object: settings, logs, checks. */
|
|
@@ -57,6 +60,6 @@ export type ObjectPageProps = {
|
|
|
57
60
|
* @words "Keep right-column buttons Verb + Noun (`Remove Member`, `Resend Invite`). Bare verbs like `Remove` or `Confirm` lose context once the row scrolls offscreen." (https://vercel.com/geist/entity) "Title slot is Title Case noun (`Last Deployed`, `Build Duration`); content is sentence case unless the value is a literal identifier, ID, or timestamp that should be preserved verbatim." (https://vercel.com/geist/description) Ours: sentence case throughout. The name as the object is called everywhere else; the line says what it is and whose ("Customer of Partner Alpha · since 3 August 2026"); a fact's label is a noun ("Plan"), its value the figure; an entry's title is a noun phrase; the hint is one sentence ("To update it, push to the main branch."); the link names where it goes ("Deployments"); the menu's trigger reads "More for {name}".
|
|
58
61
|
* @access "Geist renders `<dl>`/`<dt>`/`<dd>` so screen readers announce each key/value pair as a definition." (https://vercel.com/geist/description) "Don’t wrap the component in extra paragraphs that break the list semantics." (https://vercel.com/geist/description) Ours: with `headingProps` the name is the page's h1; without them it is text, for a product whose chrome already titles the page. The mark is decorative beside the name. Each entry is an h2 heading holding a button with `aria-expanded` that controls its panel.
|
|
59
62
|
*/
|
|
60
|
-
export declare function ObjectPage({ mark, name, headingProps, description, facts, actions, entries, footer, children, }: ObjectPageProps): ReactElement;
|
|
63
|
+
export declare function ObjectPage({ mark, name, headingProps, description, facts, actions, entries, footer, notice, children, }: ObjectPageProps): ReactElement;
|
|
61
64
|
export {};
|
|
62
65
|
//# sourceMappingURL=object-page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-page.d.ts","sourceRoot":"","sources":["../../src/components/object-page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"object-page.d.ts","sourceRoot":"","sources":["../../src/components/object-page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIlF,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,KAAK,WAAW,EAAqC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1B,4IAA4I;IAC5I,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,QAAQ,GACT,EAAE,eAAe,GAAG,YAAY,CA+FhC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FooterStrip } from "../internal/footer-strip.js";
|
|
3
|
+
import { NoticeBanner } from "./notice-banner.js";
|
|
3
4
|
import { cn } from "../lib/utils.js";
|
|
4
5
|
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./accordion.js";
|
|
5
6
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./card.js";
|
|
@@ -16,9 +17,9 @@ import { CardActionsRow, PageCommandButton } from "./page-actions.js";
|
|
|
16
17
|
* @words "Keep right-column buttons Verb + Noun (`Remove Member`, `Resend Invite`). Bare verbs like `Remove` or `Confirm` lose context once the row scrolls offscreen." (https://vercel.com/geist/entity) "Title slot is Title Case noun (`Last Deployed`, `Build Duration`); content is sentence case unless the value is a literal identifier, ID, or timestamp that should be preserved verbatim." (https://vercel.com/geist/description) Ours: sentence case throughout. The name as the object is called everywhere else; the line says what it is and whose ("Customer of Partner Alpha · since 3 August 2026"); a fact's label is a noun ("Plan"), its value the figure; an entry's title is a noun phrase; the hint is one sentence ("To update it, push to the main branch."); the link names where it goes ("Deployments"); the menu's trigger reads "More for {name}".
|
|
17
18
|
* @access "Geist renders `<dl>`/`<dt>`/`<dd>` so screen readers announce each key/value pair as a definition." (https://vercel.com/geist/description) "Don’t wrap the component in extra paragraphs that break the list semantics." (https://vercel.com/geist/description) Ours: with `headingProps` the name is the page's h1; without them it is text, for a product whose chrome already titles the page. The mark is decorative beside the name. Each entry is an h2 heading holding a button with `aria-expanded` that controls its panel.
|
|
18
19
|
*/
|
|
19
|
-
export function ObjectPage({ mark, name, headingProps, description, facts, actions, entries, footer, children, }) {
|
|
20
|
+
export function ObjectPage({ mark, name, headingProps, description, facts, actions, entries, footer, notice, children, }) {
|
|
20
21
|
const title = headingProps ? (_jsx("h1", { ...headingProps, className: cn("outline-none", headingProps.className), children: name })) : (name);
|
|
21
|
-
return (_jsxs("div", { className: "grid min-w-0 gap-6", "data-slot": "object-page", children: [_jsxs("div", { className: "grid min-w-0 gap-3", children: [_jsxs(Card, { className: "min-w-0", render: _jsx("div", { "data-slot": "object-card" }), size: "sm", children: [_jsxs(CardHeader, { className: cn("flex flex-wrap items-center justify-between gap-x-4 gap-y-3", facts && "border-b"), children: [_jsxs("div", { className: cn("flex min-w-0 flex-1 items-center gap-4", actions?.menu && !actions.secondary && !actions.primary ? "basis-0" : "basis-64"), children: [_jsx(IdentityMark, { ...mark, size: 64 }), _jsxs("div", { className: "grid min-w-0 gap-1", children: [_jsx(CardTitle, { className: "min-w-0 wrap-break-word group-data-[size=sm]/card:text-heading-sm", children: title }), description ? _jsx(CardDescription, { children: description }) : null] })] }), actions ? _jsx(CardActionsRow, { ...actions }) : null] }), facts ? (_jsx(CardContent, { className: "grid min-w-0 gap-x-6 gap-y-5", children: _jsx("div", { className: "@container/object-page-facts grid min-w-0 content-start gap-4", children: _jsx("dl", { className: "grid min-w-0 grid-cols-2 gap-x-6 gap-y-4 @xl/object-page-facts:grid-cols-4", "data-slot": "object-page-facts", children: facts.map((fact) => (_jsxs("div", { className: "grid min-w-0 content-start gap-1", children: [_jsx("dt", { className: "text-label-sm text-muted-foreground", children: fact.label }), _jsx("dd", { className: "min-w-0 text-body-sm wrap-break-word text-foreground", children: fact.value })] }, fact.label))) }) }) })) : null, footer ? (_jsx(FooterStrip, { hint: footer.hint, hintSlot: "object-page-hint", children: _jsx(PageCommandButton, { command: footer.link, variant: "outline" }) })) : null] }), entries && entries.length > 0 ? (_jsx(Card, { className: "@container/object-page-entries min-w-0 py-0", render: _jsx("div", { "data-slot": "object-page-entries" }), size: "sm", children: _jsx(Accordion, { className: "*:last:border-b-0", defaultValue: entries
|
|
22
|
+
return (_jsxs("div", { className: "grid min-w-0 gap-6", "data-slot": "object-page", children: [notice ? _jsx(NoticeBanner, { ...notice }) : null, _jsxs("div", { className: "grid min-w-0 gap-3", children: [_jsxs(Card, { className: "min-w-0", render: _jsx("div", { "data-slot": "object-card" }), size: "sm", children: [_jsxs(CardHeader, { className: cn("flex flex-wrap items-center justify-between gap-x-4 gap-y-3", facts && "border-b"), children: [_jsxs("div", { className: cn("flex min-w-0 flex-1 items-center gap-4", actions?.menu && !actions.secondary && !actions.primary ? "basis-0" : "basis-64"), children: [_jsx(IdentityMark, { ...mark, size: 64 }), _jsxs("div", { className: "grid min-w-0 gap-1", children: [_jsx(CardTitle, { className: "min-w-0 wrap-break-word group-data-[size=sm]/card:text-heading-sm", children: title }), description ? _jsx(CardDescription, { children: description }) : null] })] }), actions ? _jsx(CardActionsRow, { ...actions }) : null] }), facts ? (_jsx(CardContent, { className: "grid min-w-0 gap-x-6 gap-y-5", children: _jsx("div", { className: "@container/object-page-facts grid min-w-0 content-start gap-4", children: _jsx("dl", { className: "grid min-w-0 grid-cols-2 gap-x-6 gap-y-4 @xl/object-page-facts:grid-cols-4", "data-slot": "object-page-facts", children: facts.map((fact) => (_jsxs("div", { className: "grid min-w-0 content-start gap-1", children: [_jsx("dt", { className: "text-label-sm text-muted-foreground", children: fact.label }), _jsx("dd", { className: "min-w-0 text-body-sm wrap-break-word text-foreground", children: fact.value })] }, fact.label))) }) }) })) : null, footer ? (_jsx(FooterStrip, { hint: footer.hint, hintSlot: "object-page-hint", children: _jsx(PageCommandButton, { command: footer.link, variant: "outline" }) })) : null] }), entries && entries.length > 0 ? (_jsx(Card, { className: "@container/object-page-entries min-w-0 py-0", render: _jsx("div", { "data-slot": "object-page-entries" }), size: "sm", children: _jsx(Accordion, { className: "*:last:border-b-0", defaultValue: entries
|
|
22
23
|
.filter((entry) => entry.defaultOpen)
|
|
23
24
|
.map((entry) => entry.title), multiple: true, size: "small", children: entries.map((entry) => (_jsxs(AccordionItem, { value: entry.title, children: [_jsxs(AccordionTrigger, { className: "justify-start gap-3 px-(--card-spacing) group-data-[size=small]/accordion:text-body-sm focus-visible:-outline-offset-2 *:data-[slot=accordion-trigger-icon]:order-first *:data-[slot=accordion-trigger-icon]:text-muted-foreground", level: 2, children: [_jsx("span", { className: "min-w-0 flex-1", children: entry.title }), entry.summary] }), _jsx(AccordionContent, { className: "px-(--card-spacing) @md/object-page-entries:ps-[calc(var(--card-spacing)+1.75rem)]", children: entry.children })] }, entry.title))) }) })) : null] }), children] }));
|
|
24
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { type KpiCardProps } from "./kpi-card.js";
|
|
3
|
+
import { type NoticeBannerProps } from "./notice-banner.js";
|
|
3
4
|
type OverviewTitle = {
|
|
4
5
|
/** The page's title, when the product's chrome draws no path that names the page. */
|
|
5
6
|
title: string;
|
|
@@ -10,6 +11,8 @@ type OverviewTitle = {
|
|
|
10
11
|
description?: never;
|
|
11
12
|
};
|
|
12
13
|
export type OverviewPageProps = OverviewTitle & {
|
|
14
|
+
/** A condition of what the page reads that the page fixes, under the title: one `NoticeBanner`. */
|
|
15
|
+
notice?: NoticeBannerProps;
|
|
13
16
|
/** On the title row, through PageActions. */
|
|
14
17
|
period?: ReactElement;
|
|
15
18
|
/** The figures, one row of equal cards, one column below md. */
|
|
@@ -34,6 +37,6 @@ export type OverviewPageProps = OverviewTitle & {
|
|
|
34
37
|
* @words The product words every figure, chart and exception. A figure's label names its measure ("Active Agents", "Spend"), the chart's title names its reading ("Usage"), and the exceptions' heading says what they are ("Needs attention").
|
|
35
38
|
* @access Each chart card is a named section at the page's heading level, and the exceptions carry their own heading; figures are text, never colour alone.
|
|
36
39
|
*/
|
|
37
|
-
export declare function OverviewPage({ title, description, period, figures, nothingYet, charts, exceptions, }: OverviewPageProps): import("react").JSX.Element;
|
|
40
|
+
export declare function OverviewPage({ title, description, period, figures, nothingYet, charts, exceptions, notice, }: OverviewPageProps): import("react").JSX.Element;
|
|
38
41
|
export {};
|
|
39
42
|
//# sourceMappingURL=overview-page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview-page.d.ts","sourceRoot":"","sources":["../../src/components/overview-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"overview-page.d.ts","sourceRoot":"","sources":["../../src/components/overview-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGlF,KAAK,aAAa,GACd;IACE,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,GACD;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,mGAAmG;IACnG,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,gEAAgE;IAChE,OAAO,CAAC,EAAE,SAAS,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,EAAE,CAAC;IACxD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,gGAAgG;IAChG,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB,CAAC;AAWF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAoB,EACpB,UAAU,EACV,MAAM,EACN,UAAU,EACV,MAAM,GACP,EAAE,iBAAiB,+BA0BnB"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { CardRow } from "./card-row.js";
|
|
4
4
|
import { KpiCard } from "./kpi-card.js";
|
|
5
5
|
import { PageActions, PageActionsHostProvider } from "./page-actions.js";
|
|
6
|
+
import { NoticeBanner } from "./notice-banner.js";
|
|
6
7
|
import { PageHeader } from "./page-header.js";
|
|
7
8
|
function figureColumns(count) {
|
|
8
9
|
if (count === 2 || count === 3 || count === 4 || count === 5)
|
|
@@ -24,7 +25,7 @@ const NO_FIGURES = [];
|
|
|
24
25
|
* @words The product words every figure, chart and exception. A figure's label names its measure ("Active Agents", "Spend"), the chart's title names its reading ("Usage"), and the exceptions' heading says what they are ("Needs attention").
|
|
25
26
|
* @access Each chart card is a named section at the page's heading level, and the exceptions carry their own heading; figures are text, never colour alone.
|
|
26
27
|
*/
|
|
27
|
-
export function OverviewPage({ title, description, period, figures = NO_FIGURES, nothingYet, charts, exceptions, }) {
|
|
28
|
-
const page = (_jsxs("div", { "data-slot": "overview-page", className: "grid min-w-0 gap-6", children: [title ? _jsx(PageHeader, { description: description, title: title }) : null, _jsx(PageActions, { period: period }), nothingYet ? (_jsx("p", { className: "text-muted-foreground nc-type-body-sm", "data-slot": "overview-nothing-yet", children: nothingYet })) : (_jsxs(_Fragment, { children: [figures.length > 0 ? (_jsx(CardRow, { columns: figureColumns(figures.length), from: "md", children: figures.map((figure) => (_jsx(KpiCard, { ...figure }, figure.label))) })) : null, charts] })), exceptions] }));
|
|
28
|
+
export function OverviewPage({ title, description, period, figures = NO_FIGURES, nothingYet, charts, exceptions, notice, }) {
|
|
29
|
+
const page = (_jsxs("div", { "data-slot": "overview-page", className: "grid min-w-0 gap-6", children: [title ? _jsx(PageHeader, { description: description, title: title }) : null, _jsx(PageActions, { period: period }), notice ? _jsx(NoticeBanner, { ...notice }) : null, nothingYet ? (_jsx("p", { className: "text-muted-foreground nc-type-body-sm", "data-slot": "overview-nothing-yet", children: nothingYet })) : (_jsxs(_Fragment, { children: [figures.length > 0 ? (_jsx(CardRow, { columns: figureColumns(figures.length), from: "md", children: figures.map((figure) => (_jsx(KpiCard, { ...figure }, figure.label))) })) : null, charts] })), exceptions] }));
|
|
29
30
|
return title ? _jsx(PageActionsHostProvider, { children: page }) : page;
|
|
30
31
|
}
|