@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
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default, { useRef, useEffect } from 'react';
|
|
11
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
|
+
import cx from 'classnames';
|
|
13
|
+
import { Close } from '@carbon/icons-react';
|
|
14
|
+
import { IconButton } from '../IconButton/index.js';
|
|
15
|
+
import { noopFn } from '../../internal/noopFn.js';
|
|
16
|
+
|
|
17
|
+
const unstable__Dialog = /*#__PURE__*/React__default.forwardRef((_ref, forwardRef) => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
modal,
|
|
22
|
+
onCancel = noopFn,
|
|
23
|
+
onClick = noopFn,
|
|
24
|
+
onClose = noopFn,
|
|
25
|
+
onRequestClose = noopFn,
|
|
26
|
+
open = false,
|
|
27
|
+
...rest
|
|
28
|
+
} = _ref;
|
|
29
|
+
const prefix = usePrefix();
|
|
30
|
+
|
|
31
|
+
// This component needs access to a ref, placed on the dialog, to call the
|
|
32
|
+
// various imperative dialog functions (show(), close(), etc.).
|
|
33
|
+
// If the parent component has not passed a ref for forwardRef, forwardRef
|
|
34
|
+
// will be null. A "backup" ref is needed to ensure the dialog's instance
|
|
35
|
+
// methods can always be called within this component.
|
|
36
|
+
const backupRef = useRef(null);
|
|
37
|
+
const ref = forwardRef ?? backupRef;
|
|
38
|
+
|
|
39
|
+
// Clicks on the backdrop of an open modal dialog should request the consuming component to close
|
|
40
|
+
// the dialog. Clicks elsewhere, or on non-modal dialogs should not request
|
|
41
|
+
// to close the dialog.
|
|
42
|
+
function handleModalBackdropClick(e) {
|
|
43
|
+
if (open && modal && e.target === ref.current) {
|
|
44
|
+
onRequestClose(e);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function handleClick(e) {
|
|
48
|
+
handleModalBackdropClick(e);
|
|
49
|
+
|
|
50
|
+
// onClick should always be called, no matter if the target is a modal
|
|
51
|
+
// dialog, modal dialog backdrop, or non-modal dialog.
|
|
52
|
+
onClick(e);
|
|
53
|
+
}
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (ref.current) {
|
|
56
|
+
if (open) {
|
|
57
|
+
if (modal) {
|
|
58
|
+
// Display the dialog as a modal, over the top of any other dialogs
|
|
59
|
+
// that might be present. Everything outside the dialog are inert
|
|
60
|
+
// with interactions outside the dialog being blocked.
|
|
61
|
+
ref.current.showModal();
|
|
62
|
+
} else {
|
|
63
|
+
// Display the dialog modelessly, i.e. still allowing interaction
|
|
64
|
+
// with content outside of the dialog.
|
|
65
|
+
ref.current.show();
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
ref.current.close();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, [modal, open]);
|
|
72
|
+
return /*#__PURE__*/React__default.createElement("dialog", _extends({}, rest, {
|
|
73
|
+
className: cx(`${prefix}--dialog`, {
|
|
74
|
+
[`${prefix}--dialog--modal`]: modal
|
|
75
|
+
}, className),
|
|
76
|
+
ref: ref,
|
|
77
|
+
onCancel: onCancel,
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
onClose: onClose
|
|
80
|
+
}), children);
|
|
81
|
+
});
|
|
82
|
+
unstable__Dialog.displayName = 'Dialog';
|
|
83
|
+
unstable__Dialog.propTypes = {
|
|
84
|
+
/**
|
|
85
|
+
* Provide children to be rendered inside of the Dialog
|
|
86
|
+
*/
|
|
87
|
+
children: PropTypes.node,
|
|
88
|
+
/**
|
|
89
|
+
* Specify an optional className to be applied to the modal root node
|
|
90
|
+
*/
|
|
91
|
+
className: PropTypes.string,
|
|
92
|
+
/**
|
|
93
|
+
* Modal specifies whether the Dialog is modal or non-modal. This cannot be
|
|
94
|
+
* changed while open=true
|
|
95
|
+
*/
|
|
96
|
+
modal: PropTypes.bool,
|
|
97
|
+
/**
|
|
98
|
+
* Specify a handler for closing Dialog.
|
|
99
|
+
* The handler should care of closing Dialog, e.g. changing `open` prop.
|
|
100
|
+
*/
|
|
101
|
+
onRequestClose: PropTypes.func,
|
|
102
|
+
/**
|
|
103
|
+
* open initial state
|
|
104
|
+
*/
|
|
105
|
+
open: PropTypes.bool
|
|
106
|
+
};
|
|
107
|
+
const DialogHeader = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
108
|
+
let {
|
|
109
|
+
children,
|
|
110
|
+
...rest
|
|
111
|
+
} = _ref2;
|
|
112
|
+
const prefix = usePrefix();
|
|
113
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
114
|
+
className: `${prefix}--dialog__header`,
|
|
115
|
+
ref: ref
|
|
116
|
+
}, rest), children);
|
|
117
|
+
});
|
|
118
|
+
DialogHeader.propTypes = {
|
|
119
|
+
/**
|
|
120
|
+
* Provide the contents to be rendered inside of this component
|
|
121
|
+
*/
|
|
122
|
+
children: PropTypes.node
|
|
123
|
+
};
|
|
124
|
+
const DialogControls = /*#__PURE__*/React__default.forwardRef((_ref3, ref) => {
|
|
125
|
+
let {
|
|
126
|
+
children,
|
|
127
|
+
...rest
|
|
128
|
+
} = _ref3;
|
|
129
|
+
const prefix = usePrefix();
|
|
130
|
+
return (
|
|
131
|
+
/*#__PURE__*/
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
React__default.createElement("div", _extends({
|
|
134
|
+
className: `${prefix}--dialog__header-controls`,
|
|
135
|
+
ref: ref
|
|
136
|
+
}, rest), children)
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
DialogControls.propTypes = {
|
|
140
|
+
/**
|
|
141
|
+
* Provide children to be rendered inside of this component
|
|
142
|
+
*/
|
|
143
|
+
children: PropTypes.node
|
|
144
|
+
};
|
|
145
|
+
const DialogCloseButton = /*#__PURE__*/React__default.forwardRef((_ref4, ref) => {
|
|
146
|
+
let {
|
|
147
|
+
onClick,
|
|
148
|
+
...rest
|
|
149
|
+
} = _ref4;
|
|
150
|
+
const prefix = usePrefix();
|
|
151
|
+
return (
|
|
152
|
+
/*#__PURE__*/
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
React__default.createElement(IconButton, _extends({
|
|
155
|
+
kind: "ghost",
|
|
156
|
+
className: `${prefix}--dialog__close`,
|
|
157
|
+
label: "Close",
|
|
158
|
+
title: "Close",
|
|
159
|
+
"aria-label": "Close",
|
|
160
|
+
align: "left",
|
|
161
|
+
onClick: onClick
|
|
162
|
+
}, rest), /*#__PURE__*/React__default.createElement(Close, {
|
|
163
|
+
size: 20,
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
tabIndex: "-1",
|
|
166
|
+
className: `${prefix}--icon__close`
|
|
167
|
+
}))
|
|
168
|
+
);
|
|
169
|
+
});
|
|
170
|
+
DialogCloseButton.propTypes = {
|
|
171
|
+
/**
|
|
172
|
+
* Specify a click handler applied to the IconButton
|
|
173
|
+
*/
|
|
174
|
+
onClick: PropTypes.func
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { DialogCloseButton, DialogControls, DialogHeader, unstable__Dialog };
|
|
@@ -12,9 +12,9 @@ import Search from '../Search/Search.js';
|
|
|
12
12
|
import '../Search/Search.Skeleton.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
|
-
import mergeRefs from '../../tools/mergeRefs.js';
|
|
16
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
17
15
|
import { Escape } from '../../internal/keyboard/keys.js';
|
|
16
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
17
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
18
18
|
|
|
19
19
|
const ExpandableSearch = /*#__PURE__*/React__default.forwardRef(function ExpandableSearch(_ref, forwardedRef) {
|
|
20
20
|
let {
|
|
@@ -14,6 +14,7 @@ export interface FeatureFlagsProps {
|
|
|
14
14
|
enableV12Overflowmenu?: boolean;
|
|
15
15
|
enableTreeviewControllable?: boolean;
|
|
16
16
|
enableExperimentalFocusWrapWithoutSentinels?: boolean;
|
|
17
|
+
enableDialogElement?: boolean;
|
|
17
18
|
enableV12DynamicFloatingStyles?: boolean;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
@@ -26,7 +27,7 @@ declare const FeatureFlagContext: React.Context<any>;
|
|
|
26
27
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
27
28
|
* a feature flag is enabled or disabled in a given React tree
|
|
28
29
|
*/
|
|
29
|
-
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
|
|
30
|
+
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
|
|
30
31
|
declare namespace FeatureFlags {
|
|
31
32
|
var propTypes: {
|
|
32
33
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -39,6 +40,7 @@ declare namespace FeatureFlags {
|
|
|
39
40
|
enableV12Overflowmenu: PropTypes.Requireable<boolean>;
|
|
40
41
|
enableTreeviewControllable: PropTypes.Requireable<boolean>;
|
|
41
42
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
|
|
43
|
+
enableDialogElement: PropTypes.Requireable<boolean>;
|
|
42
44
|
enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
|
|
43
45
|
};
|
|
44
46
|
}
|
|
@@ -30,6 +30,7 @@ function FeatureFlags(_ref) {
|
|
|
30
30
|
enableV12Overflowmenu = false,
|
|
31
31
|
enableTreeviewControllable = false,
|
|
32
32
|
enableExperimentalFocusWrapWithoutSentinels = false,
|
|
33
|
+
enableDialogElement = false,
|
|
33
34
|
enableV12DynamicFloatingStyles = false
|
|
34
35
|
} = _ref;
|
|
35
36
|
const parentScope = useContext(FeatureFlagContext);
|
|
@@ -40,6 +41,7 @@ function FeatureFlags(_ref) {
|
|
|
40
41
|
'enable-v12-overflowmenu': enableV12Overflowmenu,
|
|
41
42
|
'enable-treeview-controllable': enableTreeviewControllable,
|
|
42
43
|
'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
|
|
44
|
+
'enable-dialog-element': enableDialogElement,
|
|
43
45
|
'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
|
|
44
46
|
...flags
|
|
45
47
|
};
|
|
@@ -78,6 +80,7 @@ FeatureFlags.propTypes = {
|
|
|
78
80
|
enableV12Overflowmenu: PropTypes.bool,
|
|
79
81
|
enableTreeviewControllable: PropTypes.bool,
|
|
80
82
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
|
|
83
|
+
enableDialogElement: PropTypes.bool,
|
|
81
84
|
enableV12DynamicFloatingStyles: PropTypes.bool
|
|
82
85
|
};
|
|
83
86
|
|
|
@@ -12,12 +12,12 @@ import React__default, { useState, useImperativeHandle } from 'react';
|
|
|
12
12
|
import Filename from './Filename.js';
|
|
13
13
|
import FileUploaderButton from './FileUploaderButton.js';
|
|
14
14
|
import { ButtonKinds } from '../Button/Button.js';
|
|
15
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
16
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
15
17
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
18
|
import '../Text/index.js';
|
|
17
19
|
import { useId } from '../../internal/useId.js';
|
|
18
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
19
20
|
import { Text } from '../Text/Text.js';
|
|
20
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
21
21
|
|
|
22
22
|
const FileUploader = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
23
23
|
let {
|
|
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { useState, useRef } from 'react';
|
|
12
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
13
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
12
14
|
import { ButtonKinds } from '../../prop-types/types.js';
|
|
13
15
|
import uniqueId from '../../tools/uniqueId.js';
|
|
14
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
18
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
18
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
19
19
|
|
|
20
20
|
function FileUploaderButton(_ref) {
|
|
21
21
|
let {
|
|
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import React__default, { useRef, useState } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
13
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
12
14
|
import uniqueId from '../../tools/uniqueId.js';
|
|
13
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
16
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
18
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
18
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
19
19
|
|
|
20
20
|
function FileUploaderDropContainer(_ref) {
|
|
21
21
|
let {
|
|
@@ -71,14 +71,16 @@ function FileUploaderDropContainer(_ref) {
|
|
|
71
71
|
}
|
|
72
72
|
function handleChange(event) {
|
|
73
73
|
const files = [...(event.target.files ?? [])];
|
|
74
|
-
const
|
|
74
|
+
const filesToValidate = multiple ? files : [files[0]];
|
|
75
|
+
const addedFiles = validateFiles(filesToValidate);
|
|
75
76
|
return onAddFiles(event, {
|
|
76
77
|
addedFiles
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
function handleDrop(event) {
|
|
80
81
|
const files = [...event.dataTransfer.files];
|
|
81
|
-
const
|
|
82
|
+
const filesToValidate = multiple ? files : [files[0]];
|
|
83
|
+
const addedFiles = validateFiles(filesToValidate);
|
|
82
84
|
return onAddFiles(event, {
|
|
83
85
|
addedFiles
|
|
84
86
|
});
|
|
@@ -10,15 +10,15 @@ import cx from 'classnames';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { useRef, useState, useLayoutEffect } from 'react';
|
|
12
12
|
import Filename from './Filename.js';
|
|
13
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
14
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
13
15
|
import uniqueId from '../../tools/uniqueId.js';
|
|
14
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
17
|
import { noopFn } from '../../internal/noopFn.js';
|
|
16
18
|
import '../Text/index.js';
|
|
17
19
|
import '../Tooltip/DefinitionTooltip.js';
|
|
18
20
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
19
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
20
21
|
import { Text } from '../Text/Text.js';
|
|
21
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
22
22
|
|
|
23
23
|
function FileUploaderItem(_ref) {
|
|
24
24
|
let {
|
|
@@ -12,10 +12,10 @@ import React__default from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { useGridSettings, GridSettings } from './GridContext.js';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const CSSGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
16
16
|
let {
|
|
17
17
|
align,
|
|
18
|
-
as
|
|
18
|
+
as,
|
|
19
19
|
children,
|
|
20
20
|
className: customClassName,
|
|
21
21
|
condensed = false,
|
|
@@ -38,7 +38,8 @@ function CSSGrid(_ref) {
|
|
|
38
38
|
mode: "css-grid",
|
|
39
39
|
subgrid: true
|
|
40
40
|
}, /*#__PURE__*/React__default.createElement(Subgrid, _extends({
|
|
41
|
-
|
|
41
|
+
ref: ref,
|
|
42
|
+
as: as,
|
|
42
43
|
className: customClassName,
|
|
43
44
|
mode: mode
|
|
44
45
|
}, rest), children));
|
|
@@ -53,23 +54,24 @@ function CSSGrid(_ref) {
|
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
// cast as any to let TypeScript allow passing in attributes to base component
|
|
56
|
-
const
|
|
57
|
+
const BaseComponent = as || 'div';
|
|
57
58
|
return /*#__PURE__*/React__default.createElement(GridSettings, {
|
|
58
59
|
mode: "css-grid",
|
|
59
60
|
subgrid: true
|
|
60
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
61
|
-
className: className
|
|
61
|
+
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
62
|
+
className: className,
|
|
63
|
+
ref: ref
|
|
62
64
|
}, rest), children));
|
|
63
|
-
}
|
|
65
|
+
});
|
|
64
66
|
CSSGrid.propTypes = {
|
|
65
|
-
/**
|
|
66
|
-
* Specify grid alignment. Default is center
|
|
67
|
-
*/
|
|
68
|
-
align: PropTypes.oneOf(['start', 'center', 'end']),
|
|
69
67
|
/**
|
|
70
68
|
* Provide a custom element to render instead of the default <div>
|
|
71
69
|
*/
|
|
72
70
|
as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
71
|
+
/**
|
|
72
|
+
* Specify grid alignment. Default is center
|
|
73
|
+
*/
|
|
74
|
+
align: PropTypes.oneOf(['start', 'center', 'end']),
|
|
73
75
|
/**
|
|
74
76
|
* Pass in content that will be rendered within the `Grid`
|
|
75
77
|
*/
|
|
@@ -93,9 +95,9 @@ CSSGrid.propTypes = {
|
|
|
93
95
|
*/
|
|
94
96
|
narrow: PropTypes.bool
|
|
95
97
|
};
|
|
96
|
-
const Subgrid = _ref2 => {
|
|
98
|
+
const Subgrid = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
97
99
|
let {
|
|
98
|
-
as
|
|
100
|
+
as,
|
|
99
101
|
className: customClassName,
|
|
100
102
|
children,
|
|
101
103
|
mode,
|
|
@@ -108,10 +110,12 @@ const Subgrid = _ref2 => {
|
|
|
108
110
|
[`${prefix}--subgrid--narrow`]: mode === 'narrow',
|
|
109
111
|
[`${prefix}--subgrid--wide`]: mode === 'wide'
|
|
110
112
|
});
|
|
113
|
+
const BaseComponent = as || 'div';
|
|
111
114
|
return /*#__PURE__*/React__default.createElement(BaseComponent, _extends({}, rest, {
|
|
115
|
+
ref: ref,
|
|
112
116
|
className: className
|
|
113
117
|
}), children);
|
|
114
|
-
};
|
|
118
|
+
});
|
|
115
119
|
Subgrid.propTypes = {
|
|
116
120
|
/**
|
|
117
121
|
* Provide a custom element to render instead of the default <div>
|
|
@@ -12,9 +12,9 @@ import React__default from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { GridSettings } from './GridContext.js';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const FlexGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
16
16
|
let {
|
|
17
|
-
as
|
|
17
|
+
as,
|
|
18
18
|
condensed = false,
|
|
19
19
|
narrow = false,
|
|
20
20
|
fullWidth = false,
|
|
@@ -30,14 +30,15 @@ function FlexGrid(_ref) {
|
|
|
30
30
|
[`${prefix}--grid--full-width`]: fullWidth
|
|
31
31
|
});
|
|
32
32
|
// cast as any to let TypeScript allow passing in attributes to base component
|
|
33
|
-
const
|
|
33
|
+
const BaseComponent = as || 'div';
|
|
34
34
|
return /*#__PURE__*/React__default.createElement(GridSettings, {
|
|
35
35
|
mode: "flexbox",
|
|
36
36
|
subgrid: false
|
|
37
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
38
|
-
className: className
|
|
37
|
+
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
38
|
+
className: className,
|
|
39
|
+
ref: ref
|
|
39
40
|
}, rest), children));
|
|
40
|
-
}
|
|
41
|
+
});
|
|
41
42
|
FlexGrid.propTypes = {
|
|
42
43
|
/**
|
|
43
44
|
* Provide a custom element to render instead of the default <div>
|
|
@@ -4,7 +4,7 @@
|
|
|
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 {
|
|
7
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
8
8
|
export interface GridBaseProps {
|
|
9
9
|
/**
|
|
10
10
|
* Pass in content that will be rendered within the `Grid`
|
|
@@ -29,7 +29,9 @@ export interface GridBaseProps {
|
|
|
29
29
|
*/
|
|
30
30
|
narrow?: boolean;
|
|
31
31
|
}
|
|
32
|
-
export type GridProps<T extends React.ElementType> =
|
|
32
|
+
export type GridProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, GridBaseProps>;
|
|
33
33
|
export interface GridComponent {
|
|
34
|
-
<T extends React.ElementType>(props: GridProps<T
|
|
34
|
+
<T extends React.ElementType = 'div'>(props: GridProps<T>): React.ReactElement | null;
|
|
35
|
+
displayName?: string;
|
|
36
|
+
propTypes?: React.WeakValidationMap<GridProps<any>>;
|
|
35
37
|
}
|
|
@@ -76,9 +76,9 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_r
|
|
|
76
76
|
kind: kind,
|
|
77
77
|
ref: ref,
|
|
78
78
|
size: size,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
isSelected: isSelected,
|
|
80
|
+
hasIconOnly: true,
|
|
81
|
+
className: className,
|
|
82
82
|
"aria-describedby": badgeCount && badgeId
|
|
83
83
|
}), children, !disabled && badgeCount !== undefined && /*#__PURE__*/React__default.createElement(BadgeIndicator, {
|
|
84
84
|
id: badgeId,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { LayerLevel } from './LayerLevel';
|
|
9
|
-
import {
|
|
9
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
10
10
|
/**
|
|
11
11
|
* A custom hook that will return information about the current layer. A common
|
|
12
12
|
* field to pull from this is the `level` for the layer that the component that
|
|
@@ -30,8 +30,6 @@ export interface LayerBaseProps {
|
|
|
30
30
|
*/
|
|
31
31
|
level?: LayerLevel;
|
|
32
32
|
}
|
|
33
|
-
export type LayerProps<T extends React.ElementType> =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
export declare const Layer: LayerComponent;
|
|
33
|
+
export type LayerProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, LayerBaseProps>;
|
|
34
|
+
declare const Layer: React.ForwardRefExoticComponent<Omit<LayerProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
35
|
+
export { Layer };
|
|
@@ -24,9 +24,9 @@ function useLayer() {
|
|
|
24
24
|
level
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const Layer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
28
28
|
let {
|
|
29
|
-
as
|
|
29
|
+
as,
|
|
30
30
|
className: customClassName,
|
|
31
31
|
children,
|
|
32
32
|
level: overrideLevel,
|
|
@@ -38,7 +38,7 @@ const LayerRenderFunction = /*#__PURE__*/React__default.forwardRef(function Laye
|
|
|
38
38
|
const className = cx(`${prefix}--layer-${levels[level]}`, customClassName);
|
|
39
39
|
// The level should be between MIN_LEVEL and MAX_LEVEL
|
|
40
40
|
const value = Math.max(MIN_LEVEL, Math.min(level + 1, MAX_LEVEL));
|
|
41
|
-
const BaseComponent = as;
|
|
41
|
+
const BaseComponent = as || 'div';
|
|
42
42
|
return /*#__PURE__*/React__default.createElement(LayerContext.Provider, {
|
|
43
43
|
value: value
|
|
44
44
|
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
@@ -47,8 +47,8 @@ const LayerRenderFunction = /*#__PURE__*/React__default.forwardRef(function Laye
|
|
|
47
47
|
className: className
|
|
48
48
|
}), children));
|
|
49
49
|
});
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Layer.displayName = 'Layer';
|
|
51
|
+
Layer.propTypes = {
|
|
52
52
|
/**
|
|
53
53
|
* Specify a custom component or element to be rendered as the top-level
|
|
54
54
|
* element in the component
|
|
@@ -68,6 +68,5 @@ LayerRenderFunction.propTypes = {
|
|
|
68
68
|
*/
|
|
69
69
|
level: PropTypes.oneOf([0, 1, 2])
|
|
70
70
|
};
|
|
71
|
-
const Layer = LayerRenderFunction;
|
|
72
71
|
|
|
73
72
|
export { Layer, useLayer };
|
|
@@ -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.
|
|
@@ -31,8 +31,7 @@ export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
31
31
|
*/
|
|
32
32
|
inline?: boolean;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* Can be a React component class
|
|
34
|
+
* A component used to render an icon.
|
|
36
35
|
*/
|
|
37
36
|
renderIcon?: ComponentType;
|
|
38
37
|
/**
|
|
@@ -82,8 +82,7 @@ Link.propTypes = {
|
|
|
82
82
|
*/
|
|
83
83
|
inline: PropTypes.bool,
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
* Can be a React component class
|
|
85
|
+
* A component used to render an icon.
|
|
87
86
|
*/
|
|
88
87
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
89
88
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
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.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { ForwardedRef, ReactNode, type Ref } from 'react';
|
|
8
8
|
import { ForwardRefReturn, ReactAttr } from '../../types/common';
|
|
9
9
|
export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
|
|
10
10
|
/**
|
|
@@ -30,7 +30,7 @@ export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
|
|
|
30
30
|
title?: string;
|
|
31
31
|
}
|
|
32
32
|
export type ListBoxMenuItemForwardedRef = (ForwardedRef<HTMLLIElement> & {
|
|
33
|
-
menuItemOptionRef?:
|
|
33
|
+
menuItemOptionRef?: Ref<HTMLDivElement>;
|
|
34
34
|
}) | null;
|
|
35
35
|
export type ListBoxMenuItemComponent = ForwardRefReturn<ListBoxMenuItemForwardedRef, ListBoxMenuItemProps>;
|
|
36
36
|
declare const _default: ListBoxMenuItemComponent;
|