viewkitjs 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +30 -6
  2. package/package.json +4 -2
  3. package/views/dist/controls/avatar/avatar.d.ts +10 -4
  4. package/views/dist/controls/avatar/avatar.js +5 -3
  5. package/views/dist/controls/avatar/tokens.d.ts +60 -0
  6. package/views/dist/controls/avatar/tokens.js +15 -0
  7. package/views/dist/controls/avatar.css +29 -15
  8. package/views/dist/controls/button/map-button.d.ts +5 -3
  9. package/views/dist/controls/button/map-button.js +14 -7
  10. package/views/dist/controls/index.d.ts +3 -2
  11. package/views/dist/controls/index.js +2 -1
  12. package/views/dist/controls/input/input.d.ts +12 -1
  13. package/views/dist/controls/input/input.js +7 -6
  14. package/views/dist/controls/input/save-mark.d.ts +8 -0
  15. package/views/dist/controls/input/save-mark.js +26 -0
  16. package/views/dist/controls/input/tokens.d.ts +16 -0
  17. package/views/dist/controls/input/tokens.js +4 -0
  18. package/views/dist/controls/input.css +18 -0
  19. package/views/dist/controls/radio/radio.d.ts +7 -0
  20. package/views/dist/controls/radio/radio.js +8 -4
  21. package/views/dist/controls/radio/tokens.d.ts +40 -0
  22. package/views/dist/controls/radio/tokens.js +10 -0
  23. package/views/dist/controls/radio.css +52 -3
  24. package/views/dist/controls/select/select.d.ts +8 -2
  25. package/views/dist/controls/select/select.js +6 -4
  26. package/views/dist/controls/setting-row/looks.d.ts +10 -0
  27. package/views/dist/controls/setting-row/looks.js +17 -0
  28. package/views/dist/controls/setting-row/setting-row.d.ts +65 -0
  29. package/views/dist/controls/setting-row/setting-row.js +66 -0
  30. package/views/dist/controls/setting-row/tokens.d.ts +84 -0
  31. package/views/dist/controls/setting-row/tokens.js +23 -0
  32. package/views/dist/controls/setting-row.css +94 -0
  33. package/views/dist/controls/switch-row/switch-row.d.ts +1 -15
  34. package/views/dist/controls/switch-row/switch-row.js +1 -9
  35. package/views/dist/controls/tokens.js +2 -0
  36. package/views/dist/looks/index.d.ts +1 -0
  37. package/views/dist/looks/index.js +1 -0
  38. package/views/dist/looks/pieces.js +2 -0
  39. package/views/dist/panels/react/views-row/FoldingViewRow.js +3 -4
  40. package/views/dist/styles.css +182 -19
  41. package/views/dist/styles.unlayered.css +182 -19
  42. package/views/docs/controls/avatar.md +15 -0
  43. package/views/docs/controls/input.md +8 -0
  44. package/views/docs/controls/radio.md +18 -0
  45. package/views/docs/controls/select.md +4 -0
  46. package/views/docs/controls/setting-row.md +26 -0
  47. package/views/docs/reference/controls.md +27 -10
  48. package/views/docs/reference/looks.md +3 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.31.0] — 2026-12-02
