@tangible/ui 0.2.40 → 0.2.42

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 (66) hide show
  1. package/README.md +19 -6
  2. package/components/Avatar/AvatarGroup.js +3 -2
  3. package/components/CommandPalette/CommandPalette.d.ts +30 -0
  4. package/components/CommandPalette/CommandPalette.js +409 -0
  5. package/components/CommandPalette/CommandPaletteContext.d.ts +31 -0
  6. package/components/CommandPalette/CommandPaletteContext.js +8 -0
  7. package/components/CommandPalette/index.d.ts +3 -0
  8. package/components/CommandPalette/index.js +2 -0
  9. package/components/CommandPalette/shortcut.d.ts +15 -0
  10. package/components/CommandPalette/shortcut.js +83 -0
  11. package/components/CommandPalette/types.d.ts +152 -0
  12. package/components/CommandPalette/types.js +16 -0
  13. package/components/Dropdown/Dropdown.js +6 -3
  14. package/components/IconTile/IconTile.d.ts +16 -0
  15. package/components/IconTile/IconTile.js +17 -0
  16. package/components/IconTile/index.d.ts +2 -0
  17. package/components/IconTile/index.js +1 -0
  18. package/components/IconTile/types.d.ts +29 -0
  19. package/components/IconTile/types.js +1 -0
  20. package/components/NavMenu/NavMenu.js +5 -4
  21. package/components/OverlapStack/OverlapStack.js +3 -2
  22. package/components/SegmentedControl/SegmentedControl.js +2 -2
  23. package/components/SegmentedControl/types.d.ts +10 -0
  24. package/components/StepList/StepList.js +6 -4
  25. package/components/Table/DataTable.js +1 -1
  26. package/components/Table/types.d.ts +6 -0
  27. package/components/Table/types.js +3 -0
  28. package/components/index.d.ts +4 -0
  29. package/components/index.js +2 -0
  30. package/figma-tokens.json +101 -3
  31. package/icons/icons.svg +1 -1
  32. package/icons/sprite-version.js +1 -1
  33. package/icons/sprite.php +1 -1
  34. package/package.json +22 -4
  35. package/skills/building-with-tui/SKILL.md +17 -3
  36. package/styles/all.css +1 -1
  37. package/styles/all.expanded.css +514 -63
  38. package/styles/all.expanded.unlayered.css +514 -63
  39. package/styles/all.unlayered.css +1 -1
  40. package/styles/components/_bundle.scss +8 -0
  41. package/styles/components/avatar.scss +6 -23
  42. package/styles/components/button.scss +15 -15
  43. package/styles/components/chip.scss +35 -11
  44. package/styles/components/command-palette.scss +314 -0
  45. package/styles/components/content-indicator.scss +6 -1
  46. package/styles/components/date-picker.scss +1 -1
  47. package/styles/components/icon-button.scss +6 -7
  48. package/styles/components/icon-tile.scss +89 -0
  49. package/styles/components/input/index.scss +4 -0
  50. package/styles/components/multi-select.scss +1 -1
  51. package/styles/components/progress.scss +23 -0
  52. package/styles/components/segmented-control.scss +11 -1
  53. package/styles/components/step-indicator.scss +1 -1
  54. package/styles/components/tabs.scss +1 -1
  55. package/styles/core.css +1 -1
  56. package/styles/core.unlayered.css +1 -1
  57. package/styles/system/_constants.scss +5 -0
  58. package/styles/system/_palettes.scss +1 -0
  59. package/styles/system/_tokens.scss +40 -1
  60. package/tui-manifest.json +166 -2
  61. package/utils/color/theme.d.ts +66 -0
  62. package/utils/color/theme.js +232 -0
  63. package/utils/flatten-children.d.ts +17 -0
  64. package/utils/flatten-children.js +32 -0
  65. package/vanilla/styles.css +1 -1
  66. package/vanilla/styles.unlayered.css +1 -1
