@vokality/design-system 1.2.3 → 2.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 (37) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +6 -0
  3. package/dist/components/Badge/Badge.d.ts +6 -4
  4. package/dist/components/Badge/Badge.js +6 -4
  5. package/dist/components/Button/Button.d.ts +2 -1
  6. package/dist/components/Field/Field.js +2 -2
  7. package/dist/components/Fieldset/Fieldset.d.ts +11 -0
  8. package/dist/components/Fieldset/Fieldset.js +12 -0
  9. package/dist/components/Grid/Grid.d.ts +866 -4
  10. package/dist/components/Grid/Grid.js +3 -4
  11. package/dist/components/Inline/Inline.d.ts +866 -4
  12. package/dist/components/Inline/Inline.js +3 -4
  13. package/dist/components/Stack/Stack.d.ts +866 -4
  14. package/dist/components/Stack/Stack.js +3 -4
  15. package/dist/components/Text/Text.d.ts +15 -4
  16. package/dist/components/Text/Text.js +3 -4
  17. package/dist/components.css +166 -19
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.js +1 -0
  20. package/dist/internal/describedBy.d.ts +3 -0
  21. package/dist/internal/describedBy.js +4 -0
  22. package/dist/tokens.css +2 -0
  23. package/dist/tokens.dtcg.json +10 -0
  24. package/dist/tokens.json +10 -0
  25. package/dist/types.d.ts +6 -1
  26. package/dist/vokality.css +168 -19
  27. package/dist/vokality.iife.js +945 -912
  28. package/docs/brand.md +3 -1
  29. package/docs/components/Badge/README.md +2 -0
  30. package/docs/components/Button/README.md +7 -3
  31. package/docs/components/Fieldset/README.md +25 -0
  32. package/docs/components/Grid/README.md +2 -0
  33. package/docs/components/Inline/README.md +2 -0
  34. package/docs/components/PageHeader/README.md +2 -0
  35. package/docs/components/Stack/README.md +2 -0
  36. package/docs/components/Text/README.md +4 -0
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,41 @@
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
+ ## 2.0.0 — 2026-10-14
6
+
7
+ ### Changed (breaking)
8
+ - With a coarse pointer, buttons and icon buttons of both sizes, form controls, menu, navigation and tree rows, choices, tabs, calendar days, segmented controls and pagination are 44px in every density (WCAG 2.5.5, Apple HIG). Fine-pointer sizes are unchanged; touch layouts grow, so check dense touch screens.
9
+ - In an `Inline` row that contains a field, buttons, icon buttons and segmented controls take the field height (`--control-height`) so they sit flush.
10
+ - Compact density: `--button-height`, `--button-height-sm` and the new control tokens are redefined instead of overriding component classes, so component-specific sizes (alert and toast close buttons, calendar navigation) win again. Compact also tightens table cells, list, navigation and menu rows, and cards; scales body-sm, small, lead, section lead and card, empty-state and media-card titles; keeps `sm` buttons smaller than default ones; and no longer enlarges metadata (11px in both densities).
11
+ - `Text wrap` is renamed `overflowWrap`, so it no longer shares a name with `Inline`'s boolean `wrap`.
12
+ - Compact page headers and section headers still add no trailing space; the AppShell, Dashboard, ListDetail, FormPage and SettingsPage templates now compose their header and content with `Stack`.
13
+
14
+ ### Added
15
+ - `--control-font-size` and `--control-padding-block` tokens. Compact sets 14px input text and tighter padding for fine pointers only; inputs keep 16px text whenever a coarse pointer is available, which stops iOS zooming on focus.
16
+ - `data-density="compact"` works on any element, not only `html`.
17
+ - `Stack`, `Inline`, `Grid` and `Text` type their attributes and events for the element they render `as` (for example `Inline as="form"` gives `onSubmit` a form event).
18
+ - Small controls (tag remove, sortable headers, alert close, slider thumb) extend their hit area to at least 24px (WCAG 2.5.8), and to 44px on touch where neighbours allow, without changing their look.
19
+ - A scrolling tab list fades the edge that has more tabs behind it.
20
+
21
+ ### Fixed
22
+ - Single-line fields are exactly `--control-height` (44px) tall; they inherited the body line-height and rendered at 46.8px.
23
+ - Compact: the CommandPalette and shell search keep their own heights and icon positions; a compact PageHeader fills start-aligned stacks and moves its actions below the title in narrow headers with an eyebrow; badges with `tabIndex={-1}` are not sized as targets; described checkboxes, radios and switches keep their box on the first line; textareas keep their padding.
24
+ - Date range triggers and MultiSelect fields follow the control height and font size; select options follow the control font size.
25
+ - `Fieldset` shares `Field`'s hint and error styles.
26
+ - Under 40rem, chart table toggles and date-picker footer buttons keep their width instead of filling the row.
27
+ - Bordered lists pad trailing content like the main cell, and a selected row tints the whole row.
28
+ - CodeBlock uses the mono font for its code; a selected day that is also unavailable stays readable.
29
+ - AvatarGroup's overflow count uses the initials' font, and slider values share a width so stacked sliders line up.
30
+
31
+ ## 1.3.0 — 2026-10-14
32
+
33
+ ### Added
34
+ - Opt-in compact application density through `data-density="compact"` on `html`: smaller heading and data scales, aligned page actions, consistent control heights and touch targets. Existing defaults are unchanged.
35
+ - `Fieldset` groups related controls with a native legend, group hint and error.
36
+ - `Button variant="text"` for sentence-case record actions with multiline labels and system focus/target behavior.
37
+ - `Badge` status icons, forwarded refs and standard attributes for keyboard-accessible tooltips.
38
+ - `Text` numeric typography, wrapping and weight options. Layout primitives and Text forward standard attributes and events.
39
+
5
40
  ## 1.2.3 — 2026-10-12
