@tangible/ui 0.2.19 → 0.2.21

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 (36) hide show
  1. package/components/Accordion/Accordion.d.ts +1 -1
  2. package/components/Accordion/Accordion.js +40 -12
  3. package/components/Accordion/AccordionContext.d.ts +2 -1
  4. package/components/Accordion/AccordionContext.js +25 -2
  5. package/components/Accordion/index.d.ts +2 -1
  6. package/components/Accordion/index.js +1 -0
  7. package/components/Accordion/types.d.ts +42 -3
  8. package/components/ColorPicker/ColorField.d.ts +25 -1
  9. package/components/ColorPicker/ColorField.js +9 -3
  10. package/components/ColorPicker/index.d.ts +1 -1
  11. package/components/Modal/Modal.d.ts +36 -2
  12. package/components/Modal/Modal.js +40 -11
  13. package/components/Modal/index.d.ts +1 -1
  14. package/components/MoveHandle/MoveHandle.js +25 -11
  15. package/components/MoveHandle/types.d.ts +9 -3
  16. package/components/Toast/Toast.d.ts +14 -0
  17. package/components/Toast/Toast.js +85 -19
  18. package/components/index.d.ts +4 -4
  19. package/components/index.js +1 -1
  20. package/figma-tokens.json +2 -2
  21. package/package.json +9 -1
  22. package/skills/building-with-tui/SKILL.md +29 -2
  23. package/styles/all.css +1 -1
  24. package/styles/all.expanded.css +65 -14
  25. package/styles/all.expanded.unlayered.css +65 -14
  26. package/styles/all.unlayered.css +1 -1
  27. package/styles/components/color-picker.scss +58 -4
  28. package/styles/components/modal.scss +31 -1
  29. package/styles/components/move-handle.scss +20 -4
  30. package/styles/components/toast.scss +16 -0
  31. package/styles/core.css +1 -1
  32. package/styles/core.unlayered.css +1 -1
  33. package/styles/index.scss +7 -1
  34. package/tui-manifest.json +49 -7
  35. package/utils/color/contrast.d.ts +17 -0
  36. package/utils/color/contrast.js +26 -0
@@ -30,6 +30,13 @@ export type ToastProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'c
30
30
  announce?: ToastAnnounce;
31
31
  /** Renders a dismiss (×) button. Default true. */
32
32
  dismissible?: boolean;
33
+ /**
34
+ * Makes the toast root programmatically focusable (tabIndex -1, with a
35
+ * focus ring) — Notice's `focusable`, forwarded. ToastProvider sets it on
36
+ * every queued toast: the root is the focus target when a same-id
37
+ * replacement unmounts an instance that held focus.
38
+ */
39
+ focusable?: boolean;
33
40
  /** Called after the exit animation completes (× button path). */
34
41
  onDismiss?: () => void;
35
42
  /** Accessible label for the dismiss button. Default 'Dismiss'. */
@@ -80,6 +87,13 @@ export declare const Toast: React.ForwardRefExoticComponent<Omit<React.HTMLAttri
80
87
  announce?: ToastAnnounce;
81
88
  /** Renders a dismiss (×) button. Default true. */
82
89
  dismissible?: boolean;
90
+ /**
91
+ * Makes the toast root programmatically focusable (tabIndex -1, with a
92
+ * focus ring) — Notice's `focusable`, forwarded. ToastProvider sets it on
93
+ * every queued toast: the root is the focus target when a same-id
94
+ * replacement unmounts an instance that held focus.
95
+ */
96
+ focusable?: boolean;
83
97
  /** Called after the exit animation completes (× button path). */
84
98
  onDismiss?: () => void;
85
99
  /** Accessible label for the dismiss button. Default 'Dismiss'. */
@@ -28,19 +28,15 @@ const EXIT_FALLBACK_MS = 1000;
28
28
  * component API tokens (`--tui-notice-bg`, `--tui-notice-padding`, …) can be
29
29
  * re-pointed per toast context: `.tui-toast { --tui-notice-bg: …; }`.
30
30
  */