9
+
10
+ ### Added
11
+
12
+ - `viewkitjs/views/controls`: the `Avatar` takes `colour`, one of the label hues (`AvatarColour`: blue, green, amber, red, purple, pink, teal or grey, the Option's list). A thing's, an agent's or the workspace's square stands on the hue's fill, its letters or icon in the hue's strong ink, with no edge; a person keeps their tone. Its stylesheet reads the label hues' `--vk-label-<hue>-fill` and `--vk-label-<hue>-strong`.
13
+ - `viewkitjs/views/controls`: the `Avatar` draws at 56 (`AvatarSize`), between 40 and 64, its letters at `--vk-font-size-xl` and a square's corners on 64's steps. An `AvatarStack` takes neither 16 nor 56.
14
+ - The setting row, on `viewkitjs/views/controls`: `SettingRow` draws one setting as a row, its name and a line under it, at its end a switch (`switch`), a select (`select`), a button (`action`) or › to its page (`onOpen`, with its `value`), a `mark` or an `icon` at its start; `locked` (the reason) shuts its control; `alone` stands a lone row bare. `SettingRows` holds them in a card, a line between each, `danger` the danger zone's red edge with each button the Button's danger kind. On a phone the card and its rows are Field rows'. Its stylesheet is `viewkitjs/views/controls/setting-row.css`, in the ready stylesheet; its names are on `docs/controls/setting-row.md`.
15
+ - Its options and looks, `SETTING_ROW_LOOKS` on `viewkitjs/views/looks`: the card (`outlined` or `raised`) and the rows (`snug` or `roomy`), each a computer's, set on the frame as `data-setting-row-card` and `data-setting-row-rows`; two looks, `outright` (nothing picked) and `attio` (`raised`, `roomy`). With them `settingRowWornOf` and `SETTING_ROW_ATTRS`.
16
+ - `SwitchRow` and `SwitchRows` are now the setting row's switch kind, with the props and the classes they had: an app that draws them changes nothing. They draw as before with `switch-row.css`, which stays; an app that imports the controls one by one may import `setting-row.css` in its place to draw the other kinds too (the Showcase does). The portal, Atlas and outright-base draw no SwitchRow and change nothing.
17
+ - `viewkitjs/views/controls`: the Radio's `swatch`, one of the label colours (`blue`, `green`, `amber`, `red`, `purple`, `pink`, `teal`, `grey`) drawn as a 24px dot in place of its ring, for picking a colour. Give it an `aria-label`, the colour's name. Chosen, it is ringed in the selected colour just outside a thin ring of the ground; hovered, the same ring in the field's hovered edge; focused, the focus outline outside that ring; disabled, grey and dashed, passed by the arrows. A `row` group stands them 10 apart. It reads `--vk-label-<hue>-fill` and `--vk-neutral`.
18
+ - `viewkitjs/views/controls`: a marked card's `picture` on the Radio: what your app draws (Light, Dark or System as a little app) fills the card's width, 120 tall, over its mark and its name, which stand side by side under it. A picture makes the card marked with a mark or without. Chosen, its words take the text colour. A `row` group stands pictured cards one beside another at equal widths, on a phone too. New names the Radio reads: `--vk-fg`, `--vk-font-weight-medium`, `--vk-radius-sm`, and the seven `--vk-label-<hue>-fill`.
19
+ - `viewkitjs/views/controls`: `saving` and `saved` on the `Input`, the `InputGroup` and every `Select` field, for a field that saves on its own. Saving, the Spinner stands at the field's end (before a Select's chevron) and the field is busy (`aria-busy`), still typed into; saved, a check and the word "Saved" stand there in the success colour, announced, fade after `--vk-saved-hold` and leave the field. It shows again each time `saved` turns on; saving wins when both are on. `data-force="saved"` holds Saved on a page that shows it. A save that fails is still the Field's `error`, your app putting the value before back.
20
+ - The new name `--vk-saved-hold` (motion; 2000ms at the Outright look), and the Input now reads `--vk-success`, `--vk-duration-base` and `--vk-ease-in`. The Spinner's label is "Saving".
21
+
22
+ ## [0.30.1] — 2026-12-01
23
+
24
+ ### Fixed
25
+
26
+ - At ViewKit's defaults (`CONTROLS.Button`, no `Button` of your own), the views picker's chip stands on one line again: the view's glyph small, beside its name, the chevron after it, where 0.30.0 drew the glyph large and stacked over the name. The views row's "+N" chip stands its count and chevron on one line the same way. `CONTROLS.Button` now counts your `AppIcon` as a glyph, as it counts an svg or one of your icons, and stands a glyph handed after the words as its end icon, as it stands one handed before them as its icon. `leadingGlyph` returns that end glyph as `iconEnd`. This is a default every app that takes `CONTROLS.Button` sees; an app that hands its own `Button` (the portal, the Showcase's own pages, outright-base, Atlas) sees nothing change.
27
+
8
28
  ## [0.30.0] — 2026-12-01
9
29
 
10
30
  ### Added
@@ -385,10 +405,9 @@ Create your search indexes again. The folded text `searchIndexes` prints changed
385
405
 
386
406
  ## [0.25.0] — 2026-11-26
387
407
 
388
- viewkitjs/views/controls: the Menu (the components map's default `Menu`, with `menuEntries`), its context menu and its ⋯, the Avatar and its stack, the Select, and the Picker's core (`usePicker`, `Picker`, `PickerUnder` and its rows), with the popup line's stylesheet, the phone's line (`usePhone`, `PhoneHost`, `ComputerHost`) and a list's own scrolling; their looks (`LIST_LOOKS`, `PICKER_LOOKS`, `AVATAR_LOOKS`) in viewkitjs/views/looks.
389
-
390
408
  ### Added
391
409
 
410
+ - `viewkitjs/views/controls`: the Menu (the components map's default `Menu`, with `menuEntries`), its context menu and its ⋯, the Avatar and its stack, the Select, and the Picker's core (`usePicker`, `Picker`, `PickerUnder` and its rows), with the popup line's stylesheet, the phone's line (`usePhone`, `PhoneHost`, `ComputerHost`) and a list's own scrolling; their looks (`LIST_LOOKS`, `PICKER_LOOKS`, `AVATAR_LOOKS`) in `viewkitjs/views/looks`.
392
411
  - `viewkitjs/fields/definitions`: every setting `creatableFieldTypes(cv)` lists carries a `label` in the host's words, and a word or words setting carries `wordLabels`, a name for each of its words, so a New field dialog names every setting and choice without a copy of its own.
393
412
  - Two message keys, so a host renames them in its own language; an exhaustive resolver words them:
394
413
  - `setting.label` (values `type`, `path`): Default value, Fewest characters, Most characters (a name's and a place's: Most characters in each part), Pattern it must match, Written over several lines, Stored as, Lowest value, Highest value, Whole numbers only, Most decimals, Shown as, Decimals shown, Unit after the number, Show + and −, A rise reads as, Stored in, Duration style, Currency, A range of, Per, A date to look forward to, Date style, Show the time, Options, Values allowed, Most values (a multi-select's: Most choices), Tidy each value, Links to, How many, Holds several values, Parts of the place.
@@ -398,6 +417,9 @@ viewkitjs/views/controls: the Menu (the components map's default `Menu`, with `m
398
417
 
399
418
  - `viewkitjs/fields`: a text field's `validation.pattern` is read in ViewKit's own pattern dialect and matched without backtracking: each character of a value costs at most one pass over the pattern's steps, and one value may cost at most 20,000,000 steps in all (its characters times the pattern's steps, about a fifth of a second). The dialect is JavaScript's regular-expression syntax with no flags and answers as `RegExp` does, without lookahead, lookbehind, backreferences or group flags (`(?i:…)`), and without the legacy forms whose meaning depends on where they sit (a lone `{`, `}` or `]`); its escapes are `\d \w \s \b`, their capitals, `\t \n \r \f \v \0 \xHH \uHHHH` and any escaped ASCII symbol, and an escaped letter or digit it doesn't know (`\q`, `\cJ`, `\u{41}`) is refused. A pattern is at most 500 characters and 1,000 steps once its repeats are counted out. `checkFieldSpec`, `defineFields` and `zodFor` refuse a pattern outside it, in the same words. Before, any pattern that compiled was taken: a pattern declared in code that uses one of these now fails at definition and is rewritten, for example `"^(?!test)\\w+$"` (lookahead) as a check of its own, `"(\\w)\\1"` (a backreference) as a check of its own, `"a{"` as `"a\\{"`, `"\\q"` as `"q"`. A definition already stored as data is checked the same way when `zodFor` builds its schema: run `checkFieldSpec` over your stored definitions before you upgrade.
400
419
  - `viewkitjs/fields`: `zodFor` refuses a value too long for its field's pattern to read within that cost as too long ("Too long — at most N characters", `validation.max-length`), before the pattern reads it: 20,000 characters for a cap-sized pattern of 1,000 steps, far more for a short one. A field's own `maxLength`, when lower, says the limit as before.
420
+ - `viewkitjs/views/controls`: with nothing picked, a menu list on a phone draws My preset's Words, for a menu's own sheet: Words rows, full-width lines, rows 56 high and 2xl corners, with no icon, value or chevron on a row. It drew Card rows, inset lines, rows 52 high and xl corners. A piece whose menu lists stand on no menu's own sheet (a panel's settings, a list of people) keeps the card rows with `MENU_LIST_CARD_FRAME` (`viewkitjs/views/looks`) on a frame round them, whatever the app picks; the Menu takes it as its `frame` on a phone.
421
+ - `viewkitjs/views/controls`: with nothing picked, the list's options (the Select's list, the Menu's panel, the Picker on a computer) are My preset's: an outline edge, the xl shadow, 6 of padding and the medium highlight. They were a subtle edge, the md shadow, 4 of padding and the light highlight. A frame that picks the old values (`data-list-edge="subtle"`, `data-list-shadow="md"`, `data-list-padding="4"`, `data-list-intensity="1"`) still draws them.
422
+ - `viewkitjs/views/controls`: a menu's level in steps out by its panel's own padding, where it stepped out by one spacing step, so it meets its panel's edge and its first row stands level with the row that opened it at any padding.
401
423
 
402
424
  ### Fixed
403
425
 
@@ -405,7 +427,10 @@ viewkitjs/views/controls: the Menu (the components map's default `Menu`, with `m
405
427
 
406
428
  ## [0.24.0] — 2026-11-26
407
429
 
408
- viewkitjs/views/controls: the menu list, the list's stylesheet and the helpers they stand on (Icon, Grip, useHoldDrag, useReorder); the menu list's looks in viewkitjs/views/looks. A piece's looks may pick fewer options than it has (`PieceLooks<Id, Picked>`).
430
+ ### Added
431
+
432
+ - `viewkitjs/views/controls`: the menu list, the list's stylesheet and the helpers they stand on (Icon, Grip, useHoldDrag, useReorder); the menu list's looks in `viewkitjs/views/looks`.
433
+ - `viewkitjs/views/looks`: a piece's looks may pick fewer options than it has (`PieceLooks<Id, Picked>`).
409
434
 
410
435
  ### Fixed
411
436
 
@@ -416,15 +441,15 @@ viewkitjs/views/controls: the menu list, the list's stylesheet and the helpers t
416
441
 
417
442
  ## [0.23.0] — 2026-11-25
418
443
 
419
- viewkitjs/views/controls: the Option, the Tag, the Status and the Switch, their looks in viewkitjs/views/looks; CONTROL_ATOMS draws ViewKit's Tag, StatusBadge and CellMore atoms with them for an app that spreads it into its atoms.
420
-
421
444
  ### Added
422
445
 
446
+ - `viewkitjs/views/controls`: the Option, the Tag, the Status and the Switch, their looks in `viewkitjs/views/looks`; `CONTROL_ATOMS` draws ViewKit's Tag, StatusBadge and CellMore atoms with them for an app that spreads it into its atoms.
423
447
  - `viewkitjs/views/controls`: the bottom Sheet (`Sheet`, `SheetHead`, `SheetBody`, `SheetFoot`, `SheetStep`, `SheetButton`, `SheetClose`, `useSheetCloseAll`, `STOPS`), with its forms, its stops and its spring, and the phone's header bar (`HeaderBar`) with the soft edge it stands on (`SoftEdge`), join the default controls, on Base UI. `CONTROLS` now also holds `Sheet`. Their stylesheets are `viewkitjs/views/controls/sheet.css` and `phone-header.css`, and the ready stylesheet carries them.
424
448
  - `viewkitjs/views/looks`: `SHEET_LOOKS` and `PHONE_HEADER_LOOKS`, by the Outright kit's names.
425
449
  - `viewkitjs/views/controls`: the Popover, the Tooltip (with `TooltipGroup`, `TooltipShown` and `TOOLTIP_TIMING`), the Kbd, the Glass button (with `GlassButtonGroup`) and the Scrollbar join the default controls, on Base UI; `POPUP_HOST` and `popupHostOf` name where a popup stands. `CONTROLS` now also holds `Popover` and `Tooltip`. Each control's stylesheet is `viewkitjs/views/controls/<piece>.css` (`popover`, `tooltip`, `kbd`, `glass-button`, `scrollbar`), every name it reads listed on its page under `docs/controls/`, and the ready stylesheet carries them.
426
450
  - `viewkitjs/views/looks`: `POPOVER_LOOKS`, `TOOLTIP_LOOKS`, `KBD_LOOKS` and `GLASS_BUTTON_LOOKS`, each control's options by the Outright kit's names.
427
451
  - `viewkitjs/views/controls`: the Input (with its InputGroup, addons, buttons and segments, and a box's own look), the inline input, the Field (with FieldSet, FieldSeparator and Field rows), the Toggle and its group, the number field and the Checkbox (with its mark and list), on Base UI, as the Outright kit draws them; and `useAutofill`, which turns the browser's and the password managers' filling off on a box.
452
+ - The stylesheets of the Input, the inline input, the Field, the Toggle, the number field and the Checkbox, `viewkitjs/views/controls/{input,inline-input,field,toggle,number-field,checkbox}.css`, in the ready stylesheet too, and each one's tokens page under `views/docs/controls/`. Their phone rules hold below 640px, by the Outright Showcase's hooks (`o-phone`, `data-computer-host`), named in the controls' reference page.
428
453
  - `CONTROLS` draws the components map's `Input` and `Checkbox`.
429
454
  - Their options and looks on `viewkitjs/views/looks`: `INPUT_LOOKS`, `INLINE_INPUT_LOOKS`, `FIELD_LOOKS`, `TOGGLE_LOOKS`, `CHECKBOX_LOOKS`; a box's own look beside the Input's (`InputOwnLook`, `inputAttrs`, `inputOwnAttrs`, `inputFrameAttrs`, `kindLook`, `attioBox`) and a Field rows card's (`fieldRowsAttrs`, `FieldRowsLook`).
430
455
  - `VK_CONTROL_TOKENS_BY_PIECE` and `ControlToken`: each default control's own list of the names its stylesheet reads, with each name's kind and the Outright token it stands for (`outright`). `VK_CONTROL_TOKENS` gathers them, once each.
@@ -437,7 +462,6 @@ viewkitjs/views/controls: the Option, the Tag, the Status and the Switch, their
437
462
  - Where nothing says otherwise, the phone header's surface is Glass and two Glass buttons stand together on the pill, as their options' defaults say; only `data-phone-header-surface="flat"` or `data-glass-button-pair="separate"` set them apart.
438
463
  - The default Popover's shadow is `md` and two Glass buttons share the glass pill unless something round them says `separate`: My preset's picks, the Outright look's defaults.
439
464
  - The inline input's default is the Outright look's: the line, `md` corners, on a 20% tint of the brand (it was the `attio` look: `sm` corners on the overlay's ground). An app that picks none of its options, or only some, draws the new defaults for the rest.
440
- - Their stylesheets, `viewkitjs/views/controls/{input,inline-input,field,toggle,number-field,checkbox}.css`, in the ready stylesheet too, and each one's tokens page under `views/docs/controls/`. Their phone rules hold below 640px, by the Outright Showcase's hooks (`o-phone`, `data-computer-host`), named in the controls' reference page.
441
465
  - The number field's stepper gap is named with the addon it stands in (`.o-input-addon.o-number-steps`), so it wins over the addon's own gap whatever order the stylesheets load in.
442
466
  - The controls' stylesheet doors are one pattern, `viewkitjs/views/controls/<piece>.css` (the outline's `smooth.css`, the Button's `button.css`, the Spinner's `spinner.css`), the same paths as before.
443
467
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "viewkitjs",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "ViewKit — typed fields, the grid and its editors, and a list's SQL for record lists, in one package: viewkitjs/fields, viewkitjs/views and viewkitjs/postgres. By Sheaf.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/outright-agency/portal.git"
8
+ "url": "git+https://github.com/outright-agency/viewkit.git"
9
9
  },
10
10
  "type": "module",
11
11
  "sideEffects": [
@@ -244,7 +244,9 @@
244
244
  "@prisma/adapter-pg": "7.10.0",
245
245
  "@prisma/client": "7.10.0",
246
246
  "@tailwindcss/postcss": "4.3.3",
247
+ "@testing-library/jest-dom": "^7.0.0",
247
248
  "@testing-library/react": "^16.3.2",
249
+ "@testing-library/user-event": "^14.6.1",
248
250
  "@types/node": "^20",
249
251
  "@types/pg": "^8.20.0",
250
252
  "@types/react": "^19",
@@ -1,5 +1,8 @@
1
1
  import * as React from "react";
2
- export type AvatarSize = 16 | 20 | 24 | 32 | 40 | 64;
2
+ import { type OptionColour } from "../option/looks.js";
3
+ export type AvatarSize = 16 | 20 | 24 | 32 | 40 | 56 | 64;
4
+ /** A square's own colour: one of the label hues, or grey, the Option's list. */
5
+ export type AvatarColour = OptionColour;
3
6
  /** The initials of a name: the first letters of the first and last names; a first name of two joined
4
7
  * parts gives both ("Maximiliane-Theodora von Hohenberg-Lichtenstein" is MT); one name gives one ("Jo" is J). */
5
8
  export declare function initials(name: string): string;
@@ -15,12 +18,15 @@ export interface AvatarProps {
15
18
  * fills, or with neither its first letter. */
16
19
  kind?: "person" | "thing" | "workspace" | "agent";
17
20
  /** 16 in a chip (a typed Select's), with no badge; 20 in chips and text, 24 in dense rows and stacks, 32 in list rows,
18
- * 40 in headers, 64 on a record's own page. */
21
+ * 40 in headers, 56 at a settings page's head, 64 on a record's own page. */
19
22
  size?: AvatarSize;
20
23
  /** A stable id, for a person's tone. */
21
24
  id?: string;
22
25
  /** The tone itself, where the app keeps it. */
23
26
  tone?: 1 | 2 | 3 | 4 | 5 | 6;
27
+ /** A square's own colour (a team's letter, an app's or an object's icon, the workspace's initials on the colour picked
28
+ * for it): the square on the hue's fill, what it holds in the hue's strong ink, with no edge. A person keeps their tone. */
29
+ colour?: AvatarColour;
24
30
  /** A photo or a logo, filling the same shape. */
25
31
  src?: string;
26
32
  /** A record with no name: its kind's icon instead of a letter. */
@@ -32,7 +38,7 @@ export interface AvatarProps {
32
38
  className?: string;
33
39
  }
34
40
  /** Who or what a row is about, at a glance. */
35
- export declare function Avatar({ name, kind, size, id, tone, src, icon, presence, badge, className }: AvatarProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function Avatar({ name, kind, size, id, tone, colour, src, icon, presence, badge, className }: AvatarProps): import("react/jsx-runtime").JSX.Element;
36
42
  /** One person on a stack. */
37
43
  export type AvatarStackPerson = Omit<AvatarProps, "size" | "kind">;
38
44
  export interface AvatarStackProps {
@@ -40,7 +46,7 @@ export interface AvatarStackProps {
40
46
  people: AvatarStackPerson[];
41
47
  /** How many to show before the rest become a count. */
42
48
  max?: number;
43
- size?: Exclude<AvatarSize, 16>;
49
+ size?: Exclude<AvatarSize, 16 | 56>;
44
50
  className?: string;
45
51
  /** What everyone is on ("Acme Robotics renewal"): the list's name to a screen reader. Left out, the stack's own words. */
46
52
  label?: string;
@@ -5,9 +5,10 @@ import { cx } from "../../internal/cx.js";
5
5
  import { Button } from "../button/button.js";
6
6
  import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
7
7
  import { Menu } from "../menu/menu.js";
8
+ import { optionColours } from "../option/looks.js";
8
9
  import { Icon } from "../internal/icons.js";
9
10
  import { PhoneHost, usePhone } from "../internal/phone.js";
10
- const SIZE = { 16: "o-avatar-2xs", 20: "o-avatar-xs", 24: "o-avatar-sm", 32: "", 40: "o-avatar-lg", 64: "o-avatar-xl" };
11
+ const SIZE = { 16: "o-avatar-2xs", 20: "o-avatar-xs", 24: "o-avatar-sm", 32: "", 40: "o-avatar-lg", 56: "o-avatar-56", 64: "o-avatar-xl" };
11
12
  export function initials(name) {
12
13
  const words = name.split(/\s+/).filter((w) => /^\p{L}/u.test(w));
13
14
  if (!words.length)
@@ -23,10 +24,11 @@ export function toneOf(id) {
23
24
  h = (h * 31 + c.charCodeAt(0)) >>> 0;
24
25
  return (h % 6) + 1;
25
26
  }
26
- export function Avatar({ name, kind = "person", size = 32, id, tone, src, icon, presence, badge, className }) {
27
+ export function Avatar({ name, kind = "person", size = 32, id, tone, colour, src, icon, presence, badge, className }) {
27
28
  const person = kind === "person";
29
+ const coloured = !person && colour && optionColours.includes(colour) ? colour : undefined;
28
30
  const letters = icon ? null : kind === "thing" || kind === "agent" ? initials(name).slice(0, 1) : initials(name);
29
- const avatar = (_jsxs(BaseAvatar.Root, { role: "img", "aria-label": presence ? `${name}, ${presence}` : name, "data-kit": "avatar", "data-tone": person ? tone ?? toneOf(id ?? name) : undefined, className: cx("o-avatar", SIZE[size], !person && "o-avatar-thing o-smooth o-smooth-ease", kind === "workspace" && "o-avatar-workspace", kind === "agent" && "o-avatar-agent", className), children: [src && _jsx(BaseAvatar.Image, { className: "o-avatar-image", src: src, alt: "" }), _jsx(BaseAvatar.Fallback, { className: "o-avatar-letters", "aria-hidden": "true", children: icon ?? letters })] }));
31
+ const avatar = (_jsxs(BaseAvatar.Root, { role: "img", "aria-label": presence ? `${name}, ${presence}` : name, "data-kit": "avatar", "data-tone": person ? tone ?? toneOf(id ?? name) : undefined, "data-colour": coloured, className: cx("o-avatar", SIZE[size], !person && "o-avatar-thing o-smooth o-smooth-ease", kind === "workspace" && "o-avatar-workspace", kind === "agent" && "o-avatar-agent", className), children: [src && _jsx(BaseAvatar.Image, { className: "o-avatar-image", src: src, alt: "" }), _jsx(BaseAvatar.Fallback, { className: "o-avatar-letters", "aria-hidden": "true", children: icon ?? letters })] }));
30
32
  if (size === 16 || (!presence && (badge == null || badge === false)))
31
33
  return avatar;
32
34
  return (_jsxs("span", { className: "o-avatar-badged", "data-size": size, "data-thing": person ? undefined : "", children: [avatar, presence ? _jsx("span", { className: "o-avatar-badge", "data-presence": presence, "aria-hidden": "true" })
@@ -22,6 +22,62 @@ export declare const AVATAR_TOKENS: readonly [{
22
22
  readonly name: "--vk-fg-subtlest";
23
23
  readonly kind: "colour";
24
24
  readonly outright: "--text-subtlest";
25
+ }, {
26
+ readonly name: "--vk-label-amber-fill";
27
+ readonly kind: "colour";
28
+ readonly outright: "--label-amber-fill";
29
+ }, {
30
+ readonly name: "--vk-label-amber-strong";
31
+ readonly kind: "colour";
32
+ readonly outright: "--label-amber-strong";
33
+ }, {
34
+ readonly name: "--vk-label-blue-fill";
35
+ readonly kind: "colour";
36
+ readonly outright: "--label-blue-fill";
37
+ }, {
38
+ readonly name: "--vk-label-blue-strong";
39
+ readonly kind: "colour";
40
+ readonly outright: "--label-blue-strong";
41
+ }, {
42
+ readonly name: "--vk-label-green-fill";
43
+ readonly kind: "colour";
44
+ readonly outright: "--label-green-fill";
45
+ }, {
46
+ readonly name: "--vk-label-green-strong";
47
+ readonly kind: "colour";
48
+ readonly outright: "--label-green-strong";
49
+ }, {
50
+ readonly name: "--vk-label-pink-fill";
51
+ readonly kind: "colour";
52
+ readonly outright: "--label-pink-fill";
53
+ }, {
54
+ readonly name: "--vk-label-pink-strong";
55
+ readonly kind: "colour";
56
+ readonly outright: "--label-pink-strong";
57
+ }, {
58
+ readonly name: "--vk-label-purple-fill";
59
+ readonly kind: "colour";
60
+ readonly outright: "--label-purple-fill";
61
+ }, {
62
+ readonly name: "--vk-label-purple-strong";
63
+ readonly kind: "colour";
64
+ readonly outright: "--label-purple-strong";
65
+ }, {
66
+ readonly name: "--vk-label-red-fill";
67
+ readonly kind: "colour";
68
+ readonly outright: "--label-red-fill";
69
+ }, {
70
+ readonly name: "--vk-label-red-strong";
71
+ readonly kind: "colour";
72
+ readonly outright: "--label-red-strong";
73
+ }, {
74
+ readonly name: "--vk-label-teal-fill";
75
+ readonly kind: "colour";
76
+ readonly outright: "--label-teal-fill";
77
+ }, {
78
+ readonly name: "--vk-label-teal-strong";
79
+ readonly kind: "colour";
80
+ readonly outright: "--label-teal-strong";
25
81
  }, {
26
82
  readonly name: "--vk-neutral";
27
83
  readonly kind: "colour";
@@ -82,6 +138,10 @@ export declare const AVATAR_TOKENS: readonly [{
82
138
  readonly name: "--vk-font-size-sm";
83
139
  readonly kind: "size";
84
140
  readonly outright: "--text-sm";
141
+ }, {
142
+ readonly name: "--vk-font-size-xl";
143
+ readonly kind: "size";
144
+ readonly outright: "--text-xl";
85
145
  }, {
86
146
  readonly name: "--vk-font-size-xs";
87
147
  readonly kind: "size";
@@ -5,6 +5,20 @@ export const AVATAR_TOKENS = [
5
5
  { name: "--vk-fg-on-brand", kind: "colour", outright: "--text-brand-inverse" },
6
6
  { name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
7
7
  { name: "--vk-fg-subtlest", kind: "colour", outright: "--text-subtlest" },
8
+ { name: "--vk-label-amber-fill", kind: "colour", outright: "--label-amber-fill" },
9
+ { name: "--vk-label-amber-strong", kind: "colour", outright: "--label-amber-strong" },
10
+ { name: "--vk-label-blue-fill", kind: "colour", outright: "--label-blue-fill" },
11
+ { name: "--vk-label-blue-strong", kind: "colour", outright: "--label-blue-strong" },
12
+ { name: "--vk-label-green-fill", kind: "colour", outright: "--label-green-fill" },
13
+ { name: "--vk-label-green-strong", kind: "colour", outright: "--label-green-strong" },
14
+ { name: "--vk-label-pink-fill", kind: "colour", outright: "--label-pink-fill" },
15
+ { name: "--vk-label-pink-strong", kind: "colour", outright: "--label-pink-strong" },
16
+ { name: "--vk-label-purple-fill", kind: "colour", outright: "--label-purple-fill" },
17
+ { name: "--vk-label-purple-strong", kind: "colour", outright: "--label-purple-strong" },
18
+ { name: "--vk-label-red-fill", kind: "colour", outright: "--label-red-fill" },
19
+ { name: "--vk-label-red-strong", kind: "colour", outright: "--label-red-strong" },
20
+ { name: "--vk-label-teal-fill", kind: "colour", outright: "--label-teal-fill" },
21
+ { name: "--vk-label-teal-strong", kind: "colour", outright: "--label-teal-strong" },
8
22
  { name: "--vk-neutral", kind: "colour", outright: "--background-neutral" },
9
23
  { name: "--vk-person-1", kind: "colour", outright: "--person-1" },
10
24
  { name: "--vk-person-2", kind: "colour", outright: "--person-2" },
@@ -20,6 +34,7 @@ export const AVATAR_TOKENS = [
20
34
  { name: "--vk-font-size-2xs", kind: "size", outright: "--text-2xs" },
21
35
  { name: "--vk-font-size-3xs", kind: "size", outright: "--text-3xs" },
22
36
  { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
37
+ { name: "--vk-font-size-xl", kind: "size", outright: "--text-xl" },
23
38
  { name: "--vk-font-size-xs", kind: "size", outright: "--text-xs" },
24
39
  { name: "--vk-font-weight-semibold", kind: "size", outright: "--font-weight-semibold" },
25
40
  { name: "--vk-radius-2xl", kind: "size", outright: "--radius-2xl" },
@@ -1,7 +1,7 @@
1
1
  /* The Avatar. Every value it draws with is a
2
2
  token (control tokens); this file only says which token each kind and size takes. People are circles on
3
3
  their own tone (data-tone, 1 to 6); things are squares on a quiet ground; the workspace is the brand; an agent is a thing's
4
- square holding its own icon. Its options, on the frame around it (looks.ts), are its squares' alone:
4
+ square holding its own icon; a square handed its own colour (data-colour, a label hue) stands on that hue instead. Its options, on the frame around it (looks.ts), are its squares' alone:
5
5
 
6
6
  data-avatar-corners small · medium · large · xlarge a radius token per size; nothing set is Medium
7
7
  data-avatar-smoothing round · smooth how a square's corners bend; nothing set is Smooth
@@ -27,48 +27,60 @@
27
27
  .o-avatar-letters svg { width: 55%; height: 55%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
28
28
 
29
29
  /* ── Sizes: 16 in a typed Select's chip, its initials at the 3xs type size; 20 in chips and text, 24 in dense rows and stacks,
30
- 40 in headers, 64 on a record's page ── */
30
+ 40 in headers, 56 at a settings page's head, 64 on a record's page ── */
31
31
  .o-avatar.o-avatar-2xs { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); font-size: var(--vk-font-size-3xs); }
32
32
  .o-avatar.o-avatar-xs { width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); font-size: var(--vk-font-size-2xs); }
33
33
  .o-avatar.o-avatar-sm { width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); font-size: var(--vk-font-size-2xs); }
34
34
  .o-avatar.o-avatar-lg { width: calc(var(--vk-spacing) * 10); height: calc(var(--vk-spacing) * 10); font-size: var(--vk-font-size-sm); }
35
+ .o-avatar.o-avatar-56 { width: calc(var(--vk-spacing) * 14); height: calc(var(--vk-spacing) * 14); font-size: var(--vk-font-size-xl); }
35
36
  .o-avatar.o-avatar-xl { width: calc(var(--vk-spacing) * 16); height: calc(var(--vk-spacing) * 16); font-size: var(--vk-font-size-2xl); }
36
37
 
37
38
  /* ── A thing: a square, its corners a step that grows with it, on the neutral ground, its edge inside ─ */
38
39
  .o-avatar.o-avatar-thing { border-radius: var(--avatar-r); background-color: var(--vk-neutral); color: var(--vk-fg-subtle); box-shadow: inset 0 0 0 var(--vk-border-width) var(--vk-border-subtle); }
39
40
  /* The workspace: the one square in the brand. */
40
41
  .o-avatar.o-avatar-workspace { background-color: var(--vk-brand); color: var(--vk-fg-on-brand); box-shadow: none; }
42
+ /* A square's own colour, the workspace's included: on the hue's fill, what it holds in the hue's strong ink, with no edge; grey
43
+ the neutral ground in the quieter ink. */
44
+ .o-avatar.o-avatar-thing[data-colour] { box-shadow: none; }
45
+ .o-avatar.o-avatar-thing[data-colour="blue"] { background-color: var(--vk-label-blue-fill); color: var(--vk-label-blue-strong); }
46
+ .o-avatar.o-avatar-thing[data-colour="green"] { background-color: var(--vk-label-green-fill); color: var(--vk-label-green-strong); }
47
+ .o-avatar.o-avatar-thing[data-colour="amber"] { background-color: var(--vk-label-amber-fill); color: var(--vk-label-amber-strong); }
48
+ .o-avatar.o-avatar-thing[data-colour="red"] { background-color: var(--vk-label-red-fill); color: var(--vk-label-red-strong); }
49
+ .o-avatar.o-avatar-thing[data-colour="purple"] { background-color: var(--vk-label-purple-fill); color: var(--vk-label-purple-strong); }
50
+ .o-avatar.o-avatar-thing[data-colour="pink"] { background-color: var(--vk-label-pink-fill); color: var(--vk-label-pink-strong); }
51
+ .o-avatar.o-avatar-thing[data-colour="teal"] { background-color: var(--vk-label-teal-fill); color: var(--vk-label-teal-strong); }
52
+ .o-avatar.o-avatar-thing[data-colour="grey"] { background-color: var(--vk-neutral); color: var(--vk-fg-subtle); }
41
53
  /* An agent: a thing's square holding its own icon. Its mark comes in its own fills, so it is filled, never drawn as a
42
54
  line as a record's icon is; a mark with no colour of its own (Codex's, Grok's) takes the text's ink, as the canvas drew it. */
43
55
  .o-avatar-agent .o-avatar-letters svg { fill: var(--vk-fg); stroke: none; }
44
56
 
45
- /* ── Corners: a radius token per size, in steps; Medium with nothing set: xs at 20, sm at 24 and 32, md at 40, lg at 64,
57
+ /* ── Corners: a radius token per size, in steps, 56 taking 64's; Medium with nothing set: xs at 20, sm at 24 and 32, md at 40, lg at 56 and 64,
46
58
  between Small and Large, the tokens holding nothing between xs and sm ────────────────────────────── */
47
59
  .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-sm); }
48
60
  .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs) { --avatar-r: var(--vk-radius-xs); }
49
61
  .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-md); }
50
- .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-lg); }
51
- /* Small: xs at 20 and 24, sm at 32 and 40, md at 64. */
62
+ .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-lg); }
63
+ /* Small: xs at 20 and 24, sm at 32 and 40, md at 56 and 64. */
52
64
  [data-avatar-corners="small"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-sm); }
53
65
  [data-avatar-corners="small"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-xs); }
54
- [data-avatar-corners="small"] .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-md); }
55
- /* Large, the radii before Medium came: sm at 20 and 24, md at 32, lg at 40, xl at 64. */
66
+ [data-avatar-corners="small"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-md); }
67
+ /* Large, the radii before Medium came: sm at 20 and 24, md at 32, lg at 40, xl at 56 and 64. */
56
68
  [data-avatar-corners="large"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-md); }
57
69
  [data-avatar-corners="large"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-sm); }
58
70
  [data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-lg); }
59
- [data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-xl); }
60
- /* Extra large: md at 20 and 24, lg at 32, xl at 40, 2xl at 64. */
71
+ [data-avatar-corners="large"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-xl); }
72
+ /* Extra large: md at 20 and 24, lg at 32, xl at 40, 2xl at 56 and 64. */
61
73
  [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-lg); }
62
74
  [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-md); }
