@tangible/ui 0.2.23 → 0.2.24

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 (46) hide show
  1. package/components/Checkbox/Checkbox.js +1 -1
  2. package/components/DatePicker/DateRangePicker.js +1 -1
  3. package/components/Dropdown/Dropdown.js +1 -1
  4. package/components/GradientPicker/GradientPicker.js +3 -3
  5. package/components/NavMenu/NavMenu.d.ts +26 -0
  6. package/components/NavMenu/NavMenu.js +113 -0
  7. package/components/NavMenu/index.d.ts +2 -0
  8. package/components/NavMenu/index.js +1 -0
  9. package/components/NavMenu/types.d.ts +75 -0
  10. package/components/NavMenu/types.js +4 -0
  11. package/components/index.d.ts +2 -0
  12. package/components/index.js +1 -0
  13. package/figma-tokens.json +90 -1
  14. package/package.json +5 -1
  15. package/skills/building-with-tui/SKILL.md +10 -6
  16. package/styles/all.css +1 -1
  17. package/styles/all.expanded.css +429 -64
  18. package/styles/all.expanded.unlayered.css +429 -64
  19. package/styles/all.unlayered.css +1 -1
  20. package/styles/components/_bundle.scss +2 -0
  21. package/styles/components/checkbox.scss +13 -2
  22. package/styles/components/color-picker.scss +12 -4
  23. package/styles/components/combobox.scss +7 -6
  24. package/styles/components/date-picker.scss +8 -6
  25. package/styles/components/dropdown.scss +3 -5
  26. package/styles/components/gradient-picker.scss +3 -5
  27. package/styles/components/input/index.scss +16 -6
  28. package/styles/components/multi-combobox.scss +6 -6
  29. package/styles/components/multi-select.scss +10 -7
  30. package/styles/components/nav-menu.scss +212 -0
  31. package/styles/components/radio.scss +11 -3
  32. package/styles/components/search-select.scss +7 -7
  33. package/styles/components/select.scss +7 -6
  34. package/styles/components/slider.scss +1 -1
  35. package/styles/components/switch.scss +1 -1
  36. package/styles/components/text-input.scss +15 -1
  37. package/styles/core.css +1 -1
  38. package/styles/core.unlayered.css +1 -1
  39. package/styles/index.scss +18 -0
  40. package/styles/system/_constants.scss +0 -6
  41. package/styles/system/_palettes.scss +6 -0
  42. package/styles/system/_text-styles.scss +200 -0
  43. package/styles/system/_tokens.scss +7 -0
  44. package/styles/system/index.scss +3 -1
  45. package/tui-manifest.json +94 -3
  46. package/utils/listbox/group.js +3 -1
@@ -16,7 +16,7 @@ import { isDev } from '../../utils/is-dev.js';
16
16
  //
17
17
  // CSS token API (component layer, read via fallback):
18
18
  // --tui-checkbox-accent Accent color → --tui-input-accent → --tui-theme-primary-base
19
- // --tui-checkbox-border Border color → --tui-color-border
19
+ // --tui-checkbox-border Border color → --tui-input-border → --tui-color-border-control
20
20
  // --tui-checkbox-border-invalid Invalid border → --tui-theme-danger-base
21
21
  // --tui-checkbox-radius Border radius → --tui-radius-sm
22
22
  // --tui-checkbox-bg Background → --tui-color-bg
@@ -167,7 +167,7 @@ function RangeField({ label, value, locale, onCommit, }) {
167
167
  if (parsed)
168
168
  onCommit(parsed);
169
169
  };
