@tangible/ui 0.2.24 → 0.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/NavMenu/NavMenu.d.ts +8 -2
- package/components/NavMenu/NavMenu.js +128 -11
- package/components/NavMenu/index.d.ts +2 -1
- package/components/NavMenu/index.js +1 -0
- package/components/NavMenu/types.d.ts +31 -3
- package/components/NavMenu/types.js +3 -1
- package/components/index.d.ts +2 -2
- package/components/index.js +1 -1
- package/figma-tokens.json +1 -1
- package/package.json +1 -1
- package/skills/building-with-tui/SKILL.md +1 -1
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +117 -0
- package/styles/all.expanded.unlayered.css +117 -0
- package/styles/all.unlayered.css +1 -1
- package/styles/components/nav-menu.scss +173 -0
- package/tui-manifest.json +24 -3
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { NavMenuItemProps, NavMenuSubProps } from './types';
|
|
2
|
+
import type { NavMenuItemProps, NavMenuLabels, NavMenuOrientation, NavMenuSubProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Navigation menu rows: groups with headings, the current item, nested items.
|
|
5
|
-
*
|
|
5
|
+
* Vertical by default (sidebars). `orientation="horizontal"` makes a bar whose
|
|
6
|
+
* items with a `NavMenu.Sub` open as flyouts, following the APG disclosure
|
|
7
|
+
* navigation pattern: buttons with aria-expanded, never role="menu", never
|
|
8
|
+
* hover-to-open. Not a landmark: put it inside `Sidebar.Nav` or a labelled
|
|
9
|
+
* `<nav>`.
|
|
6
10
|
*/
|
|
7
11
|
declare const NavMenuRoot: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
|
+
orientation?: NavMenuOrientation;
|
|
13
|
+
labels?: NavMenuLabels;
|
|
8
14
|
children: ReactNode;
|
|
9
15
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
16
|
declare const NavMenuGroup: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
|
|
@@ -1,38 +1,71 @@
|
|
|
1
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';
|
|
2
|
+
import { Children, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { useFloating, autoUpdate, offset, flip, shift } from '@floating-ui/react';
|
|
3
4
|
import { cx } from '../../utils/cx.js';
|
|
4
5
|
import { isDev } from '../../utils/is-dev.js';
|
|
5
6
|
import { mergeProps } from '../../utils/merge-props.js';
|
|
6
7
|
import { composeRefs, getElementRef } from '../../utils/compose-refs.js';
|
|
7
8
|
import { Icon } from '../Icon/index.js';
|
|
9
|
+
import { defaultNavMenuLabels } from './types.js';
|
|
8
10
|
// Items render <li>, so they're only valid inside a Group or Sub list. The
|
|
9
11
|
// context exists to warn when one isn't.
|
|
10
12
|
const ListContext = createContext(false);
|
|
13
|
+
const RootContext = createContext({
|
|
14
|
+
orientation: 'vertical',
|
|
15
|
+
labels: defaultNavMenuLabels,
|
|
16
|
+
openId: null,
|
|
17
|
+
setOpenId: () => { },
|
|
18
|
+
});
|
|
19
|
+
// True inside a flyout panel: everything there lays out vertically, and an
|
|
20
|
+
// item with its own Sub nests inline instead of opening another flyout.
|
|
21
|
+
const FlyoutContext = createContext(false);
|
|
11
22
|
// =============================================================================
|
|
12
23
|
// NavMenu (root)
|
|
13
24
|
// =============================================================================
|
|
14
25
|
/**
|
|
15
26
|
* Navigation menu rows: groups with headings, the current item, nested items.
|
|
16
|
-
*
|
|
27
|
+
* Vertical by default (sidebars). `orientation="horizontal"` makes a bar whose
|
|
28
|
+
* items with a `NavMenu.Sub` open as flyouts, following the APG disclosure
|
|
29
|
+
* navigation pattern: buttons with aria-expanded, never role="menu", never
|
|
30
|
+
* hover-to-open. Not a landmark: put it inside `Sidebar.Nav` or a labelled
|
|
31
|
+
* `<nav>`.
|
|
17
32
|
*/
|
|
18
|
-
const NavMenuRoot = forwardRef(function NavMenu({ className, children, ...rest }, ref) {
|
|
19
|
-
|
|
33
|
+
const NavMenuRoot = forwardRef(function NavMenu({ orientation = 'vertical', labels, className, children, ...rest }, ref) {
|
|
34
|
+
const [openId, setOpenId] = useState(null);
|
|
35
|
+
const value = useMemo(() => ({ orientation, labels: { ...defaultNavMenuLabels, ...labels }, openId, setOpenId }), [orientation, labels, openId]);
|
|
36
|
+
return (_jsx("div", { ref: ref, ...rest, "data-orientation": orientation, className: cx('tui-nav-menu', orientation === 'horizontal' && 'is-horizontal', className), children: _jsx(RootContext.Provider, { value: value, children: children }) }));
|
|
20
37
|
});
|
|
21
38
|
// =============================================================================
|
|
22
39
|
// NavMenu.Group
|
|
23
40
|
// =============================================================================
|
|
24
41
|
const NavMenuGroup = forwardRef(function NavMenuGroup({ label, labelAs: Label = 'h2', className, children, ...rest }, ref) {
|
|
25
42
|
const labelId = useId();
|
|
43
|
+
const { orientation } = useContext(RootContext);
|
|
44
|
+
const inFlyout = useContext(FlyoutContext);
|
|
26
45
|
const hasLabel = label !== undefined && label !== null && label !== false;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
46
|
+
// In a bar, a group is an inline cluster: its heading stays (it still names
|
|
47
|
+
// the list for AT) but is visually hidden. Inside a flyout it shows.
|
|
48
|
+
const headingHidden = orientation === 'horizontal' && !inFlyout;
|
|
49
|
+
return (_jsxs("div", { ref: ref, ...rest, className: cx('tui-nav-menu__group', className), children: [hasLabel &&
|
|
50
|
+
(headingHidden ? (
|
|
51
|
+
// In a bar the label only names the list. A visually hidden heading
|
|
52
|
+
// would show up in heading navigation with nothing under it, so it
|
|
53
|
+
// renders as a plain span instead.
|
|
54
|
+
_jsx("span", { id: labelId, className: "tui-visually-hidden", children: label })) : (
|
|
55
|
+
// The class is the override hook for the overline style; the
|
|
56
|
+
// stylesheet also applies it, so static markup stays styled.
|
|
57
|
+
_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
58
|
});
|
|
32
59
|
// =============================================================================
|
|
33
60
|
// NavMenu.Sub
|
|
34
61
|
// =============================================================================
|
|
62
|
+
const isGroup = (node) => isValidElement(node) && node.type === NavMenuGroup;
|
|
35
63
|
function NavMenuSub({ className, children, ...rest }) {
|
|
64
|
+
// Groups bring their own headed lists, so a Sub of groups is a plain
|
|
65
|
+
// container; a Sub of items is the list itself.
|
|
66
|
+
if (Children.toArray(children).some(isGroup)) {
|
|
67
|
+
return (_jsx("div", { ...rest, className: cx('tui-nav-menu__sub', 'has-groups', className), children: children }));
|
|
68
|
+
}
|
|
36
69
|
return (_jsx("ul", { ...rest, className: cx('tui-nav-menu__sub', className), children: _jsx(ListContext.Provider, { value: true, children: children }) }));
|
|
37
70
|
}
|
|
38
71
|
NavMenuSub.displayName = 'NavMenu.Sub';
|
|
@@ -48,6 +81,8 @@ const isSub = (node) => isValidElement(node) && node.type === NavMenuSub;
|
|
|
48
81
|
const NavMenuItem = forwardRef(function NavMenuItem(props, ref) {
|
|
49
82
|
const { current, icon, disabled, asChild, className, children, ...rest } = props;
|
|
50
83
|
const inList = useContext(ListContext);
|
|
84
|
+
const { orientation, labels, openId, setOpenId } = useContext(RootContext);
|
|
85
|
+
const inFlyout = useContext(FlyoutContext);
|
|
51
86
|
const warned = useRef(false);
|
|
52
87
|
useEffect(() => {
|
|
53
88
|
if (isDev() && !inList && !warned.current) {
|
|
@@ -59,11 +94,70 @@ const NavMenuItem = forwardRef(function NavMenuItem(props, ref) {
|
|
|
59
94
|
const all = Children.toArray(children);
|
|
60
95
|
const subs = all.filter(isSub);
|
|
61
96
|
const label = all.filter((c) => !isSub(c));
|
|
97
|
+
// -- Flyout (horizontal bar, item with a Sub) -------------------------------
|
|
98
|
+
const id = useId();
|
|
99
|
+
const panelId = `${id}-panel`;
|
|
100
|
+
const labelId = `${id}-label`;
|
|
101
|
+
const toggleTextId = `${id}-toggle`;
|
|
102
|
+
const flyout = orientation === 'horizontal' && !inFlyout && subs.length > 0 && !disabled;
|
|
103
|
+
const open = flyout && openId === id;
|
|
104
|
+
const setOpen = useCallback((next) => {
|
|
105
|
+
if (next)
|
|
106
|
+
setOpenId(id);
|
|
107
|
+
else if (openId === id)
|
|
108
|
+
setOpenId(null);
|
|
109
|
+
}, [id, openId, setOpenId]);
|
|
110
|
+
const entryRef = useRef(null);
|
|
111
|
+
const toggleRef = useRef(null);
|
|
112
|
+
const { refs, floatingStyles } = useFloating({
|
|
113
|
+
open,
|
|
114
|
+
placement: 'bottom-start',
|
|
115
|
+
strategy: 'absolute',
|
|
116
|
+
middleware: [offset(4), flip(), shift({ padding: 8 })],
|
|
117
|
+
whileElementsMounted: autoUpdate,
|
|
118
|
+
});
|
|
119
|
+
// Click or tap outside closes it. Focus leaving is handled by onBlur below.
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (!open)
|
|
122
|
+
return;
|
|
123
|
+
const onPointerDown = (e) => {
|
|
124
|
+
if (!entryRef.current?.contains(e.target))
|
|
125
|
+
setOpen(false);
|
|
126
|
+
};
|
|
127
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
128
|
+
return () => document.removeEventListener('pointerdown', onPointerDown);
|
|
129
|
+
}, [open, setOpen]);
|
|
130
|
+
const onEntryKeyDown = (e) => {
|
|
131
|
+
if (open && e.key === 'Escape') {
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
setOpen(false);
|
|
134
|
+
toggleRef.current?.focus();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const onEntryBlur = (e) => {
|
|
138
|
+
if (open && !entryRef.current?.contains(e.relatedTarget))
|
|
139
|
+
setOpen(false);
|
|
140
|
+
};
|
|
141
|
+
// Safari and Firefox on macOS don't focus a button on click. Without this,
|
|
142
|
+
// clicking the toggle to close an open flyout blurs the panel first (closing
|
|
143
|
+
// it), and the click then re-opens it. Only while open: Chromium treats a
|
|
144
|
+
// programmatic focus inside a pointer event as focus-visible, so doing it on
|
|
145
|
+
// every click would ring the toggle for mouse users.
|
|
146
|
+
const focusOnPointerDown = (e) => {
|
|
147
|
+
if (open)
|
|
148
|
+
e.currentTarget.focus();
|
|
149
|
+
};
|
|
150
|
+
// -- Row --------------------------------------------------------------------
|
|
62
151
|
const ariaCurrent = toAriaCurrent(current);
|
|
63
|
-
|
|
152
|
+
// Top-level rows of a bar. Rows inside a flyout panel keep the vertical look.
|
|
153
|
+
const bar = orientation === 'horizontal' && !inFlyout;
|
|
154
|
+
const itemClass = cx('tui-nav-menu__item', bar && 'is-bar', className);
|
|
64
155
|
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 })] }));
|
|
156
|
+
const content = (inner) => (_jsxs(_Fragment, { children: [iconNode, _jsx("span", { className: "tui-nav-menu__label", id: flyout ? labelId : undefined, children: inner })] }));
|
|
157
|
+
const chevron = (_jsx("span", { className: "tui-nav-menu__chevron", "aria-hidden": "true", children: _jsx(Icon, { name: "system/chevron-down-small" }) }));
|
|
66
158
|
let row;
|
|
159
|
+
// A flyout parent with no destination of its own: the row IS the toggle.
|
|
160
|
+
const rowIsToggle = flyout && !asChild && props.href === undefined;
|
|
67
161
|
if (disabled) {
|
|
68
162
|
// Inert: the APG disabled-link pattern. An <a> with no href is out of the
|
|
69
163
|
// tab order; role="link" keeps it announced as a link, and aria-disabled
|
|
@@ -73,6 +167,14 @@ const NavMenuItem = forwardRef(function NavMenuItem(props, ref) {
|
|
|
73
167
|
delete inertRest.href;
|
|
74
168
|
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
169
|
}
|
|
170
|
+
else if (rowIsToggle) {
|
|
171
|
+
const restProps = rest;
|
|
172
|
+
row = (_jsxs("button", { ref: composeRefs(ref, toggleRef), type: "button", ...rest, className: cx(itemClass, 'is-toggle'), "aria-current": ariaCurrent, "aria-expanded": open, "aria-controls": panelId, onPointerDown: focusOnPointerDown, onClick: (e) => {
|
|
173
|
+
restProps.onClick?.(e);
|
|
174
|
+
if (!e.defaultPrevented)
|
|
175
|
+
setOpen(!open);
|
|
176
|
+
}, children: [content(label), chevron] }));
|
|
177
|
+
}
|
|
76
178
|
else if (asChild) {
|
|
77
179
|
const child = label[0];
|
|
78
180
|
if (!isValidElement(child)) {
|
|
@@ -101,7 +203,22 @@ const NavMenuItem = forwardRef(function NavMenuItem(props, ref) {
|
|
|
101
203
|
else {
|
|
102
204
|
row = (_jsx("button", { ref: ref, type: "button", ...rest, className: itemClass, "aria-current": ariaCurrent, children: content(label) }));
|
|
103
205
|
}
|
|
104
|
-
|
|
206
|
+
if (!flyout) {
|
|
207
|
+
return (_jsxs("li", { className: "tui-nav-menu__entry", children: [row, !(disabled && bar) && subs] }));
|
|
208
|
+
}
|
|
209
|
+
return (_jsxs("li", { ref: composeRefs(entryRef, refs.setReference), className: cx('tui-nav-menu__entry', 'has-flyout', !rowIsToggle && 'is-split'), onKeyDown: onEntryKeyDown, onBlur: onEntryBlur, children: [row, !rowIsToggle && (
|
|
210
|
+
// A link can't also toggle, so a parent with a destination gets its own
|
|
211
|
+
// toggle. It's named "<label> <submenu>", so the bar never has a row
|
|
212
|
+
// of identical "toggle" buttons.
|
|
213
|
+
_jsxs("button", { ref: toggleRef, type: "button", className: cx('tui-nav-menu__toggle', 'is-bar'), "aria-expanded": open, "aria-controls": panelId, "aria-labelledby": `${labelId} ${toggleTextId}`, onPointerDown: focusOnPointerDown, onClick: () => setOpen(!open), children: [chevron, _jsx("span", { id: toggleTextId, hidden: true, children: labels.submenu })] })), _jsx("div", { id: panelId, ref: refs.setFloating, style: floatingStyles, className: "tui-nav-menu__flyout", hidden: !open,
|
|
214
|
+
// Following a link inside closes the panel (APG): in a single-page
|
|
215
|
+
// app nothing else would, and it would sit over the new page. Enter
|
|
216
|
+
// on a link fires click too. Router onClicks compose: this runs after
|
|
217
|
+
// the link's own handler, on the bubble.
|
|
218
|
+
onClick: (e) => {
|
|
219
|
+
if (e.target.closest('a[href]'))
|
|
220
|
+
setOpen(false);
|
|
221
|
+
}, children: _jsx(FlyoutContext.Provider, { value: true, children: subs }) })] }));
|
|
105
222
|
});
|
|
106
223
|
export const NavMenu = Object.assign(NavMenuRoot, {
|
|
107
224
|
Group: NavMenuGroup,
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { NavMenu } from './NavMenu';
|
|
2
|
-
export
|
|
2
|
+
export { defaultNavMenuLabels } from './types';
|
|
3
|
+
export type { NavMenuProps, NavMenuOrientation, NavMenuLabels, NavMenuGroupProps, NavMenuGroupLabelElement, NavMenuItemProps, NavMenuItemAsLink, NavMenuItemAsButton, NavMenuItemAsChild, NavMenuCurrent, NavMenuSubProps, } from './types';
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import type { IconName } from '../../icons/registry';
|
|
3
|
+
export type NavMenuOrientation = 'vertical' | 'horizontal';
|
|
4
|
+
/** Visually hidden strings, for localisation. */
|
|
5
|
+
export type NavMenuLabels = {
|
|
6
|
+
/**
|
|
7
|
+
* Word appended to a flyout parent's label to name its separate toggle
|
|
8
|
+
* button (a parent that is also a link): "Catalog submenu".
|
|
9
|
+
* @default 'submenu'
|
|
10
|
+
*/
|
|
11
|
+
submenu?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const defaultNavMenuLabels: Required<NavMenuLabels>;
|
|
3
14
|
/**
|
|
4
15
|
* Root. Not a landmark: put it inside `Sidebar.Nav` or your own `<nav>`,
|
|
5
16
|
* which owns the label.
|
|
6
17
|
*/
|
|
7
18
|
export type NavMenuProps = ComponentPropsWithoutRef<'div'> & {
|
|
19
|
+
/**
|
|
20
|
+
* `vertical` (sidebars) stacks groups and nests a `NavMenu.Sub` inline.
|
|
21
|
+
* `horizontal` makes a bar: groups become inline clusters (headings visually
|
|
22
|
+
* hidden, lists still labelled), and an item with a `NavMenu.Sub` opens it
|
|
23
|
+
* as a flyout. A flyout follows the APG disclosure pattern: a button with
|
|
24
|
+
* `aria-expanded`, opened by click or Enter/Space (never hover), closed by
|
|
25
|
+
* Escape (focus returns to the button), Tab-ing out or clicking elsewhere.
|
|
26
|
+
* One flyout is open at a time. Groups inside a flyout show their headings.
|
|
27
|
+
* @default 'vertical'
|
|
28
|
+
*/
|
|
29
|
+
orientation?: NavMenuOrientation;
|
|
30
|
+
/** Visually hidden strings. */
|
|
31
|
+
labels?: NavMenuLabels;
|
|
8
32
|
children: ReactNode;
|
|
9
33
|
};
|
|
10
34
|
export type NavMenuGroupLabelElement = 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
|
|
@@ -43,9 +67,13 @@ type NavMenuItemBaseProps = {
|
|
|
43
67
|
*/
|
|
44
68
|
disabled?: boolean;
|
|
45
69
|
/**
|
|
46
|
-
* The label, plus an optional `NavMenu.Sub` of nested items.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
70
|
+
* The label, plus an optional `NavMenu.Sub` of nested items.
|
|
71
|
+
*
|
|
72
|
+
* Vertical: the Sub renders after the link, inside the same list item, and
|
|
73
|
+
* whether it renders at all is up to you (e.g. only while its parent is
|
|
74
|
+
* current). Horizontal: the Sub is a flyout. With no `href`, the row itself
|
|
75
|
+
* toggles it; with an `href` (or `asChild` link), the row navigates and a
|
|
76
|
+
* separate toggle button opens it.
|
|
49
77
|
*/
|
|
50
78
|
children: ReactNode;
|
|
51
79
|
};
|
package/components/index.d.ts
CHANGED
|
@@ -33,7 +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
|
+
export { NavMenu, defaultNavMenuLabels } from './NavMenu';
|
|
37
37
|
export { StepIndicator } from './StepIndicator';
|
|
38
38
|
export { StepList } from './StepList';
|
|
39
39
|
export { DataTable } from './Table';
|
|
@@ -78,7 +78,7 @@ export type { RadioGroupProps, RadioProps } from './Radio';
|
|
|
78
78
|
export type { RatingProps } from './Rating';
|
|
79
79
|
export type { SegmentedControlProps, SegmentedControlItemProps, SegmentedControlValue, SegmentedControlVariant, SegmentedControlSize, SegmentedControlOrientation, } from './SegmentedControl';
|
|
80
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';
|
|
81
|
+
export type { NavMenuProps, NavMenuOrientation, NavMenuLabels, NavMenuGroupProps, NavMenuGroupLabelElement, NavMenuItemProps, NavMenuItemAsLink, NavMenuItemAsButton, NavMenuItemAsChild, NavMenuCurrent, NavMenuSubProps, } from './NavMenu';
|
|
82
82
|
export type { StepIndicatorProps, StepStatus } from './StepIndicator';
|
|
83
83
|
export type { StepListProps, StepListItemProps } from './StepList';
|
|
84
84
|
export type { DataTableProps } from './Table';
|
package/components/index.js
CHANGED
|
@@ -31,7 +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
|
+
export { NavMenu, defaultNavMenuLabels } from './NavMenu/index.js';
|
|
35
35
|
export { StepIndicator } from './StepIndicator/index.js';
|
|
36
36
|
export { StepList } from './StepList/index.js';
|
|
37
37
|
export { DataTable } from './Table/index.js';
|
package/figma-tokens.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.25",
|
|
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.",
|
package/package.json
CHANGED
|
@@ -397,7 +397,7 @@ synthesise a second toggle. For a second control that toggles the same item (an
|
|
|
397
397
|
## Component names, and what isn't there
|
|
398
398
|
|
|
399
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
|
|
400
|
+
**Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode), **Nav menu / sidebar links / top nav bar → `NavMenu`** (inside `Sidebar.Nav` or your `<nav>`; `asChild` for router links, `current` for `aria-current`; `orientation="horizontal"` for a bar whose items open flyouts — don't hand-roll menus with `role="menu"` or hover-open),
|
|
401
401
|
**Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`,
|
|
402
402
|
**ConfirmDialog / AlertDialog → `Modal role="alertdialog"`** (needs both `aria-labelledby` and
|
|
403
403
|
`aria-describedby`; the backdrop stops dismissing by default, Escape still cancels; put the actions in
|