31
- export const Toast = forwardRef(function Toast({ theme = 'neutral', size = 'sm', icon, title, announce, dismissible = true, onDismiss, dismissLabel, actions, className, children, ...rest }, ref) {
31
+ export const Toast = forwardRef(function Toast({ theme = 'neutral', size = 'sm', icon, title, announce, dismissible = true, focusable, onDismiss, dismissLabel, actions, className, children, ...rest }, ref) {
32
32
  const resolvedAnnounce = announce ?? (theme === 'danger' ? 'assertive' : 'polite');
33
- return (_jsxs(Notice, { as: "div", ref: ref, className: cx('tui-toast', 'tui-interface', className), "data-theme": "dark", theme: theme, size: size, inline: true, announce: resolvedAnnounce, dismissible: dismissible, onDismiss: onDismiss, dismissLabel: dismissLabel, exitAnimation: "fade", ...rest, children: [icon && _jsx(Notice.Head, { icon: icon }), (title || children != null) && (_jsxs(Notice.Body, { children: [title && _jsx("div", { className: "tui-toast__title", children: title }), children != null && _jsx("div", { className: "tui-toast__description", children: children })] })), actions && _jsx(Notice.Foot, { children: actions })] }));
33
+ return (_jsxs(Notice, { as: "div", ref: ref, className: cx('tui-toast', 'tui-interface', className), "data-theme": "dark", theme: theme, size: size, inline: true, announce: resolvedAnnounce, dismissible: dismissible, focusable: focusable, onDismiss: onDismiss, dismissLabel: dismissLabel, exitAnimation: "fade", ...rest, children: [icon && _jsx(Notice.Head, { icon: icon }), (title || children != null) && (_jsxs(Notice.Body, { children: [title && _jsx("div", { className: "tui-toast__title", children: title }), children != null && _jsx("div", { className: "tui-toast__description", children: children })] })), actions && _jsx(Notice.Foot, { children: actions })] }));
34
34
  });
35
35
  let toastCounter = 0;
36
36
  export function ToastProvider({ children, placement = 'bottom-end', duration = 5000, regionLabel = 'Notifications', max = 5, container, }) {
37
37
  const [toasts, setToasts] = useState([]);
38
38
  const anchorRef = useRef(null);
39
39
  const [mount, setMount] = useState(null);
40
- // Once the region has appeared it stays mounted (empty when idle): a live
41
- // region that already exists announces inserted toasts far more reliably
42
- // than one created in the same commit as its first content.
43
- const [everShown, setEverShown] = useState(false);
44
40
  const autoMountRef = useRef(null);
45
41
  const warnedEmptyRef = useRef(false);
46
42
  const warnedUndismissableRef = useRef(false);
@@ -60,7 +56,6 @@ export function ToastProvider({ children, placement = 'bottom-end', duration = 5
60
56
  'dismiss(id), or the toast can never be removed.');
61
57
  }
62
58
  const id = options.id ?? `tui-toast-${++toastCounter}`;
63
- setEverShown(true);
64
59
  setToasts((prev) => {
65
60
  const existing = prev.find((t) => t.id === id);
66
61
  const record = {
@@ -97,9 +92,13 @@ export function ToastProvider({ children, placement = 'bottom-end', duration = 5
97
92
  const api = useMemo(() => ({ toast, dismiss, dismissAll }), [toast, dismiss, dismissAll]);
98
93
  // Resolve the portal mount from the provider's own position in the tree
99
94
  // (the anchor span), never from document.activeElement — see the Modal
100
- // portal gotcha in CLAUDE.md.
95
+ // portal gotcha in CLAUDE.md. Runs at provider mount, not first toast:
96
+ // the region and its announcers are PRE-WARMED so the page's very first
97
+ // toast lands in live regions AT has already registered — insertion into
98
+ // an existing region is the reliable announcement path; a live region
99
+ // born in the same commit as its first content is the unreliable one.
101
100
  useLayoutEffect(() => {
102
- if (!isBrowser || !everShown)
101
+ if (!isBrowser)
103
102
  return;
104
103
  if (container) {
105
104
  setMount((current) => (current === container ? current : container));
@@ -113,8 +112,8 @@ export function ToastProvider({ children, placement = 'bottom-end', duration = 5
113
112
  const resolved = getPortalRootFor(anchorRef.current);
114
113
  autoMountRef.current = resolved;
115
114
  setMount(resolved);
116
- }, [everShown, container]);
117
- return (_jsxs(ToastContext.Provider, { value: api, children: [children, _jsx("span", { hidden: true, ref: anchorRef }), isBrowser && mount && everShown &&
115
+ }, [container]);
116
+ return (_jsxs(ToastContext.Provider, { value: api, children: [children, _jsx("span", { hidden: true, ref: anchorRef }), isBrowser && mount &&
118
117
  createPortal(_jsx(ToastRegion, { placement: placement, label: regionLabel, toasts: toasts, defaultDuration: duration, onRemove: remove }), mount)] }));
119
118
  }
120
119
  function ToastRegion({ placement, label, toasts, defaultDuration, onRemove }) {
@@ -123,17 +122,52 @@ function ToastRegion({ placement, label, toasts, defaultDuration, onRemove }) {
123
122
  const [focused, setFocused] = useState(false);
124
123
  const [pressed, setPressed] = useState(false);
125
124
  const paused = hovered || focused || pressed;
126
- return (_jsx("div", { ref: regionRef, className: cx('tui-toast-region', `is-placement-${placement}`), role: "region", "aria-label": label, tabIndex: -1, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onPointerDown: () => setPressed(true), onPointerUp: () => setPressed(false), onPointerCancel: () => setPressed(false), onFocusCapture: () => setFocused(true), onBlurCapture: (event) => {
125
+ // Pre-warmed announcers: one polite, one assertive, mounted (empty) with
126
+ // the region. Toast roots carry aria-live="off" — announcements happen
127
+ // exclusively by MUTATING these already-registered live regions, never by
128
+ // inserting fresh role="status"/"alert" subtrees (unreliable across AT,
129
+ // and double-fire when both mechanisms work).
130
+ const [announcement, setAnnouncement] = useState(null);
131
+ const announceSeqRef = useRef(0);
132
+ const announceClearRef = useRef(null);
133
+ // Focus hand-off across a same-id replacement: the outgoing instance
134
+ // records its id here at unmount if it held focus; the incoming instance
135
+ // claims it on mount.
136
+ const focusHandoffRef = useRef(null);
137
+ const announce = useCallback((politeness, text) => {
138
+ if (!text)
139
+ return;
140
+ announceSeqRef.current += 1;
141
+ // Alternating trailing NBSP guarantees a DOM mutation even when the
142
+ // same message repeats back-to-back — identical text is no mutation,
143
+ // and no mutation is no announcement.
144
+ setAnnouncement({
145
+ politeness,
146
+ text: text + (announceSeqRef.current % 2 ? ' ' : ''),
147
+ });
148
+ if (announceClearRef.current)
149
+ clearTimeout(announceClearRef.current);
150
+ // Clear after AT has had time to speak, so browse mode can't stumble
151
+ // over stale text in the hidden node.
152
+ announceClearRef.current = setTimeout(() => setAnnouncement(null), 3000);
153
+ }, []);
154
+ useEffect(() => {
155
+ return () => {
156
+ if (announceClearRef.current)
157
+ clearTimeout(announceClearRef.current);
158
+ };
159
+ }, []);
160
+ return (_jsxs("div", { ref: regionRef, className: cx('tui-toast-region', `is-placement-${placement}`), role: "region", "aria-label": label, tabIndex: -1, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onPointerDown: () => setPressed(true), onPointerUp: () => setPressed(false), onPointerCancel: () => setPressed(false), onFocusCapture: () => setFocused(true), onBlurCapture: (event) => {
127
161
  if (!event.currentTarget.contains(event.relatedTarget)) {
128
162
  setFocused(false);
129
163
  }
130
- }, children: toasts.map((record) => (_jsx(ToastItem
131
- // Keyed on revision too: a re-toast of the same id REMOUNTS the
132
- // item, resetting Notice's exit state — updating in place could
133
- // land new content inside an element already faded to nothing.
134
- , { record: record, paused: paused, defaultDuration: defaultDuration, regionRef: regionRef, onRemove: onRemove }, `${record.id}:${record.revision}`))) }));
164
+ }, children: [_jsx("div", { className: "tui-toast-region__announcer", "aria-live": "polite", "aria-atomic": "true", children: announcement?.politeness === 'polite' ? announcement.text : '' }), _jsx("div", { className: "tui-toast-region__announcer", "aria-live": "assertive", "aria-atomic": "true", children: announcement?.politeness === 'assertive' ? announcement.text : '' }), toasts.map((record) => (_jsx(ToastItem
165
+ // Keyed on revision too: a re-toast of the same id REMOUNTS the
166
+ // item, resetting Notice's exit state — updating in place could
167
+ // land new content inside an element already faded to nothing.
168
+ , { record: record, paused: paused, defaultDuration: defaultDuration, regionRef: regionRef, focusHandoffRef: focusHandoffRef, announce: announce, onRemove: onRemove }, `${record.id}:${record.revision}`)))] }));
135
169
  }
136
- function ToastItem({ record, paused, defaultDuration, regionRef, onRemove }) {
170
+ function ToastItem({ record, paused, defaultDuration, regionRef, focusHandoffRef, announce, onRemove, }) {
137
171
  const handleRef = useRef(null);
138
172
  const firedRef = useRef(false);
139
173
  const unmountedRef = useRef(false);
@@ -142,6 +176,35 @@ function ToastItem({ record, paused, defaultDuration, regionRef, onRemove }) {
142
176
  unmountedRef.current = true;
143
177
  };
144
178
  }, []);
179
+ const politeness = record.announce ?? (record.theme === 'danger' ? 'assertive' : 'polite');
180
+ // Once per instance (a same-id re-toast REMOUNTS, so updates re-enter
181
+ // here): announce the toast's text via the region's pre-warmed live
182
+ // regions, and settle focus across a replacement. useLayoutEffect so the
183
+ // unmount cleanup still sees the DOM attached — it must know whether this
184
+ // instance held focus at the moment it was replaced.
185
+ useLayoutEffect(() => {
186
+ const element = handleRef.current?.element;
187
+ // Title + description only — the dismiss label and action buttons are
188
+ // controls, not message.
189
+ const text = ['.tui-toast__title', '.tui-toast__description']
190
+ .map((selector) => element?.querySelector(selector)?.textContent?.trim())
191
+ .filter(Boolean)
192
+ .join('. ');
193
+ announce(politeness, text);
194
+ // Claim a pending hand-off: the instance this one replaced held focus.
195
+ if (focusHandoffRef.current === record.id) {
196
+ focusHandoffRef.current = null;
197
+ element?.focus();
198
+ }
199
+ return () => {
200
+ // Replaced (or otherwise unmounted) while holding focus: record the
201
+ // hand-off for the incoming instance. Normal removals never get here
202
+ // with focus inside — finalize has already moved it to the region.
203
+ if (element && element.contains(document.activeElement)) {
204
+ focusHandoffRef.current = record.id;
205
+ }
206
+ };
207
+ }, [announce, politeness, record.id, focusHandoffRef]);
145
208
  // Single exit point: onDismiss fires once no matter which path removed the
146
209
  // toast (timer, dismiss(), or the × button). If the removed toast held
147
210
  // focus, hand it to the region — unmounting the focused element would
@@ -189,7 +252,10 @@ function ToastItem({ record, paused, defaultDuration, regionRef, onRemove }) {
189
252
  if (record.dismissed)
190
253
  void dismissNow();
191
254
  }, [record.dismissed, dismissNow]);
192
- return (_jsx(Toast, { ref: handleRef, theme: record.theme, size: record.size, icon: record.icon, title: record.title, actions: record.actions, announce: record.announce, dismissible: record.dismissible, dismissLabel: record.dismissLabel, className: record.className, style: record.style, "data-testid": record['data-testid'], onDismiss: finalize, children: record.description }));
255
+ return (_jsx(Toast, { ref: handleRef, theme: record.theme, size: record.size, icon: record.icon, title: record.title, actions: record.actions, announce: record.announce, dismissible: record.dismissible, dismissLabel: record.dismissLabel, className: record.className, style: record.style, "data-testid": record['data-testid'], onDismiss: finalize, "aria-live": "off",
256
+ // tabIndex -1: the root is the focus target for same-id replacement
257
+ // hand-off (the Notice `focusable` prop, built for exactly this).
258
+ focusable: true, children: record.description }));
193
259
  }
194
260
  /**
195
261
  * Countdown that survives pauses: while `paused`, the remaining time is
@@ -1,7 +1,7 @@
1
1
  export type { Size, SizeExtended, SizeCompact, SizeStandard } from '../types';
2
2
  export type { Theme, ThemeIntent, ThemeStatus } from '../types';
3
3
  export type { IconName } from '../icons/registry';
4
- export { Accordion } from './Accordion';
4
+ export { Accordion, useAccordionItem } from './Accordion';
5
5
  export { Avatar, AvatarGroup } from './Avatar';
6
6
  export { Button } from './Button';
7
7
  export { Card } from './Card';
@@ -46,7 +46,7 @@ export { TextInput } from './TextInput';
46
46
  export { Toast, ToastProvider, useToast } from './Toast';
47
47
  export { Toolbar } from './Toolbar';
48
48
  export { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from './Tooltip';
49
- export type { AccordionProps, AccordionSingleProps, AccordionMultipleProps, AccordionItemProps, AccordionTriggerProps, AccordionPanelProps, } from './Accordion';
49
+ export type { AccordionProps, AccordionSingleProps, AccordionMultipleProps, AccordionItemProps, AccordionTriggerProps, AccordionPanelProps, AccordionVariant, AccordionItemState, } from './Accordion';
50
50
  export type { AvatarProps, AvatarGroupProps, AvatarSize, AvatarShape, IndicatorPosition, } from './Avatar';
51
51
  export type { ButtonProps } from './Button';
52
52
  export type { CardRootProps, CardVariant, CardMode, CardMediaProps } from './Card';
@@ -54,7 +54,7 @@ export type { CheckboxProps } from './Checkbox';
54
54
  export type { ChipProps } from './Chip';
55
55
  export type { ChipGroupProps, ChipGroupSingleProps, ChipGroupMultipleProps } from './ChipGroup';
56
56
  export type { ChipsProps, ChipOption } from './Chips';
57
- export type { ColorPickerProps, ColorPickerLabels, ColorFieldProps, ColorFieldLabels, ColorAreaProps, ColorSliderProps } from './ColorPicker';
57
+ export type { ColorPickerProps, ColorPickerLabels, ColorFieldProps, ColorFieldLabels, ColorFieldVariant, ColorAreaProps, ColorSliderProps } from './ColorPicker';
58
58
  export type { ColorFormat, Hsva as ColorHsva } from './ColorPicker';
59
59
  export type { GradientPickerProps, GradientPickerLabels, GradientBarProps, GradientBarLabels, Gradient, GradientType, GradientStop, } from './GradientPicker';
60
60
  export type { ContentIndicatorProps } from './ContentIndicator';
@@ -66,7 +66,7 @@ export type { MultiSelectProps, MultiSelectTriggerProps, MultiSelectContentProps
66
66
  export type { SelectProps, SelectTriggerProps, SelectContentProps, SelectOptionProps, SelectGroupProps, SelectLabelProps, } from './Select';
67
67
  export type { IconProps } from './Icon';
68
68
  export type { IconButtonProps } from './IconButton';
69
- export type { ModalProps } from './Modal';
69
+ export type { ModalProps, ModalRole, ModalFootProps, ModalFootJustify } from './Modal';
70
70
  export type { MoveHandleLabels, MoveHandleMode, MoveHandleProps, MoveHandleSize } from './MoveHandle';
71
71
  export type { NoticeProps } from './Notice';
72
72
  export type { OverlapStackProps, OverlapStackOverflowProps } from './OverlapStack';
@@ -1,5 +1,5 @@
1
1
  // Components
2
- export { Accordion } from './Accordion/index.js';
2
+ export { Accordion, useAccordionItem } from './Accordion/index.js';
3
3
  export { Avatar, AvatarGroup } from './Avatar/index.js';
4
4
  export { Button } from './Button/index.js';
5
5
  export { Card } from './Card/index.js';
package/figma-tokens.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.2.19",
2
+ "version": "0.2.21",
3
3
  "source": "publish/styles/all.expanded.css",
4
4
  "prefix": "tui-",
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.",
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.",
6
6
  "collections": [
7
7
  {
8
8
  "name": "TUI/Primitives",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangible/ui",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "Tangible Design System",
5
5
  "type": "module",
6
6
  "main": "./components/index.js",
@@ -41,6 +41,14 @@
41
41
  "import": "./utils/color/contrast.js",
42
42
  "types": "./utils/color/contrast.d.ts"
43
43
  },
44
+ "./utils/color": {
45
+ "import": "./utils/color/color.js",
46
+ "types": "./utils/color/color.d.ts"
47
+ },
48
+ "./utils/color/gradient": {
49
+ "import": "./utils/color/gradient.js",
50
+ "types": "./utils/color/gradient.d.ts"
51
+ },
44
52
  "./icons": {
45
53
  "import": "./icons/registry.js",
46
54
  "types": "./icons/registry.d.ts"
@@ -101,7 +101,7 @@ code. Use `DataTableProps<T>['columns']` instead.
101
101
  | size | `size?: 'sm' \| 'md' \| 'lg'` on form controls; Button/Icon/Chip use wider or narrower scales |
102
102
  | `theme` | semantic colour — `primary`, `secondary`, `success`, `warning`, `danger`, `info`; the accepted subset varies (`ThemeIntent` on Button, `ThemeStatus` on Notice) |
103
103
  | `variant` | visual treatment — `solid`, `outline`, `ghost`, `link` |
104
- | `mode` | structural mode (Progress `line \| circle`, MoveHandle `full \| handle`) |
104
+ | `mode` | structural mode (Progress `line \| circle`, MoveHandle `full \| handle \| arrows` — `arrows` + `index` is the no-drag position badge) |
105
105
  | classes | BEM-ish and stable: `tui-select__trigger`, `is-size-sm`, `is-disabled` |
106
106
 
107
107
  Clearing a clearable control calls back with **`undefined`**, not `''`. Controlled-vs-uncontrolled
@@ -212,6 +212,19 @@ Tokens, not class overrides. Four layers, and you only touch two:
212
212
  `--_*` is component-private and `$_*` compiles away; neither is yours to set. Names come from
213
213
  `tui-manifest.json` → `cssTokens`.
214
214
 
215
+ Every layer-1 primitive — colour roles **and** the scale (spacing, radius, type sizes, weights,
216
+ shadows) — is emitted at `:where(.tui-interface)`, specificity (0,0,0). A site theme written at
217
+ `:where()` after TUI's sheet therefore overrides all of them uniformly; before 0.2.21 the scale
218
+ block sat at bare `.tui-interface` and such a theme won the colours but silently lost the layout
219
+ tokens.
220
+
221
+ Colour maths ships as public utils: `@tangible/ui/utils/color` (`parseColor`, `formatColor`,
222
+ `rgbToOklch`/`oklchToRgb`, `rgbToHsl`, `hexToRgba`, …), `@tangible/ui/utils/color/gradient`
223
+ (`parseGradient`/`formatGradient`), and `@tangible/ui/utils/color/contrast` (`getContrastTone`,
224
+ `getContrastForeground`, `contrastRatio(hexA, hexB)` — WCAG ratio 1–21, `NaN` on bad input so a
225
+ `>= 4.5` check fails closed). Use them for user-selected colours and theme tooling (deriving or
226
+ validating a ladder), not to pick a component's own theming at runtime.
227
+
215
228
  Useful primitives:
216
229
 
217
230
  - Surfaces / text: `--tui-color-bg`, `-bg-surface`, `-bg-elevated`, `-bg-muted`, `-bg-inverted`,
@@ -351,11 +364,25 @@ Four things change versus a picker's default trigger, all deliberate:
351
364
 
352
365
  Your child's `onClick` still runs; call `preventDefault()` in it to suppress the toggle.
353
366
 
367
+ **`Accordion.Trigger asChild` is the one that paints.** By default it stamps `tui-accordion__trigger`
368
+ on your element — the full-width row look (flex, `width: 100%`, padding, hover background, inset
369
+ focus ring), which is what a custom header row wants. If your child is already a styled control (an
370
+ `IconButton` chevron in a repeater row), pass `unstyled` so it keeps its own sizing and focus ring;
371
+ `data-tui-accordion-trigger` and `data-state` still land, so you can style off the behaviour without
372
+ the paint. A native `<button>` child activates on Enter/Space through the browser, once — TUI does not
373
+ synthesise a second toggle. For a second control that toggles the same item (an Edit/Close link),
374
+ `useAccordionItem()` returns `{ isOpen, panelId, toggle, … }` for its own `aria-expanded`/
375
+ `aria-controls`. Controlled single-mode accordions take `value={null}` for "nothing open" —
376
+ `undefined` would flip them uncontrolled.
377
+
354
378
  ## Component names, and what isn't there
355
379
 
356
380
  43 components. If you are hunting for a name: **Alert → `Notice`**, **Menu → `Dropdown`**,
357
381
  **Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode),
358
- **Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`.
382
+ **Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`,
383
+ **ConfirmDialog / AlertDialog → `Modal role="alertdialog"`** (needs both `aria-labelledby` and
384
+ `aria-describedby`; the backdrop stops dismissing by default, Escape still cancels; put the actions in
385
+ `Modal.Foot`, which is already an end-aligned flex row — `justify="between"` separates a destructive one).
359
386
  No Toast/Snackbar, no Breadcrumb, no Skeleton, and no *standalone* time picker — but
360
387
  `DatePicker` / `DateRangePicker` take `withTime` for an hour/minute field (12- or 24-hour via
361
388
  `hour12`) plus a display-only `zoneLabel`; the value is a plain `Date` with wall-clock semantics,