@vokality/design-system 3.0.0 → 4.0.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 (61) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +24 -9
  3. package/bin/vokality-skill.mjs +68 -0
  4. package/dist/components/Alert/Alert.js +1 -1
  5. package/dist/components/AppShell/AppShell.js +4 -1
  6. package/dist/components/Button/Button.d.ts +2 -1
  7. package/dist/components/Button/Button.js +1 -1
  8. package/dist/components/ChatWidget/ChatWidget.js +1 -1
  9. package/dist/components/CommandPalette/CommandPalette.js +2 -2
  10. package/dist/components/ErrorSummary/ErrorSummary.js +3 -1
  11. package/dist/components/Fieldset/Fieldset.d.ts +2 -0
  12. package/dist/components/Fieldset/Fieldset.js +2 -2
  13. package/dist/components/FileUpload/FileUpload.js +1 -1
  14. package/dist/components/IconButton/IconButton.d.ts +2 -1
  15. package/dist/components/IconButton/IconButton.js +2 -2
  16. package/dist/components/Menu/Menu.d.ts +1 -2
  17. package/dist/components/Menu/Menu.js +7 -1
  18. package/dist/components/Popover/Popover.d.ts +1 -1
  19. package/dist/components/Popover/Popover.js +1 -1
  20. package/dist/components/Prose/Prose.d.ts +3 -1
  21. package/dist/components/Prose/Prose.js +2 -2
  22. package/dist/components/RichTextEditor/RichTextEditor.js +20 -7
  23. package/dist/components/SegmentedControl/SegmentedControl.d.ts +1 -1
  24. package/dist/components/SegmentedControl/SegmentedControl.js +1 -1
  25. package/dist/components/ThemeProvider/ThemeProvider.d.ts +13 -0
  26. package/dist/components/ThemeProvider/ThemeProvider.js +11 -0
  27. package/dist/components/TimePicker/TimePicker.js +3 -1
  28. package/dist/components/Toaster/Toaster.js +1 -1
  29. package/dist/components.css +54 -8
  30. package/dist/hooks/useTheme.d.ts +3 -2
  31. package/dist/hooks/useTheme.js +6 -4
  32. package/dist/index.d.ts +4 -4
  33. package/dist/index.js +2 -2
  34. package/dist/internal/ThemeOptionsProvider.d.ts +15 -0
  35. package/dist/internal/ThemeOptionsProvider.js +26 -0
  36. package/dist/internal/themeOptions.d.ts +3 -0
  37. package/dist/internal/themeOptions.js +4 -0
  38. package/dist/lib/theme.d.ts +5 -1
  39. package/dist/lib/theme.js +3 -2
  40. package/dist/tokens.css +1 -0
  41. package/dist/tokens.dtcg.json +5 -0
  42. package/dist/tokens.json +5 -0
  43. package/dist/vokality.css +55 -8
  44. package/dist/vokality.iife.js +483 -434
  45. package/docs/brand.md +2 -2
  46. package/docs/components/Button/README.md +4 -1
  47. package/docs/components/DatePicker/README.md +1 -1
  48. package/docs/components/Fieldset/README.md +3 -1
  49. package/docs/components/FileUpload/README.md +3 -2
  50. package/docs/components/Menu/README.md +3 -3
  51. package/docs/components/NavList/README.md +1 -1
  52. package/docs/components/Popover/README.md +1 -1
  53. package/docs/components/Prose/README.md +4 -0
  54. package/docs/components/RichTextEditor/README.md +1 -1
  55. package/docs/components/SegmentedControl/README.md +1 -1
  56. package/docs/components/{ThemeScript → ThemeProvider}/README.md +16 -11
  57. package/package.json +27 -12
  58. package/skills/vokality-design-system/SKILL.md +55 -0
  59. package/skills/vokality-design-system/references/examples.tsx +103 -0
  60. package/dist/components/ThemeScript/ThemeScript.d.ts +0 -7
  61. package/dist/components/ThemeScript/ThemeScript.js +0 -9
package/CHANGELOG.md CHANGED
@@ -2,6 +2,42 @@
2
2
 
