@nadicodeai/ui 12.1.197 → 12.1.199
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/AGENTS.md +7 -1
- package/dist/components/action-menu.d.ts +1 -1
- package/dist/components/action-menu.js +1 -1
- package/dist/components/activity-calendar.d.ts +2 -2
- package/dist/components/activity-calendar.js +2 -2
- package/dist/components/card.d.ts +2 -2
- package/dist/components/card.js +2 -2
- package/dist/components/clearable-input.d.ts +3 -2
- package/dist/components/clearable-input.d.ts.map +1 -1
- package/dist/components/clearable-input.js +3 -2
- package/dist/components/collection-page.d.ts +1 -1
- package/dist/components/collection-page.js +1 -1
- package/dist/components/collection-sort.d.ts +2 -2
- package/dist/components/collection-sort.js +2 -2
- package/dist/components/collection-toolbar.js +2 -2
- package/dist/components/command.d.ts +2 -2
- package/dist/components/command.js +2 -2
- package/dist/components/confirm-dialog.d.ts +1 -1
- package/dist/components/confirm-dialog.js +1 -1
- package/dist/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.js +1 -1
- package/dist/components/data-table.d.ts +3 -3
- package/dist/components/data-table.js +2 -2
- package/dist/components/dialog.d.ts +2 -1
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +2 -1
- package/dist/components/disclosure.d.ts +2 -2
- package/dist/components/disclosure.js +2 -2
- package/dist/components/document-tabs.d.ts +46 -0
- package/dist/components/document-tabs.d.ts.map +1 -0
- package/dist/components/document-tabs.js +54 -0
- package/dist/components/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/empty-state.js +1 -1
- package/dist/components/entry-scene.d.ts +1 -1
- package/dist/components/entry-scene.js +1 -1
- package/dist/components/file-tree.d.ts +42 -0
- package/dist/components/file-tree.d.ts.map +1 -0
- package/dist/components/file-tree.js +93 -0
- package/dist/components/file-type-icon.d.ts +6 -3
- package/dist/components/file-type-icon.d.ts.map +1 -1
- package/dist/components/file-type-icon.js +79 -5
- package/dist/components/form-dialog.d.ts +1 -1
- package/dist/components/form-dialog.js +1 -1
- package/dist/components/form-drawer.d.ts +1 -1
- package/dist/components/form-drawer.js +1 -1
- package/dist/components/hover-card.d.ts +2 -1
- package/dist/components/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card.js +2 -1
- package/dist/components/identity-mark.d.ts +1 -1
- package/dist/components/identity-mark.js +1 -1
- package/dist/components/input.d.ts +4 -4
- package/dist/components/input.js +4 -4
- package/dist/components/middle-truncate.d.ts +3 -1
- package/dist/components/middle-truncate.d.ts.map +1 -1
- package/dist/components/middle-truncate.js +3 -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 +3 -3
- package/dist/components/object-page.d.ts.map +1 -1
- package/dist/components/object-page.js +2 -2
- package/dist/components/page-actions.d.ts +3 -3
- package/dist/components/page-actions.js +3 -3
- package/dist/components/page-header.d.ts +16 -8
- package/dist/components/page-header.d.ts.map +1 -1
- package/dist/components/page-header.js +16 -8
- package/dist/components/popover.d.ts +4 -3
- package/dist/components/popover.d.ts.map +1 -1
- package/dist/components/popover.js +4 -3
- package/dist/components/record-identity.d.ts +1 -1
- package/dist/components/record-identity.js +1 -1
- package/dist/components/record-list.d.ts +1 -1
- package/dist/components/record-list.js +1 -1
- package/dist/components/scope-switcher.d.ts +1 -1
- package/dist/components/scope-switcher.js +1 -1
- package/dist/components/settings-facts.d.ts +1 -1
- package/dist/components/settings-facts.js +1 -1
- package/dist/components/settings-page.d.ts +1 -1
- package/dist/components/settings-page.js +1 -1
- package/dist/components/settings-section.d.ts +6 -6
- package/dist/components/settings-section.js +6 -6
- package/dist/components/sidebar-sections.d.ts +2 -2
- package/dist/components/sidebar-sections.js +2 -2
- package/dist/components/sidebar.d.ts +3 -3
- package/dist/components/sidebar.js +3 -3
- package/dist/components/status-badge.d.ts +13 -4
- package/dist/components/status-badge.d.ts.map +1 -1
- package/dist/components/status-badge.js +13 -4
- package/dist/components/table-value.d.ts +2 -2
- package/dist/components/table-value.js +2 -2
- package/dist/components/tabs.d.ts +10 -3
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +10 -3
- package/dist/components/tooltip.d.ts +3 -2
- package/dist/components/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip.js +3 -2
- package/dist/components/waiting-line.d.ts +3 -2
- package/dist/components/waiting-line.d.ts.map +1 -1
- package/dist/components/waiting-line.js +3 -2
- package/dist/internal/row-message.d.ts +1 -1
- package/dist/showcase/specimens/index.d.ts +2 -0
- package/dist/showcase/specimens/index.d.ts.map +1 -1
- package/dist/showcase/specimens/navigation.d.ts +2 -0
- package/dist/showcase/specimens/navigation.d.ts.map +1 -1
- package/dist/showcase/specimens/navigation.js +52 -0
- 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 +84 -62
- package/dist/styles/components.css +2 -2
- package/package.json +4 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
const idPart = (value) => encodeURIComponent(value).replaceAll("%", "_");
|
|
8
|
+
/** The id of a tab and of the panel it shows, for a page that draws its panels itself. */
|
|
9
|
+
function documentTabIds(idBase, value) {
|
|
10
|
+
return { tab: `${idBase}-tab-${idPart(value)}`, panel: `${idBase}-panel-${idPart(value)}` };
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Open documents side by side, as a browser's tabs: each a name with its icon and a close button, one of them shown.
|
|
14
|
+
*
|
|
15
|
+
* @family Navigation
|
|
16
|
+
* @when The things a person opened and switches between beside their work, each one closable: the files and web pages
|
|
17
|
+
* of Nadia's side panel. The set changes as they open and close things.
|
|
18
|
+
* @instead A fixed set of sibling views of one object is `Tabs`; a list of records to open is `ItemGroup`.
|
|
19
|
+
* @behaviour One tab stop: the arrow keys move between tabs, Home and End go to the first and the last, and moving
|
|
20
|
+
* selects. Delete or Backspace closes the focused tab and moves the focus to the tab shown next. A click on a tab's ×,
|
|
21
|
+
* which shows `closeLabel` on hover, closes that tab only and does not select it; the × is the pointer's, never a tab stop. Each tab is as wide as its name, from 7rem to 14rem, ending in an
|
|
22
|
+
* ellipsis; a row wider than its space scrolls sideways without a bar, and the tab shown scrolls into view. The tab
|
|
23
|
+
* shown takes the `accent` fill and ink text; the others are muted text that takes a lighter accent on hover.
|
|
24
|
+
* @words Each tab is the document's own name, a file's or a page's title. `closeLabel` is "Close <name>".
|
|
25
|
+
* @access A `tablist` named by `aria-label` of `tab`s, each declaring Delete in `aria-keyshortcuts` and an `aria-controls` naming the panel the page draws with
|
|
26
|
+
* `documentTabIds(idBase, value).panel`, which the panel takes as its id beside `aria-labelledby` set to `.tab`.
|
|
27
|
+
*/
|
|
28
|
+
function DocumentTabs({ tabs, value, onValueChange, onClose, idBase, children, className, ...props }) {
|
|
29
|
+
const list = React.useRef(null);
|
|
30
|
+
const focusShown = React.useRef(false);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
const shown = list.current?.querySelector(`#${CSS.escape(documentTabIds(idBase, value).tab)}`);
|
|
33
|
+
shown?.scrollIntoView?.({ block: "nearest", inline: "nearest" });
|
|
34
|
+
if (focusShown.current) {
|
|
35
|
+
focusShown.current = false;
|
|
36
|
+
shown?.focus();
|
|
37
|
+
}
|
|
38
|
+
}, [idBase, value]);
|
|
39
|
+
const closeByKey = (event, tab) => {
|
|
40
|
+
if (event.key === "Delete" || event.key === "Backspace") {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
focusShown.current = true;
|
|
43
|
+
onClose(tab.value);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return (_jsxs(TabsPrimitive.Root, { className: cn("flex min-w-0 items-center gap-1", className), "data-slot": "document-tabs", onValueChange: (next) => onValueChange(String(next)), value: value, children: [_jsx(TabsPrimitive.List, { activateOnFocus: true, "aria-label": props["aria-label"], className: "flex min-w-0 items-center gap-0.5 overflow-x-auto scrollbar-none", ref: list, children: tabs.map((tab) => {
|
|
47
|
+
const ids = documentTabIds(idBase, tab.value);
|
|
48
|
+
return (_jsxs(TabsPrimitive.Tab, { "aria-controls": ids.panel, "aria-keyshortcuts": "Delete", className: cn("group/document-tab nc-transition-paint flex h-7 max-w-56 min-w-28 shrink items-center gap-1.5 rounded-md ps-2 pe-1 text-sm text-muted-foreground hover:bg-accent/60 data-active:bg-accent data-active:text-foreground [&_svg]:size-4 [&_svg]:shrink-0"), id: ids.tab, onKeyDown: (event) => closeByKey(event, tab), title: tab.title, value: tab.value, children: [tab.icon, _jsx("span", { className: "min-w-0 flex-1 truncate text-start", children: tab.label }), _jsx("span", { "aria-hidden": "true", className: "nc-transition-paint grid size-5 shrink-0 place-items-center rounded-sm hover:bg-accent [&_svg]:size-3.5", "data-slot": "document-tab-close", onClick: (event) => {
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
onClose(tab.value);
|
|
51
|
+
}, title: tab.closeLabel, children: _jsx(XIcon, {}) })] }, tab.value));
|
|
52
|
+
}) }), children] }));
|
|
53
|
+
}
|
|
54
|
+
export { DocumentTabs, documentTabIds };
|
|
@@ -5,7 +5,7 @@ import type { LoadingWord } from "./button.js";
|
|
|
5
5
|
* A menu that floats from a visible trigger, built from its parts: the surface, labelled groups, commands, links, choices and dividers.
|
|
6
6
|
*
|
|
7
7
|
* @family Menus
|
|
8
|
-
* @when "Use Menu for a discoverable trigger that opens a list of actions on a single resource (a dots menu on a row, a dropdown on a primary entity)." (https://vercel.com/geist/menu) Ours: a menu no composition draws: a column chooser, a sort, a product's own choices in a submenu.
|
|
8
|
+
* @when "Use Menu for a discoverable trigger that opens a list of actions on a single resource (a dots menu on a row, a dropdown on a primary entity)." (https://vercel.com/geist/menu) Ours: inside `@nadicodeai/ui` only, which does not export it, a menu no composition draws: a column chooser, a sort, a product's own choices in a submenu.
|
|
9
9
|
* @instead "For right-click or long-press on a row, use `ContextMenu`. For global commands behind `⌘K`, use `CommandMenu`. For two related primary actions, use a split button rather than burying the secondary action." (https://vercel.com/geist/menu) Ours: those are `ContextMenu` and `CommandDialog`; two related primary actions stand side by side as buttons. A record's or a page's commands are `ActionMenu` or `PageActions`' menu, from data. The account's rows are `AccountMenu`. These four draw their rows with `DropdownMenuCommand`; the `DropdownMenu` family is used directly only for a choice menu such as a sort, with `DropdownMenuLink` for a destination row. A value to choose in a form is `Select`.
|
|
10
10
|
* @behaviour "Dropdown menu opened via button. Supports typeahead and keyboard navigation." (https://vercel.com/geist/menu) "Open on click, not hover; hover-open menus collide with screen readers and trackpad scrolls." (https://vercel.com/geist/menu) "Position auto-flips based on window bounds; don’t hardcode a side that clips on narrow viewports." (https://vercel.com/geist/menu) "Close on item activation, Escape, and outside-click. Don’t auto-close on a hover-out." (https://vercel.com/geist/menu) "Use `MenuItemLocked` for permission-gated actions so the lock icon and disabled state explain why the row is inert." (https://vercel.com/geist/menu) Ours: that is `locked` with its `reason`. A solid floating surface, 200 px wide at least, 10 px from its trigger. A labelled trigger may end in a chevron; an icon trigger has none. Safe commands come first, each with its icon, groups split by a divider, the destructive command last. Colour sits on that command alone: its text is the error colour at rest and its row takes the soft error fill when highlighted; the panel, the other rows, a section title and the divider stay neutral, and a suffix or lock is muted, 12 px after the label. A command that cannot run stays in place with muted text, never dimmed, and says why in a muted line under its label, which a tap on a phone reads as well as a pointer, since a tooltip opens for the mouse only; a destructive one is muted, not red. Every row, of any kind, is 36 px in the default comfortable density (44 on touch; the compact density, `density="compact"`, tightens the padding to about 28 px on a fine pointer, and no menu in the product uses it) with `{rounded.sm}` corners and the pointer cursor, or the default one when it cannot be chosen, a row with a reason growing by its line, and a section title is a muted row of that height. The highlight is the row's fill alone: no text inside a row changes colour with it, and a row that cannot be chosen takes no highlight. A submenu goes one level deep at most (`one-submenu-level`), and never holds a destructive command.
|
|
11
11
|
* @words "Item children are Title Case `Verb + Noun` (`Rename Project`, `Duplicate Deployment`). Bare verbs like `Rename` or `Edit` are wrong outside obvious single-object context." (https://vercel.com/geist/menu) "End an item with `…` only when activating it opens a follow-up dialog (`Rename…`, `Transfer to Team…`)." (https://vercel.com/geist/menu) "Group destructive items at the bottom, separated by a divider, and keep the destructive copy as `Verb + Noun` (`Delete Project`, never bare `Delete`)." (https://vercel.com/geist/menu) "Section headers (`MenuSection title`) are Title Case, 1–2 words (`Workspace`, `Recent Projects`)." (https://vercel.com/geist/menu) "Cap a Menu around 10 items. Past that, group with `MenuSection` or move secondary actions to a settings page." (https://vercel.com/geist/menu) Ours: sentence case, not Title Case: "Remove mailbox", never a bare "Delete"; a section title is sentence case too. Italian runs a third longer; rows wrap, never truncate.
|
|
@@ -10,7 +10,7 @@ import { ChevronRightIcon, CheckIcon, LockIcon } from "lucide-react";
|
|
|
10
10
|
* A menu that floats from a visible trigger, built from its parts: the surface, labelled groups, commands, links, choices and dividers.
|
|
11
11
|
*
|
|
12
12
|
* @family Menus
|
|
13
|
-
* @when "Use Menu for a discoverable trigger that opens a list of actions on a single resource (a dots menu on a row, a dropdown on a primary entity)." (https://vercel.com/geist/menu) Ours: a menu no composition draws: a column chooser, a sort, a product's own choices in a submenu.
|
|
13
|
+
* @when "Use Menu for a discoverable trigger that opens a list of actions on a single resource (a dots menu on a row, a dropdown on a primary entity)." (https://vercel.com/geist/menu) Ours: inside `@nadicodeai/ui` only, which does not export it, a menu no composition draws: a column chooser, a sort, a product's own choices in a submenu.
|
|
14
14
|
* @instead "For right-click or long-press on a row, use `ContextMenu`. For global commands behind `⌘K`, use `CommandMenu`. For two related primary actions, use a split button rather than burying the secondary action." (https://vercel.com/geist/menu) Ours: those are `ContextMenu` and `CommandDialog`; two related primary actions stand side by side as buttons. A record's or a page's commands are `ActionMenu` or `PageActions`' menu, from data. The account's rows are `AccountMenu`. These four draw their rows with `DropdownMenuCommand`; the `DropdownMenu` family is used directly only for a choice menu such as a sort, with `DropdownMenuLink` for a destination row. A value to choose in a form is `Select`.
|
|
15
15
|
* @behaviour "Dropdown menu opened via button. Supports typeahead and keyboard navigation." (https://vercel.com/geist/menu) "Open on click, not hover; hover-open menus collide with screen readers and trackpad scrolls." (https://vercel.com/geist/menu) "Position auto-flips based on window bounds; don’t hardcode a side that clips on narrow viewports." (https://vercel.com/geist/menu) "Close on item activation, Escape, and outside-click. Don’t auto-close on a hover-out." (https://vercel.com/geist/menu) "Use `MenuItemLocked` for permission-gated actions so the lock icon and disabled state explain why the row is inert." (https://vercel.com/geist/menu) Ours: that is `locked` with its `reason`. A solid floating surface, 200 px wide at least, 10 px from its trigger. A labelled trigger may end in a chevron; an icon trigger has none. Safe commands come first, each with its icon, groups split by a divider, the destructive command last. Colour sits on that command alone: its text is the error colour at rest and its row takes the soft error fill when highlighted; the panel, the other rows, a section title and the divider stay neutral, and a suffix or lock is muted, 12 px after the label. A command that cannot run stays in place with muted text, never dimmed, and says why in a muted line under its label, which a tap on a phone reads as well as a pointer, since a tooltip opens for the mouse only; a destructive one is muted, not red. Every row, of any kind, is 36 px in the default comfortable density (44 on touch; the compact density, `density="compact"`, tightens the padding to about 28 px on a fine pointer, and no menu in the product uses it) with `{rounded.sm}` corners and the pointer cursor, or the default one when it cannot be chosen, a row with a reason growing by its line, and a section title is a muted row of that height. The highlight is the row's fill alone: no text inside a row changes colour with it, and a row that cannot be chosen takes no highlight. A submenu goes one level deep at most (`one-submenu-level`), and never holds a destructive command.
|
|
16
16
|
* @words "Item children are Title Case `Verb + Noun` (`Rename Project`, `Duplicate Deployment`). Bare verbs like `Rename` or `Edit` are wrong outside obvious single-object context." (https://vercel.com/geist/menu) "End an item with `…` only when activating it opens a follow-up dialog (`Rename…`, `Transfer to Team…`)." (https://vercel.com/geist/menu) "Group destructive items at the bottom, separated by a divider, and keep the destructive copy as `Verb + Noun` (`Delete Project`, never bare `Delete`)." (https://vercel.com/geist/menu) "Section headers (`MenuSection title`) are Title Case, 1–2 words (`Workspace`, `Recent Projects`)." (https://vercel.com/geist/menu) "Cap a Menu around 10 items. Past that, group with `MenuSection` or move secondary actions to a settings page." (https://vercel.com/geist/menu) Ours: sentence case, not Title Case: "Remove mailbox", never a bare "Delete"; a section title is sentence case too. Italian runs a third longer; rows wrap, never truncate.
|
|
@@ -59,7 +59,7 @@ export type EmptyStateKind<K extends EmptyStateProps["kind"]> = Omit<Extract<Emp
|
|
|
59
59
|
* matched, finished, not allowed, or failed to load.
|
|
60
60
|
*
|
|
61
61
|
* @family Feedback
|
|
62
|
-
* @when "Fill spaces when no content has been added yet, or is temporarily empty due to the nature of the feature and should be designed to prevent confusion." (https://vercel.com/geist/empty-state) "A card used to communicate an error state with a title and message." (https://vercel.com/geist/error-card) "Pick the variant by what the user needs: no-results for a filtered list that returned zero rows, blank slate or informational for a resource the user hasn’t created, cleared for completed work, permission for role or tier denials, error for a failed load." (https://vercel.com/geist/empty-state) "Render the permission and tier-denial variants full-page when the user lands on a route they can’t view. Use a `Note` only when one tile inside an otherwise-accessible page is gated." (https://vercel.com/geist/empty-state) "Use the Error component as a block surface when a section or page-level resource failed to load: a panel, a dashboard card, a route boundary." (https://vercel.com/geist/error) Ours:
|
|
62
|
+
* @when "Fill spaces when no content has been added yet, or is temporarily empty due to the nature of the feature and should be designed to prevent confusion." (https://vercel.com/geist/empty-state) "A card used to communicate an error state with a title and message." (https://vercel.com/geist/error-card) "Pick the variant by what the user needs: no-results for a filtered list that returned zero rows, blank slate or informational for a resource the user hasn’t created, cleared for completed work, permission for role or tier denials, error for a failed load." (https://vercel.com/geist/empty-state) "Render the permission and tier-denial variants full-page when the user lands on a route they can’t view. Use a `Note` only when one tile inside an otherwise-accessible page is gated." (https://vercel.com/geist/empty-state) "Use the Error component as a block surface when a section or page-level resource failed to load: a panel, a dashboard card, a route boundary." (https://vercel.com/geist/error) Ours: it is the one owner of an absence in every product: nothing else draws one, and it has no presentation option, so each kind looks the same everywhere. A composition takes its absence as a prop (`empty`, `noMatch` or `failed`), as `DataTable` takes `empty`. Pick the `kind` by the cause. `firstUse` is the blank slate and the informational variant: no record was ever made. `nothingYet`: empty now and it fills by itself. `noResults`: the search or filter found nothing. `cleared`: the work is done. `denied`: this viewer's role or plan does not open it. `failed`: the read failed; it is the Error and the Error Card, a failure inside a card with `scope="card"` and one that stands alone as a block with `page` or `region`. There is no educational kind.
|
|
63
63
|
* @instead "Don’t put critical persistent warnings here. Empty states vanish when the list populates; persistent warnings belong in `Note` or the page header." (https://vercel.com/geist/empty-state) "Pick `toasts.error()` for transient action failures (`Couldn’t save settings. Try again.`) and the `error` prop on `Input` for field-level validation. Don’t replace either with this block." (https://vercel.com/geist/error) Ours: `Note` is `MessageNotice` or `NoticeBanner`, `toasts.error()` is `showMessageToast` with the tone `error`, and the `error` prop on `Input` is `FieldError`. Rows still loading are skeleton rows. A failure of one record's action is that record's row message. One gated tile on an open page is a `MessageNotice`, so `denied` takes `page` or `region`, never `card`.
|
|
64
64
|
* @behaviour "The CTA must be a real `Button` or `Link`, not an `onClick` div, so it joins the tab order and exposes a role." (https://vercel.com/geist/empty-state) "Cap at one primary CTA, plus one secondary when the first action could legitimately be one of two paths (`Import Repository` and `Deploy Template`). Three CTAs is a smell." (https://vercel.com/geist/empty-state) "Don’t auto-launch a tour from the educational variant; pair `Start Tour` with `Skip`." (https://vercel.com/geist/empty-state) "The recovery action must do something concrete: a `Try Again` button when the operation is retry-safe, a named verb (`Reconnect GitHub`, `Update Payment Method`) when it isn’t." (https://vercel.com/geist/error) "Don’t auto-retry in the background; the user came to this surface to decide." (https://vercel.com/geist/error) "For full-page route errors (`error.tsx`), return focus to the `Try Again` button on appearance so a keyboard user can retry without hunting for it." (https://vercel.com/geist/error) "Always pair platform or system errors with a stable identifier (request ID `x-vercel-id`, deployment ID `dpl_…`, run ID, trace ID). Validation and permission denials are user-state, not system, and don’t need an ID." (https://vercel.com/geist/error) "Render the stable ID on a monospace sub-line under a collapsed `<details>` so the user can copy-paste it into a support thread." (https://vercel.com/geist/error) Ours: `firstUse` has the one picture, one action and at most one docs link under it; there is no educational kind, so no tour. A failure shows at most two of its message's actions, Retry first, and moves focus to the first one when it fills a page (`scope="page"`); its `reference` is the collapsed Disclosure holding the monospace identifier and a copy button. A page or a region stands on a resting card, inside a card it takes none, and a collection always passes `card`; a card that lists a few items, as a collection's rail does, passes `line`, where `nothingYet` and `cleared` are one 44 px row like an item: the message at the left, after the cleared check at 16 px. Every kind that carries a title, `failed` excepted, draws it the same way: a mark or picture, a 16 px medium title, one or two muted 14 px lines, 24 px apart, centred, the lines no wider than 340 px. `cleared` and `denied` carry a bordered 54 px tile with a muted icon, never a hue; the picture is `firstUse`'s alone. The action is the filled primary button, as Vercel's Connect draws Create Connector in its empty card; the docs link is muted. A page or a region is padded 48 px above and below and 70 px at the sides (a first use narrows to 24 px under 640 px for its picture). `failed` is the one hued kind: on a page or a region its ground, line, mark and text are all in the error colour, with a 16 px regular title, 16 px padding and 8 px between its parts, and the buttons stay neutral; inside a card it takes the text and mark colour alone, because the card owns the edge and a second one would double it. A first use's picture is 240 × 176 px on a page and 200 × 144 px in a region or a card. Required: `firstUse` and `denied` take a title and a line, `firstUse` its picture, `failed` the catalogue message whose title is always drawn.
|
|
65
65
|
* @words "`title` is Title Case (`No Logs Match Your Filter`); `description` is sentence case and adds new information instead of restating the title." (https://vercel.com/geist/empty-state) Ours: a title is sentence case and names what is missing ("No mailboxes yet"), not Title Case; a quiet line is one sentence. "Quote a single typed query verbatim with curly quotes: `No logs match “${query}”. Clear the filter to see all logs.` For multi-facet filters use the plural template `No {Items} Match Your Filters` and suggest widening or clearing." (https://vercel.com/geist/empty-state) "Onboarding bodies name the next action that creates the first item: `Push to your Git repository to create your first one.` Tier-gated bodies follow `{Feature value} with the {Plan} plan.`" (https://vercel.com/geist/empty-state) "Error variant pairs the body with a copyable request ID and a `Try Again` button." (https://vercel.com/geist/empty-state) "CTA labels are Title Case `Verb + Noun`. Never `Get Started`, `Continue`, or `OK`." (https://vercel.com/geist/empty-state) Ours: an action label is sentence case, verb and noun ("Clear filters", "New Agent"), never "Get started" or "OK". "State what happened and what to do next, in that order. Cut apologetic preambles (`Unfortunately`, `Oops`, `We’re sorry`)." (https://vercel.com/geist/error) "Use `Couldn’t` or `Can’t` for user-state errors (`Couldn’t verify your passkey. Try again.`); use `Failed to` for system or infra errors that mirror CLI output (`Build failed. Bundle exceeds 50 MB.`). `Unable to` is banned." (https://vercel.com/geist/error) "Don’t fall back to `Something Went Wrong` as a title; name the resource that failed (`Couldn’t Load Page`, `Couldn’t Load Deployments`)." (https://vercel.com/geist/error) "Never humor an error. Users hitting an error are frustrated; insincere copy makes it worse." (https://vercel.com/geist/error) Ours: a failure is the catalogue's message, never a string of the component's own, and its title names what failed to load.
|
|
@@ -12,7 +12,7 @@ import { bodyBeyondTitle } from "./product-message.js";
|
|
|
12
12
|
* matched, finished, not allowed, or failed to load.
|
|
13
13
|
*
|
|
14
14
|
* @family Feedback
|
|
15
|
-
* @when "Fill spaces when no content has been added yet, or is temporarily empty due to the nature of the feature and should be designed to prevent confusion." (https://vercel.com/geist/empty-state) "A card used to communicate an error state with a title and message." (https://vercel.com/geist/error-card) "Pick the variant by what the user needs: no-results for a filtered list that returned zero rows, blank slate or informational for a resource the user hasn’t created, cleared for completed work, permission for role or tier denials, error for a failed load." (https://vercel.com/geist/empty-state) "Render the permission and tier-denial variants full-page when the user lands on a route they can’t view. Use a `Note` only when one tile inside an otherwise-accessible page is gated." (https://vercel.com/geist/empty-state) "Use the Error component as a block surface when a section or page-level resource failed to load: a panel, a dashboard card, a route boundary." (https://vercel.com/geist/error) Ours:
|
|
15
|
+
* @when "Fill spaces when no content has been added yet, or is temporarily empty due to the nature of the feature and should be designed to prevent confusion." (https://vercel.com/geist/empty-state) "A card used to communicate an error state with a title and message." (https://vercel.com/geist/error-card) "Pick the variant by what the user needs: no-results for a filtered list that returned zero rows, blank slate or informational for a resource the user hasn’t created, cleared for completed work, permission for role or tier denials, error for a failed load." (https://vercel.com/geist/empty-state) "Render the permission and tier-denial variants full-page when the user lands on a route they can’t view. Use a `Note` only when one tile inside an otherwise-accessible page is gated." (https://vercel.com/geist/empty-state) "Use the Error component as a block surface when a section or page-level resource failed to load: a panel, a dashboard card, a route boundary." (https://vercel.com/geist/error) Ours: it is the one owner of an absence in every product: nothing else draws one, and it has no presentation option, so each kind looks the same everywhere. A composition takes its absence as a prop (`empty`, `noMatch` or `failed`), as `DataTable` takes `empty`. Pick the `kind` by the cause. `firstUse` is the blank slate and the informational variant: no record was ever made. `nothingYet`: empty now and it fills by itself. `noResults`: the search or filter found nothing. `cleared`: the work is done. `denied`: this viewer's role or plan does not open it. `failed`: the read failed; it is the Error and the Error Card, a failure inside a card with `scope="card"` and one that stands alone as a block with `page` or `region`. There is no educational kind.
|
|
16
16
|
* @instead "Don’t put critical persistent warnings here. Empty states vanish when the list populates; persistent warnings belong in `Note` or the page header." (https://vercel.com/geist/empty-state) "Pick `toasts.error()` for transient action failures (`Couldn’t save settings. Try again.`) and the `error` prop on `Input` for field-level validation. Don’t replace either with this block." (https://vercel.com/geist/error) Ours: `Note` is `MessageNotice` or `NoticeBanner`, `toasts.error()` is `showMessageToast` with the tone `error`, and the `error` prop on `Input` is `FieldError`. Rows still loading are skeleton rows. A failure of one record's action is that record's row message. One gated tile on an open page is a `MessageNotice`, so `denied` takes `page` or `region`, never `card`.
|
|
17
17
|
* @behaviour "The CTA must be a real `Button` or `Link`, not an `onClick` div, so it joins the tab order and exposes a role." (https://vercel.com/geist/empty-state) "Cap at one primary CTA, plus one secondary when the first action could legitimately be one of two paths (`Import Repository` and `Deploy Template`). Three CTAs is a smell." (https://vercel.com/geist/empty-state) "Don’t auto-launch a tour from the educational variant; pair `Start Tour` with `Skip`." (https://vercel.com/geist/empty-state) "The recovery action must do something concrete: a `Try Again` button when the operation is retry-safe, a named verb (`Reconnect GitHub`, `Update Payment Method`) when it isn’t." (https://vercel.com/geist/error) "Don’t auto-retry in the background; the user came to this surface to decide." (https://vercel.com/geist/error) "For full-page route errors (`error.tsx`), return focus to the `Try Again` button on appearance so a keyboard user can retry without hunting for it." (https://vercel.com/geist/error) "Always pair platform or system errors with a stable identifier (request ID `x-vercel-id`, deployment ID `dpl_…`, run ID, trace ID). Validation and permission denials are user-state, not system, and don’t need an ID." (https://vercel.com/geist/error) "Render the stable ID on a monospace sub-line under a collapsed `<details>` so the user can copy-paste it into a support thread." (https://vercel.com/geist/error) Ours: `firstUse` has the one picture, one action and at most one docs link under it; there is no educational kind, so no tour. A failure shows at most two of its message's actions, Retry first, and moves focus to the first one when it fills a page (`scope="page"`); its `reference` is the collapsed Disclosure holding the monospace identifier and a copy button. A page or a region stands on a resting card, inside a card it takes none, and a collection always passes `card`; a card that lists a few items, as a collection's rail does, passes `line`, where `nothingYet` and `cleared` are one 44 px row like an item: the message at the left, after the cleared check at 16 px. Every kind that carries a title, `failed` excepted, draws it the same way: a mark or picture, a 16 px medium title, one or two muted 14 px lines, 24 px apart, centred, the lines no wider than 340 px. `cleared` and `denied` carry a bordered 54 px tile with a muted icon, never a hue; the picture is `firstUse`'s alone. The action is the filled primary button, as Vercel's Connect draws Create Connector in its empty card; the docs link is muted. A page or a region is padded 48 px above and below and 70 px at the sides (a first use narrows to 24 px under 640 px for its picture). `failed` is the one hued kind: on a page or a region its ground, line, mark and text are all in the error colour, with a 16 px regular title, 16 px padding and 8 px between its parts, and the buttons stay neutral; inside a card it takes the text and mark colour alone, because the card owns the edge and a second one would double it. A first use's picture is 240 × 176 px on a page and 200 × 144 px in a region or a card. Required: `firstUse` and `denied` take a title and a line, `firstUse` its picture, `failed` the catalogue message whose title is always drawn.
|
|
18
18
|
* @words "`title` is Title Case (`No Logs Match Your Filter`); `description` is sentence case and adds new information instead of restating the title." (https://vercel.com/geist/empty-state) Ours: a title is sentence case and names what is missing ("No mailboxes yet"), not Title Case; a quiet line is one sentence. "Quote a single typed query verbatim with curly quotes: `No logs match “${query}”. Clear the filter to see all logs.` For multi-facet filters use the plural template `No {Items} Match Your Filters` and suggest widening or clearing." (https://vercel.com/geist/empty-state) "Onboarding bodies name the next action that creates the first item: `Push to your Git repository to create your first one.` Tier-gated bodies follow `{Feature value} with the {Plan} plan.`" (https://vercel.com/geist/empty-state) "Error variant pairs the body with a copyable request ID and a `Try Again` button." (https://vercel.com/geist/empty-state) "CTA labels are Title Case `Verb + Noun`. Never `Get Started`, `Continue`, or `OK`." (https://vercel.com/geist/empty-state) Ours: an action label is sentence case, verb and noun ("Clear filters", "New Agent"), never "Get started" or "OK". "State what happened and what to do next, in that order. Cut apologetic preambles (`Unfortunately`, `Oops`, `We’re sorry`)." (https://vercel.com/geist/error) "Use `Couldn’t` or `Can’t` for user-state errors (`Couldn’t verify your passkey. Try again.`); use `Failed to` for system or infra errors that mirror CLI output (`Build failed. Bundle exceeds 50 MB.`). `Unable to` is banned." (https://vercel.com/geist/error) "Don’t fall back to `Something Went Wrong` as a title; name the resource that failed (`Couldn’t Load Page`, `Couldn’t Load Deployments`)." (https://vercel.com/geist/error) "Never humor an error. Users hitting an error are frustrated; insincere copy makes it worse." (https://vercel.com/geist/error) Ours: a failure is the catalogue's message, never a string of the component's own, and its title names what failed to load.
|
|
@@ -36,7 +36,7 @@ export type EntrySceneProps = {
|
|
|
36
36
|
* group. The screen is black in every theme.
|
|
37
37
|
*
|
|
38
38
|
* @family Compositions
|
|
39
|
-
* @when Nadia's installer and the desktop's sign-in, start, update and failure screens, which paint the same screen; a page that shows that screen beside other things; the top of every Nadia pairing drawer, contained at 16:9 with only its short status.
|
|
39
|
+
* @when Nadia's installer and the desktop's sign-in, start, update and failure screens, which paint the same screen; a page that shows that screen beside other things; the top of every Nadia pairing drawer, contained at 16:9 with only its short status ("Connecting Telegram", "Linked", "Code expired"): a longer sentence stands under the scene, never in it, and the code or QR the phone takes, with its expiry, then the steps on the phone follow it.
|
|
40
40
|
* @instead The Portal's entry pages are its funnel frame with the shared entry header; Alveare Server's entry is the HiveScene; a wait inside the product is a WaitingLine.
|
|
41
41
|
* @behaviour It holds no state and decides nothing: which view is open, the words and when the screen ends belong to whoever mounts it. Required: the picture, the wordmark and the heading, because every entry screen has all three; a screen that leaves one out does not compile. It fills a box of the window's own shape (`aspectRatio`), so the picture's figure stands on the window's floor (`pictureFeet`). A failure quiets the picture and never removes it. Its children stand in order: the message, the actions, the progress line, the stage list.
|
|
42
42
|
* @words The heading names the surface and is never seen. Instructions and status are one plain sentence that changes only when the real stage changes ("Loading your tools").
|
|
@@ -7,7 +7,7 @@ import { cssVariables } from "../lib/css-variables.js";
|
|
|
7
7
|
* group. The screen is black in every theme.
|
|
8
8
|
*
|
|
9
9
|
* @family Compositions
|
|
10
|
-
* @when Nadia's installer and the desktop's sign-in, start, update and failure screens, which paint the same screen; a page that shows that screen beside other things; the top of every Nadia pairing drawer, contained at 16:9 with only its short status.
|
|
10
|
+
* @when Nadia's installer and the desktop's sign-in, start, update and failure screens, which paint the same screen; a page that shows that screen beside other things; the top of every Nadia pairing drawer, contained at 16:9 with only its short status ("Connecting Telegram", "Linked", "Code expired"): a longer sentence stands under the scene, never in it, and the code or QR the phone takes, with its expiry, then the steps on the phone follow it.
|
|
11
11
|
* @instead The Portal's entry pages are its funnel frame with the shared entry header; Alveare Server's entry is the HiveScene; a wait inside the product is a WaitingLine.
|
|
12
12
|
* @behaviour It holds no state and decides nothing: which view is open, the words and when the screen ends belong to whoever mounts it. Required: the picture, the wordmark and the heading, because every entry screen has all three; a screen that leaves one out does not compile. It fills a box of the window's own shape (`aspectRatio`), so the picture's figure stands on the window's floor (`pictureFeet`). A failure quiets the picture and never removes it. Its children stand in order: the message, the actions, the progress line, the stage list.
|
|
13
13
|
* @words The heading names the surface and is never seen. Instructions and status are one plain sentence that changes only when the real stage changes ("Loading your tools").
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface FileTreeEntry {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
isFolder: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface FileTreeProps {
|
|
8
|
+
/** The folder the tree shows the inside of; it is not drawn as a row. */
|
|
9
|
+
root: FileTreeEntry;
|
|
10
|
+
/** Reads one folder's entries, in the order to show them. */
|
|
11
|
+
readFolder: (path: string) => Promise<FileTreeEntry[]>;
|
|
12
|
+
/** The paths of the folders open in the tree. */
|
|
13
|
+
expanded: readonly string[];
|
|
14
|
+
onExpandedChange: (expanded: string[]) => void;
|
|
15
|
+
/** The file shown elsewhere, marked in the tree. */
|
|
16
|
+
selected?: null | string;
|
|
17
|
+
onOpenFile: (entry: FileTreeEntry) => void;
|
|
18
|
+
/** Called when a folder cannot be read; the folder keeps what it last listed. */
|
|
19
|
+
onReadError?: (error: unknown, path: string) => void;
|
|
20
|
+
/** Changes whenever the folder may have changed on disk; each open folder is read again. */
|
|
21
|
+
changed?: number;
|
|
22
|
+
"aria-label": string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A folder and everything in it, as a tree of folders that open in place, each file with its kind's coloured icon.
|
|
27
|
+
*
|
|
28
|
+
* @family Navigation
|
|
29
|
+
* @when The files a person browses beside the thing they work on: an Agent's folder in Nadia's side panel. It is ReUI's
|
|
30
|
+
* file-explorer tree (`@reui/c-tree-5`) on Headless Tree, which reads each folder only when it opens.
|
|
31
|
+
* @instead One list of records is `ItemGroup`; a choice of one file to send is a file picker.
|
|
32
|
+
* @behaviour Folders first, then files, in the order `readFolder` gives. A click on a folder opens or closes it; a click
|
|
33
|
+
* on a file calls `onOpenFile`, and the file `selected` names is marked. The arrow keys move between rows, Right and Left
|
|
34
|
+
* open and close a folder, and Enter opens a file. Each level is indented 16 px. When
|
|
35
|
+
* `changed` changes, every open folder is read again and the tree keeps what is open. A folder that cannot be read keeps
|
|
36
|
+
* what it last listed and calls `onReadError`, so the page can say so and offer to read it again.
|
|
37
|
+
* @words Each row is the file's or the folder's own name. `aria-label` names whose folder it is: "Nadia's folder".
|
|
38
|
+
* @access A `tree` of `treeitem`s, with `aria-expanded` on a folder and `aria-current` on the file shown.
|
|
39
|
+
*/
|
|
40
|
+
declare function FileTree({ root, readFolder, expanded, onExpandedChange, selected, onOpenFile, onReadError, changed, className, ...props }: FileTreeProps): React.JSX.Element;
|
|
41
|
+
export { FileTree };
|
|
42
|
+
//# sourceMappingURL=file-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.d.ts","sourceRoot":"","sources":["../../src/components/file-tree.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,IAAI,EAAE,aAAa,CAAC;IACpB,6DAA6D;IAC7D,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACvD,iDAAiD;IACjD,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC/C,oDAAoD;IACpD,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,iFAAiF;IACjF,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoDD;;;;;;;;;;;;;;GAcG;AACH,iBAAS,QAAQ,CAAC,EAChB,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,QAAe,EACf,UAAU,EACV,WAAW,EACX,OAAW,EACX,SAAS,EACT,GAAG,KAAK,EACT,EAAE,aAAa,qBAyFf;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { asyncDataLoaderFeature, hotkeysCoreFeature, selectionFeature, } from "@headless-tree/core";
|
|
4
|
+
import { useTree } from "@headless-tree/react";
|
|
5
|
+
import { ChevronDownIcon, FolderIcon, FolderOpenIcon } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { cn } from "../lib/utils.js";
|
|
8
|
+
import { FileTypeIcon } from "./file-type-icon.js";
|
|
9
|
+
const INDENT = 16;
|
|
10
|
+
function FileTreeRow({ item, selected }) {
|
|
11
|
+
const entry = item.getItemData();
|
|
12
|
+
const folder = item.isFolder();
|
|
13
|
+
const open = item.isExpanded();
|
|
14
|
+
const props = item.getProps();
|
|
15
|
+
return (_jsx("button", { ...props, "aria-current": selected || undefined, className: "w-full rounded-sm text-start select-none", "data-slot": "file-tree-row", style: { paddingInlineStart: item.getItemMeta().level * INDENT }, title: entry?.name, type: "button", children: _jsxs("span", { className: cn("nc-transition-paint flex h-7 min-w-0 items-center gap-1.5 rounded-sm px-1.5 text-sm text-foreground hover:bg-accent", selected && "bg-accent font-medium"), children: [folder ? (_jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn("size-4 shrink-0 text-muted-foreground transition-transform", !open && "-rotate-90 rtl:rotate-90") })) : (_jsx("span", { "aria-hidden": "true", className: "size-4 shrink-0" })), folder ? (open ? (_jsx(FolderOpenIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-label-yellow" })) : (_jsx(FolderIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-label-yellow" }))) : (_jsx(FileTypeIcon, { path: entry?.name })), _jsx("span", { className: "truncate", children: entry?.name })] }) }));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A folder and everything in it, as a tree of folders that open in place, each file with its kind's coloured icon.
|
|
19
|
+
*
|
|
20
|
+
* @family Navigation
|
|
21
|
+
* @when The files a person browses beside the thing they work on: an Agent's folder in Nadia's side panel. It is ReUI's
|
|
22
|
+
* file-explorer tree (`@reui/c-tree-5`) on Headless Tree, which reads each folder only when it opens.
|
|
23
|
+
* @instead One list of records is `ItemGroup`; a choice of one file to send is a file picker.
|
|
24
|
+
* @behaviour Folders first, then files, in the order `readFolder` gives. A click on a folder opens or closes it; a click
|
|
25
|
+
* on a file calls `onOpenFile`, and the file `selected` names is marked. The arrow keys move between rows, Right and Left
|
|
26
|
+
* open and close a folder, and Enter opens a file. Each level is indented 16 px. When
|
|
27
|
+
* `changed` changes, every open folder is read again and the tree keeps what is open. A folder that cannot be read keeps
|
|
28
|
+
* what it last listed and calls `onReadError`, so the page can say so and offer to read it again.
|
|
29
|
+
* @words Each row is the file's or the folder's own name. `aria-label` names whose folder it is: "Nadia's folder".
|
|
30
|
+
* @access A `tree` of `treeitem`s, with `aria-expanded` on a folder and `aria-current` on the file shown.
|
|
31
|
+
*/
|
|
32
|
+
function FileTree({ root, readFolder, expanded, onExpandedChange, selected = null, onOpenFile, onReadError, changed = 0, className, ...props }) {
|
|
33
|
+
const read = React.useRef(readFolder);
|
|
34
|
+
const open = React.useRef(onOpenFile);
|
|
35
|
+
const failed = React.useRef(onReadError);
|
|
36
|
+
const listed = React.useRef(new Map());
|
|
37
|
+
React.useLayoutEffect(() => {
|
|
38
|
+
read.current = readFolder;
|
|
39
|
+
open.current = onOpenFile;
|
|
40
|
+
failed.current = onReadError;
|
|
41
|
+
});
|
|
42
|
+
const known = React.useRef(new Map([[root.path, root]]));
|
|
43
|
+
const state = React.useMemo(() => ({ expandedItems: [...expanded], selectedItems: selected ? [selected] : [] }), [expanded, selected]);
|
|
44
|
+
const tree = useTree({
|
|
45
|
+
rootItemId: root.path,
|
|
46
|
+
indent: INDENT,
|
|
47
|
+
state,
|
|
48
|
+
setExpandedItems: (next) => onExpandedChange(typeof next === "function" ? next([...expanded]) : next),
|
|
49
|
+
setSelectedItems: () => undefined,
|
|
50
|
+
getItemName: (item) => item.getItemData()?.name ?? "",
|
|
51
|
+
isItemFolder: (item) => item.getItemData()?.isFolder ?? false,
|
|
52
|
+
onPrimaryAction: (item) => {
|
|
53
|
+
const entry = item.getItemData();
|
|
54
|
+
if (entry && !entry.isFolder) {
|
|
55
|
+
open.current(entry);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
dataLoader: {
|
|
59
|
+
getItem: (id) => known.current.get(id) ?? { isFolder: true, name: id.split(/[\\/]/).at(-1) ?? id, path: id },
|
|
60
|
+
getChildrenWithData: async (id) => {
|
|
61
|
+
let entries;
|
|
62
|
+
try {
|
|
63
|
+
entries = await read.current(id);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
failed.current?.(error, id);
|
|
67
|
+
entries = listed.current.get(id) ?? [];
|
|
68
|
+
}
|
|
69
|
+
listed.current.set(id, entries);
|
|
70
|
+
for (const entry of entries) {
|
|
71
|
+
known.current.set(entry.path, entry);
|
|
72
|
+
}
|
|
73
|
+
return entries.map((entry) => ({ id: entry.path, data: entry }));
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
features: [asyncDataLoaderFeature, selectionFeature, hotkeysCoreFeature],
|
|
77
|
+
});
|
|
78
|
+
const shown = React.useRef(changed);
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
if (shown.current === changed) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
shown.current = changed;
|
|
84
|
+
for (const id of [root.path, ...expanded]) {
|
|
85
|
+
tree
|
|
86
|
+
.getItemInstance(id)
|
|
87
|
+
?.invalidateChildrenIds(true)
|
|
88
|
+
.catch(() => undefined);
|
|
89
|
+
}
|
|
90
|
+
}, [changed, expanded, root.path, tree]);
|
|
91
|
+
return (_jsx("div", { ...tree.getContainerProps(props["aria-label"]), "aria-label": props["aria-label"], className: cn("flex flex-col gap-px", className), "data-slot": "file-tree", children: tree.getItems().map((item) => (_jsx(FileTreeRow, { item: item, selected: item.getId() === selected }, item.getId()))) }));
|
|
92
|
+
}
|
|
93
|
+
export { FileTree };
|
|
@@ -7,11 +7,14 @@ export interface FileTypeIconProps extends Omit<React.ComponentProps<"svg">, "ch
|
|
|
7
7
|
* A file's kind as a Lucide icon, from its path or its language.
|
|
8
8
|
*
|
|
9
9
|
* @family Status
|
|
10
|
-
* @when Beside a file's name: a file an Agent wrote, a code block's language, an attachment.
|
|
10
|
+
* @when Beside a file's name: a file an Agent wrote, a code block's language, an attachment, a row of a folder.
|
|
11
11
|
* @instead An app is `AppMark`; a Library entry is its `IdentityMark`. A file's content is
|
|
12
12
|
* `CodeBlock` or `FileDiff`.
|
|
13
|
-
* @behaviour Maps a path's extension or a language name to one icon: terminal, document,
|
|
14
|
-
* settings, database, diff, palette, regex, globe, package,
|
|
13
|
+
* @behaviour Maps a path's extension or a language name to one icon: terminal, document, PDF, spreadsheet,
|
|
14
|
+
* slides, image, audio, video, archive, braces, settings, database, diff, palette, regex, globe, package,
|
|
15
|
+
* share; anything else is the code icon. The files people keep take their kind's category colour, as a file
|
|
16
|
+
* manager draws them: documents and Markdown blue, PDFs red, spreadsheets green, slides orange, pictures purple, audio pink,
|
|
17
|
+
* video teal, archives yellow; the others stay in the text colour.
|
|
15
18
|
* @words None; the file's name stands beside it.
|
|
16
19
|
* @access Always `aria-hidden`.
|
|
17
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-type-icon.d.ts","sourceRoot":"","sources":["../../src/components/file-type-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"file-type-icon.d.ts","sourceRoot":"","sources":["../../src/components/file-type-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AA0LpC,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,qBAY/E;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BracesIcon, CodeIcon, DatabaseIcon, FileCogIcon, FileDiffIcon, FileTextIcon, GlobeIcon, PackageIcon, PaletteIcon, RegexIcon, Share2Icon, TerminalIcon, } from "lucide-react";
|
|
2
|
+
import { BracesIcon, CodeIcon, DatabaseIcon, FileArchiveIcon, FileAudioIcon, FileCogIcon, FileDiffIcon, FileImageIcon, FileSpreadsheetIcon, FileTextIcon, FileVideoIcon, GlobeIcon, PackageIcon, PaletteIcon, PresentationIcon, RegexIcon, Share2Icon, TerminalIcon, } from "lucide-react";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
4
|
const ICON_BY_LANGUAGE = {
|
|
5
5
|
bash: TerminalIcon,
|
|
@@ -13,6 +13,14 @@ const ICON_BY_LANGUAGE = {
|
|
|
13
13
|
zsh: TerminalIcon,
|
|
14
14
|
md: FileTextIcon,
|
|
15
15
|
markdown: FileTextIcon,
|
|
16
|
+
document: FileTextIcon,
|
|
17
|
+
pdf: FileTextIcon,
|
|
18
|
+
spreadsheet: FileSpreadsheetIcon,
|
|
19
|
+
slides: PresentationIcon,
|
|
20
|
+
image: FileImageIcon,
|
|
21
|
+
audio: FileAudioIcon,
|
|
22
|
+
video: FileVideoIcon,
|
|
23
|
+
archive: FileArchiveIcon,
|
|
16
24
|
json: BracesIcon,
|
|
17
25
|
json5: BracesIcon,
|
|
18
26
|
ini: FileCogIcon,
|
|
@@ -44,6 +52,56 @@ const ICON_BY_LANGUAGE = {
|
|
|
44
52
|
mermaid: Share2Icon,
|
|
45
53
|
};
|
|
46
54
|
const LANGUAGE_BY_EXTENSION = new Map([
|
|
55
|
+
["txt", "document"],
|
|
56
|
+
["text", "document"],
|
|
57
|
+
["pdf", "pdf"],
|
|
58
|
+
["doc", "document"],
|
|
59
|
+
["docx", "document"],
|
|
60
|
+
["rtf", "document"],
|
|
61
|
+
["odt", "document"],
|
|
62
|
+
["pages", "document"],
|
|
63
|
+
["eml", "document"],
|
|
64
|
+
["msg", "document"],
|
|
65
|
+
["csv", "spreadsheet"],
|
|
66
|
+
["tsv", "spreadsheet"],
|
|
67
|
+
["xls", "spreadsheet"],
|
|
68
|
+
["xlsx", "spreadsheet"],
|
|
69
|
+
["xlsm", "spreadsheet"],
|
|
70
|
+
["ods", "spreadsheet"],
|
|
71
|
+
["numbers", "spreadsheet"],
|
|
72
|
+
["ppt", "slides"],
|
|
73
|
+
["pptx", "slides"],
|
|
74
|
+
["odp", "slides"],
|
|
75
|
+
["key", "slides"],
|
|
76
|
+
["png", "image"],
|
|
77
|
+
["jpg", "image"],
|
|
78
|
+
["jpeg", "image"],
|
|
79
|
+
["gif", "image"],
|
|
80
|
+
["webp", "image"],
|
|
81
|
+
["heic", "image"],
|
|
82
|
+
["bmp", "image"],
|
|
83
|
+
["tif", "image"],
|
|
84
|
+
["tiff", "image"],
|
|
85
|
+
["mp3", "audio"],
|
|
86
|
+
["wav", "audio"],
|
|
87
|
+
["m4a", "audio"],
|
|
88
|
+
["ogg", "audio"],
|
|
89
|
+
["oga", "audio"],
|
|
90
|
+
["opus", "audio"],
|
|
91
|
+
["flac", "audio"],
|
|
92
|
+
["aac", "audio"],
|
|
93
|
+
["mp4", "video"],
|
|
94
|
+
["mov", "video"],
|
|
95
|
+
["m4v", "video"],
|
|
96
|
+
["webm", "video"],
|
|
97
|
+
["avi", "video"],
|
|
98
|
+
["mkv", "video"],
|
|
99
|
+
["zip", "archive"],
|
|
100
|
+
["rar", "archive"],
|
|
101
|
+
["7z", "archive"],
|
|
102
|
+
["tar", "archive"],
|
|
103
|
+
["gz", "archive"],
|
|
104
|
+
["tgz", "archive"],
|
|
47
105
|
["bash", "bash"],
|
|
48
106
|
["cfg", "ini"],
|
|
49
107
|
["conf", "ini"],
|
|
@@ -72,6 +130,18 @@ const LANGUAGE_BY_EXTENSION = new Map([
|
|
|
72
130
|
["yml", "yml"],
|
|
73
131
|
["zsh", "zsh"],
|
|
74
132
|
]);
|
|
133
|
+
const COLOR_BY_LANGUAGE = {
|
|
134
|
+
document: "text-label-blue",
|
|
135
|
+
md: "text-label-blue",
|
|
136
|
+
markdown: "text-label-blue",
|
|
137
|
+
pdf: "text-label-red",
|
|
138
|
+
spreadsheet: "text-label-green",
|
|
139
|
+
slides: "text-label-orange",
|
|
140
|
+
image: "text-label-purple",
|
|
141
|
+
audio: "text-label-pink",
|
|
142
|
+
video: "text-label-teal",
|
|
143
|
+
archive: "text-label-yellow",
|
|
144
|
+
};
|
|
75
145
|
function isIconLanguage(key) {
|
|
76
146
|
return Object.hasOwn(ICON_BY_LANGUAGE, key);
|
|
77
147
|
}
|
|
@@ -89,17 +159,21 @@ function languageForPath(path) {
|
|
|
89
159
|
* A file's kind as a Lucide icon, from its path or its language.
|
|
90
160
|
*
|
|
91
161
|
* @family Status
|
|
92
|
-
* @when Beside a file's name: a file an Agent wrote, a code block's language, an attachment.
|
|
162
|
+
* @when Beside a file's name: a file an Agent wrote, a code block's language, an attachment, a row of a folder.
|
|
93
163
|
* @instead An app is `AppMark`; a Library entry is its `IdentityMark`. A file's content is
|
|
94
164
|
* `CodeBlock` or `FileDiff`.
|
|
95
|
-
* @behaviour Maps a path's extension or a language name to one icon: terminal, document,
|
|
96
|
-
* settings, database, diff, palette, regex, globe, package,
|
|
165
|
+
* @behaviour Maps a path's extension or a language name to one icon: terminal, document, PDF, spreadsheet,
|
|
166
|
+
* slides, image, audio, video, archive, braces, settings, database, diff, palette, regex, globe, package,
|
|
167
|
+
* share; anything else is the code icon. The files people keep take their kind's category colour, as a file
|
|
168
|
+
* manager draws them: documents and Markdown blue, PDFs red, spreadsheets green, slides orange, pictures purple, audio pink,
|
|
169
|
+
* video teal, archives yellow; the others stay in the text colour.
|
|
97
170
|
* @words None; the file's name stands beside it.
|
|
98
171
|
* @access Always `aria-hidden`.
|
|
99
172
|
*/
|
|
100
173
|
function FileTypeIcon({ className, language, path, ...props }) {
|
|
101
174
|
const key = normalizeLanguage(path ? languageForPath(path) : language);
|
|
102
175
|
const Icon = isIconLanguage(key) ? ICON_BY_LANGUAGE[key] : CodeIcon;
|
|
103
|
-
|
|
176
|
+
const color = isIconLanguage(key) ? COLOR_BY_LANGUAGE[key] : undefined;
|
|
177
|
+
return (_jsx(Icon, { "aria-hidden": "true", className: cn("size-4 shrink-0", color, className), "data-slot": "file-type-icon", ...props }));
|
|
104
178
|
}
|
|
105
179
|
export { FileTypeIcon };
|
|
@@ -14,7 +14,7 @@ export type FormDialogFormProps = FormProps & {
|
|
|
14
14
|
* @family Compositions
|
|
15
15
|
* @when "Use Modal when a decision must block the rest of the page. For persistent associated context where the underlying page stays readable, use `Sheet` on desktop or `Drawer` on mobile." (https://vercel.com/geist/modal) Ours: a person adds a record through a few fields, or changes one or two values a command asks for: new customer, add a mailbox, add an MCP server.
|
|
16
16
|
* @instead "Skip Modal for routine create flows that have a dedicated page; route to the page instead." (https://vercel.com/geist/modal) "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) Ours: a record already in a list edits in its row with `RowEditForm`; a choice from a catalogue is a `CatalogDrawer`; a setup in steps with a wait is a `FormDrawer` with `job="steps"`; a consequence that asks nothing is confirmed in a `ConfirmDialog`.
|
|
17
|
-
* @behaviour "Allow Escape and outside-click to dismiss non-destructive Modals; gate dismissal on destructive ones with unsaved input." (https://vercel.com/geist/modal) Ours: centred over a scrim without blur, 540 px wide, a bottom sheet on a phone: the title and its help, the fields in a 12 px column, then the footer, which stays at the bottom while a tall form scrolls, with Cancel at the leading edge and the primary at the trailing edge, in one row also on a phone. `FormDialogForm` puts the fields in the dialog's own scroll body and the actions in its fixed footer; no other overlay is nested inside. A refusal or a failed save sits above the footer and the fields keep what was typed. While its save runs it holds open, Cancel and the primary hold, and the waiting line runs under them. With `unsaved.dirty`, Escape and a press outside are held back and `unsaved.onDismissBlocked` runs so the caller can ask; Close and Cancel always close. A form whose primary takes something away, such as declining a company with a note for the record, sets `destructive` on `FormDialogForm`: the primary turns red, as `ConfirmDialog`'s destructive confirm does, and nothing else changes. How long it stays open while work goes on follows
|
|
17
|
+
* @behaviour "Allow Escape and outside-click to dismiss non-destructive Modals; gate dismissal on destructive ones with unsaved input." (https://vercel.com/geist/modal) Ours: centred over a scrim without blur, 540 px wide, a bottom sheet on a phone: the title and its help, the fields in a 12 px column, then the footer, which stays at the bottom while a tall form scrolls, with Cancel at the leading edge and the primary at the trailing edge, in one row also on a phone. `FormDialogForm` puts the fields in the dialog's own scroll body and the actions in its fixed footer; no other overlay is nested inside. A refusal or a failed save sits above the footer and the fields keep what was typed. While its save runs it holds open, Cancel and the primary hold, and the waiting line runs under them. With `unsaved.dirty`, Escape and a press outside are held back and `unsaved.onDismissBlocked` runs so the caller can ask; Close and Cancel always close. A form whose primary takes something away, such as declining a company with a note for the record, sets `destructive` on `FormDialogForm`: the primary turns red, as `ConfirmDialog`'s destructive confirm does, and nothing else changes. How long it stays open while work goes on follows the product-design skill's rule/wait-shows-where-it-lives and living-elements.md "System waits".
|
|
18
18
|
* @words "`Modal.Title` is a Title Case statement, never a question. `Transfer Project` is correct; `Transfer Project?` is wrong." (https://vercel.com/geist/modal) "Primary button is `Verb + Noun` and matches the title verb (`Transfer Project` title pairs with `Transfer Project` button). Never `Confirm`, `OK`, or a bare verb on a destructive primary." (https://vercel.com/geist/modal) "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) Ours: the title and the primary are sentence case, where Geist writes Title Case: the title names the job and its object, "New customer", "Add a mailbox"; the primary repeats it, "Create customer", "Add mailbox"; a destructive primary names what it takes away, "Decline company", never a bare "Decline".
|
|
19
19
|
* @access "Set `aria-labelledby` to the `Modal.Title` id so screen readers announce the title on open." (https://vercel.com/geist/modal) "Trap focus inside the Modal while it’s open and return focus to the trigger after close. Restore body scroll on the same tick the Modal unmounts." (https://vercel.com/geist/modal) "After an error inside the Modal, keep focus inside so the user can retry; after success, return focus to the trigger." (https://vercel.com/geist/modal) Ours: a modal dialog with a Close named by `closeLabel`; focus starts in its first field or `initialFocus` and returns to the opener or `finalFocus`. Escape and Close close it unless the save runs.
|
|
20
20
|
*/
|
|
@@ -12,7 +12,7 @@ import { guardUnsaved } from "../internal/unsaved-guard.js";
|
|
|
12
12
|
* @family Compositions
|
|
13
13
|
* @when "Use Modal when a decision must block the rest of the page. For persistent associated context where the underlying page stays readable, use `Sheet` on desktop or `Drawer` on mobile." (https://vercel.com/geist/modal) Ours: a person adds a record through a few fields, or changes one or two values a command asks for: new customer, add a mailbox, add an MCP server.
|
|
14
14
|
* @instead "Skip Modal for routine create flows that have a dedicated page; route to the page instead." (https://vercel.com/geist/modal) "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) Ours: a record already in a list edits in its row with `RowEditForm`; a choice from a catalogue is a `CatalogDrawer`; a setup in steps with a wait is a `FormDrawer` with `job="steps"`; a consequence that asks nothing is confirmed in a `ConfirmDialog`.
|
|
15
|
-
* @behaviour "Allow Escape and outside-click to dismiss non-destructive Modals; gate dismissal on destructive ones with unsaved input." (https://vercel.com/geist/modal) Ours: centred over a scrim without blur, 540 px wide, a bottom sheet on a phone: the title and its help, the fields in a 12 px column, then the footer, which stays at the bottom while a tall form scrolls, with Cancel at the leading edge and the primary at the trailing edge, in one row also on a phone. `FormDialogForm` puts the fields in the dialog's own scroll body and the actions in its fixed footer; no other overlay is nested inside. A refusal or a failed save sits above the footer and the fields keep what was typed. While its save runs it holds open, Cancel and the primary hold, and the waiting line runs under them. With `unsaved.dirty`, Escape and a press outside are held back and `unsaved.onDismissBlocked` runs so the caller can ask; Close and Cancel always close. A form whose primary takes something away, such as declining a company with a note for the record, sets `destructive` on `FormDialogForm`: the primary turns red, as `ConfirmDialog`'s destructive confirm does, and nothing else changes. How long it stays open while work goes on follows
|
|
15
|
+
* @behaviour "Allow Escape and outside-click to dismiss non-destructive Modals; gate dismissal on destructive ones with unsaved input." (https://vercel.com/geist/modal) Ours: centred over a scrim without blur, 540 px wide, a bottom sheet on a phone: the title and its help, the fields in a 12 px column, then the footer, which stays at the bottom while a tall form scrolls, with Cancel at the leading edge and the primary at the trailing edge, in one row also on a phone. `FormDialogForm` puts the fields in the dialog's own scroll body and the actions in its fixed footer; no other overlay is nested inside. A refusal or a failed save sits above the footer and the fields keep what was typed. While its save runs it holds open, Cancel and the primary hold, and the waiting line runs under them. With `unsaved.dirty`, Escape and a press outside are held back and `unsaved.onDismissBlocked` runs so the caller can ask; Close and Cancel always close. A form whose primary takes something away, such as declining a company with a note for the record, sets `destructive` on `FormDialogForm`: the primary turns red, as `ConfirmDialog`'s destructive confirm does, and nothing else changes. How long it stays open while work goes on follows the product-design skill's rule/wait-shows-where-it-lives and living-elements.md "System waits".
|
|
16
16
|
* @words "`Modal.Title` is a Title Case statement, never a question. `Transfer Project` is correct; `Transfer Project?` is wrong." (https://vercel.com/geist/modal) "Primary button is `Verb + Noun` and matches the title verb (`Transfer Project` title pairs with `Transfer Project` button). Never `Confirm`, `OK`, or a bare verb on a destructive primary." (https://vercel.com/geist/modal) "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) Ours: the title and the primary are sentence case, where Geist writes Title Case: the title names the job and its object, "New customer", "Add a mailbox"; the primary repeats it, "Create customer", "Add mailbox"; a destructive primary names what it takes away, "Decline company", never a bare "Decline".
|
|
17
17
|
* @access "Set `aria-labelledby` to the `Modal.Title` id so screen readers announce the title on open." (https://vercel.com/geist/modal) "Trap focus inside the Modal while it’s open and return focus to the trigger after close. Restore body scroll on the same tick the Modal unmounts." (https://vercel.com/geist/modal) "After an error inside the Modal, keep focus inside so the user can retry; after success, return focus to the trigger." (https://vercel.com/geist/modal) Ours: a modal dialog with a Close named by `closeLabel`; focus starts in its first field or `initialFocus` and returns to the opener or `finalFocus`. Escape and Close close it unless the save runs.
|
|
18
18
|
*/
|
|
@@ -40,7 +40,7 @@ export type FormDrawerProps = FormSurfaceProps & {
|
|
|
40
40
|
* @family Compositions
|
|
41
41
|
* @when Ours: choosing from a catalogue too long for a dialog (through `CatalogDrawer`), or setting something up in several steps with a wait: connect a messaging channel, Telegram's code.
|
|
42
42
|
* @instead "Don’t use Sheet to confirm destructive actions. The default `modal=false` keeps the page interactive, which weakens severity for a delete or revoke." (https://vercel.com/geist/sheet) Ours: a new record from a few fields is a `FormDialog`; a record already in a list edits in its row with `RowEditForm`; a fact on the record's own page changes in place in its section; a consequence is confirmed in a `ConfirmDialog`; a phone's short job is a `Drawer`.
|
|
43
|
-
* @behaviour "Sheet defaults to `modal=false` so toasts and other high-z elements stay reachable. Keep that default unless the sheet owns the screen." (https://vercel.com/geist/sheet) "Pick `side` from the trigger location: a row inspector slides from `right`, a global filter from `left`. Don’t change sides mid-session." (https://vercel.com/geist/sheet) "Outside-click does not auto-close, so always render an explicit close affordance and honor Escape." (https://vercel.com/geist/sheet) Ours: a modal `Sheet` from the right edge over the scrim, because the drawer owns the screen, at the Sheet's one width that no caller sets. The header holds the step ("Step 2 of 3", in mono) over the title, which stays the job's name, then the description and Close; the body scrolls between the header and a footer that stays, with no fill or rule of its own, Cancel then the primary at its trailing edge. A press outside does not close it; Escape does, unless `unsaved.dirty` holds it back. Cancel holds while a save runs. How long it stays open while work goes on follows
|
|
43
|
+
* @behaviour "Sheet defaults to `modal=false` so toasts and other high-z elements stay reachable. Keep that default unless the sheet owns the screen." (https://vercel.com/geist/sheet) "Pick `side` from the trigger location: a row inspector slides from `right`, a global filter from `left`. Don’t change sides mid-session." (https://vercel.com/geist/sheet) "Outside-click does not auto-close, so always render an explicit close affordance and honor Escape." (https://vercel.com/geist/sheet) Ours: a modal `Sheet` from the right edge over the scrim, because the drawer owns the screen, at the Sheet's one width that no caller sets. The header holds the step ("Step 2 of 3", in mono) over the title, which stays the job's name, then the description and Close; the body scrolls between the header and a footer that stays, with no fill or rule of its own, Cancel then the primary at its trailing edge. A press outside does not close it; Escape does, unless `unsaved.dirty` holds it back. Cancel holds while a save runs. How long it stays open while work goes on follows the product-design skill's rule/wait-shows-where-it-lives and living-elements.md "System waits".
|
|
44
44
|
* @words "Title is Title Case and names the entity (`Deployment Details`, `Member Profile`), not the page action." (https://vercel.com/geist/sheet) "Body is read-mostly: sentence case prose with Title Case sub-headings. Action buttons are optional; when present, follow `Verb + Noun`." (https://vercel.com/geist/sheet) Ours: the title is sentence case and names the job and its object: "Connect Telegram", "Add a skill". The step reads "Step N of M". The primary says what it does: "Connect", "Continue", never "OK".
|
|
45
45
|
* @access "Trap focus inside the sheet while it’s open and return focus to the trigger row on close so keyboard users keep their place in the list." (https://vercel.com/geist/sheet) "Provide a visible close button labeled `Close` (or an icon button with `aria-label="Close"`) since clicking outside doesn’t dismiss." (https://vercel.com/geist/sheet) "Announce the sheet with `aria-labelledby` pointing at the title; pair it with `aria-describedby` only when the body is short and load-bearing." (https://vercel.com/geist/sheet) Ours: a modal dialog named by its title; focus returns to the opener on close, or to `finalFocus` when the opener is gone. The step is read before the title.
|
|
46
46
|
*/
|
|
@@ -13,7 +13,7 @@ import { cn } from "../lib/utils.js";
|
|
|
13
13
|
* @family Compositions
|
|
14
14
|
* @when Ours: choosing from a catalogue too long for a dialog (through `CatalogDrawer`), or setting something up in several steps with a wait: connect a messaging channel, Telegram's code.
|
|
15
15
|
* @instead "Don’t use Sheet to confirm destructive actions. The default `modal=false` keeps the page interactive, which weakens severity for a delete or revoke." (https://vercel.com/geist/sheet) Ours: a new record from a few fields is a `FormDialog`; a record already in a list edits in its row with `RowEditForm`; a fact on the record's own page changes in place in its section; a consequence is confirmed in a `ConfirmDialog`; a phone's short job is a `Drawer`.
|
|
16
|
-
* @behaviour "Sheet defaults to `modal=false` so toasts and other high-z elements stay reachable. Keep that default unless the sheet owns the screen." (https://vercel.com/geist/sheet) "Pick `side` from the trigger location: a row inspector slides from `right`, a global filter from `left`. Don’t change sides mid-session." (https://vercel.com/geist/sheet) "Outside-click does not auto-close, so always render an explicit close affordance and honor Escape." (https://vercel.com/geist/sheet) Ours: a modal `Sheet` from the right edge over the scrim, because the drawer owns the screen, at the Sheet's one width that no caller sets. The header holds the step ("Step 2 of 3", in mono) over the title, which stays the job's name, then the description and Close; the body scrolls between the header and a footer that stays, with no fill or rule of its own, Cancel then the primary at its trailing edge. A press outside does not close it; Escape does, unless `unsaved.dirty` holds it back. Cancel holds while a save runs. How long it stays open while work goes on follows
|
|
16
|
+
* @behaviour "Sheet defaults to `modal=false` so toasts and other high-z elements stay reachable. Keep that default unless the sheet owns the screen." (https://vercel.com/geist/sheet) "Pick `side` from the trigger location: a row inspector slides from `right`, a global filter from `left`. Don’t change sides mid-session." (https://vercel.com/geist/sheet) "Outside-click does not auto-close, so always render an explicit close affordance and honor Escape." (https://vercel.com/geist/sheet) Ours: a modal `Sheet` from the right edge over the scrim, because the drawer owns the screen, at the Sheet's one width that no caller sets. The header holds the step ("Step 2 of 3", in mono) over the title, which stays the job's name, then the description and Close; the body scrolls between the header and a footer that stays, with no fill or rule of its own, Cancel then the primary at its trailing edge. A press outside does not close it; Escape does, unless `unsaved.dirty` holds it back. Cancel holds while a save runs. How long it stays open while work goes on follows the product-design skill's rule/wait-shows-where-it-lives and living-elements.md "System waits".
|
|
17
17
|
* @words "Title is Title Case and names the entity (`Deployment Details`, `Member Profile`), not the page action." (https://vercel.com/geist/sheet) "Body is read-mostly: sentence case prose with Title Case sub-headings. Action buttons are optional; when present, follow `Verb + Noun`." (https://vercel.com/geist/sheet) Ours: the title is sentence case and names the job and its object: "Connect Telegram", "Add a skill". The step reads "Step N of M". The primary says what it does: "Connect", "Continue", never "OK".
|
|
18
18
|
* @access "Trap focus inside the sheet while it’s open and return focus to the trigger row on close so keyboard users keep their place in the list." (https://vercel.com/geist/sheet) "Provide a visible close button labeled `Close` (or an icon button with `aria-label="Close"`) since clicking outside doesn’t dismiss." (https://vercel.com/geist/sheet) "Announce the sheet with `aria-labelledby` pointing at the title; pair it with `aria-describedby` only when the body is short and load-bearing." (https://vercel.com/geist/sheet) Ours: a modal dialog named by its title; focus returns to the opener on close, or to `finalFocus` when the opener is gone. The step is read before the title.
|
|
19
19
|
*/
|
|
@@ -8,7 +8,8 @@ import type { PresentContent } from "../internal/present-content.js";
|
|
|
8
8
|
* @when "Use Context Card to reveal entity metadata on hover or focus: a user, a deployment, a
|
|
9
9
|
* project, an API key." "The trigger is usually a name link or avatar in dense data."
|
|
10
10
|
* (https://vercel.com/geist/context-card)
|
|
11
|
-
* Ours: `Context Card` is `HoverCard
|
|
11
|
+
* Ours: `Context Card` is `HoverCard`, inside `@nadicodeai/ui` only, which does not export it:
|
|
12
|
+
* `RecordTime` draws it. The exact moment behind a relative time is also a card. An
|
|
12
13
|
* entity's card is a `HoverCardSummary`.
|
|
13
14
|
* @instead "For a one-line "why" without metadata rows, use `Tooltip`." "For long-form content, edit
|
|
14
15
|
* forms, or persistent navigation, route to a `Drawer` or a detail page." "Don’t use Context Card to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../src/components/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGlF,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMjE
|
|
1
|
+
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../src/components/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGlF,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,iBAAS,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,+BAEpF;AAED,iBAAS,gBAAgB,CAAC,EACxB,KAAwB,EACxB,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,+BAEpC;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,IAAY,EACZ,UAAe,EACf,KAAgB,EAChB,WAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,GACjC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,MAAM,GAAG,YAAY,CAAC,GAAG;IAC7F,kEAAkE;IAClE,QAAQ,EAAE,cAAc,CAAC;CAC1B,+BAyBF;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,KAAK,cAAc,GACf,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,GACvC,SAAS,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,GACtD,SAAS,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAClF,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,KAAK,EAAE,cAAc,CAAC;IACtB,4FAA4F;IAC5F,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC;CAC9E,CAAC;AAEF;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,EACxB,IAAI,EACJ,MAAM,EACN,KAAK,EACL,YAAY,EACZ,MAAM,EACN,SAAS,EACT,GAAG,KAAK,EACT,EAAE,qBAAqB,+BA8BvB;AAED,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -14,7 +14,8 @@ const HOVER_CARD_DELAY = 150;
|
|
|
14
14
|
* @when "Use Context Card to reveal entity metadata on hover or focus: a user, a deployment, a
|
|
15
15
|
* project, an API key." "The trigger is usually a name link or avatar in dense data."
|
|
16
16
|
* (https://vercel.com/geist/context-card)
|
|
17
|
-
* Ours: `Context Card` is `HoverCard
|
|
17
|
+
* Ours: `Context Card` is `HoverCard`, inside `@nadicodeai/ui` only, which does not export it:
|
|
18
|
+
* `RecordTime` draws it. The exact moment behind a relative time is also a card. An
|
|
18
19
|
* entity's card is a `HoverCardSummary`.
|
|
19
20
|
* @instead "For a one-line "why" without metadata rows, use `Tooltip`." "For long-form content, edit
|
|
20
21
|
* forms, or persistent navigation, route to a `Drawer` or a detail page." "Don’t use Context Card to
|
|
@@ -57,7 +57,7 @@ export type IdentityMarkProps = {
|
|
|
57
57
|
*
|
|
58
58
|
* @family Status
|
|
59
59
|
* @when The first thing in a record's row (32), at the head of its object page (64), in a feed or a sidebar identity line (24), on a Library entry (40), for the company at the top of Nadia's list (28): wherever it tells a person which thing they are looking at.
|
|
60
|
-
* @instead An icon beside a card's title, a KPI's label or a section heading only repeats the words and is left out. A picture for a first use or a whole-page moment is the empty state's or the page's own. A model is its `ModelIdentity`; a maker's mark beside a model's name in a list of models is `ModelMark` at 24.
|
|
60
|
+
* @instead An icon beside a card's title, a KPI's label or a section heading only repeats the words and is left out. A row's, an object's, a feed's or a sidebar's mark is one of this component's kinds, never a decorative icon: a list gets its richness from real identity marks, never from decoration. A picture for a first use or a whole-page moment is the empty state's or the page's own. A model is its `ModelIdentity`; a maker's mark beside a model's name in a list of models is `ModelMark` at 24.
|
|
61
61
|
* @behaviour Static, except an Agent's orb, which moves with her state. An Agent is always her real orb from the orb engine, at the largest orb size not above the mark's, with no tile and no ring, never an avatar or a painted circle, and `frame` lets the product wrap that orb, such as in the transition that carries her to her page; an app keeps its own logo in its bordered tile on the page ground, or its first letter when it has no logo; a record that belongs to a model maker, such as a key held at that maker, is the maker's `ModelMark` at the mark's size, with its initials when LobeHub has no mark for it; a company is its own logo, contained whole in its original colours and proportions on a dark ringed tile, as Vercel shows a project's favicon, and until a logo is found, or when the stored logo does not load, its initials in white on that same tile, so a found logo only replaces the letters; a company's mark is the same whatever its standing and whichever directory opened it, and a Partner is said in words where its standing matters, never by a colour; a person is their picture, then their initials, in a round mark; a record with no picture of its own takes its kind's own icon, the same icon its section has in the navigation (Mail for a mailbox, a server for an MCP server, a key for a password), in a ringed tile on the card ground; a skill takes the icon its hub card names, and the Skills icon when it names none, on that same neutral ringed tile, so the icon alone tells one skill from another and no colour stands for the kind; a plugin likewise takes the icon its hub card names, and the Plugins icon when it names none, on the same neutral ringed tile, since the colour of a Library row is its category label's alone; a record's own object picture, such as a Library skill's or plugin's, is drawn only at 64, at the head of its own page, on its kind's ground in the icon's place, because at a row's size its detail does not read. A record tile takes `{rounded.sm}` (6 px) corners, `{rounded.md}` (8 px) at 40 and 64; a company's tile and an app's tile take `{rounded.md}` at every size.
|
|
62
62
|
* @words None of its own: the record's name stands beside it. Initials stand for a company or a person: the first letters of the name's first two words. An app with no logo takes the first letter of its name as a monogram, a model maker with no mark the initials of its slug, and no other kind takes letters.
|
|
63
63
|
* @access Decorative beside the record's name. Alone, as in a narrow rail, `label` names it.
|