@@ -0,0 +1,152 @@
1
+ import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode, RefObject } from 'react';
2
+ import type { IconSource } from '../Icon';
3
+ import type { SizeStandard } from '../../types';
4
+ import type { ListboxGroupProps, ListboxLabelProps } from '../../utils/listbox';
5
+ import type { OptionValue } from '../../utils/value-key';
6
+ /** Where the palette is in fetching results. */
7
+ export type CommandPaletteStatus = 'ready' | 'loading' | 'error';
8
+ export type CommandPaletteLabels = {
9
+ /** The dialog's name, rendered as a visually hidden heading. */
10
+ title: string;
11
+ /** The search field's accessible name. */
12
+ search: string;
13
+ /** The results list's accessible name. Distinct from `title`, so AT doesn't hear "Search" three times. */
14
+ list: string;
15
+ /** Placeholder text in the search field. */
16
+ placeholder: string;
17
+ /**
18
+ * The narrow-screen close button (wide screens show an Esc hint instead).
19
+ * "Cancel" rather than `hintClose`'s "Close": it's the touch-sheet
20
+ * convention, and the two never show at once.
21
+ */
22
+ close: string;
23
+ /** Read with the field when results have an `href`, so the new-tab keys are discoverable. */
24
+ newTabHint: string;
25
+ /** Visible and announced when nothing matches. */
26
+ noResults: (query: string) => string;
27
+ /** Announced as the result count changes. */
28
+ results: (count: number) => string;
29
+ /** Visible and announced while `status` is `loading`. */
30
+ loading: string;
31
+ /** Visible and announced while `status` is `error`. */
32
+ error: string;
33
+ /** The retry button, shown with `onRetry` while `status` is `error`. */
34
+ retry: string;
35
+ /** Footer hint for the arrow keys. */
36
+ hintNavigate: string;
37
+ /** Footer hint for Enter. */
38
+ hintOpen: string;
39
+ /** Footer hint for Escape. */
40
+ hintClose: string;
41
+ };
42
+ export declare const defaultCommandPaletteLabels: CommandPaletteLabels;
43
+ /** Extra detail handed to `onSelect`. */
44
+ export type CommandPaletteSelectDetail = {
45
+ /** The item's `href`, when it has one. */
46
+ href?: string;
47
+ };
48
+ /** Custom match for built-in filtering. `keywords` are the item's own, unjoined. */
49
+ export type CommandPaletteFilter = (text: string, query: string, keywords: readonly string[]) => boolean;
50
+ /**
51
+ * Remaining props (`id`, `data-testid`, `aria-describedby`…) land on the
52
+ * dialog element.
53
+ */
54
+ export type CommandPaletteProps = Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-modal' | 'tabIndex' | 'children' | 'onSelect' | 'aria-labelledby' | 'defaultValue'> & {
55
+ /** Whether the palette is showing (controlled). Pair with `onOpenChange`. */
56
+ open?: boolean;
57
+ /**
58
+ * Initial state when `open` is uncontrolled: enough for a palette opened
59
+ * only by its `shortcut`. A separate `Trigger` needs controlled `open`.
60
+ * @default false
61
+ */
62
+ defaultOpen?: boolean;
63
+ /** Called to open or close: Escape, the backdrop, a selection, the shortcut. */
64
+ onOpenChange?: (open: boolean) => void;
65
+ /**
66
+ * The search text (controlled). Controlling it hands filtering to you: every
67
+ * item you render is shown, so filter (or fetch) before rendering. Leave it
68
+ * uncontrolled and the palette filters items by their text and `keywords`.
69
+ */
70
+ inputValue?: string;
71
+ /** Called with the search text on every change. */
72
+ onInputChange?: (value: string) => void;
73
+ /**
74
+ * Custom match for built-in filtering, or `false` to show every item.
75
+ * Ignored when `inputValue` is controlled.
76
+ * @default case-insensitive substring match on the item's text or any keyword
77
+ */
78
+ filter?: CommandPaletteFilter | false;
79
+ /**
80
+ * Called when an item is chosen with Enter or a click. When it's omitted, an
81
+ * item with an `href` navigates there (http, https and relative URLs only).
82
+ * Opening an `href` in a new tab (Cmd/Ctrl+Enter, Cmd/Ctrl+click,
83
+ * middle-click) never calls it: items are options, not links, so these are
84
+ * the only new-tab routes.
85
+ */
86
+ onSelect?: (value: OptionValue, detail: CommandPaletteSelectDetail) => void;
87
+ /**
88
+ * `loading` and `error` show a message under the results, which is also
89
+ * announced. Items you still render stay visible and navigable.
90
+ * @default 'ready'
91
+ */
92
+ status?: CommandPaletteStatus;
93
+ /** Shows a retry button in the `error` state. */
94
+ onRetry?: () => void;
95
+ /**
96
+ * A global shortcut that toggles the palette, e.g. `"mod+k"` (`mod` is Cmd
97
+ * on Apple platforms, Ctrl elsewhere). Omit for none. A shortcut without
98
+ * `mod` or `alt` (such as `"/"`) is ignored while the user is typing in a
99
+ * field. Avoid `alt+<letter>` on macOS, where Option changes the character.
100
+ * The shortcut stands down while another modal dialog is open.
101
+ */
102
+ shortcut?: string;
103
+ /**
104
+ * Show the keyboard hints footer. It is hidden on narrow screens regardless.
105
+ * @default true
106
+ */
107
+ showHints?: boolean;
108
+ /** Where focus returns on close. Defaults to whatever had focus on open. */
109
+ restoreFocusTo?: RefObject<HTMLElement | null> | (() => HTMLElement | null);
110
+ labels?: Partial<CommandPaletteLabels>;
111
+ className?: string;
112
+ /** `CommandPalette.Group`s and `CommandPalette.Item`s. */
113
+ children?: ReactNode;
114
+ };
115
+ export type CommandPaletteItemProps = {
116
+ /** Handed to `onSelect`. Unique within the palette. */
117
+ value: OptionValue;
118
+ /** Searchable text, when `children` isn't a plain string. */
119
+ textValue?: string;
120
+ /** Extra words that match in built-in filtering but aren't shown. */
121
+ keywords?: string[];
122
+ /** A leading icon. */
123
+ icon?: IconSource;
124
+ /** A second, muted line. */
125
+ description?: ReactNode;
126
+ /** A destination. Cmd/Ctrl+Enter opens it in a new tab. */
127
+ href?: string;
128
+ /** Keep the palette open after this item is chosen. */
129
+ keepOpen?: boolean;
130
+ disabled?: boolean;
131
+ className?: string;
132
+ children?: ReactNode;
133
+ };
134
+ export type CommandPaletteGroupProps = ListboxGroupProps;
135
+ export type CommandPaletteLabelProps = ListboxLabelProps;
136
+ export type CommandPaletteTriggerProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'type'> & {
137
+ /**
138
+ * Visible text, which is also the button's accessible name.
139
+ * @default defaultCommandPaletteLabels.placeholder ("Search…")
140
+ */
141
+ children?: ReactNode;
142
+ /**
143
+ * Shown as a key hint and in `aria-keyshortcuts`, e.g. `"mod+k"`. Display
144
+ * only: it registers nothing, so match the palette's own `shortcut`.
145
+ */
146
+ shortcut?: string;
147
+ /**
148
+ * Control height tier, as for the form controls. App headers usually want `sm`.
149
+ * @default 'md'
150
+ */
151
+ size?: SizeStandard;
152
+ };
@@ -0,0 +1,16 @@
1
+ export const defaultCommandPaletteLabels = {
2
+ title: 'Search',
3
+ search: 'Search',
4
+ list: 'Search results',
5
+ placeholder: 'Search…',
6
+ close: 'Cancel',
7
+ newTabHint: 'Press Control or Command with Enter to open a page in a new tab.',
8
+ noResults: (query) => (query ? `No results for “${query}”` : 'No results'),
9
+ results: (count) => (count === 1 ? '1 result' : `${count} results`),
10
+ loading: 'Searching…',
11
+ error: 'Something went wrong while searching.',
12
+ retry: 'Try again',
13
+ hintNavigate: 'Navigate',
14
+ hintOpen: 'Open',
15
+ hintClose: 'Close',
16
+ };
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { useCallback, useEffect, useLayoutEffect, useId, useMemo, useRef, useState, cloneElement, isValidElement, Children, } from 'react';
2
+ import React, { useCallback, useEffect, useLayoutEffect, useId, useMemo, useRef, useState, cloneElement, isValidElement, } from 'react';
3
3
  import { useFloating, offset, flip, shift, autoUpdate, FloatingPortal, useDismiss, useInteractions, useListNavigation, useRole, FloatingFocusManager, } from '@floating-ui/react';
