@carbon/ibm-products 2.10.1 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -0
- package/css/index-full-carbon.css +72 -26
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +72 -26
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +69 -25
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.js +10 -3
- package/es/components/AboutModal/AboutModal.js +10 -3
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +17 -5
- package/es/components/CreateModal/CreateModal.js +10 -3
- package/es/components/Datagrid/Datagrid/DatagridContent.js +9 -7
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +5 -3
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +26 -13
- package/es/components/Datagrid/Datagrid/DatagridRow.js +47 -40
- package/es/components/Datagrid/Datagrid/DraggableElement.js +36 -132
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +17 -49
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +125 -40
- package/es/components/Datagrid/useActionsColumn.js +5 -3
- package/es/components/Datagrid/useExpandedRow.js +1 -1
- package/es/components/Datagrid/utils/DatagridPagination.js +1 -1
- package/es/components/EmptyStates/EmptyState.js +1 -1
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -11
- package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -11
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -12
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -12
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -12
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -12
- package/es/components/ExportModal/ExportModal.js +10 -3
- package/es/components/ImportModal/ImportModal.js +10 -3
- package/es/components/RemoveModal/RemoveModal.js +10 -3
- package/es/components/TagSet/TagSet.js +5 -21
- package/es/components/TagSet/TagSetModal.js +7 -3
- package/es/components/Tearsheet/TearsheetShell.js +12 -26
- package/es/components/index.js +1 -1
- package/es/global/decorators/sidePanelDecorator.js +7 -0
- package/es/global/js/hooks/usePortalTarget.js +30 -0
- package/es/global/js/hooks/useWindowScroll.js +5 -0
- package/es/global/js/package-settings.js +1 -1
- package/es/global/js/utils/getNodeTextContent.js +47 -0
- package/flags.js +6 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +10 -3
- package/lib/components/AboutModal/AboutModal.js +10 -3
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +17 -5
- package/lib/components/CreateModal/CreateModal.js +10 -3
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +9 -7
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -2
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +26 -13
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +46 -41
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +37 -137
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +20 -49
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +130 -47
- package/lib/components/Datagrid/useActionsColumn.js +5 -3
- package/lib/components/Datagrid/useExpandedRow.js +1 -1
- package/lib/components/Datagrid/utils/DatagridPagination.js +1 -1
- package/lib/components/EmptyStates/EmptyState.js +1 -1
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -11
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -11
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -12
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -12
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -12
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -12
- package/lib/components/ExportModal/ExportModal.js +10 -3
- package/lib/components/ImportModal/ImportModal.js +10 -3
- package/lib/components/RemoveModal/RemoveModal.js +10 -3
- package/lib/components/TagSet/TagSet.js +5 -21
- package/lib/components/TagSet/TagSetModal.js +7 -3
- package/lib/components/Tearsheet/TearsheetShell.js +12 -26
- package/lib/components/index.js +6 -0
- package/lib/global/decorators/sidePanelDecorator.js +7 -0
- package/lib/global/js/hooks/usePortalTarget.js +38 -0
- package/lib/global/js/hooks/useWindowScroll.js +6 -0
- package/lib/global/js/package-settings.js +1 -1
- package/lib/global/js/utils/getNodeTextContent.js +55 -0
- package/package.json +11 -7
- package/scss/components/ActionSet/_action-set.scss +2 -1
- package/scss/components/Datagrid/styles/_datagrid.scss +11 -6
- package/scss/components/Datagrid/styles/_draggableElement.scss +34 -16
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +13 -0
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +1 -1
- package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +22 -11
- package/scss/components/Datagrid/styles/addons/_FilterPanel.scss +6 -3
- package/scss/components/FilterSummary/_filter-summary.scss +2 -1
- package/scss/global/decorators/_side-panel-decorator.scss +7 -0
- package/scss/global/js/utils/_story-as-full-page.scss +0 -6
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
var _excluded = ["body", "className", "error", "errorMessage", "filename", "hidePasswordLabel", "inputLabel", "inputType", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "showPasswordLabel", "successMessage", "successful", "title", "validExtensions"];
|
5
|
+
var _excluded = ["body", "className", "error", "errorMessage", "filename", "hidePasswordLabel", "inputLabel", "inputType", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "portalTarget", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "showPasswordLabel", "successMessage", "successful", "title", "validExtensions"];
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
8
8
|
//
|
@@ -20,6 +20,7 @@ import PropTypes from 'prop-types';
|
|
20
20
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
21
21
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
22
22
|
import { pkg } from '../../settings';
|
23
|
+
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget';
|
23
24
|
var componentName = 'ExportModal';
|
24
25
|
|
25
26
|
// Default values for props
|
@@ -48,6 +49,7 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
48
49
|
onClose = _ref.onClose,
|
49
50
|
onRequestSubmit = _ref.onRequestSubmit,
|
50
51
|
open = _ref.open,
|
52
|
+
portalTargetIn = _ref.portalTarget,
|
51
53
|
_ref$preformattedExte = _ref.preformattedExtensions,
|
52
54
|
preformattedExtensions = _ref$preformattedExte === void 0 ? defaults.preformattedExtensions : _ref$preformattedExte,
|
53
55
|
preformattedExtensionsLabel = _ref.preformattedExtensionsLabel,
|
@@ -73,6 +75,7 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
73
75
|
_useState6 = _slicedToArray(_useState5, 2),
|
74
76
|
extension = _useState6[0],
|
75
77
|
setExtension = _useState6[1];
|
78
|
+
var renderPortalUse = usePortalTarget(portalTargetIn);
|
76
79
|
useEffect(function () {
|
77
80
|
var _preformattedExtensio;
|
78
81
|
setName(filename);
|
@@ -117,7 +120,7 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
117
120
|
invalidText: invalidInputText,
|
118
121
|
onBlur: onBlurHandler
|
119
122
|
}, 'data-modal-primary-focus', true);
|
120
|
-
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
123
|
+
return renderPortalUse( /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
121
124
|
className: cx(blockClass, className),
|
122
125
|
"aria-label": title,
|
123
126
|
size: "sm",
|
@@ -177,7 +180,7 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
177
180
|
kind: "primary",
|
178
181
|
onClick: onSubmitHandler,
|
179
182
|
disabled: primaryButtonDisabled
|
180
|
-
}, primaryButtonText)));
|
183
|
+
}, primaryButtonText))));
|
181
184
|
});
|
182
185
|
|
183
186
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -239,6 +242,10 @@ ExportModal.propTypes = {
|
|
239
242
|
* Specify whether the Modal is currently open
|
240
243
|
*/
|
241
244
|
open: PropTypes.bool,
|
245
|
+
/**
|
246
|
+
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
247
|
+
*/
|
248
|
+
portalTarget: PropTypes.node,
|
242
249
|
/**
|
243
250
|
* Array of extensions to display as radio buttons
|
244
251
|
*/
|
@@ -4,7 +4,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
7
|
-
var _excluded = ["accept", "className", "defaultErrorBody", "defaultErrorHeader", "description", "fetchErrorBody", "fetchErrorHeader", "fileDropHeader", "fileDropLabel", "fileUploadLabel", "inputButtonIcon", "inputButtonText", "inputId", "inputLabel", "inputPlaceholder", "invalidFileTypeErrorBody", "invalidFileTypeErrorHeader", "invalidIconDescription", "maxFileSize", "maxFileSizeErrorBody", "maxFileSizeErrorHeader", "onClose", "onRequestSubmit", "open", "primaryButtonText", "secondaryButtonText", "title"];
|
7
|
+
var _excluded = ["accept", "className", "defaultErrorBody", "defaultErrorHeader", "description", "fetchErrorBody", "fetchErrorHeader", "fileDropHeader", "fileDropLabel", "fileUploadLabel", "inputButtonIcon", "inputButtonText", "inputId", "inputLabel", "inputPlaceholder", "invalidFileTypeErrorBody", "invalidFileTypeErrorHeader", "invalidIconDescription", "maxFileSize", "maxFileSizeErrorBody", "maxFileSizeErrorHeader", "onClose", "onRequestSubmit", "open", "portalTarget", "primaryButtonText", "secondaryButtonText", "title"];
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
@@ -21,6 +21,7 @@ import { ComposedModal, ModalHeader, ModalFooter, ModalBody, FileUploaderDropCon
|
|
21
21
|
import cx from 'classnames';
|
22
22
|
import PropTypes from 'prop-types';
|
23
23
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
24
|
+
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget';
|
24
25
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
25
26
|
import { pkg } from '../../settings';
|
26
27
|
var componentName = 'ImportModal';
|
@@ -56,6 +57,7 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
56
57
|
onClose = _ref.onClose,
|
57
58
|
onRequestSubmit = _ref.onRequestSubmit,
|
58
59
|
open = _ref.open,
|
60
|
+
portalTargetIn = _ref.portalTarget,
|
59
61
|
primaryButtonText = _ref.primaryButtonText,
|
60
62
|
secondaryButtonText = _ref.secondaryButtonText,
|
61
63
|
title = _ref.title,
|
@@ -69,6 +71,7 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
69
71
|
_useState4 = _slicedToArray(_useState3, 2),
|
70
72
|
importUrl = _useState4[0],
|
71
73
|
setImportUrl = _useState4[1];
|
74
|
+
var renderPortalUse = usePortalTarget(portalTargetIn);
|
72
75
|
var isInvalidFileType = function isInvalidFileType(file) {
|
73
76
|
var acceptSet = new Set(accept);
|
74
77
|
var name = file.name;
|
@@ -193,7 +196,7 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
193
196
|
var importButtonDisabled = !importUrl || hasFiles;
|
194
197
|
var fileStatusString = "".concat(numberOfValidFiles, " / ").concat(numberOfFiles, " ").concat(fileUploadLabel);
|
195
198
|
var blockClass = "".concat(pkg.prefix, "--import-modal");
|
196
|
-
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, _objectSpread({
|
199
|
+
return renderPortalUse( /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, _objectSpread({
|
197
200
|
open: open,
|
198
201
|
ref: ref
|
199
202
|
}, getDevtoolsProps(componentName)), {
|
@@ -270,7 +273,7 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
270
273
|
kind: "primary",
|
271
274
|
onClick: onSubmitHandler,
|
272
275
|
disabled: primaryButtonDisabled
|
273
|
-
}, primaryButtonText)));
|
276
|
+
}, primaryButtonText))));
|
274
277
|
});
|
275
278
|
|
276
279
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -372,6 +375,10 @@ ImportModal.propTypes = {
|
|
372
375
|
* Specify whether the Modal is currently open
|
373
376
|
*/
|
374
377
|
open: PropTypes.bool.isRequired,
|
378
|
+
/**
|
379
|
+
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
380
|
+
*/
|
381
|
+
portalTarget: PropTypes.node,
|
375
382
|
/**
|
376
383
|
* Specify the text for the primary button
|
377
384
|
*/
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "preventCloseOnClickOutside", "primaryButtonDisabled", "primaryButtonText", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
5
|
+
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "portalTarget", "preventCloseOnClickOutside", "primaryButtonDisabled", "primaryButtonText", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
8
8
|
//
|
@@ -20,6 +20,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
20
20
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
21
21
|
import { pkg } from '../../settings';
|
22
22
|
import { usePreviousValue } from '../../global/js/hooks';
|
23
|
+
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget';
|
23
24
|
var componentName = 'RemoveModal';
|
24
25
|
|
25
26
|
/**
|
@@ -38,6 +39,7 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
38
39
|
onClose = _ref.onClose,
|
39
40
|
onRequestSubmit = _ref.onRequestSubmit,
|
40
41
|
open = _ref.open,
|
42
|
+
portalTargetIn = _ref.portalTarget,
|
41
43
|
preventCloseOnClickOutside = _ref.preventCloseOnClickOutside,
|
42
44
|
primaryButtonDisabled = _ref.primaryButtonDisabled,
|
43
45
|
primaryButtonText = _ref.primaryButtonText,
|
@@ -54,6 +56,7 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
54
56
|
userInput = _useState2[0],
|
55
57
|
setUserInput = _useState2[1];
|
56
58
|
var idRef = useRef(uuidv4());
|
59
|
+
var renderPortalUse = usePortalTarget(portalTargetIn);
|
57
60
|
var onChangeHandler = function onChangeHandler(e) {
|
58
61
|
setUserInput(e.target.value);
|
59
62
|
};
|
@@ -77,7 +80,7 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
77
80
|
setUserInput('');
|
78
81
|
}
|
79
82
|
}, [open, previousState === null || previousState === void 0 ? void 0 : previousState.open]);
|
80
|
-
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
83
|
+
return renderPortalUse( /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
81
84
|
className: cx(blockClass, className),
|
82
85
|
size: "sm",
|
83
86
|
"aria-label": title
|
@@ -111,7 +114,7 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
111
114
|
kind: "danger",
|
112
115
|
onClick: onRequestSubmit,
|
113
116
|
disabled: primaryButtonStatus
|
114
|
-
}, primaryButtonText)));
|
117
|
+
}, primaryButtonText))));
|
115
118
|
});
|
116
119
|
|
117
120
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -157,6 +160,10 @@ RemoveModal.propTypes = {
|
|
157
160
|
* Specify whether the Modal is currently open
|
158
161
|
*/
|
159
162
|
open: PropTypes.bool.isRequired,
|
163
|
+
/**
|
164
|
+
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
165
|
+
*/
|
166
|
+
portalTarget: PropTypes.node,
|
160
167
|
/**
|
161
168
|
* Prevent closing on click outside of modal
|
162
169
|
*/
|
@@ -15,7 +15,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
15
15
|
//
|
16
16
|
|
17
17
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
18
|
-
import { createPortal } from 'react-dom';
|
19
18
|
import PropTypes from 'prop-types';
|
20
19
|
import cx from 'classnames';
|
21
20
|
import { TagSetOverflow } from './TagSetOverflow';
|
@@ -32,13 +31,12 @@ var allTagsModalSearchThreshold = 10;
|
|
32
31
|
// Default values for props
|
33
32
|
var defaults = {
|
34
33
|
align: 'start',
|
35
|
-
// allTagsModalTarget: document.body,
|
36
34
|
overflowAlign: 'bottom'
|
37
35
|
};
|
38
36
|
export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
39
37
|
var _ref$align = _ref.align,
|
40
38
|
align = _ref$align === void 0 ? defaults.align : _ref$align,
|
41
|
-
|
39
|
+
allTagsModalTarget = _ref.allTagsModalTarget,
|
42
40
|
className = _ref.className,
|
43
41
|
maxVisible = _ref.maxVisible,
|
44
42
|
multiline = _ref.multiline,
|
@@ -76,22 +74,9 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
76
74
|
sizingTags = _useState10[0],
|
77
75
|
setSizingTags = _useState10[1];
|
78
76
|
var overflowTag = useRef(null);
|
79
|
-
var _useState11 = useState(null),
|
80
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
81
|
-
allTagsModalTarget = _useState12[0],
|
82
|
-
setAllTagsModalTarget = _useState12[1];
|
83
77
|
var handleShowAllClick = function handleShowAllClick() {
|
84
78
|
setShowAllModalOpen(true);
|
85
79
|
};
|
86
|
-
useEffect(function () {
|
87
|
-
if (allTagsModalTargetIn) {
|
88
|
-
setAllTagsModalTarget(allTagsModalTargetIn);
|
89
|
-
} else {
|
90
|
-
if (pkg.isFeatureEnabled('default-portal-target-body')) {
|
91
|
-
setAllTagsModalTarget(document.body);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}, [allTagsModalTargetIn]);
|
95
80
|
useEffect(function () {
|
96
81
|
var newSizingTags = [];
|
97
82
|
// create sizing tags
|
@@ -211,16 +196,15 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
211
196
|
}, hiddenSizingTags), /*#__PURE__*/React.createElement("div", {
|
212
197
|
className: cx(["".concat(blockClass, "__tag-container"), multiline && "".concat(blockClass, "__tag-container--multiline")]),
|
213
198
|
ref: displayedArea
|
214
|
-
}, displayedTags)), (
|
215
|
-
return children;
|
216
|
-
})( /*#__PURE__*/React.createElement(TagSetModal, {
|
199
|
+
}, displayedTags)), /*#__PURE__*/React.createElement(TagSetModal, {
|
217
200
|
allTags: tags,
|
218
201
|
open: showAllModalOpen,
|
219
202
|
title: allTagsModalTitle,
|
220
203
|
onClose: handleModalClose,
|
221
204
|
searchLabel: allTagsModalSearchLabel,
|
222
|
-
searchPlaceholder: allTagsModalSearchPlaceholderText
|
223
|
-
|
205
|
+
searchPlaceholder: allTagsModalSearchPlaceholderText,
|
206
|
+
portalTarget: allTagsModalTarget
|
207
|
+
}));
|
224
208
|
});
|
225
209
|
|
226
210
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
var _excluded = ["allTags", "className", "title", "onClose", "open", "searchLabel", "searchPlaceholder"],
|
5
|
+
var _excluded = ["allTags", "className", "title", "onClose", "open", "portalTarget", "searchLabel", "searchPlaceholder"],
|
6
6
|
_excluded2 = ["label"];
|
7
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
8
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
@@ -19,6 +19,7 @@ import cx from 'classnames';
|
|
19
19
|
import { ComposedModal, ModalHeader, ModalBody, Search, Tag } from '@carbon/react';
|
20
20
|
import { pkg } from '../../settings';
|
21
21
|
import { prepareProps } from '../../global/js/utils/props-helper';
|
22
|
+
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget';
|
22
23
|
var componentName = 'TagSetModal';
|
23
24
|
var blockClass = "".concat(pkg.prefix, "--tag-set-modal");
|
24
25
|
|
@@ -33,6 +34,7 @@ export var TagSetModal = function TagSetModal(_ref) {
|
|
33
34
|
title = _ref.title,
|
34
35
|
onClose = _ref.onClose,
|
35
36
|
open = _ref.open,
|
37
|
+
portalTargetIn = _ref.portalTarget,
|
36
38
|
_ref$searchLabel = _ref.searchLabel,
|
37
39
|
searchLabel = _ref$searchLabel === void 0 ? defaults.searchLabel : _ref$searchLabel,
|
38
40
|
searchPlaceholder = _ref.searchPlaceholder,
|
@@ -45,6 +47,7 @@ export var TagSetModal = function TagSetModal(_ref) {
|
|
45
47
|
_useState4 = _slicedToArray(_useState3, 2),
|
46
48
|
search = _useState4[0],
|
47
49
|
setSearch = _useState4[1];
|
50
|
+
var renderPortalUse = usePortalTarget(portalTargetIn);
|
48
51
|
useEffect(function () {
|
49
52
|
var newFilteredModalTags = [];
|
50
53
|
if (open) {
|
@@ -67,7 +70,7 @@ export var TagSetModal = function TagSetModal(_ref) {
|
|
67
70
|
var handleSearch = function handleSearch(ev) {
|
68
71
|
setSearch(ev.target.value || '');
|
69
72
|
};
|
70
|
-
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
73
|
+
return renderPortalUse( /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
71
74
|
containerClassName: "".concat(blockClass, "__container"),
|
72
75
|
className: cx(className, "".concat(blockClass)),
|
73
76
|
size: "sm",
|
@@ -96,7 +99,7 @@ export var TagSetModal = function TagSetModal(_ref) {
|
|
96
99
|
}), label);
|
97
100
|
})), /*#__PURE__*/React.createElement("div", {
|
98
101
|
className: "".concat(blockClass, "__fade")
|
99
|
-
}));
|
102
|
+
})));
|
100
103
|
};
|
101
104
|
TagSetModal.propTypes = {
|
102
105
|
allTags: PropTypes.arrayOf(PropTypes.shape(_objectSpread(_objectSpread({}, prepareProps(Tag.propTypes, 'filter')), {}, {
|
@@ -105,6 +108,7 @@ TagSetModal.propTypes = {
|
|
105
108
|
className: PropTypes.string,
|
106
109
|
onClose: PropTypes.func,
|
107
110
|
open: PropTypes.bool,
|
111
|
+
portalTarget: PropTypes.node,
|
108
112
|
searchLabel: PropTypes.string,
|
109
113
|
searchPlaceholder: PropTypes.string,
|
110
114
|
title: PropTypes.string
|
@@ -14,7 +14,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
14
14
|
|
15
15
|
// Import portions of React that are needed.
|
16
16
|
import React, { useEffect, useState, useRef } from 'react';
|
17
|
-
import { createPortal } from 'react-dom';
|
18
17
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver';
|
19
18
|
|
20
19
|
// Other standard imports.
|
@@ -22,11 +21,13 @@ import PropTypes from 'prop-types';
|
|
22
21
|
import cx from 'classnames';
|
23
22
|
import { pkg } from '../../settings';
|
24
23
|
import pconsole from '../../global/js/utils/pconsole';
|
24
|
+
import { getNodeTextContent } from '../../global/js/utils/getNodeTextContent';
|
25
25
|
|
26
26
|
// Carbon and package components we use.
|
27
27
|
import { Button, ComposedModal, Layer, ModalHeader, ModalBody, usePrefix } from '@carbon/react';
|
28
28
|
import { ActionSet } from '../ActionSet';
|
29
29
|
import { Wrap } from '../../global/js/utils/Wrap';
|
30
|
+
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget';
|
30
31
|
|
31
32
|
// The block part of our conventional BEM class names (bc__E--M).
|
32
33
|
var bc = "".concat(pkg.prefix, "--tearsheet");
|
@@ -85,20 +86,7 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
85
86
|
rest = _objectWithoutProperties(_ref, _excluded);
|
86
87
|
var carbonPrefix = usePrefix();
|
87
88
|
var bcModalHeader = "".concat(carbonPrefix, "--modal-header");
|
88
|
-
|
89
|
-
var _useState = useState(null),
|
90
|
-
_useState2 = _slicedToArray(_useState, 2),
|
91
|
-
portalTarget = _useState2[0],
|
92
|
-
setPortalTarget = _useState2[1];
|
93
|
-
useEffect(function () {
|
94
|
-
if (portalTargetIn) {
|
95
|
-
setPortalTarget(portalTargetIn);
|
96
|
-
} else {
|
97
|
-
if (pkg.isFeatureEnabled('default-portal-target-body')) {
|
98
|
-
setPortalTarget(document.body);
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}, [portalTargetIn]);
|
89
|
+
var renderPortalUse = usePortalTarget(portalTargetIn);
|
102
90
|
var localRef = useRef();
|
103
91
|
var resizer = useRef(null);
|
104
92
|
var modalRef = ref || localRef;
|
@@ -107,14 +95,14 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
107
95
|
var wide = size === 'wide';
|
108
96
|
|
109
97
|
// Keep track of the stack depth and our position in it (1-based, 0=closed)
|
98
|
+
var _useState = useState(0),
|
99
|
+
_useState2 = _slicedToArray(_useState, 2),
|
100
|
+
depth = _useState2[0],
|
101
|
+
setDepth = _useState2[1];
|
110
102
|
var _useState3 = useState(0),
|
111
103
|
_useState4 = _slicedToArray(_useState3, 2),
|
112
|
-
|
113
|
-
|
114
|
-
var _useState5 = useState(0),
|
115
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
116
|
-
position = _useState6[0],
|
117
|
-
setPosition = _useState6[1];
|
104
|
+
position = _useState4[0],
|
105
|
+
setPosition = _useState4[1];
|
118
106
|
|
119
107
|
// Keep a record of the previous value of depth.
|
120
108
|
var prevDepth = useRef();
|
@@ -199,10 +187,8 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
199
187
|
|
200
188
|
// Include an ActionSet if and only if one or more actions is given.
|
201
189
|
var includeActions = actions && (actions === null || actions === void 0 ? void 0 : actions.length) > 0;
|
202
|
-
return (
|
203
|
-
|
204
|
-
})( /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
205
|
-
"aria-label": title,
|
190
|
+
return renderPortalUse( /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
191
|
+
"aria-label": getNodeTextContent(title),
|
206
192
|
className: cx(bc, className, (_cx = {}, _defineProperty(_cx, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),
|
207
193
|
// Don't apply this on the initial open of a single tearsheet.
|
208
194
|
depth > 1 || depth === 1 && prevDepth.current > 1), _defineProperty(_cx, "".concat(bc, "--wide"), wide), _defineProperty(_cx, "".concat(bc, "--narrow"), !wide), _cx)),
|
@@ -266,7 +252,7 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
266
252
|
})))), /*#__PURE__*/React.createElement("div", {
|
267
253
|
className: "".concat(bc, "__resize-detector"),
|
268
254
|
ref: resizer
|
269
|
-
}))
|
255
|
+
})));
|
270
256
|
} else {
|
271
257
|
pconsole.warn('Tearsheet not rendered: maximum stacking depth exceeded.');
|
272
258
|
return null;
|
package/es/components/index.js
CHANGED
@@ -38,7 +38,7 @@ export { OptionsTile } from './OptionsTile';
|
|
38
38
|
export { EditInPlace } from './EditInPlace';
|
39
39
|
export { DataSpreadsheet } from './DataSpreadsheet';
|
40
40
|
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnCenterAlign, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useFiltering, getAutoSizedColumnWidth, useFilterContext } from './Datagrid';
|
41
|
-
export { EditTearsheet } from './EditTearsheet';
|
41
|
+
export { EditTearsheet, EditTearsheetForm } from './EditTearsheet';
|
42
42
|
export { EditTearsheetNarrow } from './EditTearsheetNarrow';
|
43
43
|
export { EditFullPage } from './EditFullPage';
|
44
44
|
export { EditUpdateCards } from './EditUpdateCards';
|
@@ -1,3 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 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
|
+
|
1
8
|
import React from 'react';
|
2
9
|
import { Content } from '@carbon/react';
|
3
10
|
export var sidePanelDecorator = function sidePanelDecorator(renderHeader, prefix) {
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
/**
|
3
|
+
* Copyright IBM Corp. 2023, 2023
|
4
|
+
*
|
5
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
7
|
+
*/
|
8
|
+
import { useState, useEffect, useCallback } from 'react';
|
9
|
+
import { pkg } from '../../../settings';
|
10
|
+
import { createPortal } from 'react-dom';
|
11
|
+
var usePortalTarget = function usePortalTarget(portalTargetIn) {
|
12
|
+
var _useState = useState(null),
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
14
|
+
portalTarget = _useState2[0],
|
15
|
+
setPortalTarget = _useState2[1];
|
16
|
+
useEffect(function () {
|
17
|
+
if (portalTargetIn) {
|
18
|
+
setPortalTarget(portalTargetIn);
|
19
|
+
} else {
|
20
|
+
if (pkg.isFeatureEnabled('default-portal-target-body')) {
|
21
|
+
setPortalTarget(document.body);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}, [portalTargetIn]);
|
25
|
+
var renderPortalUse = useCallback(function (children) {
|
26
|
+
return portalTarget ? /*#__PURE__*/createPortal(children, portalTarget) : children;
|
27
|
+
}, [portalTarget]);
|
28
|
+
return renderPortalUse;
|
29
|
+
};
|
30
|
+
export { usePortalTarget };
|
@@ -74,4 +74,9 @@ export function useNearestScroll(ref, effect, deps) {
|
|
74
74
|
scrollableTarget = window;
|
75
75
|
}
|
76
76
|
return useTargetScroll(scrollableTarget, effect, deps, throttle);
|
77
|
+
}
|
78
|
+
export function useScroll(ref, effect, deps) {
|
79
|
+
var _ref$current;
|
80
|
+
var throttle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
81
|
+
return useTargetScroll((_ref$current = ref === null || ref === void 0 ? void 0 : ref.current) !== null && _ref$current !== void 0 ? _ref$current : null, effect, deps, throttle);
|
77
82
|
}
|
@@ -65,6 +65,7 @@ var defaults = {
|
|
65
65
|
DataSpreadsheet: false,
|
66
66
|
Datagrid: false,
|
67
67
|
EditTearsheet: false,
|
68
|
+
EditTearsheetForm: false,
|
68
69
|
EditTearsheetNarrow: false,
|
69
70
|
EditFullPage: false,
|
70
71
|
EditUpdateCards: false
|
@@ -73,7 +74,6 @@ var defaults = {
|
|
73
74
|
|
74
75
|
// feature level flags
|
75
76
|
feature: {
|
76
|
-
'a-new-feature': false,
|
77
77
|
'default-portal-target-body': true,
|
78
78
|
'Datagrid.useInfiniteScroll': false,
|
79
79
|
'Datagrid.useInlineEdit': false,
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
2
|
+
/**
|
3
|
+
* Copyright IBM Corp. 2023
|
4
|
+
*
|
5
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Returns a compiled string of all the text content of a React node and any of its child nodes.
|
11
|
+
* This is meant to be used in a limited fashion to convert a "styled" sentence into a single string:
|
12
|
+
* e.g. <p>Title <b>Page</b>.</p> --> "Title Page."
|
13
|
+
* This will likely not work for arrays of nodes due to the lack of word spacing:
|
14
|
+
* e.g. <ul>
|
15
|
+
* <li>Item 1</li>
|
16
|
+
* <li>Item 2</li>
|
17
|
+
* <li>Item 3</li>
|
18
|
+
* </ul>
|
19
|
+
* --> "Item 1Item 2Item 3"
|
20
|
+
* @param {Node} node A React node
|
21
|
+
* @returns {string}
|
22
|
+
*/
|
23
|
+
export var getNodeTextContent = function getNodeTextContent(node) {
|
24
|
+
if (node == null) {
|
25
|
+
return '';
|
26
|
+
}
|
27
|
+
switch (_typeof(node)) {
|
28
|
+
case 'string':
|
29
|
+
case 'number':
|
30
|
+
return node.toString();
|
31
|
+
case 'object':
|
32
|
+
{
|
33
|
+
if (node instanceof Array) {
|
34
|
+
return node.map(getNodeTextContent).join('');
|
35
|
+
}
|
36
|
+
if ('props' in node) {
|
37
|
+
return getNodeTextContent(node.props.children);
|
38
|
+
}
|
39
|
+
|
40
|
+
// Ignore any other JavaScript 'object' types.
|
41
|
+
return '';
|
42
|
+
}
|
43
|
+
default:
|
44
|
+
// Ignore all other JavaScript types.
|
45
|
+
return '';
|
46
|
+
}
|
47
|
+
};
|
package/flags.js
ADDED
@@ -19,10 +19,11 @@ var _react2 = require("@carbon/react");
|
|
19
19
|
var _icons = require("@carbon/react/icons");
|
20
20
|
var _APIKeyDownloader = require("./APIKeyDownloader");
|
21
21
|
var _settings = require("../../settings");
|
22
|
+
var _usePortalTarget = require("../../global/js/hooks/usePortalTarget");
|
22
23
|
var _devtools = require("../../global/js/utils/devtools");
|
23
24
|
var _propsHelper = require("../../global/js/utils/props-helper");
|
24
25
|
var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
|
25
|
-
var _excluded = ["apiKey", "apiKeyLabel", "apiKeyName", "body", "className", "closeButtonText", "copyButtonText", "copyErrorText", "copyIconDescription", "customSteps", "downloadBodyText", "downloadFileName", "downloadFileType", "downloadLinkText", "editButtonText", "editSuccess", "editSuccessTitle", "editing", "error", "errorText", "generateButtonText", "generateSuccessBody", "generateSuccessTitle", "generateTitle", "hasAPIKeyVisibilityToggle", "hasDownloadLink", "hideAPIKeyLabel", "loading", "loadingText", "modalLabel", "nameHelperText", "nameLabel", "namePlaceholder", "nameRequired", "nextStepButtonText", "onClose", "onCopy", "onRequestEdit", "onRequestGenerate", "open", "previousStepButtonText", "showAPIKeyLabel"]; //
|
26
|
+
var _excluded = ["apiKey", "apiKeyLabel", "apiKeyName", "body", "className", "closeButtonText", "copyButtonText", "copyErrorText", "copyIconDescription", "customSteps", "downloadBodyText", "downloadFileName", "downloadFileType", "downloadLinkText", "editButtonText", "editSuccess", "editSuccessTitle", "editing", "error", "errorText", "generateButtonText", "generateSuccessBody", "generateSuccessTitle", "generateTitle", "hasAPIKeyVisibilityToggle", "hasDownloadLink", "hideAPIKeyLabel", "loading", "loadingText", "modalLabel", "nameHelperText", "nameLabel", "namePlaceholder", "nameRequired", "nextStepButtonText", "onClose", "onCopy", "onRequestEdit", "onRequestGenerate", "open", "portalTarget", "previousStepButtonText", "showAPIKeyLabel"]; //
|
26
27
|
// Copyright IBM Corp. 2021, 2021
|
27
28
|
//
|
28
29
|
// This source code is licensed under the Apache-2.0 license found in the
|
@@ -83,6 +84,7 @@ var APIKeyModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
83
84
|
onRequestEdit = _ref.onRequestEdit,
|
84
85
|
onRequestGenerate = _ref.onRequestGenerate,
|
85
86
|
open = _ref.open,
|
87
|
+
portalTargetIn = _ref.portalTarget,
|
86
88
|
previousStepButtonText = _ref.previousStepButtonText,
|
87
89
|
showAPIKeyLabel = _ref.showAPIKeyLabel,
|
88
90
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
@@ -105,6 +107,7 @@ var APIKeyModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
105
107
|
var copyRef = (0, _react.useRef)();
|
106
108
|
var apiKeyInputId = (0, _react.useRef)((0, _uuidv.default)());
|
107
109
|
var nameInputId = (0, _react.useRef)((0, _uuidv.default)());
|
110
|
+
var renderPortalUse = (0, _usePortalTarget.usePortalTarget)(portalTargetIn);
|
108
111
|
var hasSteps = Boolean(customSteps.length);
|
109
112
|
var apiKeyLoaded = apiKey && !loading;
|
110
113
|
var hasNextStep = hasSteps && currentStep < customSteps.length - 1;
|
@@ -233,7 +236,7 @@ var APIKeyModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
233
236
|
onCloseHandler();
|
234
237
|
}
|
235
238
|
};
|
236
|
-
return /*#__PURE__*/_react.default.createElement(_react2.ComposedModal, (0, _extends2.default)({}, rest, _objectSpread({
|
239
|
+
return renderPortalUse( /*#__PURE__*/_react.default.createElement(_react2.ComposedModal, (0, _extends2.default)({}, rest, _objectSpread({
|
237
240
|
open: open,
|
238
241
|
ref: ref
|
239
242
|
}, (0, _devtools.getDevtoolsProps)(componentName)), {
|
@@ -308,7 +311,7 @@ var APIKeyModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
308
311
|
kind: "primary",
|
309
312
|
onClick: submitHandler,
|
310
313
|
disabled: isPrimaryButtonDisabled()
|
311
|
-
}), getPrimaryButtonText())));
|
314
|
+
}), getPrimaryButtonText()))));
|
312
315
|
});
|
313
316
|
exports.APIKeyModal = APIKeyModal;
|
314
317
|
var customStepsRequiredProps = function customStepsRequiredProps(type) {
|
@@ -509,6 +512,10 @@ APIKeyModal.propTypes = {
|
|
509
512
|
* designates if modal is open or closed
|
510
513
|
*/
|
511
514
|
open: _propTypes.default.bool.isRequired,
|
515
|
+
/**
|
516
|
+
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
517
|
+
*/
|
518
|
+
portalTarget: _propTypes.default.node,
|
512
519
|
/**
|
513
520
|
* text that displays in the secondary button when using custom steps to indicate to the user that there is a previous step
|
514
521
|
*/
|
@@ -18,7 +18,8 @@ var _settings = require("../../settings");
|
|
18
18
|
var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
|
19
19
|
var _devtools = require("../../global/js/utils/devtools");
|
20
20
|
var _react2 = require("@carbon/react");
|
21
|
-
var
|
21
|
+
var _usePortalTarget = require("../../global/js/hooks/usePortalTarget");
|
22
|
+
var _excluded = ["additionalInfo", "className", "closeIconDescription", "copyrightText", "content", "links", "logo", "modalAriaLabel", "onClose", "open", "portalTarget", "title", "version"];
|
22
23
|
/**
|
23
24
|
* Copyright IBM Corp. 2020, 2021
|
24
25
|
*
|
@@ -56,6 +57,7 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
56
57
|
modalAriaLabel = _ref.modalAriaLabel,
|
57
58
|
onClose = _ref.onClose,
|
58
59
|
open = _ref.open,
|
60
|
+
portalTargetIn = _ref.portalTarget,
|
59
61
|
title = _ref.title,
|
60
62
|
version = _ref.version,
|
61
63
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
@@ -66,6 +68,7 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
66
68
|
var bodyRef = (0, _react.useRef)();
|
67
69
|
var contentRef = (0, _react.useRef)();
|
68
70
|
var contentId = (0, _uuidv.default)();
|
71
|
+
var renderPortalUse = (0, _usePortalTarget.usePortalTarget)(portalTargetIn);
|
69
72
|
var handleResize = function handleResize() {
|
70
73
|
setHasScrollingContent(
|
71
74
|
// if our scroll height exceeds the client height enable scrolling
|
@@ -82,7 +85,7 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
82
85
|
|
83
86
|
// Detect resize of the ModalBody to recalculate whether scrolling is enabled
|
84
87
|
(0, _useResizeObserver.useResizeObserver)(bodyRef, handleResize);
|
85
|
-
return /*#__PURE__*/_react.default.createElement(_react2.ComposedModal, (0, _extends2.default)({}, rest, {
|
88
|
+
return renderPortalUse( /*#__PURE__*/_react.default.createElement(_react2.ComposedModal, (0, _extends2.default)({}, rest, {
|
86
89
|
className: (0, _classnames.default)(blockClass,
|
87
90
|
// Apply the block class to the main HTML element
|
88
91
|
className // Apply any supplied class names to the main HTML element.
|
@@ -126,7 +129,7 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
126
129
|
theme: "g100"
|
127
130
|
}, /*#__PURE__*/_react.default.createElement(_react2.ModalFooter, {
|
128
131
|
className: "".concat(blockClass, "__footer")
|
129
|
-
}, additionalInfo)));
|
132
|
+
}, additionalInfo))));
|
130
133
|
});
|
131
134
|
|
132
135
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -185,6 +188,10 @@ AboutModal.propTypes = {
|
|
185
188
|
* Specifies whether the AboutModal is open or not.
|
186
189
|
*/
|
187
190
|
open: _propTypes.default.bool,
|
191
|
+
/**
|
192
|
+
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
193
|
+
*/
|
194
|
+
portalTarget: _propTypes.default.node,
|
188
195
|
/**
|
189
196
|
* Header text that provides the product name. The IBM Services logo
|
190
197
|
* consists of two discrete, but required, elements: the iconic
|