170
- return (_jsxs("label", { className: "tui-date-range-picker__field", children: [_jsx("span", { className: "tui-date-range-picker__field-label", children: label }), _jsx(TextInput, { value: text ?? value, onChange: (e) => setText(e.target.value), onBlur: (e) => commit(e.target.value), onKeyDown: (e) => {
170
+ return (_jsxs("label", { className: "tui-date-range-picker__field", children: [_jsx("span", { className: "tui-date-range-picker__field-label tui-text-style-overline", children: label }), _jsx(TextInput, { value: text ?? value, onChange: (e) => setText(e.target.value), onBlur: (e) => commit(e.target.value), onKeyDown: (e) => {
171
171
  if (e.key === 'Enter')
172
172
  commit(e.currentTarget.value);
173
173
  } })] }));
@@ -277,7 +277,7 @@ DropdownSeparatorComponent.displayName = 'Dropdown.Separator';
277
277
  * Non-interactive section label for grouping menu items.
278
278
  */
279
279
  function DropdownHeaderComponent({ className, children }) {
280
- return (_jsx("div", { role: "presentation", className: cx('tui-dropdown__header', className), children: children }));
280
+ return (_jsx("div", { role: "presentation", className: cx('tui-dropdown__header', 'tui-text-style-overline', className), children: children }));
281
281
  }
282
282
  DropdownHeaderComponent.displayName = 'Dropdown.Header';
283
283
  export const Dropdown = DropdownRoot;
@@ -33,7 +33,7 @@ function NumberField({ label, hideLabel, value, min, max, suffix, disabled, onCo
33
33
  if (raw >= min && raw <= max)
34
34
  onCommit(raw);
35
35
  };
36
- return (_jsxs("span", { className: cx('tui-gradient-picker__field', className), children: [!hideLabel && (_jsx("label", { className: "tui-gradient-picker__label", htmlFor: id, children: label })), _jsx(TextInput, { id: id, size: "sm", inputMode: "decimal", autoComplete: "off", spellCheck: false, value: display, suffix: suffix, disabled: disabled, role: "spinbutton", "aria-label": hideLabel ? label : undefined, "aria-valuenow": round1(value), "aria-valuetext": `${round1(value)}${suffix ?? ''}`, "aria-valuemin": min, "aria-valuemax": max, onChange: (e) => {
36
+ return (_jsxs("span", { className: cx('tui-gradient-picker__field', className), children: [!hideLabel && (_jsx("label", { className: "tui-gradient-picker__label tui-text-style-overline", htmlFor: id, children: label })), _jsx(TextInput, { id: id, size: "sm", inputMode: "decimal", autoComplete: "off", spellCheck: false, value: display, suffix: suffix, disabled: disabled, role: "spinbutton", "aria-label": hideLabel ? label : undefined, "aria-valuenow": round1(value), "aria-valuetext": `${round1(value)}${suffix ?? ''}`, "aria-valuemin": min, "aria-valuemax": max, onChange: (e) => {
37
37
  const text = e.target.value;
38
38
  setDraft(text);
39
39
  const num = parseFloat(text);
@@ -181,11 +181,11 @@ export function GradientPicker({ value: controlledValue, defaultValue = formatGr
181
181
  // stop after the reorder — close it instead.
182
182
  setOpenStop(null);
183
183
  patch({ stops: reverseStops(stops) });
184
- } }) }), _jsx(Tooltip.Content, { children: L.reverse })] }), _jsxs(Tooltip, { children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx(IconButton, { icon: "system/copy", label: L.copy, variant: "ghost", size: "sm", disabled: disabled, onClick: handleCopy }) }), _jsx(Tooltip.Content, { children: copied ? L.copied : L.copy })] })] }), _jsxs("div", { className: "tui-gradient-picker__stops", children: [_jsx("span", { className: "tui-gradient-picker__label", children: L.stopsHeading }), stops.map((stop, i) => (_jsxs("div", { className: "tui-gradient-picker__stop", children: [_jsxs(Popover, { open: openStop === i, onOpenChange: (open) => setOpenStop(open ? i : null), children: [_jsx(Popover.Trigger, { asChild: true, children: _jsx("button", { type: "button", className: "tui-gradient-picker__swatch", "aria-label": L.editStop(i + 1), disabled: disabled, children: _jsx("span", { className: "tui-gradient-picker__swatch-fill", "aria-hidden": "true", style: { '--_swatch': stop.color } }) }) }), _jsx(Popover.Content, { side: "bottom", align: "start", modal: true, "aria-label": L.editStop(i + 1), className: "tui-gradient-picker__stop-popover", children: _jsx(ColorPicker, { value: stop.color, onValueChange: (color) => updateStop(i, { color }), alpha: alpha, formats: formats }) })] }), _jsx(NumberField, { label: L.stopPosition(i + 1), hideLabel: true, value: stop.position, min: stops[i - 1]?.position ?? 0, max: stops[i + 1]?.position ?? 100, suffix: "%", disabled: disabled, onCommit: (position) => updateStop(i, { position: round1(position) }), className: "tui-gradient-picker__stop-position" }), _jsx(IconButton, { ref: (el) => {
184
+ } }) }), _jsx(Tooltip.Content, { children: L.reverse })] }), _jsxs(Tooltip, { children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx(IconButton, { icon: "system/copy", label: L.copy, variant: "ghost", size: "sm", disabled: disabled, onClick: handleCopy }) }), _jsx(Tooltip.Content, { children: copied ? L.copied : L.copy })] })] }), _jsxs("div", { className: "tui-gradient-picker__stops", children: [_jsx("span", { className: "tui-gradient-picker__label tui-text-style-overline", children: L.stopsHeading }), stops.map((stop, i) => (_jsxs("div", { className: "tui-gradient-picker__stop", children: [_jsxs(Popover, { open: openStop === i, onOpenChange: (open) => setOpenStop(open ? i : null), children: [_jsx(Popover.Trigger, { asChild: true, children: _jsx("button", { type: "button", className: "tui-gradient-picker__swatch", "aria-label": L.editStop(i + 1), disabled: disabled, children: _jsx("span", { className: "tui-gradient-picker__swatch-fill", "aria-hidden": "true", style: { '--_swatch': stop.color } }) }) }), _jsx(Popover.Content, { side: "bottom", align: "start", modal: true, "aria-label": L.editStop(i + 1), className: "tui-gradient-picker__stop-popover", children: _jsx(ColorPicker, { value: stop.color, onValueChange: (color) => updateStop(i, { color }), alpha: alpha, formats: formats }) })] }), _jsx(NumberField, { label: L.stopPosition(i + 1), hideLabel: true, value: stop.position, min: stops[i - 1]?.position ?? 0, max: stops[i + 1]?.position ?? 100, suffix: "%", disabled: disabled, onCommit: (position) => updateStop(i, { position: round1(position) }), className: "tui-gradient-picker__stop-position" }), _jsx(IconButton, { ref: (el) => {
185
185
  removeRefs.current[i] = el;
186
186
  }, icon: "system/trash", label: L.removeStop(i + 1), variant: "ghost", theme: "danger", size: "sm", disabled: disabled || stops.length <= 2, onClick: () => removeStop(i, true) })] }, i))), _jsx(Button, { ref: (el) => {
187
187
  addRef.current = el;
188
- }, variant: "outline", size: "sm", disabled: disabled, onClick: () => addStop(), className: "tui-gradient-picker__add", children: L.addStop })] }), _jsxs("div", { className: cx('tui-gradient-picker__geometry', gradient.type === 'linear' && 'is-linear'), children: [_jsxs("span", { className: "tui-gradient-picker__field tui-gradient-picker__type-field", children: [_jsx("span", { className: "tui-gradient-picker__label", id: typeLabelId, children: L.type }), _jsxs(Select, { value: gradient.type, onValueChange: (t) => patch({ type: t }), disabled: disabled, size: "sm", "aria-labelledby": typeLabelId, children: [_jsx(Select.Trigger, { className: "tui-gradient-picker__type" }), _jsx(Select.Content, { children: GRADIENT_TYPES.map((t) => (_jsx(Select.Option, { value: t, children: L.types[t] }, t))) })] })] }), gradient.type === 'linear' && (_jsxs("span", { className: "tui-gradient-picker__angle", children: [_jsx(NumberField, { label: L.angle, value: gradient.angle, min: 0, max: 360, suffix: "\u00B0", disabled: disabled,
188
+ }, variant: "outline", size: "sm", disabled: disabled, onClick: () => addStop(), className: "tui-gradient-picker__add", children: L.addStop })] }), _jsxs("div", { className: cx('tui-gradient-picker__geometry', gradient.type === 'linear' && 'is-linear'), children: [_jsxs("span", { className: "tui-gradient-picker__field tui-gradient-picker__type-field", children: [_jsx("span", { className: "tui-gradient-picker__label tui-text-style-overline", id: typeLabelId, children: L.type }), _jsxs(Select, { value: gradient.type, onValueChange: (t) => patch({ type: t }), disabled: disabled, size: "sm", "aria-labelledby": typeLabelId, children: [_jsx(Select.Trigger, { className: "tui-gradient-picker__type" }), _jsx(Select.Content, { children: GRADIENT_TYPES.map((t) => (_jsx(Select.Option, { value: t, children: L.types[t] }, t))) })] })] }), gradient.type === 'linear' && (_jsxs("span", { className: "tui-gradient-picker__angle", children: [_jsx(NumberField, { label: L.angle, value: gradient.angle, min: 0, max: 360, suffix: "\u00B0", disabled: disabled,
189
189
  // mod 360 so a committed 360 doesn't flip to 0 on blur.
190
190
  onCommit: (angle) => patch({ angle: round1(angle) % 360 }) }), _jsx(AngleDial, { angle: gradient.angle, onAngleChange: (angle) => patch({ angle }), disabled: disabled })] })), gradient.type === 'radial' && (_jsxs(_Fragment, { children: [_jsx(NumberField, { label: L.sizeX, value: gradient.sizeX, min: 0, max: 1000, suffix: "%", disabled: disabled, onCommit: (sizeX) => patch({ sizeX: round1(sizeX) }) }), _jsx(NumberField, { label: L.sizeY, value: gradient.sizeY, min: 0, max: 1000, suffix: "%", disabled: disabled, onCommit: (sizeY) => patch({ sizeY: round1(sizeY) }) })] })), (gradient.type === 'radial' || gradient.type === 'conic') && (_jsxs(_Fragment, { children: [_jsx(NumberField, { label: L.posX, value: gradient.posX, min: 0, max: 100, suffix: "%", disabled: disabled, onCommit: (posX) => patch({ posX: round1(posX) }) }), _jsx(NumberField, { label: L.posY, value: gradient.posY, min: 0, max: 100, suffix: "%", disabled: disabled, onCommit: (posY) => patch({ posY: round1(posY) }) })] }))] }), _jsx("span", { className: "tui-visually-hidden", role: "status", "aria-live": "polite", children: copied ? L.copied : '' })] }));
191
191
  }
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { NavMenuItemProps, NavMenuSubProps } from './types';
3
+ /**
4
+ * Navigation menu rows: groups with headings, the current item, nested items.
5
+ * Not a landmark: put it inside `Sidebar.Nav` or your own labelled `<nav>`.
6
+ */
7
+ declare const NavMenuRoot: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
8
+ children: ReactNode;
9
+ } & import("react").RefAttributes<HTMLDivElement>>;
10
+ declare const NavMenuGroup: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
11
+ label?: ReactNode;
12
+ labelAs?: import("./types").NavMenuGroupLabelElement;
13
+ children: ReactNode;
14
+ } & import("react").RefAttributes<HTMLDivElement>>;
15
+ declare function NavMenuSub({ className, children, ...rest }: NavMenuSubProps): import("react/jsx-runtime").JSX.Element;
16
+ declare namespace NavMenuSub {
17
+ var displayName: string;
18
+ }
19
+ declare const NavMenuItem: import("react").ForwardRefExoticComponent<NavMenuItemProps & import("react").RefAttributes<HTMLElement>>;
20
+ type NavMenuComponent = typeof NavMenuRoot & {
21
+ Group: typeof NavMenuGroup;
22
+ Item: typeof NavMenuItem;
23
+ Sub: typeof NavMenuSub;
24
+ };
25
+ export declare const NavMenu: NavMenuComponent;
26
+ export {};
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Children, cloneElement, createContext, forwardRef, isValidElement, useContext, useEffect, useId, useRef, } from 'react';
3
+ import { cx } from '../../utils/cx.js';
4
+ import { isDev } from '../../utils/is-dev.js';
5
+ import { mergeProps } from '../../utils/merge-props.js';
6
+ import { composeRefs, getElementRef } from '../../utils/compose-refs.js';
7
+ import { Icon } from '../Icon/index.js';
8
+ // Items render <li>, so they're only valid inside a Group or Sub list. The
9
+ // context exists to warn when one isn't.
10
+ const ListContext = createContext(false);
11
+ // =============================================================================
12
+ // NavMenu (root)
13
+ // =============================================================================
14
+ /**
15
+ * Navigation menu rows: groups with headings, the current item, nested items.
16
+ * Not a landmark: put it inside `Sidebar.Nav` or your own labelled `<nav>`.
17
+ */
18
+ const NavMenuRoot = forwardRef(function NavMenu({ className, children, ...rest }, ref) {
19
+ return (_jsx("div", { ref: ref, ...rest, className: cx('tui-nav-menu', className), children: children }));
20
+ });
21
+ // =============================================================================
22
+ // NavMenu.Group
23
+ // =============================================================================
24
+ const NavMenuGroup = forwardRef(function NavMenuGroup({ label, labelAs: Label = 'h2', className, children, ...rest }, ref) {
25
+ const labelId = useId();
26
+ const hasLabel = label !== undefined && label !== null && label !== false;
27
+ return (_jsxs("div", { ref: ref, ...rest, className: cx('tui-nav-menu__group', className), children: [hasLabel && (
28
+ // The class is the override hook for the overline style; the
29
+ // stylesheet also applies it, so static markup stays styled.
30
+ _jsx(Label, { id: labelId, className: "tui-nav-menu__group-label tui-text-style-overline", children: label })), _jsx("ul", { className: "tui-nav-menu__list", "aria-labelledby": hasLabel ? labelId : undefined, children: _jsx(ListContext.Provider, { value: true, children: children }) })] }));
31
+ });
32
+ // =============================================================================
33
+ // NavMenu.Sub
34
+ // =============================================================================
35
+ function NavMenuSub({ className, children, ...rest }) {
36
+ return (_jsx("ul", { ...rest, className: cx('tui-nav-menu__sub', className), children: _jsx(ListContext.Provider, { value: true, children: children }) }));
37
+ }
38
+ NavMenuSub.displayName = 'NavMenu.Sub';
39
+ // =============================================================================
40
+ // NavMenu.Item
41
+ // =============================================================================
42
+ function toAriaCurrent(current) {
43
+ if (current === undefined || current === false)
44
+ return undefined;
45
+ return current === true ? 'page' : current;
46
+ }
47
+ const isSub = (node) => isValidElement(node) && node.type === NavMenuSub;
48
+ const NavMenuItem = forwardRef(function NavMenuItem(props, ref) {
49
+ const { current, icon, disabled, asChild, className, children, ...rest } = props;
50
+ const inList = useContext(ListContext);
51
+ const warned = useRef(false);
52
+ useEffect(() => {
53
+ if (isDev() && !inList && !warned.current) {
54
+ warned.current = true;
55
+ console.warn('NavMenu.Item renders an <li>: place it inside NavMenu.Group or NavMenu.Sub.');
56
+ }
57
+ }, [inList]);
58
+ // Sub lists render after the link, inside the same <li>.
59
+ const all = Children.toArray(children);
60
+ const subs = all.filter(isSub);
61
+ const label = all.filter((c) => !isSub(c));
62
+ const ariaCurrent = toAriaCurrent(current);
63
+ const itemClass = cx('tui-nav-menu__item', className);
64
+ const iconNode = icon ? (_jsx("span", { className: "tui-nav-menu__icon", "aria-hidden": "true", children: _jsx(Icon, { name: icon }) })) : null;
65
+ const content = (inner) => (_jsxs(_Fragment, { children: [iconNode, _jsx("span", { className: "tui-nav-menu__label", children: inner })] }));
66
+ let row;
67
+ if (disabled) {
68
+ // Inert: the APG disabled-link pattern. An <a> with no href is out of the
69
+ // tab order; role="link" keeps it announced as a link, and aria-disabled
70
+ // is valid on that role (it isn't on a role-less span). Rest still lands
71
+ // (data-testid), minus the href that would make it live again.
72
+ const inertRest = { ...rest };
73
+ delete inertRest.href;
74
+ row = (_jsx("a", { ref: ref, ...inertRest, role: "link", className: itemClass, "aria-disabled": "true", "aria-current": ariaCurrent, children: content(asChild && isValidElement(label[0]) ? label[0].props.children : label) }));
75
+ }
76
+ else if (asChild) {
77
+ const child = label[0];
78
+ if (!isValidElement(child)) {
79
+ if (isDev())
80
+ console.warn('NavMenu.Item asChild needs a single element child (a router <Link>).');
81
+ row = null;
82
+ }
83
+ else {
84
+ const childProps = child.props;
85
+ const merged = mergeProps(childProps, {
86
+ // Rest (data-testid, handlers) lands on the link like the other branches.
87
+ ...rest,
88
+ className: itemClass,
89
+ // When `current` is set it wins over the router's own active props.
90
+ // When it's unset, mergeProps skips the undefined value, so a router
91
+ // that sets aria-current itself keeps it.
92
+ 'aria-current': ariaCurrent,
93
+ });
94
+ merged.ref = composeRefs(ref, getElementRef(child));
95
+ row = cloneElement(child, merged, content(childProps.children));
96
+ }
97
+ }
98
+ else if (props.href !== undefined) {
99
+ row = (_jsx("a", { ref: ref, ...rest, className: itemClass, "aria-current": ariaCurrent, children: content(label) }));
100
+ }
101
+ else {
102
+ row = (_jsx("button", { ref: ref, type: "button", ...rest, className: itemClass, "aria-current": ariaCurrent, children: content(label) }));
103
+ }
104
+ return (_jsxs("li", { className: "tui-nav-menu__entry", children: [row, subs] }));
105
+ });
106
+ export const NavMenu = Object.assign(NavMenuRoot, {
107
+ Group: NavMenuGroup,
108
+ Item: NavMenuItem,
109
+ Sub: NavMenuSub,
110
+ });
111
+ NavMenuRoot.displayName = 'NavMenu';
112
+ NavMenuGroup.displayName = 'NavMenu.Group';
113
+ NavMenuItem.displayName = 'NavMenu.Item';
@@ -0,0 +1,2 @@
1
+ export { NavMenu } from './NavMenu';
2
+ export type { NavMenuProps, NavMenuGroupProps, NavMenuGroupLabelElement, NavMenuItemProps, NavMenuItemAsLink, NavMenuItemAsButton, NavMenuItemAsChild, NavMenuCurrent, NavMenuSubProps, } from './types';
@@ -0,0 +1 @@
1
+ export { NavMenu } from './NavMenu.js';
@@ -0,0 +1,75 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import type { IconName } from '../../icons/registry';
3
+ /**
4
+ * Root. Not a landmark: put it inside `Sidebar.Nav` or your own `<nav>`,
5
+ * which owns the label.
6
+ */
7
+ export type NavMenuProps = ComponentPropsWithoutRef<'div'> & {
8
+ children: ReactNode;
9
+ };
10
+ export type NavMenuGroupLabelElement = 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
11
+ export type NavMenuGroupProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {
12
+ /**
13
+ * Visible group heading, styled with the overline text style. It names the
14
+ * group's list via `aria-labelledby`. Omit it for an unlabelled group.
15
+ */
16
+ label?: ReactNode;
17
+ /**
18
+ * Element for the heading. Pick the level that fits the page outline; use
19
+ * `'span'` when headings would be noise (the list stays labelled either way).
20
+ * @default 'h2'
21
+ */
22
+ labelAs?: NavMenuGroupLabelElement;
23
+ children: ReactNode;
24
+ };
25
+ /**
26
+ * `aria-current` values for a nav item. `true` means `'page'`, the item for
27
+ * the page being shown. `'true'` marks an ancestor of that page, such as an
28
+ * open parent whose child is current, and gives it ancestor styling
29
+ * (emphasis, no fill). Screen readers announce both as "current", so a nested
30
+ * page reads as two current items; that's valid ARIA and matches what the
31
+ * route actually is.
32
+ */
33
+ export type NavMenuCurrent = boolean | 'page' | 'step' | 'location' | 'date' | 'time' | 'true';
34
+ type NavMenuItemBaseProps = {
35
+ /** Marks the current item; see {@link NavMenuCurrent}. */
36
+ current?: NavMenuCurrent;
37
+ /** Leading icon, from the registry. Sized by `--tui-nav-menu-icon-size`. */
38
+ icon?: IconName;
39
+ /**
40
+ * Inert item: rendered as a disabled link (`role="link"`, `aria-disabled`,
41
+ * no href), out of the tab order. For destinations that exist but aren't
42
+ * available yet.
43
+ */
44
+ disabled?: boolean;
45
+ /**
46
+ * The label, plus an optional `NavMenu.Sub` of nested items. Sub lists render
47
+ * after the link, inside the same list item. Whether a Sub renders at all is
48
+ * up to you (e.g. only while its parent is current).
49
+ */
50
+ children: ReactNode;
51
+ };
52
+ /** Link item: renders an `<a>`. */
53
+ export type NavMenuItemAsLink = NavMenuItemBaseProps & Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'aria-current'> & {
54
+ href: string;
55
+ asChild?: never;
56
+ };
57
+ /** Action item: renders a `<button type="button">`. */
58
+ export type NavMenuItemAsButton = NavMenuItemBaseProps & Omit<ComponentPropsWithoutRef<'button'>, 'children' | 'aria-current' | 'disabled'> & {
59
+ href?: never;
60
+ asChild?: never;
61
+ };
62
+ /**
63
+ * Router item: the first non-`NavMenu.Sub` child is the element (a router
64
+ * `<Link>`, say). It receives the item's class, `aria-current`, the icon and
65
+ * a label wrapper. It must render a real `<a href>`.
66
+ */
67
+ export type NavMenuItemAsChild = NavMenuItemBaseProps & Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'aria-current' | 'href'> & {
68
+ asChild: true;
69
+ href?: never;
70
+ };
71
+ export type NavMenuItemProps = NavMenuItemAsLink | NavMenuItemAsButton | NavMenuItemAsChild;
72
+ export type NavMenuSubProps = Omit<ComponentPropsWithoutRef<'ul'>, 'children'> & {
73
+ children: ReactNode;
74
+ };
75
+ export {};
@@ -0,0 +1,4 @@
1
+ // =============================================================================
2
+ // NavMenu Types
3
+ // =============================================================================
4
+ export {};
@@ -33,6 +33,7 @@ export { Rating } from './Rating';
33
33
  export { SegmentedControl } from './SegmentedControl';
34
34
  export { Slider } from './Slider';
35
35
  export { Sidebar, defaultSidebarToggleLabels } from './Sidebar';
36
+ export { NavMenu } from './NavMenu';
36
37
  export { StepIndicator } from './StepIndicator';
37
38
  export { StepList } from './StepList';
38
39
  export { DataTable } from './Table';
@@ -77,6 +78,7 @@ export type { RadioGroupProps, RadioProps } from './Radio';
77
78
  export type { RatingProps } from './Rating';
78
79
  export type { SegmentedControlProps, SegmentedControlItemProps, SegmentedControlValue, SegmentedControlVariant, SegmentedControlSize, SegmentedControlOrientation, } from './SegmentedControl';
79
80
  export type { SidebarProps, SidebarHeaderProps, SidebarFooterProps, SidebarNavProps, SidebarToggleProps, SidebarToggleLabels, } from './Sidebar';
81
+ export type { NavMenuProps, NavMenuGroupProps, NavMenuGroupLabelElement, NavMenuItemProps, NavMenuItemAsLink, NavMenuItemAsButton, NavMenuItemAsChild, NavMenuCurrent, NavMenuSubProps, } from './NavMenu';
80
82
  export type { StepIndicatorProps, StepStatus } from './StepIndicator';
81
83
  export type { StepListProps, StepListItemProps } from './StepList';
82
84
  export type { DataTableProps } from './Table';
@@ -31,6 +31,7 @@ export { Rating } from './Rating/index.js';
31
31
  export { SegmentedControl } from './SegmentedControl/index.js';
32
32
  export { Slider } from './Slider/index.js';
33
33
  export { Sidebar, defaultSidebarToggleLabels } from './Sidebar/index.js';
34
+ export { NavMenu } from './NavMenu/index.js';
34
35
  export { StepIndicator } from './StepIndicator/index.js';
35
36
  export { StepList } from './StepList/index.js';
36
37
  export { DataTable } from './Table/index.js';
package/figma-tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.23",
2
+ "version": "0.2.24",
3
3
  "source": "publish/styles/all.expanded.css",
4
4
  "prefix": "tui-",
5
5
  "note": "Layer 1 primitives only. Component API tokens (--tui-{component}-*) are never defined in CSS — they exist only as fallback reads — so they have no Figma representation. CONTRACT: consumers read TUI defaults from this file at build time (variables[].cssVar, the \"Light\"/\"Dark\" mode names, and alias chains into TUI/Primitives). Renaming a cssVar or a mode is a breaking change to those consumers even when the CSS value is unchanged — a rename silently becomes an undefined default downstream — so treat it as at least a minor bump and call it out in the CHANGELOG.",
@@ -98,6 +98,18 @@
98
98
  }
99
99
  }
