@tangible/ui 0.2.29 → 0.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Accordion/Accordion.js +2 -1
- package/components/Avatar/Avatar.js +6 -2
- package/components/Button/types.d.ts +5 -5
- package/components/Chip/Chip.js +2 -1
- package/components/ChipGroup/ChipGroup.js +1 -1
- package/components/ChipGroup/types.d.ts +2 -1
- package/components/Chips/Chips.d.ts +2 -0
- package/components/Chips/Chips.js +2 -16
- package/components/ColorPicker/ColorField.d.ts +3 -3
- package/components/ColorPicker/ColorField.js +2 -1
- package/components/ColorPicker/ColorPicker.js +2 -1
- package/components/ColorPicker/usePointerDrag.d.ts +7 -0
- package/components/ColorPicker/usePointerDrag.js +15 -1
- package/components/Combobox/Combobox.js +3 -2
- package/components/ContentIndicator/types.d.ts +3 -3
- package/components/DatePicker/Calendar.js +4 -3
- package/components/DatePicker/DatePicker.js +3 -2
- package/components/DatePicker/PickerTrigger.js +2 -1
- package/components/DatePicker/types.d.ts +1 -1
- package/components/GradientPicker/GradientBar.js +3 -1
- package/components/GradientPicker/GradientPicker.js +4 -3
- package/components/Icon/Icon.d.ts +9 -2
- package/components/Icon/Icon.js +4 -3
- package/components/Icon/index.d.ts +1 -1
- package/components/IconButton/IconButton.js +13 -45
- package/components/IconButton/IconButtonCore.d.ts +9 -0
- package/components/IconButton/IconButtonCore.js +76 -0
- package/components/IconButton/types.d.ts +4 -3
- package/components/Modal/Modal.js +3 -2
- package/components/MoveHandle/MoveHandle.js +3 -2
- package/components/MultiCombobox/MultiCombobox.js +3 -2
- package/components/MultiSelect/MultiSelect.js +3 -2
- package/components/NavMenu/NavMenu.js +2 -1
- package/components/NavMenu/types.d.ts +3 -3
- package/components/Notice/Notice.d.ts +7 -0
- package/components/Notice/Notice.js +6 -5
- package/components/Pager/Pager.js +5 -4
- package/components/Rating/Rating.js +2 -1
- package/components/SearchInput/SearchInput.js +3 -2
- package/components/SearchSelect/SearchSelect.js +3 -2
- package/components/SecretInput/SecretInput.js +3 -2
- package/components/Select/Select.js +3 -2
- package/components/Sidebar/Sidebar.js +2 -1
- package/components/StepIndicator/StepIndicator.js +4 -2
- package/components/StepIndicator/types.d.ts +2 -2
- package/components/StepList/types.d.ts +2 -2
- package/components/Tabs/types.d.ts +3 -3
- package/components/Toast/Toast.d.ts +5 -1
- package/components/Toast/Toast.js +3 -3
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +28 -6
- package/components/Tooltip/index.d.ts +1 -1
- package/components/Tooltip/types.d.ts +18 -0
- package/components/index.d.ts +2 -2
- package/figma-tokens.json +6 -4
- package/icons/cred/index.js +1 -0
- package/icons/icons.svg +7 -3
- package/icons/lms/index.d.ts +0 -3
- package/icons/lms/index.js +6 -33
- package/icons/manifest.json +71 -9
- package/icons/membersync/index.js +1 -0
- package/icons/player/index.js +1 -0
- package/icons/reaction/index.js +1 -0
- package/icons/registry.d.ts +14 -0
- package/icons/registry.js +7 -0
- package/icons/system/index.d.ts +11 -0
- package/icons/system/index.js +48 -0
- package/package.json +2 -1
- package/skills/building-with-tui/SKILL.md +201 -4
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +90 -13
- package/styles/all.expanded.unlayered.css +90 -13
- package/styles/all.unlayered.css +1 -1
- package/styles/app.css +41 -0
- package/styles/components/_bundle.scss +2 -0
- package/styles/components/button.scss +6 -1
- package/styles/components/card.scss +17 -1
- package/styles/components/chip-group.scss +45 -28
- package/styles/components/chips.scss +21 -0
- package/styles/components/color-picker.scss +15 -1
- package/styles/components/gradient-picker.scss +2 -2
- package/styles/components/tooltip.scss +8 -1
- package/styles/core.css +1 -1
- package/styles/core.unlayered.css +1 -1
- package/styles/system/_text-styles.scss +4 -0
- package/styles/system/_tokens.scss +7 -2
- package/styles/utilities/_index.scss +3 -0
- package/tui-manifest.json +40 -18
- package/vanilla/styles.css +1 -1
- package/vanilla/styles.unlayered.css +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect } from 'react';
|
|
3
|
+
import { cx } from '../../utils/cx.js';
|
|
4
|
+
import { Icon } from '../Icon/index.js';
|
|
5
|
+
import { getSafeRel } from '../../utils/polymorphic.js';
|
|
6
|
+
import { isDev } from '../../utils/is-dev.js';
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// IconButtonCore (@internal)
|
|
9
|
+
// =============================================================================
|
|
10
|
+
//
|
|
11
|
+
// IconButton without its tooltip, so it doesn't import Tooltip and
|
|
12
|
+
// @floating-ui (~39 KB min / 15 KB gzip). A module can't be tree-shaken on a
|
|
13
|
+
// prop value, so a static Tooltip import made every IconButton pay for it,
|
|
14
|
+
// including the many that never set `showTooltip` — Notice's dismiss ×,
|
|
15
|
+
// Calendar's month arrows.
|
|
16
|
+
//
|
|
17
|
+
// TUI components that never show the tooltip render this; eslint enforces the
|
|
18
|
+
// choice at each import (eslint.config.js). Consumers use IconButton, which
|
|
19
|
+
// wraps this and adds the tooltip when `showTooltip` is set. Not exported: a
|
|
20
|
+
// second public IconButton named after its implementation isn't an API. If
|
|
21
|
+
// consumers want the saving, the shape is a light IconButton they wrap in
|
|
22
|
+
// Tooltip themselves — a deliberate `showTooltip` deprecation, not this file.
|
|
23
|
+
//
|
|
24
|
+
// A component whose own props accept `showTooltip` (Sidebar.Toggle) must use
|
|
25
|
+
// IconButton: here the prop would do nothing. Stray tooltip props are dropped
|
|
26
|
+
// rather than reaching the DOM, with a dev warning.
|
|
27
|
+
//
|
|
28
|
+
// =============================================================================
|
|
29
|
+
export const IconButtonCore = forwardRef((props, ref) => {
|
|
30
|
+
const { icon, label, size = 'sm', theme = 'secondary', variant = 'ghost', disabled = false, loading = false, loadingLabel: loadingLabelProp, pressed, shape = 'square', className, ...restWithStray } = props;
|
|
31
|
+
const stray = restWithStray;
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
const { showTooltip: strayShowTooltip, tooltipSide: _tooltipSide, ...rest } = stray;
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (isDev() && strayShowTooltip) {
|
|
36
|
+
console.warn(`IconButtonCore ("${label}"): \`showTooltip\` does nothing here. A component that offers the tooltip must render IconButton.`);
|
|
37
|
+
}
|
|
38
|
+
}, [strayShowTooltip, label]);
|
|
39
|
+
const isLink = typeof rest.href === 'string';
|
|
40
|
+
const isDisabled = disabled || loading;
|
|
41
|
+
// Loading keeps focus (see Button): aria-disabled plus a click guard, never
|
|
42
|
+
// native `disabled` or a dropped href. Only explicit `disabled` goes native.
|
|
43
|
+
const loadingOnly = loading && !disabled;
|
|
44
|
+
const resolvedLabel = loading ? (loadingLabelProp ?? `${label}, loading`) : label;
|
|
45
|
+
const classes = cx('tui-icon-button', `is-size-${size}`, `is-theme-${theme}`, `is-style-${variant}`, isDisabled && 'is-disabled', shape === 'circle' && 'is-shape-circle', className);
|
|
46
|
+
const iconContent = (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon }), loading && _jsx("span", { className: "tui-icon-button__spinner", "aria-hidden": "true" })] }));
|
|
47
|
+
// Render the base element (button or anchor)
|
|
48
|
+
let element;
|
|
49
|
+
if (isLink) {
|
|
50
|
+
const { href, target, rel, tabIndex, onClick, ...anchorRest } = rest;
|
|
51
|
+
const safeRel = getSafeRel(target, rel);
|
|
52
|
+
const handleClick = (e) => {
|
|
53
|
+
if (isDisabled) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
onClick?.(e);
|
|
59
|
+
};
|
|
60
|
+
element = (_jsx("a", { ref: ref, href: disabled ? undefined : href, className: classes, "aria-label": resolvedLabel, "aria-disabled": isDisabled || undefined, "aria-busy": loading || undefined, tabIndex: disabled ? -1 : tabIndex, onClick: handleClick, target: target, rel: safeRel, ...anchorRest, children: iconContent }));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const { onClick, ...buttonRest } = rest;
|
|
64
|
+
const handleButtonClick = (e) => {
|
|
65
|
+
if (loadingOnly) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
onClick?.(e);
|
|
71
|
+
};
|
|
72
|
+
element = (_jsx("button", { ref: ref, type: buttonRest.type ?? 'button', className: classes, "aria-label": resolvedLabel, disabled: disabled, "aria-disabled": loadingOnly || undefined, "aria-busy": loading || undefined, "aria-pressed": pressed, onClick: handleButtonClick, ...buttonRest, children: iconContent }));
|
|
73
|
+
}
|
|
74
|
+
return element;
|
|
75
|
+
});
|
|
76
|
+
IconButtonCore.displayName = 'IconButtonCore';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IconSource } from '../Icon/Icon';
|
|
2
2
|
import type { Size, ThemeIntent, ThemeStatus } from '../../types';
|
|
3
3
|
export type { Size };
|
|
4
4
|
export type Theme = ThemeIntent | ThemeStatus;
|
|
@@ -6,10 +6,11 @@ export type Variant = 'solid' | 'outline' | 'ghost';
|
|
|
6
6
|
export type Shape = 'square' | 'circle';
|
|
7
7
|
type IconButtonBaseProps = {
|
|
8
8
|
/**
|
|
9
|
-
* Icon to display. Required — this is
|
|
9
|
+
* Icon to display: a registry path or an icon component. Required — this is
|
|
10
|
+
* the button's visual content.
|
|
10
11
|
* @example icon="system/close"
|
|
11
12
|
*/
|
|
12
|
-
icon:
|
|
13
|
+
icon: IconSource;
|
|
13
14
|
/**
|
|
14
15
|
* Accessible label. Required — icon-only buttons must have a label
|
|
15
16
|
* for screen readers since there's no visible text.
|
|
@@ -8,6 +8,7 @@ import { lockScroll, unlockScroll } from '../../utils/scroll-lock.js';
|
|
|
8
8
|
import { useFocusTrap, getInitialFocus } from '../../utils/focus-trap.js';
|
|
9
9
|
import { ModalContext, useModalContext } from './context.js';
|
|
10
10
|
import { IconButton } from '../IconButton/index.js';
|
|
11
|
+
import { Close as CloseIcon } from '../../icons/system/index.js';
|
|
11
12
|
const isBrowser = typeof document !== 'undefined';
|
|
12
13
|
function ModalRoot({ open, onClose, size = 'md', stickyHead, stickyFoot, 'aria-labelledby': labelledBy, 'aria-describedby': describedBy, role = 'dialog', initialFocusSelector, container, showCloseButton, closeLabel = 'Close', closeOnBackdropClick, closeOnEscape = true, preventScrollOnRestore = false, restoreFocusTo, className, children, ...rest }) {
|
|
13
14
|
const dialogRef = useRef(null);
|
|
@@ -238,11 +239,11 @@ function ModalRoot({ open, onClose, size = 'md', stickyHead, stickyFoot, 'aria-l
|
|
|
238
239
|
// Unmounts on the very next render (pre-paint), so it never lays anything out.
|
|
239
240
|
if (!mount)
|
|
240
241
|
return _jsx("span", { ref: anchorRef, hidden: true });
|
|
241
|
-
return createPortal(_jsx(ModalContext.Provider, { value: contextValue, children: _jsxs("div", { className: "tui-modal", "data-state": "open", style: { pointerEvents: 'auto' }, children: [_jsx("div", { className: "tui-modal__backdrop", "aria-hidden": "true", onClick: backdropDismisses ? onClose : undefined }), _jsxs("div", { ref: dialogRef, role: role, "aria-modal": "true", "aria-labelledby": labelledBy, "aria-describedby": describedBy, className: cx('tui-modal__dialog', `is-size-${size}`, stickyHead && 'is-sticky-head', stickyFoot && 'is-sticky-foot', className), tabIndex: -1, ...rest, children: [children, showCloseButton && (_jsx(IconButton, { icon:
|
|
242
|
+
return createPortal(_jsx(ModalContext.Provider, { value: contextValue, children: _jsxs("div", { className: "tui-modal", "data-state": "open", style: { pointerEvents: 'auto' }, children: [_jsx("div", { className: "tui-modal__backdrop", "aria-hidden": "true", onClick: backdropDismisses ? onClose : undefined }), _jsxs("div", { ref: dialogRef, role: role, "aria-modal": "true", "aria-labelledby": labelledBy, "aria-describedby": describedBy, className: cx('tui-modal__dialog', `is-size-${size}`, stickyHead && 'is-sticky-head', stickyFoot && 'is-sticky-foot', className), tabIndex: -1, ...rest, children: [children, showCloseButton && (_jsx(IconButton, { icon: CloseIcon, label: closeLabel, variant: "ghost", size: "sm", onClick: onClose, className: "tui-modal__close", showTooltip: true }))] })] }) }), mount);
|
|
242
243
|
}
|
|
243
244
|
function ModalClose({ label = 'Close', className }) {
|
|
244
245
|
const { onClose } = useModalContext();
|
|
245
|
-
return (_jsx(IconButton, { icon:
|
|
246
|
+
return (_jsx(IconButton, { icon: CloseIcon, label: label, variant: "ghost", size: "sm", onClick: onClose, className: cx('tui-modal__close', className), showTooltip: true }));
|
|
246
247
|
}
|
|
247
248
|
ModalClose.displayName = 'Modal.Close';
|
|
248
249
|
function ModalHead({ className, children, subtitle, icon, ...rest }) {
|
|
@@ -3,6 +3,7 @@ import { forwardRef, memo, useCallback, useEffect, useId, useRef, useState } fro
|
|
|
3
3
|
import { cx } from '../../utils/cx.js';
|
|
4
4
|
import { isDev } from '../../utils/is-dev.js';
|
|
5
5
|
import { Icon } from '../Icon/index.js';
|
|
6
|
+
import { ChevronDown as ChevronDownIcon, ChevronUp as ChevronUpIcon, Drag as DragIcon, HandleAlt as HandleAltIcon, LockFill as LockFillIcon } from '../../icons/system/index.js';
|
|
6
7
|
// =============================================================================
|
|
7
8
|
// MoveHandle Component
|
|
8
9
|
// =============================================================================
|
|
@@ -97,7 +98,7 @@ export const MoveHandle = memo(forwardRef(function MoveHandle({ mode = 'full', s
|
|
|
97
98
|
// Uses ref directly (not mergedRef) — innerRef is unused for this path.
|
|
98
99
|
// Focus recovery and dev warning effects early-return for handle mode.
|
|
99
100
|
if (mode === 'handle') {
|
|
100
|
-
return (_jsx("button", { ref: ref, type: "button", className: cx('tui-move-handle', 'is-handle', `is-size-${size}`, className), "aria-label": resolvedDragLabel, ...restDragProps, children: _jsx(Icon, { name:
|
|
101
|
+
return (_jsx("button", { ref: ref, type: "button", className: cx('tui-move-handle', 'is-handle', `is-size-${size}`, className), "aria-label": resolvedDragLabel, ...restDragProps, children: _jsx(Icon, { name: DragIcon }) }));
|
|
101
102
|
}
|
|
102
103
|
// ----- Full / arrows mode -----
|
|
103
104
|
const isArrows = mode === 'arrows';
|
|
@@ -113,5 +114,5 @@ export const MoveHandle = memo(forwardRef(function MoveHandle({ mode = 'full', s
|
|
|
113
114
|
return (_jsxs("div", { ref: mergedRef, role: "group", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": locked ? lockedDescId : undefined, "aria-disabled": locked || undefined,
|
|
114
115
|
// Focus-recovery target for arrows mode (see the effect above). Not in
|
|
115
116
|
// the tab order; only reached programmatically.
|
|
116
|
-
tabIndex: isArrows ? -1 : undefined, className: cx('tui-move-handle', `is-size-${size}`, isArrows && 'is-arrows', locked && 'is-locked', hasIndex && 'has-index', className), children: [locked && (_jsx("span", { id: lockedDescId, className: "tui-visually-hidden", children: resolvedLockedDesc })), onMoveUp && (_jsx("button", { type: "button", className: "tui-move-handle__up", "data-direction": "up", "aria-label": labels?.moveUp ?? 'Move up', disabled: locked || !canMoveUp, onClick: onMoveUp, children: _jsx(Icon, { name:
|
|
117
|
+
tabIndex: isArrows ? -1 : undefined, className: cx('tui-move-handle', `is-size-${size}`, isArrows && 'is-arrows', locked && 'is-locked', hasIndex && 'has-index', className), children: [locked && (_jsx("span", { id: lockedDescId, className: "tui-visually-hidden", children: resolvedLockedDesc })), onMoveUp && (_jsx("button", { type: "button", className: "tui-move-handle__up", "data-direction": "up", "aria-label": labels?.moveUp ?? 'Move up', disabled: locked || !canMoveUp, onClick: onMoveUp, children: _jsx(Icon, { name: ChevronUpIcon }) })), showCenter && isArrows && (_jsx("div", { className: "tui-move-handle__center", children: _jsx("span", { className: "tui-move-handle__index", "aria-hidden": "true", children: index }) })), showCenter && !isArrows && (_jsx("div", { className: "tui-move-handle__center", children: showLockIcon ? (_jsx("span", { className: "tui-move-handle__lock", "aria-hidden": "true", children: _jsx(Icon, { name: LockFillIcon }) })) : (_jsxs(_Fragment, { children: [hasIndex && (_jsx("span", { className: "tui-move-handle__index", "aria-hidden": "true", children: index })), _jsx("button", { type: "button", className: "tui-move-handle__handle", "data-role": "drag-handle", "aria-label": resolvedDragLabel, tabIndex: hasArrows ? -1 : 0, ...restDragProps, children: _jsx(Icon, { name: HandleAltIcon }) })] })) })), onMoveDown && (_jsx("button", { type: "button", className: "tui-move-handle__down", "data-direction": "down", "aria-label": labels?.moveDown ?? 'Move down', disabled: locked || !canMoveDown, onClick: onMoveDown, children: _jsx(Icon, { name: ChevronDownIcon }) }))] }));
|
|
117
118
|
}));
|
|
@@ -10,6 +10,7 @@ import { Icon } from '../Icon/index.js';
|
|
|
10
10
|
import { Chip } from '../Chip/index.js';
|
|
11
11
|
import { MultiComboboxActionsContext, MultiComboboxStateContext, MultiComboboxContentContext, useMultiComboboxContext, useMultiComboboxContentContext, } from './MultiComboboxContext.js';
|
|
12
12
|
import { defaultMultiComboboxLabels } from './types.js';
|
|
13
|
+
import { Check as CheckIcon, ChevronDown as ChevronDownIcon, Close as CloseIcon } from '../../icons/system/index.js';
|
|
13
14
|
// Stable empty value so an unset controlled `value` doesn't churn identity
|
|
14
15
|
// (which would re-run isSelected/state memos every render).
|
|
15
16
|
const EMPTY_VALUE = [];
|
|
@@ -389,7 +390,7 @@ function MultiComboboxRoot({ value: controlledValue, defaultValue, onValueChange
|
|
|
389
390
|
return (_jsx(Chip, { className: "tui-multicombobox__chip", disabled: disabled, removeLabel: labels.remove(label), onRemove: () => removeValue(v), children: label }, toKey(v)));
|
|
390
391
|
}), _jsx("input", { ref: (node) => {
|
|
391
392
|
inputRef.current = node;
|
|
392
|
-
}, type: "text", id: inputId, className: cx('tui-multicombobox__input', inputClassName), role: "combobox", "aria-expanded": open, "aria-controls": open ? listboxId : undefined, "aria-autocomplete": "list", "aria-activedescendant": activeOptionId, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, disabled: disabled, placeholder: hasValue ? undefined : placeholder, value: inputValue, autoComplete: "off", ...referenceProps, onChange: handleInputChange })] }), clearable && hasValue && !disabled && (_jsx("button", { type: "button", className: "tui-multicombobox__clear", onClick: handleClear, onMouseDown: (e) => e.preventDefault(), "aria-label": labels.clear, tabIndex: -1, children: _jsx(Icon, { name:
|
|
393
|
+
}, type: "text", id: inputId, className: cx('tui-multicombobox__input', inputClassName), role: "combobox", "aria-expanded": open, "aria-controls": open ? listboxId : undefined, "aria-autocomplete": "list", "aria-activedescendant": activeOptionId, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, disabled: disabled, placeholder: hasValue ? undefined : placeholder, value: inputValue, autoComplete: "off", ...referenceProps, onChange: handleInputChange })] }), clearable && hasValue && !disabled && (_jsx("button", { type: "button", className: "tui-multicombobox__clear", onClick: handleClear, onMouseDown: (e) => e.preventDefault(), "aria-label": labels.clear, tabIndex: -1, children: _jsx(Icon, { name: CloseIcon }) })), _jsx("span", { className: "tui-multicombobox__icon", "aria-hidden": "true", children: _jsx(Icon, { name: ChevronDownIcon }) })] }), children, _jsx("div", { className: "tui-visually-hidden", role: "status", children: labels.status(value.length, max) })] }) }) }));
|
|
393
394
|
}
|
|
394
395
|
MultiComboboxRoot.displayName = 'MultiCombobox';
|
|
395
396
|
// =============================================================================
|
|
@@ -457,7 +458,7 @@ function MultiComboboxOptionComponent({ value: optionValue, disabled = false, te
|
|
|
457
458
|
const itemProps = getItemProps({
|
|
458
459
|
onClick: handleClick,
|
|
459
460
|
});
|
|
460
|
-
return (_jsxs("div", { ref: ref, id: optionId, role: "option", className: cx('tui-multicombobox__option', className), "aria-selected": selected, "aria-disabled": blocked || undefined, "data-highlighted": isHighlighted || undefined, "data-disabled": blocked || undefined, "data-selected": selected || undefined, ...itemProps, onPointerDown: composeEventHandlers(handlePointerDown, itemProps.onPointerDown), children: [_jsx("span", { className: "tui-multicombobox__option-check", "aria-hidden": "true", children: selected && _jsx(Icon, { name:
|
|
461
|
+
return (_jsxs("div", { ref: ref, id: optionId, role: "option", className: cx('tui-multicombobox__option', className), "aria-selected": selected, "aria-disabled": blocked || undefined, "data-highlighted": isHighlighted || undefined, "data-disabled": blocked || undefined, "data-selected": selected || undefined, ...itemProps, onPointerDown: composeEventHandlers(handlePointerDown, itemProps.onPointerDown), children: [_jsx("span", { className: "tui-multicombobox__option-check", "aria-hidden": "true", children: selected && _jsx(Icon, { name: CheckIcon }) }), _jsx("span", { className: "tui-multicombobox__option-content", children: children })] }));
|
|
461
462
|
}
|
|
462
463
|
MultiComboboxOptionComponent.displayName = 'MultiCombobox.Option';
|
|
463
464
|
// =============================================================================
|
|
@@ -9,6 +9,7 @@ import { Icon } from '../Icon/index.js';
|
|
|
9
9
|
import { Chip } from '../Chip/index.js';
|
|
10
10
|
import { MultiSelectActionsContext, MultiSelectStateContext, MultiSelectContentContext, useMultiSelectContext, useMultiSelectContentContext, } from './MultiSelectContext.js';
|
|
11
11
|
import { toKey, defaultMultiSelectLabels, } from './types.js';
|
|
12
|
+
import { Check as CheckIcon, ChevronDown as ChevronDownIcon, Close as CloseIcon } from '../../icons/system/index.js';
|
|
12
13
|
// =============================================================================
|
|
13
14
|
// MultiSelect Root
|
|
14
15
|
// =============================================================================
|
|
@@ -368,7 +369,7 @@ function MultiSelectTriggerComponent({ asChild = false, className, children, })
|
|
|
368
369
|
return (_jsxs("span", { className: "tui-multiselect__chips", children: [visibleChips.map((opt) => (_jsx(Chip, { className: "tui-multiselect__chip", children: opt.textValue }, toKey(opt.value)))), overflow > 0 && (_jsx("span", { className: "tui-multiselect__more", children: labels.more(overflow) }))] }));
|
|
369
370
|
};
|
|
370
371
|
// Default trigger content (when not using asChild or custom children)
|
|
371
|
-
const defaultTriggerContent = (_jsxs(_Fragment, { children: [_jsx("span", { className: "tui-multiselect__value", children: renderTriggerContent() }), hasSelection && (_jsx("span", { className: "tui-multiselect__clear", onClick: handleClearClick, "aria-hidden": "true", children: _jsx(Icon, { name:
|
|
372
|
+
const defaultTriggerContent = (_jsxs(_Fragment, { children: [_jsx("span", { className: "tui-multiselect__value", children: renderTriggerContent() }), hasSelection && (_jsx("span", { className: "tui-multiselect__clear", onClick: handleClearClick, "aria-hidden": "true", children: _jsx(Icon, { name: CloseIcon }) })), _jsx(Icon, { name: ChevronDownIcon, className: "tui-multiselect__icon", "aria-hidden": "true" })] }));
|
|
372
373
|
// Generate status message for screen readers
|
|
373
374
|
const statusMessage = labels.status(selectedOptions.length, max);
|
|
374
375
|
// Live region (rendered outside button, sibling to trigger)
|
|
@@ -544,7 +545,7 @@ function MultiSelectOptionComponent({ value: optionValue, disabled = false, text
|
|
|
544
545
|
return (_jsxs("div", { ref: ref, id: optionIdForIndex(listboxId, index), role: "option", className: cx('tui-multiselect__option', className), "aria-selected": selected, "aria-disabled": !isSelectable || undefined, "data-highlighted": isHighlighted || undefined, "data-disabled": disabled || undefined, "data-blocked": isBlocked || undefined, ...getItemProps({
|
|
545
546
|
onClick: isSelectable ? handleClick : undefined,
|
|
546
547
|
onPointerDown: handlePointerDown,
|
|
547
|
-
}), children: [_jsx("span", { className: cx('tui-multiselect__checkbox', selected && 'is-checked'), "aria-hidden": "true", children: selected && _jsx(Icon, { name:
|
|
548
|
+
}), children: [_jsx("span", { className: cx('tui-multiselect__checkbox', selected && 'is-checked'), "aria-hidden": "true", children: selected && _jsx(Icon, { name: CheckIcon, size: "xs" }) }), _jsx("span", { className: "tui-multiselect__option-content", children: children })] }));
|
|
548
549
|
}
|
|
549
550
|
MultiSelectOptionComponent.displayName = 'MultiSelect.Option';
|
|
550
551
|
// =============================================================================
|
|
@@ -8,6 +8,7 @@ import { composeRefs, getElementRef } from '../../utils/compose-refs.js';
|
|
|
8
8
|
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
|
+
import { ChevronDownSmall as ChevronDownSmallIcon } from '../../icons/system/index.js';
|
|
11
12
|
// Hover intent and warmth come from utils/hover-intent (shared with tooltips).
|
|
12
13
|
// A panel opens when the pointer settles, not after a fixed delay; once the
|
|
13
14
|
// bar is warm (a panel open, or one closed within PRIMED_WINDOW) the next
|
|
@@ -349,7 +350,7 @@ const NavMenuItem = forwardRef(function NavMenuItem(props, ref) {
|
|
|
349
350
|
// name ("Inbox 3 unread", not "Inbox3 unread"). A flex container doesn't
|
|
350
351
|
// render whitespace-only text, so layout is unaffected.
|
|
351
352
|
const content = (inner) => (_jsxs(_Fragment, { children: [leading, leading && prefix != null && ' ', _jsx("span", { className: "tui-nav-menu__label", id: flyout ? labelId : undefined, children: inner }), suffix != null && (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "tui-nav-menu__suffix", ref: suffixRef, children: suffix })] }))] }));
|
|
352
|
-
const chevron = (_jsx("span", { className: "tui-nav-menu__chevron", "aria-hidden": "true", children: _jsx(Icon, { name:
|
|
353
|
+
const chevron = (_jsx("span", { className: "tui-nav-menu__chevron", "aria-hidden": "true", children: _jsx(Icon, { name: ChevronDownSmallIcon }) }));
|
|
353
354
|
let row;
|
|
354
355
|
// A flyout parent with no destination of its own: the row IS the toggle.
|
|
355
356
|
const rowIsToggle = flyout && !asChild && props.href === undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IconSource } from '../Icon/Icon';
|
|
3
3
|
export type NavMenuOrientation = 'vertical' | 'horizontal';
|
|
4
4
|
export type NavMenuFlyoutTrigger = 'click' | 'hover';
|
|
5
5
|
/** Visually hidden strings, for localisation. */
|
|
@@ -71,8 +71,8 @@ export type NavMenuCurrent = boolean | 'page' | 'step' | 'location' | 'date' | '
|
|
|
71
71
|
type NavMenuItemBaseProps = {
|
|
72
72
|
/** Marks the current item; see {@link NavMenuCurrent}. */
|
|
73
73
|
current?: NavMenuCurrent;
|
|
74
|
-
/** Leading icon
|
|
75
|
-
icon?:
|
|
74
|
+
/** Leading icon: a registry path or an icon component. Sized by `--tui-nav-menu-icon-size`. */
|
|
75
|
+
icon?: IconSource;
|
|
76
76
|
/**
|
|
77
77
|
* Custom leading content in the icon's place (an avatar, a glyph not in the
|
|
78
78
|
* registry). Replaces `icon` when both are set. Unlike `icon`, it isn't
|
|
@@ -48,6 +48,13 @@ export type NoticeProps<TAs extends RootAs = 'section'> = CommonProps & {
|
|
|
48
48
|
dismissible?: boolean;
|
|
49
49
|
onDismiss?: () => void;
|
|
50
50
|
dismissLabel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Announced to screen readers after the dismiss button removes the notice
|
|
53
|
+
* (not on a programmatic `exit()`). Default 'Notification dismissed'.
|
|
54
|
+
* Override it to translate. If Notice gains more built-in strings, move
|
|
55
|
+
* this and `dismissLabel` into a `labels` object together.
|
|
56
|
+
*/
|
|
57
|
+
dismissedMessage?: string;
|
|
51
58
|
/**
|
|
52
59
|
* Exit animation to play when dismissed.
|
|
53
60
|
* - none: onDismiss called immediately (default)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { forwardRef, useId, useMemo, useState, useRef, useImperativeHandle, useCallback, useEffect, useLayoutEffect, useContext, createContext } from 'react';
|
|
3
3
|
import { cx } from '../../utils/cx.js';
|
|
4
|
-
import {
|
|
4
|
+
import { IconButtonCore } from '../IconButton/IconButtonCore.js';
|
|
5
|
+
import { Close as CloseIcon } from '../../icons/system/index.js';
|
|
5
6
|
const NoticeContext = createContext(null);
|
|
6
7
|
/** Check if user prefers reduced motion */
|
|
7
8
|
function prefersReducedMotion() {
|
|
@@ -9,7 +10,7 @@ function prefersReducedMotion() {
|
|
|
9
10
|
return false;
|
|
10
11
|
return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
11
12
|
}
|
|
12
|
-
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', exitAnimation = 'none', focusable, children, ...rest }, ref) {
|
|
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) {
|
|
13
14
|
const Tag = as;
|
|
14
15
|
const innerRef = useRef(null);
|
|
15
16
|
const [isExiting, setIsExiting] = useState(false);
|
|
@@ -87,10 +88,10 @@ export const Notice = forwardRef(function Notice({ as = 'section', inline, eleva
|
|
|
87
88
|
el.style.cssText =
|
|
88
89
|
'position:absolute;width:1px;height:1px;padding:0;margin:-1px;' +
|
|
89
90
|
'overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;';
|
|
90
|
-
el.textContent =
|
|
91
|
+
el.textContent = dismissedMessage;
|
|
91
92
|
document.body.appendChild(el);
|
|
92
93
|
setTimeout(() => el.remove(), 1000);
|
|
93
|
-
}, []);
|
|
94
|
+
}, [dismissedMessage]);
|
|
94
95
|
// Handle dismiss button click
|
|
95
96
|
const handleDismiss = useCallback(async () => {
|
|
96
97
|
if (disabled)
|
|
@@ -128,7 +129,7 @@ export const Notice = forwardRef(function Notice({ as = 'section', inline, eleva
|
|
|
128
129
|
const computedAriaLabel = hasTitle ? undefined : (ariaLabel || undefined);
|
|
129
130
|
const classes = cx('tui-notice', `is-theme-${theme}`, size && size !== 'md' && `is-size-${size}`, inline && 'is-layout-inline', elevated && 'is-style-elevated', interactive && 'has-interaction', disabled && 'is-disabled', stripe && 'has-stripe', dismissible && 'is-dismissible', focusable && 'is-focusable', isExiting && exitType && `is-exiting-${exitType}`, className);
|
|
130
131
|
// Dismiss button component
|
|
131
|
-
const dismissButton = dismissible && (_jsx(
|
|
132
|
+
const dismissButton = dismissible && (_jsx(IconButtonCore, { icon: CloseIcon, label: dismissLabel, size: "sm", variant: "ghost", className: "tui-notice__dismiss", onClick: (e) => {
|
|
132
133
|
e.stopPropagation();
|
|
133
134
|
handleDismiss();
|
|
134
135
|
}, disabled: disabled || isExiting }));
|
|
@@ -4,6 +4,7 @@ import { cx } from '../../utils/cx.js';
|
|
|
4
4
|
import { Button } from '../Button/index.js';
|
|
5
5
|
import { IconButton } from '../IconButton/index.js';
|
|
6
6
|
import { defaultPagerLabels } from './types.js';
|
|
7
|
+
import { ChevronLeft as ChevronLeftIcon, ChevronLeftDouble as ChevronLeftDoubleIcon, ChevronRight as ChevronRightIcon, ChevronRightDouble as ChevronRightDoubleIcon } from '../../icons/system/index.js';
|
|
7
8
|
// =============================================================================
|
|
8
9
|
// Pager Component
|
|
9
10
|
// =============================================================================
|
|
@@ -23,10 +24,10 @@ const DEFAULT_MAX_SLOTS = 7;
|
|
|
23
24
|
* would not have been.
|
|
24
25
|
*/
|
|
25
26
|
const NAV_ICONS = {
|
|
26
|
-
first:
|
|
27
|
-
prev:
|
|
28
|
-
next:
|
|
29
|
-
last:
|
|
27
|
+
first: ChevronLeftDoubleIcon,
|
|
28
|
+
prev: ChevronLeftIcon,
|
|
29
|
+
next: ChevronRightIcon,
|
|
30
|
+
last: ChevronRightDoubleIcon,
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
32
33
|
* Build a stable-width list of page tokens (numbers + ellipses).
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { cx } from '../../utils/cx.js';
|
|
4
4
|
import { Icon } from '../Icon/index.js';
|
|
5
5
|
import { defaultRatingLabels } from './types.js';
|
|
6
|
+
import { StarFill as StarFillIcon, StarOutline as StarOutlineIcon } from '../../icons/system/index.js';
|
|
6
7
|
export function Rating({ value, defaultValue = 0, max = 5, disabled, readOnly, name, size = 'lg', theme = 'secondary', onValueChange, allowClear, className, gap, 'aria-label': ariaLabel, labels: labelsProp, }) {
|
|
7
8
|
const isControlled = value != null;
|
|
8
9
|
const [internal, setInternal] = React.useState(defaultValue);
|
|
@@ -73,6 +74,6 @@ export function Rating({ value, defaultValue = 0, max = 5, disabled, readOnly, n
|
|
|
73
74
|
const n = i + 1;
|
|
74
75
|
const checked = current >= n;
|
|
75
76
|
const id = `${groupName}__star-${n}`;
|
|
76
|
-
return (_jsxs("div", { className: "tui-rating__item", children: [!readOnly && (_jsx("input", { className: "tui-visually-hidden", type: "radio", id: id, name: groupName, value: n, checked: current === n, tabIndex: n === focusableIndex ? 0 : -1, onChange: () => handleSelect(n), disabled: disabled })), readOnly ? (_jsx("span", { className: cx('tui-rating__star', checked && 'is-active'), children: _jsx(Icon, { name: checked ?
|
|
77
|
+
return (_jsxs("div", { className: "tui-rating__item", children: [!readOnly && (_jsx("input", { className: "tui-visually-hidden", type: "radio", id: id, name: groupName, value: n, checked: current === n, tabIndex: n === focusableIndex ? 0 : -1, onChange: () => handleSelect(n), disabled: disabled })), readOnly ? (_jsx("span", { className: cx('tui-rating__star', checked && 'is-active'), children: _jsx(Icon, { name: checked ? StarFillIcon : StarOutlineIcon }) })) : (_jsxs("label", { className: cx('tui-rating__star', checked && 'is-active'), htmlFor: id, tabIndex: -1, children: [_jsx(Icon, { name: checked ? StarFillIcon : StarOutlineIcon }), _jsx("span", { className: "tui-visually-hidden", children: labels.value(n, max) })] }))] }, n));
|
|
77
78
|
}) }));
|
|
78
79
|
}
|
|
@@ -5,6 +5,7 @@ import { composeRefs } from '../../utils/compose-refs.js';
|
|
|
5
5
|
import { useControllableState } from '../../utils/use-controllable-state.js';
|
|
6
6
|
import { Icon } from '../Icon/index.js';
|
|
7
7
|
import { TextInput } from '../TextInput/index.js';
|
|
8
|
+
import { CloseSmall as CloseSmallIcon, Search as SearchIcon } from '../../icons/system/index.js';
|
|
8
9
|
// =============================================================================
|
|
9
10
|
// SearchInput Component
|
|
10
11
|
// =============================================================================
|
|
@@ -52,7 +53,7 @@ export const SearchInput = forwardRef(function SearchInput({ value: valueProp, d
|
|
|
52
53
|
const clearable = !hideClear && !disabled;
|
|
53
54
|
// Whether the button is currently shown (there's something to clear).
|
|
54
55
|
const showClear = clearable && value.length > 0;
|
|
55
|
-
const icon = searchIcon ?? _jsx(Icon, { name:
|
|
56
|
+
const icon = searchIcon ?? _jsx(Icon, { name: SearchIcon });
|
|
56
57
|
// With onSearch the leading icon is the submit control; otherwise it stays a
|
|
57
58
|
// decorative glyph (Icon renders decorative-by-default with no `label`).
|
|
58
59
|
const prefix = onSearch && !disabled ? (_jsx("button", { type: "button", className: "tui-search-input__submit", "aria-label": searchLabel, onClick: submit,
|
|
@@ -72,5 +73,5 @@ export const SearchInput = forwardRef(function SearchInput({ value: valueProp, d
|
|
|
72
73
|
// the input never reflows as the button appears/disappears.
|
|
73
74
|
// `visibility: hidden` (vs. unmounting) also drops the empty-state
|
|
74
75
|
// button from the tab order and the a11y tree.
|
|
75
|
-
style: showClear ? undefined : { visibility: 'hidden' }, children: _jsx(Icon, { name:
|
|
76
|
+
style: showClear ? undefined : { visibility: 'hidden' }, children: _jsx(Icon, { name: CloseSmallIcon }) })) : undefined }));
|
|
76
77
|
});
|
|
@@ -9,6 +9,7 @@ import { Icon } from '../Icon/index.js';
|
|
|
9
9
|
import { SearchInput } from '../SearchInput/index.js';
|
|
10
10
|
import { SearchSelectContext, SearchSelectContentContext, useSearchSelectContext, useSearchSelectContentContext, } from './SearchSelectContext.js';
|
|
11
11
|
import { defaultSearchSelectLabels, } from './types.js';
|
|
12
|
+
import { Check as CheckIcon, ChevronDown as ChevronDownIcon } from '../../icons/system/index.js';
|
|
12
13
|
// Default filter: case-insensitive substring on textValue.
|
|
13
14
|
const defaultFilter = (textValue, query) => textValue.toLowerCase().includes(query.trim().toLowerCase());
|
|
14
15
|
// =============================================================================
|
|
@@ -324,7 +325,7 @@ function SearchSelectTriggerComponent({ className, children, onClick: onClickPro
|
|
|
324
325
|
pointerDownFix(e);
|
|
325
326
|
}, [onPointerDownProp, pointerDownFix]);
|
|
326
327
|
return (_jsxs("button", { ...rest, ref: handleRef, type: "button", id: triggerId, className: cx('tui-input-group', 'tui-search-select__trigger', size !== 'md' && `is-size-${size}`, className), disabled: disabled, "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? panelId : undefined, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${valueId}` : undefined, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "data-state": open ? 'open' : 'closed', onClick: handleClick, onKeyDown: handleKeyDown, onPointerDown: handlePointerDown, children: [_jsx("span", { id: valueId, className: "tui-search-select__value", children: children ??
|
|
327
|
-
(hasValue ? (labelFor(value)) : (_jsx("span", { className: "tui-search-select__placeholder", children: placeholder }))) }), _jsx(Icon, { name:
|
|
328
|
+
(hasValue ? (labelFor(value)) : (_jsx("span", { className: "tui-search-select__placeholder", children: placeholder }))) }), _jsx(Icon, { name: ChevronDownIcon, className: "tui-search-select__icon" })] }));
|
|
328
329
|
}
|
|
329
330
|
SearchSelectTriggerComponent.displayName = 'SearchSelect.Trigger';
|
|
330
331
|
// =============================================================================
|
|
@@ -438,7 +439,7 @@ function SearchSelectOptionComponent({ value: optionValue, disabled = false, tex
|
|
|
438
439
|
return (_jsxs("div", { ref: ref, id: optionIdForValue(listboxId, optionValue), role: "option", className: cx('tui-search-select__option', className), "aria-selected": isSelected, "aria-disabled": disabled || undefined, "data-highlighted": isHighlighted || undefined, "data-disabled": disabled || undefined, ...getItemProps({
|
|
439
440
|
onClick: handleClick,
|
|
440
441
|
onPointerDown: handlePointerDown,
|
|
441
|
-
}), children: [_jsx("span", { className: "tui-search-select__option-content", children: children }), isSelected && _jsx(Icon, { name:
|
|
442
|
+
}), children: [_jsx("span", { className: "tui-search-select__option-content", children: children }), isSelected && _jsx(Icon, { name: CheckIcon, className: "tui-search-select__option-check" })] }));
|
|
442
443
|
}
|
|
443
444
|
SearchSelectOptionComponent.displayName = 'SearchSelect.Option';
|
|
444
445
|
// =============================================================================
|
|
@@ -6,6 +6,7 @@ import { isDev } from '../../utils/is-dev.js';
|
|
|
6
6
|
import { Icon } from '../Icon/index.js';
|
|
7
7
|
import { TextInput } from '../TextInput/index.js';
|
|
8
8
|
import { defaultSecretInputLabels } from './types.js';
|
|
9
|
+
import { LockSmall as LockSmallIcon, View as ViewIcon, ViewOff as ViewOffIcon } from '../../icons/system/index.js';
|
|
9
10
|
// =============================================================================
|
|
10
11
|
// SecretInput Component
|
|
11
12
|
// =============================================================================
|
|
@@ -140,7 +141,7 @@ export const SecretInput = forwardRef(function SecretInput({ isSet = false, reve
|
|
|
140
141
|
// tui-input-reset strips native in-field chrome — here Edge's own
|
|
141
142
|
// ::-ms-reveal eye, which would sit beside our toggle AND unmask the
|
|
142
143
|
// field without changing `type`, so the toggle's state would be wrong.
|
|
143
|
-
inputClassName: cx('tui-input-reset', 'tui-secret-input__input', inputClassName), suffix: _jsxs(_Fragment, { children: [describeSetState && (_jsx("span", { id: setDescId, className: "tui-visually-hidden", children: text.valueSetDescription })), locked ? (_jsxs(_Fragment, { children: [_jsx("span", { id: lockedDescId, className: "tui-visually-hidden", children: lockedMessage ?? text.locked }), _jsx(Icon, { name:
|
|
144
|
+
inputClassName: cx('tui-input-reset', 'tui-secret-input__input', inputClassName), suffix: _jsxs(_Fragment, { children: [describeSetState && (_jsx("span", { id: setDescId, className: "tui-visually-hidden", children: text.valueSetDescription })), locked ? (_jsxs(_Fragment, { children: [_jsx("span", { id: lockedDescId, className: "tui-visually-hidden", children: lockedMessage ?? text.locked }), _jsx(Icon, { name: LockSmallIcon, className: "tui-secret-input__lock" })] })) : (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "tui-secret-input__reveal", "aria-label": revealed ? text.hide : text.reveal, "data-revealed": revealed ? 'true' : undefined, disabled: disabled, onClick: handleToggleClick,
|
|
144
145
|
// Keep pointerdown from stealing focus before the click fires.
|
|
145
|
-
onPointerDown: (e) => e.preventDefault(), children: _jsx(Icon, { name: revealed ?
|
|
146
|
+
onPointerDown: (e) => e.preventDefault(), children: _jsx(Icon, { name: revealed ? ViewOffIcon : ViewIcon }) }), _jsx("span", { role: "status", "aria-live": "polite", className: "tui-visually-hidden", children: announcement })] }))] }) }));
|
|
146
147
|
});
|
|
@@ -9,6 +9,7 @@ import { useOptionRegistry, useOptionRegistration, useListboxIds, useListboxFloa
|
|
|
9
9
|
import { Icon } from '../Icon/index.js';
|
|
10
10
|
import { SelectContext, SelectContentContext, useSelectContext, useSelectContentContext, } from './SelectContext.js';
|
|
11
11
|
import { toPlacement, } from './types.js';
|
|
12
|
+
import { Check as CheckIcon, ChevronDown as ChevronDownIcon, Close as CloseIcon } from '../../icons/system/index.js';
|
|
12
13
|
// =============================================================================
|
|
13
14
|
// Select Root
|
|
14
15
|
// =============================================================================
|
|
@@ -348,7 +349,7 @@ function SelectTriggerComponent({ asChild = false, className, children, }) {
|
|
|
348
349
|
// Wrap in a relative container so the clear button can be a sibling of the
|
|
349
350
|
// trigger <button> — nesting <button> inside <button> is invalid HTML and
|
|
350
351
|
// causes browsers to eject the inner button via the adoption agency algorithm.
|
|
351
|
-
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:
|
|
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 }) }))] }));
|
|
352
353
|
}
|
|
353
354
|
SelectTriggerComponent.displayName = 'Select.Trigger';
|
|
354
355
|
// =============================================================================
|
|
@@ -414,7 +415,7 @@ function SelectOptionComponent({ value: optionValue, disabled = false, textValue
|
|
|
414
415
|
}, [disabled, optionValue, textValue, setValue, setOpen]);
|
|
415
416
|
return (_jsxs("div", { ref: ref, id: optionIdForIndex(listboxId, index), role: "option", className: cx('tui-select__option', className), "aria-selected": isSelected, "aria-disabled": disabled || undefined, "data-highlighted": isHighlighted || undefined, "data-disabled": disabled || undefined, ...getItemProps({
|
|
416
417
|
onClick: handleClick,
|
|
417
|
-
}), children: [_jsx("span", { className: "tui-select__option-content", children: children }), isSelected && (_jsx(Icon, { name:
|
|
418
|
+
}), children: [_jsx("span", { className: "tui-select__option-content", children: children }), isSelected && (_jsx(Icon, { name: CheckIcon, className: "tui-select__option-check", "aria-hidden": "true" }))] }));
|
|
418
419
|
}
|
|
419
420
|
SelectOptionComponent.displayName = 'Select.Option';
|
|
420
421
|
// =============================================================================
|
|
@@ -5,6 +5,7 @@ import { useFocusTrap, getInitialFocus } from '../../utils/focus-trap.js';
|
|
|
5
5
|
import { useControllableState } from '../../utils/use-controllable-state.js';
|
|
6
6
|
import { isDev } from '../../utils/is-dev.js';
|
|
7
7
|
import { IconButton } from '../IconButton/index.js';
|
|
8
|
+
import { SidebarCollapse as SidebarCollapseIcon, SidebarExpand as SidebarExpandIcon } from '../../icons/system/index.js';
|
|
8
9
|
const isBrowser = typeof document !== 'undefined';
|
|
9
10
|
const SidebarCollapseContext = createContext(null);
|
|
10
11
|
// =============================================================================
|
|
@@ -259,7 +260,7 @@ function SidebarToggle(props) {
|
|
|
259
260
|
const pointsInward = position === 'left' ? !collapsed : collapsed;
|
|
260
261
|
return (_jsx(IconButton, { ...rest, ref: (node) => {
|
|
261
262
|
toggleRef.current = node;
|
|
262
|
-
}, icon: pointsInward ?
|
|
263
|
+
}, icon: pointsInward ? SidebarCollapseIcon : SidebarExpandIcon, label: collapsed ? text.expand : text.collapse, className: ['tui-sidebar__toggle', className].filter(Boolean).join(' '), "aria-expanded": !collapsed, onClick: toggle }));
|
|
263
264
|
}
|
|
264
265
|
SidebarHeader.displayName = 'Sidebar.Header';
|
|
265
266
|
SidebarFooter.displayName = 'Sidebar.Footer';
|
|
@@ -3,12 +3,14 @@ import { memo } from 'react';
|
|
|
3
3
|
import { defaultStepIndicatorLabels } from './types.js';
|
|
4
4
|
import { Progress } from '../Progress/index.js';
|
|
5
5
|
import { Icon } from '../Icon/index.js';
|
|
6
|
+
import { Checkmark as CheckmarkIcon } from '../../icons/lms/index.js';
|
|
7
|
+
import { LockOutline as LockOutlineIcon } from '../../icons/system/index.js';
|
|
6
8
|
// =============================================================================
|
|
7
9
|
// Icon mapping for static states
|
|
8
10
|
// =============================================================================
|
|
9
11
|
const statusIcons = {
|
|
10
|
-
complete:
|
|
11
|
-
locked:
|
|
12
|
+
complete: CheckmarkIcon,
|
|
13
|
+
locked: LockOutlineIcon,
|
|
12
14
|
};
|
|
13
15
|
// =============================================================================
|
|
14
16
|
// Status inference
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IconSource } from '../Icon/Icon';
|
|
2
2
|
import type { Size } from '../../types';
|
|
3
3
|
export type { Size };
|
|
4
4
|
/**
|
|
@@ -56,7 +56,7 @@ export type StepIndicatorProps = {
|
|
|
56
56
|
* Use for content-type indicators like quizzes, readings, videos.
|
|
57
57
|
* @example icon="lms/question-mark"
|
|
58
58
|
*/
|
|
59
|
-
icon?:
|
|
59
|
+
icon?: IconSource;
|
|
60
60
|
/**
|
|
61
61
|
* Size of the indicator.
|
|
62
62
|
* - `'xs'`: 16px circle
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StepStatus } from '../StepIndicator/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IconSource } from '../Icon/Icon';
|
|
4
4
|
export type { StepStatus };
|
|
5
5
|
export type StepListProps = {
|
|
6
6
|
/**
|
|
@@ -64,7 +64,7 @@ export type StepListItemProps = {
|
|
|
64
64
|
* - `in-progress` shows progress ring (icon ignored)
|
|
65
65
|
* @example icon="lms/question-mark"
|
|
66
66
|
*/
|
|
67
|
-
icon?:
|
|
67
|
+
icon?: IconSource;
|
|
68
68
|
/**
|
|
69
69
|
* URL to navigate to. When provided, renders as an anchor element.
|
|
70
70
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IconSource } from '../Icon/Icon';
|
|
3
3
|
export type TabsVariant = 'pill' | 'underline' | 'outline';
|
|
4
4
|
export type TabsActivationMode = 'auto' | 'manual';
|
|
5
5
|
export type TabsOrientation = 'horizontal' | 'vertical';
|
|
@@ -40,8 +40,8 @@ export type TabsListProps = TabsListBaseProps & ({
|
|
|
40
40
|
export type TabProps = {
|
|
41
41
|
/** Unique identifier, must match a Panel */
|
|
42
42
|
value: string;
|
|
43
|
-
/** Icon
|
|
44
|
-
icon?:
|
|
43
|
+
/** Icon: a registry path or an icon component */
|
|
44
|
+
icon?: IconSource;
|
|
45
45
|
/**
|
|
46
46
|
* Accessible label for the tab button. Required for icon-only tabs
|
|
47
47
|
* (no `children`). Omitting this on an icon-only tab leaves the button
|
|
@@ -41,6 +41,8 @@ export type ToastProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'c
|
|
|
41
41
|
onDismiss?: () => void;
|
|
42
42
|
/** Accessible label for the dismiss button. Default 'Dismiss'. */
|
|
43
43
|
dismissLabel?: string;
|
|
44
|
+
/** Announced after the × button removes the toast (not on programmatic `dismiss(id)`). Default 'Notification dismissed'. */
|
|
45
|
+
dismissedMessage?: string;
|
|
44
46
|
/** Action content (e.g. a Button), rendered in the foot. */
|
|
45
47
|
actions?: React.ReactNode;
|
|
46
48
|
className?: string;
|
|
@@ -98,6 +100,8 @@ export declare const Toast: React.ForwardRefExoticComponent<Omit<React.HTMLAttri
|
|
|
98
100
|
onDismiss?: () => void;
|
|
99
101
|
/** Accessible label for the dismiss button. Default 'Dismiss'. */
|
|
100
102
|
dismissLabel?: string;
|
|
103
|
+
/** Announced after the × button removes the toast (not on programmatic `dismiss(id)`). Default 'Notification dismissed'. */
|
|
104
|
+
dismissedMessage?: string;
|
|
101
105
|
/** Action content (e.g. a Button), rendered in the foot. */
|
|
102
106
|
actions?: React.ReactNode;
|
|
103
107
|
className?: string;
|
|
@@ -105,7 +109,7 @@ export declare const Toast: React.ForwardRefExoticComponent<Omit<React.HTMLAttri
|
|
|
105
109
|
/** Body/description content. */
|
|
106
110
|
children?: React.ReactNode;
|
|
107
111
|
} & React.RefAttributes<NoticeHandle>>;
|
|
108
|
-
export type ToastOptions = Pick<ToastProps, 'theme' | 'size' | 'icon' | 'title' | 'announce' | 'dismissible' | 'onDismiss' | 'dismissLabel' | 'actions' | 'className' | 'style'> & {
|
|
112
|
+
export type ToastOptions = Pick<ToastProps, 'theme' | 'size' | 'icon' | 'title' | 'announce' | 'dismissible' | 'onDismiss' | 'dismissLabel' | 'dismissedMessage' | 'actions' | 'className' | 'style'> & {
|
|
109
113
|
/**
|
|
110
114
|
* Stable id. Calling toast() again with the same id updates that toast in
|
|
111
115
|
* place (remounting it, so it re-animates and re-announces) and restarts
|