@carbon/react 1.78.1 → 1.78.2
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 +764 -764
- package/es/components/Accordion/AccordionItem.js +2 -2
- package/es/components/Button/Button.d.ts +3 -2
- package/es/components/Button/Button.js +2 -1
- package/es/components/Button/ButtonBase.js +1 -1
- package/es/components/ChatButton/ChatButton.d.ts +3 -2
- package/es/components/ChatButton/ChatButton.js +2 -1
- package/es/components/ComboBox/ComboBox.js +24 -34
- package/es/components/ComposedModal/ComposedModal.js +51 -65
- 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 +5 -6
- 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 +4 -42
- package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/es/components/FeatureFlags/index.d.ts +1 -3
- package/es/components/FeatureFlags/index.js +0 -3
- 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 +4 -6
- package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/Grid/CSSGrid.js +14 -18
- package/es/components/Grid/FlexGrid.js +6 -7
- package/es/components/Grid/GridTypes.d.ts +3 -5
- package/es/components/IconButton/index.js +3 -3
- package/es/components/Layer/index.d.ts +6 -4
- package/es/components/Layer/index.js +6 -5
- package/es/components/Link/Link.d.ts +3 -2
- package/es/components/Link/Link.js +2 -1
- package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/es/components/ListBox/ListBoxMenuItem.js +15 -37
- 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 +49 -121
- package/es/components/Modal/next/index.d.ts +171 -0
- 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 +13 -5
- package/es/components/Notification/Notification.js +4 -3
- package/es/components/OverflowMenu/OverflowMenu.d.ts +8 -4
- 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 +3 -2
- package/es/components/Search/Search.js +6 -4
- package/es/components/Slider/Slider.d.ts +15 -16
- package/es/components/Slider/Slider.js +22 -22
- package/es/components/Tabs/Tabs.d.ts +6 -3
- package/es/components/Tabs/Tabs.js +9 -8
- package/es/components/Tag/DismissibleTag.d.ts +5 -3
- package/es/components/Tag/DismissibleTag.js +2 -1
- package/es/components/Tag/OperationalTag.d.ts +3 -2
- package/es/components/Tag/OperationalTag.js +2 -1
- package/es/components/Tag/SelectableTag.d.ts +5 -3
- package/es/components/Tag/SelectableTag.js +2 -1
- package/es/components/Tag/Tag.d.ts +3 -2
- package/es/components/Tag/Tag.js +2 -1
- package/es/components/Tile/Tile.d.ts +5 -3
- package/es/components/Tile/Tile.js +6 -8
- 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 +5 -3
- package/es/components/TreeView/TreeNode.js +4 -3
- 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 +3 -2
- package/es/components/UIShell/SideNavHeader.js +2 -1
- 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.js +24 -21
- package/es/internal/focus/index.js +15 -0
- package/es/internal/keyboard/keys.js +2 -2
- package/es/internal/keyboard/match.js +41 -17
- package/es/internal/keyboard/navigation.js +27 -15
- package/es/internal/useMergedRefs.js +0 -3
- package/lib/components/Accordion/AccordionItem.js +2 -2
- package/lib/components/Button/Button.d.ts +3 -2
- package/lib/components/Button/Button.js +2 -1
- package/lib/components/Button/ButtonBase.js +1 -1
- package/lib/components/ChatButton/ChatButton.d.ts +3 -2
- package/lib/components/ChatButton/ChatButton.js +2 -1
- package/lib/components/ComboBox/ComboBox.js +24 -34
- package/lib/components/ComposedModal/ComposedModal.js +50 -64
- 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 +5 -6
- 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 +4 -42
- package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/lib/components/FeatureFlags/index.d.ts +1 -3
- package/lib/components/FeatureFlags/index.js +0 -3
- 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 +4 -6
- package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/Grid/CSSGrid.js +14 -18
- package/lib/components/Grid/FlexGrid.js +6 -7
- package/lib/components/Grid/GridTypes.d.ts +3 -5
- package/lib/components/IconButton/index.js +3 -3
- package/lib/components/Layer/index.d.ts +6 -4
- package/lib/components/Layer/index.js +6 -5
- package/lib/components/Link/Link.d.ts +3 -2
- package/lib/components/Link/Link.js +2 -1
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/lib/components/ListBox/ListBoxMenuItem.js +14 -36
- 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 +51 -123
- package/lib/components/Modal/next/index.d.ts +171 -0
- 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 +13 -5
- package/lib/components/Notification/Notification.js +4 -3
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +8 -4
- 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 +3 -2
- package/lib/components/Search/Search.js +6 -4
- package/lib/components/Slider/Slider.d.ts +15 -16
- package/lib/components/Slider/Slider.js +22 -22
- package/lib/components/Tabs/Tabs.d.ts +6 -3
- package/lib/components/Tabs/Tabs.js +9 -8
- package/lib/components/Tag/DismissibleTag.d.ts +5 -3
- package/lib/components/Tag/DismissibleTag.js +2 -1
- package/lib/components/Tag/OperationalTag.d.ts +3 -2
- package/lib/components/Tag/OperationalTag.js +2 -1
- package/lib/components/Tag/SelectableTag.d.ts +5 -3
- package/lib/components/Tag/SelectableTag.js +2 -1
- package/lib/components/Tag/Tag.d.ts +3 -2
- package/lib/components/Tag/Tag.js +2 -1
- package/lib/components/Tile/Tile.d.ts +5 -3
- package/lib/components/Tile/Tile.js +6 -8
- 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 +5 -3
- package/lib/components/TreeView/TreeNode.js +4 -3
- 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 +3 -2
- package/lib/components/UIShell/SideNavHeader.js +2 -1
- 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.js +24 -21
- package/lib/internal/focus/index.js +19 -0
- package/lib/internal/keyboard/keys.js +2 -2
- package/lib/internal/keyboard/match.js +41 -17
- package/lib/internal/keyboard/navigation.js +27 -15
- package/lib/internal/useMergedRefs.js +0 -3
- package/package.json +6 -6
- package/telemetry.yml +0 -1
- package/es/components/Dialog/index.js +0 -177
- package/es/internal/OptimizedResize.d.ts +0 -18
- package/es/internal/keyboard/index.d.ts +0 -9
- package/es/internal/keyboard/keys.d.ts +0 -23
- package/es/internal/keyboard/match.d.ts +0 -26
- package/es/internal/keyboard/navigation.d.ts +0 -37
- package/lib/components/Dialog/index.js +0 -190
- package/lib/internal/OptimizedResize.d.ts +0 -18
- package/lib/internal/keyboard/index.d.ts +0 -9
- package/lib/internal/keyboard/keys.d.ts +0 -23
- package/lib/internal/keyboard/match.d.ts +0 -26
- package/lib/internal/keyboard/navigation.d.ts +0 -37
- package/scss/components/dialog/_dialog.scss +0 -9
- package/scss/components/dialog/_index.scss +0 -9
|
@@ -19,23 +19,22 @@ var Button = require('../Button/Button.js');
|
|
|
19
19
|
require('../Button/Button.Skeleton.js');
|
|
20
20
|
var ButtonSet = require('../ButtonSet/ButtonSet.js');
|
|
21
21
|
var InlineLoading = require('../InlineLoading/InlineLoading.js');
|
|
22
|
-
var index$
|
|
22
|
+
var index$1 = require('../Layer/index.js');
|
|
23
23
|
var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
|
|
24
24
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
25
25
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
26
26
|
var useId = require('../../internal/useId.js');
|
|
27
27
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
28
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
29
|
-
var match = require('../../internal/keyboard/match.js');
|
|
30
28
|
var index$2 = require('../IconButton/index.js');
|
|
31
29
|
var noopFn = require('../../internal/noopFn.js');
|
|
32
30
|
require('../Text/index.js');
|
|
33
31
|
var index = require('../FeatureFlags/index.js');
|
|
34
32
|
var events = require('../../tools/events.js');
|
|
35
33
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
36
|
-
var index$1 = require('../Dialog/index.js');
|
|
37
34
|
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js');
|
|
35
|
+
var match = require('../../internal/keyboard/match.js');
|
|
38
36
|
var Text = require('../Text/Text.js');
|
|
37
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
39
38
|
|
|
40
39
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
41
40
|
|
|
@@ -97,7 +96,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
97
96
|
[`${prefix}--btn--loading`]: loadingStatus !== 'inactive'
|
|
98
97
|
});
|
|
99
98
|
const loadingActive = loadingStatus !== 'inactive';
|
|
100
|
-
const
|
|
99
|
+
const focusTrapWithoutSentinels = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
|
|
101
100
|
function isCloseButton(element) {
|
|
102
101
|
return !onSecondarySubmit && element === secondaryButton.current || element.classList.contains(modalCloseButtonClass);
|
|
103
102
|
}
|
|
@@ -110,6 +109,13 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
110
109
|
if (match.match(evt, keys.Enter) && shouldSubmitOnEnter && !isCloseButton(evt.target)) {
|
|
111
110
|
onRequestSubmit(evt);
|
|
112
111
|
}
|
|
112
|
+
if (focusTrapWithoutSentinels && match.match(evt, keys.Tab) && innerModal.current) {
|
|
113
|
+
wrapFocus.wrapFocusWithoutSentinels({
|
|
114
|
+
containerNode: innerModal.current,
|
|
115
|
+
currentActiveNode: evt.target,
|
|
116
|
+
event: evt
|
|
117
|
+
});
|
|
118
|
+
}
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
function handleOnClick(evt) {
|
|
@@ -185,46 +191,40 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
185
191
|
}
|
|
186
192
|
React.useEffect(() => {
|
|
187
193
|
return () => {
|
|
188
|
-
|
|
189
|
-
toggleClass["default"](document.body, `${prefix}--body--with-modal-open`, false);
|
|
190
|
-
}
|
|
194
|
+
toggleClass["default"](document.body, `${prefix}--body--with-modal-open`, false);
|
|
191
195
|
};
|
|
192
|
-
}, [prefix
|
|
196
|
+
}, [prefix]);
|
|
193
197
|
React.useEffect(() => {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
}, [open, prefix, enableDialogElement]);
|
|
198
|
+
toggleClass["default"](document.body, `${prefix}--body--with-modal-open`, open ?? false);
|
|
199
|
+
}, [open, prefix]);
|
|
198
200
|
React.useEffect(() => {
|
|
199
|
-
if (!
|
|
201
|
+
if (!open && launcherButtonRef) {
|
|
200
202
|
setTimeout(() => {
|
|
201
203
|
if ('current' in launcherButtonRef) {
|
|
202
204
|
launcherButtonRef.current?.focus();
|
|
203
205
|
}
|
|
204
206
|
});
|
|
205
207
|
}
|
|
206
|
-
}, [open, launcherButtonRef
|
|
208
|
+
}, [open, launcherButtonRef]);
|
|
207
209
|
React.useEffect(() => {
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
target.focus();
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
if (open) {
|
|
224
|
-
focusButton(innerModal.current);
|
|
210
|
+
const initialFocus = focusContainerElement => {
|
|
211
|
+
const containerElement = focusContainerElement || innerModal.current;
|
|
212
|
+
const primaryFocusElement = containerElement ? containerElement.querySelector(danger ? `.${prefix}--btn--secondary` : selectorPrimaryFocus) : null;
|
|
213
|
+
if (primaryFocusElement) {
|
|
214
|
+
return primaryFocusElement;
|
|
215
|
+
}
|
|
216
|
+
return button && button.current;
|
|
217
|
+
};
|
|
218
|
+
const focusButton = focusContainerElement => {
|
|
219
|
+
const target = initialFocus(focusContainerElement);
|
|
220
|
+
if (target !== null) {
|
|
221
|
+
target.focus();
|
|
225
222
|
}
|
|
223
|
+
};
|
|
224
|
+
if (open) {
|
|
225
|
+
focusButton(innerModal.current);
|
|
226
226
|
}
|
|
227
|
-
}, [open, selectorPrimaryFocus, danger, prefix
|
|
227
|
+
}, [open, selectorPrimaryFocus, danger, prefix]);
|
|
228
228
|
useIsomorphicEffect["default"](() => {
|
|
229
229
|
if (contentRef.current) {
|
|
230
230
|
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
@@ -264,84 +264,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
264
264
|
tabIndex: "-1",
|
|
265
265
|
className: `${modalCloseButtonClass}__icon`
|
|
266
266
|
})));
|
|
267
|
-
|
|
268
|
-
// alertdialog is the only permitted aria role for a native dialog element
|
|
269
|
-
// https://www.w3.org/TR/html-aria/#docconformance:~:text=Role%3A-,alertdialog,-.%20(dialog%20is
|
|
270
|
-
const isAlertDialog = alert && !passiveModal;
|
|
271
|
-
const modalBody = enableDialogElement ? /*#__PURE__*/React__default["default"].createElement(index$1.unstable__Dialog, {
|
|
272
|
-
open: open,
|
|
273
|
-
modal: true,
|
|
274
|
-
ref: innerModal,
|
|
275
|
-
role: isAlertDialog ? 'alertdialog' : '',
|
|
276
|
-
"aria-describedby": isAlertDialog ? modalBodyId : '',
|
|
277
|
-
className: containerClasses,
|
|
278
|
-
"aria-label": ariaLabel
|
|
279
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
280
|
-
className: `${prefix}--modal-header`
|
|
281
|
-
}, modalLabel && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
282
|
-
as: "h2",
|
|
283
|
-
id: modalLabelId,
|
|
284
|
-
className: `${prefix}--modal-header__label`
|
|
285
|
-
}, modalLabel), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
286
|
-
as: "h2",
|
|
287
|
-
id: modalHeadingId,
|
|
288
|
-
className: `${prefix}--modal-header__heading`
|
|
289
|
-
}, modalHeading), decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
290
|
-
className: `${prefix}--modal--inner__decorator`
|
|
291
|
-
}, normalizedDecorator) : '', /*#__PURE__*/React__default["default"].createElement("div", {
|
|
292
|
-
className: `${prefix}--modal-close-button`
|
|
293
|
-
}, /*#__PURE__*/React__default["default"].createElement(index$2.IconButton, {
|
|
294
|
-
className: modalCloseButtonClass,
|
|
295
|
-
label: closeButtonLabel,
|
|
296
|
-
onClick: onRequestClose,
|
|
297
|
-
"aria-label": closeButtonLabel,
|
|
298
|
-
align: "left",
|
|
299
|
-
ref: button
|
|
300
|
-
}, /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, {
|
|
301
|
-
size: 20,
|
|
302
|
-
"aria-hidden": "true",
|
|
303
|
-
tabIndex: "-1",
|
|
304
|
-
className: `${modalCloseButtonClass}__icon`
|
|
305
|
-
})))), /*#__PURE__*/React__default["default"].createElement(index$3.Layer, _rollupPluginBabelHelpers["extends"]({
|
|
306
|
-
ref: contentRef,
|
|
307
|
-
id: modalBodyId,
|
|
308
|
-
className: contentClasses
|
|
309
|
-
}, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/React__default["default"].createElement(ButtonSet["default"], {
|
|
310
|
-
className: footerClasses,
|
|
311
|
-
"aria-busy": loadingActive
|
|
312
|
-
}, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map((_ref3, i) => {
|
|
313
|
-
let {
|
|
314
|
-
buttonText,
|
|
315
|
-
onClick: onButtonClick
|
|
316
|
-
} = _ref3;
|
|
317
|
-
return /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
318
|
-
key: `${buttonText}-${i}`,
|
|
319
|
-
kind: "secondary",
|
|
320
|
-
onClick: onButtonClick
|
|
321
|
-
}, buttonText);
|
|
322
|
-
}) : secondaryButtonText && /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
323
|
-
disabled: loadingActive,
|
|
324
|
-
kind: "secondary",
|
|
325
|
-
onClick: onSecondaryButtonClick,
|
|
326
|
-
ref: secondaryButton
|
|
327
|
-
}, secondaryButtonText), /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
328
|
-
className: primaryButtonClass,
|
|
329
|
-
kind: danger ? 'danger' : 'primary',
|
|
330
|
-
disabled: loadingActive || primaryButtonDisabled,
|
|
331
|
-
onClick: onRequestSubmit,
|
|
332
|
-
ref: button
|
|
333
|
-
}, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React__default["default"].createElement(InlineLoading["default"], {
|
|
334
|
-
status: loadingStatus,
|
|
335
|
-
description: loadingDescription,
|
|
336
|
-
iconDescription: loadingIconDescription,
|
|
337
|
-
className: `${prefix}--inline-loading--btn`,
|
|
338
|
-
onSuccess: onLoadingSuccess
|
|
339
|
-
})))) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !enableDialogElement && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
340
|
-
ref: startTrap,
|
|
341
|
-
tabIndex: 0,
|
|
342
|
-
role: "link",
|
|
343
|
-
className: `${prefix}--visually-hidden`
|
|
344
|
-
}, "Focus sentinel"), /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
267
|
+
const modalBody = /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
345
268
|
ref: innerModal,
|
|
346
269
|
role: "dialog"
|
|
347
270
|
}, alertDialogProps, {
|
|
@@ -361,18 +284,18 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
361
284
|
className: `${prefix}--modal-header__heading`
|
|
362
285
|
}, modalHeading), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
363
286
|
className: `${prefix}--modal--inner__decorator`
|
|
364
|
-
}, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/React__default["default"].createElement(index$
|
|
287
|
+
}, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/React__default["default"].createElement(index$1.Layer, _rollupPluginBabelHelpers["extends"]({
|
|
365
288
|
ref: contentRef,
|
|
366
289
|
id: modalBodyId,
|
|
367
290
|
className: contentClasses
|
|
368
291
|
}, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/React__default["default"].createElement(ButtonSet["default"], {
|
|
369
292
|
className: footerClasses,
|
|
370
293
|
"aria-busy": loadingActive
|
|
371
|
-
}, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map((
|
|
294
|
+
}, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map((_ref3, i) => {
|
|
372
295
|
let {
|
|
373
296
|
buttonText,
|
|
374
297
|
onClick: onButtonClick
|
|
375
|
-
} =
|
|
298
|
+
} = _ref3;
|
|
376
299
|
return /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
377
300
|
key: `${buttonText}-${i}`,
|
|
378
301
|
kind: "secondary",
|
|
@@ -395,21 +318,26 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
395
318
|
iconDescription: loadingIconDescription,
|
|
396
319
|
className: `${prefix}--inline-loading--btn`,
|
|
397
320
|
onSuccess: onLoadingSuccess
|
|
398
|
-
}))))
|
|
399
|
-
|
|
400
|
-
tabIndex: 0,
|
|
401
|
-
role: "link",
|
|
402
|
-
className: `${prefix}--visually-hidden`
|
|
403
|
-
}, "Focus sentinel"));
|
|
404
|
-
return /*#__PURE__*/React__default["default"].createElement(index$3.Layer, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
321
|
+
}))));
|
|
322
|
+
return /*#__PURE__*/React__default["default"].createElement(index$1.Layer, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
405
323
|
level: 0,
|
|
406
324
|
onKeyDown: handleKeyDown,
|
|
407
325
|
onClick: events.composeEventHandlers([rest?.onClick, handleOnClick]),
|
|
408
|
-
onBlur: !
|
|
326
|
+
onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
|
|
409
327
|
className: modalClasses,
|
|
410
328
|
role: "presentation",
|
|
411
329
|
ref: ref
|
|
412
|
-
}),
|
|
330
|
+
}), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
331
|
+
ref: startTrap,
|
|
332
|
+
tabIndex: 0,
|
|
333
|
+
role: "link",
|
|
334
|
+
className: `${prefix}--visually-hidden`
|
|
335
|
+
}, "Focus sentinel"), modalBody, !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
336
|
+
ref: endTrap,
|
|
337
|
+
tabIndex: 0,
|
|
338
|
+
role: "link",
|
|
339
|
+
className: `${prefix}--visually-hidden`
|
|
340
|
+
}, "Focus sentinel"));
|
|
413
341
|
});
|
|
414
342
|
Modal.propTypes = {
|
|
415
343
|
/**
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
import { ReactAttr } from '../../../types/common';
|
|
9
|
+
import { InlineLoadingStatus } from '../../InlineLoading/InlineLoading';
|
|
10
|
+
export declare const ModalSizes: readonly ["xs", "sm", "md", "lg"];
|
|
11
|
+
export type ModalSize = (typeof ModalSizes)[number];
|
|
12
|
+
export interface ModalSecondaryButton {
|
|
13
|
+
buttonText?: string | ReactNode;
|
|
14
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
15
|
+
}
|
|
16
|
+
export interface BaseModalProps extends ReactAttr<HTMLDivElement> {
|
|
17
|
+
/**
|
|
18
|
+
* Required props for the accessibility label of the header
|
|
19
|
+
*/
|
|
20
|
+
'aria-label'?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Provide the contents of your Modal
|
|
23
|
+
*/
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Specify an optional className to be applied to the modal root node
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Specify an label for the close button of the modal; defaults to close
|
|
31
|
+
*/
|
|
32
|
+
closeButtonLabel?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Specify whether the Modal is for dangerous actions
|
|
35
|
+
*/
|
|
36
|
+
danger?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
39
|
+
*/
|
|
40
|
+
decorator?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Specify whether the modal contains scrolling content
|
|
43
|
+
*/
|
|
44
|
+
hasScrollingContent?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Specify the DOM element ID of the top-level node.
|
|
47
|
+
*/
|
|
48
|
+
id?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Specify whether or not the Modal content should have any inner padding.
|
|
51
|
+
*/
|
|
52
|
+
isFullWidth?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Specify the description for the loading text
|
|
55
|
+
*/
|
|
56
|
+
loadingDescription?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Specify the description for the loading text
|
|
59
|
+
*/
|
|
60
|
+
loadingIconDescription?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Specify loading status
|
|
63
|
+
*/
|
|
64
|
+
loadingStatus?: InlineLoadingStatus;
|
|
65
|
+
/**
|
|
66
|
+
* Specify a label to be read by screen readers on the modal root node
|
|
67
|
+
*/
|
|
68
|
+
modalAriaLabel?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Specify the content of the modal header title.
|
|
71
|
+
*/
|
|
72
|
+
modalHeading?: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Specify the content of the modal header label.
|
|
75
|
+
*/
|
|
76
|
+
modalLabel?: ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* Specify a handler for keypresses.
|
|
79
|
+
* @deprecated this property is unused
|
|
80
|
+
*/
|
|
81
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
82
|
+
/**
|
|
83
|
+
* Specify an optional handler to be invoked when loading is
|
|
84
|
+
* successful
|
|
85
|
+
*/
|
|
86
|
+
onLoadingSuccess?: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Specify a handler for closing modal.
|
|
89
|
+
* The handler should care of closing modal, e.g. changing `open` prop.
|
|
90
|
+
*/
|
|
91
|
+
onRequestClose?: React.ReactEventHandler<HTMLElement>;
|
|
92
|
+
/**
|
|
93
|
+
* Specify a handler for "submitting" modal.
|
|
94
|
+
* The handler should care of closing modal, e.g. changing `open` prop, if necessary.
|
|
95
|
+
*/
|
|
96
|
+
onRequestSubmit?: React.ReactEventHandler<HTMLElement>;
|
|
97
|
+
/**
|
|
98
|
+
* Specify a handler for the secondary button.
|
|
99
|
+
* Useful if separate handler from `onRequestClose` is desirable
|
|
100
|
+
*/
|
|
101
|
+
onSecondarySubmit?: React.ReactEventHandler<HTMLElement>;
|
|
102
|
+
/**
|
|
103
|
+
* Specify whether the Modal is currently open
|
|
104
|
+
*/
|
|
105
|
+
open?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Prevent closing on click outside of modal
|
|
108
|
+
*/
|
|
109
|
+
preventCloseOnClickOutside?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Specify whether the Button should be disabled, or not
|
|
112
|
+
*/
|
|
113
|
+
primaryButtonDisabled?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Specify the text for the primary button
|
|
116
|
+
*/
|
|
117
|
+
primaryButtonText?: ReactNode;
|
|
118
|
+
/**
|
|
119
|
+
* Specify the text for the secondary button
|
|
120
|
+
*/
|
|
121
|
+
secondaryButtonText?: ReactNode;
|
|
122
|
+
/**
|
|
123
|
+
* Specify an array of config objects for secondary buttons
|
|
124
|
+
*/
|
|
125
|
+
secondaryButtons?: ModalSecondaryButton[];
|
|
126
|
+
/**
|
|
127
|
+
* Specify a CSS selector that matches the DOM element that should
|
|
128
|
+
* be focused when the Modal opens
|
|
129
|
+
*/
|
|
130
|
+
selectorPrimaryFocus?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Specify CSS selectors that match DOM elements working as floating menus.
|
|
133
|
+
* Focusing on those elements won't trigger "focus-wrap" behavior
|
|
134
|
+
*/
|
|
135
|
+
selectorsFloatingMenus?: string[];
|
|
136
|
+
/**
|
|
137
|
+
* Specify if Enter key should be used as "submit" action
|
|
138
|
+
*/
|
|
139
|
+
shouldSubmitOnEnter?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Specify the size variant.
|
|
142
|
+
*/
|
|
143
|
+
size?: ModalSize;
|
|
144
|
+
}
|
|
145
|
+
interface PassiveModal extends BaseModalProps {
|
|
146
|
+
/**
|
|
147
|
+
* Specify whether the modal should be button-less
|
|
148
|
+
*/
|
|
149
|
+
passiveModal?: true;
|
|
150
|
+
/**
|
|
151
|
+
* Specify whether the Modal is displaying an alert, error or warning. Should
|
|
152
|
+
* go hand in hand with the `danger` prop. This changes the `role` to
|
|
153
|
+
* `alertdialog` and cannot be used with passive modals.
|
|
154
|
+
*/
|
|
155
|
+
alert?: never;
|
|
156
|
+
}
|
|
157
|
+
interface NonPassiveModal extends BaseModalProps {
|
|
158
|
+
/**
|
|
159
|
+
* Specify whether the modal should be button-less
|
|
160
|
+
*/
|
|
161
|
+
passiveModal?: false;
|
|
162
|
+
/**
|
|
163
|
+
* Specify whether the Modal is displaying an alert, error or warning. Should
|
|
164
|
+
* go hand in hand with the `danger` prop. This changes the `role` to
|
|
165
|
+
* `alertdialog` and cannot be used with passive modals.
|
|
166
|
+
*/
|
|
167
|
+
alert?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export type ModalProps = PassiveModal | NonPassiveModal;
|
|
170
|
+
declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
171
|
+
export default Modal;
|
|
@@ -17,8 +17,8 @@ var Button = require('../Button/Button.js');
|
|
|
17
17
|
require('../Button/Button.Skeleton.js');
|
|
18
18
|
var warning = require('../../internal/warning.js');
|
|
19
19
|
var noopFn = require('../../internal/noopFn.js');
|
|
20
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
21
20
|
var match = require('../../internal/keyboard/match.js');
|
|
21
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
22
22
|
|
|
23
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
24
|
|
|
@@ -21,8 +21,6 @@ var MultiSelectPropTypes = require('./MultiSelectPropTypes.js');
|
|
|
21
21
|
var index = require('../ListBox/index.js');
|
|
22
22
|
var ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
|
|
23
23
|
var ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
|
|
24
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
25
|
-
var match = require('../../internal/keyboard/match.js');
|
|
26
24
|
var itemToString = require('./tools/itemToString.js');
|
|
27
25
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
28
26
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
@@ -33,7 +31,9 @@ require('../FluidForm/FluidForm.js');
|
|
|
33
31
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
34
32
|
var Selection = require('../../internal/Selection.js');
|
|
35
33
|
var react = require('@floating-ui/react');
|
|
34
|
+
var match = require('../../internal/keyboard/match.js');
|
|
36
35
|
var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
36
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
37
37
|
|
|
38
38
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
39
|
|
|
@@ -426,7 +426,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
426
426
|
});
|
|
427
427
|
function clearInputValue(event) {
|
|
428
428
|
const value = textInput.current?.value;
|
|
429
|
-
if (value?.length === 1 || event &&
|
|
429
|
+
if (value?.length === 1 || event && match.match(event, keys.Escape)) {
|
|
430
430
|
setInputValue('');
|
|
431
431
|
} else {
|
|
432
432
|
setInputValue(value ?? '');
|
|
@@ -23,8 +23,6 @@ var Selection = require('../../internal/Selection.js');
|
|
|
23
23
|
var useId = require('../../internal/useId.js');
|
|
24
24
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
25
25
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
26
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
27
|
-
var match = require('../../internal/keyboard/match.js');
|
|
28
26
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
29
27
|
require('../FluidForm/FluidForm.js');
|
|
30
28
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
@@ -33,7 +31,9 @@ require('../Checkbox/Checkbox.Skeleton.js');
|
|
|
33
31
|
var noopFn = require('../../internal/noopFn.js');
|
|
34
32
|
var react = require('@floating-ui/react');
|
|
35
33
|
var index = require('../FeatureFlags/index.js');
|
|
34
|
+
var match = require('../../internal/keyboard/match.js');
|
|
36
35
|
var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
36
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
37
37
|
|
|
38
38
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
39
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
8
|
+
import React, { type ReactNode, type MouseEvent, type ComponentType, type FunctionComponent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
9
9
|
import { type ButtonProps } from '../Button';
|
|
10
10
|
export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
11
11
|
/**
|
|
@@ -71,9 +71,16 @@ export interface NotificationButtonProps extends ButtonHTMLAttributes<HTMLButton
|
|
|
71
71
|
*/
|
|
72
72
|
notificationType?: 'toast' | 'inline' | 'actionable';
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Optional prop to allow overriding the icon rendering.
|
|
75
|
+
* Can be a React component class
|
|
75
76
|
*/
|
|
76
|
-
renderIcon?:
|
|
77
|
+
renderIcon?: ComponentType<{
|
|
78
|
+
className?: string;
|
|
79
|
+
name?: string;
|
|
80
|
+
}> | FunctionComponent<{
|
|
81
|
+
className?: string;
|
|
82
|
+
name?: string;
|
|
83
|
+
}>;
|
|
77
84
|
}
|
|
78
85
|
export declare function NotificationButton({ 'aria-label': ariaLabel, ariaLabel: deprecatedAriaLabel, className, type, renderIcon: IconTag, name, notificationType, ...rest }: NotificationButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
79
86
|
export declare namespace NotificationButton {
|
|
@@ -101,7 +108,8 @@ export declare namespace NotificationButton {
|
|
|
101
108
|
*/
|
|
102
109
|
notificationType: PropTypes.Requireable<string>;
|
|
103
110
|
/**
|
|
104
|
-
*
|
|
111
|
+
* Optional prop to allow overriding the icon rendering.
|
|
112
|
+
* Can be a React component class
|
|
105
113
|
*/
|
|
106
114
|
renderIcon: PropTypes.Requireable<object>;
|
|
107
115
|
/**
|
|
@@ -20,8 +20,6 @@ var Button = require('../Button/Button.js');
|
|
|
20
20
|
require('../Button/Button.Skeleton.js');
|
|
21
21
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
22
22
|
var useNoInteractiveChildren = require('../../internal/useNoInteractiveChildren.js');
|
|
23
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
24
|
-
var match = require('../../internal/keyboard/match.js');
|
|
25
23
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
26
24
|
var useId = require('../../internal/useId.js');
|
|
27
25
|
var noopFn = require('../../internal/noopFn.js');
|
|
@@ -29,7 +27,9 @@ var wrapFocus = require('../../internal/wrapFocus.js');
|
|
|
29
27
|
var index = require('../FeatureFlags/index.js');
|
|
30
28
|
var warning = require('../../internal/warning.js');
|
|
31
29
|
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
30
|
+
var match = require('../../internal/keyboard/match.js');
|
|
32
31
|
var Text = require('../Text/Text.js');
|
|
32
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
33
33
|
|
|
34
34
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
35
35
|
|
|
@@ -155,7 +155,8 @@ NotificationButton.propTypes = {
|
|
|
155
155
|
*/
|
|
156
156
|
notificationType: PropTypes__default["default"].oneOf(['toast', 'inline', 'actionable']),
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
158
|
+
* Optional prop to allow overriding the icon rendering.
|
|
159
|
+
* Can be a React component class
|
|
159
160
|
*/
|
|
160
161
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
161
162
|
/**
|
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { type MenuDirection, type MenuOffset } from '../../internal/FloatingMenu';
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { ComponentType } from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
export declare const getMenuOffset: MenuOffset;
|
|
11
|
+
type IconProps = {
|
|
12
|
+
className?: string;
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
};
|
|
11
15
|
export interface OverflowMenuProps {
|
|
12
16
|
/**
|
|
13
17
|
* Specify a label to be read by screen readers on the container node
|
|
@@ -85,9 +89,9 @@ export interface OverflowMenuProps {
|
|
|
85
89
|
*/
|
|
86
90
|
open?: boolean;
|
|
87
91
|
/**
|
|
88
|
-
*
|
|
92
|
+
* Function called to override icon rendering.
|
|
89
93
|
*/
|
|
90
|
-
renderIcon?:
|
|
94
|
+
renderIcon?: ComponentType<IconProps>;
|
|
91
95
|
/**
|
|
92
96
|
* Specify a CSS selector that matches the DOM element that should
|
|
93
97
|
* be focused when the OverflowMenu opens
|
|
@@ -204,7 +208,7 @@ declare class OverflowMenu extends React.Component<OverflowMenuProps, OverflowMe
|
|
|
204
208
|
*/
|
|
205
209
|
open: PropTypes.Requireable<boolean>;
|
|
206
210
|
/**
|
|
207
|
-
*
|
|
211
|
+
* Function called to override icon rendering.
|
|
208
212
|
*/
|
|
209
213
|
renderIcon: PropTypes.Requireable<object>;
|
|
210
214
|
/**
|
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var FloatingMenu = require('../../internal/FloatingMenu.js');
|
|
14
14
|
var React = require('react');
|
|
15
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
16
|
-
var match = require('../../internal/keyboard/match.js');
|
|
17
15
|
var ClickListener = require('../../internal/ClickListener.js');
|
|
18
16
|
var index = require('../IconButton/index.js');
|
|
19
17
|
var iconsReact = require('@carbon/icons-react');
|
|
@@ -25,6 +23,8 @@ var invariant = require('invariant');
|
|
|
25
23
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
26
24
|
var noopFn = require('../../internal/noopFn.js');
|
|
27
25
|
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
26
|
+
var match = require('../../internal/keyboard/match.js');
|
|
27
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
28
28
|
|
|
29
29
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
30
30
|
|
|
@@ -499,7 +499,7 @@ _rollupPluginBabelHelpers.defineProperty(OverflowMenu, "propTypes", {
|
|
|
499
499
|
*/
|
|
500
500
|
open: PropTypes__default["default"].bool,
|
|
501
501
|
/**
|
|
502
|
-
*
|
|
502
|
+
* Function called to override icon rendering.
|
|
503
503
|
*/
|
|
504
504
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
505
505
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2020,
|
|
2
|
+
* Copyright IBM Corp. 2020, 2023
|
|
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 OverflowMenuProps {
|
|
|
27
27
|
*/
|
|
28
28
|
menuAlignment?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Optionally provide a custom icon to be rendered on the trigger button.
|
|
31
31
|
*/
|
|
32
32
|
renderIcon?: ComponentType | FunctionComponent;
|
|
33
33
|
/**
|
|
@@ -175,7 +175,7 @@ OverflowMenu.propTypes = {
|
|
|
175
175
|
*/
|
|
176
176
|
menuAlignment: PropTypes__default["default"].oneOf(['top-start', 'top-end', 'bottom-start', 'bottom-end']),
|
|
177
177
|
/**
|
|
178
|
-
*
|
|
178
|
+
* Optionally provide a custom icon to be rendered on the trigger button.
|
|
179
179
|
*/
|
|
180
180
|
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
181
181
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|