@carbon/react 1.78.0 → 1.78.1
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 +883 -883
- package/es/components/Accordion/AccordionItem.js +2 -2
- package/es/components/Button/Button.d.ts +2 -3
- package/es/components/Button/Button.js +1 -2
- package/es/components/Button/ButtonBase.js +1 -1
- package/es/components/ChatButton/ChatButton.d.ts +2 -3
- package/es/components/ChatButton/ChatButton.js +1 -2
- package/es/components/ComboBox/ComboBox.js +34 -24
- package/es/components/ComposedModal/ComposedModal.js +65 -51
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
- package/es/components/ContentSwitcher/ContentSwitcher.js +3 -3
- package/es/components/DataTable/TableBatchAction.d.ts +3 -3
- package/es/components/DataTable/TableBatchAction.js +1 -1
- package/es/components/DataTable/TableContainer.d.ts +1 -1
- package/es/components/DataTable/TableContainer.js +3 -3
- package/es/components/DataTable/TableExpandHeader.d.ts +6 -5
- package/es/components/DataTable/TableToolbarMenu.d.ts +2 -2
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DatePicker/DatePicker.js +2 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
- package/es/components/Dialog/index.d.ts +42 -4
- package/es/components/Dialog/index.js +177 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/es/components/FeatureFlags/index.d.ts +3 -1
- package/es/components/FeatureFlags/index.js +3 -0
- package/es/components/FileUploader/FileUploader.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderButton.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +6 -4
- package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/Grid/CSSGrid.js +18 -14
- package/es/components/Grid/FlexGrid.js +7 -6
- package/es/components/Grid/GridTypes.d.ts +5 -3
- package/es/components/IconButton/index.js +3 -3
- package/es/components/Layer/index.d.ts +4 -6
- package/es/components/Layer/index.js +5 -6
- package/es/components/Link/Link.d.ts +2 -3
- package/es/components/Link/Link.js +1 -2
- package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/es/components/ListBox/ListBoxMenuItem.js +37 -15
- package/es/components/Menu/Menu.js +2 -2
- package/es/components/Menu/MenuItem.d.ts +2 -2
- package/es/components/Menu/MenuItem.js +3 -3
- package/es/components/Modal/Modal.js +121 -49
- package/es/components/ModalWrapper/ModalWrapper.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/es/components/MultiSelect/MultiSelect.js +2 -2
- package/es/components/Notification/Notification.d.ts +5 -13
- package/es/components/Notification/Notification.js +3 -4
- package/es/components/OverflowMenu/OverflowMenu.d.ts +4 -8
- package/es/components/OverflowMenu/OverflowMenu.js +3 -3
- package/es/components/OverflowMenu/next/index.d.ts +2 -2
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.d.ts +2 -3
- package/es/components/Search/Search.js +4 -6
- package/es/components/Slider/Slider.d.ts +16 -15
- package/es/components/Slider/Slider.js +22 -22
- package/es/components/Tabs/Tabs.d.ts +3 -6
- package/es/components/Tabs/Tabs.js +8 -9
- package/es/components/Tag/DismissibleTag.d.ts +3 -5
- package/es/components/Tag/DismissibleTag.js +1 -2
- package/es/components/Tag/OperationalTag.d.ts +2 -3
- package/es/components/Tag/OperationalTag.js +1 -2
- package/es/components/Tag/SelectableTag.d.ts +3 -5
- package/es/components/Tag/SelectableTag.js +1 -2
- package/es/components/Tag/Tag.d.ts +2 -3
- package/es/components/Tag/Tag.js +1 -2
- package/es/components/Tile/Tile.d.ts +3 -5
- package/es/components/Tile/Tile.js +8 -6
- package/es/components/Toggletip/index.js +2 -2
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/Tooltip/Tooltip.js +2 -2
- package/es/components/TreeView/TreeNode.d.ts +3 -5
- package/es/components/TreeView/TreeNode.js +3 -4
- package/es/components/TreeView/TreeView.js +2 -2
- package/es/components/UIShell/HeaderContainer.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +2 -2
- package/es/components/UIShell/HeaderPanel.js +2 -2
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/SideNav.js +2 -2
- package/es/components/UIShell/SideNavHeader.d.ts +2 -3
- package/es/components/UIShell/SideNavHeader.js +1 -2
- package/es/components/UIShell/SideNavLink.d.ts +2 -2
- package/es/components/UIShell/SideNavLink.js +1 -1
- package/es/components/UIShell/SideNavMenu.d.ts +2 -2
- package/es/components/UIShell/SideNavMenu.js +3 -3
- package/es/components/UIShell/SwitcherItem.js +2 -2
- package/es/internal/FloatingMenu.js +4 -4
- package/es/internal/OptimizedResize.d.ts +18 -0
- package/es/internal/OptimizedResize.js +21 -24
- package/es/internal/keyboard/index.d.ts +9 -0
- package/es/internal/keyboard/keys.d.ts +23 -0
- package/es/internal/keyboard/keys.js +2 -2
- package/es/internal/keyboard/match.d.ts +26 -0
- package/es/internal/keyboard/match.js +17 -41
- package/es/internal/keyboard/navigation.d.ts +37 -0
- package/es/internal/keyboard/navigation.js +15 -27
- package/es/internal/useMergedRefs.js +3 -0
- package/lib/components/Accordion/AccordionItem.js +2 -2
- package/lib/components/Button/Button.d.ts +2 -3
- package/lib/components/Button/Button.js +1 -2
- package/lib/components/Button/ButtonBase.js +1 -1
- package/lib/components/ChatButton/ChatButton.d.ts +2 -3
- package/lib/components/ChatButton/ChatButton.js +1 -2
- package/lib/components/ComboBox/ComboBox.js +34 -24
- package/lib/components/ComposedModal/ComposedModal.js +64 -50
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
- package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
- package/lib/components/DataTable/TableBatchAction.js +1 -1
- package/lib/components/DataTable/TableContainer.d.ts +1 -1
- package/lib/components/DataTable/TableContainer.js +3 -3
- package/lib/components/DataTable/TableExpandHeader.d.ts +6 -5
- package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +2 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
- package/lib/components/Dialog/index.d.ts +42 -4
- package/lib/components/Dialog/index.js +190 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/lib/components/FeatureFlags/index.d.ts +3 -1
- package/lib/components/FeatureFlags/index.js +3 -0
- package/lib/components/FileUploader/FileUploader.d.ts +1 -1
- package/lib/components/FileUploader/FileUploader.js +2 -2
- package/lib/components/FileUploader/FileUploaderButton.js +2 -2
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +6 -4
- package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/Grid/CSSGrid.js +18 -14
- package/lib/components/Grid/FlexGrid.js +7 -6
- package/lib/components/Grid/GridTypes.d.ts +5 -3
- package/lib/components/IconButton/index.js +3 -3
- package/lib/components/Layer/index.d.ts +4 -6
- package/lib/components/Layer/index.js +5 -6
- package/lib/components/Link/Link.d.ts +2 -3
- package/lib/components/Link/Link.js +1 -2
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/lib/components/ListBox/ListBoxMenuItem.js +36 -14
- package/lib/components/Menu/Menu.js +2 -2
- package/lib/components/Menu/MenuItem.d.ts +2 -2
- package/lib/components/Menu/MenuItem.js +3 -3
- package/lib/components/Modal/Modal.js +123 -51
- package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/lib/components/MultiSelect/MultiSelect.js +2 -2
- package/lib/components/Notification/Notification.d.ts +5 -13
- package/lib/components/Notification/Notification.js +3 -4
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +4 -8
- package/lib/components/OverflowMenu/OverflowMenu.js +3 -3
- package/lib/components/OverflowMenu/next/index.d.ts +2 -2
- package/lib/components/OverflowMenu/next/index.js +1 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.d.ts +2 -3
- package/lib/components/Search/Search.js +4 -6
- package/lib/components/Slider/Slider.d.ts +16 -15
- package/lib/components/Slider/Slider.js +22 -22
- package/lib/components/Tabs/Tabs.d.ts +3 -6
- package/lib/components/Tabs/Tabs.js +8 -9
- package/lib/components/Tag/DismissibleTag.d.ts +3 -5
- package/lib/components/Tag/DismissibleTag.js +1 -2
- package/lib/components/Tag/OperationalTag.d.ts +2 -3
- package/lib/components/Tag/OperationalTag.js +1 -2
- package/lib/components/Tag/SelectableTag.d.ts +3 -5
- package/lib/components/Tag/SelectableTag.js +1 -2
- package/lib/components/Tag/Tag.d.ts +2 -3
- package/lib/components/Tag/Tag.js +1 -2
- package/lib/components/Tile/Tile.d.ts +3 -5
- package/lib/components/Tile/Tile.js +8 -6
- package/lib/components/Toggletip/index.js +2 -2
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.js +2 -2
- package/lib/components/TreeView/TreeNode.d.ts +3 -5
- package/lib/components/TreeView/TreeNode.js +3 -4
- package/lib/components/TreeView/TreeView.js +2 -2
- package/lib/components/UIShell/HeaderContainer.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +2 -2
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/SideNav.js +2 -2
- package/lib/components/UIShell/SideNavHeader.d.ts +2 -3
- package/lib/components/UIShell/SideNavHeader.js +1 -2
- package/lib/components/UIShell/SideNavLink.d.ts +2 -2
- package/lib/components/UIShell/SideNavLink.js +1 -1
- package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
- package/lib/components/UIShell/SideNavMenu.js +3 -3
- package/lib/components/UIShell/SwitcherItem.js +2 -2
- package/lib/internal/FloatingMenu.js +5 -5
- package/lib/internal/OptimizedResize.d.ts +18 -0
- package/lib/internal/OptimizedResize.js +21 -24
- package/lib/internal/keyboard/index.d.ts +9 -0
- package/lib/internal/keyboard/keys.d.ts +23 -0
- package/lib/internal/keyboard/keys.js +2 -2
- package/lib/internal/keyboard/match.d.ts +26 -0
- package/lib/internal/keyboard/match.js +17 -41
- package/lib/internal/keyboard/navigation.d.ts +37 -0
- package/lib/internal/keyboard/navigation.js +15 -27
- package/lib/internal/useMergedRefs.js +3 -0
- package/package.json +6 -6
- package/scss/components/dialog/_dialog.scss +9 -0
- package/scss/components/dialog/_index.scss +9 -0
- package/telemetry.yml +1 -0
- package/es/components/Modal/next/index.d.ts +0 -171
- package/es/internal/focus/index.js +0 -15
- package/lib/components/Modal/next/index.d.ts +0 -171
- package/lib/internal/focus/index.js +0 -19
|
@@ -11,13 +11,13 @@ import cx from 'classnames';
|
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import React__default, { useState, useContext } from 'react';
|
|
13
13
|
import '../Text/index.js';
|
|
14
|
+
import { Escape } from '../../internal/keyboard/keys.js';
|
|
15
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
14
16
|
import { useId } from '../../internal/useId.js';
|
|
15
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
18
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
19
|
import { AccordionContext } from './AccordionProvider.js';
|
|
18
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
19
20
|
import { Text } from '../Text/Text.js';
|
|
20
|
-
import { Escape } from '../../internal/keyboard/keys.js';
|
|
21
21
|
|
|
22
22
|
const defaultRenderToggle = props => /*#__PURE__*/React__default.createElement("button", _extends({
|
|
23
23
|
type: "button"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -50,8 +50,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
50
50
|
*/
|
|
51
51
|
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
|
-
* Can be a React component class
|
|
53
|
+
* A component used to render an icon.
|
|
55
54
|
*/
|
|
56
55
|
renderIcon?: React.ElementType;
|
|
57
56
|
/**
|
|
@@ -194,8 +194,7 @@ Button.propTypes = {
|
|
|
194
194
|
*/
|
|
195
195
|
rel: PropTypes.string,
|
|
196
196
|
/**
|
|
197
|
-
*
|
|
198
|
-
* Can be a React component class
|
|
197
|
+
* A component used to render an icon.
|
|
199
198
|
*/
|
|
200
199
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
201
200
|
/**
|
|
@@ -49,7 +49,7 @@ const ButtonBase = /*#__PURE__*/React__default.forwardRef(function ButtonBase(_r
|
|
|
49
49
|
[`${prefix}--btn--${kind}`]: kind,
|
|
50
50
|
[`${prefix}--btn--disabled`]: disabled,
|
|
51
51
|
[`${prefix}--btn--expressive`]: isExpressive,
|
|
52
|
-
[`${prefix}--btn--icon-only`]: hasIconOnly
|
|
52
|
+
[`${prefix}--btn--icon-only`]: hasIconOnly,
|
|
53
53
|
[`${prefix}--btn--selected`]: hasIconOnly && isSelected && kind === 'ghost'
|
|
54
54
|
});
|
|
55
55
|
const commonProps = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2024
|
|
2
|
+
* Copyright IBM Corp. 2024, 2025
|
|
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.
|
|
@@ -33,8 +33,7 @@ export interface ChatButtonProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
33
33
|
*/
|
|
34
34
|
kind?: ChatButtonKind;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* Can be a React component class
|
|
36
|
+
* A component used to render an icon.
|
|
38
37
|
*/
|
|
39
38
|
renderIcon?: ComponentType | FunctionComponent;
|
|
40
39
|
/**
|
|
@@ -75,8 +75,7 @@ ChatButton.propTypes = {
|
|
|
75
75
|
*/
|
|
76
76
|
kind: PropTypes.oneOf(['primary', 'secondary', 'danger', 'ghost', 'tertiary']),
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
79
|
-
* Can be a React component class
|
|
78
|
+
* A component used to render an icon.
|
|
80
79
|
*/
|
|
81
80
|
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
82
81
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
@@ -16,6 +16,8 @@ import isEqual from 'react-fast-compare';
|
|
|
16
16
|
import ListBox from '../ListBox/index.js';
|
|
17
17
|
import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
18
18
|
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
19
|
+
import { Space, Enter, Escape, Home, End } from '../../internal/keyboard/keys.js';
|
|
20
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
19
21
|
import { useId } from '../../internal/useId.js';
|
|
20
22
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
21
23
|
import deprecate from '../../prop-types/deprecate.js';
|
|
@@ -24,10 +26,8 @@ import '../FluidForm/FluidForm.js';
|
|
|
24
26
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
25
27
|
import { useFloating, flip, hide, autoUpdate } from '@floating-ui/react';
|
|
26
28
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
27
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
28
29
|
import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
|
|
29
30
|
import { Text } from '../Text/Text.js';
|
|
30
|
-
import { Space, Enter, Escape, Home, End } from '../../internal/keyboard/keys.js';
|
|
31
31
|
|
|
32
32
|
const {
|
|
33
33
|
InputBlur,
|
|
@@ -301,31 +301,41 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
301
301
|
return changes;
|
|
302
302
|
}
|
|
303
303
|
case InputKeyDownEnter:
|
|
304
|
-
if (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
304
|
+
if (!allowCustomValue) {
|
|
305
|
+
const highlightedIndex = indexToHighlight(inputValue);
|
|
306
|
+
const matchingItem = items[highlightedIndex];
|
|
307
|
+
if (matchingItem) {
|
|
308
|
+
// Prevent matching items that are marked as `disabled` from
|
|
309
|
+
// being selected.
|
|
310
|
+
if (matchingItem.disabled) {
|
|
311
|
+
return state;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Select the matching item.
|
|
315
|
+
return {
|
|
316
|
+
...changes,
|
|
317
|
+
selectedItem: matchingItem,
|
|
318
|
+
inputValue: itemToString(matchingItem)
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// If no matching item is found and there is an existing
|
|
323
|
+
// selection, clear the selection.
|
|
324
|
+
if (state.selectedItem !== null) {
|
|
325
|
+
return {
|
|
326
|
+
...changes,
|
|
327
|
+
selectedItem: null,
|
|
317
328
|
inputValue
|
|
318
|
-
}
|
|
329
|
+
};
|
|
319
330
|
}
|
|
320
|
-
return changes;
|
|
321
|
-
} else if (changes.selectedItem && !allowCustomValue) {
|
|
322
|
-
return changes;
|
|
323
|
-
} else {
|
|
324
|
-
return {
|
|
325
|
-
...changes,
|
|
326
|
-
isOpen: true
|
|
327
|
-
};
|
|
328
331
|
}
|
|
332
|
+
|
|
333
|
+
// For `allowCustomValue` or if no matching item is found, keep the
|
|
334
|
+
// menu open.
|
|
335
|
+
return {
|
|
336
|
+
...changes,
|
|
337
|
+
isOpen: true
|
|
338
|
+
};
|
|
329
339
|
case FunctionToggleMenu:
|
|
330
340
|
case ToggleButtonClick:
|
|
331
341
|
if (!changes.isOpen && state.inputValue && highlightedIndex === -1 && !allowCustomValue) {
|
|
@@ -17,14 +17,15 @@ import mergeRefs from '../../tools/mergeRefs.js';
|
|
|
17
17
|
import cx from 'classnames';
|
|
18
18
|
import toggleClass from '../../tools/toggleClass.js';
|
|
19
19
|
import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
|
|
20
|
-
import wrapFocus, {
|
|
20
|
+
import wrapFocus, { elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
|
|
21
21
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
22
|
+
import { Escape } from '../../internal/keyboard/keys.js';
|
|
23
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
22
24
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
23
25
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
24
26
|
import deprecate from '../../prop-types/deprecate.js';
|
|
27
|
+
import { unstable__Dialog } from '../Dialog/index.js';
|
|
25
28
|
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
|
|
26
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
27
|
-
import { Escape, Tab } from '../../internal/keyboard/keys.js';
|
|
28
29
|
|
|
29
30
|
const ModalBody = /*#__PURE__*/React__default.forwardRef(function ModalBody(_ref, ref) {
|
|
30
31
|
let {
|
|
@@ -120,12 +121,14 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
120
121
|
const startSentinel = useRef(null);
|
|
121
122
|
const endSentinel = useRef(null);
|
|
122
123
|
const onMouseDownTarget = useRef(null);
|
|
123
|
-
const
|
|
124
|
+
const enableDialogElement =
|
|
125
|
+
// useFeatureFlag('enable-experimental-focus-wrap-without-sentinels') ||
|
|
126
|
+
useFeatureFlag('enable-dialog-element');
|
|
124
127
|
|
|
125
128
|
// Keep track of modal open/close state
|
|
126
129
|
// and propagate it to the document.body
|
|
127
130
|
useEffect(() => {
|
|
128
|
-
if (open !== wasOpen) {
|
|
131
|
+
if (!enableDialogElement && open !== wasOpen) {
|
|
129
132
|
setIsOpen(!!open);
|
|
130
133
|
setWasOpen(!!open);
|
|
131
134
|
toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
|
|
@@ -133,22 +136,19 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
133
136
|
}, [open, wasOpen, prefix]);
|
|
134
137
|
// Remove the document.body className on unmount
|
|
135
138
|
useEffect(() => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
if (!enableDialogElement) {
|
|
140
|
+
return () => {
|
|
141
|
+
toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
139
144
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
140
145
|
|
|
141
146
|
function handleKeyDown(event) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
wrapFocusWithoutSentinels({
|
|
148
|
-
containerNode: innerModal.current,
|
|
149
|
-
currentActiveNode: event.target,
|
|
150
|
-
event: event
|
|
151
|
-
});
|
|
147
|
+
if (!enableDialogElement) {
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
if (match(event, Escape)) {
|
|
150
|
+
closeModal(event);
|
|
151
|
+
}
|
|
152
152
|
}
|
|
153
153
|
onKeyDown?.(event);
|
|
154
154
|
}
|
|
@@ -228,32 +228,34 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
230
|
useEffect(() => {
|
|
231
|
-
if (!open && launcherButtonRef) {
|
|
231
|
+
if (!enableDialogElement && !open && launcherButtonRef) {
|
|
232
232
|
setTimeout(() => {
|
|
233
233
|
launcherButtonRef?.current?.focus();
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
}, [open, launcherButtonRef]);
|
|
237
237
|
useEffect(() => {
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
target
|
|
251
|
-
|
|
252
|
-
closeButton
|
|
238
|
+
if (!enableDialogElement) {
|
|
239
|
+
const initialFocus = focusContainerElement => {
|
|
240
|
+
const containerElement = focusContainerElement || innerModal.current;
|
|
241
|
+
const primaryFocusElement = containerElement ? containerElement.querySelector(danger ? `.${prefix}--btn--secondary` : selectorPrimaryFocus) : null;
|
|
242
|
+
if (primaryFocusElement) {
|
|
243
|
+
return primaryFocusElement;
|
|
244
|
+
}
|
|
245
|
+
return button && button.current;
|
|
246
|
+
};
|
|
247
|
+
const focusButton = focusContainerElement => {
|
|
248
|
+
const target = initialFocus(focusContainerElement);
|
|
249
|
+
const closeButton = focusContainerElement.querySelector(`.${prefix}--modal-close`);
|
|
250
|
+
if (target) {
|
|
251
|
+
target.focus();
|
|
252
|
+
} else if (!target && closeButton) {
|
|
253
|
+
closeButton?.focus();
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
if (open && isOpen) {
|
|
257
|
+
focusButton(innerModal.current);
|
|
253
258
|
}
|
|
254
|
-
};
|
|
255
|
-
if (open && isOpen) {
|
|
256
|
-
focusButton(innerModal.current);
|
|
257
259
|
}
|
|
258
260
|
}, [open, selectorPrimaryFocus, isOpen]);
|
|
259
261
|
|
|
@@ -264,23 +266,24 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
264
266
|
size: 'sm'
|
|
265
267
|
});
|
|
266
268
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
"aria-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
269
|
+
const modalBody = enableDialogElement ? /*#__PURE__*/React__default.createElement(unstable__Dialog, {
|
|
270
|
+
open: open,
|
|
271
|
+
modal: true,
|
|
272
|
+
className: containerClass,
|
|
273
|
+
"aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
|
|
274
|
+
"aria-labelledby": ariaLabelledBy
|
|
275
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
276
|
+
ref: innerModal,
|
|
277
|
+
className: `${prefix}--modal-container-body`
|
|
278
|
+
}, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
|
|
279
|
+
className: `${prefix}--modal--inner__decorator`
|
|
280
|
+
}, normalizedDecorator) : '', childrenWithProps)) : /*#__PURE__*/React__default.createElement("div", {
|
|
278
281
|
className: containerClass,
|
|
279
282
|
role: "dialog",
|
|
280
283
|
"aria-modal": "true",
|
|
281
284
|
"aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
|
|
282
285
|
"aria-labelledby": ariaLabelledBy
|
|
283
|
-
},
|
|
286
|
+
}, /*#__PURE__*/React__default.createElement("button", {
|
|
284
287
|
type: "button",
|
|
285
288
|
ref: startSentinel,
|
|
286
289
|
className: `${prefix}--visually-hidden`
|
|
@@ -289,11 +292,22 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
289
292
|
className: `${prefix}--modal-container-body`
|
|
290
293
|
}, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
|
|
291
294
|
className: `${prefix}--modal--inner__decorator`
|
|
292
|
-
}, normalizedDecorator) : '', childrenWithProps),
|
|
295
|
+
}, normalizedDecorator) : '', childrenWithProps), /*#__PURE__*/React__default.createElement("button", {
|
|
293
296
|
type: "button",
|
|
294
297
|
ref: endSentinel,
|
|
295
298
|
className: `${prefix}--visually-hidden`
|
|
296
|
-
}, "Focus sentinel"))
|
|
299
|
+
}, "Focus sentinel"));
|
|
300
|
+
return /*#__PURE__*/React__default.createElement(Layer, _extends({}, rest, {
|
|
301
|
+
level: 0,
|
|
302
|
+
role: "presentation",
|
|
303
|
+
ref: ref,
|
|
304
|
+
"aria-hidden": !open,
|
|
305
|
+
onBlur: !enableDialogElement ? handleBlur : () => {},
|
|
306
|
+
onClick: composeEventHandlers([rest?.onClick, handleOnClick]),
|
|
307
|
+
onMouseDown: composeEventHandlers([rest?.onMouseDown, handleOnMouseDown]),
|
|
308
|
+
onKeyDown: handleKeyDown,
|
|
309
|
+
className: modalClass
|
|
310
|
+
}), modalBody);
|
|
297
311
|
});
|
|
298
312
|
ComposedModal.propTypes = {
|
|
299
313
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2022
|
|
2
|
+
* Copyright IBM Corp. 2022, 2025
|
|
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.
|
|
@@ -27,7 +27,7 @@ interface ContainedListItemProps {
|
|
|
27
27
|
*/
|
|
28
28
|
onClick?: () => void;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* A component used to render an icon.
|
|
31
31
|
*/
|
|
32
32
|
renderIcon?: ComponentType | FunctionComponent;
|
|
33
33
|
}
|
|
@@ -71,7 +71,7 @@ ContainedListItem.propTypes = {
|
|
|
71
71
|
*/
|
|
72
72
|
onClick: PropTypes.func,
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* A component used to render an icon.
|
|
75
75
|
*/
|
|
76
76
|
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
77
77
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
@@ -12,11 +12,11 @@ import cx from 'classnames';
|
|
|
12
12
|
import deprecate from '../../prop-types/deprecate.js';
|
|
13
13
|
import { LayoutConstraint } from '../Layout/index.js';
|
|
14
14
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
|
-
import {
|
|
16
|
-
import { noopFn } from '../../internal/noopFn.js';
|
|
15
|
+
import { ArrowRight, ArrowLeft } from '../../internal/keyboard/keys.js';
|
|
17
16
|
import { matches } from '../../internal/keyboard/match.js';
|
|
18
17
|
import { getNextIndex } from '../../internal/keyboard/navigation.js';
|
|
19
|
-
import {
|
|
18
|
+
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
19
|
+
import { noopFn } from '../../internal/noopFn.js';
|
|
20
20
|
|
|
21
21
|
class ContentSwitcher extends React__default.Component {
|
|
22
22
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -17,7 +17,7 @@ export interface TableBatchActionProps extends React.ButtonHTMLAttributes<HTMLBu
|
|
|
17
17
|
*/
|
|
18
18
|
iconDescription?: string;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* A component used to render an icon.
|
|
21
21
|
*/
|
|
22
22
|
renderIcon?: React.ElementType;
|
|
23
23
|
}
|
|
@@ -34,7 +34,7 @@ declare const TableBatchAction: {
|
|
|
34
34
|
*/
|
|
35
35
|
iconDescription: (props: any) => Error | undefined;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* A component used to render an icon.
|
|
38
38
|
*/
|
|
39
39
|
renderIcon: PropTypes.Requireable<object>;
|
|
40
40
|
};
|
|
@@ -39,7 +39,7 @@ TableBatchAction.propTypes = {
|
|
|
39
39
|
return undefined;
|
|
40
40
|
},
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* A component used to render an icon.
|
|
43
43
|
*/
|
|
44
44
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
45
45
|
};
|
|
@@ -41,12 +41,12 @@ const TableContainer = _ref => {
|
|
|
41
41
|
value: value
|
|
42
42
|
}, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
43
43
|
className: tableContainerClasses
|
|
44
|
-
}), title && /*#__PURE__*/React__default.createElement("div", {
|
|
44
|
+
}), (title || description) && /*#__PURE__*/React__default.createElement("div", {
|
|
45
45
|
className: `${prefix}--data-table-header`
|
|
46
|
-
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
46
|
+
}, title && /*#__PURE__*/React__default.createElement("h4", {
|
|
47
47
|
className: `${prefix}--data-table-header__title`,
|
|
48
48
|
id: titleId
|
|
49
|
-
}, title), /*#__PURE__*/React__default.createElement("p", {
|
|
49
|
+
}, title), description && /*#__PURE__*/React__default.createElement("p", {
|
|
50
50
|
className: `${prefix}--data-table-header__description`,
|
|
51
51
|
id: descriptionId
|
|
52
52
|
}, description)), children));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -45,15 +45,16 @@ export type TableExpandHeaderPropsBase = {
|
|
|
45
45
|
*/
|
|
46
46
|
onExpand?(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
47
47
|
} & ReactAttr<HTMLTableCellElement>;
|
|
48
|
-
export type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, '
|
|
48
|
+
export type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableToggle' | 'onExpand'> & {
|
|
49
49
|
enableToggle: true;
|
|
50
|
-
ariaLabel: string;
|
|
51
50
|
['aria-label']: string;
|
|
52
51
|
onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
53
52
|
};
|
|
54
|
-
export type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, '
|
|
53
|
+
export type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableExpando' | 'onExpand'> & {
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated The enableExpando prop is being replaced by `enableToggle`
|
|
56
|
+
*/
|
|
55
57
|
enableExpando: true;
|
|
56
|
-
ariaLabel: string;
|
|
57
58
|
['aria-label']: string;
|
|
58
59
|
onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
59
60
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -20,7 +20,7 @@ export interface TableToolbarMenuProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
20
20
|
*/
|
|
21
21
|
menuOptionsClass?: string;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* A component used to render an icon.
|
|
24
24
|
*/
|
|
25
25
|
renderIcon?: any;
|
|
26
26
|
}
|
|
@@ -51,7 +51,7 @@ TableToolbarMenu.propTypes = {
|
|
|
51
51
|
*/
|
|
52
52
|
menuOptionsClass: PropTypes.string,
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* A component used to render an icon.
|
|
55
55
|
*/
|
|
56
56
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
57
57
|
};
|
|
@@ -16,13 +16,13 @@ import carbonFlatpickrAppendToPlugin from './plugins/appendToPlugin.js';
|
|
|
16
16
|
import carbonFlatpickrFixEventsPlugin from './plugins/fixEventsPlugin.js';
|
|
17
17
|
import carbonFlatpickrRangePlugin from './plugins/rangePlugin.js';
|
|
18
18
|
import deprecate from '../../prop-types/deprecate.js';
|
|
19
|
+
import { Escape, ArrowDown, Enter, Tab } from '../../internal/keyboard/keys.js';
|
|
20
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
19
21
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
20
22
|
import { useSavedCallback } from '../../internal/useSavedCallback.js';
|
|
21
23
|
import '../FluidForm/FluidForm.js';
|
|
22
24
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
23
25
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
24
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
25
|
-
import { Escape, ArrowDown, Enter, Tab } from '../../internal/keyboard/keys.js';
|
|
26
26
|
|
|
27
27
|
// Weekdays shorthand for english locale
|
|
28
28
|
l10n.en.weekdays.shorthand.forEach((_day, index) => {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { match } from '../../../internal/keyboard/match.js';
|
|
9
8
|
import { Enter, ArrowLeft, ArrowRight, ArrowDown } from '../../../internal/keyboard/keys.js';
|
|
9
|
+
import { match } from '../../../internal/keyboard/match.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @param {object} config Plugin configuration.
|
|
@@ -12,9 +12,28 @@ export interface DialogProps extends ReactAttr<HTMLDialogElement> {
|
|
|
12
12
|
*/
|
|
13
13
|
children?: React.ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Specify an optional className to be applied to the modal root node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specifies whether the dialog is modal or non-modal. This cannot be changed
|
|
20
|
+
* while open=true
|
|
16
21
|
*/
|
|
17
22
|
modal?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify a handler for the dialog's cancel event.
|
|
25
|
+
* The browser fires this event when the user presses the Esc key and is cancelable.
|
|
26
|
+
*/
|
|
27
|
+
onCancel?: React.ReactEventHandler<HTMLDialogElement>;
|
|
28
|
+
/**
|
|
29
|
+
* Specify a click handler applied to the dialog.
|
|
30
|
+
*/
|
|
31
|
+
onClick?: React.ReactEventHandler<HTMLDialogElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Specify a handler the dialog's close event.
|
|
34
|
+
* The browser fires this event after the dialog has closed.
|
|
35
|
+
*/
|
|
36
|
+
onClose?: React.ReactEventHandler<HTMLDialogElement>;
|
|
18
37
|
/**
|
|
19
38
|
* Specify a handler for closing Dialog.
|
|
20
39
|
* The handler should care of closing Dialog, e.g. changing `open` prop.
|
|
@@ -25,6 +44,25 @@ export interface DialogProps extends ReactAttr<HTMLDialogElement> {
|
|
|
25
44
|
*/
|
|
26
45
|
open?: boolean;
|
|
27
46
|
}
|
|
28
|
-
declare const unstable__Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
|
|
29
|
-
export
|
|
30
|
-
|
|
47
|
+
export declare const unstable__Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
|
|
48
|
+
export interface DialogHeaderProps extends ReactAttr<HTMLDivElement> {
|
|
49
|
+
/**
|
|
50
|
+
* Provide the contents to be rendered inside of this component
|
|
51
|
+
*/
|
|
52
|
+
children?: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
export declare const DialogHeader: React.ForwardRefExoticComponent<DialogHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
export interface DialogControlsProps extends ReactAttr<HTMLDivElement> {
|
|
56
|
+
/**
|
|
57
|
+
* Provide the contents to be rendered inside of this component
|
|
58
|
+
*/
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
export declare const DialogControls: React.ForwardRefExoticComponent<DialogControlsProps & React.RefAttributes<HTMLDivElement>>;
|
|
62
|
+
export interface DialogCloseButtonProps extends ReactAttr<HTMLDivElement> {
|
|
63
|
+
/**
|
|
64
|
+
* Specify a click handler applied to the IconButton
|
|
65
|
+
*/
|
|
66
|
+
onClick?: React.MouseEventHandler;
|
|
67
|
+
}
|
|
68
|
+
export declare const DialogCloseButton: React.ForwardRefExoticComponent<DialogCloseButtonProps & React.RefAttributes<HTMLDivElement>>;
|