3
3
  All notable changes to `@vokality/design-system`. The package follows [semantic versioning](https://semver.org); see CONTRIBUTING.md for what counts as breaking.
4
4
 
5
+ ## 4.0.0 — 2026-10-18
6
+
7
+ One way to do each thing.
8
+
9
+ ### Added
10
+ - `ThemeProvider`, the one place an app sets its theme and density: render it at the top of `<body>` in the root layout. It is server-safe, inlines the no-flash script before its children and gives every `useTheme()` below it the same options. `density="compact"` replaces setting `data-density` by hand.
11
+ - Extra-small actions: `size="xs"` on `Button`, `IconButton`, `Menu`, `Popover` and `SegmentedControl` for toolbars, record rows and status lines. 24px with fine pointers; coarse pointers keep 44px. New `control-height-xs` token.
12
+ - `Fieldset` `plain`: an unframed group whose legend lines up with the surrounding field labels.
13
+ - `Prose` `tone="foreground"` for rendered records and messages.
14
+ - Storybook is the design system's preview and documentation site (`bun run storybook`). Every component has stories beside its source: one per variant, size and state, with controls, interaction tests and its README as the docs page. The toolbar switches theme, density and viewport. `bun run test:stories` runs every story as a test with axe checks, and the visual comparison now covers every story in every theme.
15
+
16
+ ### Changed
17
+ - Compact density scales `Prose` to 14px text with 20px to 14px headings and tighter block spacing, and alert and toast titles to 14px.
18
+ - Fieldset legends use the field label style (uppercase, tracked, muted), so a group's name matches the fields beside it.
19
+
20
+ ### Fixed
21
+ Running every story in every theme and density with axe found these:
22
+ - Colour contrast: List and TreeView meta on selected rows, the NavList count on the current item, menu group labels and shortcuts (Menu, ContextMenu, Select, Combobox, CommandPalette), the CommandPalette footer, Field hints inside dialogs, drawers and popovers, the calendar inside the DatePicker popover, pressed RichTextEditor tools and the disabled FileUpload drop zone.
23
+ - AppShell's phone sidebar is a plain element while it is a modal dialog; `<aside>` may not take the dialog role.
24
+ - ErrorSummary titles have unique ids, so two summaries on a page name themselves correctly.
25
+ - CommandPalette points `aria-controls` only at a list that exists, and keeps its options current when two groups share a name.
26
+ - TimePicker keeps a typed time when Enter is pressed after the list opened.
27
+ - RichTextEditor no longer resets a controlled document to its own trimmed Markdown, which moved the cursor and dropped spaces while typing in the chat composer.
28
+
29
+ ### Changed (breaking)
30
+ - `ThemeScript` is removed; use `ThemeProvider`. `useTheme()` no longer takes options; it uses the provider's. `themeScript(options)` remains for pages not rendered by React and also sets `data-density` when `density` is `compact`.
31
+ - The claude.ai docs page and its `preview.html` cards are retired in favour of Storybook; `bun run preview`, `bun run artifact` and `bun run verify:docs` are removed. Visual baselines are rendered only in the pinned CI container, which `bun run test:visual` uses on workstations too.
32
+ - `IconButton` `size` is now the control size (`"xs"`), like every other action; the glyph size follows the system.
33
+
34
+ ## 3.0.1 — 2026-10-17
35
+
36
+ ### Added
37
+ - A bundled `vokality-design-system` Agent Skill with version-matched guidance for composing the existing React components, Radix contracts, tokens, localization, Markdown editing, chat and reduced motion.
38
+ - An explicit `vokality-skill` command to link the installed skill into a consuming project’s `.agents/skills` directory without overwriting existing skills. Package installation does not register skills automatically.
39
+ - Packed-package checks for the skill, its referenced documentation and typed usage examples, plus setup, upgrade and collision handling.
40
+
5
41
  ## 3.0.0 — 2026-10-17
6
42
 
7
43
  ### Added
package/README.md CHANGED
@@ -64,17 +64,16 @@ Set `data-theme` on `<html>`, or on any element to theme a subtree:
64
64
  | `light` | Documents, long reading, print, or where people prefer it. |
65
65
  | `contrast` | High contrast (AAA), offered as a setting. |
66
66
 
67
- To follow the system until the person picks a theme, without a flash of the wrong one, put `ThemeScript` in `<head>` and switch with `useTheme`:
67
+ Every app sets its theme and density in one place: `ThemeProvider`, at the top of `<body>` in the root layout. It applies the saved or system theme before the page paints, and every `useTheme()` below it shares its options:
68
68
 
69
69
  ```tsx
70
70
  // app/layout.tsx
71
- import { ThemeScript } from "@vokality/design-system";
71
+ import { ThemeProvider } from "@vokality/design-system";
72
72
 
73
73
  export default function RootLayout({ children }: { children: React.ReactNode }) {
74
74
  return (
75
75
  <html lang="en" suppressHydrationWarning>
76
- <head><ThemeScript /></head>
77
- <body>{children}</body>
76
+ <body><ThemeProvider storageKey="app.theme">{children}</ThemeProvider></body>
78
77
  </html>
79
78
  );
80
79
  }
@@ -84,11 +83,13 @@ export default function RootLayout({ children }: { children: React.ReactNode })
84
83
  const { theme, resolvedTheme, setTheme } = useTheme(); // theme: "system" | "dark" | "light" | "contrast"
85
84
  ```
86
85
 
87
- Pages not rendered by React can inline `themeScript()` instead. See `docs/components/ThemeScript/README.md`.
86
+ Pages not rendered by React can inline `themeScript()` instead. See `docs/components/ThemeProvider/README.md`.
88
87
 
89
88
  ## Compact applications
90
89
 
91
- Set `<html data-density="compact">` for dense operational interfaces. It uses 20px page titles, 16px section titles, 14px body text and 24px statistics, never enlarges smaller text, and tightens table cells, list and navigation rows, menus and cards. Page-header actions align with the title; headers leave section spacing to `Stack` instead of adding another margin. With only a fine pointer, buttons and fields share a 32px height and inputs use 14px text; when a coarse pointer is available they keep 44px targets and 16px input text, which stops iOS zooming on focus. Density redefines the control tokens (`--control-height`, `--control-font-size`, `--control-padding-block`) and the button heights, so components that size from them follow it while component-specific sizes still apply. Apply density to `html` so portalled dialogs and menus inherit it; a subtree with the attribute also works. Omitting the attribute preserves the existing defaults.
90
+ Pass `density="compact"` to `ThemeProvider` for dense operational interfaces. It uses 20px page titles, 16px section titles, 14px body text and 24px statistics, never enlarges smaller text, and tightens table cells, list and navigation rows, menus and cards. Page-header actions align with the title; headers leave section spacing to `Stack` instead of adding another margin. With only a fine pointer, buttons and fields share a 32px height and inputs use 14px text; when a coarse pointer is available they keep 44px targets and 16px input text, which stops iOS zooming on focus. Density redefines the control tokens (`--control-height`, `--control-font-size`, `--control-padding-block`) and the button heights, so components that size from them follow it while component-specific sizes still apply. The provider sets it on `html`, so portalled dialogs and menus inherit it. Without it the defaults apply. Prose follows the compact scale (14px text, headings from 20px), and alert and toast titles use 14px.
91
+
92
+ For toolbars, record rows and status lines, `size="xs"` on `Button`, `IconButton`, `Menu`, `Popover` and `SegmentedControl` gives 24px actions with 11px labels. Fields keep the control height, so forms stay readable. Extra-small sizes apply with fine pointers only; a coarse pointer keeps the 44px target. The `--control-height-xs` token holds the height.
92
93
 
93
94
  Compose pages with `Stack`, `Inline` and `Grid`; these forward standard attributes and events typed for the element they render, including `Inline as="form" onSubmit={...}`. Use `Fieldset` for related controls, `Button variant="text"` for record names, and `Text numeric overflowWrap="anywhere"` for long identifiers.
94
95
 
@@ -169,6 +170,20 @@ The design guide and every component's page ship with the package, so they match
169
170
  - `node_modules/@vokality/design-system/docs/brand.md`: principles, color, type, layout, writing.
170
171
  - `node_modules/@vokality/design-system/docs/components/<Name>/README.md`: anatomy, states, props, accessibility and rules for each component.
171
172
 
173
+ ## Agent skill
174
+
175
+ The package includes a standard [Agent Skill](https://agentskills.io/specification) with version-matched integration guidance. After installing the package, run this **once from your consuming project root** to register it for Codex:
176
+
177
+ ```sh
178
+ bun run vokality-skill
179
+ ```
180
+
181
+ The opt-in command creates `.agents/skills/vokality-design-system` as a link to the installed package’s `skills/vokality-design-system` directory. It follows the logical `node_modules` path, including hoisted workspace dependencies, so package upgrades update the guidance without copying it. Use `bun run vokality-skill --project <project-root>` to select a project explicitly. Existing files or other skills are never replaced. Installation itself runs no skill setup and changes no agent instructions.
182
+
183
+ Codex supports [project-local and symlinked skills](https://learn.chatgpt.com/docs/build-skills). It can select this skill when relevant, or you can invoke `$vokality-design-system`. For another Agent Skills-compatible tool, register the same bundled folder using that tool’s documented discovery location. The skill points to the shipped component docs, tokens and declarations; those remain the API source of truth. It does not install checks or enforce application code automatically.
184
+
185
+ On Unix, the relative link can be committed when the team shares the dependency layout. On Windows the command uses a directory junction; keep that machine-local path untracked. Remove the link to unregister the skill; do not remove its target in `node_modules`.
186
+
172
187
  ## Develop
173
188
 
174
189
  ```sh
@@ -178,10 +193,10 @@ bun run test:browser # keyboard, focus and overlay behaviour in headless Chrom
178
193
  bun run typecheck # the declarations against test/types-usage.tsx
179
194
  bun run lint # strict type-aware TypeScript and React/Hooks rules
180
195
  bun run doctor # full production-source React Doctor scan
181
- bun run test:visual # compare all theme previews against reviewed image baselines
196
+ bun run storybook # every component, story and docs page, with theme, density and viewport switches
197
+ bun run test:stories # every story renders, passes axe and its play function
198
+ bun run test:visual # compare every story in every theme with its reviewed image (in the CI container)
182
199
  bun run test:next # production Next.js App Router consumer and hydration checks
183
- bun run preview --theme=light # render every docs/components preview; screenshots in artifact/shots
184
- bun run artifact # build the claude.ai docs page in artifact/ (see "The docs page" in CONTRIBUTING.md)
185
200
  ```
186
201
 
187
202
  See [CONTRIBUTING.md](CONTRIBUTING.md) before adding tokens or components, and [CHANGELOG.md](CHANGELOG.md) for releases.
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ import { access, lstat, mkdir, readFile, readlink, realpath, symlink } from "node:fs/promises";
3
+ import { dirname, join, relative, resolve } from "node:path";
4
+
5
+ const skillName = "vokality-design-system";
6
+ const usage = "Usage: vokality-skill [--project <project-root>]\nLinks the installed package skill into .agents/skills/vokality-design-system.\nRun explicitly from a project with package.json; existing skills are never replaced.";
7
+
8
+ async function installedSkill(project) {
9
+ for (let directory = project; ; directory = dirname(directory)) {
10
+ const packageRoot = join(directory, "node_modules", "@vokality", "design-system");
11
+ let manifest;
12
+ try {
13
+ manifest = JSON.parse(await readFile(join(packageRoot, "package.json"), "utf8"));
14
+ } catch (error) {
15
+ if (error.code !== "ENOENT") throw error;
16
+ if (dirname(directory) === directory) break;
17
+ continue;
18
+ }
19
+ if (manifest?.name !== "@vokality/design-system" || typeof manifest.version !== "string") {
20
+ throw new Error(`Invalid design-system package at ${packageRoot}`);
21
+ }
22
+ const target = join(packageRoot, "skills", skillName);
23
+ await access(join(target, "SKILL.md")).catch(() => {
24
+ throw new Error(`The installed @vokality/design-system@${manifest.version} has no bundled skill. Upgrade the package first.`);
25
+ });
26
+ return { target, version: manifest.version };
27
+ }
28
+ throw new Error("Install @vokality/design-system in this project before linking its skill.");
29
+ }
30
+
31
+ async function main() {
32
+ const args = process.argv.slice(2);
33
+ if (args.length === 1 && ["--help", "-h"].includes(args[0])) {
34
+ console.log(usage);
35
+ return;
36
+ }
37
+ if (args.length !== 0 && (args.length !== 2 || args[0] !== "--project" || !args[1] || args[1].startsWith("--"))) {
38
+ throw new Error(usage);
39
+ }
40
+ const project = resolve(args[1] ?? process.cwd());
41
+ await access(join(project, "package.json")).catch(() => {
42
+ throw new Error(`No package.json at ${project}. Run from the project root or pass --project <project-root>.`);
43
+ });
44
+ const { target, version } = await installedSkill(project);
45
+ const destination = join(project, ".agents", "skills", skillName);
46
+ await mkdir(dirname(destination), { recursive: true });
47
+ const physicalParent = await realpath(dirname(destination));
48
+ const existing = await lstat(destination).catch((error) => {
49
+ if (error.code === "ENOENT") return null;
50
+ throw error;
51
+ });
52
+ if (existing) {
53
+ if (!existing.isSymbolicLink() || resolve(physicalParent, await readlink(destination)) !== target) {
54
+ throw new Error(`A different skill already exists at ${destination}. Move it yourself before linking; nothing was replaced.`);
55
+ }
56
+ console.log(`Already linked @vokality/design-system@${version}: ${destination}`);
57
+ return;
58
+ }
59
+ // Keep the logical node_modules path: package-manager store paths change on upgrades.
60
+ const linkTarget = process.platform === "win32" ? target : relative(physicalParent, target);
61
+ await symlink(linkTarget, destination, process.platform === "win32" ? "junction" : "dir");
62
+ console.log(`Linked @vokality/design-system@${version}: ${destination}`);
63
+ }
64
+
65
+ main().catch((error) => {
66
+ console.error(error.message);
67
+ process.exitCode = 1;
68
+ });
@@ -11,5 +11,5 @@ export function Alert({ status: statusProp, title, children, action, onDismiss,
11
11
  const status = statusProp || "info";
12
12
  // Live alerts announce themselves: urgently for danger and warning, politely otherwise.
13
13
  const role = live ? (status === "danger" || status === "warning" ? "alert" : "status") : undefined;
14
- return (_jsxs("div", { className: cx("vk-alert", "vk-alert-" + status, className), role: role, children: [_jsx(Icon, { name: STATUS_ICON[status], size: 18, className: "vk-alert-icon" }), _jsxs("div", { className: "vk-alert-body", children: [_jsx("span", { className: "vk-sr-only", children: statusWord(status, messages) + ": " }), title ? _jsx("p", { className: "vk-alert-title", children: title }) : null, children ? _jsx("div", { className: "vk-alert-text", children: children }) : null, action ? _jsx("div", { className: "vk-alert-action", children: action }) : null] }), onDismiss ? _jsx(IconButton, { icon: "x", size: 16, label: dismissLabel || messages.dismiss, className: "vk-alert-close", onClick: onDismiss }) : null] }));
14
+ return (_jsxs("div", { className: cx("vk-alert", "vk-alert-" + status, className), role: role, children: [_jsx(Icon, { name: STATUS_ICON[status], size: 18, className: "vk-alert-icon" }), _jsxs("div", { className: "vk-alert-body", children: [_jsx("span", { className: "vk-sr-only", children: statusWord(status, messages) + ": " }), title ? _jsx("p", { className: "vk-alert-title", children: title }) : null, children ? _jsx("div", { className: "vk-alert-text", children: children }) : null, action ? _jsx("div", { className: "vk-alert-action", children: action }) : null] }), onDismiss ? _jsx(IconButton, { icon: "x", label: dismissLabel || messages.dismiss, className: "vk-alert-close", onClick: onDismiss }) : null] }));
15
15
  }
@@ -36,7 +36,10 @@ function ShellTopbar(props) {
36
36
  return (_jsxs("header", { className: "vk-shell-topbar", children: [_jsx(Primitive.Trigger, { className: "vk-icon-btn vk-icon-btn-ghost vk-shell-menu", "aria-label": props.menuLabel || messages.menu, "aria-controls": sidebarId, children: _jsx(Icon, { name: mobileOpen ? "x" : "menu" }) }), _jsx("button", { type: "button", className: "vk-icon-btn vk-icon-btn-ghost vk-shell-collapse", "aria-label": collapseLabel, "aria-expanded": collapsed ? "false" : "true", "aria-controls": sidebarId, title: collapseLabel, onClick: props.onToggleCollapsed, children: _jsx(Icon, { name: "sidebar" }) }), _jsx("div", { className: "vk-shell-brand", children: props.brand }), props.search ? _jsx("div", { className: "vk-shell-search", children: props.search }) : null, _jsx("div", { className: "vk-shell-actions", children: props.actions })] }));
37
37
  }
38
38
  function ShellSidebar({ id, modal, label, footer, children }) {
39
- const aside = (_jsxs("aside", { id: id, className: "vk-shell-sidebar", "aria-label": label, children: [children, footer ? _jsx("div", { className: "vk-shell-sidebar-footer", children: footer }) : null] }));
39
+ // A complementary landmark at rest; while it is a modal dialog it is a plain element, since <aside>
40
+ // may not take the dialog role.
41
+ const Tag = modal ? "div" : "aside";
42
+ const aside = (_jsxs(Tag, { id: id, className: "vk-shell-sidebar", "aria-label": label, children: [children, footer ? _jsx("div", { className: "vk-shell-sidebar-footer", children: footer }) : null] }));
40
43
  if (!modal)
41
44
  return aside;
42
45
  // Open on a small screen: the same sidebar as a modal dialog, in place (no portal) so it stays inside the shell.
@@ -2,7 +2,8 @@ import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ReactNode }
2
2
  export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement> & AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> {
3
3
  /** Visual emphasis; text keeps record names in sentence case. */
4
4
  variant?: 'primary' | 'outline' | 'ghost' | 'danger' | 'text';
5
- size?: 'sm';
5
+ /** sm for dense screens; xs for toolbars, record rows and status lines (24px on fine pointers, 44px on touch). */
6
+ size?: 'sm' | 'xs';
6
7
  href?: string;
7
8
  /** Disables the button, sets aria-busy and shows a spinner. */
8
9
  loading?: boolean;
@@ -8,7 +8,7 @@ import { omit } from "../../lib/omit.js";
8
8
  export const Button = forwardRef(function Button(props, ref) {
9
9
  const variant = props.variant || "primary";
10
10
  const rest = omit(props, ["variant", "size", "href", "arrow", "children", "className", "loading", "loadingLabel", "block"]);
11
- const className = cx("vk-btn", "vk-btn-" + variant, props.size === "sm" && "vk-btn-sm", props.block && "vk-btn-block", props.loading && "vk-btn-loading", props.className);
11
+ const className = cx("vk-btn", "vk-btn-" + variant, props.size === "sm" && "vk-btn-sm", props.size === "xs" && "vk-btn-xs", props.block && "vk-btn-block", props.loading && "vk-btn-loading", props.className);
12
12
  const kids = [
13
13
  _jsxs("span", { className: "vk-btn-label", children: [props.loading ? _jsx("span", { className: "vk-spinner vk-btn-spinner", "aria-hidden": "true" }) : null, props.loading && props.loadingLabel ? props.loadingLabel : props.children] }, "l"),
14
14
  ];
@@ -38,5 +38,5 @@ export function ChatWidget({ title, description, align = "end", triggerLabel, un
38
38
  const titleId = useUid("vk-chat-title");
39
39
  const unread = unreadCount && unreadCount > 0 ? messages.chat.unread(unreadCount) : "";
40
40
  const label = (triggerLabel || messages.chat.open) + (unread ? ", " + unread : "");
41
- return (_jsx(LazyMotion, { features: domAnimation, children: _jsxs(Primitive.Root, { open: disclosure.open, onOpenChange: disclosure.change, modal: modal, children: [_jsxs("div", { className: cx("vk-chat-widget-launcher", "vk-chat-widget-" + align, className), children: [_jsx(Primitive.Trigger, { asChild: true, children: _jsx(MotionIconButton, { icon: "message-circle", size: 24, label: label, variant: "outline", className: "vk-chat-widget-trigger", whileHover: reducedMotion ? undefined : { scale: 1.03 }, whileTap: reducedMotion ? undefined : { scale: 0.97 }, transition: { duration: reducedMotion ? 0 : 0.12 } }) }), unreadCount && unreadCount > 0 ? _jsx("span", { className: "vk-chat-unread", "aria-hidden": "true", children: formatNumber(unreadCount, { locale }) }) : null] }), _jsx(AnimatePresence, { initial: false, children: disclosure.open ? _jsx(WidgetContent, { title: title, description: description, align: align, titleId: titleId, panel: panel }) : null })] }) }));
41
+ return (_jsx(LazyMotion, { features: domAnimation, children: _jsxs(Primitive.Root, { open: disclosure.open, onOpenChange: disclosure.change, modal: modal, children: [_jsxs("div", { className: cx("vk-chat-widget-launcher", "vk-chat-widget-" + align, className), children: [_jsx(Primitive.Trigger, { asChild: true, children: _jsx(MotionIconButton, { icon: "message-circle", label: label, variant: "outline", className: "vk-chat-widget-trigger", whileHover: reducedMotion ? undefined : { scale: 1.03 }, whileTap: reducedMotion ? undefined : { scale: 0.97 }, transition: { duration: reducedMotion ? 0 : 0.12 } }) }), unreadCount && unreadCount > 0 ? _jsx("span", { className: "vk-chat-unread", "aria-hidden": "true", children: formatNumber(unreadCount, { locale }) }) : null] }), _jsx(AnimatePresence, { initial: false, children: disclosure.open ? _jsx(WidgetContent, { title: title, description: description, align: align, titleId: titleId, panel: panel }) : null })] }) }));
42
42
  }
@@ -83,7 +83,7 @@ function PaletteSearch({ uid, commands, placeholder, emptyText, close }) {
83
83
  else
84
84
  groups.push({ name: g, items: [{ c, i }] });
85
85
  });
86
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "vk-cmd-search", children: [_jsx(Icon, { name: "search", size: 16, className: "vk-search-icon" }), _jsx("input", { id: uid + "-search", type: "text", role: "combobox", className: "vk-input vk-search-input", placeholder: placeholder || messages.commandSearch, autoComplete: "off", value: query, "aria-expanded": "true", "aria-controls": uid + "-list", "aria-activedescendant": cmds.length ? uid + "-" + String(active) : undefined, "aria-autocomplete": "list", onChange: (e) => { setQuery(e.target.value); setActive(0); }, onKeyDown: (e) => {
86
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "vk-cmd-search", children: [_jsx(Icon, { name: "search", size: 16, className: "vk-search-icon" }), _jsx("input", { id: uid + "-search", type: "text", role: "combobox", className: "vk-input vk-search-input", placeholder: placeholder || messages.commandSearch, autoComplete: "off", value: query, "aria-expanded": cmds.length > 0, "aria-controls": cmds.length ? uid + "-list" : undefined, "aria-activedescendant": cmds.length ? uid + "-" + String(active) : undefined, "aria-autocomplete": "list", onChange: (e) => { setQuery(e.target.value); setActive(0); }, onKeyDown: (e) => {
87
87
  if (e.key === "ArrowDown") {
88
88
  e.preventDefault();
89
89
  setActive(Math.min(cmds.length - 1, active + 1));
@@ -100,6 +100,6 @@ function PaletteSearch({ uid, commands, placeholder, emptyText, close }) {
100
100
  ? (_jsx("div", { ref: listRef, id: uid + "-list", role: "listbox", "aria-label": messages.commands, className: "vk-cmd-list", children: groups.map((g) => (_jsxs("div", { role: "group", "aria-label": g.name || undefined, children: [g.name ? _jsx("div", { className: "vk-menu-label", "aria-hidden": "true", children: g.name }) : null, g.items.map(({ c, i }) => (_jsxs("div", { id: uid + "-" + String(i), "data-index": i, role: "option", "aria-selected": i === active ? "true" : "false", "aria-disabled": c.disabled ? "true" : undefined, className: cx("vk-menu-item", "vk-cmd-item", i === active ? "vk-cmd-item-active" : null), onMouseMove: () => { if (active !== i)
101
101
  setActive(i); },
102
102
  // Keep focus in the search box while clicking a command.
103
- onMouseDown: (e) => { e.preventDefault(); }, onClick: () => { run(c); }, children: [c.icon ? _jsx(Icon, { name: c.icon, size: 16, className: "vk-menu-item-icon" }) : _jsx("span", { className: "vk-menu-item-icon" }), _jsx("span", { className: "vk-menu-item-label", children: highlight(c.label, query) }), c.shortcut ? _jsx("kbd", { className: "vk-menu-shortcut", children: c.shortcut }) : null] }, c.id || c.label)))] }, g.name || "_"))) }))
103
+ onMouseDown: (e) => { e.preventDefault(); }, onClick: () => { run(c); }, children: [c.icon ? _jsx(Icon, { name: c.icon, size: 16, className: "vk-menu-item-icon" }) : _jsx("span", { className: "vk-menu-item-icon" }), _jsx("span", { className: "vk-menu-item-label", children: highlight(c.label, query) }), c.shortcut ? _jsx("kbd", { className: "vk-menu-shortcut", children: c.shortcut }) : null] }, c.id || c.label)))] }, String(g.items[0]?.i) + ":" + g.name))) }))
104
104
  : _jsx("p", { className: "vk-select-empty", role: "status", children: emptyText || messages.noCommands(query) })] }));
105
105
  }
