@tangible/ui 0.2.38 → 0.2.40

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 (73) hide show
  1. package/README.md +2 -2
  2. package/components/Avatar/Avatar.js +20 -5
  3. package/components/Avatar/types.d.ts +15 -0
  4. package/components/Button/Button.js +10 -3
  5. package/components/Button/types.d.ts +31 -3
  6. package/components/Button/types.js +2 -0
  7. package/components/ColorPicker/ColorField.d.ts +1 -1
  8. package/components/ColorPicker/ColorField.js +9 -1
  9. package/components/DatePicker/DateRangePicker.d.ts +1 -0
  10. package/components/DatePicker/DateRangePicker.js +24 -6
  11. package/components/DatePicker/PickerTrigger.js +1 -1
  12. package/components/DatePicker/types.d.ts +20 -3
  13. package/components/DatePicker/types.js +1 -0
  14. package/components/IconButton/IconButtonCore.js +13 -5
  15. package/components/IconButton/index.d.ts +2 -1
  16. package/components/IconButton/index.js +1 -0
  17. package/components/IconButton/types.d.ts +37 -2
  18. package/components/IconButton/types.js +4 -1
  19. package/components/MultiSelect/MultiSelect.js +9 -3
  20. package/components/NavMenu/NavMenu.js +37 -3
  21. package/components/Notice/Notice.d.ts +13 -0
  22. package/components/Notice/Notice.js +10 -2
  23. package/components/Progress/Progress.js +73 -2
  24. package/components/Progress/index.d.ts +2 -1
  25. package/components/Progress/index.js +1 -0
  26. package/components/Progress/types.d.ts +130 -2
  27. package/components/Progress/types.js +3 -1
  28. package/components/Select/Select.js +2 -1
  29. package/components/Tooltip/Tooltip.js +23 -0
  30. package/components/index.d.ts +28 -26
  31. package/components/index.js +10 -10
  32. package/figma-tokens.json +1 -1
  33. package/icons/icons.svg +15 -5
  34. package/icons/lms/index.d.ts +7 -4
  35. package/icons/lms/index.js +9 -44
  36. package/icons/lms.svg +4 -4
  37. package/icons/manifest.json +96 -12
  38. package/icons/registry.d.ts +20 -0
  39. package/icons/registry.js +11 -0
  40. package/icons/searchsync/index.d.ts +21 -0
  41. package/icons/searchsync/index.js +82 -0
  42. package/icons/searchsync.svg +9 -0
  43. package/icons/sprite-registry.js +10 -0
  44. package/icons/sprite-version.js +1 -1
  45. package/icons/sprite.d.ts +1 -1
  46. package/icons/sprite.js +2 -1
  47. package/icons/sprite.php +3 -2
  48. package/icons/system/index.d.ts +6 -0
  49. package/icons/system/index.js +33 -0
  50. package/icons/system.svg +3 -0
  51. package/package.json +1 -1
  52. package/skills/building-with-tui/SKILL.md +81 -30
  53. package/styles/all.css +1 -1
  54. package/styles/all.expanded.css +221 -64
  55. package/styles/all.expanded.unlayered.css +221 -64
  56. package/styles/all.unlayered.css +1 -1
  57. package/styles/app.css +2 -0
  58. package/styles/components/button.scss +18 -0
  59. package/styles/components/checkbox.scss +21 -13
  60. package/styles/components/icon-button.scss +44 -25
  61. package/styles/components/nav-menu.scss +3 -0
  62. package/styles/components/notice.scss +38 -0
  63. package/styles/components/progress.scss +96 -0
  64. package/styles/components/radio.scss +35 -7
  65. package/styles/components/segmented-control.scss +98 -18
  66. package/styles/components/table.scss +39 -24
  67. package/tui-manifest.json +151 -39
  68. package/utils/portal.d.ts +4 -3
  69. package/utils/portal.js +16 -2
  70. package/utils/use-loading-announcer.d.ts +2 -0
  71. package/utils/use-loading-announcer.js +101 -0
  72. package/vanilla/styles.css +1 -1
  73. package/vanilla/styles.unlayered.css +1 -1
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isDev } from '../../utils/is-dev.js';
2
3
  import React, { forwardRef, useId, useMemo, useState, useRef, useImperativeHandle, useCallback, useEffect, useLayoutEffect, useContext, createContext } from 'react';
3
4
  import { cx } from '../../utils/cx.js';
4
5
  import { IconButtonCore } from '../IconButton/IconButtonCore.js';
@@ -10,9 +11,16 @@ function prefersReducedMotion() {
10
11
  return false;
11
12
  return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
12
13
  }