4
4
  import { cx } from '../../utils/cx.js';
5
+ import { flattenChildren } from '../../utils/flatten-children.js';
5
6
  import { getPortalRootFor } from '../../utils/portal.js';
6
7
  import { getElementRef } from '../../utils/compose-refs.js';
7
8
  import { Button } from '../Button/index.js';
@@ -146,7 +147,9 @@ function DropdownContentInner({ side = 'bottom', align = 'start', sideOffset = 4
146
147
  const disabled = [];
147
148
  let itemIdx = 0;
148
149
  let firstEnabled = -1;
149
- Children.forEach(children, (child) => {
150
+ // Fragments are opened up (#193): both passes walk the same flat list,
151
+ // so the indices counted here match the ones rendered below.
152
+ flattenChildren(children).forEach((child) => {
150
153
  if (!isValidElement(child))
151
154
  return;
152
155
  // Skip non-navigable sub-components
@@ -199,7 +202,7 @@ function DropdownContentInner({ side = 'bottom', align = 'start', sideOffset = 4
199
202
  // Clone children to inject item props and role.
200
203
  // Non-navigable children (Separator, Header) are rendered as-is.
201
204
  let itemIndex = 0;
202
- const items = Children.map(children, (child) => {
205
+ const items = flattenChildren(children).map((child) => {
203
206
  if (!isValidElement(child))
204
207
  return child;
205
208
  // Non-navigable sub-components — render without list navigation props
@@ -0,0 +1,16 @@
1
+ /**
2
+ * An icon in a tinted tile: a stat's category, an empty state, a step in a
3
+ * list. Avatar's sibling. Avatar is a person, drawn from their name; IconTile
4
+ * is a thing, coloured by meaning (a theme). They share one size ladder so
5
+ * they line up in the same list.
6
+ *
7
+ * Decorative by default: the text beside it says what it means. Give it a
8
+ * `label` when it stands alone. Not interactive: wrap it in a Button to act.
9
+ */
10
+ export declare const IconTile: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLSpanElement>, "role" | "aria-hidden" | "children" | "aria-label" | "tabIndex" | "aria-labelledby"> & {
11
+ icon: import("..").IconSource;
12
+ size?: import("./types").IconTileSize;
13
+ shape?: import("./types").IconTileShape;
14
+ theme?: import("./types").IconTileTheme;
15
+ label?: string;
16
+ } & import("react").RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { Icon } from "../Icon/index.js";
5
+ /**
6
+ * An icon in a tinted tile: a stat's category, an empty state, a step in a
7
+ * list. Avatar's sibling. Avatar is a person, drawn from their name; IconTile
8
+ * is a thing, coloured by meaning (a theme). They share one size ladder so
9
+ * they line up in the same list.
10
+ *
11
+ * Decorative by default: the text beside it says what it means. Give it a
12
+ * `label` when it stands alone. Not interactive: wrap it in a Button to act.
13
+ */
14
+ export const IconTile = forwardRef(function IconTile({ icon, size = "md", shape = "square", theme = "primary", label, className, ...rest }, ref) {
15
+ const name = label?.trim();
16
+ return (_jsx("span", { ...rest, ref: ref, className: cx("tui-icon-tile", `is-size-${size}`, `is-shape-${shape}`, `is-theme-${theme}`, className), role: name ? "img" : undefined, "aria-label": name || undefined, "aria-hidden": name ? undefined : true, "aria-labelledby": undefined, tabIndex: undefined, children: _jsx(Icon, { name: icon }) }));
17
+ });
@@ -0,0 +1,2 @@
1
+ export { IconTile } from "./IconTile";
2
+ export type { IconTileProps, IconTileSize, IconTileShape, IconTileTheme, } from "./types";
@@ -0,0 +1 @@
1
+ export { IconTile } from "./IconTile.js";
@@ -0,0 +1,29 @@
1
+ import type { HTMLAttributes } from "react";
2
+ import type { SizeExtended, ThemeIntent, ThemeStatus } from "../../types";
3
+ import type { IconSource } from "../Icon";
4
+ /** Avatar's box ladder: xs 24, sm 32, md 40, lg 48, xl 64, xxl 80 */
5
+ export type IconTileSize = SizeExtended;
6
+ export type IconTileShape = "square" | "circle";
7
+ export type IconTileTheme = ThemeIntent | ThemeStatus;
8
+ /**
9
+ * Not interactive, so no tabIndex; and named only through `label`, so no
10
+ * aria-labelledby (it would outrank `label`, and a dangling id blanks the
11
+ * name). To make a tile act, wrap it in a Button.
12
+ */
13
+ export type IconTileProps = Omit<HTMLAttributes<HTMLSpanElement>, "children" | "role" | "aria-label" | "aria-labelledby" | "aria-hidden" | "tabIndex"> & {
14
+ /** The icon, by registry name (`"system/folder"`) or as an imported icon component */
15
+ icon: IconSource;
16
+ /** Default `md` (40px). The same ladder as Avatar, so the two line up in a list. */
17
+ size?: IconTileSize;
18
+ /** Default `square` (radius-md) */
19
+ shape?: IconTileShape;
20
+ /** Default `primary`. Meaning, not identity: the tint and icon colour follow the theme. */
21
+ theme?: IconTileTheme;
22
+ /**
23
+ * Names the tile as an image. Leave it out when the text beside the tile
24
+ * already says what it means (the usual case): the tile is then decorative
25
+ * and hidden from assistive tech. Don't repeat text that's already beside it,
26
+ * or it's read twice. Blank or whitespace-only counts as no label.
27
+ */
28
+ label?: string;
29
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Children, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, } from 'react';
2
+ import { cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, } from 'react';
3
3
  import { useFloating, autoUpdate, offset, flip, shift } from '@floating-ui/react';
4
4
  import { cx } from '../../utils/cx.js';
5
5
  import { isDev } from '../../utils/is-dev.js';
@@ -9,6 +9,7 @@ import { Icon } from '../Icon/index.js';
9
9
  import { createHoverWarmth, isWarm, markClosed, markOpen, sampleHoverIntent } from '../../utils/hover-intent.js';
10
10
  import { defaultNavMenuLabels } from './types.js';
11
11
  import { ChevronDownSmall as ChevronDownSmallIcon } from '../../icons/system/index.js';
12
+ import { flattenChildren } from '../../utils/flatten-children.js';
12
13
  // Hover intent and warmth come from utils/hover-intent (shared with tooltips).
13
14
  // A panel opens when the pointer settles, not after a fixed delay; once the
14
15
  // bar is warm (a panel open, or one closed within PRIMED_WINDOW) the next
@@ -78,7 +79,7 @@ function wrapLooseItems(children) {
78
79
  out.push(_jsx("ul", { className: "tui-nav-menu__list", children: _jsx(ListContext.Provider, { value: true, children: run }) }, `loose:${run[0].key}`));
79
80
  run = [];
80
81
  };
81
- Children.toArray(children).forEach((child) => {
82
+ flattenChildren(children).forEach((child) => {
82
83
  if (isValidElement(child) && child.type === NavMenuItem) {
83
84
  run.push(child);
84
85
  }
@@ -118,7 +119,7 @@ const isGroup = (node) => isValidElement(node) && node.type === NavMenuGroup;
118
119
  function NavMenuSub({ className, children, ...rest }) {
119
120
  // Groups bring their own headed lists, so a Sub of groups is a plain
120
121
  // container; a Sub of items is the list itself.
121
- if (Children.toArray(children).some(isGroup)) {
122
+ if (flattenChildren(children).some(isGroup)) {
122
123
  return (_jsx("div", { ...rest, className: cx('tui-nav-menu__sub', 'has-groups', className), children: children }));
123
124
  }
124
125
  return (_jsx("ul", { ...rest, className: cx('tui-nav-menu__sub', className), children: _jsx(ListContext.Provider, { value: true, children: children }) }));
@@ -171,7 +172,7 @@ const NavMenuItem = forwardRef(function NavMenuItem(props, ref) {
171
172
  }
172
173
  });
173
174
  // Sub lists render after the link, inside the same <li>.
174
- const all = Children.toArray(children);
175
+ const all = flattenChildren(children);
175
176
  const subs = all.filter(isSub);
176
177
  const label = all.filter((c) => !isSub(c));
177
178
  // -- Flyout (horizontal bar, item with a Sub) -------------------------------
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Children, forwardRef, isValidElement } from 'react';
2
+ import { forwardRef, isValidElement } from 'react';
3
3
  import { cx } from '../../utils/cx.js';
4
+ import { flattenChildren } from '../../utils/flatten-children.js';
4
5
  // =============================================================================
5
6
  // Overflow Component
6
7
  // =============================================================================
@@ -16,7 +17,7 @@ const OverlapStackOverflow = forwardRef(function OverlapStackOverflow({ children
16
17
  const Z_INDEX_BASE = 10;
17
18
  const defaultOverflowLabel = (count) => `${count} more`;
18
19
  const OverlapStackRoot = forwardRef(function OverlapStack({ overlap, max, frame, renderOverflow, overflowLabel = defaultOverflowLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, children, className, style, }, ref) {
19
- const childArray = Children.toArray(children).filter(isValidElement);
20
+ const childArray = flattenChildren(children).filter(isValidElement);
20
21
  const totalCount = childArray.length;
21
22
  // Determine visible children and overflow count
22
23
  const hasOverflow = max !== undefined && totalCount > max;
@@ -8,7 +8,7 @@ import { SegmentedControlContext, useSegmentedControlContext } from './Segmented
8
8
  // =============================================================================
9
9
  // SegmentedControl Root
10
10
  // =============================================================================
11
- function SegmentedControlRoot({ value: controlledValue, defaultValue, onValueChange, variant = 'pill', size = 'md', orientation = 'horizontal', loop = true, wrap = false, disabled = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, children, }) {
11
+ function SegmentedControlRoot({ value: controlledValue, defaultValue, onValueChange, variant = 'pill', size = 'md', orientation = 'horizontal', loop = true, wrap = false, disabled = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, className, children, }) {
12
12
  const [internalValue, setInternalValue] = useState(defaultValue);
13
13
  // Lock controlled/uncontrolled decision at mount to prevent mode switching
14
14
  const isControlled = useRef(controlledValue !== undefined).current;
@@ -61,7 +61,7 @@ function SegmentedControlRoot({ value: controlledValue, defaultValue, onValueCha
61
61
  unregisterItem,
62
62
  onSelect,
63
63
  ]);
64
- return (_jsx(SegmentedControlContext.Provider, { value: contextValue, children: _jsx("div", { role: "radiogroup", className: cx('tui-segmented', `is-variant-${variant}`, `is-size-${size}`, orientation === 'vertical' && 'is-vertical', wrap && 'is-wrap', className), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-disabled": disabled || undefined, "aria-orientation": orientation, onKeyDown: handleKeyDown, children: children }) }));
64
+ return (_jsx(SegmentedControlContext.Provider, { value: contextValue, children: _jsx("div", { role: "radiogroup", className: cx('tui-segmented', `is-variant-${variant}`, `is-size-${size}`, orientation === 'vertical' && 'is-vertical', wrap && 'is-wrap', className), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-disabled": disabled || undefined, "aria-orientation": orientation, onKeyDown: handleKeyDown, children: children }) }));
65
65
  }
66
66
  // =============================================================================
67
67
  // SegmentedControl.Item
@@ -34,6 +34,16 @@ export type SegmentedControlProps = {
34
34
  * At least one of `aria-label` or `aria-labelledby` is required.
35
35
  */
36
36
  'aria-labelledby'?: string;
37
+ /**
38
+ * Help or error text, by id. Declared (not left to a rest spread) so
39
+ * Field.Control's injection reaches the radiogroup: help and errors are
40
+ * announced, as on RadioGroup.
41
+ */
42
+ 'aria-describedby'?: string;
43
+ /** Marks the group invalid; Field.Control injects it from `error` */
44
+ 'aria-invalid'?: boolean | 'true' | 'false';
45
+ /** Marks the group required; Field.Control injects it from `required` */
46
+ 'aria-required'?: boolean | 'true' | 'false';
37
47
  /** Additional classes */
38
48
  className?: string;
39
49
  children: ReactNode;
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Children, isValidElement, useMemo, useRef } from 'react';
2
+ import { isValidElement, useMemo, useRef } from 'react';
3
3
  import { cx } from '../../utils/cx.js';
4
4
  import { isDev } from '../../utils/is-dev.js';
5
5
  import { defaultStepListLabels } from './types.js';
6
6
  import { StepListContext, useStepListContext } from './StepListContext.js';
7
7
  import { StepIndicator } from '../StepIndicator/index.js';
8
8
  import { stepIndicatorLabel } from '../StepIndicator/label.js';
9
+ import { flattenChildren } from '../../utils/flatten-children.js';
9
10
  // =============================================================================
10
11
  // StepList (Root)
11
12
  // =============================================================================
@@ -18,10 +19,11 @@ function StepListRoot(props) {
18
19
  }
19
20
  const rootClassName = cx('tui-steplist', className);
20
21
  // A list with nothing to select or follow isn't navigation. Only direct
21
- // children are inspected: an Item wrapped in another component keeps its
22
- // own rendering, but the root can't see its href and won't be a nav.
22
+ // children (fragments opened up) are inspected: an Item wrapped in another
23
+ // component keeps its own rendering, but the root can't see its href and
24
+ // won't be a nav.
23
25
  const isNav = !!onSelect ||
24
- Children.toArray(children).some((child) => isValidElement(child) && !!child.props.href);
26
+ flattenChildren(children).some((child) => isValidElement(child) && !!child.props.href);
25
27
  // Memoize context value to prevent unnecessary re-renders of all items
26
28
  const contextValue = useMemo(() => ({ current, ariaCurrent, onSelect, labels: { ...defaultStepListLabels, ...labelsProp }, isNav }), [current, ariaCurrent, onSelect, labelsProp, isNav]);
27
29
  return (_jsx(StepListContext.Provider, { value: contextValue, children: isNav ? (_jsx("nav", { className: rootClassName, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children: _jsx("ul", { role: "list", className: "tui-steplist__list", children: children }) })) : (_jsx("div", { className: rootClassName, children: _jsx("ul", { role: "list", className: "tui-steplist__list", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children: children }) })) }));
@@ -237,7 +237,7 @@ enableRowSelection = false, getRowId, getRowLabelForSelection, onSelectionChange
237
237
  selectedRowIds,
238
238
  clearSelection: () => table.resetRowSelection(),
239
239
  selectedCount
240
- })) : (_jsx(BulkActionsBar, { count: selectedCount, onClear: () => table.resetRowSelection(), "aria-controls": tableId }))), _jsxs("table", { ...rest, id: tableId, className: "tui-table", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-busy": loading || undefined, children: [_jsx("thead", { className: "tui-table__head", children: table.getHeaderGroups().map((headerGroup) => (_jsx("tr", { className: "tui-table__row tui-table__row--head", children: headerGroup.headers.map((header) => {
240
+ })) : (_jsx(BulkActionsBar, { count: selectedCount, onClear: () => table.resetRowSelection(), "aria-controls": tableId, labels: { selected: labels.bulkSelected, actions: labels.bulkActions }, clearLabel: labels.bulkClear }))), _jsxs("table", { ...rest, id: tableId, className: "tui-table", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-busy": loading || undefined, children: [_jsx("thead", { className: "tui-table__head", children: table.getHeaderGroups().map((headerGroup) => (_jsx("tr", { className: "tui-table__row tui-table__row--head", children: headerGroup.headers.map((header) => {
241
241
  const canSort = header.column.getCanSort();
242
242
  const sortDirection = header.column.getIsSorted();
243
243
  const headerDef = header.column.columnDef.header;
@@ -16,5 +16,11 @@ export type DataTableLabels = {
16
16
  sortBy?: (column: string) => string;
17
17
  /** Live-region announcement after sorting. Default: `` `Sorted by ${column}, ${direction}` `` */
18
18
  sorted?: (column: string, direction: 'ascending' | 'descending') => string;
19
+ /** Built-in bulk bar's visible count. Default: BulkActionsBar's `selected`, `` `${count} selected` `` */
20
+ bulkSelected?: (count: number) => string;
21
+ /** Built-in bulk bar's group `aria-label`. Default: BulkActionsBar's `actions` */
22
+ bulkActions?: (count: number) => string;
23
+ /** Built-in bulk bar's clear-selection button. Default: `"Clear"` */
24
+ bulkClear?: string;
19
25
  };
20
26
  export declare const defaultDataTableLabels: Required<DataTableLabels>;
@@ -8,4 +8,7 @@ export const defaultDataTableLabels = {
8
8
  pageStatus: (current, total) => `Page ${current} of ${total}`,
9
9
  sortBy: (column) => `Sort by ${column}`,
10
10
  sorted: (column, direction) => `Sorted by ${column}, ${direction}`,
11
+ bulkSelected: defaultBulkActionsBarLabels.selected,
12
+ bulkActions: defaultBulkActionsBarLabels.actions,
13
+ bulkClear: 'Clear',
11
14
  };
@@ -21,6 +21,7 @@ export { MultiSelect, MultiSelectTrigger, MultiSelectContent, MultiSelectOption,
21
21
  export { Select, SelectTrigger, SelectContent, SelectOption, SelectGroup, SelectLabel, useSelect } from './Select';
22
22
  export { Icon } from './Icon';
23
23
  export { IconButton, defaultIconButtonLabels } from './IconButton';
24
+ export { IconTile } from './IconTile';
24
25
  export { Modal } from './Modal';
25
26
  export { MoveHandle } from './MoveHandle';
26
27
  export { Notice } from './Notice';
@@ -37,6 +38,7 @@ export { NavMenu, defaultNavMenuLabels } from './NavMenu';
37
38
  export { StepIndicator, defaultStepIndicatorLabels } from './StepIndicator';
38
39
  export { StepList, defaultStepListLabels } from './StepList';
39
40
  export { DataTable, BulkActionsBar, defaultDataTableLabels, defaultBulkActionsBarLabels } from './Table';
41
+ export { CommandPalette, CommandPaletteItem, CommandPaletteGroup, CommandPaletteLabel, CommandPaletteTrigger, defaultCommandPaletteLabels, } from './CommandPalette';
40
42
  export { SearchInput } from './SearchInput';
41
43
  export { SecretInput, defaultSecretInputLabels } from './SecretInput';
42
44
  export { SearchSelect, SearchSelectTrigger, SearchSelectContent, SearchSelectOption, SearchSelectGroup, SearchSelectLabel, useSearchSelect, } from './SearchSelect';
@@ -69,6 +71,7 @@ export type { MultiSelectProps, MultiSelectTriggerProps, MultiSelectContentProps
69
71
  export type { SelectProps, SelectTriggerProps, SelectContentProps, SelectOptionProps, SelectGroupProps, SelectLabelProps, OptionValue as SelectOptionValue, } from './Select';
70
72
  export type { IconProps, IconSource, IconComponent } from './Icon';
71
73
  export type { IconButtonProps, IconButtonLabels, Shape as IconButtonShape, Theme as IconButtonTheme, Variant as IconButtonVariant, } from './IconButton';
74
+ export type { IconTileProps, IconTileSize, IconTileShape, IconTileTheme } from './IconTile';
72
75
  export type { ModalProps, ModalRole, ModalFootProps, ModalFootJustify } from './Modal';
73
76
  export type { MoveHandleLabels, MoveHandleMode, MoveHandleProps, MoveHandleSize } from './MoveHandle';
74
77
  export type { NoticeProps, NoticeHandle, NoticeExitAnimation } from './Notice';
@@ -85,6 +88,7 @@ export type { StepIndicatorProps, StepStatus, StepIndicatorLabels } from './Step
85
88
  export type { StepListProps, StepListItemProps, StepListLabels } from './StepList';
86
89
  export type { DataTableProps, DataTableLabels, BulkActionsBarLabels } from './Table';
87
90
  export type { TabsProps, TabsListProps, TabProps, TabPanelProps, TabsVariant, TabsActivationMode, TabsOrientation, } from './Tabs';
91
+ export type { CommandPaletteProps, CommandPaletteItemProps, CommandPaletteGroupProps, CommandPaletteLabelProps, CommandPaletteTriggerProps, CommandPaletteLabels, CommandPaletteStatus, CommandPaletteSelectDetail, CommandPaletteFilter, } from './CommandPalette';
88
92
  export type { SearchInputProps } from './SearchInput';
89
93
  export type { SliderProps } from './Slider';
90
94
  export type { SecretInputProps, SecretInputLabels } from './SecretInput';
@@ -19,6 +19,7 @@ export { MultiSelect, MultiSelectTrigger, MultiSelectContent, MultiSelectOption,
19
19
  export { Select, SelectTrigger, SelectContent, SelectOption, SelectGroup, SelectLabel, useSelect } from './Select/index.js';
20
20
  export { Icon } from './Icon/index.js';
21
21
  export { IconButton, defaultIconButtonLabels } from './IconButton/index.js';
22
+ export { IconTile } from './IconTile/index.js';
22
23
  export { Modal } from './Modal/index.js';
23
24
  export { MoveHandle } from './MoveHandle/index.js';
24
25
  export { Notice } from './Notice/index.js';
@@ -35,6 +36,7 @@ export { NavMenu, defaultNavMenuLabels } from './NavMenu/index.js';
35
36
  export { StepIndicator, defaultStepIndicatorLabels } from './StepIndicator/index.js';
36
37
  export { StepList, defaultStepListLabels } from './StepList/index.js';
37
38
  export { DataTable, BulkActionsBar, defaultDataTableLabels, defaultBulkActionsBarLabels } from './Table/index.js';
39
+ export { CommandPalette, CommandPaletteItem, CommandPaletteGroup, CommandPaletteLabel, CommandPaletteTrigger, defaultCommandPaletteLabels, } from './CommandPalette/index.js';
38
40
  export { SearchInput } from './SearchInput/index.js';
39
41
  export { SecretInput, defaultSecretInputLabels } from './SecretInput/index.js';
40
42
  export { SearchSelect, SearchSelectTrigger, SearchSelectContent, SearchSelectOption, SearchSelectGroup, SearchSelectLabel, useSearchSelect, } from './SearchSelect/index.js';