63
75
  [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-xl); }
64
- [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-2xl); }
76
+ [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-2xl); }
65
77
 
66
78
  /* ── Corner smoothing: Smooth, with nothing set, draws a square's corners with the smooth outline (smooth.css),
67
79
  every browser that knows shape() showing it; one that doesn't keeps the quarter circles above, and so does Round. Its
68
80
  smoothing eases off where a side is too short for 1.7 radii at each end, as the canvas drew it (o-smooth-ease, from its size and
69
81
  its radius, both tokens, so it follows Corner radius). The outline would cut the edge drawn inside the square, so under it the
70
82
  edge is a ring of its own (::before), between the outline and the same outline drawn a hairline in, under whatever the square
71
- holds; the workspace has none. Its smoothing is its own Corner smoothing, never a host's: the outline's amount inherits, and a
83
+ holds; the workspace and a square on its own colour have none. Its smoothing is its own Corner smoothing, never a host's: the outline's amount inherits, and a
72
84
  crumb, a tab or a list's card that follows the token sets it on itself, so the square sets it back. ─────── */
73
85
  @supports (clip-path: shape(evenodd from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close, move to 0 0, hline to 1px, close)) and (width: calc(tan(atan2(1px, 1px)) * 1px)) {
74
86
  .o-avatar.o-avatar-thing { --smooth-amount: initial; }
@@ -76,8 +88,9 @@
76
88
  --avatar-rr: min(var(--avatar-r), var(--avatar-size) / 2); --smooth-t: var(--avatar-rr); --smooth-side: var(--avatar-size);
77
89
  position: relative; box-shadow: none; clip-path: shape(var(--smooth-outline));
78
90
  }
