@carbon/react 1.101.0 → 1.102.0
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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +987 -952
- package/es/components/Accordion/AccordionItem.js +8 -6
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +2 -2
- package/es/components/ComboBox/ComboBox.js +3 -4
- package/es/components/ComposedModal/ComposedModal.js +0 -1
- package/es/components/ContainedList/ContainedList.d.ts +1 -1
- package/es/components/ContainedList/ContainedList.js +9 -34
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +3 -3
- package/es/components/ContentSwitcher/ContentSwitcher.js +4 -4
- package/es/components/DataTable/DataTable.d.ts +6 -2
- package/es/components/DataTable/DataTable.js +3 -1
- package/es/components/DataTable/Table.js +1 -1
- package/es/components/DataTable/TableExpandRow.js +2 -2
- package/es/components/DataTable/TableToolbarSearch.d.ts +11 -2
- package/es/components/DataTable/TableToolbarSearch.js +10 -3
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +3 -0
- package/es/components/DataTable/tools/normalize.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +2 -12
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -8
- package/es/components/DatePicker/DatePicker.js +7 -3
- package/es/components/DatePickerInput/DatePickerInput.d.ts +2 -5
- package/es/components/DatePickerInput/DatePickerInput.js +2 -13
- package/es/components/Dropdown/Dropdown.js +2 -3
- package/es/components/ExpandableSearch/ExpandableSearch.js +2 -1
- package/es/components/ExpandableSearch/index.js +12 -0
- package/es/components/FluidSelect/FluidSelect.d.ts +3 -3
- package/es/components/FluidTextArea/FluidTextArea.d.ts +2 -4
- package/es/components/FluidTextArea/FluidTextArea.js +1 -2
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +3 -3
- package/es/components/Grid/Column.d.ts +1 -1
- package/es/components/Grid/Column.js +2 -2
- package/es/components/Loading/Loading.d.ts +1 -1
- package/es/components/Loading/Loading.js +3 -1
- package/es/components/Menu/Menu.d.ts +1 -1
- package/es/components/Menu/Menu.js +6 -2
- package/es/components/Menu/MenuItem.js +2 -2
- package/es/components/Modal/Modal.js +0 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +4 -3
- package/es/components/MultiSelect/MultiSelect.js +5 -8
- package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +6 -8
- package/es/components/MultiSelect/tools/sorting.d.ts +16 -9
- package/es/components/MultiSelect/tools/sorting.js +10 -14
- package/es/components/OverflowMenu/OverflowMenu.js +1 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +5 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -2
- package/es/components/Popover/index.js +3 -3
- package/es/components/ProgressIndicator/ProgressIndicator.js +3 -3
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -11
- package/es/components/Search/Search.js +3 -2
- package/es/components/Search/utils.d.ts +7 -0
- package/es/components/Search/utils.js +10 -0
- package/es/components/Select/Select.d.ts +2 -2
- package/es/components/Select/Select.js +1 -1
- package/es/components/SelectItem/SelectItem.d.ts +3 -3
- package/es/components/Slider/Slider.d.ts +1 -1
- package/es/components/Slider/Slider.js +2 -8
- package/es/components/StructuredList/StructuredList.js +2 -2
- package/es/components/Tabs/Tabs.js +9 -4
- package/es/components/Tag/DismissibleTag.d.ts +1 -1
- package/es/components/Tag/DismissibleTag.js +2 -2
- package/es/components/Tag/OperationalTag.d.ts +1 -1
- package/es/components/Tag/OperationalTag.js +2 -2
- package/es/components/Tag/SelectableTag.d.ts +1 -1
- package/es/components/Tag/SelectableTag.js +2 -2
- package/es/components/Tag/Tag.d.ts +1 -1
- package/es/components/Tag/Tag.js +2 -2
- package/es/components/TextArea/TextArea.d.ts +1 -2
- package/es/components/TextArea/TextArea.js +4 -5
- package/es/components/TextInput/ControlledPasswordInput.js +1 -1
- package/es/components/TileGroup/TileGroup.d.ts +1 -1
- package/es/components/TileGroup/TileGroup.js +2 -1
- package/es/components/TimePickerSelect/TimePickerSelect.d.ts +4 -4
- package/es/components/Toggletip/index.js +1 -2
- package/es/components/TreeView/TreeNode.js +2 -2
- package/es/components/TreeView/TreeView.d.ts +1 -1
- package/es/components/UIShell/HeaderPanel.d.ts +1 -1
- package/es/components/UIShell/HeaderPanel.js +7 -4
- package/es/components/UIShell/SideNav.js +3 -3
- package/es/components/UIShell/Switcher.d.ts +1 -1
- package/es/components/UIShell/Switcher.js +6 -5
- package/es/feature-flags.js +2 -2
- package/es/internal/FloatingMenu.js +3 -3
- package/es/internal/useOverflowItems.d.ts +1 -5
- package/es/internal/useOverflowItems.js +6 -27
- package/lib/components/Accordion/AccordionItem.js +7 -5
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +3 -4
- package/lib/components/ComposedModal/ComposedModal.js +0 -1
- package/lib/components/ContainedList/ContainedList.d.ts +1 -1
- package/lib/components/ContainedList/ContainedList.js +9 -34
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +3 -3
- package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
- package/lib/components/DataTable/DataTable.d.ts +6 -2
- package/lib/components/DataTable/DataTable.js +3 -1
- package/lib/components/DataTable/Table.js +1 -1
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +11 -2
- package/lib/components/DataTable/TableToolbarSearch.js +10 -3
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +3 -0
- package/lib/components/DataTable/tools/normalize.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +2 -12
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -8
- package/lib/components/DatePicker/DatePicker.js +7 -3
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +2 -5
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -13
- package/lib/components/Dropdown/Dropdown.js +2 -3
- package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -1
- package/lib/components/ExpandableSearch/index.js +17 -0
- package/lib/components/FeatureFlags/index.js +5 -5
- package/lib/components/FluidSelect/FluidSelect.d.ts +3 -3
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +2 -4
- package/lib/components/FluidTextArea/FluidTextArea.js +1 -2
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +3 -3
- package/lib/components/Grid/Column.d.ts +1 -1
- package/lib/components/Grid/Column.js +2 -21
- package/lib/components/Loading/Loading.d.ts +1 -1
- package/lib/components/Loading/Loading.js +3 -1
- package/lib/components/Menu/Menu.d.ts +1 -1
- package/lib/components/Menu/Menu.js +6 -2
- package/lib/components/Menu/MenuItem.js +2 -2
- package/lib/components/Modal/Modal.js +0 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +4 -3
- package/lib/components/MultiSelect/MultiSelect.js +5 -8
- package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +6 -8
- package/lib/components/MultiSelect/tools/sorting.d.ts +16 -9
- package/lib/components/MultiSelect/tools/sorting.js +10 -14
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +5 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -2
- package/lib/components/Popover/index.js +3 -3
- package/lib/components/ProgressIndicator/ProgressIndicator.js +3 -3
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -10
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/Search/utils.d.ts +7 -0
- package/lib/components/Search/utils.js +12 -0
- package/lib/components/Select/Select.d.ts +2 -2
- package/lib/components/Select/Select.js +1 -1
- package/lib/components/SelectItem/SelectItem.d.ts +3 -3
- package/lib/components/Slider/Slider.d.ts +1 -1
- package/lib/components/Slider/Slider.js +2 -8
- package/lib/components/StructuredList/StructuredList.js +2 -2
- package/lib/components/Tabs/Tabs.js +9 -4
- package/lib/components/Tag/DismissibleTag.d.ts +1 -1
- package/lib/components/Tag/DismissibleTag.js +2 -2
- package/lib/components/Tag/OperationalTag.d.ts +1 -1
- package/lib/components/Tag/OperationalTag.js +2 -2
- package/lib/components/Tag/SelectableTag.d.ts +1 -1
- package/lib/components/Tag/SelectableTag.js +2 -2
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Tag/Tag.js +2 -2
- package/lib/components/TextArea/TextArea.d.ts +1 -2
- package/lib/components/TextArea/TextArea.js +4 -5
- package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
- package/lib/components/TileGroup/TileGroup.d.ts +1 -1
- package/lib/components/TileGroup/TileGroup.js +2 -1
- package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +4 -4
- package/lib/components/Toggletip/index.js +1 -2
- package/lib/components/TreeView/TreeNode.js +2 -2
- package/lib/components/TreeView/TreeView.d.ts +1 -1
- package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
- package/lib/components/UIShell/HeaderPanel.js +6 -3
- package/lib/components/UIShell/SideNav.js +3 -3
- package/lib/components/UIShell/Switcher.d.ts +1 -1
- package/lib/components/UIShell/Switcher.js +5 -4
- package/lib/feature-flags.js +2 -21
- package/lib/internal/FloatingMenu.js +3 -22
- package/lib/internal/useOverflowItems.d.ts +1 -5
- package/lib/internal/useOverflowItems.js +6 -27
- package/package.json +8 -8
- package/telemetry.yml +0 -1
|
@@ -45,8 +45,8 @@ const DismissibleTag = /*#__PURE__*/forwardRef(({
|
|
|
45
45
|
}, forwardRef) => {
|
|
46
46
|
const prefix = usePrefix();
|
|
47
47
|
const tagLabelRef = useRef(null);
|
|
48
|
-
|
|
49
|
-
const tagId = id
|
|
48
|
+
const generatedTagId = useId();
|
|
49
|
+
const tagId = id ?? `tag-${generatedTagId}`;
|
|
50
50
|
const tagClasses = cx(`${prefix}--tag--filter`, className);
|
|
51
51
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
52
52
|
useIsomorphicEffect(() => {
|
|
@@ -45,8 +45,8 @@ const OperationalTag = /*#__PURE__*/forwardRef(({
|
|
|
45
45
|
}, forwardRef) => {
|
|
46
46
|
const prefix = usePrefix();
|
|
47
47
|
const tagRef = useRef(null);
|
|
48
|
-
|
|
49
|
-
const tagId = id
|
|
48
|
+
const generatedTagId = useId();
|
|
49
|
+
const tagId = id ?? `tag-${generatedTagId}`;
|
|
50
50
|
const tagClasses = cx(`${prefix}--tag--operational`, className);
|
|
51
51
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
52
52
|
useIsomorphicEffect(() => {
|
|
@@ -37,8 +37,8 @@ const SelectableTag = /*#__PURE__*/forwardRef(({
|
|
|
37
37
|
}, forwardRef) => {
|
|
38
38
|
const prefix = usePrefix();
|
|
39
39
|
const tagRef = useRef(null);
|
|
40
|
-
|
|
41
|
-
const tagId = id
|
|
40
|
+
const generatedTagId = useId();
|
|
41
|
+
const tagId = id ?? `tag-${generatedTagId}`;
|
|
42
42
|
const [selectedTag, setSelectedTag] = useControllableState({
|
|
43
43
|
value: selected,
|
|
44
44
|
onChange: onChange,
|
package/es/components/Tag/Tag.js
CHANGED
|
@@ -74,8 +74,8 @@ const TagBase = /*#__PURE__*/React.forwardRef(({
|
|
|
74
74
|
console.warn('The `onClose` prop for Tag has been deprecated and will be removed in the next major version. Use DismissibleTag instead.');
|
|
75
75
|
}
|
|
76
76
|
const ref = useMergedRefs([forwardRef, tagRef]);
|
|
77
|
-
|
|
78
|
-
const tagId = id
|
|
77
|
+
const generatedTagId = useId();
|
|
78
|
+
const tagId = id ?? `tag-${generatedTagId}`;
|
|
79
79
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
80
80
|
useIsomorphicEffect(() => {
|
|
81
81
|
const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import React, { type ReactNode } from 'react';
|
|
8
8
|
export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
9
9
|
/**
|
|
10
|
-
* Provide a custom className that is applied
|
|
11
|
-
* `<textarea>` node
|
|
10
|
+
* Provide a custom className that is applied to the wrapper node
|
|
12
11
|
*/
|
|
13
12
|
className?: string;
|
|
14
13
|
/**
|
|
@@ -38,7 +38,7 @@ const TextArea = frFn((props, forwardRef) => {
|
|
|
38
38
|
onKeyDown = noopFn,
|
|
39
39
|
invalid = false,
|
|
40
40
|
invalidText = '',
|
|
41
|
-
helperText
|
|
41
|
+
helperText,
|
|
42
42
|
light,
|
|
43
43
|
placeholder = '',
|
|
44
44
|
enableCounter = false,
|
|
@@ -239,7 +239,7 @@ const TextArea = frFn((props, forwardRef) => {
|
|
|
239
239
|
ariaDescribedBy = warnId;
|
|
240
240
|
} else {
|
|
241
241
|
const ids = [];
|
|
242
|
-
if (!isFluid &&
|
|
242
|
+
if (!isFluid && hasHelper && helperId) ids.push(helperId);
|
|
243
243
|
if (counterDescriptionId) ids.push(counterDescriptionId);
|
|
244
244
|
ariaDescribedBy = ids.length > 0 ? ids.join(' ') : undefined;
|
|
245
245
|
}
|
|
@@ -278,7 +278,7 @@ const TextArea = frFn((props, forwardRef) => {
|
|
|
278
278
|
}, [ariaAnnouncement, prevAnnouncement, counterMode]);
|
|
279
279
|
const input = /*#__PURE__*/React.createElement("textarea", _extends({}, other, textareaProps, {
|
|
280
280
|
placeholder: placeholder,
|
|
281
|
-
"aria-readonly":
|
|
281
|
+
"aria-readonly": other.readOnly,
|
|
282
282
|
className: textareaClasses,
|
|
283
283
|
"aria-invalid": invalid,
|
|
284
284
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -324,8 +324,7 @@ const TextArea = frFn((props, forwardRef) => {
|
|
|
324
324
|
TextArea.displayName = 'TextArea';
|
|
325
325
|
TextArea.propTypes = {
|
|
326
326
|
/**
|
|
327
|
-
* Provide a custom className that is applied
|
|
328
|
-
* `<textarea>` node
|
|
327
|
+
* Provide a custom className that is applied to the wrapper node
|
|
329
328
|
*/
|
|
330
329
|
className: PropTypes.string,
|
|
331
330
|
/**
|
|
@@ -9,6 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React, { useState, useEffect, Children, isValidElement, cloneElement } from 'react';
|
|
11
11
|
import RadioTile from '../RadioTile/RadioTile.js';
|
|
12
|
+
import { isComponentElement } from '../../internal/utils.js';
|
|
12
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
14
|
import { noopFn } from '../../internal/noopFn.js';
|
|
14
15
|
|
|
@@ -42,7 +43,7 @@ const TileGroup = ({
|
|
|
42
43
|
if (! /*#__PURE__*/isValidElement(child)) return child;
|
|
43
44
|
|
|
44
45
|
// If a `RadioTile` is found, return it with necessary props,
|
|
45
|
-
if (
|
|
46
|
+
if (isComponentElement(child, RadioTile)) {
|
|
46
47
|
const {
|
|
47
48
|
value,
|
|
48
49
|
...otherProps
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { type SelectHTMLAttributes } from 'react';
|
|
8
8
|
export type TimePickerSelectProps = {
|
|
9
9
|
/**
|
|
10
10
|
* Provide the contents of your TimePickerSelect
|
|
@@ -17,7 +17,7 @@ export type TimePickerSelectProps = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Optionally provide the default value of the `<select>`
|
|
19
19
|
*/
|
|
20
|
-
defaultValue?:
|
|
20
|
+
defaultValue?: SelectHTMLAttributes<HTMLSelectElement>['defaultValue'];
|
|
21
21
|
/**
|
|
22
22
|
* Specify whether the control is disabled
|
|
23
23
|
*/
|
|
@@ -39,7 +39,7 @@ declare const TimePickerSelect: React.ForwardRefExoticComponent<{
|
|
|
39
39
|
/**
|
|
40
40
|
* Optionally provide the default value of the `<select>`
|
|
41
41
|
*/
|
|
42
|
-
defaultValue?:
|
|
42
|
+
defaultValue?: SelectHTMLAttributes<HTMLSelectElement>["defaultValue"];
|
|
43
43
|
/**
|
|
44
44
|
* Specify whether the control is disabled
|
|
45
45
|
*/
|
|
@@ -134,8 +134,7 @@ function Toggletip({
|
|
|
134
134
|
const eventType = 'PointerEvent' in window ? 'pointerdown' : 'mousedown';
|
|
135
135
|
const handleOutsideClick = event => {
|
|
136
136
|
const node = event.target;
|
|
137
|
-
|
|
138
|
-
if (open && node && !ref.current.contains(node)) {
|
|
137
|
+
if (open && node && !ref.current?.contains(node)) {
|
|
139
138
|
setOpen(false);
|
|
140
139
|
}
|
|
141
140
|
};
|
|
@@ -241,7 +241,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
241
241
|
return node;
|
|
242
242
|
}
|
|
243
243
|
if (node.classList.contains(`${prefix}--tree-node-link-parent`)) {
|
|
244
|
-
return node.
|
|
244
|
+
return node.firstElementChild;
|
|
245
245
|
}
|
|
246
246
|
if (node.classList.contains(`${prefix}--tree`)) {
|
|
247
247
|
return null;
|
|
@@ -263,7 +263,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
263
263
|
* When focus is on a leaf node or a closed parent node, move focus to
|
|
264
264
|
* its parent node (unless its depth is level 1)
|
|
265
265
|
*/
|
|
266
|
-
const parentNode = findParentTreeNode(href ? currentNode.current?.parentElement?.parentElement : currentNode.current?.parentElement);
|
|
266
|
+
const parentNode = findParentTreeNode((href ? currentNode.current?.parentElement?.parentElement : currentNode.current?.parentElement) ?? null);
|
|
267
267
|
if (parentNode instanceof HTMLElement) {
|
|
268
268
|
parentNode.focus();
|
|
269
269
|
}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import React, { useRef, useState
|
|
11
|
+
import React, { useRef, useState } from 'react';
|
|
12
|
+
import { isComponentElement } from '../../internal/utils.js';
|
|
12
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
14
|
import { Escape } from '../../internal/keyboard/keys.js';
|
|
14
15
|
import { match } from '../../internal/keyboard/match.js';
|
|
@@ -59,10 +60,12 @@ const HeaderPanel = /*#__PURE__*/React.forwardRef(({
|
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
useWindowEvent('click', event => {
|
|
62
|
-
const
|
|
63
|
-
|
|
63
|
+
const {
|
|
64
|
+
target
|
|
65
|
+
} = event;
|
|
66
|
+
if (!(target instanceof Element)) return;
|
|
64
67
|
setLastClickedElement(target);
|
|
65
|
-
const isChildASwitcher =
|
|
68
|
+
const isChildASwitcher = isComponentElement(children, Switcher);
|
|
66
69
|
if (isChildASwitcher && !target.closest(`.${prefix}--header-panel--expanded`) && !target.closest(`.${prefix}--header__action`) && !headerPanelReference?.current?.classList.contains(`${prefix}--switcher`) && expanded) {
|
|
67
70
|
setExpandedState(false);
|
|
68
71
|
onHeaderPanelFocus();
|
|
@@ -20,7 +20,7 @@ import { useDelayedState } from '../../internal/useDelayedState.js';
|
|
|
20
20
|
import { breakpoints } from '@carbon/layout';
|
|
21
21
|
import { useMatchMedia } from '../../internal/useMatchMedia.js';
|
|
22
22
|
|
|
23
|
-
//
|
|
23
|
+
// TODO: comment back in when footer is added for rails
|
|
24
24
|
// import SideNavFooter from './SideNavFooter';
|
|
25
25
|
|
|
26
26
|
const SideNavContext = /*#__PURE__*/createContext({});
|
|
@@ -35,7 +35,7 @@ const SideNav = frFn((props, ref) => {
|
|
|
35
35
|
children,
|
|
36
36
|
onToggle,
|
|
37
37
|
className: customClassName,
|
|
38
|
-
//
|
|
38
|
+
// TODO: comment back in when footer is added for rails
|
|
39
39
|
// translateById: t = (id) => translations[id],
|
|
40
40
|
href,
|
|
41
41
|
isFixedNav = false,
|
|
@@ -73,7 +73,7 @@ const SideNav = frFn((props, ref) => {
|
|
|
73
73
|
'aria-labelledby': ariaLabelledBy
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
//
|
|
76
|
+
// TODO: comment back in when footer is added for rails
|
|
77
77
|
// const assistiveText = expanded
|
|
78
78
|
// ? t('carbon.sidenav.state.open')
|
|
79
79
|
// : t('carbon.sidenav.state.closed');
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React, { forwardRef, useRef, Children,
|
|
9
|
+
import React, { forwardRef, useRef, Children, cloneElement } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
12
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
13
|
+
import { isComponentElement } from '../../internal/utils.js';
|
|
13
14
|
import PropTypes from 'prop-types';
|
|
14
15
|
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
15
16
|
import SwitcherItem from './SwitcherItem.js';
|
|
@@ -38,7 +39,7 @@ const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
|
|
|
38
39
|
direction
|
|
39
40
|
}) => {
|
|
40
41
|
const enabledIndices = Children.toArray(children).reduce((acc, child, i) => {
|
|
41
|
-
if (
|
|
42
|
+
if (isComponentElement(child, SwitcherItem) && Object.keys(child.props).length) {
|
|
42
43
|
acc.push(i);
|
|
43
44
|
}
|
|
44
45
|
return acc;
|
|
@@ -61,12 +62,12 @@ const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
|
|
|
61
62
|
}
|
|
62
63
|
})();
|
|
63
64
|
const switcherItem = switcherRef.current?.children[nextValidIndex]?.children[0];
|
|
64
|
-
if (switcherItem) {
|
|
65
|
+
if (switcherItem instanceof HTMLElement) {
|
|
65
66
|
switcherItem.focus();
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
const childrenWithProps = Children.toArray(children).map((child, index) => {
|
|
69
|
-
if (
|
|
70
|
+
if (isComponentElement(child, SwitcherItem)) {
|
|
70
71
|
return /*#__PURE__*/cloneElement(child, {
|
|
71
72
|
handleSwitcherItemFocus,
|
|
72
73
|
index,
|
|
@@ -74,7 +75,7 @@ const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
|
|
|
74
75
|
expanded
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
if (
|
|
78
|
+
if (isComponentElement(child, SwitcherDivider)) {
|
|
78
79
|
return /*#__PURE__*/cloneElement(child, {
|
|
79
80
|
key: index
|
|
80
81
|
});
|
package/es/feature-flags.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import { merge } from '@carbon/feature-flags';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
merge({
|
|
11
11
|
'enable-css-custom-properties': true,
|
|
12
12
|
'enable-css-grid': true,
|
|
13
13
|
'enable-v11-release': true,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React, { useContext, useState, useRef, useCallback, useEffect, cloneElement } from 'react';
|
|
9
|
-
import
|
|
9
|
+
import { enabled } from '@carbon/feature-flags';
|
|
10
10
|
import ReactDOM from 'react-dom';
|
|
11
11
|
import { Tab } from './keyboard/keys.js';
|
|
12
12
|
import { match } from './keyboard/match.js';
|
|
@@ -274,8 +274,8 @@ const FloatingMenu = ({
|
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
};
|
|
277
|
-
const deprecatedFlag =
|
|
278
|
-
const focusTrapWithoutSentinelsFlag =
|
|
277
|
+
const deprecatedFlag = enabled('enable-experimental-focus-wrap-without-sentinels');
|
|
278
|
+
const focusTrapWithoutSentinelsFlag = enabled('enable-focus-wrap-without-sentinels');
|
|
279
279
|
const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
|
|
280
280
|
if (typeof document !== 'undefined') {
|
|
281
281
|
const portalTarget = target ? target() : document.body;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2025,
|
|
2
|
+
* Copyright IBM Corp. 2025, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -18,10 +18,6 @@ type Item = {
|
|
|
18
18
|
* @returns Object with `visibleItems` (items to display), `hiddenItems` (items that don't fit), and `itemRefHandler` (function to attach refs to items for width measurement).
|
|
19
19
|
*/
|
|
20
20
|
declare const useOverflowItems: <T extends Item>(items: T[] | ReactNode, containerRef: RefObject<HTMLDivElement>, offsetRef?: RefObject<HTMLDivElement>, maxItems?: number, onChange?: (hiddenItems: T[]) => void) => {
|
|
21
|
-
visibleItems: T[];
|
|
22
|
-
hiddenItems: T[];
|
|
23
|
-
itemRefHandler: () => void;
|
|
24
|
-
} | {
|
|
25
21
|
visibleItems: T[];
|
|
26
22
|
itemRefHandler: (id: string, node: HTMLDivElement | null) => () => void;
|
|
27
23
|
hiddenItems: T[];
|
|
@@ -18,17 +18,10 @@ import { usePreviousValue } from './usePreviousValue.js';
|
|
|
18
18
|
* @param onChange - Optional callback called when hidden items change. Receives array of currently hidden items.
|
|
19
19
|
* @returns Object with `visibleItems` (items to display), `hiddenItems` (items that don't fit), and `itemRefHandler` (function to attach refs to items for width measurement).
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
21
|
const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) => {
|
|
23
22
|
const itemsRef = useRef(null);
|
|
24
23
|
const [maxWidth, setMaxWidth] = useState(0);
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
visibleItems: [],
|
|
28
|
-
hiddenItems: [],
|
|
29
|
-
itemRefHandler: () => {}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
24
|
+
const overflowItems = useMemo(() => Array.isArray(items) ? items : [], [items]);
|
|
32
25
|
const handleResize = () => {
|
|
33
26
|
if (containerRef.current) {
|
|
34
27
|
const offset = offsetRef?.current?.offsetWidth || 0;
|
|
@@ -36,7 +29,6 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
|
|
|
36
29
|
setMaxWidth(newMax);
|
|
37
30
|
}
|
|
38
31
|
};
|
|
39
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
40
32
|
useResizeObserver({
|
|
41
33
|
ref: containerRef,
|
|
42
34
|
onResize: handleResize
|
|
@@ -59,16 +51,13 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
|
|
|
59
51
|
};
|
|
60
52
|
};
|
|
61
53
|
const getVisibleItems = () => {
|
|
62
|
-
if (!items || Array.isArray(items) === false) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
54
|
if (!containerRef) {
|
|
66
|
-
return
|
|
55
|
+
return overflowItems;
|
|
67
56
|
}
|
|
68
57
|
const map = getMap();
|
|
69
58
|
let maxReached = false;
|
|
70
59
|
let accumulatedWidth = 0;
|
|
71
|
-
const visibleItems =
|
|
60
|
+
const visibleItems = overflowItems.slice(0, maxItems).reduce((prev, cur) => {
|
|
72
61
|
if (maxReached) {
|
|
73
62
|
return prev;
|
|
74
63
|
}
|
|
@@ -86,30 +75,20 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
|
|
|
86
75
|
};
|
|
87
76
|
|
|
88
77
|
// Memoize visible items calculation to avoid recalculating on every render
|
|
89
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
90
78
|
const visibleItems = useMemo(() => {
|
|
91
|
-
if (!Array.isArray(items)) {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
79
|
return getVisibleItems();
|
|
95
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
96
|
-
}, [
|
|
81
|
+
}, [overflowItems, maxWidth, maxItems]);
|
|
97
82
|
|
|
98
83
|
// Memoize hidden items calculation
|
|
99
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
100
84
|
const hiddenItems = useMemo(() => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
return items.slice(visibleItems.length);
|
|
105
|
-
}, [items, visibleItems]);
|
|
85
|
+
return overflowItems.slice(visibleItems.length);
|
|
86
|
+
}, [overflowItems, visibleItems]);
|
|
106
87
|
|
|
107
88
|
// Use previous value to compare and only call onChange when needed
|
|
108
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
109
89
|
const previousHiddenItems = usePreviousValue(hiddenItems);
|
|
110
90
|
|
|
111
91
|
// Only call onChange if hidden items actually changed
|
|
112
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
113
92
|
useEffect(() => {
|
|
114
93
|
}, [hiddenItems, previousHiddenItems, onChange]);
|
|
115
94
|
return {
|
|
@@ -41,7 +41,7 @@ function AccordionItem({
|
|
|
41
41
|
...rest
|
|
42
42
|
}) {
|
|
43
43
|
const [isOpen, setIsOpen] = React.useState(open);
|
|
44
|
-
const
|
|
44
|
+
const prevOpenRef = React.useRef(open);
|
|
45
45
|
const accordionState = React.useContext(AccordionProvider.AccordionContext);
|
|
46
46
|
const disabledIsControlled = typeof controlledDisabled === 'boolean';
|
|
47
47
|
const disabled = disabledIsControlled ? controlledDisabled : accordionState.disabled;
|
|
@@ -64,10 +64,12 @@ function AccordionItem({
|
|
|
64
64
|
node.style.maxBlockSize = '';
|
|
65
65
|
}
|
|
66
66
|
}, [isOpen]);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
React.useEffect(() => {
|
|
68
|
+
if (open !== prevOpenRef.current) {
|
|
69
|
+
setIsOpen(open);
|
|
70
|
+
prevOpenRef.current = open;
|
|
71
|
+
}
|
|
72
|
+
}, [open]);
|
|
71
73
|
|
|
72
74
|
// When the AccordionItem heading is clicked, toggle the open state of the
|
|
73
75
|
// panel
|
|
@@ -65,7 +65,7 @@ const CheckboxGroup = ({
|
|
|
65
65
|
kind: 'default'
|
|
66
66
|
}) : candidate;
|
|
67
67
|
const clonedChildren = React.Children.map(children, child => {
|
|
68
|
-
if (
|
|
68
|
+
if (utils.isComponentElement(child, Checkbox.default)) {
|
|
69
69
|
const childProps = {
|
|
70
70
|
...(typeof invalid !== 'undefined' && typeof child.props.invalid === 'undefined' ? {
|
|
71
71
|
invalid
|
|
@@ -149,7 +149,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
149
149
|
middleware: autoAlign ? [react.flip(), react.hide()] : undefined,
|
|
150
150
|
whileElementsMounted: react.autoUpdate
|
|
151
151
|
} : {});
|
|
152
|
-
const
|
|
152
|
+
const referenceElement = refs?.reference?.current;
|
|
153
|
+
const parentWidth = referenceElement instanceof HTMLElement ? referenceElement.clientWidth : undefined;
|
|
153
154
|
React.useEffect(() => {
|
|
154
155
|
if (enableFloatingStyles) {
|
|
155
156
|
const updatedFloatingStyles = {
|
|
@@ -503,10 +504,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
503
504
|
onHighlightedIndexChange: ({
|
|
504
505
|
highlightedIndex
|
|
505
506
|
}) => {
|
|
506
|
-
|
|
507
|
-
if (highlightedIndex > -1 && typeof window !== undefined) {
|
|
507
|
+
if (highlightedIndex > -1) {
|
|
508
508
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
509
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
510
509
|
const highlightedItem = itemArray[highlightedIndex];
|
|
511
510
|
if (highlightedItem) {
|
|
512
511
|
highlightedItem.scrollIntoView({
|
|
@@ -200,7 +200,6 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
200
200
|
target
|
|
201
201
|
} = evt;
|
|
202
202
|
const mouseDownTarget = onMouseDownTarget.current;
|
|
203
|
-
evt.stopPropagation();
|
|
204
203
|
const shouldCloseOnOutsideClick =
|
|
205
204
|
// Passive modals can close on clicks outside the modal when
|
|
206
205
|
// preventCloseOnClickOutside is undefined or explicitly set to false.
|
|
@@ -14,36 +14,25 @@ var React = require('react');
|
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var index = require('../Layout/index.js');
|
|
17
|
+
var utils = require('../../internal/utils.js');
|
|
17
18
|
var useId = require('../../internal/useId.js');
|
|
18
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
20
|
var ContainedListItem = require('./ContainedListItem/ContainedListItem.js');
|
|
21
|
+
var ExpandableSearch = require('../ExpandableSearch/ExpandableSearch.js');
|
|
20
22
|
var Search = require('../Search/Search.js');
|
|
21
23
|
require('../Search/Search.Skeleton.js');
|
|
22
24
|
|
|
23
25
|
const variants = ['on-page', 'disclosed'];
|
|
24
|
-
|
|
26
|
+
const isSearchComponent = node => utils.isComponentElement(node, Search.default) || utils.isComponentElement(node, ExpandableSearch.default);
|
|
27
|
+
const filterChildren = children => {
|
|
25
28
|
if (Array.isArray(children)) {
|
|
26
|
-
return children
|
|
29
|
+
return children.filter(child => !isSearchComponent(child));
|
|
27
30
|
}
|
|
28
|
-
if (children && !
|
|
31
|
+
if (children && !isSearchComponent(children)) {
|
|
29
32
|
return children;
|
|
30
33
|
}
|
|
31
34
|
return null;
|
|
32
|
-
}
|
|
33
|
-
function renderChildren(children) {
|
|
34
|
-
if (Array.isArray(children)) {
|
|
35
|
-
children.map((child, index) => {
|
|
36
|
-
if (index === 0 && child.type === Search.default) {
|
|
37
|
-
return child;
|
|
38
|
-
}
|
|
39
|
-
return child;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
if (children && children.type === Search.default) {
|
|
43
|
-
return children;
|
|
44
|
-
}
|
|
45
|
-
return children;
|
|
46
|
-
}
|
|
35
|
+
};
|
|
47
36
|
const ContainedList = ({
|
|
48
37
|
action,
|
|
49
38
|
children,
|
|
@@ -63,21 +52,7 @@ const ContainedList = ({
|
|
|
63
52
|
[`${prefix}--layout--size-${size}`]: size
|
|
64
53
|
}, `${prefix}--contained-list--${kind}`, className);
|
|
65
54
|
const filteredChildren = filterChildren(children);
|
|
66
|
-
|
|
67
|
-
if (! /*#__PURE__*/React.isValidElement(action)) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
const actionTypes = ['Search', 'ExpandableSearch'];
|
|
71
|
-
let actionType = '';
|
|
72
|
-
if (typeof action.type === 'string') {
|
|
73
|
-
actionType = action.type;
|
|
74
|
-
} else {
|
|
75
|
-
actionType = action.type.displayName || '';
|
|
76
|
-
}
|
|
77
|
-
return actionTypes.includes(actionType);
|
|
78
|
-
}
|
|
79
|
-
const isActionSearch = isSearchAction(action);
|
|
80
|
-
const renderedChildren = renderChildren(children);
|
|
55
|
+
const isActionSearch = isSearchComponent(action);
|
|
81
56
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
82
57
|
className: classes
|
|
83
58
|
}, rest), label && /*#__PURE__*/React.createElement("div", {
|
|
@@ -104,7 +79,7 @@ const ContainedList = ({
|
|
|
104
79
|
React.createElement("ul", {
|
|
105
80
|
role: "list",
|
|
106
81
|
"aria-labelledby": label ? labelId : undefined
|
|
107
|
-
}, isActionSearch ? filteredChildren :
|
|
82
|
+
}, isActionSearch ? filteredChildren : children));
|
|
108
83
|
};
|
|
109
84
|
ContainedList.propTypes = {
|
|
110
85
|
/**
|