@vokality/design-system 5.1.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +22 -1
  3. package/dist/appearance.d.ts +6 -0
  4. package/dist/appearance.js +1 -0
  5. package/dist/chat.d.ts +3 -1
  6. package/dist/components/Accordion/Accordion.d.ts +9 -6
  7. package/dist/components/Accordion/Accordion.js +4 -8
  8. package/dist/components/AppShell/AppShell.js +1 -1
  9. package/dist/components/Badge/Badge.d.ts +5 -1
  10. package/dist/components/Badge/Badge.js +2 -2
  11. package/dist/components/Button/Button.d.ts +11 -10
  12. package/dist/components/Button/Button.js +6 -14
  13. package/dist/components/ChatPanel/transcript.js +1 -1
  14. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  15. package/dist/components/Checkbox/Checkbox.js +2 -2
  16. package/dist/components/Combobox/Combobox.d.ts +3 -0
  17. package/dist/components/Combobox/Combobox.js +3 -3
  18. package/dist/components/Combobox/ListPanel.d.ts +3 -1
  19. package/dist/components/Combobox/ListPanel.js +2 -2
  20. package/dist/components/Container/Container.d.ts +7 -4
  21. package/dist/components/Container/Container.js +3 -4
  22. package/dist/components/DatePicker/DatePicker.d.ts +3 -0
  23. package/dist/components/DatePicker/DatePicker.js +3 -3
  24. package/dist/components/Dialog/Dialog.d.ts +2 -4
  25. package/dist/components/Dialog/Dialog.js +2 -3
  26. package/dist/components/Grid/Grid.d.ts +3 -3
  27. package/dist/components/Heading/Heading.d.ts +14 -9
  28. package/dist/components/Heading/Heading.js +6 -5
  29. package/dist/components/IconButton/IconButton.d.ts +7 -7
  30. package/dist/components/IconButton/IconButton.js +2 -10
  31. package/dist/components/Inline/Inline.d.ts +2 -2
  32. package/dist/components/Input/Input.d.ts +6 -1
  33. package/dist/components/Input/Input.js +3 -3
  34. package/dist/components/Link/Link.d.ts +18 -3
  35. package/dist/components/Link/Link.js +7 -7
  36. package/dist/components/Menu/Menu.d.ts +27 -8
  37. package/dist/components/Menu/Menu.js +6 -11
  38. package/dist/components/MultiSelect/MultiSelect.d.ts +3 -0
  39. package/dist/components/MultiSelect/MultiSelect.js +3 -3
  40. package/dist/components/OtpInput/OtpInput.d.ts +16 -15
  41. package/dist/components/OtpInput/OtpInput.js +10 -8
  42. package/dist/components/PageHeader/PageHeader.d.ts +2 -2
  43. package/dist/components/PageHeader/PageHeader.js +2 -2
  44. package/dist/components/Popover/Popover.d.ts +16 -7
  45. package/dist/components/Popover/Popover.js +4 -3
  46. package/dist/components/Progress/Progress.d.ts +10 -10
  47. package/dist/components/Progress/Progress.js +8 -12
  48. package/dist/components/Prose/Prose.d.ts +4 -3
  49. package/dist/components/Prose/Prose.js +2 -2
  50. package/dist/components/Radio/Radio.d.ts +3 -3
  51. package/dist/components/Radio/Radio.js +4 -3
  52. package/dist/components/RadioGroup/RadioGroup.d.ts +7 -2
  53. package/dist/components/RadioGroup/RadioGroup.js +2 -2
  54. package/dist/components/SearchInput/SearchInput.d.ts +6 -1
  55. package/dist/components/SearchInput/SearchInput.js +2 -2
  56. package/dist/components/SegmentedControl/SegmentedControl.d.ts +8 -8
  57. package/dist/components/SegmentedControl/SegmentedControl.js +4 -3
  58. package/dist/components/Select/Select.d.ts +4 -9
  59. package/dist/components/Select/Select.js +2 -7
  60. package/dist/components/Slider/Slider.d.ts +26 -19
  61. package/dist/components/Slider/Slider.js +20 -25
  62. package/dist/components/Sparkline/Sparkline.d.ts +2 -2
  63. package/dist/components/Sparkline/Sparkline.js +3 -3
  64. package/dist/components/Stack/Stack.d.ts +2 -2
  65. package/dist/components/Switch/Switch.d.ts +1 -1
  66. package/dist/components/Switch/Switch.js +2 -2
  67. package/dist/components/Table/Table.js +1 -1
  68. package/dist/components/Tabs/Tabs.d.ts +11 -9
  69. package/dist/components/Tabs/Tabs.js +5 -5
  70. package/dist/components/Text/Text.d.ts +12 -5
  71. package/dist/components/Text/Text.js +3 -3
  72. package/dist/components/Textarea/Textarea.d.ts +2 -0
  73. package/dist/components/Textarea/Textarea.js +3 -3
  74. package/dist/components/TimePicker/TimePicker.d.ts +2 -0
  75. package/dist/components/TimePicker/TimePicker.js +5 -5
  76. package/dist/components/Tooltip/Tooltip.d.ts +11 -6
  77. package/dist/components/Tooltip/Tooltip.js +5 -3
  78. package/dist/components.css +274 -130
  79. package/dist/internal/choice.d.ts +7 -2
  80. package/dist/internal/choice.js +4 -4
  81. package/dist/lib/space.d.ts +2 -1
  82. package/dist/lib/space.js +2 -6
  83. package/dist/tokens.css +2 -0
  84. package/dist/tokens.dtcg.json +10 -0
  85. package/dist/tokens.json +10 -0
  86. package/dist/types.d.ts +4 -3
  87. package/dist/typography.d.ts +8 -0
  88. package/dist/typography.js +34 -0
  89. package/dist/vokality.css +276 -130
  90. package/dist/vokality.iife.js +1945 -1863
  91. package/docs/brand.md +6 -2
  92. package/docs/components/Accordion/README.md +5 -2
  93. package/docs/components/Badge/README.md +2 -2
  94. package/docs/components/Button/README.md +15 -11
  95. package/docs/components/Checkbox/README.md +4 -0
  96. package/docs/components/Combobox/README.md +6 -0
  97. package/docs/components/Container/README.md +2 -1
  98. package/docs/components/DatePicker/README.md +6 -0
  99. package/docs/components/Dialog/README.md +2 -2
  100. package/docs/components/Grid/README.md +2 -1
  101. package/docs/components/Heading/README.md +4 -2
  102. package/docs/components/IconButton/README.md +7 -3
  103. package/docs/components/Inline/README.md +3 -3
  104. package/docs/components/Input/README.md +6 -0
  105. package/docs/components/Link/README.md +3 -1
  106. package/docs/components/Menu/README.md +7 -1
  107. package/docs/components/MultiSelect/README.md +8 -0
  108. package/docs/components/NumberInput/README.md +6 -0
  109. package/docs/components/OtpInput/README.md +10 -2
  110. package/docs/components/PageHeader/README.md +1 -1
  111. package/docs/components/PasswordInput/README.md +6 -0
  112. package/docs/components/Popover/README.md +6 -2
  113. package/docs/components/Progress/README.md +2 -2
  114. package/docs/components/Prose/README.md +1 -1
  115. package/docs/components/Radio/README.md +4 -0
  116. package/docs/components/RadioGroup/README.md +4 -0
  117. package/docs/components/SearchInput/README.md +6 -0
  118. package/docs/components/SegmentedControl/README.md +4 -1
  119. package/docs/components/Select/README.md +8 -3
  120. package/docs/components/Slider/README.md +13 -3
  121. package/docs/components/Sparkline/README.md +1 -1
  122. package/docs/components/Stack/README.md +1 -1
  123. package/docs/components/Switch/README.md +4 -0
  124. package/docs/components/Tabs/README.md +3 -1
  125. package/docs/components/Text/README.md +6 -3
  126. package/docs/components/Textarea/README.md +4 -0
  127. package/docs/components/ThemeProvider/README.md +1 -1
  128. package/docs/components/TimePicker/README.md +6 -0
  129. package/docs/components/Tooltip/README.md +4 -3
  130. package/package.json +9 -1
  131. package/skills/vokality-design-system/SKILL.md +1 -1