13
- export const Notice = forwardRef(function Notice({ as = 'section', inline, elevated, interactive, disabled, stripe, size, className, style, onClick, theme = 'info', announce = 'off', 'aria-label': ariaLabel, dismissible, onDismiss, dismissLabel = 'Dismiss', dismissedMessage = 'Notification dismissed', exitAnimation = 'none', focusable, children, ...rest }, ref) {
14
+ export const Notice = forwardRef(function Notice({ as = 'section', inline, align = 'center', elevated, interactive, disabled, stripe, size, className, style, onClick, theme = 'info', announce = 'off', 'aria-label': ariaLabel, dismissible, onDismiss, dismissLabel = 'Dismiss', dismissedMessage = 'Notification dismissed', exitAnimation = 'none', focusable, children, ...rest }, ref) {
14
15
  const Tag = as;
15
16
  const innerRef = useRef(null);
17
+ const warnedAlign = useRef(false);
18
+ useEffect(() => {
19
+ if (isDev() && align !== 'center' && !inline && !warnedAlign.current) {
20
+ warnedAlign.current = true;
21
+ console.warn('[Notice] `align` only applies to an inline Notice; add `inline` or drop `align`.');
22
+ }
23
+ }, [align, inline]);
16
24
  const [isExiting, setIsExiting] = useState(false);
17
25
  const [exitType, setExitType] = useState(null);
18
26
  const exitResolveRef = useRef(null);
@@ -135,7 +143,7 @@ export const Notice = forwardRef(function Notice({ as = 'section', inline, eleva
135
143
  }, disabled: disabled || isExiting }));
136
144
  // Determine tabIndex: clickable gets 0, focusable gets -1, otherwise none
137
145
  const computedTabIndex = isClickable ? 0 : (focusable ? -1 : undefined);
138
- return (_jsx(NoticeContext.Provider, { value: contextValue, children: _jsxs(Tag, { ref: innerRef, className: classes, style: style, "aria-disabled": disabled || undefined, role: computedRole, "aria-labelledby": computedLabelledBy, "aria-label": computedAriaLabel, "aria-atomic": liveRole ? true : undefined, tabIndex: computedTabIndex, onClick: disabled ? undefined : onClick, onKeyDown: isClickable ? handleKeyDown : undefined, ...rest, children: [_jsx("div", { className: "tui-notice__inner", children: children }), dismissButton] }) }));
146
+ return (_jsx(NoticeContext.Provider, { value: contextValue, children: _jsxs(Tag, { ref: innerRef, className: classes, style: style, "aria-disabled": disabled || undefined, "data-align": inline && align === 'start' ? 'start' : undefined, role: computedRole, "aria-labelledby": computedLabelledBy, "aria-label": computedAriaLabel, "aria-atomic": liveRole ? true : undefined, tabIndex: computedTabIndex, onClick: disabled ? undefined : onClick, onKeyDown: isClickable ? handleKeyDown : undefined, ...rest, children: [_jsx("div", { className: "tui-notice__inner", children: children }), dismissButton] }) }));
139
147
  });
140
148
  // Notice.Head renders icon and title (consumers can add custom actions via children)
141
149
  function NoticeHead({ className, icon, title, titleAs = 'h3', children, ...rest }) {
@@ -1,15 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { memo } from 'react';
2
+ import React, { memo, useEffect, useRef } from 'react';
3
+ import { defaultProgressLabels } from './types.js';
3
4
  import { useProgressSegments } from './useProgressSegments.js';
4
5
  import { cx } from '../../utils/cx.js';
5
6
  import { isDev } from '../../utils/is-dev.js';
6
7
  // =============================================================================
7
8
  // COMPONENT
8
9
  // =============================================================================
10
+ // Stable empty input, so a breakdown skips the cumulative segment work
11
+ // without changing hook order.
12
+ const NO_SEGMENTS = [];
9
13
  export const Progress = memo(function Progress(props) {
10
14
  const { children, mode = 'line', size = 'md', max = 100, showLabels = true, 'aria-labelledby': labelledBy, 'aria-label': ariaLabel, defaultLabel, className, } = props;
11
15
  // Determine mode
12
16
  const isSegmented = 'segments' in props && Array.isArray(props.segments);
17
+ const isBreakdown = isSegmented && 'breakdown' in props && props.breakdown === true;
13
18
  // Standard mode props
14
19
  const value = !isSegmented ? (props.value ?? 0) : 0;
15
20
  const indeterminate = !isSegmented ? (props.indeterminate ?? false) : false;
@@ -20,7 +25,11 @@ export const Progress = memo(function Progress(props) {
20
25
  // Segments (for segmented mode) — fallback ensures type safety
21
26
  const segments = ('segments' in props && props.segments) || [];
22
27
  // Process segments via hook
23
- const { processedSegments, ariaValueText, primaryValue, primaryPct, } = useProgressSegments({ segments, max });
28
+ const { processedSegments, ariaValueText, primaryValue, primaryPct, } = useProgressSegments({ segments: isBreakdown ? NO_SEGMENTS : segments, max });
29
+ // Breakdown: a by-status composition, not a progressbar (#111).
30
+ if (isBreakdown) {
31
+ return _jsx(ProgressBreakdown, { ...props, size: size });
32
+ }
24
33
  // Calculate percentages for standard mode
25
34
  const pct = Math.max(0, Math.min(100, (value / max) * 100));
26
35
  // Dev warning: inside position only supports labelStart (or children)
@@ -99,3 +108,65 @@ export const Progress = memo(function Progress(props) {
99
108
  const labelRow = (_jsxs("div", { className: "tui-progress__labels", children: [labelStart && _jsx("span", { className: "tui-progress__label is-start", children: labelStart }), labelEnd && _jsx("span", { className: "tui-progress__label is-end", children: labelEnd })] }));
100
109
  return (_jsxs("div", { ...rootProps, children: [labelPosition === 'above' && labelRow, labelPosition === 'inline' ? (_jsxs("div", { className: "tui-progress__inline", children: [labelStart && _jsx("span", { className: "tui-progress__label is-start", children: labelStart }), trackContent, labelEnd && _jsx("span", { className: "tui-progress__label is-end", children: labelEnd })] })) : (trackContent), labelPosition === 'below' && labelRow, !labelledBy && !ariaLabel && defaultLabel && (_jsx("span", { className: "tui-visually-hidden", children: defaultLabel }))] }));
101
110
  });
111
+ // =============================================================================
112
+ // BREAKDOWN (#111)
113
+ // =============================================================================
114
+ //
115
+ // Each segment is its own count with a semantic theme, so there is no single
116
+ // value to report: a progressbar's aria-valuenow would be a lie. The
117
+ // accessible representation is the legend itself, a list named by the
118
+ // component's accessible name, one item per segment ("Done 12"). The bar is
119
+ // aria-hidden: it repeats the list as a picture. With `max` above the sum, a
120
+ // trailing "Remaining" item carries the empty track. With showLabels={false} the
121
+ // list stays, visually hidden, so AT still gets the numbers.
122
+ //
123
+ // Fills use each theme's -strong step: base measured 2.23:1 against the dark
124
+ // track for primary/info (SC 1.4.11 wants 3:1); strong clears 3:1 against the
125
+ // track, bg and surface for every theme in both modes. Segments are separated
126
+ // by a gap showing the track, so adjacent fills never depend on their
127
+ // contrast with each other.
128
+ function ProgressBreakdown({ segments, max: maxProp, size = 'md', showLabels = true, showPercent = false, 'aria-labelledby': labelledBy, 'aria-label': ariaLabel, defaultLabel, labels: labelsProp, className, }) {
129
+ const labels = { ...defaultProgressLabels, ...labelsProp };
130
+ const counts = segments.map((seg) => (Number.isFinite(seg.value) ? Math.max(0, seg.value) : 0));
131
+ const sum = counts.reduce((a, b) => a + b, 0);
132
+ // `max` given: widths are shares of it and the rest is empty track.
133
+ // Otherwise the parts fill the bar.
134
+ const total = maxProp !== undefined && maxProp > 0 ? Math.max(maxProp, sum) : sum;
135
+ const remainder = total - sum;
136
+ const overMax = maxProp !== undefined && sum > maxProp;
137
+ const unnamed = !labelledBy && !ariaLabel && !defaultLabel;
138
+ const warnedOverRef = useRef(false);
139
+ const warnedNameRef = useRef(false);
140
+ useEffect(() => {
141
+ if (!isDev())
142
+ return;
143
+ if (overMax && !warnedOverRef.current) {
144
+ warnedOverRef.current = true;
145
+ console.warn(`Progress: breakdown values sum to ${sum}, more than max (${maxProp}). ` +
146
+ 'Widths are taken over the sum instead.');
147
+ }
148
+ if (unnamed && !warnedNameRef.current) {
149
+ warnedNameRef.current = true;
150
+ console.warn('Progress: a breakdown renders a list that needs a name. Pass `aria-label`, ' +
151
+ '`aria-labelledby` or `defaultLabel` (e.g. "Tasks by status").');
152
+ }
153
+ }, [overMax, unnamed, sum, maxProp]);
154
+ const items = segments.map((seg, i) => ({
155
+ ...seg,
156
+ count: counts[i],
157
+ share: total > 0 ? (counts[i] / total) * 100 : 0,
158
+ }));
159
+ const nameProps = labelledBy
160
+ ? { 'aria-labelledby': labelledBy }
161
+ : ariaLabel
162
+ ? { 'aria-label': ariaLabel }
163
+ : defaultLabel
164
+ ? { 'aria-label': defaultLabel }
165
+ : {};
166
+ return (_jsxs("div", { className: cx('tui-progress', 'is-mode-line', `is-size-${size}`, 'is-segmented', 'is-breakdown', className), children: [_jsx("div", { className: "tui-progress__track", "aria-hidden": "true", children: items.map((item, i) => item.count > 0 ? (_jsx("div", { className: cx('tui-progress__bar', `is-theme-${item.theme}`), style: { '--tui-segment-width': `${item.share}%` } }, i)) : null) }), _jsxs("ul", {
167
+ // Explicit role: WebKit drops list semantics from a list-style: none list.
168
+ role: "list", className: cx('tui-progress__segment-labels', !showLabels && 'tui-visually-hidden'), ...nameProps, children: [items.map((item, i) => (_jsxs("li", { className: cx('tui-progress__segment-label', `is-theme-${item.theme}`), children: [_jsx("span", { className: "tui-progress__segment-swatch", "aria-hidden": "true" }), _jsx("span", { className: "tui-progress__segment-label-text", children: item.label }), ' ', _jsx("span", { className: "tui-progress__segment-label-value", children: showPercent ? `${Math.round(item.share)}%` : item.count })] }, i))), remainder > 0 && (
169
+ // The empty track of `max`: without it AT never hears the total,
170
+ // and showPercent shares would sum under 100% unexplained.
171
+ _jsxs("li", { className: "tui-progress__segment-label is-remainder", children: [_jsx("span", { className: "tui-progress__segment-swatch is-remainder", "aria-hidden": "true" }), _jsx("span", { className: "tui-progress__segment-label-text", children: labels.remaining }), ' ', _jsx("span", { className: "tui-progress__segment-label-value", children: showPercent ? `${Math.round((remainder / total) * 100)}%` : remainder })] }))] })] }));
172
+ }
@@ -1,4 +1,5 @@
1
1
  export { Progress } from './Progress';
2
2
  export { useProgressSegments } from './useProgressSegments';
3
- export type { ProgressProps, ProgressSegment, SegmentedProgressProps, StandardProgressProps, Mode, Size, LabelPos, } from './types';
3
+ export { defaultProgressLabels } from './types';
4
+ export type { ProgressProps, ProgressSegment, SegmentedProgressProps, BreakdownProgressProps, ProgressBreakdownSegment, ProgressBreakdownTheme, ProgressLabels, StandardProgressProps, Mode, Size, LabelPos, } from './types';
4
5
  export type { ProcessedSegment } from './useProgressSegments';
@@ -1,2 +1,3 @@
1
1
  export { Progress } from './Progress.js';
2
2
  export { useProgressSegments } from './useProgressSegments.js';
3
+ export { defaultProgressLabels } from './types.js';
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { Size } from '../../types';
2
+ import type { Size, ThemeIntent, ThemeStatus } from '../../types';
3
3
  export type { Size };
4
4
  export type Mode = 'line' | 'circle';
5
5
  export type LabelPos = 'above' | 'inline' | 'below' | 'inside';
@@ -26,6 +26,38 @@ export type ProgressSegment = {
26
26
  */
27
27
  label?: string;
28
28
  };
29
+ /**
30
+ * Overridable strings for Progress i18n (breakdown only today).
31
+ */
32
+ export type ProgressLabels = {
33
+ /** Legend item for the empty track when `max` exceeds the sum. @default 'Remaining' */
34
+ remaining?: string;
35
+ };
36
+ export declare const defaultProgressLabels: Required<ProgressLabels>;
37
+ /**
38
+ * Semantic color for a breakdown segment. Don't use `primary` and `info` in
39
+ * the same breakdown: they resolve to the same blue, so only the legend text
40
+ * tells them apart.
41
+ */
42
+ export type ProgressBreakdownTheme = ThemeIntent | ThemeStatus;
43
+ /**
44
+ * One part of a breakdown (by-status composition), e.g. 3 tasks "Failed".
45
+ *
46
+ * Unlike {@link ProgressSegment}, the value is this part's own count, not a
47
+ * cumulative position, and the color comes from `theme`, not from the
48
+ * segment's position.
49
+ *
50
+ * @example
51
+ * { label: 'Done', value: 12, theme: 'success' }
52
+ */
53
+ export type ProgressBreakdownSegment = {
54
+ /** This part's own count (not cumulative). Negative values count as 0. */
55
+ value: number;
56
+ /** Visible legend text, and the list item's name for assistive tech. */
57
+ label: string;
58
+ /** Semantic color of this part's fill and legend swatch. */
59
+ theme: ProgressBreakdownTheme;
60
+ };
29
61
  /**
30
62
  * Base props shared by all Progress variants.
31
63
  */
@@ -107,6 +139,10 @@ export type SegmentedProgressProps = BaseProgressProps & {
107
139
  * @default 'line'
108
140
  */
109
141
  mode?: 'line';
142
+ /** Cumulative segments. Set `breakdown` for a by-status composition. */
143
+ breakdown?: false;
144
+ /** Breakdown only. */
145
+ showPercent?: never;
110
146
  /**
111
147
  * Segments to display, ordered front-to-back (z1, z2, z3...).
112
148
  * Maximum 5 segments have default colors; beyond that, override via CSS.
@@ -199,6 +235,78 @@ export type StandardProgressProps = BaseProgressProps & {
199
235
  labelEnd?: React.ReactNode;
200
236
  /** Not available in standard mode. Use segmented mode instead. */
201
237
  segments?: never;
238
+ /** Not available in standard mode. */
239
+ breakdown?: never;
240
+ /** Not available in standard mode. */
241
+ showPercent?: never;
242
+ };
243
+ /**
244
+ * Props for a breakdown: a by-status composition such as "12 done, 3 failed,
245
+ * 1 pending", where each segment is its own count with its own semantic
246
+ * color. Not a progressbar: there is no single value, so it renders as a
247
+ * named list of label + value items, and the bar is decorative.
248
+ *
249
+ * - Widths are each value over the total: the sum of values, or `max` when
250
+ * given. The remainder shows as empty track and as a trailing
251
+ * "Remaining" legend item (`labels.remaining`).
252
+ * - Don't combine `primary` and `info`: they're the same blue.
253
+ * - Labels show each segment's own count, or its share with `showPercent`.
254
+ * Zero-count segments keep their legend item ("Failed 0").
255
+ * - The accessible name (`aria-label`, `aria-labelledby` or `defaultLabel`)
256
+ * names the list.
257
+ *
258
+ * @example
259
+ * ```tsx
260
+ * <Progress
261
+ * breakdown
262
+ * aria-label="Tasks by status"
263
+ * segments={[
264
+ * { label: 'Done', value: 12, theme: 'success' },
265
+ * { label: 'Failed', value: 3, theme: 'danger' },
266
+ * { label: 'Pending', value: 1, theme: 'warning' },
267
+ * ]}
268
+ * />
269
+ * ```
270
+ */
271
+ export type BreakdownProgressProps = Omit<BaseProgressProps, 'children'> & {
272
+ /**
273
+ * Display mode. A breakdown is a line.
274
+ * @default 'line'
275
+ */
276
+ mode?: 'line';
277
+ /** Each segment is its own count, colored by its `theme`. */
278
+ breakdown: true;
279
+ /** The parts, in display order (start to end). */
280
+ segments: ProgressBreakdownSegment[];
281
+ /**
282
+ * Show each segment's share of the total ("25%") instead of its count.
283
+ * This replaces the count in the accessible output too: the list items
284
+ * read "Done 75%", so put counts in visible text nearby if they matter.
285
+ * @default false
286
+ */
287
+ showPercent?: boolean;
288
+ /**
289
+ * Whether to show the legend. When false the list stays in the
290
+ * accessibility tree (visually hidden), but sighted users are left with
291
+ * color alone (SC 1.4.1): you must show the labels and values in visible
292
+ * text elsewhere.
293
+ * @default true
294
+ */
295
+ showLabels?: boolean;
296
+ /** Overridable strings for i18n (`remaining`). */
297
+ labels?: ProgressLabels;
298
+ /** Not available in breakdown mode: the legend list is the accessible representation. */
299
+ children?: never;
300
+ /** Not available in breakdown mode. */
301
+ value?: never;
302
+ /** Not supported in breakdown mode. */
303
+ indeterminate?: never;
304
+ /** Not available in breakdown mode. */
305
+ labelPosition?: never;
306
+ /** Not available in breakdown mode. */
307
+ labelStart?: never;
308
+ /** Not available in breakdown mode. */
309
+ labelEnd?: never;
202
310
  };
203
311
  /**
204
312
  * Progress bar component with support for single-value and segmented modes.
@@ -225,6 +333,20 @@ export type StandardProgressProps = BaseProgressProps & {
225
333
  * />
226
334
  * ```
227
335
  *
336
+ * **Breakdown** (`breakdown` + `segments`) — a by-status composition: each
337
+ * segment is its own count with a semantic `theme`, labelled by its count
338
+ * or share. Rendered as a named list, not a progressbar:
339
+ * ```tsx
340
+ * <Progress
341
+ * breakdown
342
+ * aria-label="Tasks by status"
343
+ * segments={[
344
+ * { label: 'Done', value: 12, theme: 'success' },
345
+ * { label: 'Pending', value: 1, theme: 'warning' },
346
+ * ]}
347
+ * />
348
+ * ```
349
+ *
228
350
  * ## Styling
229
351
  *
230
352
  * Customise via CSS custom properties on the component or a parent:
@@ -239,13 +361,19 @@ export type StandardProgressProps = BaseProgressProps & {
239
361
  * | `--tui-progress-z3-fill` | Segment 3 color | Success (green) |
240
362
  * | `--tui-progress-z4-fill` | Segment 4 color | Danger (red) |
241
363
  * | `--tui-progress-z5-fill` | Segment 5 color | Info (blue) |
364
+ * | `--tui-progress-segment-gap` | Gap between breakdown segments | 2px |
365
+ *
366
+ * Breakdown fills use each segment theme's `-strong` step, which clears 3:1
367
+ * against the track in light and dark; re-theme them through the theme tokens.
242
368
  *
243
369
  * ## Accessibility
244
370
  *
371
+ * - Breakdown: a list named by the accessible name, one item per segment
372
+ * ("Done 12"); the bar is `aria-hidden`
245
373
  * - Uses `role="progressbar"` with proper ARIA attributes
246
374
  * - `aria-valuenow`, `aria-valuemin`, `aria-valuemax` for screen readers
247
375
  * - `aria-valuetext` in segmented mode announces all segment values
248
376
  * - `aria-busy` set during indeterminate state
249
377
  * - Respects `prefers-reduced-motion` for animations
250
378
  */
251
- export type ProgressProps = SegmentedProgressProps | StandardProgressProps;
379
+ export type ProgressProps = SegmentedProgressProps | BreakdownProgressProps | StandardProgressProps;
@@ -1 +1,3 @@
1
- export {};
1
+ export const defaultProgressLabels = {
2
+ remaining: 'Remaining',
3
+ };
@@ -283,6 +283,7 @@ function SelectTriggerComponent({ asChild = false, className, children, }) {
283
283
  // real regression for a popup that re-renders per keystroke.
284
284
  const childRef = asChild && isValidElement(children) ? getElementRef(children) : undefined;
285
285
  const composedReferenceRef = React.useMemo(() => composeRefs(refs.setReference, childRef), [refs.setReference, childRef]);
286
+ const valueId = `${triggerId}-value`;
286
287
  const triggerProps = {
287
288
  id: triggerId,
288
289
  'aria-label': ariaLabel,
@@ -349,7 +350,7 @@ function SelectTriggerComponent({ asChild = false, className, children, }) {
349
350
  // Wrap in a relative container so the clear button can be a sibling of the
350
351
  // trigger <button> — nesting <button> inside <button> is invalid HTML and
351
352
  // causes browsers to eject the inner button via the adoption agency algorithm.
352
- return (_jsxs("div", { className: cx('tui-select__trigger-wrap', showClear && 'has-clear'), children: [_jsxs("button", { ref: refs.setReference, type: "button", className: cx('tui-input-group', 'tui-select__trigger', sizeClass, className), disabled: disabled, ...triggerProps, children: [_jsx("span", { className: "tui-select__value", children: displayText ?? _jsx("span", { className: "tui-select__placeholder", children: placeholder }) }), _jsx(Icon, { name: ChevronDownIcon, className: "tui-select__icon", "aria-hidden": "true" })] }), showClear && (_jsx("button", { type: "button", className: "tui-select__clear", onClick: handleClear, "aria-label": clearLabel, tabIndex: -1, children: _jsx(Icon, { name: CloseIcon }) }))] }));
353
+ return (_jsxs("div", { className: cx('tui-select__trigger-wrap', showClear && 'has-clear'), children: [_jsxs("button", { ref: refs.setReference, type: "button", className: cx('tui-input-group', 'tui-select__trigger', sizeClass, className), disabled: disabled, ...triggerProps, "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${valueId}` : undefined, children: [_jsx("span", { id: valueId, className: "tui-select__value", children: displayText ?? _jsx("span", { className: "tui-select__placeholder", children: placeholder }) }), _jsx(Icon, { name: ChevronDownIcon, className: "tui-select__icon", "aria-hidden": "true" })] }), showClear && (_jsx("button", { type: "button", className: "tui-select__clear", onClick: handleClear, "aria-label": clearLabel, tabIndex: -1, children: _jsx(Icon, { name: CloseIcon }) }))] }));
353
354
  }
354
355
  SelectTriggerComponent.displayName = 'Select.Trigger';
355
356
  // =============================================================================
@@ -178,8 +178,31 @@ function TooltipTriggerComponent({ asChild = false, 'aria-label': ariaLabel, chi
178
178
  'data-tooltip-open': open || undefined,
179
179
  };
180
180
  if (asChild && isValidElement(children)) {
181
+ // Compose, don't clobber (#129) — the Popover.Trigger contract. The child's
182
+ // own handler runs first, and opts out of the tooltip's by calling
183
+ // preventDefault. Its own aria-describedby is kept, with the content id
184
+ // appended while a description tooltip is open; never an empty string.
185
+ const childProps = children.props;
186
+ const compose = (theirs, ours) => {
187
+ if (typeof theirs !== 'function')
188
+ return ours;
189
+ return (e) => {
190
+ theirs(e);
191
+ if (!e.defaultPrevented)
192
+ ours(e);
193
+ };
194
+ };
195
+ const describedBy = Array.from(new Set([childProps['aria-describedby'], triggerProps['aria-describedby']]
196
+ .filter((v) => typeof v === 'string')
197
+ .flatMap((v) => v.split(/\s+/))
198
+ .filter(Boolean))).join(' ');
181
199
  return cloneElement(children, {
182
200
  ...triggerProps,
201
+ onMouseEnter: compose(childProps.onMouseEnter, handleOpen),
202
+ onMouseLeave: compose(childProps.onMouseLeave, handleClose),
203
+ onFocus: compose(childProps.onFocus, handleOpen),
204
+ onBlur: compose(childProps.onBlur, handleClose),
205
+ 'aria-describedby': describedBy || undefined,
183
206
  ref: setRefs,
184
207
  });
185
208
  }
@@ -2,8 +2,8 @@ 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
4
  export { Accordion, useAccordionItem } from './Accordion';
5
- export { Avatar, AvatarGroup } from './Avatar';
6
- export { Button } from './Button';
5
+ export { Avatar, AvatarGroup, defaultAvatarLabels, defaultAvatarGroupLabels } from './Avatar';
6
+ export { Button, defaultButtonLabels } from './Button';
7
7
  export { Card } from './Card';
8
8
  export { Checkbox } from './Checkbox';
9
9
  export { Chip } from './Chip';
@@ -13,30 +13,30 @@ export { ColorPicker, ColorField, ColorArea, ColorSlider, defaultColorPickerLabe
13
13
  export { GradientPicker, GradientBar, defaultGradientPickerLabels } from './GradientPicker';
14
14
  export { ContentIndicator } from './ContentIndicator';
15
15
  export { Calendar, DatePicker, DatePickerTrigger, DateRangePicker, DateRangePickerTrigger, defaultDateRangePresets, defaultCalendarLabels, defaultDatePickerLabels, defaultDateRangePickerLabels, } from './DatePicker';
16
- export { Combobox, ComboboxContent, ComboboxOption, ComboboxGroup, ComboboxLabel, useCombobox } from './Combobox';
17
- export { MultiCombobox, MultiComboboxContent, MultiComboboxOption, MultiComboboxGroup, MultiComboboxLabel, useMultiCombobox } from './MultiCombobox';
16
+ export { Combobox, ComboboxContent, ComboboxOption, ComboboxGroup, ComboboxLabel, useCombobox, defaultComboboxLabels, } from './Combobox';
17
+ export { MultiCombobox, MultiComboboxContent, MultiComboboxOption, MultiComboboxGroup, MultiComboboxLabel, useMultiCombobox, defaultMultiComboboxLabels, } from './MultiCombobox';
18
18
  export { Dropdown, DropdownTrigger, DropdownContent, DropdownItem, DropdownSeparator, DropdownHeader, useDropdown } from './Dropdown';
19
- export { Field } from './Field';
20
- export { MultiSelect, MultiSelectTrigger, MultiSelectContent, MultiSelectOption, MultiSelectGroup, MultiSelectLabel, useMultiSelect } from './MultiSelect';
19
+ export { Field, defaultFieldLabels } from './Field';
20
+ export { MultiSelect, MultiSelectTrigger, MultiSelectContent, MultiSelectOption, MultiSelectGroup, MultiSelectLabel, useMultiSelect, defaultMultiSelectLabels, } from './MultiSelect';
21
21
  export { Select, SelectTrigger, SelectContent, SelectOption, SelectGroup, SelectLabel, useSelect } from './Select';
22
22
  export { Icon } from './Icon';
23
- export { IconButton } from './IconButton';
23
+ export { IconButton, defaultIconButtonLabels } from './IconButton';
24
24
  export { Modal } from './Modal';
25
25
  export { MoveHandle } from './MoveHandle';
26
26
  export { Notice } from './Notice';
27
27
  export { OverlapStack } from './OverlapStack';
28
28
  export { Pager, defaultPagerLabels } from './Pager';
29
29
  export { Popover, PopoverTrigger, PopoverContent, usePopover } from './Popover';
30
- export { Progress } from './Progress';
30
+ export { Progress, defaultProgressLabels } from './Progress';
31
31
  export { RadioGroup, Radio } from './Radio';
32
- export { Rating } from './Rating';
32
+ export { Rating, defaultRatingLabels } from './Rating';
33
33
  export { SegmentedControl } from './SegmentedControl';
34
34
  export { Slider } from './Slider';
35
35
  export { Sidebar, defaultSidebarToggleLabels } from './Sidebar';
36
36
  export { NavMenu, defaultNavMenuLabels } from './NavMenu';
37
37
  export { StepIndicator, defaultStepIndicatorLabels } from './StepIndicator';
38
38
  export { StepList, defaultStepListLabels } from './StepList';
39
- export { DataTable } from './Table';
39
+ export { DataTable, BulkActionsBar, defaultDataTableLabels, defaultBulkActionsBarLabels } from './Table';
40
40
  export { SearchInput } from './SearchInput';
41
41
  export { SecretInput, defaultSecretInputLabels } from './SecretInput';
42
42
  export { SearchSelect, SearchSelectTrigger, SearchSelectContent, SearchSelectOption, SearchSelectGroup, SearchSelectLabel, useSearchSelect, } from './SearchSelect';
@@ -49,42 +49,44 @@ export { Tray, defaultTraySaveLabels } from './Tray';
49
49
  export { Toolbar } from './Toolbar';
50
50
  export { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from './Tooltip';
51
51
  export type { AccordionProps, AccordionSingleProps, AccordionMultipleProps, AccordionItemProps, AccordionTriggerProps, AccordionPanelProps, AccordionVariant, AccordionItemState, } from './Accordion';
52
- export type { AvatarProps, AvatarGroupProps, AvatarSize, AvatarShape, IndicatorPosition, } from './Avatar';
53
- export type { ButtonProps } from './Button';
52
+ export type { AvatarProps, AvatarGroupProps, AvatarLabels, AvatarGroupLabels, AvatarSize, AvatarShape, IndicatorPosition, } from './Avatar';
53
+ export type { ButtonProps, ButtonLabels } from './Button';
54
54
  export type { CardRootProps, CardVariant, CardMode, CardMediaProps } from './Card';
55
55
  export type { CheckboxProps } from './Checkbox';
56
56
  export type { ChipProps } from './Chip';
57
57
  export type { ChipGroupProps, ChipGroupSingleProps, ChipGroupMultipleProps } from './ChipGroup';
58
58
  export type { ChipsProps, ChipOption } from './Chips';
59
59
  export type { ColorPickerProps, ColorPickerLabels, ColorFieldProps, ColorFieldLabels, ColorFieldVariant, ColorAreaProps, ColorSliderProps } from './ColorPicker';
60
- export type { ColorFormat, Hsva as ColorHsva } from './ColorPicker';
61
- export type { GradientPickerProps, GradientPickerLabels, GradientBarProps, GradientBarLabels, Gradient, GradientType, GradientStop, } from './GradientPicker';
62
- export type { ContentIndicatorProps } from './ContentIndicator';
60
+ export type { ColorFieldSide, ColorFieldAlign, ColorFormat, Hsva as ColorHsva, ParsedColor } from './ColorPicker';
61
+ export type { GradientPickerProps, GradientPickerLabels, GradientBarProps, GradientBarLabels, Gradient, GradientType, GradientStop, ParsedGradient, } from './GradientPicker';
62
+ export type { ContentIndicatorProps, ContentIndicatorSize, ContentIndicatorTheme, ContentIndicatorVariant, } from './ContentIndicator';
63
+ export type { CalendarProps, CalendarLabels, DatePickerProps, DatePickerTriggerProps, DatePickerLabels, DateRangePickerProps, DateRangePickerTriggerProps, DateRangePickerLabels, DateRange, DateRangePreset, WeekStart, } from './DatePicker';
63
64
  export type { DropdownProps, DropdownTriggerProps, DropdownContentProps, DropdownItemProps, DropdownSeparatorProps, DropdownHeaderProps, } from './Dropdown';
64
- export type { ComboboxProps, ComboboxContentProps, ComboboxOptionProps, ComboboxGroupProps, ComboboxLabelProps, ComboboxRegisteredOption, } from './Combobox';
65
+ export type { ComboboxProps, ComboboxContentProps, ComboboxOptionProps, ComboboxGroupProps, ComboboxLabelProps, ComboboxLabels, ComboboxFilterMode, ComboboxRegisteredOption, } from './Combobox';
65
66
  export type { MultiComboboxProps, MultiComboboxContentProps, MultiComboboxOptionProps, MultiComboboxGroupProps, MultiComboboxLabelProps, MultiComboboxLabels, MultiComboboxValue, MultiComboboxFilterMode, MultiComboboxRegisteredOption, } from './MultiCombobox';
66
- export type { FieldProps } from './Field';
67
- export type { MultiSelectProps, MultiSelectTriggerProps, MultiSelectContentProps, MultiSelectOptionProps, MultiSelectGroupProps, MultiSelectLabelProps, MultiSelectValue, OptionValue as MultiSelectOptionValue, DisplayMode as MultiSelectDisplayMode, MultiSelectRegisteredOption, } from './MultiSelect';
68
- export type { SelectProps, SelectTriggerProps, SelectContentProps, SelectOptionProps, SelectGroupProps, SelectLabelProps, } from './Select';
67
+ export type { FieldProps, FieldLabels } from './Field';
68
+ export type { MultiSelectProps, MultiSelectTriggerProps, MultiSelectContentProps, MultiSelectOptionProps, MultiSelectGroupProps, MultiSelectLabelProps, MultiSelectLabels, MultiSelectValue, OptionValue as MultiSelectOptionValue, DisplayMode as MultiSelectDisplayMode, MultiSelectRegisteredOption, } from './MultiSelect';
69
+ export type { SelectProps, SelectTriggerProps, SelectContentProps, SelectOptionProps, SelectGroupProps, SelectLabelProps, OptionValue as SelectOptionValue, } from './Select';
69
70
  export type { IconProps, IconSource, IconComponent } from './Icon';
70
- export type { IconButtonProps } from './IconButton';
71
+ export type { IconButtonProps, IconButtonLabels, Shape as IconButtonShape, Theme as IconButtonTheme, Variant as IconButtonVariant, } from './IconButton';
71
72
  export type { ModalProps, ModalRole, ModalFootProps, ModalFootJustify } from './Modal';
72
73
  export type { MoveHandleLabels, MoveHandleMode, MoveHandleProps, MoveHandleSize } from './MoveHandle';
73
- export type { NoticeProps } from './Notice';
74
+ export type { NoticeProps, NoticeHandle, NoticeExitAnimation } from './Notice';
74
75
  export type { OverlapStackProps, OverlapStackOverflowProps } from './OverlapStack';
75
76
  export type { PagerProps, PagerMode, PagerVariant, PagerLabels } from './Pager';
76
- export type { PopoverProps, PopoverTriggerProps, PopoverContentProps, } from './Popover';
77
- export type { ProgressProps } from './Progress';
77
+ export type { PopoverProps, PopoverTriggerProps, PopoverContentProps, Side as PopoverSide, Align as PopoverAlign, } from './Popover';
78
+ export type { ProgressProps, StandardProgressProps, SegmentedProgressProps, ProgressSegment, Mode as ProgressMode, LabelPos as ProgressLabelPosition, BreakdownProgressProps, ProgressBreakdownSegment, ProgressBreakdownTheme, ProgressLabels, } from './Progress';
78
79
  export type { RadioGroupProps, RadioProps } from './Radio';
79
- export type { RatingProps } from './Rating';
80
+ export type { RatingProps, RatingLabels } from './Rating';
80
81
  export type { SegmentedControlProps, SegmentedControlItemProps, SegmentedControlValue, SegmentedControlVariant, SegmentedControlSize, SegmentedControlOrientation, } from './SegmentedControl';
81
82
  export type { SidebarProps, SidebarHeaderProps, SidebarFooterProps, SidebarNavProps, SidebarToggleProps, SidebarToggleLabels, } from './Sidebar';
82
83
  export type { NavMenuProps, NavMenuOrientation, NavMenuFlyoutTrigger, NavMenuLabels, NavMenuGroupProps, NavMenuGroupLabelElement, NavMenuItemProps, NavMenuItemAsLink, NavMenuItemAsButton, NavMenuItemAsChild, NavMenuCurrent, NavMenuSubProps, } from './NavMenu';
83
84
  export type { StepIndicatorProps, StepStatus, StepIndicatorLabels } from './StepIndicator';
84
85
  export type { StepListProps, StepListItemProps, StepListLabels } from './StepList';
85
- export type { DataTableProps } from './Table';
86
+ export type { DataTableProps, DataTableLabels, BulkActionsBarLabels } from './Table';
86
87
  export type { TabsProps, TabsListProps, TabProps, TabPanelProps, TabsVariant, TabsActivationMode, TabsOrientation, } from './Tabs';
87
88
  export type { SearchInputProps } from './SearchInput';
89
+ export type { SliderProps } from './Slider';
88
90
  export type { SecretInputProps, SecretInputLabels } from './SecretInput';
89
91
  export type { SearchSelectProps, SearchSelectTriggerProps, SearchSelectContentProps, SearchSelectOptionProps, SearchSelectGroupProps, SearchSelectLabelProps, SearchSelectLabels, } from './SearchSelect';
90
92
  export type { SwitchProps } from './Switch';
@@ -93,7 +95,7 @@ export type { TextInputProps, TextInputType } from './TextInput';
93
95
  export type { ToastProps, ToastHandle, ToastTheme, ToastAnnounce, ToastPlacement, ToastOptions, ToastContextValue, ToastProviderProps, } from './Toast';
94
96
  export type { TrayProps, TrayPlacement, TrayMessageProps, TrayActionsProps, TraySaveActionsProps, TraySaveLabels, } from './Tray';
95
97
  export type { ToolbarProps, ToolbarGroupProps, ToolbarItemProps, ToolbarOrientation } from './Toolbar';
96
- export type { TooltipProps, TooltipProviderProps, TooltipTriggerProps, TooltipContentProps, TooltipType } from './Tooltip';
98
+ export type { TooltipProps, TooltipProviderProps, TooltipTriggerProps, TooltipContentProps, TooltipType, TooltipTheme, Side as TooltipSide, Align as TooltipAlign, } from './Tooltip';
97
99
  export { GENERATIVE_COLORS, stringToGenerativeColor } from '../utils/generative';
98
100
  export type { GenerativeColor } from '../utils/generative';
99
101
  export * from '../utils/color-scheme';
@@ -1,7 +1,7 @@
1
1
  // Components
2
2
  export { Accordion, useAccordionItem } from './Accordion/index.js';
3
- export { Avatar, AvatarGroup } from './Avatar/index.js';
4
- export { Button } from './Button/index.js';
3
+ export { Avatar, AvatarGroup, defaultAvatarLabels, defaultAvatarGroupLabels } from './Avatar/index.js';
4
+ export { Button, defaultButtonLabels } from './Button/index.js';
5
5
  export { Card } from './Card/index.js';
6
6
  export { Checkbox } from './Checkbox/index.js';
7
7
  export { Chip } from './Chip/index.js';
@@ -11,30 +11,30 @@ export { ColorPicker, ColorField, ColorArea, ColorSlider, defaultColorPickerLabe
11
11
  export { GradientPicker, GradientBar, defaultGradientPickerLabels } from './GradientPicker/index.js';
12
12
  export { ContentIndicator } from './ContentIndicator/index.js';
13
13
  export { Calendar, DatePicker, DatePickerTrigger, DateRangePicker, DateRangePickerTrigger, defaultDateRangePresets, defaultCalendarLabels, defaultDatePickerLabels, defaultDateRangePickerLabels, } from './DatePicker/index.js';
14
- export { Combobox, ComboboxContent, ComboboxOption, ComboboxGroup, ComboboxLabel, useCombobox } from './Combobox/index.js';
15
- export { MultiCombobox, MultiComboboxContent, MultiComboboxOption, MultiComboboxGroup, MultiComboboxLabel, useMultiCombobox } from './MultiCombobox/index.js';
14
+ export { Combobox, ComboboxContent, ComboboxOption, ComboboxGroup, ComboboxLabel, useCombobox, defaultComboboxLabels, } from './Combobox/index.js';
15
+ export { MultiCombobox, MultiComboboxContent, MultiComboboxOption, MultiComboboxGroup, MultiComboboxLabel, useMultiCombobox, defaultMultiComboboxLabels, } from './MultiCombobox/index.js';
16
16
  export { Dropdown, DropdownTrigger, DropdownContent, DropdownItem, DropdownSeparator, DropdownHeader, useDropdown } from './Dropdown/index.js';
17
- export { Field } from './Field/index.js';
18
- export { MultiSelect, MultiSelectTrigger, MultiSelectContent, MultiSelectOption, MultiSelectGroup, MultiSelectLabel, useMultiSelect } from './MultiSelect/index.js';
17
+ export { Field, defaultFieldLabels } from './Field/index.js';
18
+ export { MultiSelect, MultiSelectTrigger, MultiSelectContent, MultiSelectOption, MultiSelectGroup, MultiSelectLabel, useMultiSelect, defaultMultiSelectLabels, } from './MultiSelect/index.js';
19
19
  export { Select, SelectTrigger, SelectContent, SelectOption, SelectGroup, SelectLabel, useSelect } from './Select/index.js';
20
20
  export { Icon } from './Icon/index.js';
21
- export { IconButton } from './IconButton/index.js';
21
+ export { IconButton, defaultIconButtonLabels } from './IconButton/index.js';
22
22
  export { Modal } from './Modal/index.js';
23
23
  export { MoveHandle } from './MoveHandle/index.js';
24
24
  export { Notice } from './Notice/index.js';
25
25
  export { OverlapStack } from './OverlapStack/index.js';
26
26
  export { Pager, defaultPagerLabels } from './Pager/index.js';
27
27
  export { Popover, PopoverTrigger, PopoverContent, usePopover } from './Popover/index.js';
28
- export { Progress } from './Progress/index.js';
28
+ export { Progress, defaultProgressLabels } from './Progress/index.js';
29
29
  export { RadioGroup, Radio } from './Radio/index.js';
30
- export { Rating } from './Rating/index.js';
30
+ export { Rating, defaultRatingLabels } 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
34
  export { NavMenu, defaultNavMenuLabels } from './NavMenu/index.js';
35
35
  export { StepIndicator, defaultStepIndicatorLabels } from './StepIndicator/index.js';
36
36
  export { StepList, defaultStepListLabels } from './StepList/index.js';
37
- export { DataTable } from './Table/index.js';
37
+ export { DataTable, BulkActionsBar, defaultDataTableLabels, defaultBulkActionsBarLabels } from './Table/index.js';
38
38
  export { SearchInput } from './SearchInput/index.js';
39
39
  export { SecretInput, defaultSecretInputLabels } from './SecretInput/index.js';
40
40
  export { SearchSelect, SearchSelectTrigger, SearchSelectContent, SearchSelectOption, SearchSelectGroup, SearchSelectLabel, useSearchSelect, } from './SearchSelect/index.js';
package/figma-tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.38",
2
+ "version": "0.2.40",
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.",