100
100
  },
101
+ {
102
+ "name": "palette/blue/450",
103
+ "type": "COLOR",
104
+ "values": {
105
+ "Default": {
106
+ "r": 0.18823529411764706,
107
+ "g": 0.30196078431372547,
108
+ "b": 0.8666666666666667,
109
+ "a": 1
110
+ }
111
+ }
112
+ },
101
113
  {
102
114
  "name": "palette/blue/50",
103
115
  "type": "COLOR",
@@ -266,6 +278,18 @@
266
278
  }
267
279
  }
268
280
  },
281
+ {
282
+ "name": "palette/gray/450",
283
+ "type": "COLOR",
284
+ "values": {
285
+ "Default": {
286
+ "r": 0.5137254901960784,
287
+ "g": 0.5411764705882353,
288
+ "b": 0.592156862745098,
289
+ "a": 1
290
+ }
291
+ }
292
+ },
269
293
  {
270
294
  "name": "palette/gray/50",
271
295
  "type": "COLOR",
@@ -434,6 +458,18 @@
434
458
  }
435
459
  }
436
460
  },
461
+ {
462
+ "name": "palette/green/450",
463
+ "type": "COLOR",
464
+ "values": {
465
+ "Default": {
466
+ "r": 0,
467
+ "g": 0.5882352941176471,
468
+ "b": 0.1450980392156863,
469
+ "a": 1
470
+ }
471
+ }
472
+ },
437
473
  {
438
474
  "name": "palette/green/50",
439
475
  "type": "COLOR",
@@ -602,6 +638,18 @@
602
638
  }