@@ -3,10 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useLocale } from "../../localization.js";
4
4
  import { useEffect, useRef } from "react";
5
5
  import { Icon } from "../Icon/Icon.js";
6
+ import { useUid } from "../../internal/useUid.js";
6
7
  /** A form's problems at the top of the form after a failed submit; each item links to its field. */
7
8
  export function ErrorSummary(props) {
8
9
  const { messages } = useLocale();
9
10
  const ref = useRef(null);
11
+ const titleId = useUid("vk-errsum-title");
10
12
  const errors = props.errors;
11
13
  // Focus follows a change in the number of errors, not a change of autoFocus: the effect reads the latest value.
12
14
  const autoFocusRef = useRef(props.autoFocus);
@@ -18,7 +20,7 @@ export function ErrorSummary(props) {
18
20
  if (!errors.length)
19
21
  return null;
20
22
  const title = props.title || messages.fixProblems(errors.length);
21
- return (_jsxs("div", { ref: ref, tabIndex: -1, role: "alert", className: "vk-alert vk-alert-danger vk-error-summary", "aria-labelledby": "vk-errsum-title", children: [_jsx(Icon, { name: "circle-alert", size: 18, className: "vk-alert-icon" }), _jsxs("div", { className: "vk-alert-body", children: [_jsx("p", { id: "vk-errsum-title", className: "vk-alert-title", children: title }), _jsx("ul", { className: "vk-error-summary-list", children: errors.map(({ field, message }) => (_jsx("li", { children: field ? (_jsx("a", { href: "#" + field, className: "vk-link", onClick: (ev) => {
23
+ return (_jsxs("div", { ref: ref, tabIndex: -1, role: "alert", className: "vk-alert vk-alert-danger vk-error-summary", "aria-labelledby": titleId, children: [_jsx(Icon, { name: "circle-alert", size: 18, className: "vk-alert-icon" }), _jsxs("div", { className: "vk-alert-body", children: [_jsx("p", { id: titleId, className: "vk-alert-title", children: title }), _jsx("ul", { className: "vk-error-summary-list", children: errors.map(({ field, message }) => (_jsx("li", { children: field ? (_jsx("a", { href: "#" + field, className: "vk-link", onClick: (ev) => {
22
24
  const el = document.getElementById(field);
23
25
  if (el) {
24
26
  ev.preventDefault();
@@ -6,6 +6,8 @@ export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElemen
6
6
  hint?: ReactNode;
7
7
  /** Validation message applying to the entire group. */
8
8
  error?: ReactNode;
9
+ /** No frame: the group reads as part of the surrounding form, with its legend as a field label. */
10
+ plain?: boolean;
9
11
  }
10
12
  /** Groups related controls with a native legend and shared instructions. */
11
13
  export declare const Fieldset: import("react").ForwardRefExoticComponent<FieldsetProps & import("react").RefAttributes<HTMLFieldSetElement>>;
@@ -5,8 +5,8 @@ import { describedBy } from "../../internal/describedBy.js";
5
5
  import { useUid } from "../../internal/useUid.js";
6
6
  import { cx } from "../../lib/cx.js";
7
7
  /** Groups related controls with a native legend and shared instructions. */
8
- export const Fieldset = forwardRef(function Fieldset({ legend, hint, error, children, className, id, "aria-describedby": existing, ...rest }, ref) {
8
+ export const Fieldset = forwardRef(function Fieldset({ legend, hint, error, plain, children, className, id, "aria-describedby": existing, ...rest }, ref) {
9
9
  const uid = useUid("vk-fieldset");
10
10
  const groupId = id || uid;
11
- return (_jsxs("fieldset", { ref: ref, id: groupId, className: cx("vk-fieldset", className), "aria-describedby": describedBy(groupId, hint, error, existing), "aria-invalid": error ? true : undefined, ...rest, children: [_jsx("legend", { className: "vk-fieldset-legend", children: legend }), hint ? _jsx("p", { className: "vk-field-hint vk-fieldset-hint", id: groupId + "-hint", children: hint }) : null, _jsx("div", { className: "vk-fieldset-controls", children: children }), error ? _jsx("p", { className: "vk-field-error vk-fieldset-error", id: groupId + "-error", children: error }) : null] }));
11
+ return (_jsxs("fieldset", { ref: ref, id: groupId, className: cx("vk-fieldset", plain && "vk-fieldset-plain", className), "aria-describedby": describedBy(groupId, hint, error, existing), "aria-invalid": error ? true : undefined, ...rest, children: [_jsx("legend", { className: "vk-fieldset-legend", children: legend }), hint ? _jsx("p", { className: "vk-field-hint vk-fieldset-hint", id: groupId + "-hint", children: hint }) : null, _jsx("div", { className: "vk-fieldset-controls", children: children }), error ? _jsx("p", { className: "vk-field-error vk-fieldset-error", id: groupId + "-error", children: error }) : null] }));
12
12
  });
@@ -51,5 +51,5 @@ export function FileUpload(props) {
51
51
  accept(chosen);
52
52
  // Clear it so choosing the same file again still fires onChange.
53
53
  e.target.value = "";
54
- } })] }), files.length ? (_jsx("ul", { className: "vk-upload-list", children: files.map((f, i) => (_jsxs("li", { className: cx("vk-upload-item", f.error && "vk-upload-item-error"), children: [_jsx(Icon, { name: f.error ? "circle-alert" : "file", size: 16, className: "vk-upload-icon" }), _jsx("span", { className: "vk-upload-name", children: f.name }), f.error ? _jsx("span", { className: "vk-upload-error", children: f.file && props.maxSize && f.size > props.maxSize ? messages.fileTooLarge(sizeLabel(props.maxSize)) : f.error }) : _jsx("span", { className: "vk-upload-size", children: sizeLabel(f.size) }), _jsx(IconButton, { icon: "x", size: 16, label: messages.remove(f.name), onClick: () => { remove(i); } })] }, f.name + String(i)))) })) : null] }));
54
+ } })] }), files.length ? (_jsx("ul", { className: "vk-upload-list", children: files.map((f, i) => (_jsxs("li", { className: cx("vk-upload-item", f.error && "vk-upload-item-error"), children: [_jsx(Icon, { name: f.error ? "circle-alert" : "file", size: 16, className: "vk-upload-icon" }), _jsx("span", { className: "vk-upload-name", children: f.name }), f.error ? _jsx("span", { className: "vk-upload-error", children: f.file && props.maxSize && f.size > props.maxSize ? messages.fileTooLarge(sizeLabel(props.maxSize)) : f.error }) : _jsx("span", { className: "vk-upload-size", children: sizeLabel(f.size) }), _jsx(IconButton, { icon: "x", label: messages.remove(f.name), onClick: () => { remove(i); } })] }, f.name + String(i)))) })) : null] }));
55
55
  }
@@ -4,7 +4,8 @@ export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonEle
4
4
  icon: IconName;
5
5
  label: string;
6
6
  variant?: 'ghost' | 'outline';
7
- size?: number;
7
+ /** xs for toolbars, record rows and status lines (24px on fine pointers, 44px on touch). */
8
+ size?: 'xs';
8
9
  href?: string;
9
10
  }
10
11
  /** Square icon-only button; label becomes aria-label and tooltip. */
@@ -7,8 +7,8 @@ import { omit } from "../../lib/omit.js";
7
7
  /** Square icon-only button; label becomes aria-label and tooltip. */
8
8
  export const IconButton = forwardRef(function IconButton(props, ref) {
9
9
  const rest = omit(props, ["icon", "label", "variant", "href", "size", "className"]);
10
- const className = cx("vk-icon-btn", "vk-icon-btn-" + (props.variant || "ghost"), props.className);
11
- const glyph = _jsx(Icon, { name: props.icon, size: props.size });
10
+ const className = cx("vk-icon-btn", "vk-icon-btn-" + (props.variant || "ghost"), props.size === "xs" && "vk-icon-btn-xs", props.className);
11
+ const glyph = _jsx(Icon, { name: props.icon });
12
12
  if (props.href) {
13
13
  return (_jsx(Anchor, { ref: ref, href: props.href, className: className, "aria-label": props.label, title: props.label, ...rest, children: glyph }));
14
14
  }
@@ -5,10 +5,9 @@ export interface MenuProps {
5
5
  icon?: IconName;
6
6
  triggerLabel?: string;
7
7
  variant?: 'outline' | 'ghost' | 'primary';
8
- size?: 'sm';
8
+ size?: 'sm' | 'xs';
9
9
  align?: 'start' | 'end';
10
10
  disabled?: boolean;
11
11
  className?: string;
12
12
  }
13
- /** Menu button (WAI-ARIA), built on Radix DropdownMenu. */
14
13
  export declare function Menu({ items, label, icon, triggerLabel, variant, size, align, disabled, className }: MenuProps): import("react/jsx-runtime").JSX.Element;
@@ -6,11 +6,17 @@ import { Icon } from "../Icon/Icon.js";
6
6
  import { cx } from "../../lib/cx.js";
7
7
  import { MenuEntries } from "./entries.js";
8
8
  /** Menu button (WAI-ARIA), built on Radix DropdownMenu. */
9
+ /** An icon button when the trigger has only an icon, else a labelled button; both follow size. */
10
+ function triggerClass(iconOnly, variant, size) {
11
+ return iconOnly
12
+ ? cx("vk-icon-btn", "vk-icon-btn-" + (variant || "ghost"), size === "xs" && "vk-icon-btn-xs")
13
+ : cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" && "vk-btn-sm", size === "xs" && "vk-btn-xs");
14
+ }
9
15
  export function Menu({ items, label, icon, triggerLabel, variant, size, align, disabled, className }) {
10
16
  const { messages } = useLocale();
11
17
  // An icon with no label makes an icon button, named by triggerLabel.
12
18
  const iconOnly = label ? undefined : icon;
13
- return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { children: [_jsx(Primitive.Trigger, { disabled: disabled, className: iconOnly ? "vk-icon-btn vk-icon-btn-" + (variant || "ghost") : cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" ? "vk-btn-sm" : null), "aria-label": iconOnly ? triggerLabel || messages.moreActions : undefined, title: iconOnly ? triggerLabel || messages.moreActions : undefined, children: iconOnly
19
+ return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { children: [_jsx(Primitive.Trigger, { disabled: disabled, className: triggerClass(Boolean(iconOnly), variant, size), "aria-label": iconOnly ? triggerLabel || messages.moreActions : undefined, title: iconOnly ? triggerLabel || messages.moreActions : undefined, children: iconOnly
14
20
  ? _jsx(Icon, { name: iconOnly })
15
21
  : _jsxs(_Fragment, { children: [_jsxs("span", { className: "vk-btn-label", children: [icon ? _jsx(Icon, { name: icon, size: 16, className: "vk-menu-trigger-icon" }) : null, label] }), _jsx("span", { className: "vk-btn-glyph", "aria-hidden": "true", children: _jsx(Icon, { name: "chevron-down", size: 14 }) })] }) }), _jsx(Primitive.Portal, { children: _jsx(Primitive.Content, { className: "vk-menu", side: "bottom", align: align === "end" ? "end" : "start", sideOffset: 4, collisionPadding: 8, children: _jsx(MenuEntries, { parts: Primitive, items: items }) }) })] }) }));
16
22
  }
@@ -6,7 +6,7 @@ export interface PopoverProps extends Pick<Primitive.PopoverProps, 'open' | 'def
6
6
  title?: string;
7
7
  icon?: IconName;
8
8
  variant?: 'outline' | 'ghost' | 'primary';
9
- size?: 'sm';
9
+ size?: 'sm' | 'xs';
10
10
  align?: 'start' | 'end';
11
11
  width?: string;
12
12
  children: ReactNode;
@@ -5,5 +5,5 @@ import { Icon } from "../Icon/Icon.js";
5
5
  import { cx } from "../../lib/cx.js";
6
6
  /** Non-modal panel attached to a button (Radix Popover). */
7
7
  export function Popover({ label, title, icon, variant, size, align, width, open, defaultOpen, onOpenChange, modal, children, close, className }) {
8
- return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, modal: modal, children: [_jsxs(Primitive.Trigger, { className: cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" ? "vk-btn-sm" : null), children: [_jsxs("span", { className: "vk-btn-label", children: [icon ? _jsx(Icon, { name: icon, size: 16, className: "vk-menu-trigger-icon" }) : null, label] }), _jsx("span", { className: "vk-btn-glyph", "aria-hidden": "true", children: _jsx(Icon, { name: "chevron-down", size: 14 }) })] }), _jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { "aria-label": title || label, className: "vk-popover vk-popover-panel", side: "bottom", align: align === "end" ? "end" : "start", sideOffset: 4, collisionPadding: 8, style: width ? { width } : undefined, children: [title ? _jsx("p", { className: "vk-popover-title", children: title }) : null, children, close ? _jsx("div", { className: "vk-popover-footer", children: _jsx(Primitive.Close, { asChild: true, children: close }) }) : null] }) })] }) }));
8
+ return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, modal: modal, children: [_jsxs(Primitive.Trigger, { className: cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" ? "vk-btn-sm" : size === "xs" ? "vk-btn-xs" : null), children: [_jsxs("span", { className: "vk-btn-label", children: [icon ? _jsx(Icon, { name: icon, size: 16, className: "vk-menu-trigger-icon" }) : null, label] }), _jsx("span", { className: "vk-btn-glyph", "aria-hidden": "true", children: _jsx(Icon, { name: "chevron-down", size: 14 }) })] }), _jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { "aria-label": title || label, className: "vk-popover vk-popover-panel", side: "bottom", align: align === "end" ? "end" : "start", sideOffset: 4, collisionPadding: 8, style: width ? { width } : undefined, children: [title ? _jsx("p", { className: "vk-popover-title", children: title }) : null, children, close ? _jsx("div", { className: "vk-popover-footer", children: _jsx(Primitive.Close, { asChild: true, children: close }) }) : null] }) })] }) }));
9
9
  }
@@ -3,6 +3,8 @@ import type { AsProp } from "../../types.js";
3
3
  export interface ProseProps extends AsProp {
4
4
  children?: ReactNode;
5
5
  className?: string;
6
+ /** muted (default) for articles and release notes; foreground when the text is the record itself, such as a task description or a message. */
7
+ tone?: "muted" | "foreground";
6
8
  }
7
9
  /** Styles long-form HTML (help articles, release notes, rendered Markdown) without a class on every element. */
8
- export declare function Prose({ as, children, className }: ProseProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function Prose({ as, children, className, tone }: ProseProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cx } from "../../lib/cx.js";
3
3
  /** Styles long-form HTML (help articles, release notes, rendered Markdown) without a class on every element. */
4
- export function Prose({ as, children, className }) {
4
+ export function Prose({ as, children, className, tone }) {
5
5
  const Tag = as || "div";
6
- return _jsx(Tag, { className: cx("vk-prose", className), children: children });
6
+ return _jsx(Tag, { className: cx("vk-prose", tone === "foreground" && "vk-prose-foreground", className), children: children });
7
7
  }
@@ -37,10 +37,15 @@ function editorPlugins() {
37
37
  keymap(baseKeymap),
38
38
  ];
39
39
  }
40
+ // How many unechoed reports to remember; an application trails far fewer keystrokes than this.
41
+ const ECHO_LIMIT = 64;
40
42
  function useRichTextEditor(props) {
41
43
  const surfaceRef = useRef(null);
42
44
  const viewRef = useRef(null);
43
45
  const settings = useRef(props);
46
+ // Markdown this editor reported that the application has not echoed back yet, oldest first. Its
47
+ // re-renders can trail several keystrokes, so any of these arriving as `value` is an echo.
48
+ const emitted = useRef([]);
44
49
  useIsoLayoutEffect(() => { settings.current = props; }, [props]);
45
50
  const [initial] = useState(() => props.value ?? props.defaultValue ?? "");
46
51
  const [initialDoc] = useState(() => parseRichTextMarkdown(initial));
@@ -87,6 +92,7 @@ function useRichTextEditor(props) {
87
92
  setEditorState(next);
88
93
  if (transaction.docChanged && !next.doc.eq(transaction.before)) {
89
94
  const content = serializeRichTextMarkdown(next.doc);
95
+ emitted.current = [...emitted.current.slice(-(ECHO_LIMIT - 1)), content];
90
96
  if (settings.current.value === undefined)
91
97
  setUncontrolledMarkdown(content);
92
98
  settings.current.onChange?.(content);
@@ -127,18 +133,25 @@ function useRichTextEditor(props) {
127
133
  return;
128
134
  view.setProps({ editable: () => !(props.disabled || props.readOnly) });
129
135
  }, [props.disabled, props.readOnly]);
130
- const currentDoc = editorState?.doc;
136
+ // A controlled value replaces the document only when it is Markdown this editor did not report.
137
+ // Input arrives outside React's events, so the application can re-render with a value from a few
138
+ // keystrokes ago; that echo must never reset what a person is typing.
131
139
  useEffect(() => {
132
140
  const view = viewRef.current;
133
141
  if (props.value === undefined || !view)
134
142
  return;
135
- const document = parseRichTextMarkdown(props.value);
136
- if (!view.state.doc.eq(document)) {
137
- resetUploads();
138
- view.updateState(EditorState.create({ doc: document, plugins: editorPlugins() }));
139
- setEditorState(view.state);
143
+ const echo = emitted.current.indexOf(props.value);
144
+ if (echo >= 0) {
145
+ emitted.current = emitted.current.slice(echo + 1);
146
+ return;
140
147
  }
141
- }, [props.value, currentDoc, resetUploads]);
148
+ emitted.current = [];
149
+ if (serializeRichTextMarkdown(view.state.doc) === props.value)
150
+ return;
151
+ resetUploads();
152
+ view.updateState(EditorState.create({ doc: parseRichTextMarkdown(props.value), plugins: editorPlugins() }));
153
+ setEditorState(view.state);
154
+ }, [props.value, resetUploads]);
142
155
  return { surfaceRef, editorView, editorState, initialDoc, markdown, uploads };
143
156
  }
144
157
  /** The forwarded ref and Field id identify the same ProseMirror-owned textbox. */
@@ -12,7 +12,7 @@ export interface SegmentedControlProps {
12
12
  defaultValue?: string;
13
13
  onChange?: (value: string) => void;
14
14
  label?: string;
15
- size?: "sm";
15
+ size?: "sm" | "xs";
16
16
  className?: string;
17
17
  }
18
18
  /** Exclusive options that apply immediately (Radix RadioGroup): one Tab stop, arrow keys move the selection and wrap. */
@@ -7,5 +7,5 @@ import { normalizeOptions } from "../../internal/options.js";
7
7
  /** Exclusive options that apply immediately (Radix RadioGroup): one Tab stop, arrow keys move the selection and wrap. */
8
8
  export function SegmentedControl({ options: optionsProp, value: valueProp, defaultValue, onChange, label, size, className }) {
9
9
  const options = normalizeOptions(optionsProp, (value) => ({ value, label: value }));
10
- return (_jsx(Primitive.Root, { "aria-label": label, className: cx("vk-segmented", size === "sm" && "vk-segmented-sm", className), value: valueProp, defaultValue: defaultValue, onValueChange: onChange, children: options.map((o) => (_jsxs(Primitive.Item, { value: o.value, disabled: o.disabled, className: "vk-segment", children: [o.icon ? _jsx(Icon, { name: o.icon, size: 16 }) : null, o.label] }, o.value))) }));
10
+ return (_jsx(Primitive.Root, { "aria-label": label, className: cx("vk-segmented", size === "sm" && "vk-segmented-sm", size === "xs" && "vk-segmented-xs", className), value: valueProp, defaultValue: defaultValue, onValueChange: onChange, children: options.map((o) => (_jsxs(Primitive.Item, { value: o.value, disabled: o.disabled, className: "vk-segment", children: [o.icon ? _jsx(Icon, { name: o.icon, size: 16 }) : null, o.label] }, o.value))) }));
11
11
  }
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ThemeOptions } from "../../lib/theme.js";
3
+ export interface ThemeProviderProps extends ThemeOptions {
4
+ /** For a Content-Security-Policy that allows inline scripts by nonce. */
5
+ nonce?: string;
6
+ children?: ReactNode;
7
+ }
8
+ /**
9
+ * The one place an app sets its theme and density. Render it once, at the top of <body> in the
10
+ * root layout: it applies the saved or system theme and the density to <html> before first paint,
11
+ * and every useTheme below it shares these options.
12
+ */
13
+ export declare function ThemeProvider({ defaultTheme, storageKey, followSystem, density, nonce, children }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ThemeOptionsProvider, ThemeScriptTag } from "../../internal/ThemeOptionsProvider.js";
3
+ /**
4
+ * The one place an app sets its theme and density. Render it once, at the top of <body> in the
5
+ * root layout: it applies the saved or system theme and the density to <html> before first paint,
6
+ * and every useTheme below it shares these options.
7
+ */
8
+ export function ThemeProvider({ defaultTheme, storageKey, followSystem, density, nonce, children }) {
9
+ const options = { defaultTheme, storageKey, followSystem, density };
10
+ return (_jsxs(_Fragment, { children: [_jsx(ThemeScriptTag, { options: options, nonce: nonce }), _jsx(ThemeOptionsProvider, { options: options, children: children })] }));
11
+ }
@@ -182,7 +182,9 @@ export const TimePicker = forwardRef(function TimePicker(props, ref) {
182
182
  }
183
183
  };
184
184
  const a11y = omit(props, ["value", "defaultValue", "onChange", "step", "min", "max", "locale", "id", "name", "placeholder", "defaultOpen", "className", "disabled", "invalidMessage"]);
185
- return (_jsx(Primitive.Root, { open: open, onOpenChange: setOpen, children: _jsxs("div", { ref: rootRef, className: cx("vk-select", "vk-timepicker", props.className), "data-state": open ? "open" : "closed", children: [_jsx(Primitive.Anchor, { asChild: true, children: _jsxs("div", { className: "vk-combobox-field", children: [_jsx("input", { ref: setInputRef, id: props.id || uid, type: "text", role: "combobox", autoComplete: "off", className: "vk-input vk-combobox-input", placeholder: props.placeholder || formatTime("09:30", locale), disabled: props.disabled, value: text, "aria-autocomplete": "none", "aria-expanded": open ? "true" : "false", "aria-controls": listId, "aria-activedescendant": open && active >= 0 ? listId + "-" + String(active) : undefined, onChange: (e) => { type(e.target.value); }, onClick: () => {
185
+ return (_jsx(Primitive.Root, { open: open, onOpenChange: setOpen, children: _jsxs("div", { ref: rootRef, className: cx("vk-select", "vk-timepicker", props.className), "data-state": open ? "open" : "closed", children: [_jsx(Primitive.Anchor, { asChild: true, children: _jsxs("div", { className: "vk-combobox-field", children: [_jsx("input", { ref: setInputRef, id: props.id || uid, type: "text", role: "combobox", autoComplete: "off", className: "vk-input vk-combobox-input", placeholder: props.placeholder || formatTime("09:30", locale), disabled: props.disabled, value: text, "aria-autocomplete": "none", "aria-expanded": open ? "true" : "false", "aria-controls": listId, "aria-activedescendant": open && active >= 0 ? listId + "-" + String(active) : undefined,
186
+ // Typing drops the highlighted option, so Enter keeps the typed time rather than the list's.
187
+ onChange: (e) => { type(e.target.value); setActive(-1); }, onClick: () => {
186
188
  if (!open)
187
189
  openList();
188
190
  }, onKeyDown: onKeyDown, onBlur: (e) => {
@@ -48,7 +48,7 @@ export function ToastItem({ toast: t }) {
48
48
  // Follow the pointer while swiping; Radix sets the variable and clears it on cancel.
49
49
  style: { translate: "var(--radix-toast-swipe-move-x, 0) 0" }, children: [_jsx(Icon, { name: STATUS_ICON[t.status], size: 18, className: "vk-alert-icon" }), _jsxs("div", { className: "vk-alert-body", children: [_jsx("span", { className: "vk-sr-only", children: statusWord(t.status, messages) + ": " }), _jsx(Primitive.Title, { asChild: true, children: _jsx("p", { className: "vk-alert-title", children: t.title }) }), t.description ? _jsxs(_Fragment, { children: [" ", _jsx(Primitive.Description, { className: "vk-alert-text", children: t.description })] }) : null, action
50
50
  ? (_jsxs(_Fragment, { children: [" ", _jsx("div", { className: "vk-alert-action", children: _jsx(Primitive.Action, { altText: action.label, asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", onClick: () => action.onClick?.(), children: action.label }) }) })] }))
51
- : null] }), _jsx(Primitive.Close, { asChild: true, children: _jsx(IconButton, { icon: "x", size: 16, label: messages.dismissNotification, className: "vk-alert-close" }) })] }));
51
+ : null] }), _jsx(Primitive.Close, { asChild: true, children: _jsx(IconButton, { icon: "x", label: messages.dismissNotification, className: "vk-alert-close" }) })] }));
52
52
  }
53
53
  const emptyServerToasts = [];
54
54
  const readToasts = () => toastStore.items;