Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/console-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ exports the raw tokens and `@shepherdjerred/console-ui/testing` the scan.
Promoted from Tracker, generic: no data types, router or tRPC. Every popup
shares the menu look and is inert while it fades out (`leavingPopup`).

| Export | Renders |
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Menu`, `MenuItem`, `MenuLinkItem`, `MenuCheckboxItem`, `MenuRadioGroup`, `MenuRadioItem`, `MenuGroup`, `MenuSeparator`, `Submenu` | A `trigger` button opening a Base UI menu. Items take `icon`, `description`, `shortcut` (a keys string shown as a hint and as `aria-keyshortcuts`), `danger`, `disabled`, `keepOpen`; checkbox items stay open; `Submenu` opens on hover, ArrowRight or Enter. |
| `ContextMenu` | The same items on a target (`children`, or `render` for e.g. a `<tr>`): right-click, long press, Shift+F10 or the Menu key, opened where the focused element is. `isContextMenuKey` tells those keys apart. |
| `Popover`, `PopoverClose` | An anchored panel (`title` or `label`, `size` `sm`/`md`/`lg`, `side`, `align`) with no arrow; Escape or a click outside closes it and focus returns to the trigger. |
| `Select` | The 28px picker for a short list: `{ value, label, icon?, description?, disabled? }` options, or `{ label, options }` groups. A Base UI select in every browser (the native customizable `<select>` is Limited Availability and not used). |
| `Combobox` | A searchable picker over the same options. Single: a 28px trigger and a list with its own search line. `multiple`: removable chips inside the control. `loadOptions(query, signal)` (debounced, aborted, "Searching…"), `onCreate` for a "Create “…”" row, groups and check marks. |
| `ToastProvider`, `toast` | One region per app. `toast.notify(title, { action?, description? })`, `toast.error(title)` (assertive, 10s), `toast.undo(title, { undo, expire? })` (6s), `toast.dismiss(id)`, `toast.undoLatest()` for ⌘Z. Glyph, word and text; at most four (`limit`); F6 focuses them. |
| `Sheet`, `SheetClose` | A modal panel on an edge (`side` `right`/`left`/`bottom`, `size` `md`/`lg`): title row, scrolling body, optional `actions`. Put navigation rows in `ul.ui-sheet-links` for a phone's "More". |
| `Avatar`, `ActorChip`, `initials` | A 16/20/24px rounded-square picture with initials until it loads; `decorative` hides it beside the name. `ActorChip` is a tag chip with a 16px avatar, the name and a muted `kind`. |
| `createShortcutRegistry`, `ShortcutSheet`, `KeyHint`, `formatShortcut`, `parseShortcut`, `ariaKeyshortcuts` | One list of shortcuts (`"c"`, `"g i"`, `"Mod+K"`) for the key handler and the help sheet; `scope`s, `anywhere`, editable targets and open dialogs ignored. Register `?` to open `ShortcutSheet`. `KeyHint` draws keycaps. |
| `CommandPaletteCommands`, `createRecentCommands`, `matchesCommand` | A ready `CommandPalette` body: filtered static `sections`, `loadSections(query, signal)` server results, nested `step`s with a breadcrumb (Backspace and Escape go back), `run(context)` after close, `stay`, and recent commands. |
| Export | Renders |
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Menu`, `MenuItem`, `MenuLinkItem`, `MenuCheckboxItem`, `MenuRadioGroup`, `MenuRadioItem`, `MenuGroup`, `MenuSeparator`, `Submenu` | A `trigger` button opening a Base UI menu. Items take `icon`, `description`, `shortcut` (a keys string shown as a hint and as `aria-keyshortcuts`), `danger`, `disabled`, `keepOpen`; checkbox items stay open; `Submenu` opens on hover, ArrowRight or Enter. |
| `ContextMenu` | The same items on a target (`children`, or `render` for e.g. a `<tr>`): right-click, long press, Shift+F10 or the Menu key, opened where the focused element is. `isContextMenuKey` tells those keys apart. |
| `Popover`, `PopoverClose` | An anchored panel (`title` or `label`, `size` `sm`/`md`/`lg`, `side`, `align`) with no arrow; Escape or a click outside closes it and focus returns to the trigger. |
| `Select` | The 28px picker for a short list: `{ value, label, icon?, description?, disabled? }` options, or `{ label, options }` groups. A Base UI select in every browser (the native customizable `<select>` is Limited Availability and not used). `aria-describedby` and `invalid` (aria-invalid and the error border) pass through, and `onOpenChangeComplete` fires after the list has closed, the moment to move focus on. |
| `Combobox` | A searchable picker over the same options. Single: a 28px trigger and a list with its own search line. `multiple`: removable chips inside the control. `loadOptions(query, signal)` (debounced, aborted, "Searching…"), `onCreate` for a "Create “…”" row, groups and check marks. |
| `ToastProvider`, `toast` | One region per app. `toast.notify(title, { action?, description? })`, `toast.error(title)` (assertive, 10s), `toast.undo(title, { undo, expire? })` (6s), `toast.dismiss(id)`, `toast.undoLatest()` for ⌘Z. Glyph, word and text; at most four (`limit`); F6 focuses them. |
| `Sheet`, `SheetClose` | A modal panel on an edge (`side` `right`/`left`/`bottom`, `size` `md`/`lg`): title row, scrolling body, optional `actions`. Put navigation rows in `ul.ui-sheet-links` for a phone's "More". |
| `Avatar`, `ActorChip`, `initials` | A 16/20/24px rounded-square picture with initials until it loads; `decorative` hides it beside the name. `ActorChip` is a tag chip with a 16px avatar, the name and a muted `kind`. |
| `createShortcutRegistry`, `ShortcutSheet`, `KeyHint`, `formatShortcut`, `parseShortcut`, `ariaKeyshortcuts` | One list of shortcuts (`"c"`, `"g i"`, `"Mod+K"`) for the key handler and the help sheet; `scope`s, `anywhere`, editable targets and open dialogs ignored. Register `?` to open `ShortcutSheet`. `KeyHint` draws keycaps. |
| `CommandPaletteCommands`, `createRecentCommands`, `matchesCommand` | A ready `CommandPalette` body: filtered static `sections`, `loadSections(query, signal)` server results, nested `step`s with a breadcrumb (Backspace and Escape go back), `run(context)` after close, `stay`, and recent commands. |