@@ -17,9 +17,9 @@ export const Input = forwardRef(function Input(props, ref) {
17
17
  const countMax = props.showCount && props.maxLength ? props.maxLength : 0;
18
18
  // Add-ons or a counter put the field in a wrapper, which then takes className.
19
19
  const wrapped = !!(props.prefix || props.suffix || countMax);
20
- const rest = omit(props, ["className", "prefix", "suffix", "showCount", "value", "defaultValue", "onChange", "inputClassName"]);
21
- const input = (_jsx("input", { type: "text", ref: ref, ...rest, value: txt.value, onChange: txt.onChange, maxLength: countMax ? undefined : props.maxLength, className: cx("vk-input", props.prefix ? "vk-input-has-prefix" : null, props.suffix ? "vk-input-has-suffix" : null, props.inputClassName, wrapped ? null : props.className) }));
20
+ const rest = omit(props, ["size", "htmlSize", "className", "prefix", "suffix", "showCount", "value", "defaultValue", "onChange", "inputClassName"]);
21
+ const input = (_jsx("input", { type: "text", ref: ref, ...rest, "data-vk-size": props.size, size: props.htmlSize, value: txt.value, onChange: txt.onChange, maxLength: countMax ? undefined : props.maxLength, className: cx("vk-input", props.prefix ? "vk-input-has-prefix" : null, props.suffix ? "vk-input-has-suffix" : null, props.inputClassName, wrapped ? null : props.className) }));
22
22
  if (!wrapped)
23
23
  return input;
24
- return (_jsxs("span", { className: cx("vk-affix", props.className), children: [_jsxs("span", { className: "vk-affix-row", children: [_jsx(Addon, { side: "prefix", children: props.prefix }), input, _jsx(Addon, { side: "suffix", children: props.suffix })] }), countMax ? _jsx(CharCount, { value: txt.value, max: countMax }) : null] }));
24
+ return (_jsxs("span", { className: cx("vk-affix", props.className), "data-vk-size": props.size, children: [_jsxs("span", { className: "vk-affix-row", children: [_jsx(Addon, { side: "prefix", children: props.prefix }), input, _jsx(Addon, { side: "suffix", children: props.suffix })] }), countMax ? _jsx(CharCount, { value: txt.value, max: countMax }) : null] }));
25
25
  });
@@ -1,7 +1,22 @@
1
1
  import { type AnchorHTMLAttributes } from "react";
2
- export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
3
- tone?: 'default' | 'muted';
2
+ import type { AppearanceVariant, ControlSize, SemanticColor } from "../../appearance.js";
3
+ import type { TextEmphasis } from "../../typography.js";
4
+ interface LinkBaseProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "color"> {
5
+ /** Theme-aware palette. Neutral for inline links, primary for action links. */
6
+ color?: SemanticColor;
7
+ /** Opens an external destination in a new tab with an accompanying glyph. */
4
8
  external?: boolean;
5
9
  }
6
- /** Inline text link. */
10
+ /** Inline text emphasis and action geometry are separate presentation contracts. */
11
+ export type LinkProps = LinkBaseProps & ({
12
+ variant?: undefined;
13
+ emphasis?: TextEmphasis;
14
+ size?: never;
15
+ } | {
16
+ variant: AppearanceVariant;
17
+ size?: ControlSize;
18
+ emphasis?: never;
19
+ });
20
+ /** A native anchor, optionally styled as an action. LinkProvider supplies router integration. */
7
21
  export declare const Link: import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
22
+ export {};
@@ -1,12 +1,12 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Icon } from "../Icon/Icon.js";
4
4
  import { Anchor } from "../LinkProvider/LinkProvider.js";