6
41
 
7
42
  ### Changed
package/README.md CHANGED
@@ -86,6 +86,12 @@ const { theme, resolvedTheme, setTheme } = useTheme(); // theme: "system" | "dar
86
86
 
87
87
  Pages not rendered by React can inline `themeScript()` instead. See `docs/components/ThemeScript/README.md`.
88
88
 
89
+ ## Compact applications
90
+
91
+ Set `<html data-density="compact">` for dense operational interfaces. It uses 20px page titles, 16px section titles, 14px body text and 24px statistics, never enlarges smaller text, and tightens table cells, list and navigation rows, menus and cards. Page-header actions align with the title; headers leave section spacing to `Stack` instead of adding another margin. With only a fine pointer, buttons and fields share a 32px height and inputs use 14px text; when a coarse pointer is available they keep 44px targets and 16px input text, which stops iOS zooming on focus. Density redefines the control tokens (`--control-height`, `--control-font-size`, `--control-padding-block`) and the button heights, so components that size from them follow it while component-specific sizes still apply. Apply density to `html` so portalled dialogs and menus inherit it; a subtree with the attribute also works. Omitting the attribute preserves the existing defaults.
92
+
93
+ Compose pages with `Stack`, `Inline` and `Grid`; these forward standard attributes and events typed for the element they render, including `Inline as="form" onSubmit={...}`. Use `Fieldset` for related controls, `Button variant="text"` for record names, and `Text numeric overflowWrap="anywhere"` for long identifiers.
94
+
89
95
  ## Starting a new project
90
96
 