79
- /* Its edge, a hairline ring along the outline, under the picture or the letters it holds; the workspace has none. */
80
- .o-avatar.o-avatar-thing:not(.o-avatar-workspace):not([data-avatar-smoothing="round"] *)::before {
91
+ /* Its edge, a hairline ring along the outline, under the picture or the letters it holds; the workspace and a square on its
92
+ own colour have none. */
93
+ .o-avatar.o-avatar-thing:not(.o-avatar-workspace):not([data-colour]):not([data-avatar-smoothing="round"] *)::before {
81
94
  --smooth-t: calc(var(--avatar-rr) - var(--vk-border-width)); --smooth-in: var(--vk-border-width);
82
95
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-color: var(--vk-border-subtle);
83
96
  clip-path: shape(var(--smooth-ring));
@@ -123,13 +136,14 @@
123
136
  /* The rest, as a count in a neutral circle. */
124
137
  .o-avatar.o-avatar-more { background-color: var(--vk-neutral); color: var(--vk-fg-subtle); font-variant-numeric: tabular-nums; }
125
138
  /* ── Presence and the badge: a dot on the corner, its size stepping with the avatar's (6,
126
- 8, 10, 12, 16), cut out of whatever the avatar stands on by a mask, never a ring painted in the page's colour. The mask stands
139
+ 8, 10, 12, 14, 16), cut out of whatever the avatar stands on by a mask, never a ring painted in the page's colour. The mask stands
127
140
  only on a badged avatar and a stack's faces: a mask clips what is outside the box and makes a stacking context. ──────── */
128
141
  :is(.o-avatar, .o-avatar-badged) { --avatar-size: calc(var(--vk-spacing) * 8); --avatar-dot: calc(var(--vk-spacing) * 2.5); --avatar-cut: calc(var(--vk-spacing) * 0.5); --avatar-dot-inset: 0px; }
129
142
  .o-avatar.o-avatar-2xs { --avatar-size: calc(var(--vk-spacing) * 4); }
130
143
  :is(.o-avatar.o-avatar-xs, .o-avatar-badged[data-size="20"]) { --avatar-size: calc(var(--vk-spacing) * 5); --avatar-dot: var(--vk-dot-size); --avatar-cut: calc(var(--vk-spacing) * 0.375); }
131
144
  :is(.o-avatar.o-avatar-sm, .o-avatar-badged[data-size="24"]) { --avatar-size: calc(var(--vk-spacing) * 6); --avatar-dot: calc(var(--vk-spacing) * 2); }
132
145
  :is(.o-avatar.o-avatar-lg, .o-avatar-badged[data-size="40"]) { --avatar-size: calc(var(--vk-spacing) * 10); --avatar-dot: calc(var(--vk-spacing) * 3); }
146
+ :is(.o-avatar.o-avatar-56, .o-avatar-badged[data-size="56"]) { --avatar-size: calc(var(--vk-spacing) * 14); --avatar-dot: calc(var(--vk-spacing) * 3.5); --avatar-dot-inset: calc(var(--vk-spacing) * 0.5); }
133
147
  :is(.o-avatar.o-avatar-xl, .o-avatar-badged[data-size="64"]) { --avatar-size: calc(var(--vk-spacing) * 16); --avatar-dot: calc(var(--vk-spacing) * 4); --avatar-dot-inset: calc(var(--vk-spacing) * 0.5); }
134
148
  :is(.o-avatar.o-avatar-thing, .o-avatar-badged[data-thing]) { --avatar-dot-inset: calc(var(--vk-spacing) * -0.75); }
135
149
  .o-avatar-badged { position: relative; display: inline-flex; flex: none; vertical-align: middle; isolation: isolate; }
@@ -141,7 +155,7 @@
141
155
  background-color: var(--vk-brand); color: var(--vk-fg-on-brand);
142
156
  }
143
157
  .o-avatar-badge > svg { display: none; width: 70%; height: 70%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
144
- .o-avatar-badged:is([data-size="32"], [data-size="40"], [data-size="64"]) > .o-avatar-badge > svg { display: block; }
158
+ .o-avatar-badged:is([data-size="32"], [data-size="40"], [data-size="56"], [data-size="64"]) > .o-avatar-badge > svg { display: block; }
145
159
  /* Here, a green dot; away, a hollow ring whose middle shows the ground. */
146
160
  .o-avatar-badge[data-presence="here"] { background-color: var(--vk-success-bold); }
147
161
  .o-avatar-badge[data-presence="away"] { background-color: transparent; box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 2) var(--vk-fg-subtlest); }
@@ -1,11 +1,13 @@
1
1
  import * as React from "react";
2
2
  import type { ViewsButtonProps } from "../../provider/components.js";
3
- /** A glyph ViewKit hands before a button's words (+ Add column's "+", its icon in a fragment with the words) is the Button's
4
- * icon, so it stands before the words on one line, never stacked over them in the label. The glyph is an svg or one of the
5
- * app's icons (`glyphs`), never another component; a glyph alone stays the children. */
3
+ /** A glyph ViewKit hands before a button's words (+ Add column's "+", its icon in a fragment with the words; the views chip's
4
+ * view glyph) is the Button's icon, and one after them (the chip's chevron) its end icon, so each stands beside the words on
5
+ * one line, never stacked over or under them in the label. A glyph is an svg, one of the app's icons or its `AppIcon`
6
+ * (`glyphs`), never another component; a glyph alone stays the children. */
6
7
  export declare function leadingGlyph(children: React.ReactNode, glyphs: ReadonlySet<unknown>): {
7
8
  icon?: React.ReactNode;
8
9
  label: React.ReactNode;
10
+ iconEnd?: React.ReactNode;
9
11
  };
10
12
  /** ViewKit's button, drawn as the kit's Button. Outside a provider (an app drawing it on its own) only an svg is a glyph. */
11
13
  export declare function MapButton({ variant, size, type, children, ...rest }: ViewsButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -8,13 +8,20 @@ const KIND = {
8
8
  export function leadingGlyph(children, glyphs) {
9
9
  const inner = React.isValidElement(children) && children.type === React.Fragment ? children.props.children : children;
10
10
  const parts = React.Children.toArray(inner);
11
- const first = parts[0];
12
- const glyph = React.isValidElement(first) && (first.type === "svg" || glyphs.has(first.type));
13
- return parts.length > 1 && glyph ? { icon: first, label: parts.slice(1) } : { label: children };
11
+ const isGlyph = (part) => React.isValidElement(part) && (part.type === "svg" || glyphs.has(part.type));
12
+ if (parts.length < 2)
13
+ return { label: children };
14
+ const icon = isGlyph(parts[0]) ? parts[0] : undefined;
15
+ const words = parts.slice(icon === undefined ? 0 : 1);
16
+ const iconEnd = words.length > 1 && isGlyph(words[words.length - 1]) ? words[words.length - 1] : undefined;
17
+ if (icon === undefined && iconEnd === undefined)
18
+ return { label: children };
19
+ return { icon, label: iconEnd === undefined ? words : words.slice(0, -1), iconEnd };
14
20
  }
15
21
  export function MapButton({ variant = "default", size = "default", type = "button", children, ...rest }) {
16
- const icons = React.useContext(ViewsContext)?.icons;
17
- const glyphs = React.useMemo(() => new Set(icons ? Object.values(icons) : []), [icons]);
18
- const { icon, label } = size === "icon" ? { icon: undefined, label: children } : leadingGlyph(children, glyphs);
19
- return _jsx(Button, { kind: KIND[variant], size: size === "default" ? "md" : "sm", shape: size === "icon" ? "icon" : "default", type: type, icon: icon, ...rest, children: label });
22
+ const views = React.useContext(ViewsContext);
23
+ const icons = views?.icons, AppIcon = views?.components.AppIcon;
24
+ const glyphs = React.useMemo(() => new Set([...(icons ? Object.values(icons) : []), ...(AppIcon ? [AppIcon] : [])]), [icons, AppIcon]);
25
+ const { icon, label, iconEnd } = size === "icon" ? { icon: undefined, label: children, iconEnd: undefined } : leadingGlyph(children, glyphs);
26
+ return _jsx(Button, { kind: KIND[variant], size: size === "default" ? "md" : "sm", shape: size === "icon" ? "icon" : "default", type: type, icon: icon, iconEnd: iconEnd, ...rest, children: label });
20
27
  }
@@ -45,7 +45,7 @@ export { COMPUTER_HOST, ComputerHost, PHONE_MARK, PhoneHost, PhoneLine, phoneMar
45
45
  export { drawnAt, focusWhereItStands, focusesInPlace, holdsThePage, keepsToItsList, overflows, scaleOf, scrollInList, scrollTopFor, scrollTopForDrag, staysInView, tapsInPlace, typesInto, } from "./internal/scroll.js";
46
46
  export { ContextMenu, Menu, MenuDots, useSheetMenus, type MenuChangeDetails, type MenuProps, type MenuWords, } from "./menu/menu.js";
47
47
  export { MapMenu, menuEntries } from "./menu/map-menu.js";
48
- export { Avatar, AvatarStack, initials, toneOf, type AvatarPresence, type AvatarProps, type AvatarSize, type AvatarStackPerson, type AvatarStackProps, } from "./avatar/avatar.js";
48
+ export { Avatar, AvatarStack, initials, toneOf, type AvatarColour, type AvatarPresence, type AvatarProps, type AvatarSize, type AvatarStackPerson, type AvatarStackProps, } from "./avatar/avatar.js";
49
49
  export { PICKER_WORDS, Picker, PickerUnder, usePicker, type PickerAction, type PickerBoxSearch, type PickerDoing, type PickerLead, type PickerParts, type PickerProps, type PickerUnderProps, type PickerWords, } from "./picker/picker.js";
50
50
  export { exactMatch, findItem, fold, itemLabel, openLevels, orderMoved, pickerRows, searchShown, type PickerAs, type PickerItem, type PickerRow, type RowsInput, } from "./picker/rows.js";
51
51
  export { pickerRead, pickerWornOf, type PickerWorn } from "./picker/looks.js";
@@ -130,4 +130,5 @@ export { LinksEditor, useLinksEditor, type LinksEditorAction, type LinksEditorLe
130
130
  export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, type LinkChoice, type LinkField, type LinkFieldKind, type LinkValue, } from "./links-editor/links.js";
131
131
  export { LINKS_EDITOR_WORDS, linksWords, type LinksEditorWords } from "./links-editor/words.js";
132
132
  export { TagField, type TagFieldProps } from "./tag-field/tag-field.js";
133
- export { SwitchRow, SwitchRows, type SwitchRowProps } from "./switch-row/switch-row.js";
133
+ export { SettingRow, SettingRows, SwitchRow, SwitchRows, type SettingAction, type SettingRowProps, type SettingRowsProps, type SwitchRowProps } from "./setting-row/setting-row.js";
134
+ export { SETTING_ROW_ATTRS, settingRowWornOf } from "./setting-row/looks.js";
@@ -122,4 +122,5 @@ export { LinksEditor, useLinksEditor, } from "./links-editor/links-editor.js";
122
122
  export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, } from "./links-editor/links.js";
123
123
  export { LINKS_EDITOR_WORDS, linksWords } from "./links-editor/words.js";
124
124
  export { TagField } from "./tag-field/tag-field.js";
125
- export { SwitchRow, SwitchRows } from "./switch-row/switch-row.js";
125
+ export { SettingRow, SettingRows, SwitchRow, SwitchRows } from "./setting-row/setting-row.js";
126
+ export { SETTING_ROW_ATTRS, settingRowWornOf } from "./setting-row/looks.js";
@@ -54,6 +54,12 @@ export interface InputProps extends Omit<BaseInput.Props, "className" | "size">
54
54
  /** Bare, whether it fills its line (the rest of a flex line, its full height): on unless said. Off, it stands at the width
55
55
  * and height its place gives it, as the editors size their boxes. In its field, nothing. */
56
56
  fills?: boolean;
57
+ /** In its field, the app saving what was typed (VK-921): the Spinner at the box's end, the field busy and still typed
58
+ * into. It wins over saved. Inside an InputGroup, the group's. */
59
+ saving?: boolean;
60
+ /** In its field, the save took: a check and Saved at the box's end, announced, fading after --vk-saved-hold and then
61
+ * gone; it shows again each time it turns on. A save that fails is the Field's error instead. */
62
+ saved?: boolean;
57
63
  /** The Input's list: see InputComboboxProps. */
58
64
  combobox?: false;
59
65
  /** In its field, the box's classes, not the control's: a lone Input is a box round its control, so a utility class lands
@@ -86,13 +92,18 @@ export interface InputGroupProps extends React.HTMLAttributes<HTMLDivElement> {
86
92
  className?: string;
87
93
  /** Its Input and its InputGroupAddons, as its own children. */
88
94
  children: React.ReactNode;
95
+ /** The app saving what was typed (VK-921): the Spinner at the group's end, after its end side, the group busy. It wins
96
+ * over saved. */
97
+ saving?: boolean;
98
+ /** The save took: a check and Saved at the group's end, fading after --vk-saved-hold and then gone. */
99
+ saved?: boolean;
89
100
  }
90
101
  /** A field with something inside it beside the words: an icon, words before or after them, a button
91
102
  * (clear, show the password, copy); or rows above and below long text. It draws the field around its
92
103
  * Input and addons, in every state and every look, and a press anywhere in it but a button puts the
93
104
  * cursor in its Input. A value typed in parts holds InputGroupSegments instead of an Input: the group shows its focus while
94
105
  * any has it, and a press off them puts the focus in the first. */
95
- export declare function InputGroup({ size, look: lookGiven, chrome, className, children, onMouseDown, ...props }: InputGroupProps): import("react/jsx-runtime").JSX.Element;
106
+ export declare function InputGroup({ size, look: lookGiven, chrome, saving, saved, className, children, onMouseDown, ...props }: InputGroupProps): import("react/jsx-runtime").JSX.Element;
96
107
  export interface InputGroupAddonProps extends React.HTMLAttributes<HTMLDivElement> {
97
108
  /** Where it sits: before the words or after them (start, end), or a row above or below long text (top,
98
109
  * bottom). */
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { Input as BaseInput } from "@base-ui/react/input";
4
4
  import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
@@ -8,6 +8,7 @@ import { phoneMark, usePhoneForm } from "../internal/phone.js";
8
8
  import { useAutofill } from "./autofill.js";
9
9
  import { inputOwnAttrs, kindLook } from "./looks.js";
10
10
  import { keepTypedRun } from "../internal/typed-run.js";
11
+ import { SaveMark } from "./save-mark.js";
11
12
  const sized = (size) => size !== "md" && `o-input-${size}`;
12
13
  const InGroup = React.createContext(null);
13
14
  export const InputGroupContext = InGroup;
@@ -76,7 +77,7 @@ function useKeptCursor(el, type) {
76
77
  return () => cancelAnimationFrame(f);
77
78
  }, [el, type]);
78
79
  }
79
- export const Input = React.forwardRef(function Input({ size = "md", numeric = false, multiline = false, grow = false, maxLines, minLines, lines: linesGiven, autofill = true, look: lookGiven, chrome = "field", fills = true, combobox = false, className, style, ...props }, ref) {
80
+ export const Input = React.forwardRef(function Input({ size = "md", numeric = false, multiline = false, grow = false, maxLines, minLines, lines: linesGiven, autofill = true, look: lookGiven, chrome = "field", fills = true, combobox = false, saving = false, saved = false, className, style, ...props }, ref) {
80
81
  const fill = useAutofill(), look = kindLook(chrome, lookGiven), phone = usePhoneForm();
81
82
  const group = React.useContext(InGroup), grouped = group != null;
82
83
  const lines = linesGiven ?? look?.lines ?? group?.lines;
@@ -101,13 +102,13 @@ export const Input = React.forwardRef(function Input({ size = "md", numeric = fa
101
102
  if (field) {
102
103
  const { "data-force": force, ...rest } = props;
103
104
  props = rest;
104
- return (_jsx("span", { className: cx("o-input o-input-lone o-smooth o-smooth-ease", sized(size), long && "o-input-long", grows && "o-input-grow", className), style: start || style ? { ...start, ...style } : undefined, "data-kit": "input", ...phoneMark(phone), ...(force != null ? { "data-force": force } : {}), ...(look ? inputOwnAttrs(look) : {}), onMouseDown: (e) => {
105
+ return (_jsxs("span", { className: cx("o-input o-input-lone o-smooth o-smooth-ease", sized(size), long && "o-input-long", grows && "o-input-grow", className), style: start || style ? { ...start, ...style } : undefined, "data-kit": "input", ...phoneMark(phone), ...(force != null ? { "data-force": force } : {}), ...(look ? inputOwnAttrs(look) : {}), onMouseDown: (e) => {
105
106
  const box = own.current;
106
107
  if (e.target !== e.currentTarget || !box || box.disabled)
107
108
  return;
108
109
  e.preventDefault();
109
110
  box.focus();
110
- }, children: control({ className: cx("o-input-control", set && "o-input-lines", numeric && "o-input-num"), ...(most ? { style: most } : {}) }) }));
111
+ }, children: [control({ className: cx("o-input-control", set && "o-input-lines", numeric && "o-input-num"), ...(most ? { style: most } : {}), ...(saving ? { "aria-busy": true } : {}) }), _jsx(SaveMark, { saving: saving, saved: saved })] }));
111
112
  }
112
113
  return control({
113
114
  className: cx("o-input-control", set && "o-input-lines", numeric && "o-input-num", className),
@@ -117,11 +118,11 @@ export const Input = React.forwardRef(function Input({ size = "md", numeric = fa
117
118
  ...(bare && !fills ? { "data-fills": "off" } : {}),
118
119
  });
119
120
  });
120
- export function InputGroup({ size = "md", look: lookGiven, chrome, className, children, onMouseDown, ...props }) {
121
+ export function InputGroup({ size = "md", look: lookGiven, chrome, saving = false, saved = false, className, children, onMouseDown, ...props }) {
121
122
  const look = kindLook(chrome, lookGiven), phone = usePhoneForm();
122
123
  const tall = React.Children.toArray(children).some((c) => React.isValidElement(c)
123
124
  && ((c.type === Input && c.props.multiline) || (c.type === InputGroupAddon && (c.props.side === "top" || c.props.side === "bottom"))));
124
- return (_jsx(InGroup.Provider, { value: { size, cell: false, lines: look?.lines }, children: _jsx("div", { role: "group", className: cx("o-input o-input-group o-smooth o-smooth-ease", sized(size), tall && "o-input-long", className), ...phoneMark(phone), ...(look ? inputOwnAttrs(look) : {}), onMouseDown: (e) => { onMouseDown?.(e); pressGroup(e); }, ...props, children: children }) }));
125
+ return (_jsx(InGroup.Provider, { value: { size, cell: false, lines: look?.lines }, children: _jsxs("div", { role: "group", className: cx("o-input o-input-group o-smooth o-smooth-ease", sized(size), tall && "o-input-long", className), ...phoneMark(phone), ...(look ? inputOwnAttrs(look) : {}), onMouseDown: (e) => { onMouseDown?.(e); pressGroup(e); }, ...(saving ? { "aria-busy": true } : {}), ...props, children: [children, _jsx(SaveMark, { saving: saving, saved: saved })] }) }));
125
126
  }
126
127
  export function InputGroupAddon({ side = "start", flush = false, className, children, ...props }) {
127
128
  return _jsx("div", { "data-side": side, ...(flush ? { "data-flush": "" } : {}), className: cx("o-input-addon", className), ...props, children: children });
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export interface SaveMarkProps {
3
+ /** The app is saving: the Spinner. It wins over saved. */
4
+ saving?: boolean;
5
+ /** The save took: a check and Saved, for a moment. */
6
+ saved?: boolean;
7
+ }
8
+ export declare function SaveMark({ saving, saved }: SaveMarkProps): React.ReactElement | null;