5
5
  import { cx } from "../../lib/cx.js";
6
- import { omit } from "../../lib/omit.js";
7
- /** Inline text link. */
8
- export const Link = forwardRef(function Link(props, ref) {
9
- const rest = omit(props, ["tone", "external", "className", "children"]);
10
- const ext = props.external ? { target: "_blank", rel: "noopener noreferrer" } : {};
11
- return (_jsxs(Anchor, { ref: ref, className: cx("vk-link", props.tone === "muted" && "vk-link-muted", props.className), ...ext, ...rest, children: [props.children, props.external ? _jsx(Icon, { name: "arrow-up-right", size: 13, className: "vk-link-icon" }) : null] }));
6
+ /** A native anchor, optionally styled as an action. LinkProvider supplies router integration. */
7
+ export const Link = forwardRef(function Link({ color, emphasis, variant, size, external, className, children, ...props }, ref) {
8
+ const palette = color ?? (variant ? "primary" : "neutral");
9
+ const ext = external ? { target: "_blank", rel: "noopener noreferrer" } : {};
10
+ const content = _jsxs(_Fragment, { children: [children, external ? _jsx(Icon, { name: "arrow-up-right", size: 13, className: "vk-link-icon" }) : null] });
11
+ return (_jsx(Anchor, { ...ext, ...props, ref: ref, "data-vk-color": palette, "data-vk-variant": variant, "data-vk-size": size, className: cx("vk-link", variant && "vk-btn", emphasis && "vk-emphasis-" + emphasis, className), children: variant ? _jsx("span", { className: "vk-btn-label", children: content }) : content }));
12
12
  });
@@ -1,13 +1,32 @@
1
+ import { DropdownMenu as Primitive } from "radix-ui";
2
+ import type { AppearanceVariant, ControlSize, SemanticColor } from "../../appearance.js";
1
3
  import type { IconName, MenuEntry } from "../../types.js";
2
- export interface MenuProps {
4
+ import type { IconButtonProps } from "../IconButton/IconButton.js";
5
+ interface MenuBaseProps extends Omit<Primitive.DropdownMenuProps, "children"> {
3
6
  items: MenuEntry[];
4
- label?: string;
5
- icon?: IconName;
6
- triggerLabel?: string; /** text reads as a sentence-case label, 12px at xs; it applies to labelled triggers. */
7
- variant?: 'outline' | 'ghost' | 'primary' | 'text';
8
- size?: 'sm' | 'xs';
9
- align?: 'start' | 'end';
7
+ color?: SemanticColor;
8
+ size?: ControlSize;
9
+ /** Native content placement. */
10
+ side?: Primitive.DropdownMenuContentProps["side"];
11
+ align?: Primitive.DropdownMenuContentProps["align"];
12
+ /** Native trigger attributes and handlers; the ref targets this button. */
13
+ triggerProps?: Omit<Primitive.DropdownMenuTriggerProps, "children" | "asChild" | "className" | "disabled">;
14
+ /** Native positioning, dismissal and content attributes. */
15
+ contentProps?: Omit<Primitive.DropdownMenuContentProps, "children" | "asChild" | "className" | "side" | "align">;
10
16
  disabled?: boolean;
11
17
  className?: string;
12
18
  }
13
- export declare function Menu({ items, label, icon, triggerLabel, variant, size, align, disabled, className }: MenuProps): import("react/jsx-runtime").JSX.Element;
19
+ export type MenuProps = MenuBaseProps & ({
20
+ label: string;
21
+ icon?: IconName;
22
+ triggerLabel?: string;
23
+ variant?: AppearanceVariant;
24
+ } | {
25
+ label?: undefined;
26
+ icon: IconName;
27
+ triggerLabel?: string;
28
+ variant?: IconButtonProps["variant"];
29
+ });
30
+ /** Menu button (WAI-ARIA), built on Radix DropdownMenu. */
31
+ export declare const Menu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<HTMLButtonElement>>;
32
+ export {};
@@ -1,22 +1,17 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { forwardRef } from "react";
3
4
  import { useLocale } from "../../localization.js";
4
5
  import { DropdownMenu as Primitive } from "radix-ui";
5
6
  import { Icon } from "../Icon/Icon.js";
6
7
  import { cx } from "../../lib/cx.js";
7
8
  import { MenuEntries } from "./entries.js";
8
9
  /** Menu button (WAI-ARIA), built on Radix DropdownMenu. */
9
- /** An icon button (ghost or outline) 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", variant === "outline" ? "vk-icon-btn-outline" : "vk-icon-btn-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
- }
15
- export function Menu({ items, label, icon, triggerLabel, variant, size, align, disabled, className }) {
10
+ export const Menu = forwardRef(function Menu({ items, label, icon, triggerLabel, variant, color = "primary", size, side = "bottom", align = "start", triggerProps, contentProps, disabled, className, ...rootProps }, ref) {
16
11
  const { messages } = useLocale();
17
12
  // An icon with no label makes an icon button, named by triggerLabel.
18
- const iconOnly = label ? undefined : icon;
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
13
+ const iconOnly = label === undefined ? icon : undefined;
14
+ return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { ...rootProps, children: [_jsx(Primitive.Trigger, { ...triggerProps, ref: ref, disabled: disabled, className: iconOnly ? "vk-icon-btn" : "vk-btn", "data-vk-size": size, "data-vk-color": color, "data-vk-variant": variant ?? (iconOnly ? "ghost" : "outline"), "aria-label": triggerProps?.["aria-label"] ?? (iconOnly ? triggerLabel || messages.moreActions : undefined), title: triggerProps?.title ?? (iconOnly ? triggerLabel || messages.moreActions : undefined), children: iconOnly
20
15
  ? _jsx(Icon, { name: iconOnly })
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 }) }) })] }) }));
22
- }
16
+ : _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, { forceMount: contentProps?.forceMount, children: _jsx(Primitive.Content, { sideOffset: 4, collisionPadding: 8, ...contentProps, className: "vk-menu", side: side, align: align, children: _jsx(MenuEntries, { parts: Primitive, items: items }) }) })] }) }));
17
+ });
@@ -1,5 +1,8 @@
1
+ import type { ControlSize } from "../../appearance.js";
1
2
  import type { SelectOption } from "../../types.js";
2
3
  export interface MultiSelectProps {
4
+ /** Visual size shared with actions and other fields. */
5
+ size?: ControlSize;
3
6
  options: (string | SelectOption)[];
4
7
  value?: string[];
5
8
  defaultValue?: string[];
@@ -132,12 +132,12 @@ export function MultiSelect(props) {
132
132
  close();
133
133
  }
134
134
  };
135
- const a11y = omit(props, ["options", "placeholder", "className", "value", "defaultValue", "onChange", "disabled", "name", "id", "defaultOpen", "emptyText", "max", "required"]);
135
+ const a11y = omit(props, ["size", "options", "placeholder", "className", "value", "defaultValue", "onChange", "disabled", "name", "id", "defaultOpen", "emptyText", "max", "required"]);
136
136
  return (_jsx(Popover.Root, { open: open, onOpenChange: (next) => {
137
137
  // A press outside, or Escape from outside the field.
138
138
  if (!next)
139
139
  close();
140
- }, children: _jsxs("div", { ref: rootRef, className: cx("vk-select", "vk-multiselect", open && "vk-select-open", props.disabled && "vk-multiselect-disabled", props.className), children: [_jsx(Popover.Anchor, { asChild: true, children: _jsxs("div", {
140
+ }, children: _jsxs("div", { ref: rootRef, "data-vk-size": props.size, className: cx("vk-select", "vk-multiselect", open && "vk-select-open", props.disabled && "vk-multiselect-disabled", props.className), children: [_jsx(Popover.Anchor, { asChild: true, children: _jsxs("div", {
141
141
  // The box around the tags and the combobox input: a press anywhere in it focuses the
142
142
  // input (which carries the role and keyboard support), so the box itself is presentational.
143
143
  role: "presentation", className: "vk-input vk-multiselect-field", "aria-invalid": props["aria-invalid"], onMouseDown: (e) => {
@@ -159,7 +159,7 @@ export function MultiSelect(props) {
159
159
  }, onKeyDown: onKeyDown, onBlur: (e) => {
160
160
  if (rootRef.current && !rootRef.current.contains(e.relatedTarget))
161
161
  close();
162
- }, ...a11y }), _jsx(Icon, { name: "chevron-down", className: "vk-select-icon" })] }) }), _jsx(ListPanel, { rootRef: rootRef, active: active, children: optionList({
162
+ }, ...a11y }), _jsx(Icon, { name: "chevron-down", className: "vk-select-icon" })] }) }), _jsx(ListPanel, { rootRef: rootRef, active: active, size: props.size, children: optionList({
163
163
  listId,
164
164
  options: filtered,
165
165
  values,
@@ -1,19 +1,20 @@
1
- export interface OtpInputProps {
1
+ import { unstable_OneTimePasswordField as Primitive } from "radix-ui";
2
+ import { type ComponentPropsWithoutRef } from "react";
3
+ import type { ControlSize } from "../../appearance.js";
4
+ type RootProps = ComponentPropsWithoutRef<typeof Primitive.Root>;
5
+ type DigitProps = ComponentPropsWithoutRef<typeof Primitive.Input>;
6
+ export interface OtpInputProps extends Omit<RootProps, "children" | "asChild"> {
7
+ /** Visual size shared with actions and other fields. */
8
+ size?: ControlSize;
9
+ /** Number of composed input boxes. */
2
10
  length?: number;
3
- value?: string;
4
- defaultValue?: string;
5
- onChange?: (code: string) => void;
6
- onComplete?: (code: string) => void;
7
- numeric?: boolean;
8
- name?: string;
9
- disabled?: boolean;
11
+ /** Localized noun used in each box's accessible name. */
10
12
  label?: string;
11
- id?: string;
12
- className?: string;
13
- 'aria-label'?: string;
14
- 'aria-labelledby'?: string;
15
- 'aria-describedby'?: string;
16
- 'aria-invalid'?: boolean;
13
+ /** Called after a changed value fills every box; does not submit the form. */
14
+ onComplete?: (code: string) => void;
15
+ /** Native Radix Input props shared by each digit, including onInvalidChange. */
16
+ inputProps?: Omit<DigitProps, "index" | "id" | "children" | "asChild" | "className" | "aria-label" | "aria-invalid" | "aria-describedby">;
17
17
  }
18
18
  /** Styled Radix OTP fields; the primitive owns validation, paste, navigation, focus and form data. */
19
- export declare function OtpInput(props: OtpInputProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare const OtpInput: import("react").ForwardRefExoticComponent<OtpInputProps & import("react").RefAttributes<HTMLDivElement>>;
20
+ export {};
@@ -1,18 +1,20 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createElement as _createElement } from "react";
3
4
  import { unstable_OneTimePasswordField as Primitive } from "radix-ui";
5
+ import { forwardRef } from "react";
4
6
  import { useLocale } from "../../localization.js";
5
7
  import { useUid } from "../../internal/useUid.js";
6
8
  import { cx } from "../../lib/cx.js";
7
9
  /** Styled Radix OTP fields; the primitive owns validation, paste, navigation, focus and form data. */
8
- export function OtpInput(props) {
10
+ export const OtpInput = forwardRef(function OtpInput({ size, length = 6, label, onComplete, inputProps, onValueChange, className, style, id, ...rootProps }, ref) {
9
11
  const { messages } = useLocale();
10
- const length = props.length || 6;
11
12
  const uid = useUid("vk-otp");
12
- const style = { "--vk-otp-length": length };
13
- return (_jsxs(Primitive.Root, { className: cx("vk-otp", props.className), style: style, value: props.value, defaultValue: props.defaultValue, onValueChange: (code) => {
14
- props.onChange?.(code);
13
+ const rootId = id || uid;
14
+ const otpStyle = { "--vk-otp-length": length, ...style };
15
+ return (_jsxs(Primitive.Root, { ...rootProps, ref: ref, id: rootId, className: cx("vk-otp", className), "data-vk-size": size, style: otpStyle, onValueChange: (code) => {
16
+ onValueChange?.(code);
15
17
  if (code.length === length)
16
- props.onComplete?.(code);
17
- }, validationType: props.numeric === false ? "none" : "numeric", name: props.disabled ? undefined : props.name, disabled: props.disabled, "aria-labelledby": props["aria-labelledby"], "aria-label": props["aria-labelledby"] ? undefined : props["aria-label"] || messages.oneTimeCode, children: [Array.from({ length }, (_, index) => (_jsx(Primitive.Input, { index: index, id: index === 0 ? props.id || uid : undefined, className: "vk-input vk-otp-box", "aria-label": messages.digitPosition(props.label || messages.digit, index + 1, length), "aria-invalid": props["aria-invalid"], "aria-describedby": index === 0 ? props["aria-describedby"] : undefined }, index))), _jsx(Primitive.HiddenInput, {})] }));
18
- }
18
+ onComplete?.(code);
19
+ }, "aria-label": rootProps["aria-labelledby"] ? undefined : rootProps["aria-label"] || messages.oneTimeCode, children: [Array.from({ length }, (_, index) => (_createElement(Primitive.Input, { ...inputProps, key: index, index: index, id: rootId + "-digit-" + String(index + 1), className: "vk-input vk-otp-box", "aria-label": messages.digitPosition(label || messages.digit, index + 1, length), "aria-invalid": rootProps["aria-invalid"], "aria-describedby": index === 0 ? rootProps["aria-describedby"] : undefined }))), _jsx(Primitive.HiddenInput, { name: rootProps.disabled ? undefined : rootProps.name, form: rootProps.form })] }));
20
+ });
@@ -8,11 +8,11 @@ export interface PageHeaderProps {
8
8
  breadcrumbs?: BreadcrumbsProps["items"];
9
9
  actions?: ReactNode;
10
10
  badge?: ReactNode;
11
- badgeTone?: BadgeProps["tone"];
11
+ badgeColor?: BadgeProps["color"];
12
12
  divider?: boolean;
13
13
  headingAs?: "h1" | "h2";
14
14
  children?: ReactNode;
15
15
  className?: string;
16
16
  }
17
17
  /** The top of a page inside an app: breadcrumbs, the page title, a description and the page's main actions. */
18
- export declare function PageHeader({ title, description, eyebrow, breadcrumbs, actions, badge, badgeTone, divider, headingAs, children, className }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function PageHeader({ title, description, eyebrow, breadcrumbs, actions, badge, badgeColor, divider, headingAs, children, className }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -5,7 +5,7 @@ import { Breadcrumbs } from "../Breadcrumbs/Breadcrumbs.js";
5
5
  import { cx } from "../../lib/cx.js";
6
6
  import { para } from "../../lib/text.js";
7
7
  /** The top of a page inside an app: breadcrumbs, the page title, a description and the page's main actions. */
8
- export function PageHeader({ title, description, eyebrow, breadcrumbs, actions, badge, badgeTone, divider, headingAs, children, className }) {
8
+ export function PageHeader({ title, description, eyebrow, breadcrumbs, actions, badge, badgeColor, divider, headingAs, children, className }) {
9
9
  const Heading = headingAs || "h1";
10
- return (_jsxs("header", { className: cx("vk-page-header", divider ? "vk-page-header-divider" : null, className), children: [breadcrumbs ? _jsx(Breadcrumbs, { items: breadcrumbs }) : null, _jsxs("div", { className: "vk-page-header-row", children: [_jsxs("div", { className: "vk-page-header-text", children: [eyebrow ? _jsx("p", { className: "vk-page-header-eyebrow", children: eyebrow }) : null, _jsxs(Heading, { className: "vk-page-header-title", children: [title, badge ? _jsx(Badge, { tone: badgeTone, children: badge }) : null] }), description ? createElement(para(description), { className: "vk-page-header-description" }, description) : null] }), actions ? _jsx("div", { className: "vk-page-header-actions", children: actions }) : null] }), children] }));
10
+ return (_jsxs("header", { className: cx("vk-page-header", divider ? "vk-page-header-divider" : null, className), children: [breadcrumbs ? _jsx(Breadcrumbs, { items: breadcrumbs }) : null, _jsxs("div", { className: "vk-page-header-row", children: [_jsxs("div", { className: "vk-page-header-text", children: [eyebrow ? _jsx("p", { className: "vk-page-header-eyebrow", children: eyebrow }) : null, _jsxs(Heading, { className: "vk-page-header-title", children: [title, badge ? _jsx(Badge, { color: badgeColor, children: badge }) : null] }), description ? createElement(para(description), { className: "vk-page-header-description" }, description) : null] }), actions ? _jsx("div", { className: "vk-page-header-actions", children: actions }) : null] }), children] }));
11
11
  }
@@ -1,17 +1,26 @@
1
- import type { ReactElement, ReactNode } from "react";
1
+ import { type ReactElement, type ReactNode } from "react";
2
2
  import { Popover as Primitive } from "radix-ui";
3
+ import type { AppearanceVariant, ControlSize, SemanticColor } from "../../appearance.js";
3
4
  import type { IconName } from "../../types.js";
4
- export interface PopoverProps extends Pick<Primitive.PopoverProps, 'open' | 'defaultOpen' | 'onOpenChange' | 'modal'> {
5
+ export interface PopoverProps extends Omit<Primitive.PopoverProps, "children"> {
5
6
  label: string;
6
7
  title?: string;
7
- icon?: IconName; /** text reads as a sentence-case status ("2 issues"), 12px at xs; outline is the default. */
8
- variant?: 'outline' | 'ghost' | 'primary' | 'text';
9
- size?: 'sm' | 'xs';
10
- align?: 'start' | 'end';
8
+ icon?: IconName;
9
+ variant?: AppearanceVariant;
10
+ color?: SemanticColor;
11
+ size?: ControlSize;
12
+ disabled?: boolean;
13
+ /** Native content placement. */
14
+ side?: Primitive.PopoverContentProps["side"];
15
+ align?: Primitive.PopoverContentProps["align"];
16
+ /** Native trigger attributes and handlers; the ref targets this button. */
17
+ triggerProps?: Omit<Primitive.PopoverTriggerProps, "children" | "asChild" | "className" | "disabled">;
18
+ /** Native positioning, focus, dismissal and content attributes. */
19
+ contentProps?: Omit<Primitive.PopoverContentProps, "children" | "asChild" | "className" | "side" | "align">;
11
20
  width?: string;
12
21
  children: ReactNode;
13
22
  close?: ReactElement;
14
23
  className?: string;
15
24
  }
16
25
  /** Non-modal panel attached to a button (Radix Popover). */
17
- export declare function Popover({ label, title, icon, variant, size, align, width, open, defaultOpen, onOpenChange, modal, children, close, className }: PopoverProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare const Popover: import("react").ForwardRefExoticComponent<PopoverProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,9 +1,10 @@
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 { Popover as Primitive } from "radix-ui";
4
5
  import { Icon } from "../Icon/Icon.js";
5
6
  import { cx } from "../../lib/cx.js";
6
7
  /** Non-modal panel attached to a button (Radix Popover). */
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" : 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
- }
8
+ export const Popover = forwardRef(function Popover({ label, title, icon, variant = "outline", color = "primary", size, disabled, side = "bottom", align = "start", triggerProps, contentProps, width, children, close, className, ...rootProps }, ref) {
9
+ return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { ...rootProps, children: [_jsxs(Primitive.Trigger, { ...triggerProps, ref: ref, className: "vk-btn", disabled: disabled, "data-vk-size": size, "data-vk-color": color, "data-vk-variant": variant, 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, { forceMount: contentProps?.forceMount, children: _jsxs(Primitive.Content, { "aria-label": title || label, sideOffset: 4, collisionPadding: 8, ...contentProps, className: "vk-popover vk-popover-panel", side: side, align: align, style: width ? { ...contentProps?.style, width } : contentProps?.style, 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] }) })] }) }));
10
+ });
@@ -1,13 +1,13 @@
1
- import type { ReactNode } from "react";
2
- export interface ProgressProps {
3
- value?: number | null;
4
- max?: number;
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
2
+ import { Progress as Primitive } from "radix-ui";
3
+ import type { SemanticColor } from "../../appearance.js";
4
+ export interface ProgressProps extends Omit<ComponentPropsWithoutRef<typeof Primitive.Root>, "children" | "asChild"> {
5
+ /** A visible label associated with the progressbar. */
5
6
  label?: ReactNode;
7
+ /** Displays the percentage, or the upstream getValueLabel result. */
6
8
  showValue?: boolean;
7
- valueText?: string;
8
- tone?: "primary" | "success" | "warning" | "danger";
9
- "aria-label"?: string;
10
- className?: string;
9
+ /** Theme-aware fill palette. */
10
+ color?: SemanticColor;
11
11
  }
12
- /** A bar showing how far a task has got, or that it is still running (Radix Progress). */
13
- export declare function Progress({ value, max: maxProp, label, showValue, valueText, tone, "aria-label": ariaLabel, className }: ProgressProps): import("react/jsx-runtime").JSX.Element;
12
+ /** Styled Radix Progress. Native props and the ref target its progressbar root. */
13
+ export declare const Progress: import("react").ForwardRefExoticComponent<ProgressProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,20 +1,16 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useLocale } from "../../localization.js";
3
+ import { forwardRef } from "react";
4
4
  import { Progress as Primitive } from "radix-ui";
5
+ import { useLocale } from "../../localization.js";
5
6
  import { useUid } from "../../internal/useUid.js";
6
7
  import { cx } from "../../lib/cx.js";
7
- // The label and the value above the bar; the value is left out while indeterminate.
8
- function ProgressRow({ label, labelId, value }) {
9
- return (_jsxs("div", { className: "vk-progress-row", children: [label ? _jsx("span", { id: labelId, className: "vk-progress-label", children: label }) : _jsx("span", {}), value != null ? _jsx("span", { className: "vk-progress-value", children: value }) : null] }));
10
- }
11
- /** A bar showing how far a task has got, or that it is still running (Radix Progress). */
12
- export function Progress({ value, max: maxProp, label, showValue, valueText, tone, "aria-label": ariaLabel, className }) {
8
+ /** Styled Radix Progress. Native props and the ref target its progressbar root. */
9
+ export const Progress = forwardRef(function Progress({ value, max = 100, label, showValue, getValueLabel, color = "primary", "aria-label": ariaLabel, className, ...props }, ref) {
13
10
  const { messages } = useLocale();
14
- const max = maxProp ?? 100;
11
+ const labelId = useUid("vk-progress");
15
12
  const indeterminate = value == null;
16
13
  const pct = value == null ? 0 : (value / max) * 100;
17
- const labelId = useUid("vk-progress");
18
- const shownValue = showValue && !indeterminate ? valueText || String(Math.round(pct)) + "%" : null;
19
- return (_jsxs("div", { className: cx("vk-progress", "vk-progress-" + (tone || "primary"), className), children: [label || showValue ? _jsx(ProgressRow, { label: label, labelId: labelId, value: shownValue }) : null, _jsx(Primitive.Root, { value: value, max: max, "aria-labelledby": label ? labelId : undefined, "aria-label": label ? undefined : ariaLabel || messages.progress, getValueLabel: valueText === undefined ? undefined : () => valueText, className: "vk-progress-track", children: indeterminate ? null : _jsx(Primitive.Indicator, { className: "vk-progress-fill", style: { width: String(pct) + "%" } }) })] }));
20
- }
14
+ const shownValue = showValue && value != null ? getValueLabel?.(value, max) ?? String(Math.round(pct)) + "%" : null;
15
+ return (_jsxs("div", { className: "vk-progress", "data-vk-color": color, children: [label || showValue ? _jsxs("div", { className: "vk-progress-row", children: [label ? _jsx("span", { id: labelId, className: "vk-progress-label", children: label }) : _jsx("span", {}), shownValue != null ? _jsx("span", { className: "vk-progress-value", children: shownValue }) : null] }) : null, _jsx(Primitive.Root, { ...props, ref: ref, value: value, max: max, getValueLabel: getValueLabel, "aria-labelledby": props["aria-labelledby"] ?? (label ? labelId : undefined), "aria-label": label ? ariaLabel : ariaLabel ?? messages.progress, className: cx("vk-progress-track", className), children: indeterminate ? null : _jsx(Primitive.Indicator, { className: "vk-progress-fill", style: { width: String(pct) + "%" } }) })] }));
16
+ });
@@ -1,10 +1,11 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { TextEmphasis } from "../../typography.js";
2
3
  import type { AsProp } from "../../types.js";
3
4
  export interface ProseProps extends AsProp {
4
5
  children?: ReactNode;
5
6
  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";
7
+ /** Muted by default for articles; default emphasis uses foreground for record descriptions and messages. */
8
+ emphasis?: Extract<TextEmphasis, "default" | "muted">;
8
9
  }
9
10
  /** Styles long-form HTML (help articles, release notes, rendered Markdown) without a class on every element. */
10
- export declare function Prose({ as, children, className, tone }: ProseProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function Prose({ as, children, className, emphasis }: 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, tone }) {
4
+ export function Prose({ as, children, className, emphasis }) {
5
5
  const Tag = as || "div";
6
- return _jsx(Tag, { className: cx("vk-prose", tone === "foreground" && "vk-prose-foreground", className), children: children });
6
+ return _jsx(Tag, { className: cx("vk-prose", emphasis === "default" && "vk-prose-foreground", className), children: children });
7
7
  }
@@ -1,9 +1,9 @@
1
- import type { InputHTMLAttributes } from "react";
1
+ import { type InputHTMLAttributes } from "react";
2
2
  import type { ChoiceTextProps } from "../../internal/choice.js";
3
- export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type">, ChoiceTextProps {
3
+ export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "color">, ChoiceTextProps {
4
4
  }
5
5
  /**
6
6
  * Square radio (inner square dot) with label and optional description. A native radio, since Radix radios only
7
7
  * work inside a group; `RadioGroup` draws the same box with Radix RadioGroup.
8
8
  */
9
- export declare function Radio(props: RadioProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import { nativeRadio } from "../../internal/choice.js";
3
+ import { forwardRef } from "react";
3
4
  /**
4
5
  * Square radio (inner square dot) with label and optional description. A native radio, since Radix radios only
5
6
  * work inside a group; `RadioGroup` draws the same box with Radix RadioGroup.
6
7
  */
7
- export function Radio(props) {
8
- return nativeRadio(props);
9
- }
8
+ export const Radio = forwardRef(function Radio(props, ref) {
9
+ return nativeRadio(props, ref);
10
+ });
@@ -1,6 +1,11 @@
1
1
  import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
2
  import { RadioGroup as Primitive } from "radix-ui";
3
- export interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<typeof Primitive.Root>, "asChild" | "children" | "onChange"> {
3
+ import type { ControlSize, SemanticColor } from "../../appearance.js";
4
+ export interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<typeof Primitive.Root>, "asChild" | "children" | "onChange" | "color"> {
5
+ /** Shared dimensions of each choice. */
6
+ size?: ControlSize;
7
+ /** Semantic palette of the selected option. */
8
+ color?: SemanticColor;
4
9
  label: ReactNode;
5
10
  options: (string | {
6
11
  value: string;
@@ -11,4 +16,4 @@ export interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<typeof Pr
11
16
  inline?: boolean;
12
17
  }
13
18
  /** Styled Radix RadioGroup with a fieldset legend and direct onValueChange(value) callbacks. */
14
- export declare function RadioGroup({ label, options, inline, className, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function RadioGroup({ label, options, inline, className, size, color, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -5,10 +5,10 @@ import { ChoiceLabel } from "../../internal/choice.js";
5
5
  import { useUid } from "../../internal/useUid.js";
6
6
  import { cx } from "../../lib/cx.js";
7
7
  /** Styled Radix RadioGroup with a fieldset legend and direct onValueChange(value) callbacks. */
8
- export function RadioGroup({ label, options, inline, className, ...props }) {
8
+ export function RadioGroup({ label, options, inline, className, size, color, ...props }) {
9
9
  const legendId = useUid("vk-radio-group");
10
10
  return (_jsx(Primitive.Root, { ...props, asChild: true, children: _jsxs("fieldset", { className: cx("vk-choice-group", inline && "vk-choice-group-inline", className), "aria-labelledby": legendId, children: [_jsx("legend", { id: legendId, className: "vk-field-label", children: label }), _jsx("div", { className: "vk-choice-list", children: options.map((option) => {
11
11
  const item = typeof option === "string" ? { value: option, label: option } : option;
12
- return (_jsx(ChoiceLabel, { label: item.label, description: item.description, disabled: props.disabled || item.disabled, children: _jsx(Primitive.Item, { className: "vk-choice-box vk-choice-box-radio", value: item.value, disabled: item.disabled, children: _jsx(Primitive.Indicator, { forceMount: true, className: "vk-choice-dot" }) }) }, item.value));
12
+ return (_jsx(ChoiceLabel, { size: size, color: color, label: item.label, description: item.description, disabled: props.disabled || item.disabled, children: _jsx(Primitive.Item, { className: "vk-choice-box vk-choice-box-radio", value: item.value, disabled: item.disabled, children: _jsx(Primitive.Indicator, { forceMount: true, className: "vk-choice-dot" }) }) }, item.value));
13
13
  }) })] }) }));
14
14
  }
@@ -1,5 +1,10 @@
1
1
  import { type ChangeEvent, type InputHTMLAttributes } from "react";
2
- export interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'type'> {
2
+ import type { ControlSize } from "../../appearance.js";
3
+ export interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'type' | 'size'> {
4
+ /** Visual size shared with actions and other fields. */
5
+ size?: ControlSize;
6
+ /** Native input width in characters. */
7
+ htmlSize?: number;
3
8
  value?: string;
4
9
  defaultValue?: string;
5
10
  onChange?: (value: string, event?: ChangeEvent<HTMLInputElement>) => void;
@@ -20,13 +20,13 @@ export const SearchInput = forwardRef(function SearchInput(props, ref) {
20
20
  else if (ref)
21
21
  ref.current = el;
22
22
  }, [ref]);
23
- const rest = omit(props, ["value", "defaultValue", "onChange", "onClear", "className", "clearLabel"]);
23
+ const rest = omit(props, ["size", "htmlSize", "value", "defaultValue", "onChange", "onClear", "className", "clearLabel"]);
24
24
  const set = (v, e) => {
25
25
  if (!controlled)
26
26
  setText(v);
27
27
  props.onChange?.(v, e);
28
28
  };
29
- return (_jsxs("span", { className: cx("vk-search", props.className), children: [_jsx(Icon, { name: "search", size: 16, className: "vk-search-icon" }), _jsx("input", { ref: setRef, type: "search", className: "vk-input vk-search-input", autoComplete: "off", ...rest, value: value, onChange: (e) => { set(e.target.value, e); }, onKeyDown: (e) => {
29
+ return (_jsxs("span", { className: cx("vk-search", props.className), "data-vk-size": props.size, children: [_jsx(Icon, { name: "search", size: 16, className: "vk-search-icon" }), _jsx("input", { ref: setRef, type: "search", className: "vk-input vk-search-input", autoComplete: "off", ...rest, size: props.htmlSize, value: value, onChange: (e) => { set(e.target.value, e); }, onKeyDown: (e) => {
30
30
  if (e.key === "Escape" && value) {
31
31
  e.preventDefault();
32
32
  set("");
@@ -1,19 +1,19 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
+ import { RadioGroup as Primitive } from "radix-ui";
2
3
  import type { IconName } from "../../types.js";
4
+ import type { AppearanceVariant, ControlSize, SemanticColor } from "../../appearance.js";
3
5
  /** Exclusive options that apply immediately (radiogroup). */
4
- export interface SegmentedControlProps {
6
+ export interface SegmentedControlProps extends Omit<Primitive.RadioGroupProps, "children" | "color" | "asChild"> {
5
7
  options: (string | {
6
8
  value: string;
7
9
  label: ReactNode;
8
10
  icon?: IconName;
9
11
  disabled?: boolean;
10
12
  })[];
11
- value?: string;
12
- defaultValue?: string;
13
- onChange?: (value: string) => void;
14
13
  label?: string;
15
- size?: "sm" | "xs";
16
- className?: string;
14
+ size?: ControlSize;
15
+ color?: SemanticColor;
16
+ variant?: Extract<AppearanceVariant, "solid" | "soft" | "outline">;
17
17
  }
18
18
  /** Exclusive options that apply immediately (Radix RadioGroup): one Tab stop, arrow keys move the selection and wrap. */
19
- export declare function SegmentedControl({ options: optionsProp, value: valueProp, defaultValue, onChange, label, size, className }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare const SegmentedControl: import("react").ForwardRefExoticComponent<SegmentedControlProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,11 +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 { RadioGroup as Primitive } from "radix-ui";
4
5
  import { Icon } from "../Icon/Icon.js";
5
6
  import { cx } from "../../lib/cx.js";
6
7
  import { normalizeOptions } from "../../internal/options.js";
7
8
  /** Exclusive options that apply immediately (Radix RadioGroup): one Tab stop, arrow keys move the selection and wrap. */
8
- export function SegmentedControl({ options: optionsProp, value: valueProp, defaultValue, onChange, label, size, className }) {
9
+ export const SegmentedControl = forwardRef(function SegmentedControl({ options: optionsProp, label, size, color = "primary", variant = "soft", className, ...rootProps }, ref) {
9
10
  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", 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
+ return (_jsx(Primitive.Root, { ...rootProps, ref: ref, "aria-label": rootProps["aria-label"] ?? label, className: cx("vk-segmented", className), "data-vk-size": size, "data-vk-color": color, "data-vk-variant": variant, 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))) }));
12
+ });
@@ -1,20 +1,15 @@
1
1
  import { type ComponentPropsWithoutRef } from "react";
2
2
  import { Select as Primitive } from "radix-ui";
3
+ import type { ControlSize } from "../../appearance.js";
3
4
  import type { SelectOption } from "../../types.js";
4
5
  type RootProps = ComponentPropsWithoutRef<typeof Primitive.Root>;
5
- export interface SelectProps extends Omit<RootProps, "children" | "value" | "defaultValue" | "onValueChange"> {
6
+ export interface SelectProps extends Omit<RootProps, "children"> {
6
7
  /** Non-empty string values, following Radix Select's item contract. */
7
8
  options: (string | SelectOption)[];
8
9
  /** Shown until an option is selected. */
9
10
  placeholder?: string;
10
- /** The selected option; null clears the selection. */
11
- value?: string | null;
12
- /** The initial selection for an uncontrolled select. */
13
- defaultValue?: string;
14
- /** Receives Radix's changed value and its matching option. */
15
- onChange?: (value: string, option: SelectOption) => void;
16
- /** xs for toolbars and status lines (24px with small type on fine pointers, 44px on touch); forms keep the control height. */
17
- size?: 'xs';
11
+ /** Visual size shared with actions and other fields. */
12
+ size?: ControlSize;
18
13
  id?: string;
19
14
  className?: string;
20
15
  "aria-label"?: string;