@tangible/ui 0.2.18 → 0.2.20

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 (34) 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/Modal/Modal.d.ts +36 -2
  9. package/components/Modal/Modal.js +40 -11
  10. package/components/Modal/index.d.ts +1 -1
  11. package/components/MoveHandle/MoveHandle.js +25 -11
  12. package/components/MoveHandle/types.d.ts +9 -3
  13. package/components/Notice/Notice.js +7 -0
  14. package/components/Toast/Toast.d.ts +134 -0
  15. package/components/Toast/Toast.js +234 -0
  16. package/components/Toast/ToastContext.d.ts +11 -0
  17. package/components/Toast/ToastContext.js +9 -0
  18. package/components/Toast/index.d.ts +4 -0
  19. package/components/Toast/index.js +2 -0
  20. package/components/index.d.ts +5 -3
  21. package/components/index.js +2 -1
  22. package/figma-tokens.json +1 -1
  23. package/package.json +5 -1
  24. package/skills/building-with-tui/SKILL.md +16 -2
  25. package/styles/all.css +1 -1
  26. package/styles/all.expanded.css +114 -9
  27. package/styles/all.expanded.unlayered.css +114 -9
  28. package/styles/all.unlayered.css +1 -1
  29. package/styles/components/_bundle.scss +5 -0
  30. package/styles/components/modal.scss +31 -1
  31. package/styles/components/move-handle.scss +20 -4
  32. package/styles/components/notice.scss +13 -0
  33. package/styles/components/toast.scss +183 -0
  34. package/tui-manifest.json +157 -12