603
639
  }
604
640
  },
641
+ {
642
+ "name": "palette/purple/450",
643
+ "type": "COLOR",
644
+ "values": {
645
+ "Default": {
646
+ "r": 0.611764705882353,
647
+ "g": 0.3176470588235294,
648
+ "b": 0.6745098039215687,
649
+ "a": 1
650
+ }
651
+ }
652
+ },
605
653
  {
606
654
  "name": "palette/purple/50",
607
655
  "type": "COLOR",
@@ -770,6 +818,18 @@
770
818
  }
771
819
  }
772
820
  },
821
+ {
822
+ "name": "palette/red/450",
823
+ "type": "COLOR",
824
+ "values": {
825
+ "Default": {
826
+ "r": 0.8705882352941177,
827
+ "g": 0.26666666666666666,
828
+ "b": 0.27450980392156865,
829
+ "a": 1
830
+ }
831
+ }
832
+ },
773
833
  {
774
834
  "name": "palette/red/50",
775
835
  "type": "COLOR",
@@ -938,6 +998,18 @@
938
998
  }
939
999
  }
940
1000
  },
1001
+ {
1002
+ "name": "palette/yellow/450",
1003
+ "type": "COLOR",
1004
+ "values": {
1005
+ "Default": {
1006
+ "r": 0.6705882352941176,
1007
+ "g": 0.4666666666666667,
1008
+ "b": 0,
1009
+ "a": 1
1010
+ }
1011
+ }
1012
+ },
941
1013
  {
942
1014
  "name": "palette/yellow/50",
943
1015
  "type": "COLOR",
@@ -1285,6 +1357,23 @@
1285
1357
  }