Register shortcuts while a page is mounted from a ref callback that returns
its cleanup, so no effect is needed:
Expand Down
25 changes: 25 additions & 0 deletions packages/console-ui/src/components/pickers/pickers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,31 @@ describe("Select", () => {
expect(html).not.toContain("Finished and verified");
});

test("passes aria-describedby and invalid through to the trigger", () => {
const html = renderToStaticMarkup(
<Select
label="Status"
value="done"
aria-describedby="status-help"
invalid
onValueChange={noop}
options={STATUSES}
/>,
);
expect(html).toContain('aria-describedby="status-help"');
expect(html).toContain('aria-invalid="true"');
const plain = renderToStaticMarkup(
<Select
label="Status"
value="done"
onValueChange={noop}
options={STATUSES}
/>,
);
expect(plain).not.toContain("aria-invalid");
expect(plain).not.toContain("aria-describedby");
});

test("an unknown value shows the placeholder", () => {
const html = renderToStaticMarkup(
<Select
Expand Down
16 changes: 16 additions & 0 deletions packages/console-ui/src/components/pickers/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ export type SelectProps = {
readonly disabled?: boolean;
/** Shown while `value` matches no option. */
readonly placeholder?: string;
/** Id of the element describing the picker (a hint, a notice, problems). */
readonly "aria-describedby"?: string | undefined;
/** Marks the picker invalid: `aria-invalid` and the error border. */
readonly invalid?: boolean;
/**
* Called once the list has finished opening or closing (after its exit
* animation). Move focus on from here after a choice: Base UI returns
* focus to the trigger as the list closes.
*/
readonly onOpenChangeComplete?: (open: boolean) => void;
};

/**
Expand All @@ -36,6 +46,9 @@ export function Select({
name,
disabled = false,
placeholder = "Choose…",
"aria-describedby": describedBy,
invalid = false,
onOpenChangeComplete,
}: SelectProps): React.JSX.Element {
const selected = flattenOptions(options).find(
(option) => option.value === value,
Expand All @@ -45,6 +58,7 @@ export function Select({
value={value}
disabled={disabled}
modal={false}
{...(onOpenChangeComplete === undefined ? {} : { onOpenChangeComplete })}
{...(name === undefined ? {} : { name })}
onValueChange={(next) => {
if (typeof next === "string") onValueChange(next);
Expand All @@ -53,6 +67,8 @@ export function Select({
<SelectPrimitive.Trigger
className="ui-picker"
aria-label={label}
aria-describedby={describedBy}
aria-invalid={invalid ? true : undefined}
{...(id === undefined ? {} : { id })}
>
<span className="ui-picker-value">
Expand Down
3 changes: 3 additions & 0 deletions packages/console-ui/src/styles/components/picker.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
.ui-picker:hover:not(:disabled, [data-disabled]) {
background: var(--ui-hover);
}
.ui-picker[aria-invalid="true"] {
border-color: var(--ui-sev-error);
}
.ui-picker:is(:disabled, [data-disabled]) {
color: var(--ui-faint);
cursor: not-allowed;
Expand Down
37 changes: 20 additions & 17 deletions packages/flags/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,19 @@ grouped with Beta and Prod rows. Below 900px the sidebar is replaced by the
shared top bar: the app switcher, a search button and a menu whose drawer lists
the same views and deployments.

Every page is built from the console-ui page kit, the way Hub's and Go link's
pages are: a `PageBody` with a `PageHeading`, then `SummaryGrid` and `Card`s. A
deployment's heading names the catalog and stage, says when a consumer last
fetched it (see [Where a flag is read](#where-a-flag-is-read)), and shows its
revision, a drift badge linking to its section of the drift page, and "Compare with Beta/Prod"
when the catalog has both stages. The flag table lists each flag's key with its
inventory description as a muted, truncated second line, its state (an On, Off
or Targeted `SeverityBadge`, or the variant string) and its type. The search
field filters flags by key or description and keeps the filter in the `?q=`
query, so it survives choosing a flag. Choosing a flag opens its editor beside
the table.
Every page is the console-ui page: a `HeaderBar`, a `FigureStrip`, then
`Section`s with `.ui-table` lists, in the shell's inset panel. A deployment's
header names the catalog and stage, shows its revision and when a consumer last
fetched it (a `RelativeTime`; see [Where a flag is read](#where-a-flag-is-read)),
a drift status linking to its section of the drift page, and "Compare with
Beta/Prod" when the catalog has both stages. The figure strip counts its flags
by state. The flag table lists each flag's key with its inventory description
as a muted, truncated second line, its state (an On, Off or Targeted
`StatusGlyph`, or the variant string) and its type. The search field filters
flags by key or description and keeps the filter in the `?q=` query, so it
survives choosing a flag. Choosing a flag opens its editor beside the table,
with its kind, revision and inventory facts in a `DescriptionList`, and its
review dialog is the shared `Dialog`.

Navigation is client-side (`react-router`): the sidebar, the drawer, flag rows
and the "All flags" link change the URL without reloading the page, and choosing another flag in the same deployment reuses the loaded
Expand All @@ -256,8 +258,8 @@ the open flag and deployment, e.g. `dares_enabled · scout/prod · Flags`.

The views:

- **Overview** (`/`): totals and one card per catalog with each stage's flag
count, revision, drift and when a consumer last fetched it.
- **Overview** (`/`): totals and one table, grouped by catalog, with each
stage's flag count, revision, drift and when a consumer last fetched it.
- **Compare** (`/compare?left=<catalog/stage>&right=<catalog/stage>`): two
deployments' documents, every key classified as differs, only-left,
only-right or identical (`sameFlag`). The Show toggle adds identical rows
Expand All @@ -271,7 +273,7 @@ The views:
documented remediation command. `/drift#<catalog/stage>` scrolls to one
deployment. A deployment missing from the report fails the request, so the
page shows the error rather than a partial result.
- **Archived** (`/archive`): `GET /v1/archive` as one card per deployment
- **Archived** (`/archive`): `GET /v1/archive` as one section per deployment
listing each retired key with when and by whom it was retired, its revision
and its final value (a variant's value, or the boolean flag as JSON). A key
with basis `declared-retired` was deleted before the audit trail and reads
Expand All @@ -294,9 +296,10 @@ The editor has a Form / JSON toggle over one draft. Switching modes never loses
an edit: the JSON text is rebuilt from the draft only when the form changed it,
so text that does not parse yet is still there when you switch back.

- **Form** shows typed controls: a boolean flag's default and segments; a
variant's stored string in a number field (`number` encoding), a wrapping
text area (`json` encoding), or a text field (`string` encoding).
- **Form** shows typed controls on the shared `Field`, `Switch`, `Select` and
`Textarea`: a boolean flag's default and segments; a variant's stored string
in a number field (`number` encoding), a wrapping text area (`json`
encoding), or a text field (`string` encoding).
- **JSON** edits in Monaco. A boolean flag is edited as its whole object, with
`type` and `key` fixed by the schema. A `json`-encoded variant is edited as
its decoded value, pretty-printed (an array, not a one-line string), and
Expand Down
52 changes: 0 additions & 52 deletions packages/flags/eslint-suppressions.json

This file was deleted.

Loading