@@ -0,0 +1,134 @@
1
+ import React from 'react';
2
+ import type { NoticeHandle } from '../Notice';
3
+ import type { SizeStandard, ThemeStatus } from '../../types';
4
+ export type ToastTheme = ThemeStatus | 'neutral';
5
+ export type ToastPlacement = 'top-start' | 'top' | 'top-end' | 'bottom-start' | 'bottom' | 'bottom-end';
6
+ export type ToastAnnounce = 'polite' | 'assertive';
7
+ /** Handle exposed via ref — the underlying Notice handle (element + exit). */
8
+ export type ToastHandle = NoticeHandle;
9
+ export type ToastProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'children'> & {
10
+ /** Visual intent. Default 'neutral' — the plain dark surface. */
11
+ theme?: ToastTheme;
12
+ /**
13
+ * Density preset (Notice's size scale). Default 'sm' — toasts are dense;
14
+ * 'md'/'lg' restore Notice's roomier panel spacing.
15
+ */
16
+ size?: SizeStandard;
17
+ /** Icon content, rendered leading the text. Colored by theme via Notice. */
18
+ icon?: React.ReactNode;
19
+ /**
20
+ * Title text — a styled `<div>`, never a heading: a toast lives in a
21
+ * portal outside the document outline, so a heading would be an orphan
22
+ * for screen-reader heading navigation.
23
+ */
24
+ title?: React.ReactNode;
25
+ /**
26
+ * Screen-reader announcement politeness.
27
+ * Defaults to 'assertive' (role="alert") for danger, 'polite'
28
+ * (role="status") otherwise.
29
+ */
30
+ announce?: ToastAnnounce;
31
+ /** Renders a dismiss (×) button. Default true. */
32
+ dismissible?: boolean;
33
+ /** Called after the exit animation completes (× button path). */
34
+ onDismiss?: () => void;
35
+ /** Accessible label for the dismiss button. Default 'Dismiss'. */
36
+ dismissLabel?: string;
37
+ /** Action content (e.g. a Button), rendered in the foot. */
38
+ actions?: React.ReactNode;
39
+ className?: string;
40
+ style?: React.CSSProperties;
41
+ /** Body/description content. */
42
+ children?: React.ReactNode;
43
+ };
44
+ /**
45
+ * Presentational toast — an inline-layout Notice dressed for the toast stack
46
+ * (shadow, enter animation, icon | text | actions | × in one row).
47
+ *
48
+ * The toast root is also a nested `.tui-interface` with `data-theme="dark"`:
49
+ * a dark surface by default (following Tooltip's inverted treatment), done as
50
+ * a theme SCOPE rather than a token remap — the toast accepts arbitrary
51
+ * children, and everything inside (action Buttons, the dismiss IconButton,
52
+ * icons, consumer content) resolves dark tokens for free. Pass
53
+ * `data-theme="light"` (or "auto") through rest to opt out.
54
+ *
55
+ * The DOM carries both `tui-toast` and `tui-notice` classes, so Notice's
56
+ * component API tokens (`--tui-notice-bg`, `--tui-notice-padding`, …) can be
57
+ * re-pointed per toast context: `.tui-toast { --tui-notice-bg: …; }`.
58
+ */
59
+ export declare const Toast: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "title"> & {
60
+ /** Visual intent. Default 'neutral' — the plain dark surface. */
61
+ theme?: ToastTheme;
62
+ /**
63
+ * Density preset (Notice's size scale). Default 'sm' — toasts are dense;
64
+ * 'md'/'lg' restore Notice's roomier panel spacing.
65
+ */
66
+ size?: SizeStandard;
67
+ /** Icon content, rendered leading the text. Colored by theme via Notice. */
68
+ icon?: React.ReactNode;
69
+ /**
70
+ * Title text — a styled `<div>`, never a heading: a toast lives in a
71
+ * portal outside the document outline, so a heading would be an orphan
72
+ * for screen-reader heading navigation.
73
+ */
74
+ title?: React.ReactNode;
75
+ /**
76
+ * Screen-reader announcement politeness.
77
+ * Defaults to 'assertive' (role="alert") for danger, 'polite'
78
+ * (role="status") otherwise.
79
+ */
80
+ announce?: ToastAnnounce;
81
+ /** Renders a dismiss (×) button. Default true. */
82
+ dismissible?: boolean;
83
+ /** Called after the exit animation completes (× button path). */
84
+ onDismiss?: () => void;
85
+ /** Accessible label for the dismiss button. Default 'Dismiss'. */
86
+ dismissLabel?: string;
87
+ /** Action content (e.g. a Button), rendered in the foot. */
88
+ actions?: React.ReactNode;
89
+ className?: string;
90
+ style?: React.CSSProperties;
91
+ /** Body/description content. */
92
+ children?: React.ReactNode;
93
+ } & React.RefAttributes<NoticeHandle>>;
94
+ export type ToastOptions = Pick<ToastProps, 'theme' | 'size' | 'icon' | 'title' | 'announce' | 'dismissible' | 'onDismiss' | 'dismissLabel' | 'actions' | 'className' | 'style'> & {
95
+ /**
96
+ * Stable id. Calling toast() again with the same id updates that toast in
97
+ * place (remounting it, so it re-animates and re-announces) and restarts
98
+ * its timer. Omit for a generated id.
99
+ */
100
+ id?: string;
101
+ /** Body content — maps to the presentational `<Toast>`'s children. */
102
+ description?: React.ReactNode;
103
+ /**
104
+ * Auto-dismiss delay in ms. `null` persists until dismissed.
105
+ * Defaults to the provider's `duration` — unless the toast has `actions`,
106
+ * in which case it persists (the user needs time to act; WCAG 2.2.1).
107
+ */
108
+ duration?: number | null;
109
+ /** Playwright hook — lands on the toast root, per house testid policy. */
110
+ 'data-testid'?: string;
111
+ };
112
+ export type ToastProviderProps = {
113
+ children?: React.ReactNode;
114
+ /** Where the toast stack anchors. Default 'bottom-end'. */
115
+ placement?: ToastPlacement;
116
+ /** Default auto-dismiss delay in ms. Default 5000. */
117
+ duration?: number;
118
+ /**
119
+ * Accessible name for the toast region landmark. Default 'Notifications'.
120
+ * If a page hosts multiple providers (e.g. several independent
121
+ * `.tui-interface` widgets), give each a unique label — duplicate region
122
+ * landmark names are ambiguous for AT users.
123
+ */
124
+ regionLabel?: string;
125
+ /**
126
+ * Most toasts the stack shows at once — older ones are dismissed to make
127
+ * room. Default 5; pass Infinity to disable.
128
+ */
129
+ max?: number;
130
+ /** Optional portal target (mirrors Modal). Defaults to the portal root of
131
+ * the nearest `.tui-interface`. */
132
+ container?: Element | null;
133
+ };
134
+ export declare function ToastProvider({ children, placement, duration, regionLabel, max, container, }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,234 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import { cx } from '../../utils/cx.js';
5
+ import { isDev } from '../../utils/is-dev.js';
6
+ import { getPortalRootFor } from '../../utils/portal.js';
7
+ import { Notice } from '../Notice/index.js';
8
+ import { ToastContext } from './ToastContext.js';
9
+ const isBrowser = typeof document !== 'undefined';
10
+ // Safety net for the exit animation: `exit('fade')` resolves on
11
+ // `animationend`, which never fires if the region sits in a hidden/inert
12
+ // subtree (a Fields tab panel) or the stylesheet wasn't loaded. Without a
13
+ // fallback the toast record would accumulate in provider state forever.
14
+ // Comfortably above the 200ms --tui-motion-duration default.
15
+ const EXIT_FALLBACK_MS = 1000;
16
+ /**
17
+ * Presentational toast — an inline-layout Notice dressed for the toast stack
18
+ * (shadow, enter animation, icon | text | actions | × in one row).
19
+ *
20
+ * The toast root is also a nested `.tui-interface` with `data-theme="dark"`:
21
+ * a dark surface by default (following Tooltip's inverted treatment), done as
22
+ * a theme SCOPE rather than a token remap — the toast accepts arbitrary
23
+ * children, and everything inside (action Buttons, the dismiss IconButton,
24
+ * icons, consumer content) resolves dark tokens for free. Pass
25
+ * `data-theme="light"` (or "auto") through rest to opt out.
26
+ *
27
+ * The DOM carries both `tui-toast` and `tui-notice` classes, so Notice's
28
+ * component API tokens (`--tui-notice-bg`, `--tui-notice-padding`, …) can be
29
+ * re-pointed per toast context: `.tui-toast { --tui-notice-bg: …; }`.
30
+ */
31
+ export const Toast = forwardRef(function Toast({ theme = 'neutral', size = 'sm', icon, title, announce, dismissible = true, onDismiss, dismissLabel, actions, className, children, ...rest }, ref) {
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 })] }));
34
+ });
35
+ let toastCounter = 0;
36
+ export function ToastProvider({ children, placement = 'bottom-end', duration = 5000, regionLabel = 'Notifications', max = 5, container, }) {
37
+ const [toasts, setToasts] = useState([]);
38
+ const anchorRef = useRef(null);
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
+ const autoMountRef = useRef(null);
45
+ const warnedEmptyRef = useRef(false);
46
+ const warnedUndismissableRef = useRef(false);
47
+ const toast = useCallback((options = {}) => {
48
+ if (isDev() && !warnedEmptyRef.current && !options.title && !options.description) {
49
+ warnedEmptyRef.current = true;
50
+ console.warn('[TUI Toast] toast() called with neither `title` nor `description` — ' +
51
+ 'there is nothing to display or announce.');
52
+ }
53
+ if (isDev() &&
54
+ !warnedUndismissableRef.current &&
55
+ options.dismissible === false &&
56
+ (options.duration === null || (options.duration === undefined && options.actions))) {
57
+ warnedUndismissableRef.current = true;
58
+ console.warn('[TUI Toast] This toast is permanent: `dismissible: false` with no ' +
59
+ 'auto-dismiss (persistent duration). Make sure an action calls ' +
60
+ 'dismiss(id), or the toast can never be removed.');
61
+ }
62
+ const id = options.id ?? `tui-toast-${++toastCounter}`;
63
+ setEverShown(true);
64
+ setToasts((prev) => {
65
+ const existing = prev.find((t) => t.id === id);
66
+ const record = {
67
+ ...options,
68
+ id,
69
+ revision: (existing?.revision ?? 0) + 1,
70
+ dismissed: false,
71
+ };
72
+ const next = existing
73
+ ? prev.map((t) => (t.id === id ? record : t))
74
+ : [...prev, record];
75
+ // Over the cap: dismiss the oldest still-active toasts (animated,
76
+ // onDismiss fires) rather than dropping them cold.
77
+ const active = next.filter((t) => !t.dismissed);
78
+ if (active.length > max) {
79
+ const excess = new Set(active.slice(0, active.length - max).map((t) => t.id));
80
+ return next.map((t) => (excess.has(t.id) ? { ...t, dismissed: true } : t));
81
+ }
82
+ return next;
83
+ });
84
+ return id;
85
+ }, [max]);
86
+ const dismiss = useCallback((id) => {
87
+ setToasts((prev) => prev.map((t) => (t.id === id && !t.dismissed ? { ...t, dismissed: true } : t)));
88
+ }, []);
89
+ const dismissAll = useCallback(() => {
90
+ setToasts((prev) => prev.map((t) => (t.dismissed ? t : { ...t, dismissed: true })));
91
+ }, []);
92
+ // Revision-scoped: a stale removal (an exit that resolved after the same id
93
+ // was re-toasted) must not delete the replacement record.
94
+ const remove = useCallback((id, revision) => {
95
+ setToasts((prev) => prev.filter((t) => !(t.id === id && t.revision === revision)));
96
+ }, []);
97
+ const api = useMemo(() => ({ toast, dismiss, dismissAll }), [toast, dismiss, dismissAll]);
98
+ // Resolve the portal mount from the provider's own position in the tree
99
+ // (the anchor span), never from document.activeElement — see the Modal
100
+ // portal gotcha in CLAUDE.md.
101
+ useLayoutEffect(() => {
102
+ if (!isBrowser || !everShown)
103
+ return;
104
+ if (container) {
105
+ setMount((current) => (current === container ? current : container));
106
+ return;
107
+ }
108
+ if (autoMountRef.current?.isConnected) {
109
+ const auto = autoMountRef.current;
110
+ setMount((current) => (current === auto ? current : auto));
111
+ return;
112
+ }
113
+ const resolved = getPortalRootFor(anchorRef.current);
114
+ autoMountRef.current = resolved;
115
+ setMount(resolved);
116
+ }, [everShown, container]);
117
+ return (_jsxs(ToastContext.Provider, { value: api, children: [children, _jsx("span", { hidden: true, ref: anchorRef }), isBrowser && mount && everShown &&
118
+ createPortal(_jsx(ToastRegion, { placement: placement, label: regionLabel, toasts: toasts, defaultDuration: duration, onRemove: remove }), mount)] }));
119
+ }
120
+ function ToastRegion({ placement, label, toasts, defaultDuration, onRemove }) {
121
+ const regionRef = useRef(null);
122
+ const [hovered, setHovered] = useState(false);
123
+ const [focused, setFocused] = useState(false);
124
+ const [pressed, setPressed] = useState(false);
125
+ 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) => {
127
+ if (!event.currentTarget.contains(event.relatedTarget)) {
128
+ setFocused(false);
129
+ }
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}`))) }));
135
+ }
136
+ function ToastItem({ record, paused, defaultDuration, regionRef, onRemove }) {
137
+ const handleRef = useRef(null);
138
+ const firedRef = useRef(false);
139
+ const unmountedRef = useRef(false);
140
+ useEffect(() => {
141
+ return () => {
142
+ unmountedRef.current = true;
143
+ };
144
+ }, []);
145
+ // Single exit point: onDismiss fires once no matter which path removed the
146
+ // toast (timer, dismiss(), or the × button). If the removed toast held
147
+ // focus, hand it to the region — unmounting the focused element would
148
+ // silently drop focus to <body> (WCAG 2.4.3; same class of bug as the
149
+ // token-field chip-removal gotcha).
150
+ const finalize = useCallback(() => {
151
+ if (firedRef.current)
152
+ return;
153
+ firedRef.current = true;
154
+ const element = handleRef.current?.element;
155
+ const hadFocus = element ? element.contains(document.activeElement) : false;
156
+ record.onDismiss?.();
157
+ onRemove(record.id, record.revision);
158
+ if (hadFocus)
159
+ regionRef.current?.focus();
160
+ }, [record, onRemove, regionRef]);
161
+ // Programmatic removal (timer expiry, dismiss()): animate, then finalize.
162
+ // The × button path skips this — Notice runs its own fade before calling
163
+ // onDismiss, which lands on finalize directly.
164
+ //
165
+ // The race guards against an `animationend` that never comes (region in a
166
+ // hidden/inert subtree, stylesheet not loaded); the unmounted check drops
167
+ // a resolution that arrives after this instance was superseded by a
168
+ // re-toast of the same id — finalizing then would delete the replacement.
169
+ const dismissNow = useCallback(async () => {
170
+ if (firedRef.current)
171
+ return;
172
+ await Promise.race([
173
+ handleRef.current?.exit('fade'),
174
+ new Promise((resolve) => setTimeout(resolve, EXIT_FALLBACK_MS)),
175
+ ]);
176
+ if (unmountedRef.current)
177
+ return;
178
+ finalize();
179
+ }, [finalize]);
180
+ // `duration: null` persists; a toast with actions persists by default —
181
+ // the user needs time to act on it.
182
+ const effectiveDuration = record.duration !== undefined
183
+ ? record.duration
184
+ : record.actions
185
+ ? null
186
+ : defaultDuration;
187
+ useToastTimer(effectiveDuration, paused, dismissNow);
188
+ useEffect(() => {
189
+ if (record.dismissed)
190
+ void dismissNow();
191
+ }, [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 }));
193
+ }
194
+ /**
195
+ * Countdown that survives pauses: while `paused`, the remaining time is
196
+ * banked and the timeout cleared; on resume it restarts with what's left.
197
+ * A `duration` change resets the countdown in full. (A re-toast of the same
198
+ * id remounts the whole item via its key, so its countdown starts fresh.)
199
+ *
200
+ * Date.now() rather than performance.now() is deliberate: fake-timer suites
201
+ * mock Date but not performance, and the banked arithmetic must move with
202
+ * the mocked clock.
203
+ */
204
+ function useToastTimer(duration, paused, onExpire) {
205
+ const remainingRef = useRef(null);
206
+ const startedAtRef = useRef(0);
207
+ const onExpireRef = useRef(onExpire);
208
+ useEffect(() => {
209
+ onExpireRef.current = onExpire;
210
+ });
211
+ // Reset the bank when the duration changes. Declared before the countdown
212
+ // effect so it runs first in the same commit.
213
+ useEffect(() => {
214
+ remainingRef.current =
215
+ typeof duration === 'number' && Number.isFinite(duration) && duration > 0
216
+ ? duration
217
+ : null;
218
+ }, [duration]);
219
+ useEffect(() => {
220
+ if (paused || remainingRef.current == null)
221
+ return;
222
+ startedAtRef.current = Date.now();
223
+ const timer = setTimeout(() => {
224
+ remainingRef.current = null;
225
+ onExpireRef.current();
226
+ }, remainingRef.current);
227
+ return () => {
228
+ clearTimeout(timer);
229
+ if (remainingRef.current != null) {
230
+ remainingRef.current = Math.max(0, remainingRef.current - (Date.now() - startedAtRef.current));
231
+ }
232
+ };
233
+ }, [paused, duration]);
234
+ }
@@ -0,0 +1,11 @@
1
+ import type { ToastOptions } from './Toast';
2
+ export type ToastContextValue = {
3
+ /** Show a toast. Returns its id. */
4
+ toast: (options?: ToastOptions) => string;
5
+ /** Dismiss one toast by id (plays its exit animation). */
6
+ dismiss: (id: string) => void;
7
+ /** Dismiss all toasts. */
8
+ dismissAll: () => void;
9
+ };
10
+ export declare const ToastContext: import("react").Context<ToastContextValue | null>;
11
+ export declare function useToast(): ToastContextValue;
@@ -0,0 +1,9 @@
1
+ import { createContext, useContext } from 'react';
2
+ export const ToastContext = createContext(null);
3
+ export function useToast() {
4
+ const context = useContext(ToastContext);
5
+ if (!context) {
6
+ throw new Error('[TUI Toast] useToast must be used within a <ToastProvider>.');
7
+ }
8
+ return context;
9
+ }
@@ -0,0 +1,4 @@
1
+ export { Toast, ToastProvider } from './Toast';
2
+ export { useToast } from './ToastContext';
3
+ export type { ToastProps, ToastHandle, ToastTheme, ToastAnnounce, ToastPlacement, ToastOptions, ToastProviderProps, } from './Toast';
4
+ export type { ToastContextValue } from './ToastContext';
@@ -0,0 +1,2 @@
1
+ export { Toast, ToastProvider } from './Toast.js';
2
+ export { useToast } from './ToastContext.js';
@@ -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';
@@ -43,9 +43,10 @@ export { Switch } from './Switch';
43
43
  export { Tabs } from './Tabs';
44
44
  export { Textarea } from './Textarea';
45
45
  export { TextInput } from './TextInput';
46
+ export { Toast, ToastProvider, useToast } from './Toast';
46
47
  export { Toolbar } from './Toolbar';
47
48
  export { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from './Tooltip';
48
- export type { AccordionProps, AccordionSingleProps, AccordionMultipleProps, AccordionItemProps, AccordionTriggerProps, AccordionPanelProps, } from './Accordion';
49
+ export type { AccordionProps, AccordionSingleProps, AccordionMultipleProps, AccordionItemProps, AccordionTriggerProps, AccordionPanelProps, AccordionVariant, AccordionItemState, } from './Accordion';
49
50
  export type { AvatarProps, AvatarGroupProps, AvatarSize, AvatarShape, IndicatorPosition, } from './Avatar';
50
51
  export type { ButtonProps } from './Button';
51
52
  export type { CardRootProps, CardVariant, CardMode, CardMediaProps } from './Card';
@@ -65,7 +66,7 @@ export type { MultiSelectProps, MultiSelectTriggerProps, MultiSelectContentProps
65
66
  export type { SelectProps, SelectTriggerProps, SelectContentProps, SelectOptionProps, SelectGroupProps, SelectLabelProps, } from './Select';
66
67
  export type { IconProps } from './Icon';
67
68
  export type { IconButtonProps } from './IconButton';
68
- export type { ModalProps } from './Modal';
69
+ export type { ModalProps, ModalRole, ModalFootProps, ModalFootJustify } from './Modal';
69
70
  export type { MoveHandleLabels, MoveHandleMode, MoveHandleProps, MoveHandleSize } from './MoveHandle';
70
71
  export type { NoticeProps } from './Notice';
71
72
  export type { OverlapStackProps, OverlapStackOverflowProps } from './OverlapStack';
@@ -86,6 +87,7 @@ export type { SearchSelectProps, SearchSelectTriggerProps, SearchSelectContentPr
86
87
  export type { SwitchProps } from './Switch';
87
88
  export type { TextareaProps, TextareaResize } from './Textarea';
88
89
  export type { TextInputProps, TextInputType } from './TextInput';
90
+ export type { ToastProps, ToastHandle, ToastTheme, ToastAnnounce, ToastPlacement, ToastOptions, ToastContextValue, ToastProviderProps, } from './Toast';
89
91
  export type { ToolbarProps, ToolbarGroupProps, ToolbarItemProps, ToolbarOrientation } from './Toolbar';
90
92
  export type { TooltipProps, TooltipProviderProps, TooltipTriggerProps, TooltipContentProps } from './Tooltip';
91
93
  export { GENERATIVE_COLORS, stringToGenerativeColor } from '../utils/generative';
@@ -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';
@@ -41,6 +41,7 @@ export { Switch } from './Switch/index.js';
41
41
  export { Tabs } from './Tabs/index.js';
42
42
  export { Textarea } from './Textarea/index.js';
43
43
  export { TextInput } from './TextInput/index.js';
44
+ export { Toast, ToastProvider, useToast } from './Toast/index.js';
44
45
  export { Toolbar } from './Toolbar/index.js';
45
46
  export { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from './Tooltip/index.js';
46
47
  // Generative colors (The Jellybean Bag) — deterministic identity colors
package/figma-tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.18",
2
+ "version": "0.2.20",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangible/ui",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "description": "Tangible Design System",
5
5
  "type": "module",
6
6
  "main": "./components/index.js",
@@ -218,6 +218,10 @@
218
218
  "import": "./components/Textarea/index.js",
219
219
  "types": "./components/Textarea/index.d.ts"
220
220
  },
221
+ "./components/Toast": {
222
+ "import": "./components/Toast/index.js",
223
+ "types": "./components/Toast/index.d.ts"
224
+ },
221
225
  "./components/Toolbar": {
222
226
  "import": "./components/Toolbar/index.js",
223
227
  "types": "./components/Toolbar/index.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
@@ -351,11 +351,25 @@ Four things change versus a picker's default trigger, all deliberate:
351
351
 
352
352
  Your child's `onClick` still runs; call `preventDefault()` in it to suppress the toggle.
353
353
 
354
+ **`Accordion.Trigger asChild` is the one that paints.** By default it stamps `tui-accordion__trigger`
355
+ on your element — the full-width row look (flex, `width: 100%`, padding, hover background, inset
356
+ focus ring), which is what a custom header row wants. If your child is already a styled control (an
357
+ `IconButton` chevron in a repeater row), pass `unstyled` so it keeps its own sizing and focus ring;
358
+ `data-tui-accordion-trigger` and `data-state` still land, so you can style off the behaviour without
359
+ the paint. A native `<button>` child activates on Enter/Space through the browser, once — TUI does not
360
+ synthesise a second toggle. For a second control that toggles the same item (an Edit/Close link),
361
+ `useAccordionItem()` returns `{ isOpen, panelId, toggle, … }` for its own `aria-expanded`/
362
+ `aria-controls`. Controlled single-mode accordions take `value={null}` for "nothing open" —
363
+ `undefined` would flip them uncontrolled.
364
+
354
365
  ## Component names, and what isn't there
355
366
 
356
367
  43 components. If you are hunting for a name: **Alert → `Notice`**, **Menu → `Dropdown`**,
357
368
  **Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode),
358
- **Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`.
369
+ **Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`,
370
+ **ConfirmDialog / AlertDialog → `Modal role="alertdialog"`** (needs both `aria-labelledby` and
371
+ `aria-describedby`; the backdrop stops dismissing by default, Escape still cancels; put the actions in
372
+ `Modal.Foot`, which is already an end-aligned flex row — `justify="between"` separates a destructive one).
359
373
  No Toast/Snackbar, no Breadcrumb, no Skeleton, and no *standalone* time picker — but
360
374
  `DatePicker` / `DateRangePicker` take `withTime` for an hour/minute field (12- or 24-hour via
361
375
  `hour12`) plus a display-only `zoneLabel`; the value is a plain `Date` with wall-clock semantics,