1286
1358
  }
1287
1359
  },
1360
+ {
1361
+ "name": "color/border/control",
1362
+ "cssVar": "--tui-color-border-control",
1363
+ "type": "COLOR",
1364
+ "values": {
1365
+ "Light": {
1366
+ "alias": "palette/gray/450",
1367
+ "collection": "TUI/Primitives",
1368
+ "hex": "#838a97"
1369
+ },
1370
+ "Dark": {
1371
+ "alias": "palette/gray/500",
1372
+ "collection": "TUI/Primitives",
1373
+ "hex": "#6b7280"
1374
+ }
1375
+ }
1376
+ },
1288
1377
  {
1289
1378
  "name": "color/border/default",
1290
1379
  "cssVar": "--tui-color-border",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangible/ui",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
4
4
  "description": "Tangible Design System",
5
5
  "type": "module",
6
6
  "main": "./components/index.js",
@@ -142,6 +142,10 @@
142
142
  "import": "./components/MultiSelect/index.js",
143
143
  "types": "./components/MultiSelect/index.d.ts"
144
144
  },
145
+ "./components/NavMenu": {
146
+ "import": "./components/NavMenu/index.js",
147
+ "types": "./components/NavMenu/index.d.ts"
148
+ },
145
149
  "./components/Notice": {
146
150
  "import": "./components/Notice/index.js",
147
151
  "types": "./components/Notice/index.d.ts"
@@ -231,7 +231,7 @@ Useful primitives:
231
231
 
232
232
  - Surfaces / text: `--tui-color-bg`, `-bg-surface`, `-bg-elevated`, `-bg-muted`, `-bg-inverted`,
233
233
  `--tui-color-fg`, `-fg-secondary`, `-fg-muted`, `-fg-on-accent`, `--tui-color-border`,
234
- `--tui-color-divider`, `--tui-color-fill{,-subtle,-strong}`, `--tui-color-focus-ring`.
234
+ `--tui-color-border-control` (form-control boundaries, 3:1; `--tui-color-border` is decorative), `--tui-color-divider`, `--tui-color-fill{,-subtle,-strong}`, `--tui-color-focus-ring`.
235
235
  - Themes: `--tui-theme-{primary,secondary,success,warning,danger,info}-{subtlest,subtle,soft,base,strong,stronger,strongest}`.
236
236
  The ladder is **contrast-based** — "stronger" always means more contrast against the current
237
237
  background, so a single choice reads correctly in both light and dark mode.
@@ -243,17 +243,21 @@ Useful primitives:
243
243
 
244
244
  Two families share a token layer, so you can restyle the whole family in one place:
245
245
 
246
- - **Control chrome:** `--tui-input-{bg,fg,border,border-focus,radius}` reaches TextInput,
246
+ - **Control chrome:** `--tui-input-{bg,fg,border,border-focus,border-hover,radius}` reaches TextInput,
247
247
  SearchInput, the pickers and every select-family trigger.
248
248
  - **Listbox panels and options** (Select, MultiSelect, Combobox, MultiCombobox, SearchSelect;
249
249
  0.2.23+):
250
250
  - Panel: `--tui-listbox-{bg,fg,border,shadow,radius}`.
251
251
  - Options: `--tui-listbox-option-{radius,gap,bg-hover,fg-hover,bg-selected,fg-selected,bg-selected-hover,check}`.
252
252
 
253
- A component's own token (e.g. `--tui-combobox-option-bg-selected`) overrides the shared one for
253
+ Form controls show no border change on hover unless you set `--tui-input-border-hover` (opt-in; focus, open and invalid still win). A component's own token (e.g. `--tui-combobox-option-bg-selected`) overrides the shared one for
254
254
  that component only. If you re-point an option state's background, set its `-fg-*` partner too:
255
255
  the text defaults to the panel's own fg, which is tuned for TUI's default fills.
256
256
 
257
+ **Text styles** (0.2.24+) are classes: `.tui-text-style-{display-01…04, headline-01…06, body, body-sm, label, caption, overline}`. Restyle a treatment everywhere through its one class (`.tui-text-style-overline { text-transform: none }` reaches every listbox group label and the Dropdown header), or through its knobs, `--tui-text-{style}-{family,size,weight,line-height,tracking,transform,color}`. Knobs are never declared, so `:root` works. `--tui-text-headline-weight` retunes every headline level at once.
258
+
259
+ **Fonts:** TUI inherits the host's font. If your page has none (you see the browser's serif), add `tui-font-sans` next to `tui-interface`, or set `--tui-font-family-base` anywhere. `--tui-font-family-sans` / `-mono` replace the stacks those utilities use.
260
+
257
261
  `className` is for layout integration (margin, grid placement), not appearance. Beyond the token
