@vokality/design-system 5.1.2 → 6.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 +14 -0
- package/README.md +22 -1
- package/dist/appearance.d.ts +6 -0
- package/dist/appearance.js +1 -0
- package/dist/chat.d.ts +3 -1
- package/dist/components/Accordion/Accordion.d.ts +9 -6
- package/dist/components/Accordion/Accordion.js +4 -8
- package/dist/components/AppShell/AppShell.js +1 -1
- package/dist/components/Badge/Badge.d.ts +5 -1
- package/dist/components/Badge/Badge.js +2 -2
- package/dist/components/Button/Button.d.ts +11 -10
- package/dist/components/Button/Button.js +6 -14
- package/dist/components/ChatPanel/transcript.js +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +2 -2
- package/dist/components/Combobox/Combobox.d.ts +3 -0
- package/dist/components/Combobox/Combobox.js +3 -3
- package/dist/components/Combobox/ListPanel.d.ts +3 -1
- package/dist/components/Combobox/ListPanel.js +2 -2
- package/dist/components/CommandPalette/CommandPalette.js +4 -3
- package/dist/components/Container/Container.d.ts +7 -4
- package/dist/components/Container/Container.js +3 -4
- package/dist/components/DatePicker/DatePicker.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.js +3 -3
- package/dist/components/Dialog/Dialog.d.ts +2 -4
- package/dist/components/Dialog/Dialog.js +2 -3
- package/dist/components/Grid/Grid.d.ts +3 -3
- package/dist/components/Heading/Heading.d.ts +14 -9
- package/dist/components/Heading/Heading.js +6 -5
- package/dist/components/IconButton/IconButton.d.ts +7 -7
- package/dist/components/IconButton/IconButton.js +2 -10
- package/dist/components/Inline/Inline.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +6 -1
- package/dist/components/Input/Input.js +3 -3
- package/dist/components/Link/Link.d.ts +18 -3
- package/dist/components/Link/Link.js +7 -7
- package/dist/components/Menu/Menu.d.ts +27 -8
- package/dist/components/Menu/Menu.js +6 -11
- package/dist/components/MultiSelect/MultiSelect.d.ts +3 -0
- package/dist/components/MultiSelect/MultiSelect.js +3 -3
- package/dist/components/OtpInput/OtpInput.d.ts +16 -15
- package/dist/components/OtpInput/OtpInput.js +10 -8
- package/dist/components/PageHeader/PageHeader.d.ts +2 -2
- package/dist/components/PageHeader/PageHeader.js +2 -2
- package/dist/components/Popover/Popover.d.ts +16 -7
- package/dist/components/Popover/Popover.js +4 -3
- package/dist/components/Progress/Progress.d.ts +10 -10
- package/dist/components/Progress/Progress.js +8 -12
- package/dist/components/Prose/Prose.d.ts +4 -3
- package/dist/components/Prose/Prose.js +2 -2
- package/dist/components/Radio/Radio.d.ts +3 -3
- package/dist/components/Radio/Radio.js +4 -3
- package/dist/components/RadioGroup/RadioGroup.d.ts +7 -2
- package/dist/components/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/SearchInput/SearchInput.d.ts +6 -1
- package/dist/components/SearchInput/SearchInput.js +2 -2
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +8 -8
- package/dist/components/SegmentedControl/SegmentedControl.js +4 -3
- package/dist/components/Select/Select.d.ts +4 -9
- package/dist/components/Select/Select.js +2 -7
- package/dist/components/Slider/Slider.d.ts +26 -19
- package/dist/components/Slider/Slider.js +20 -25
- package/dist/components/Sparkline/Sparkline.d.ts +2 -2
- package/dist/components/Sparkline/Sparkline.js +3 -3
- package/dist/components/Stack/Stack.d.ts +2 -2
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Table/Table.js +1 -1
- package/dist/components/Tabs/Tabs.d.ts +11 -9
- package/dist/components/Tabs/Tabs.js +5 -5
- package/dist/components/Text/Text.d.ts +12 -5
- package/dist/components/Text/Text.js +3 -3
- package/dist/components/Textarea/Textarea.d.ts +2 -0
- package/dist/components/Textarea/Textarea.js +3 -3
- package/dist/components/TimePicker/TimePicker.d.ts +2 -0
- package/dist/components/TimePicker/TimePicker.js +5 -5
- package/dist/components/Tooltip/Tooltip.d.ts +11 -6
- package/dist/components/Tooltip/Tooltip.js +5 -3
- package/dist/components.css +296 -129
- package/dist/internal/choice.d.ts +7 -2
- package/dist/internal/choice.js +4 -4
- package/dist/lib/space.d.ts +2 -1
- package/dist/lib/space.js +2 -6
- package/dist/tokens.css +2 -0
- package/dist/tokens.dtcg.json +10 -0
- package/dist/tokens.json +10 -0
- package/dist/types.d.ts +4 -3
- package/dist/typography.d.ts +8 -0
- package/dist/typography.js +34 -0
- package/dist/vokality.css +298 -129
- package/dist/vokality.iife.js +1948 -1865
- package/docs/brand.md +6 -2
- package/docs/components/Accordion/README.md +5 -2
- package/docs/components/Badge/README.md +2 -2
- package/docs/components/Button/README.md +15 -11
- package/docs/components/ChatInbox/README.md +2 -0
- package/docs/components/ChatWidget/README.md +2 -0
- package/docs/components/Checkbox/README.md +4 -0
- package/docs/components/Combobox/README.md +6 -0
- package/docs/components/CommandPalette/README.md +2 -0
- package/docs/components/Container/README.md +2 -1
- package/docs/components/DatePicker/README.md +6 -0
- package/docs/components/Dialog/README.md +2 -2
- package/docs/components/Grid/README.md +2 -1
- package/docs/components/Heading/README.md +4 -2
- package/docs/components/IconButton/README.md +7 -3
- package/docs/components/Inline/README.md +3 -3
- package/docs/components/Input/README.md +6 -0
- package/docs/components/Link/README.md +3 -1
- package/docs/components/Menu/README.md +7 -1
- package/docs/components/MultiSelect/README.md +8 -0
- package/docs/components/NumberInput/README.md +6 -0
- package/docs/components/OtpInput/README.md +10 -2
- package/docs/components/PageHeader/README.md +1 -1
- package/docs/components/PasswordInput/README.md +6 -0
- package/docs/components/Popover/README.md +6 -2
- package/docs/components/Progress/README.md +2 -2
- package/docs/components/Prose/README.md +1 -1
- package/docs/components/Radio/README.md +4 -0
- package/docs/components/RadioGroup/README.md +4 -0
- package/docs/components/SearchInput/README.md +6 -0
- package/docs/components/SegmentedControl/README.md +4 -1
- package/docs/components/Select/README.md +8 -3
- package/docs/components/Slider/README.md +13 -3
- package/docs/components/Sparkline/README.md +1 -1
- package/docs/components/Stack/README.md +1 -1
- package/docs/components/Switch/README.md +4 -0
- package/docs/components/Tabs/README.md +3 -1
- package/docs/components/Text/README.md +6 -3
- package/docs/components/Textarea/README.md +5 -1
- package/docs/components/ThemeProvider/README.md +1 -1
- package/docs/components/TimePicker/README.md +6 -0
- package/docs/components/Tooltip/README.md +4 -3
- package/package.json +9 -1
- package/skills/vokality-design-system/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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
|
+
## 6.0.1 — 2026-10-26
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Compact Textarea respects native rows with a two-line minimum based on shared field text, padding and target tokens, including character counts. Default density retains its 8rem floor; touch retains readable 16px text and larger targets.
|
|
9
|
+
- Compact chat density now tightens header, thread and transcript spacing, reduces incoming-message framing and starts the composer at two short lines. Docked inbox titles leave more room for actions; the Back control uses an extra-small fine-pointer target and retains larger coarse-pointer targets. Default density and native editor behavior are unchanged.
|
|
10
|
+
- CommandPalette captures the current outside focus on every opening, including controlled application/native-menu actions, and restores that opening's context when it closes instead of retaining an earlier hotkey invoker.
|
|
11
|
+
|
|
12
|
+
## 6.0.0 — 2026-10-26
|
|
13
|
+
|
|
14
|
+
- Clean native HTML and Radix component contracts: native callbacks, refs, array slider values and discriminated accordion state.
|
|
15
|
+
- Independent semantic `color`, visual `variant` and explicit `xs`/`sm`/`md` sizing across actions and fields; shared themed appearance recipes.
|
|
16
|
+
- Native action buttons and anchor Links; typed typography recipes, neutral text emphasis and spacing steps.
|
|
17
|
+
- Updated component documentation, examples and contract/browser verification.
|
|
18
|
+
|
|
5
19
|
## 5.1.2 — 2026-10-20
|
|
6
20
|
|
|
7
21
|
### Fixed
|
package/README.md
CHANGED
|
@@ -89,7 +89,28 @@ Pages not rendered by React can inline `themeScript()` instead. See `docs/compon
|
|
|
89
89
|
|
|
90
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
91
|
|
|
92
|
-
For toolbars, record rows and status lines, `size="xs"` on `Button`, `IconButton`, `Menu`, `Popover` and `SegmentedControl` gives 24px actions with 11px labels, and on `Select` a 24px toolbar picker with 12px text. A status-line `Menu` or `Popover` takes `variant="text"` to read in sentence case, at 12px with `size="xs"`, like compact `Text size="small"`.
|
|
92
|
+
For toolbars, record rows and status lines, `size="xs"` on `Button`, `IconButton`, `Menu`, `Popover` and `SegmentedControl` gives 24px actions with 11px labels, and on `Select` a 24px toolbar picker with 12px text. A status-line `Menu` or `Popover` takes `variant="text"` to read in sentence case, at 12px with `size="xs"`, like compact `Text size="small"`. Omitted field sizes follow the shared control height; explicit sizes also apply to form fields. Extra-small sizes apply with fine pointers only; a coarse pointer keeps the 44px target. The `--control-height-xs` token holds the height.
|
|
93
|
+
|
|
94
|
+
### Component APIs
|
|
95
|
+
|
|
96
|
+
Components preserve their underlying native HTML or Radix props, callbacks and ref targets. `Button` and `IconButton` are native buttons; `Link` is a native anchor and accepts action appearance when navigation should look like a button.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<Button size="sm" color="danger" variant="outline">Delete invoice</Button>
|
|
100
|
+
<Link href="/invoices/new" size="sm" color="primary" variant="solid">New invoice</Link>
|
|
101
|
+
<Input size="xs" htmlSize={12} aria-label="Reference" />
|
|
102
|
+
<Select size="sm" value={project} onValueChange={setProject} options={projects} />
|
|
103
|
+
<Text size="body-sm" emphasis="muted">Last saved 2 minutes ago.</Text>
|
|
104
|
+
<Badge color="success" variant="soft">Paid</Badge>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- `size` on actions, fields and choices is `xs`, `sm` or `md`: 24px, 32px or 44px single-line control heights with fine pointers. Coarse pointers retain 44px targets and 16px field text. Omitted sizes follow the existing application density; explicit sizes win over row alignment and density.
|
|
108
|
+
- `color` selects `neutral`, `primary`, `info`, `success`, `warning` or `danger` from the active theme. `variant` selects the treatment: `solid`, `soft`, `outline`, `ghost` or `text`, with meaningful subsets per component. Labelled Menu triggers support `text`; icon-only triggers do not.
|
|
109
|
+
- Text and Heading accept token-backed typography `size` names, semantic `color`, and neutral `emphasis` (`default`, `muted`, `subtle`). Layout `gap` accepts spacing tokens; custom CSS belongs in `style`.
|
|
110
|
+
- Alert and toast `status` still communicates feedback meaning, including the icon and announcement behavior. Cosmetic color does not set validity or interaction state.
|
|
111
|
+
- Select, SegmentedControl, Tabs, Slider and OtpInput retain `onValueChange`; Slider uses native number arrays and `onValueCommit`. Accordion uses native discriminated `type`, `value`, `defaultValue` and `onValueChange`. Tooltip uses `side` and `delayDuration`. Progress forwards native `getValueLabel` and root attributes.
|
|
112
|
+
|
|
113
|
+
Shared type definitions are available directly from `@vokality/design-system/appearance` and `@vokality/design-system/typography`.
|
|
93
114
|
|
|
94
115
|
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.
|
|
95
116
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Shared dimensions for actions and form controls. Omit size to use the application density. */
|
|
2
|
+
export type ControlSize = "xs" | "sm" | "md";
|
|
3
|
+
/** Theme-aware semantic palettes. These describe appearance, independently of component state. */
|
|
4
|
+
export type SemanticColor = "neutral" | "primary" | "info" | "success" | "warning" | "danger";
|
|
5
|
+
/** Visual treatment, independently of the chosen semantic palette. */
|
|
6
|
+
export type AppearanceVariant = "solid" | "soft" | "outline" | "ghost" | "text";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/chat.d.ts
CHANGED
|
@@ -26,7 +26,9 @@ export interface ChatAction {
|
|
|
26
26
|
onSelect: () => void;
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
/** Default outline. */
|
|
29
|
-
variant?:
|
|
29
|
+
variant?: ButtonProps["variant"];
|
|
30
|
+
/** Semantic palette of the action. */
|
|
31
|
+
color?: ButtonProps["color"];
|
|
30
32
|
}
|
|
31
33
|
export interface ChatMessage {
|
|
32
34
|
id: string;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { Accordion as Primitive } from "radix-ui";
|
|
3
|
+
interface AccordionContentProps {
|
|
4
|
+
/** Sections keyed by native Radix item values. */
|
|
3
5
|
items: {
|
|
4
6
|
id: string;
|
|
5
7
|
title: ReactNode;
|
|
6
8
|
content: ReactNode;
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
}[];
|
|
9
|
-
|
|
10
|
-
defaultOpen?: string[];
|
|
11
|
+
/** Native heading element for each section title. */
|
|
11
12
|
headingLevel?: "h2" | "h3" | "h4";
|
|
12
|
-
className?: string;
|
|
13
13
|
}
|
|
14
|
+
/** Native Radix single/multiple discrimination preserves the value and callback types. */
|
|
15
|
+
export type AccordionProps = AccordionContentProps & (Omit<Primitive.AccordionSingleProps, "children" | "asChild"> | Omit<Primitive.AccordionMultipleProps, "children" | "asChild">);
|
|
14
16
|
/** A stack of sections that expand and collapse, for long content people scan by heading: settings groups, FAQs, details. */
|
|
15
|
-
export declare
|
|
17
|
+
export declare const Accordion: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export {};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
3
4
|
import { Accordion as Primitive } from "radix-ui";
|
|
4
5
|
import { Icon } from "../Icon/Icon.js";
|
|
5
6
|
import { cx } from "../../lib/cx.js";
|
|
6
7
|
/** A stack of sections that expand and collapse, for long content people scan by heading: settings groups, FAQs, details. */
|
|
7
|
-
export function Accordion({ items
|
|
8
|
-
const items = itemsProp;
|
|
8
|
+
export const Accordion = forwardRef(function Accordion({ items, headingLevel, className, ...rootProps }, ref) {
|
|
9
9
|
const Heading = headingLevel || "h3";
|
|
10
10
|
const body = items.map((it) => (_jsxs(Primitive.Item, { value: it.id, disabled: it.disabled, className: "vk-accordion-item", children: [_jsx(Primitive.Header, { asChild: true, children: _jsx(Heading, { className: "vk-accordion-heading", children: _jsxs(Primitive.Trigger, { className: "vk-accordion-trigger", children: [_jsx("span", { children: it.title }), _jsx(Icon, { name: "chevron-down", className: "vk-accordion-icon" })] }) }) }), _jsx(Primitive.Content, { className: "vk-accordion-panel", children: it.content })] }, it.id)));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return type === "multiple"
|
|
14
|
-
? _jsx(Primitive.Root, { type: "multiple", defaultValue: defaultOpen || [], className: cls, children: body })
|
|
15
|
-
: _jsx(Primitive.Root, { type: "single", collapsible: true, defaultValue: defaultOpen?.[0], className: cls, children: body });
|
|
16
|
-
}
|
|
11
|
+
return _jsx(Primitive.Root, { ...rootProps, ref: ref, className: cx("vk-accordion", className), children: body });
|
|
12
|
+
});
|
|
@@ -33,7 +33,7 @@ function ShellTopbar(props) {
|
|
|
33
33
|
const { messages } = useLocale();
|
|
34
34
|
const { sidebarId, mobileOpen, collapsed } = props;
|
|
35
35
|
const collapseLabel = collapsed ? props.expandLabel || messages.showSidebar : props.collapseLabel || messages.hideSidebar;
|
|
36
|
-
return (_jsxs("header", { className: "vk-shell-topbar", children: [_jsx(Primitive.Trigger, {
|
|
36
|
+
return (_jsxs("header", { className: "vk-shell-topbar", children: [_jsx(Primitive.Trigger, { "data-vk-color": "primary", "data-vk-variant": "ghost", className: "vk-icon-btn vk-shell-menu", "aria-label": props.menuLabel || messages.menu, "aria-controls": sidebarId, children: _jsx(Icon, { name: mobileOpen ? "x" : "menu" }) }), _jsx("button", { type: "button", "data-vk-color": "primary", "data-vk-variant": "ghost", className: "vk-icon-btn 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>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { AppearanceVariant, SemanticColor } from "../../appearance.js";
|
|
2
3
|
import type { IconName } from "../../lib/icons.js";
|
|
3
4
|
/** Outlined uppercase status tag. */
|
|
4
5
|
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
6
|
children: ReactNode;
|
|
6
|
-
|
|
7
|
+
/** Semantic palette, independent of the visual treatment. */
|
|
8
|
+
color?: SemanticColor;
|
|
9
|
+
/** Outline by default. */
|
|
10
|
+
variant?: Extract<AppearanceVariant, "solid" | "soft" | "outline">;
|
|
7
11
|
/** Status icon beside its visible label. */
|
|
8
12
|
icon?: IconName;
|
|
9
13
|
}
|
|
@@ -3,6 +3,6 @@ import { forwardRef } from "react";
|
|
|
3
3
|
import { cx } from "../../lib/cx.js";
|
|
4
4
|
import { Icon } from "../Icon/Icon.js";
|
|
5
5
|
/** Outlined uppercase status tag. */
|
|
6
|
-
export const Badge = forwardRef(function Badge({ children,
|
|
7
|
-
return _jsxs("span", { ref: ref,
|
|
6
|
+
export const Badge = forwardRef(function Badge({ children, color = "primary", variant = "outline", icon, className, ...rest }, ref) {
|
|
7
|
+
return _jsxs("span", { ref: ref, "data-vk-color": color, "data-vk-variant": variant, className: cx("vk-badge", icon && "vk-badge-icon", className), ...rest, children: [icon ? _jsx(Icon, { name: icon, size: 14 }) : null, children] });
|
|
8
8
|
});
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { AppearanceVariant, ControlSize, SemanticColor } from "../../appearance.js";
|
|
3
|
+
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'> {
|
|
4
|
+
/** Visual treatment, independent of color. Text keeps labels in sentence case. */
|
|
5
|
+
variant?: AppearanceVariant;
|
|
6
|
+
color?: SemanticColor;
|
|
7
|
+
/** Explicit control size. Omit to follow application density. */
|
|
8
|
+
size?: ControlSize;
|
|
8
9
|
/** Disables the button, sets aria-busy and shows a spinner. */
|
|
9
10
|
loading?: boolean;
|
|
10
11
|
/** Label shown while loading ("Saving…"). */
|
|
11
12
|
loadingLabel?: ReactNode;
|
|
12
13
|
/** Full width. */
|
|
13
14
|
block?: boolean;
|
|
14
|
-
/** Adds
|
|
15
|
+
/** Adds a trailing arrow-up-right glyph cell. */
|
|
15
16
|
arrow?: boolean;
|
|
16
17
|
children: ReactNode;
|
|
17
18
|
}
|
|
18
|
-
/**
|
|
19
|
-
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement
|
|
19
|
+
/** A native action button. Use Link for navigation. */
|
|
20
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Icon } from "../Icon/Icon.js";
|
|
4
|
-
import { Anchor } from "../LinkProvider/LinkProvider.js";
|
|
5
4
|
import { cx } from "../../lib/cx.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const variant = props.variant || "primary";
|
|
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.size === "xs" && "vk-btn-xs", props.block && "vk-btn-block", props.loading && "vk-btn-loading", props.className);
|
|
5
|
+
/** A native action button. Use Link for navigation. */
|
|
6
|
+
export const Button = forwardRef(function Button({ variant = "solid", color = "primary", size, arrow, children, className: customClassName, loading, loadingLabel, block, disabled, type = "button", ...rest }, ref) {
|
|
7
|
+
const className = cx("vk-btn", block && "vk-btn-block", loading && "vk-btn-loading", customClassName);
|
|
12
8
|
const kids = [
|
|
13
|
-
_jsxs("span", { className: "vk-btn-label", children: [
|
|
9
|
+
_jsxs("span", { className: "vk-btn-label", children: [loading ? _jsx("span", { className: "vk-spinner vk-btn-spinner", "aria-hidden": "true" }) : null, loading && loadingLabel ? loadingLabel : children] }, "l"),
|
|
14
10
|
];
|
|
15
|
-
if (
|
|
11
|
+
if (arrow) {
|
|
16
12
|
kids.push(_jsx("span", { className: "vk-btn-glyph", "aria-hidden": "true", children: _jsx(Icon, { name: "arrow-up-right" }) }, "g"));
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
return (_jsx(Anchor, { ref: ref, href: props.href, className: className, ...rest, children: kids }));
|
|
20
|
-
}
|
|
21
|
-
const busy = props.loading ? { disabled: true, "aria-busy": "true" } : null;
|
|
22
|
-
return (_jsx("button", { ref: ref, type: "button", className: className, ...rest, ...busy, children: kids }));
|
|
14
|
+
return (_jsx("button", { ...rest, ref: ref, type: type, className: className, disabled: disabled || loading, "aria-busy": loading || rest["aria-busy"], "data-vk-size": size, "data-vk-color": color, "data-vk-variant": variant, children: kids }));
|
|
23
15
|
});
|
|
@@ -19,7 +19,7 @@ function MessageDelivery({ message, onRetry }) {
|
|
|
19
19
|
return (_jsxs("div", { className: "vk-chat-delivery vk-chat-delivery-failed", children: [_jsx(Icon, { name: "circle-alert", size: 14 }), _jsx("span", { children: message.delivery.error || messages.chat.failed }), onRetry ? _jsx(Button, { type: "button", size: "sm", variant: "ghost", "aria-label": messages.chat.retryMessage(message.author.name), onClick: () => { onRetry(message.id); }, children: messages.chat.retry }) : null] }));
|
|
20
20
|
}
|
|
21
21
|
function MessageItem({ message, onRetry, reducedMotion }) {
|
|
22
|
-
return (_jsxs(m.li, { className: cx("vk-chat-message", "vk-chat-message-" + message.direction), initial: { opacity: 0, y: reducedMotion ? 0 : 4 }, animate: { opacity: 1, y: 0 }, transition: { duration: reducedMotion ? 0 : 0.16, ease: "easeOut" }, children: [_jsx("span", { className: "vk-chat-message-avatar", children: message.author.avatar || _jsx(Avatar, { name: message.author.name, size: 28, decorative: true }) }), _jsxs("div", { className: "vk-chat-message-body", children: [_jsxs("div", { className: "vk-chat-message-meta", children: [_jsx("span", { className: "vk-chat-message-author", children: message.author.name }), message.author.source ? _jsxs("span", { className: "vk-chat-message-source", children: [message.author.source.mark, message.author.source.label] }) : null, message.timestamp ? _jsx("span", { className: "vk-chat-message-time", children: message.timestamp }) : null] }), _jsx("div", { className: "vk-prose vk-chat-message-content", children: message.content }), _jsx(MessageDelivery, { message: message, onRetry: onRetry })] }), message.actions?.length ? _jsx("div", { className: "vk-chat-message-actions", children: message.actions.map((action) => _jsx(Button, { type: "button", size: "xs", variant: action.variant || "outline", disabled: action.disabled, onClick: action.onSelect, children: action.label }, action.id)) }) : null] }));
|
|
22
|
+
return (_jsxs(m.li, { className: cx("vk-chat-message", "vk-chat-message-" + message.direction), initial: { opacity: 0, y: reducedMotion ? 0 : 4 }, animate: { opacity: 1, y: 0 }, transition: { duration: reducedMotion ? 0 : 0.16, ease: "easeOut" }, children: [_jsx("span", { className: "vk-chat-message-avatar", children: message.author.avatar || _jsx(Avatar, { name: message.author.name, size: 28, decorative: true }) }), _jsxs("div", { className: "vk-chat-message-body", children: [_jsxs("div", { className: "vk-chat-message-meta", children: [_jsx("span", { className: "vk-chat-message-author", children: message.author.name }), message.author.source ? _jsxs("span", { className: "vk-chat-message-source", children: [message.author.source.mark, message.author.source.label] }) : null, message.timestamp ? _jsx("span", { className: "vk-chat-message-time", children: message.timestamp }) : null] }), _jsx("div", { className: "vk-prose vk-chat-message-content", children: message.content }), _jsx(MessageDelivery, { message: message, onRetry: onRetry })] }), message.actions?.length ? _jsx("div", { className: "vk-chat-message-actions", children: message.actions.map((action) => _jsx(Button, { type: "button", size: "xs", variant: action.variant || "outline", color: action.color, disabled: action.disabled, onClick: action.onSelect, children: action.label }, action.id)) }) : null] }));
|
|
23
23
|
}
|
|
24
24
|
/** A native scrollable log of messages and agent runs. Follow new items only while the reader is near its end. */
|
|
25
25
|
export function ChatTranscript(props) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef } from "react";
|
|
2
2
|
import { Checkbox as Primitive } from "radix-ui";
|
|
3
3
|
import { type ChoiceTextProps } from "../../internal/choice.js";
|
|
4
|
-
export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<typeof Primitive.Root>, "asChild" | "children" | "onChange">, ChoiceTextProps {
|
|
4
|
+
export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<typeof Primitive.Root>, "asChild" | "children" | "onChange" | "color">, ChoiceTextProps {
|
|
5
5
|
}
|
|
6
6
|
/** Styled Radix Checkbox; checked state, callbacks, keyboard and form behavior belong to Radix. */
|
|
7
7
|
export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -5,6 +5,6 @@ import { Checkbox as Primitive } from "radix-ui";
|
|
|
5
5
|
import { checkMark, ChoiceLabel, hiddenLabel } from "../../internal/choice.js";
|
|
6
6
|
import { omit } from "../../lib/omit.js";
|
|
7
7
|
/** Styled Radix Checkbox; checked state, callbacks, keyboard and form behavior belong to Radix. */
|
|
8
|
-
export const Checkbox = forwardRef(function Checkbox({ label, description, hideLabel, className, ...props }, ref) {
|
|
9
|
-
return (_jsx(ChoiceLabel, { label: label, description: description, hideLabel: hideLabel, disabled: props.disabled, className: className, children: _jsx(Primitive.Root, { ...omit(props, ["data-state"]), ref: ref, "aria-label": props["aria-label"] || hiddenLabel({ label, hideLabel }), className: "vk-choice-box", children: _jsx(Primitive.Indicator, { forceMount: true, asChild: true, children: checkMark() }) }) }));
|
|
8
|
+
export const Checkbox = forwardRef(function Checkbox({ label, description, hideLabel, className, size, color, ...props }, ref) {
|
|
9
|
+
return (_jsx(ChoiceLabel, { size: size, color: color, label: label, description: description, hideLabel: hideLabel, disabled: props.disabled, className: className, children: _jsx(Primitive.Root, { ...omit(props, ["data-state"]), ref: ref, "aria-label": props["aria-label"] || hiddenLabel({ label, hideLabel }), className: "vk-choice-box", children: _jsx(Primitive.Indicator, { forceMount: true, asChild: true, children: checkMark() }) }) }));
|
|
10
10
|
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { ControlSize } from "../../appearance.js";
|
|
1
2
|
import type { SelectOption } from "../../types.js";
|
|
2
3
|
export interface ComboboxProps {
|
|
4
|
+
/** Visual size shared with actions and other fields. */
|
|
5
|
+
size?: ControlSize;
|
|
3
6
|
options: (string | SelectOption)[];
|
|
4
7
|
value?: string | null;
|
|
5
8
|
defaultValue?: string;
|
|
@@ -149,7 +149,7 @@ export function Combobox(props) {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
-
const a11y = omit(props, ["options", "placeholder", "className", "value", "defaultValue", "onChange", "disabled", "name", "id", "defaultOpen", "emptyText", "icon", "required", "clearLabel"]);
|
|
152
|
+
const a11y = omit(props, ["size", "options", "placeholder", "className", "value", "defaultValue", "onChange", "disabled", "name", "id", "defaultOpen", "emptyText", "icon", "required", "clearLabel"]);
|
|
153
153
|
const input = (_jsx("input", { ref: inputRef, id: inputId, type: "text", role: "combobox", autoComplete: "off", spellCheck: false, className: cx("vk-input", "vk-combobox-input", props.icon === "search" && "vk-has-lead"), placeholder: props.placeholder, disabled: props.disabled, required: props.required, "aria-autocomplete": "list", "aria-expanded": open ? "true" : "false", "aria-controls": listId, "aria-activedescendant": open && active >= 0 ? listId + "-" + String(active) : undefined, value: text, onChange: (e) => {
|
|
154
154
|
const v = e.target.value;
|
|
155
155
|
setText(v);
|
|
@@ -174,13 +174,13 @@ export function Combobox(props) {
|
|
|
174
174
|
close();
|
|
175
175
|
restore();
|
|
176
176
|
}
|
|
177
|
-
}, children: _jsxs("div", { ref: rootRef, className: cx("vk-select", "vk-combobox", open && "vk-select-open", props.className), children: [_jsx(Popover.Anchor, { asChild: true, children: _jsxs("div", { className: "vk-combobox-field", children: [props.icon === "search" ? _jsx(Icon, { name: "search", size: 16, className: "vk-search-icon" }) : null, input, _jsx(FieldEnd, { clearable: Boolean(text) && !props.disabled, clearLabel: props.clearLabel, onClear: () => {
|
|
177
|
+
}, children: _jsxs("div", { ref: rootRef, "data-vk-size": props.size, className: cx("vk-select", "vk-combobox", open && "vk-select-open", props.className), children: [_jsx(Popover.Anchor, { asChild: true, children: _jsxs("div", { className: "vk-combobox-field", children: [props.icon === "search" ? _jsx(Icon, { name: "search", size: 16, className: "vk-search-icon" }) : null, input, _jsx(FieldEnd, { clearable: Boolean(text) && !props.disabled, clearLabel: props.clearLabel, onClear: () => {
|
|
178
178
|
setText("");
|
|
179
179
|
setQuery("");
|
|
180
180
|
setValue(null);
|
|
181
181
|
openAt(-1);
|
|
182
182
|
inputRef.current?.focus();
|
|
183
|
-
} })] }) }), _jsx(ListPanel, { rootRef: rootRef, active: active, children: optionList({
|
|
183
|
+
} })] }) }), _jsx(ListPanel, { rootRef: rootRef, active: active, size: props.size, children: optionList({
|
|
184
184
|
listId,
|
|
185
185
|
options: filtered,
|
|
186
186
|
value,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ReactElement, type RefObject } from "react";
|
|
2
|
+
import type { ControlSize } from "../../appearance.js";
|
|
2
3
|
export interface ListPanelProps {
|
|
4
|
+
size?: ControlSize;
|
|
3
5
|
/** The component's root: presses and Escape inside it are the component's own to handle. */
|
|
4
6
|
rootRef: RefObject<HTMLElement | null>;
|
|
5
7
|
/** data-index of the active option, kept scrolled into view. */
|
|
@@ -13,4 +15,4 @@ export interface ListPanelProps {
|
|
|
13
15
|
* Non-modal and never focused: focus stays in the input, which drives it with aria-activedescendant.
|
|
14
16
|
* Must render inside a Popover.Root whose onOpenChange(false) closes the component.
|
|
15
17
|
*/
|
|
16
|
-
export declare function ListPanel({ rootRef, active, children }: ListPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function ListPanel({ rootRef, active, size, children }: ListPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -27,7 +27,7 @@ const prevent = (e) => { e.preventDefault(); };
|
|
|
27
27
|
* Non-modal and never focused: focus stays in the input, which drives it with aria-activedescendant.
|
|
28
28
|
* Must render inside a Popover.Root whose onOpenChange(false) closes the component.
|
|
29
29
|
*/
|
|
30
|
-
export function ListPanel({ rootRef, active, children }) {
|
|
30
|
+
export function ListPanel({ rootRef, active, size, children }) {
|
|
31
31
|
// The panel mounts a render after the list opens (it is portalled): `shown` re-runs the effects
|
|
32
32
|
// once it is there, and the element itself stays in a ref since scrolling writes to it.
|
|
33
33
|
const nodeRef = useRef(null);
|
|
@@ -76,7 +76,7 @@ export function ListPanel({ rootRef, active, children }) {
|
|
|
76
76
|
observer.observe(el);
|
|
77
77
|
return () => { observer.disconnect(); };
|
|
78
78
|
}, [shown, active]);
|
|
79
|
-
return (_jsx(Primitive.Portal, { children: _jsx(Primitive.Content, { asChild: true, ref: ref, side: "bottom", align: "start", sideOffset: 4, collisionPadding: 8, onOpenAutoFocus: prevent, onCloseAutoFocus: prevent,
|
|
79
|
+
return (_jsx(Primitive.Portal, { children: _jsx(Primitive.Content, { asChild: true, "data-vk-size": size, ref: ref, side: "bottom", align: "start", sideOffset: 4, collisionPadding: 8, onOpenAutoFocus: prevent, onCloseAutoFocus: prevent,
|
|
80
80
|
// The input handles its own Escape (close, then clear); Radix dismisses only from elsewhere.
|
|
81
81
|
onEscapeKeyDown: (e) => { if (inside(rootRef, e.target))
|
|
82
82
|
e.preventDefault(); }, onInteractOutside: (e) => { if (ours(e.target))
|
|
@@ -22,7 +22,7 @@ export function CommandPalette({ commands, open: openProp, onOpenChange, hotkey,
|
|
|
22
22
|
onOpenChange?.(v);
|
|
23
23
|
};
|
|
24
24
|
const uid = useUid("vk-cmd");
|
|
25
|
-
// A
|
|
25
|
+
// A palette opened by an application menu or hotkey has no Dialog.Trigger.
|
|
26
26
|
const invokerRef = useRef(null);
|
|
27
27
|
// The hotkey listener toggles from the latest state without re-subscribing on every change.
|
|
28
28
|
const toggleRef = useRef(() => { setOpen(!open); });
|
|
@@ -33,8 +33,6 @@ export function CommandPalette({ commands, open: openProp, onOpenChange, hotkey,
|
|
|
33
33
|
const onKey = (e) => {
|
|
34
34
|
if ((e.metaKey || e.ctrlKey) && (e.key === "k" || e.key === "K")) {
|
|
35
35
|
e.preventDefault();
|
|
36
|
-
if (e.target instanceof HTMLElement && !e.target.closest(".vk-cmd"))
|
|
37
|
-
invokerRef.current = e.target;
|
|
38
36
|
toggleRef.current();
|
|
39
37
|
}
|
|
40
38
|
};
|
|
@@ -43,6 +41,8 @@ export function CommandPalette({ commands, open: openProp, onOpenChange, hotkey,
|
|
|
43
41
|
}, [hotkey]);
|
|
44
42
|
return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, title: title || messages.commandPalette, className: "vk-cmd", size: "md", contentProps: {
|
|
45
43
|
onOpenAutoFocus(event) {
|
|
44
|
+
const active = document.activeElement;
|
|
45
|
+
invokerRef.current = active instanceof HTMLElement && active !== document.body && active !== document.documentElement && !active.closest(".vk-cmd") ? active : null;
|
|
46
46
|
event.preventDefault();
|
|
47
47
|
document.getElementById(uid + "-search")?.focus();
|
|
48
48
|
},
|
|
@@ -51,6 +51,7 @@ export function CommandPalette({ commands, open: openProp, onOpenChange, hotkey,
|
|
|
51
51
|
event.preventDefault();
|
|
52
52
|
invokerRef.current.focus();
|
|
53
53
|
}
|
|
54
|
+
invokerRef.current = null;
|
|
54
55
|
}
|
|
55
56
|
}, children: [_jsx(PaletteSearch, { uid: uid, commands: commands, placeholder: placeholder, emptyText: emptyText, close: () => { setOpen(false); } }), _jsxs("div", { className: "vk-cmd-footer", "aria-hidden": "true", children: [_jsx(Kbd, { children: "↑" }), _jsx(Kbd, { children: "↓" }), messages.commandMove, _jsx(Kbd, { children: "Enter" }), messages.commandRun, _jsx(Kbd, { children: "Esc" }), messages.commandClose] })] }));
|
|
56
57
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ElementTag, PolymorphicProps } from "../../types.js";
|
|
3
|
+
export interface ContainerOwnProps {
|
|
4
4
|
size?: 'content' | 'prose';
|
|
5
5
|
padded?: boolean;
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
+
export type ContainerProps<T extends ElementTag = "div"> = PolymorphicProps<T, ContainerOwnProps>;
|
|
9
10
|
/** Centers content at the frame width or the reading width, with the page gutter on each side. */
|
|
10
|
-
export declare function Container({ as, size, padded, children, className }: ContainerProps): import("react
|
|
11
|
+
export declare function Container<T extends ElementTag = "div">({ as, size, padded, children, className, ...rest }: ContainerProps<T>): import("react").ReactElement<Omit<ContainerProps<T>, "size" | "className" | "children" | "as" | "padded"> & {
|
|
12
|
+
className: string;
|
|
13
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createElement } from "react";
|
|
2
2
|
import { cx } from "../../lib/cx.js";
|
|
3
3
|
/** Centers content at the frame width or the reading width, with the page gutter on each side. */
|
|
4
|
-
export function Container({ as, size, padded, children, className }) {
|
|
5
|
-
|
|
6
|
-
return _jsx(Tag, { className: cx("vk-container", size === "prose" ? "vk-container-prose" : null, padded === false ? null : "vk-container-padded", className), children: children });
|
|
4
|
+
export function Container({ as, size, padded, children, className, ...rest }) {
|
|
5
|
+
return createElement(as || "div", { ...rest, className: cx("vk-container", size === "prose" ? "vk-container-prose" : null, padded === false ? null : "vk-container-padded", className) }, children);
|
|
7
6
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type CalendarProps } from "../Calendar/Calendar.js";
|
|
2
|
+
import type { ControlSize } from "../../appearance.js";
|
|
2
3
|
import type { DateRange, ISODate } from "../../types.js";
|
|
3
4
|
/** Field that opens a Calendar in a popover dialog. */
|
|
4
5
|
export interface DatePickerProps extends Omit<CalendarProps, 'autoFocus' | 'defaultMonth' | 'onChange'> {
|
|
6
|
+
/** Visual size shared with actions and other fields. */
|
|
7
|
+
size?: ControlSize;
|
|
5
8
|
/** Receives null when a single date is cleared. */
|
|
6
9
|
onChange?: (next: ISODate | DateRange | null) => void;
|
|
7
10
|
placeholder?: string;
|
|
@@ -93,7 +93,7 @@ function ButtonField({ fieldRef, id, disabled, open, label, placeholder, range,
|
|
|
93
93
|
function DatePanel({ props, range, locale, value, todayISO, rootRef, popRef, refocusRef, changeOpen, set }) {
|
|
94
94
|
const { messages } = useLocale();
|
|
95
95
|
const close = () => { changeOpen(false); };
|
|
96
|
-
return (_jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { ref: popRef, "aria-label": props.dialogLabel || (range ? messages.chooseDates : messages.chooseDate), className: "vk-popover vk-date-popover", side: "bottom", align: "start", sideOffset: 4, collisionPadding: 8, onInteractOutside: (e) => {
|
|
96
|
+
return (_jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { ref: popRef, "aria-label": props.dialogLabel || (range ? messages.chooseDates : messages.chooseDate), className: "vk-popover vk-date-popover", "data-vk-size": props.size, side: "bottom", align: "start", sideOffset: 4, collisionPadding: 8, onInteractOutside: (e) => {
|
|
97
97
|
// The field and its button belong to the picker: pressing them keeps it open (the button toggles it).
|
|
98
98
|
if (e.target instanceof Node && rootRef.current && rootRef.current.contains(e.target))
|
|
99
99
|
e.preventDefault();
|
|
@@ -192,7 +192,7 @@ export const DatePicker = forwardRef(function DatePicker(props, ref) {
|
|
|
192
192
|
else
|
|
193
193
|
setDraft(null);
|
|
194
194
|
};
|
|
195
|
-
const a11y = omit(props, ["mode", "locale", "id", "value", "defaultValue", "onChange", "placeholder", "min", "max", "isDateDisabled", "weekStartsOn", "name", "disabled", "defaultOpen", "className", "today", "dialogLabel", "allowTyping", "invalidMessage"]);
|
|
195
|
+
const a11y = omit(props, ["size", "mode", "locale", "id", "value", "defaultValue", "onChange", "placeholder", "min", "max", "isDateDisabled", "weekStartsOn", "name", "disabled", "defaultOpen", "className", "today", "dialogLabel", "allowTyping", "invalidMessage"]);
|
|
196
196
|
const errId = base + "-err";
|
|
197
197
|
const example = fmt.format(todayDate);
|
|
198
198
|
const trigger = typing ? (_jsx(TypedField, { fieldRef: setFieldRef, id: triggerId, placeholder: props.placeholder || example, disabled: props.disabled, text: text, invalid: invalid, errId: errId, a11y: a11y, dialogLabel: props.dialogLabel, label: label, onType: (t) => { setDraft({ text: t, invalid: false, value }); }, onCommit: commitTyped, onOpen: () => { changeOpen(true); }, onButtonClick: () => {
|
|
@@ -200,5 +200,5 @@ export const DatePicker = forwardRef(function DatePicker(props, ref) {
|
|
|
200
200
|
if (open)
|
|
201
201
|
refocusRef.current = false;
|
|
202
202
|
}, popRef: popRef })) : (_jsx(ButtonField, { fieldRef: setFieldRef, id: triggerId, disabled: props.disabled, open: open, label: label, placeholder: props.placeholder, range: range, a11y: a11y, onOpen: () => { changeOpen(true); } }));
|
|
203
|
-
return (_jsx(LocaleProvider, { locale: locale, children: _jsx(Primitive.Root, { open: open, onOpenChange: changeOpen, children: _jsxs("div", { ref: rootRef, className: cx("vk-select", "vk-datepicker", props.className), "data-state": open ? "open" : "closed", children: [trigger, _jsx(DatePanel, { props: props, range: range, locale: locale, value: value, todayISO: todayISO, rootRef: rootRef, popRef: popRef, refocusRef: refocusRef, changeOpen: changeOpen, set: set }), invalid ? _jsx(InvalidDate, { id: errId, message: props.invalidMessage, example: example }) : null, props.name ? _jsx(HiddenDate, { name: props.name, range: range, value: value }) : null] }) }) }));
|
|
203
|
+
return (_jsx(LocaleProvider, { locale: locale, children: _jsx(Primitive.Root, { open: open, onOpenChange: changeOpen, children: _jsxs("div", { ref: rootRef, "data-vk-size": props.size, className: cx("vk-select", "vk-datepicker", props.className), "data-state": open ? "open" : "closed", children: [trigger, _jsx(DatePanel, { props: props, range: range, locale: locale, value: value, todayISO: todayISO, rootRef: rootRef, popRef: popRef, refocusRef: refocusRef, changeOpen: changeOpen, set: set }), invalid ? _jsx(InvalidDate, { id: errId, message: props.invalidMessage, example: example }) : null, props.name ? _jsx(HiddenDate, { name: props.name, range: range, value: value }) : null] }) }) }));
|
|
204
204
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import { AlertDialog, Dialog as Primitive } from "radix-ui";
|
|
3
3
|
interface DialogFrameProps extends Pick<Primitive.DialogProps, 'open' | 'defaultOpen' | 'onOpenChange'> {
|
|
4
|
-
/** Compatibility alias for onOpenChange(false). */
|
|
5
|
-
onClose?: () => void;
|
|
6
4
|
/** Radix Trigger asChild: supplies opening behavior and focus restoration. */
|
|
7
5
|
trigger?: ReactElement;
|
|
8
6
|
title: ReactNode;
|
|
@@ -18,12 +16,12 @@ interface DialogFrameProps extends Pick<Primitive.DialogProps, 'open' | 'default
|
|
|
18
16
|
/** The content contract follows the selected Radix component without widening event props. */
|
|
19
17
|
export type DialogProps = DialogFrameProps & ({
|
|
20
18
|
role?: 'dialog';
|
|
21
|
-
contentProps?: Omit<Primitive.DialogContentProps, 'children' | 'className'>;
|
|
19
|
+
contentProps?: Omit<Primitive.DialogContentProps, 'children' | 'className' | 'asChild'>;
|
|
22
20
|
cancel?: never;
|
|
23
21
|
action?: never;
|
|
24
22
|
} | {
|
|
25
23
|
role: 'alertdialog';
|
|
26
|
-
contentProps?: Omit<AlertDialog.AlertDialogContentProps, 'children' | 'className'>;
|
|
24
|
+
contentProps?: Omit<AlertDialog.AlertDialogContentProps, 'children' | 'className' | 'asChild'>;
|
|
27
25
|
/** Radix Cancel receives initial focus when supplied. */
|
|
28
26
|
cancel?: ReactElement;
|
|
29
27
|
/** Radix Action closes after the supplied action. */
|
|
@@ -11,14 +11,13 @@ import { para } from "../../lib/text.js";
|
|
|
11
11
|
* trapped, the page behind is inert and can't scroll, and closing returns focus to its Radix Trigger.
|
|
12
12
|
*/
|
|
13
13
|
export function Dialog(props) {
|
|
14
|
-
const { open, defaultOpen, onOpenChange,
|
|
14
|
+
const { open, defaultOpen, onOpenChange, trigger, children, size, role, className, side } = props;
|
|
15
15
|
const alert = role === "alertdialog";
|
|
16
16
|
// The same Radix parts either way; AlertDialog also ignores outside presses.
|
|
17
17
|
const P = alert ? AlertDialog : Primitive;
|
|
18
18
|
const content = (_jsxs(_Fragment, { children: [_jsx(DialogHeader, { ...props }), children ? _jsx("div", { className: "vk-dialog-body", children: children }) : null, _jsx(DialogFooter, { ...props })] }));
|
|
19
19
|
const contentClass = cx("vk-dialog", side ? "vk-drawer vk-drawer-" + side : "vk-dialog-" + (size || "md"), className);
|
|
20
|
-
return (_jsxs(P.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: (
|
|
21
|
-
onClose?.(); }, children: [trigger ? _jsx(P.Trigger, { asChild: true, children: trigger }) : null, _jsx(P.Portal, { children: _jsx(P.Overlay, { className: cx("vk-overlay", side ? "vk-overlay-drawer" : null), children: props.role === "alertdialog"
|
|
20
|
+
return (_jsxs(P.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, children: [trigger ? _jsx(P.Trigger, { asChild: true, children: trigger }) : null, _jsx(P.Portal, { children: _jsx(P.Overlay, { className: cx("vk-overlay", side ? "vk-overlay-drawer" : null), children: props.role === "alertdialog"
|
|
22
21
|
? _jsx(AlertDialog.Content, { ...props.contentProps, "aria-modal": "true", className: contentClass, children: content })
|
|
23
22
|
: _jsx(Primitive.Content, { ...props.contentProps, "aria-modal": "true", className: contentClass, children: content }) }) })] }));
|
|
24
23
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
-
import type { ElementTag, PolymorphicProps } from "../../types.js";
|
|
2
|
+
import type { ElementTag, PolymorphicProps, SpaceStep } from "../../types.js";
|
|
3
3
|
export interface GridOwnProps {
|
|
4
4
|
columns?: number;
|
|
5
|
-
min?: string;
|
|
6
|
-
gap?:
|
|
5
|
+
min?: string; /** Gap from the shared spacing scale; use style.gap for a custom length. */
|
|
6
|
+
gap?: SpaceStep;
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
className?: string;
|
|
9
9
|
style?: CSSProperties;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import type { SemanticColor } from "../../appearance.js";
|
|
3
|
+
import type { HeadingLevel, TextEmphasis, TextStyle } from "../../typography.js";
|
|
4
|
+
export interface HeadingProps extends Omit<HTMLAttributes<HTMLHeadingElement>, "color"> {
|
|
5
|
+
/** Semantic heading level, independent of its visual recipe. */
|
|
6
|
+
level?: HeadingLevel;
|
|
7
|
+
/** A named typography recipe from the design tokens. */
|
|
8
|
+
size?: TextStyle;
|
|
9
|
+
/** Semantic foreground palette. */
|
|
10
|
+
color?: SemanticColor;
|
|
11
|
+
/** Neutral foreground hierarchy; semantic colors keep their named foreground. */
|
|
12
|
+
emphasis?: TextEmphasis;
|
|
8
13
|
}
|
|
9
14
|
/** The text style each heading level uses unless `size` says otherwise. */
|
|
10
|
-
export declare const HEADING_SIZE: Record<
|
|
15
|
+
export declare const HEADING_SIZE: Record<HeadingLevel, TextStyle>;
|
|
11
16
|
/** A heading at the right level with the right type style; structure and visual size can differ. */
|
|
12
|
-
export declare
|
|
17
|
+
export declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
2
3
|
import { cx } from "../../lib/cx.js";
|
|
3
4
|
/** The text style each heading level uses unless `size` says otherwise. */
|
|
4
|
-
export const HEADING_SIZE = { 1: "heading-1", 2: "heading-2", 3: "title", 4: "title-sm" };
|
|
5
|
+
export const HEADING_SIZE = { 1: "heading-1", 2: "heading-2", 3: "title", 4: "title-sm", 5: "title-xs", 6: "section-label" };
|
|
5
6
|
/** A heading at the right level with the right type style; structure and visual size can differ. */
|
|
6
|
-
export function Heading({ level: levelProp, size,
|
|
7
|
+
export const Heading = forwardRef(function Heading({ level: levelProp, size, color, emphasis, children, className, ...rest }, ref) {
|
|
7
8
|
const level = levelProp || 2;
|
|
8
9
|
const style = size || HEADING_SIZE[level];
|
|
9
|
-
const tags = { 1: "h1", 2: "h2", 3: "h3", 4: "h4" };
|
|
10
|
+
const tags = { 1: "h1", 2: "h2", 3: "h3", 4: "h4", 5: "h5", 6: "h6" };
|
|
10
11
|
const Tag = tags[level];
|
|
11
|
-
return _jsx(Tag, {
|
|
12
|
-
}
|
|
12
|
+
return _jsx(Tag, { ...rest, ref: ref, "data-vk-color": color, className: cx("vk-heading", "vk-text-" + style, emphasis && "vk-emphasis-" + emphasis, className), children: children });
|
|
13
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ButtonHTMLAttributes } from "react";
|
|
2
|
+
import type { AppearanceVariant, ControlSize, SemanticColor } from "../../appearance.js";
|
|
2
3
|
import type { IconName } from "../../types.js";
|
|
3
|
-
export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
|
|
4
|
+
export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'> {
|
|
4
5
|
icon: IconName;
|
|
5
6
|
label: string;
|
|
6
|
-
variant?:
|
|
7
|
-
|
|
8
|
-
size?:
|
|
9
|
-
href?: string;
|
|
7
|
+
variant?: Exclude<AppearanceVariant, "text">;
|
|
8
|
+
color?: SemanticColor;
|
|
9
|
+
size?: ControlSize;
|
|
10
10
|
}
|
|
11
11
|
/** Square icon-only button; label becomes aria-label and tooltip. */
|
|
12
|
-
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement
|
|
12
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|