91
97
  [`Vokality/app-template`](https://github.com/Vokality/app-template) is a Next.js app already set up with this package: `.npmrc`, CSS imports, theme switching, the app shell, sample pages, CI and Dependabot. On GitHub, choose **Use this template**.
@@ -1,9 +1,11 @@
1
- import type { ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ import type { IconName } from "../../lib/icons.js";
2
3
  /** Outlined uppercase status tag. */
3
- export interface BadgeProps {
4
+ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
4
5
  children: ReactNode;
5
6
  tone?: "neutral" | "info" | "success" | "warning" | "danger";
6
- className?: string;
7
+ /** Status icon beside its visible label. */
8
+ icon?: IconName;
7
9
  }
8
10
  /** Outlined uppercase status tag. */
9
- export declare function Badge({ children, tone, className }: BadgeProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
@@ -1,6 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { cx } from "../../lib/cx.js";
4
+ import { Icon } from "../Icon/Icon.js";
3
5
  /** Outlined uppercase status tag. */
4
- export function Badge({ children, tone, className }) {
5
- return _jsx("span", { className: cx("vk-badge", tone && "vk-badge-" + tone, className), children: children });
6
- }
6
+ export const Badge = forwardRef(function Badge({ children, tone, icon, className, ...rest }, ref) {
7
+ return _jsxs("span", { ref: ref, className: cx("vk-badge", tone && "vk-badge-" + tone, icon && "vk-badge-icon", className), ...rest, children: [icon ? _jsx(Icon, { name: icon, size: 14 }) : null, children] });
8
+ });
@@ -1,6 +1,7 @@
1
1
  import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ReactNode } from "react";
2
2
  export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement> & AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> {
3
- variant?: 'primary' | 'outline' | 'ghost' | 'danger';
3
+ /** Visual emphasis; text keeps record names in sentence case. */
4
+ variant?: 'primary' | 'outline' | 'ghost' | 'danger' | 'text';
4
5
  size?: 'sm';
5
6
  href?: string;
6
7
  /** Disables the button, sets aria-busy and shows a spinner. */
@@ -2,16 +2,16 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cloneElement, isValidElement } from "react";
4
4
  import { Label } from "radix-ui";
5
+ import { describedBy } from "../../internal/describedBy.js";
5
6
  import { useUid } from "../../internal/useUid.js";
6
7
  import { cx } from "../../lib/cx.js";
7
8
  /** Label (Radix Label), hint and error around one control; wires id, aria-describedby and aria-invalid onto the child. */
8
9
  export function Field(props) {
9
10
  const uid = useUid("vk-field");
10
11
  const id = props.id || uid;
11
- const describedBy = [props.hint ? id + "-hint" : null, props.error ? id + "-error" : null].filter(Boolean).join(" ") || undefined;
12
12
  const labelId = id + "-label";
13
13
  const control = isValidElement(props.children)
14
- ? cloneElement(props.children, { id, "aria-labelledby": labelId, "aria-describedby": describedBy, "aria-invalid": props.error ? true : undefined })
14
+ ? cloneElement(props.children, { id, "aria-labelledby": labelId, "aria-describedby": describedBy(id, props.hint, props.error), "aria-invalid": props.error ? true : undefined })
15
15
  : props.children;
16
16
  // A custom combobox only takes focus from its label; the click is not forwarded to it.
17
17
  const focusControl = (e) => {
@@ -0,0 +1,11 @@
1
+ import { type FieldsetHTMLAttributes, type ReactNode } from "react";
2
+ export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {
3
+ /** Accessible name for a related group of controls. */
4
+ legend: ReactNode;
5
+ /** Instructions applying to the entire group. */
6
+ hint?: ReactNode;
7
+ /** Validation message applying to the entire group. */
8
+ error?: ReactNode;
9
+ }
10
+ /** Groups related controls with a native legend and shared instructions. */
11
+ export declare const Fieldset: import("react").ForwardRefExoticComponent<FieldsetProps & import("react").RefAttributes<HTMLFieldSetElement>>;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef } from "react";
4
+ import { describedBy } from "../../internal/describedBy.js";
5
+ import { useUid } from "../../internal/useUid.js";
6
+ import { cx } from "../../lib/cx.js";
7
+ /** Groups related controls with a native legend and shared instructions. */
8
+ export const Fieldset = forwardRef(function Fieldset({ legend, hint, error, children, className, id, "aria-describedby": existing, ...rest }, ref) {
9
+ const uid = useUid("vk-fieldset");
10
+ const groupId = id || uid;
11
+ return (_jsxs("fieldset", { ref: ref, id: groupId, className: cx("vk-fieldset", className), "aria-describedby": describedBy(groupId, hint, error, existing), "aria-invalid": error ? true : undefined, ...rest, children: [_jsx("legend", { className: "vk-fieldset-legend", children: legend }), hint ? _jsx("p", { className: "vk-field-hint vk-fieldset-hint", id: groupId + "-hint", children: hint }) : null, _jsx("div", { className: "vk-fieldset-controls", children: children }), error ? _jsx("p", { className: "vk-field-error vk-fieldset-error", id: groupId + "-error", children: error }) : null] }));
12
+ });