258
262
  API the sanctioned escape hatch is to **swizzle** — copy the component source and own the fork.
259
263
 
@@ -392,13 +396,13 @@ synthesise a second toggle. For a second control that toggles the same item (an
392
396
 
393
397
  ## Component names, and what isn't there
394
398
 
395
- 43 components. If you are hunting for a name: **Alert → `Notice`**, **Menu → `Dropdown`**,
396
- **Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode),
399
+ 46 components. If you are hunting for a name: **Alert → `Notice`**, **Menu → `Dropdown`**,
400
+ **Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode), **Nav menu / sidebar links → `NavMenu`** (inside `Sidebar.Nav`; `asChild` for router links, `current` for `aria-current`),
397
401
  **Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`,
398
402
  **ConfirmDialog / AlertDialog → `Modal role="alertdialog"`** (needs both `aria-labelledby` and
399
403
  `aria-describedby`; the backdrop stops dismissing by default, Escape still cancels; put the actions in
400
404
  `Modal.Foot`, which is already an end-aligned flex row — `justify="between"` separates a destructive one).
401
- No Toast/Snackbar, no Breadcrumb, no Skeleton, and no *standalone* time picker — but
405
+ **Snackbar → `Toast`** (`ToastProvider` + `useToast()`). No Breadcrumb, no Skeleton, and no *standalone* time picker — but
402
406
  `DatePicker` / `DateRangePicker` take `withTime` for an hour/minute field (12- or 24-hour via
403
407
  `hour12`) plus a display-only `zoneLabel`; the value is a plain `Date` with wall-clock semantics,
404
408
  so timezone interpretation stays yours.