@tangible/ui 0.2.16 → 0.2.18
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/Sidebar/Sidebar.d.ts +19 -1
- package/components/Sidebar/Sidebar.js +110 -3
- package/components/Sidebar/index.d.ts +2 -1
- package/components/Sidebar/index.js +1 -0
- package/components/Sidebar/types.d.ts +68 -0
- package/components/Sidebar/types.js +4 -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 +20 -1
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +48 -1
- package/styles/all.expanded.unlayered.css +48 -1
- package/styles/all.unlayered.css +1 -1
- package/styles/components/segmented-control.scss +43 -1
- package/styles/components/sidebar.scss +83 -0
- package/tui-manifest.json +21 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SidebarProps, SidebarHeaderProps, SidebarFooterProps, SidebarNavProps } from './types';
|
|
1
|
+
import type { SidebarProps, SidebarHeaderProps, SidebarFooterProps, SidebarNavProps, SidebarToggleProps } from './types';
|
|
2
2
|
declare function SidebarHeader(props: SidebarHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace SidebarHeader {
|
|
4
4
|
var displayName: string;
|
|
@@ -11,12 +11,30 @@ declare function SidebarNav(props: SidebarNavProps): import("react/jsx-runtime")
|
|
|
11
11
|
declare namespace SidebarNav {
|
|
12
12
|
var displayName: string;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Collapses and expands the sidebar it sits in.
|
|
16
|
+
*
|
|
17
|
+
* Place it as a direct child of `Sidebar` rather than inside Header, Nav or
|
|
18
|
+
* Footer — those three are what the collapsed rail hides, and a button
|
|
19
|
+
* hidden with them could never bring the sidebar back. Anything else you
|
|
20
|
+
* put directly in the sidebar survives the collapse alongside it.
|
|
21
|
+
*
|
|
22
|
+
* The glyph reads as a direction, so it tracks `position`: on a left-hand
|
|
23
|
+
* sidebar collapsing moves content left (`sidebar-collapse`, arrow pointing
|
|
24
|
+
* left) and expanding moves it right. A right-hand sidebar wants the
|
|
25
|
+
* mirror of that, and the icon pair already is one.
|
|
26
|
+
*/
|
|
27
|
+
declare function SidebarToggle(props: SidebarToggleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
28
|
+
declare namespace SidebarToggle {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
14
31
|
type SidebarCompound = {
|
|
15
32
|
(props: SidebarProps): React.JSX.Element | null;
|
|
16
33
|
displayName?: string;
|
|
17
34
|
Header: typeof SidebarHeader;
|
|
18
35
|
Footer: typeof SidebarFooter;
|
|
19
36
|
Nav: typeof SidebarNav;
|
|
37
|
+
Toggle: typeof SidebarToggle;
|
|
20
38
|
};
|
|
21
39
|
export declare const Sidebar: SidebarCompound;
|
|
22
40
|
export {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { defaultSidebarToggleLabels } from './types.js';
|
|
3
4
|
import { useFocusTrap, getInitialFocus } from '../../utils/focus-trap.js';
|
|
5
|
+
import { useControllableState } from '../../utils/use-controllable-state.js';
|
|
4
6
|
import { isDev } from '../../utils/is-dev.js';
|
|
7
|
+
import { IconButton } from '../IconButton/index.js';
|
|
5
8
|
const isBrowser = typeof document !== 'undefined';
|
|
9
|
+
const SidebarCollapseContext = createContext(null);
|
|
6
10
|
// =============================================================================
|
|
7
11
|
// Sidebar (Root)
|
|
8
12
|
// =============================================================================
|
|
@@ -12,7 +16,59 @@ function SidebarRoot(props) {
|
|
|
12
16
|
const drawer = props.drawer === true;
|
|
13
17
|
const open = props.drawer ? (props.open ?? false) : false;
|
|
14
18
|
const onClose = props.drawer ? props.onClose : undefined;
|
|
19
|
+
// Collapse is static-mode only, narrowed the same way. A drawer already
|
|
20
|
+
// shows and hides wholesale; a rail inside one would sit beside nothing.
|
|
21
|
+
const collapsible = !drawer && props.collapsible === true;
|
|
22
|
+
const [collapsedValue, setCollapsed] = useControllableState({
|
|
23
|
+
value: drawer ? undefined : props.collapsed,
|
|
24
|
+
defaultValue: (!drawer && props.defaultCollapsed) ?? false,
|
|
25
|
+
onChange: drawer ? undefined : props.onCollapsedChange,
|
|
26
|
+
});
|
|
27
|
+
// Only a collapsible sidebar can be collapsed — a stale `collapsed` left
|
|
28
|
+
// behind after `collapsible` is turned off must not shrink the rail.
|
|
29
|
+
const collapsed = collapsible && collapsedValue === true;
|
|
30
|
+
const toggleCollapsed = useCallback(() => {
|
|
31
|
+
setCollapsed((prev) => !prev);
|
|
32
|
+
}, [setCollapsed]);
|
|
15
33
|
const sidebarRef = useRef(null);
|
|
34
|
+
const toggleRef = useRef(null);
|
|
35
|
+
// Read inside an event handler, so it must be a ref rather than the
|
|
36
|
+
// render-closure value.
|
|
37
|
+
const collapsedRef = useRef(collapsed);
|
|
38
|
+
collapsedRef.current = collapsed;
|
|
39
|
+
/**
|
|
40
|
+
* Collapsing hides Header, Nav and Footer outright, so a collapse driven
|
|
41
|
+
* from outside — a controlled `collapsed`, an app-level shortcut — can pull
|
|
42
|
+
* the rendered element out from under the keyboard cursor. The browser then
|
|
43
|
+
* drops focus to `<body>`: no ring, no announcement, and the user's place in
|
|
44
|
+
* the page is simply gone (WCAG 2.4.3). Clicking the toggle is safe because
|
|
45
|
+
* focus is already on the one element that survives; every other route is
|
|
46
|
+
* not, which is why this hangs off the event rather than the toggle.
|
|
47
|
+
*
|
|
48
|
+
* Driven by `focusout` rather than an effect on `collapsed` deliberately:
|
|
49
|
+
* the browser fires it at the exact moment focus is actually lost, so there
|
|
50
|
+
* is no race against style recalculation to reason about — an effect has to
|
|
51
|
+
* guess whether `display: none` has been applied yet.
|
|
52
|
+
*
|
|
53
|
+
* The `offsetParent` check is what separates the two cases that both arrive
|
|
54
|
+
* with a null `relatedTarget`: an element hidden under the cursor has no
|
|
55
|
+
* offset parent, while one the user simply clicked away from is still laid
|
|
56
|
+
* out. Without it this would steal focus from anyone clicking dead space.
|
|
57
|
+
*/
|
|
58
|
+
const handleFocusOut = useCallback((event) => {
|
|
59
|
+
if (!collapsedRef.current)
|
|
60
|
+
return;
|
|
61
|
+
if (event.relatedTarget)
|
|
62
|
+
return;
|
|
63
|
+
const lost = event.target;
|
|
64
|
+
if (lost.isConnected && lost.offsetParent !== null)
|
|
65
|
+
return;
|
|
66
|
+
// The toggle is the one interactive element guaranteed to survive the
|
|
67
|
+
// collapse. Without one, the rail itself takes focus so the user lands
|
|
68
|
+
// on the landmark rather than at the top of the document.
|
|
69
|
+
(toggleRef.current ?? sidebarRef.current)?.focus();
|
|
70
|
+
}, []);
|
|
71
|
+
const collapseContext = useMemo(() => ({ collapsible, collapsed, position, toggle: toggleCollapsed, toggleRef }), [collapsible, collapsed, position, toggleCollapsed]);
|
|
16
72
|
const restoreRef = useRef(null);
|
|
17
73
|
// Exit animation: keep DOM mounted until slide-out animation completes.
|
|
18
74
|
// `visible` stays true after `open` goes false, until animationend fires.
|
|
@@ -115,7 +171,14 @@ function SidebarRoot(props) {
|
|
|
115
171
|
// Static mode: render directly
|
|
116
172
|
// ---------------------------------------------------------------------------
|
|
117
173
|
if (!drawer) {
|
|
118
|
-
return (_jsx("aside", { ref: sidebarRef, className: rootClassName, "data-position": position, "
|
|
174
|
+
return (_jsx(SidebarCollapseContext.Provider, { value: collapseContext, children: _jsx("aside", { ref: sidebarRef, className: rootClassName, "data-position": position, "data-collapsed": collapsible ? String(collapsed) : undefined,
|
|
175
|
+
// Focus target of last resort for the recovery above, for a
|
|
176
|
+
// collapsible sidebar driven by an external control with no
|
|
177
|
+
// `Sidebar.Toggle` of its own. Not in the tab order either way.
|
|
178
|
+
tabIndex: collapsible ? -1 : undefined,
|
|
179
|
+
// React maps this to `focusout`, which bubbles — so one handler on
|
|
180
|
+
// the landmark covers every descendant the collapse can hide.
|
|
181
|
+
onBlur: collapsible ? handleFocusOut : undefined, "aria-label": ariaLabel, children: children }) }));
|
|
119
182
|
}
|
|
120
183
|
// ---------------------------------------------------------------------------
|
|
121
184
|
// Drawer mode: render inline with fixed positioning (no portal needed)
|
|
@@ -130,7 +193,7 @@ function SidebarRoot(props) {
|
|
|
130
193
|
]
|
|
131
194
|
.filter(Boolean)
|
|
132
195
|
.join(' ');
|
|
133
|
-
return (_jsxs("div", { className: drawerClassName, "data-position": position, "data-state": drawerState, children: [_jsx("div", { className: "tui-sidebar-drawer__backdrop", onClick: onClose, "aria-hidden": "true" }), _jsx("div", { ref: panelRef, className: "tui-sidebar-drawer__panel", role: "dialog", "aria-modal": "true", "aria-label": ariaLabel, onAnimationEnd: handleAnimationEnd, children: _jsx("aside", { ref: sidebarRef, className: rootClassName, "data-position": position, tabIndex: -1, children: children }) })] }));
|
|
196
|
+
return (_jsx(SidebarCollapseContext.Provider, { value: collapseContext, children: _jsxs("div", { className: drawerClassName, "data-position": position, "data-state": drawerState, children: [_jsx("div", { className: "tui-sidebar-drawer__backdrop", onClick: onClose, "aria-hidden": "true" }), _jsx("div", { ref: panelRef, className: "tui-sidebar-drawer__panel", role: "dialog", "aria-modal": "true", "aria-label": ariaLabel, onAnimationEnd: handleAnimationEnd, children: _jsx("aside", { ref: sidebarRef, className: rootClassName, "data-position": position, tabIndex: -1, children: children }) })] }) }));
|
|
134
197
|
}
|
|
135
198
|
// =============================================================================
|
|
136
199
|
// Sidebar.Header
|
|
@@ -156,11 +219,55 @@ function SidebarNav(props) {
|
|
|
156
219
|
const navClassName = ['tui-sidebar__nav', className].filter(Boolean).join(' ');
|
|
157
220
|
return (_jsx("nav", { className: navClassName, "aria-label": navAriaLabel, "aria-labelledby": navAriaLabelledBy, children: children }));
|
|
158
221
|
}
|
|
222
|
+
// =============================================================================
|
|
223
|
+
// Sidebar.Toggle
|
|
224
|
+
// =============================================================================
|
|
225
|
+
/**
|
|
226
|
+
* Collapses and expands the sidebar it sits in.
|
|
227
|
+
*
|
|
228
|
+
* Place it as a direct child of `Sidebar` rather than inside Header, Nav or
|
|
229
|
+
* Footer — those three are what the collapsed rail hides, and a button
|
|
230
|
+
* hidden with them could never bring the sidebar back. Anything else you
|
|
231
|
+
* put directly in the sidebar survives the collapse alongside it.
|
|
232
|
+
*
|
|
233
|
+
* The glyph reads as a direction, so it tracks `position`: on a left-hand
|
|
234
|
+
* sidebar collapsing moves content left (`sidebar-collapse`, arrow pointing
|
|
235
|
+
* left) and expanding moves it right. A right-hand sidebar wants the
|
|
236
|
+
* mirror of that, and the icon pair already is one.
|
|
237
|
+
*/
|
|
238
|
+
function SidebarToggle(props) {
|
|
239
|
+
const { labels, className, ...rest } = props;
|
|
240
|
+
const text = { ...defaultSidebarToggleLabels, ...labels };
|
|
241
|
+
const context = useContext(SidebarCollapseContext);
|
|
242
|
+
const hasWarnedRef = useRef(false);
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
if (isDev() && context && !context.collapsible && !hasWarnedRef.current) {
|
|
245
|
+
console.warn('[TUI Sidebar] Sidebar.Toggle rendered inside a Sidebar without ' +
|
|
246
|
+
'`collapsible`. Add `collapsible` to the Sidebar, or drop the toggle.');
|
|
247
|
+
hasWarnedRef.current = true;
|
|
248
|
+
}
|
|
249
|
+
}, [context]);
|
|
250
|
+
// Outside a Sidebar there is nothing to collapse, and rendering a dead
|
|
251
|
+
// button would be worse than rendering none.
|
|
252
|
+
if (!context) {
|
|
253
|
+
if (isDev()) {
|
|
254
|
+
console.warn('[TUI Sidebar] Sidebar.Toggle must be rendered inside a Sidebar.');
|
|
255
|
+
}
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
const { collapsed, position, toggle, toggleRef } = context;
|
|
259
|
+
const pointsInward = position === 'left' ? !collapsed : collapsed;
|
|
260
|
+
return (_jsx(IconButton, { ...rest, ref: (node) => {
|
|
261
|
+
toggleRef.current = node;
|
|
262
|
+
}, icon: pointsInward ? 'system/sidebar-collapse' : 'system/sidebar-expand', label: collapsed ? text.expand : text.collapse, className: ['tui-sidebar__toggle', className].filter(Boolean).join(' '), "aria-expanded": !collapsed, onClick: toggle }));
|
|
263
|
+
}
|
|
159
264
|
SidebarHeader.displayName = 'Sidebar.Header';
|
|
160
265
|
SidebarFooter.displayName = 'Sidebar.Footer';
|
|
161
266
|
SidebarNav.displayName = 'Sidebar.Nav';
|
|
267
|
+
SidebarToggle.displayName = 'Sidebar.Toggle';
|
|
162
268
|
export const Sidebar = SidebarRoot;
|
|
163
269
|
Sidebar.displayName = 'Sidebar';
|
|
164
270
|
Sidebar.Header = SidebarHeader;
|
|
165
271
|
Sidebar.Footer = SidebarFooter;
|
|
166
272
|
Sidebar.Nav = SidebarNav;
|
|
273
|
+
Sidebar.Toggle = SidebarToggle;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { Sidebar } from './Sidebar';
|
|
2
|
-
export
|
|
2
|
+
export { defaultSidebarToggleLabels } from './types';
|
|
3
|
+
export type { SidebarProps, SidebarHeaderProps, SidebarFooterProps, SidebarNavProps, SidebarToggleProps, SidebarToggleLabels, } from './types';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { IconButtonAsButton } from '../IconButton/types';
|
|
2
3
|
type SidebarBaseProps = {
|
|
3
4
|
/**
|
|
4
5
|
* Sidebar position. Affects border placement and drawer slide direction.
|
|
@@ -27,6 +28,31 @@ type SidebarStaticProps = SidebarBaseProps & {
|
|
|
27
28
|
* @default false
|
|
28
29
|
*/
|
|
29
30
|
drawer?: false;
|
|
31
|
+
/**
|
|
32
|
+
* Opt into the collapsed rail: the sidebar can shrink to
|
|
33
|
+
* `--tui-sidebar-collapsed-width`, hiding Header, Nav and Footer while
|
|
34
|
+
* leaving any other child — a `Sidebar.Toggle`, an icon rail — visible.
|
|
35
|
+
*
|
|
36
|
+
* Deliberately absent from drawer mode: a drawer is already a
|
|
37
|
+
* show/hide overlay, and a rail inside one has nothing to sit beside.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
collapsible?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Collapsed state (controlled). Pair with `onCollapsedChange`.
|
|
43
|
+
* Leave undefined to let the sidebar own the state.
|
|
44
|
+
*/
|
|
45
|
+
collapsed?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Initial collapsed state when uncontrolled.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
defaultCollapsed?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Called with the next collapsed state whenever `Sidebar.Toggle` is
|
|
53
|
+
* pressed — in both controlled and uncontrolled mode.
|
|
54
|
+
*/
|
|
55
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
30
56
|
};
|
|
31
57
|
type SidebarDrawerProps = SidebarBaseProps & {
|
|
32
58
|
/**
|
|
@@ -68,6 +94,48 @@ export type SidebarFooterProps = {
|
|
|
68
94
|
*/
|
|
69
95
|
className?: string;
|
|
70
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* The toggle's accessible name flips with the state rather than staying
|
|
99
|
+
* constant, so each half is named for the action it will perform — the same
|
|
100
|
+
* call `SecretInput` makes for its reveal/hide button, and for the same
|
|
101
|
+
* reason: a name is announced reliably by every AT, where a state attribute
|
|
102
|
+
* is not.
|
|
103
|
+
*/
|
|
104
|
+
export type SidebarToggleLabels = {
|
|
105
|
+
/**
|
|
106
|
+
* Accessible name while the sidebar is expanded — i.e. what pressing it
|
|
107
|
+
* will do: collapse the sidebar.
|
|
108
|
+
* @default 'Collapse sidebar'
|
|
109
|
+
*/
|
|
110
|
+
collapse?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Accessible name while the sidebar is collapsed.
|
|
113
|
+
* @default 'Expand sidebar'
|
|
114
|
+
*/
|
|
115
|
+
expand?: string;
|
|
116
|
+
};
|
|
117
|
+
export declare const defaultSidebarToggleLabels: Required<SidebarToggleLabels>;
|
|
118
|
+
/**
|
|
119
|
+
* Everything IconButton takes as a `<button>`, minus the four props the
|
|
120
|
+
* toggle decides for itself: the glyph, its label, the pressed state and
|
|
121
|
+
* the click. Everything else — `theme`, `size`, `variant`, `showTooltip`,
|
|
122
|
+
* `data-*` — passes straight through, so a consumer can restyle the
|
|
123
|
+
* control without the Sidebar growing a prop for each.
|
|
124
|
+
*
|
|
125
|
+
* `label` is among the four because IconButton's `label` is one constant
|
|
126
|
+
* accessible name, and this button does not have one — it has two. Keeping
|
|
127
|
+
* the prop and quietly redefining it as "the expanded one" would read as
|
|
128
|
+
* the IconButton prop it no longer is; `labels` says there are two states
|
|
129
|
+
* and names both.
|
|
130
|
+
*/
|
|
131
|
+
export type SidebarToggleProps = Omit<IconButtonAsButton, 'icon' | 'label' | 'pressed' | 'onClick' | 'aria-expanded'> & {
|
|
132
|
+
/**
|
|
133
|
+
* Accessible names for the two states. Defaults are English and are
|
|
134
|
+
* exported as {@link defaultSidebarToggleLabels}; a partial object
|
|
135
|
+
* overrides only the keys it names.
|
|
136
|
+
*/
|
|
137
|
+
labels?: SidebarToggleLabels;
|
|
138
|
+
};
|
|
71
139
|
export type SidebarNavProps = {
|
|
72
140
|
/**
|
|
73
141
|
* Accessible label for the nav landmark.
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
2
|
// Sidebar Types
|
|
3
3
|
// =============================================================================
|
|
4
|
-
export {
|
|
4
|
+
export const defaultSidebarToggleLabels = {
|
|
5
|
+
collapse: 'Collapse sidebar',
|
|
6
|
+
expand: 'Expand sidebar',
|
|
7
|
+
};
|
package/components/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export { RadioGroup, Radio } from './Radio';
|
|
|
32
32
|
export { Rating } from './Rating';
|
|
33
33
|
export { SegmentedControl } from './SegmentedControl';
|
|
34
34
|
export { Slider } from './Slider';
|
|
35
|
-
export { Sidebar } from './Sidebar';
|
|
35
|
+
export { Sidebar, defaultSidebarToggleLabels } from './Sidebar';
|
|
36
36
|
export { StepIndicator } from './StepIndicator';
|
|
37
37
|
export { StepList } from './StepList';
|
|
38
38
|
export { DataTable } from './Table';
|
|
@@ -75,7 +75,7 @@ export type { ProgressProps } from './Progress';
|
|
|
75
75
|
export type { RadioGroupProps, RadioProps } from './Radio';
|
|
76
76
|
export type { RatingProps } from './Rating';
|
|
77
77
|
export type { SegmentedControlProps, SegmentedControlItemProps, SegmentedControlValue, SegmentedControlVariant, SegmentedControlSize, SegmentedControlOrientation, } from './SegmentedControl';
|
|
78
|
-
export type { SidebarProps, SidebarHeaderProps, SidebarNavProps } from './Sidebar';
|
|
78
|
+
export type { SidebarProps, SidebarHeaderProps, SidebarFooterProps, SidebarNavProps, SidebarToggleProps, SidebarToggleLabels, } from './Sidebar';
|
|
79
79
|
export type { StepIndicatorProps, StepStatus } from './StepIndicator';
|
|
80
80
|
export type { StepListProps, StepListItemProps } from './StepList';
|
|
81
81
|
export type { DataTableProps } from './Table';
|
package/components/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export { RadioGroup, Radio } from './Radio/index.js';
|
|
|
30
30
|
export { Rating } from './Rating/index.js';
|
|
31
31
|
export { SegmentedControl } from './SegmentedControl/index.js';
|
|
32
32
|
export { Slider } from './Slider/index.js';
|
|
33
|
-
export { Sidebar } from './Sidebar/index.js';
|
|
33
|
+
export { Sidebar, defaultSidebarToggleLabels } from './Sidebar/index.js';
|
|
34
34
|
export { StepIndicator } from './StepIndicator/index.js';
|
|
35
35
|
export { StepList } from './StepList/index.js';
|
|
36
36
|
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.18",
|
|
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.",
|
package/package.json
CHANGED
|
@@ -80,7 +80,8 @@ their full `--tui-<component>-*` API — the only shipped listing, since consume
|
|
|
80
80
|
0.2.12.)
|
|
81
81
|
- **Most union / variant aliases**: `AccordionVariant`, `ContentIndicatorSize`,
|
|
82
82
|
`ComboboxFilterMode`, `IconButton`'s `Shape`/`Variant`, `NoticeHandle`, `ProgressSegment`,
|
|
83
|
-
`OptionValue`, `
|
|
83
|
+
`OptionValue`, `TooltipTheme`, … (`SidebarFooterProps` was on this list until 0.2.18, which
|
|
84
|
+
also exported the new `SidebarToggleProps`.)
|
|
84
85
|
- **All of DatePicker** — the barrel exports zero DatePicker types: `DatePickerProps`,
|
|
85
86
|
`DateRangePickerProps`, `CalendarProps`, `DateRange`, `DateRangePreset`, `WeekStart`.
|
|
86
87
|
- **`SliderProps`**, which is missing entirely.
|
|
@@ -248,6 +249,24 @@ DataTable already use.
|
|
|
248
249
|
}
|
|
249
250
|
```
|
|
250
251
|
|
|
252
|
+
On `SegmentedControl`'s **outline** variant the selected *border* is the whole selection
|
|
253
|
+
indicator, and it has its own token — `--tui-segmented-item-border-active` (added 0.2.17). Before
|
|
254
|
+
that it read the theme token directly, so the fill and text were overridable per value and the
|
|
255
|
+
border was not. If you recolour a segment in the outline variant, move the border with the fill or
|
|
256
|
+
the option will read as the wrong colour outlined in the theme's:
|
|
257
|
+
|
|
258
|
+
```css
|
|
259
|
+
.tui-segmented__item[data-value='fail'] {
|
|
260
|
+
--tui-segmented-item-bg-active: var(--tui-theme-danger-subtlest);
|
|
261
|
+
--tui-segmented-item-fg-active: var(--tui-theme-danger-stronger);
|
|
262
|
+
--tui-segmented-item-border-active: var(--tui-theme-danger-base);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Check the border you pick against the **page**, not against the fill — it is a non-text indicator,
|
|
267
|
+
so WCAG SC 1.4.11 asks for 3:1 there, and a tone that looks right on the fill can fall under that
|
|
268
|
+
against a dark page. TUI's own defaults are 3.60:1 (dark) and 7.52:1 (light).
|
|
269
|
+
|
|
251
270
|
Reach for the component's own tokens inside the rule, as above, rather than setting `background`
|
|
252
271
|
directly — that keeps the hover and focus treatments the component already derives. Note that
|
|
253
272
|
`--tui-segmented-item-bg-active` only applies when the item *is* active, so the selector above does
|