@vokality/design-system 3.0.1 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +10 -9
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/AppShell/AppShell.js +4 -1
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/ChatWidget/ChatWidget.js +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +2 -2
- package/dist/components/ErrorSummary/ErrorSummary.js +3 -1
- package/dist/components/Fieldset/Fieldset.d.ts +2 -0
- package/dist/components/Fieldset/Fieldset.js +2 -2
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/IconButton/IconButton.d.ts +2 -1
- package/dist/components/IconButton/IconButton.js +2 -2
- package/dist/components/Menu/Menu.d.ts +1 -2
- package/dist/components/Menu/Menu.js +7 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/Prose/Prose.d.ts +3 -1
- package/dist/components/Prose/Prose.js +2 -2
- package/dist/components/RichTextEditor/RichTextEditor.js +20 -7
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +13 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +11 -0
- package/dist/components/TimePicker/TimePicker.js +3 -1
- package/dist/components/Toaster/Toaster.js +1 -1
- package/dist/components.css +55 -8
- package/dist/hooks/useTheme.d.ts +3 -2
- package/dist/hooks/useTheme.js +6 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/internal/ThemeOptionsProvider.d.ts +15 -0
- package/dist/internal/ThemeOptionsProvider.js +26 -0
- package/dist/internal/themeOptions.d.ts +3 -0
- package/dist/internal/themeOptions.js +4 -0
- package/dist/lib/theme.d.ts +5 -1
- package/dist/lib/theme.js +3 -2
- package/dist/tokens.css +1 -0
- package/dist/tokens.dtcg.json +5 -0
- package/dist/tokens.json +5 -0
- package/dist/vokality.css +56 -8
- package/dist/vokality.iife.js +483 -434
- package/docs/brand.md +2 -2
- package/docs/components/Button/README.md +4 -1
- package/docs/components/DatePicker/README.md +1 -1
- package/docs/components/Fieldset/README.md +3 -1
- package/docs/components/FileUpload/README.md +3 -2
- package/docs/components/Menu/README.md +3 -3
- package/docs/components/NavList/README.md +1 -1
- package/docs/components/Popover/README.md +1 -1
- package/docs/components/Prose/README.md +4 -0
- package/docs/components/RichTextEditor/README.md +1 -1
- package/docs/components/SegmentedControl/README.md +1 -1
- package/docs/components/{ThemeScript → ThemeProvider}/README.md +16 -11
- package/package.json +21 -11
- package/skills/vokality-design-system/SKILL.md +1 -1
- package/dist/components/ThemeScript/ThemeScript.d.ts +0 -7
- package/dist/components/ThemeScript/ThemeScript.js +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
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.1 — 2026-10-19
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- `Prose` ends at its last block: the final paragraph or list no longer leaves a bottom margin inside rows and panels.
|
|
9
|
+
|
|
10
|
+
## 4.0.0 — 2026-10-18
|
|
11
|
+
|
|
12
|
+
One way to do each thing.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `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.
|
|
16
|
+
- 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.
|
|
17
|
+
- `Fieldset` `plain`: an unframed group whose legend lines up with the surrounding field labels.
|
|
18
|
+
- `Prose` `tone="foreground"` for rendered records and messages.
|
|
19
|
+
- 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.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- Compact density scales `Prose` to 14px text with 20px to 14px headings and tighter block spacing, and alert and toast titles to 14px.
|
|
23
|
+
- Fieldset legends use the field label style (uppercase, tracked, muted), so a group's name matches the fields beside it.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
Running every story in every theme and density with axe found these:
|
|
27
|
+
- 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.
|
|
28
|
+
- AppShell's phone sidebar is a plain element while it is a modal dialog; `<aside>` may not take the dialog role.
|
|
29
|
+
- ErrorSummary titles have unique ids, so two summaries on a page name themselves correctly.
|
|
30
|
+
- CommandPalette points `aria-controls` only at a list that exists, and keeps its options current when two groups share a name.
|
|
31
|
+
- TimePicker keeps a typed time when Enter is pressed after the list opened.
|
|
32
|
+
- 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.
|
|
33
|
+
|
|
34
|
+
### Changed (breaking)
|
|
35
|
+
- `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`.
|
|
36
|
+
- 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.
|
|
37
|
+
- `IconButton` `size` is now the control size (`"xs"`), like every other action; the glyph size follows the system.
|
|
38
|
+
|
|
5
39
|
## 3.0.1 — 2026-10-17
|
|
6
40
|
|
|
7
41
|
### 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
|
-
|
|
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 {
|
|
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
|
-
<
|
|
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/
|
|
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
|
-
|
|
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
|
|
|
@@ -192,10 +193,10 @@ bun run test:browser # keyboard, focus and overlay behaviour in headless Chrom
|
|
|
192
193
|
bun run typecheck # the declarations against test/types-usage.tsx
|
|
193
194
|
bun run lint # strict type-aware TypeScript and React/Hooks rules
|
|
194
195
|
bun run doctor # full production-source React Doctor scan
|
|
195
|
-
bun run
|
|
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)
|
|
196
199
|
bun run test:next # production Next.js App Router consumer and hydration checks
|
|
197
|
-
bun run preview --theme=light # render every docs/components preview; screenshots in artifact/shots
|
|
198
|
-
bun run artifact # build the claude.ai docs page in artifact/ (see "The docs page" in CONTRIBUTING.md)
|
|
199
200
|
```
|
|
200
201
|
|
|
201
202
|
See [CONTRIBUTING.md](CONTRIBUTING.md) before adding tokens or components, and [CHANGELOG.md](CHANGELOG.md) for releases.
|
|
@@ -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",
|
|
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
|
-
|
|
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
|
-
|
|
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",
|
|
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":
|
|
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.
|
|
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":
|
|
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",
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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,
|
|
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",
|
|
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;
|