@carbon/ibm-products 2.0.0-rc.27 → 2.0.0-rc.29
Sign up to get free protection for your applications and to get access to all the features.
- package/css/config.css +3 -0
- package/css/config.css.map +1 -0
- package/css/index-full-carbon.css +126 -355
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +6 -6
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +196 -252
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +4 -4
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +126 -355
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +6 -6
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +126 -355
- package/css/index.css.map +1 -1
- package/css/index.min.css +6 -6
- package/css/index.min.css.map +1 -1
- package/es/components/AboutModal/AboutModal.js +44 -66
- package/es/components/ActionBar/ActionBar.js +13 -29
- package/es/components/AddSelect/AddSelectBody.js +4 -2
- package/es/components/AddSelect/AddSelectColumn.js +11 -5
- package/es/components/AddSelect/AddSelectFilter.js +5 -4
- package/es/components/AddSelect/AddSelectRow.js +3 -3
- package/es/components/AddSelect/AddSelectSort.js +2 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +15 -21
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +7 -8
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +6 -5
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +3 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +17 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +19 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -5
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +19 -1
- package/es/components/Datagrid/index.js +1 -0
- package/es/components/Datagrid/useEditableCell.js +13 -0
- package/es/components/Datagrid/useFiltering.js +4 -2
- package/es/components/Datagrid/useInlineEdit.js +16 -11
- package/es/components/Datagrid/useOnRowClick.js +11 -1
- package/es/components/Datagrid/useSelectRows.js +2 -0
- package/es/components/{InlineEditV2/InlineEditV2.js → EditInPlace/EditInPlace.js} +92 -30
- package/es/components/{InlineEdit → EditInPlace}/index.js +1 -1
- package/es/components/ExampleComponent/ExampleDeprecatedComponent.js +24 -0
- package/es/components/PageHeader/PageHeader.js +36 -35
- package/es/components/PageHeader/PageHeaderTitle.js +18 -18
- package/es/components/SidePanel/SidePanel.js +25 -26
- package/es/components/TagSet/TagSet.js +5 -7
- package/es/components/Tearsheet/Tearsheet.js +5 -0
- package/es/components/Tearsheet/TearsheetShell.js +4 -6
- package/es/components/index.js +1 -2
- package/es/global/js/hooks/useResizeObserver.js +79 -0
- package/es/global/js/hooks/useWindowResize.js +6 -0
- package/es/global/js/hooks/useWindowScroll.js +7 -0
- package/es/global/js/package-settings.js +4 -6
- package/es/settings.js +40 -20
- package/lib/components/AboutModal/AboutModal.js +43 -66
- package/lib/components/ActionBar/ActionBar.js +13 -29
- package/lib/components/AddSelect/AddSelectBody.js +4 -2
- package/lib/components/AddSelect/AddSelectColumn.js +11 -5
- package/lib/components/AddSelect/AddSelectFilter.js +4 -3
- package/lib/components/AddSelect/AddSelectRow.js +2 -2
- package/lib/components/AddSelect/AddSelectSort.js +2 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +13 -19
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +5 -4
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +3 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +17 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +19 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -5
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +18 -1
- package/lib/components/Datagrid/index.js +8 -0
- package/lib/components/Datagrid/useEditableCell.js +23 -0
- package/lib/components/Datagrid/useFiltering.js +4 -2
- package/lib/components/Datagrid/useInlineEdit.js +22 -11
- package/lib/components/Datagrid/useOnRowClick.js +11 -1
- package/lib/components/Datagrid/useSelectRows.js +2 -0
- package/lib/components/{InlineEditV2/InlineEditV2.js → EditInPlace/EditInPlace.js} +100 -34
- package/lib/components/{InlineEdit → EditInPlace}/index.js +3 -3
- package/lib/components/ExampleComponent/ExampleDeprecatedComponent.js +38 -0
- package/lib/components/PageHeader/PageHeader.js +36 -35
- package/lib/components/PageHeader/PageHeaderTitle.js +19 -19
- package/lib/components/SidePanel/SidePanel.js +25 -26
- package/lib/components/TagSet/TagSet.js +5 -7
- package/lib/components/Tearsheet/Tearsheet.js +5 -0
- package/lib/components/Tearsheet/TearsheetShell.js +4 -6
- package/lib/components/index.js +7 -15
- package/lib/global/js/hooks/useResizeObserver.js +91 -0
- package/lib/global/js/hooks/useWindowScroll.js +6 -0
- package/lib/global/js/package-settings.js +4 -6
- package/lib/settings.js +43 -21
- package/package.json +3 -4
- package/scss/components/AboutModal/_about-modal.scss +34 -53
- package/scss/components/AboutModal/_storybook-styles.scss +10 -4
- package/scss/components/AddSelect/_add-select.scss +7 -3
- package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +10 -1
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +1 -1
- package/scss/components/Datagrid/styles/_useSelectAllToggle.scss +11 -7
- package/scss/components/{InlineEditV2/_inline-edit-v2.scss → EditInPlace/_edit-in-place.scss} +56 -14
- package/scss/components/{InlineEditV1 → EditInPlace}/_index-with-carbon.scss +1 -1
- package/scss/components/{InlineEditV2 → EditInPlace}/_index.scss +1 -1
- package/scss/components/{InlineEditV1 → EditInPlace}/_storybook-styles.scss +3 -15
- package/scss/components/PageHeader/_page-header.scss +1 -7
- package/scss/components/_index-released-only-with-carbon.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -1
- package/scss/components/_index-with-carbon.scss +1 -3
- package/scss/components/_index.scss +1 -3
- package/scss/config.scss +1 -0
- package/es/components/InlineEdit/InlineEdit.js +0 -47
- package/es/components/InlineEditV1/InlineEditV1.js +0 -442
- package/es/components/InlineEditV1/index.js +0 -7
- package/es/components/InlineEditV2/index.js +0 -7
- package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -34
- package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -47
- package/es/components/ModifiedTabs/ModifiedTabs.js +0 -141
- package/es/components/ModifiedTabs/index.js +0 -1
- package/lib/components/InlineEdit/InlineEdit.js +0 -63
- package/lib/components/InlineEditV1/InlineEditV1.js +0 -459
- package/lib/components/InlineEditV1/index.js +0 -13
- package/lib/components/InlineEditV2/index.js +0 -13
- package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -50
- package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -63
- package/lib/components/ModifiedTabs/ModifiedTabs.js +0 -164
- package/lib/components/ModifiedTabs/index.js +0 -13
- package/scss/components/InlineEditV1/_carbon-imports.scss +0 -6
- package/scss/components/InlineEditV1/_index.scss +0 -8
- package/scss/components/InlineEditV1/_inline-edit-v1.scss +0 -269
- package/scss/components/InlineEditV2/_index-with-carbon.scss +0 -9
- package/scss/components/InlineEditV2/_storybook-styles.scss +0 -9
- package/scss/components/ModifiedTabs/_carbon-imports.scss +0 -10
- package/scss/components/ModifiedTabs/_index-with-carbon.scss +0 -9
- package/scss/components/ModifiedTabs/_index.scss +0 -8
- package/scss/components/ModifiedTabs/_modified-tabs.scss +0 -89
- package/scss/components/ModifiedTabs/_storybook-styles.scss +0 -6
- /package/scss/components/{InlineEditV2 → EditInPlace}/_carbon-imports.scss +0 -0
@@ -21,7 +21,7 @@ import { motion, AnimatePresence } from 'framer-motion'; // Other standard impor
|
|
21
21
|
|
22
22
|
import PropTypes from 'prop-types';
|
23
23
|
import cx from 'classnames';
|
24
|
-
import {
|
24
|
+
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver';
|
25
25
|
import { moderate02 } from '@carbon/motion';
|
26
26
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
27
27
|
import { allPropTypes } from '../../global/js/utils/props-helper';
|
@@ -51,7 +51,7 @@ var defaults = {
|
|
51
51
|
*/
|
52
52
|
|
53
53
|
export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
54
|
-
var _window,
|
54
|
+
var _window, _ref5, _cx4;
|
55
55
|
|
56
56
|
var actionToolbarButtons = _ref.actionToolbarButtons,
|
57
57
|
actions = _ref.actions,
|
@@ -172,9 +172,10 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
172
172
|
}, [labelText, title]);
|
173
173
|
/* istanbul ignore next */
|
174
174
|
|
175
|
-
var handleResize = function handleResize(
|
175
|
+
var handleResize = function handleResize(_ref2) {
|
176
176
|
var _sidePanelOuter$style3;
|
177
177
|
|
178
|
+
var height = _ref2.height;
|
178
179
|
setPanelHeight(height);
|
179
180
|
var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
|
180
181
|
var actionsContainer = getActionsContainerElement();
|
@@ -371,9 +372,9 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
371
372
|
|
372
373
|
/* istanbul ignore next */
|
373
374
|
|
374
|
-
var handleBlur = function handleBlur(
|
375
|
-
var oldActiveNode =
|
376
|
-
currentActiveNode =
|
375
|
+
var handleBlur = function handleBlur(_ref3) {
|
376
|
+
var oldActiveNode = _ref3.target,
|
377
|
+
currentActiveNode = _ref3.relatedTarget;
|
377
378
|
|
378
379
|
// focus trap should only be set if the side panel is a `slideOver` type
|
379
380
|
if (open && sidePanelInnerRef && !slideIn) {
|
@@ -388,7 +389,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
388
389
|
};
|
389
390
|
|
390
391
|
var primaryActionContainerClassNames = cx(["".concat(blockClass, "__actions-container"), _defineProperty({}, "".concat(blockClass, "__actions-container-condensed"), condensedActions)]);
|
391
|
-
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (
|
392
|
+
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref5 = {}, _defineProperty(_ref5, "".concat(blockClass, "__container-right-placement"), placement === 'right'), _defineProperty(_ref5, "".concat(blockClass, "__container-left-placement"), placement === 'left'), _defineProperty(_ref5, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), _defineProperty(_ref5, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), _defineProperty(_ref5, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), _ref5)]);
|
392
393
|
|
393
394
|
var renderHeader = function renderHeader() {
|
394
395
|
var _cx, _cx2;
|
@@ -427,17 +428,17 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
427
428
|
className: cx("".concat(blockClass, "__subtitle-text"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-no-animation"), !animateTitle), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-no-animation-no-action-toolbar"), !animateTitle && (!actionToolbarButtons || !actionToolbarButtons.length)), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-is-animating"), !animationComplete && animateTitle), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-without-title"), !title), _cx2))
|
428
429
|
}, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/React.createElement("div", {
|
429
430
|
className: cx("".concat(blockClass, "__action-toolbar"), _defineProperty({}, "".concat(blockClass, "__action-toolbar-no-animation"), !animateTitle))
|
430
|
-
}, actionToolbarButtons.map(function (
|
431
|
-
var label =
|
432
|
-
kind =
|
433
|
-
icon =
|
434
|
-
tooltipPosition =
|
435
|
-
tooltipAlignment =
|
436
|
-
leading =
|
437
|
-
disabled =
|
438
|
-
className =
|
439
|
-
onClick =
|
440
|
-
rest = _objectWithoutProperties(
|
431
|
+
}, actionToolbarButtons.map(function (_ref6) {
|
432
|
+
var label = _ref6.label,
|
433
|
+
kind = _ref6.kind,
|
434
|
+
icon = _ref6.icon,
|
435
|
+
tooltipPosition = _ref6.tooltipPosition,
|
436
|
+
tooltipAlignment = _ref6.tooltipAlignment,
|
437
|
+
leading = _ref6.leading,
|
438
|
+
disabled = _ref6.disabled,
|
439
|
+
className = _ref6.className,
|
440
|
+
onClick = _ref6.onClick,
|
441
|
+
rest = _objectWithoutProperties(_ref6, _excluded2);
|
441
442
|
|
442
443
|
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
443
444
|
key: label,
|
@@ -468,10 +469,8 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
468
469
|
};
|
469
470
|
|
470
471
|
var contentRef = ref || sidePanelRef;
|
471
|
-
|
472
|
-
|
473
|
-
onResize: handleResize,
|
474
|
-
targetRef: contentRef
|
472
|
+
useResizeObserver(contentRef, {
|
473
|
+
callback: handleResize
|
475
474
|
});
|
476
475
|
return /*#__PURE__*/React.createElement(AnimatePresence, null, open && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(motion.div, _extends({}, getDevtoolsProps(componentName), rest, {
|
477
476
|
id: "".concat(blockClass, "-outer"),
|
@@ -640,8 +639,8 @@ SidePanel.propTypes = {
|
|
640
639
|
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
641
640
|
* This prop is required when using the `slideIn` variant of the side panel.
|
642
641
|
*/
|
643
|
-
selectorPageContent: PropTypes.string.isRequired.if(function (
|
644
|
-
var slideIn =
|
642
|
+
selectorPageContent: PropTypes.string.isRequired.if(function (_ref8) {
|
643
|
+
var slideIn = _ref8.slideIn;
|
645
644
|
return slideIn;
|
646
645
|
}),
|
647
646
|
|
@@ -669,8 +668,8 @@ SidePanel.propTypes = {
|
|
669
668
|
/**
|
670
669
|
* Sets the title text
|
671
670
|
*/
|
672
|
-
title: PropTypes.string.isRequired.if(function (
|
673
|
-
var labelText =
|
671
|
+
title: PropTypes.string.isRequired.if(function (_ref9) {
|
672
|
+
var labelText = _ref9.labelText;
|
674
673
|
return labelText;
|
675
674
|
})
|
676
675
|
};
|
@@ -23,7 +23,7 @@ import cx from 'classnames';
|
|
23
23
|
import { TagSetOverflow } from './TagSetOverflow';
|
24
24
|
import { TagSetModal } from './TagSetModal';
|
25
25
|
import { Tag } from '@carbon/react';
|
26
|
-
import {
|
26
|
+
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver';
|
27
27
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
28
28
|
import { prepareProps, isRequiredIf } from '../../global/js/utils/props-helper';
|
29
29
|
import { pkg } from '../../settings';
|
@@ -222,13 +222,11 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
222
222
|
setShowAllModalOpen(false);
|
223
223
|
};
|
224
224
|
|
225
|
-
|
226
|
-
|
227
|
-
targetRef: sizingContainerRef
|
225
|
+
useResizeObserver(sizingContainerRef, {
|
226
|
+
callback: handleSizerTagsResize
|
228
227
|
});
|
229
|
-
|
230
|
-
|
231
|
-
targetRef: tagSetRef
|
228
|
+
useResizeObserver(tagSetRef, {
|
229
|
+
callback: handleResize
|
232
230
|
});
|
233
231
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
234
232
|
className: cx([blockClass, className]),
|
@@ -187,6 +187,11 @@ Tearsheet.propTypes = _objectSpread({
|
|
187
187
|
*/
|
188
188
|
portalTarget: PropTypes.node,
|
189
189
|
|
190
|
+
/**
|
191
|
+
* Specify a CSS selector that matches the DOM element that should be focused when the Modal opens
|
192
|
+
*/
|
193
|
+
selectorPrimaryFocus: PropTypes.string,
|
194
|
+
|
190
195
|
/**
|
191
196
|
* The main title of the tearsheet, displayed in the header area.
|
192
197
|
*/
|
@@ -17,7 +17,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
17
17
|
// Import portions of React that are needed.
|
18
18
|
import React, { useEffect, useState, useRef } from 'react';
|
19
19
|
import { createPortal } from 'react-dom';
|
20
|
-
import {
|
20
|
+
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver'; // Other standard imports.
|
21
21
|
|
22
22
|
import PropTypes from 'prop-types';
|
23
23
|
import cx from 'classnames';
|
@@ -91,13 +91,11 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
91
91
|
}
|
92
92
|
}, [portalTargetIn]);
|
93
93
|
var localRef = useRef();
|
94
|
+
var resizer = useRef(null);
|
94
95
|
var modalRef = ref || localRef;
|
95
96
|
|
96
|
-
var
|
97
|
-
|
98
|
-
}),
|
99
|
-
width = _useResizeDetector.width,
|
100
|
-
resizer = _useResizeDetector.ref;
|
97
|
+
var _useResizeObserver = useResizeObserver(resizer),
|
98
|
+
width = _useResizeObserver.width;
|
101
99
|
|
102
100
|
var wide = size === 'wide'; // Keep track of the stack depth and our position in it (1-based, 0=closed)
|
103
101
|
|
package/es/components/index.js
CHANGED
@@ -18,7 +18,6 @@ export { ExportModal } from './ExportModal';
|
|
18
18
|
export { ExpressiveCard } from './ExpressiveCard';
|
19
19
|
export { HTTPError403, HTTPError404, HTTPErrorOther } from './HTTPErrors';
|
20
20
|
export { ImportModal } from './ImportModal';
|
21
|
-
export { ModifiedTabs } from './ModifiedTabs';
|
22
21
|
export { MultiAddSelect } from './MultiAddSelect';
|
23
22
|
export { NotificationsPanel } from './NotificationsPanel';
|
24
23
|
export { PageHeader } from './PageHeader';
|
@@ -35,7 +34,7 @@ export { UserProfileImage } from './UserProfileImage';
|
|
35
34
|
export { WebTerminal, WebTerminalContentWrapper, useWebTerminal, WebTerminalProvider } from './WebTerminal';
|
36
35
|
export { EditSidePanel } from './EditSidePanel';
|
37
36
|
export { OptionsTile } from './OptionsTile';
|
38
|
-
export {
|
37
|
+
export { EditInPlace } from './EditInPlace';
|
39
38
|
export { DataSpreadsheet } from './DataSpreadsheet';
|
40
39
|
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnCenterAlign, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useFiltering, getAutoSizedColumnWidth } from './Datagrid';
|
41
40
|
export { EditTearsheet } from './EditTearsheet';
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copyright IBM Corp. 2023, 2023
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
import { useRef, useState, useLayoutEffect } from 'react';
|
10
|
+
export var useResizeObserver = function useResizeObserver(ref) {
|
11
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
12
|
+
callback: null,
|
13
|
+
throttleInterval: 0
|
14
|
+
};
|
15
|
+
var callback = options.callback,
|
16
|
+
throttleInterval = options.throttleInterval;
|
17
|
+
|
18
|
+
var _useState = useState(0),
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
20
|
+
width = _useState2[0],
|
21
|
+
setWidth = _useState2[1];
|
22
|
+
|
23
|
+
var _useState3 = useState(0),
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
25
|
+
height = _useState4[0],
|
26
|
+
setHeight = _useState4[1];
|
27
|
+
|
28
|
+
var throttleTimeout = useRef(null);
|
29
|
+
var entriesToHandle = useRef(null);
|
30
|
+
useLayoutEffect(function () {
|
31
|
+
if (!(ref !== null && ref !== void 0 && ref.current)) {
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
|
35
|
+
var doCallbacks = function doCallbacks() {
|
36
|
+
if (!(ref !== null && ref !== void 0 && ref.current) || !Array.isArray(entriesToHandle === null || entriesToHandle === void 0 ? void 0 : entriesToHandle.current)) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
|
40
|
+
var entry = entriesToHandle.current[0];
|
41
|
+
setWidth(entry.contentRect.width);
|
42
|
+
setHeight(entry.contentRect.height);
|
43
|
+
throttleTimeout.current = null;
|
44
|
+
callback && callback(entry.contentRect);
|
45
|
+
};
|
46
|
+
|
47
|
+
var observer = new ResizeObserver(function (entries) {
|
48
|
+
// always update entriesToHandle
|
49
|
+
entriesToHandle.current = entries;
|
50
|
+
|
51
|
+
if (throttleInterval) {
|
52
|
+
// if a throttleInterval check for running timeout
|
53
|
+
if (throttleTimeout.current === null) {
|
54
|
+
// no live timeout set entries to handle and move on
|
55
|
+
// set up throttle
|
56
|
+
throttleTimeout.current = setTimeout(function () {
|
57
|
+
// do callbacks
|
58
|
+
doCallbacks(); // reset throttle
|
59
|
+
|
60
|
+
throttleTimeout.current = null;
|
61
|
+
}, throttleInterval);
|
62
|
+
}
|
63
|
+
} else {
|
64
|
+
// no throttle do callbacks every time
|
65
|
+
doCallbacks();
|
66
|
+
}
|
67
|
+
}); // observe all refs passed
|
68
|
+
|
69
|
+
observer.observe(ref.current);
|
70
|
+
return function () {
|
71
|
+
observer.disconnect();
|
72
|
+
observer = null;
|
73
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
74
|
+
}, [ref, options]);
|
75
|
+
return {
|
76
|
+
width: width,
|
77
|
+
height: height
|
78
|
+
};
|
79
|
+
};
|
@@ -5,6 +5,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
5
5
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
|
8
|
+
/**
|
9
|
+
* Copyright IBM Corp. 2022, 2023
|
10
|
+
*
|
11
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
13
|
+
*/
|
8
14
|
import { useRef, useLayoutEffect } from 'react';
|
9
15
|
var windowExists = (typeof window === "undefined" ? "undefined" : _typeof(window)) !== "undefined";
|
10
16
|
|
@@ -1,4 +1,11 @@
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copyright IBM Corp. 2022, 2023
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
2
9
|
import { useRef, useLayoutEffect } from 'react';
|
3
10
|
import { scrollableAncestor } from '../utils/scrollableAncestor';
|
4
11
|
var windowExists = (typeof window === "undefined" ? "undefined" : _typeof(window)) !== "undefined";
|
@@ -27,6 +27,7 @@ var defaults = {
|
|
27
27
|
CreateTearsheet: true,
|
28
28
|
CreateTearsheetStep: true,
|
29
29
|
CreateTearsheetDivider: true,
|
30
|
+
EditInPlace: true,
|
30
31
|
EmptyState: true,
|
31
32
|
ErrorEmptyState: true,
|
32
33
|
ExportModal: true,
|
@@ -35,8 +36,6 @@ var defaults = {
|
|
35
36
|
HTTPError404: true,
|
36
37
|
HTTPErrorOther: true,
|
37
38
|
ImportModal: true,
|
38
|
-
InlineEdit: true,
|
39
|
-
InlineEditV1: true,
|
40
39
|
MultiAddSelect: true,
|
41
40
|
NotificationsPanel: true,
|
42
41
|
NoDataEmptyState: true,
|
@@ -60,7 +59,6 @@ var defaults = {
|
|
60
59
|
WebTerminalContentWrapper: true,
|
61
60
|
WebTerminalProvider: true,
|
62
61
|
// other public components not yet reviewed and released:
|
63
|
-
ModifiedTabs: false,
|
64
62
|
Toolbar: false,
|
65
63
|
ToolbarButton: false,
|
66
64
|
ToolbarGroup: false,
|
@@ -71,8 +69,7 @@ var defaults = {
|
|
71
69
|
EditTearsheet: false,
|
72
70
|
EditTearsheetNarrow: false,
|
73
71
|
EditFullPage: false,
|
74
|
-
EditUpdateCards: false
|
75
|
-
InlineEditV2: false
|
72
|
+
EditUpdateCards: false
|
76
73
|
/* new component flags here - comment used by generate CLI */
|
77
74
|
|
78
75
|
},
|
@@ -80,7 +77,8 @@ var defaults = {
|
|
80
77
|
feature: {
|
81
78
|
'a-new-feature': false,
|
82
79
|
'default-portal-target-body': true,
|
83
|
-
'Datagrid.useInfiniteScroll': false
|
80
|
+
'Datagrid.useInfiniteScroll': false,
|
81
|
+
'Datagrid.useInlineEdit': false
|
84
82
|
}
|
85
83
|
};
|
86
84
|
|
package/es/settings.js
CHANGED
@@ -2,32 +2,51 @@ import { Canary } from './components/_Canary';
|
|
2
2
|
import pkgSettings from './global/js/package-settings';
|
3
3
|
import React from 'react';
|
4
4
|
import { themes } from '@carbon/themes';
|
5
|
+
import pconsole from './global/js/utils/pconsole';
|
5
6
|
export var carbon = {
|
6
7
|
get themes() {
|
7
8
|
return themes;
|
8
9
|
},
|
9
10
|
|
10
11
|
prefix: 'cds'
|
12
|
+
};
|
13
|
+
|
14
|
+
var componentDeprecatedWarning = function componentDeprecatedWarning(name, details) {
|
15
|
+
return "Carbon for IBM Products (WARNING): Component \"".concat(name, "\" is deprecated. ").concat(details);
|
16
|
+
};
|
17
|
+
|
18
|
+
pkgSettings.logDeprecated = function (component, name) {
|
19
|
+
if (component !== null && component !== void 0 && component.deprecated) {
|
20
|
+
var _pconsole$level;
|
21
|
+
|
22
|
+
var _component$deprecated = component.deprecated,
|
23
|
+
level = _component$deprecated.level,
|
24
|
+
details = _component$deprecated.details;
|
25
|
+
var logUsing = (_pconsole$level = pconsole === null || pconsole === void 0 ? void 0 : pconsole[level]) !== null && _pconsole$level !== void 0 ? _pconsole$level : pconsole.error;
|
26
|
+
logUsing(componentDeprecatedWarning(name || component.displayName, details));
|
27
|
+
}
|
11
28
|
}; // Check that a component is enabled. This function returns a stub which checks
|
12
29
|
// the component status on first use and then renders as the component or as
|
13
30
|
// a Canary placeholder initialized with the name of the replaced component.
|
14
31
|
// Note that the returned stub carries any other properties which had already
|
15
32
|
// been assigned (eg propTypes, displayName, etc).
|
16
33
|
|
34
|
+
|
17
35
|
pkgSettings.checkComponentEnabled = function (component, name) {
|
18
36
|
if (component.render) {
|
19
37
|
// The component is a forward-ref, so make a stub forward-ref.
|
20
38
|
var forward = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
)
|
39
|
+
pkgSettings.logDeprecated(component, name); // may log don't care about result
|
40
|
+
// Replace the stub's render fn so this test only happens once.
|
41
|
+
|
42
|
+
return (forward.render = pkgSettings.isComponentEnabled(name) || !pkgSettings.isComponentPublic(name) ? // If the component is enabled, or if it's not a public component,
|
43
|
+
// replace the stub's render fn with the component's render fn.
|
44
|
+
component.render : // Note that Canary is a direct render fn (not a forward-ref) and
|
45
|
+
// will ignore the passed props and ref (if any)
|
46
|
+
Canary.bind(undefined, {
|
47
|
+
componentName: name
|
48
|
+
}))( // Call it now (after this it will be directly called).
|
49
|
+
props, ref);
|
31
50
|
}); // Transfer object properties already assigned (eg propTypes, displayName)
|
32
51
|
// then merge in the stub forward-ref which checks the component status
|
33
52
|
// when first used.
|
@@ -36,16 +55,17 @@ pkgSettings.checkComponentEnabled = function (component, name) {
|
|
36
55
|
} else {
|
37
56
|
// The component is a direct render fn, so make a stub render fn.
|
38
57
|
var _render = function render(props) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
)
|
58
|
+
pkgSettings.logDeprecated(component, name); // may log don't care about result
|
59
|
+
// Replace the stub render fn so this test only happens once.
|
60
|
+
|
61
|
+
return (_render = pkgSettings.isComponentEnabled(name) || !pkgSettings.isComponentPublic(name) ? // If the component is enabled, or if it's not a public component,
|
62
|
+
// replace the stub render fn with the component render fn.
|
63
|
+
component : // Replace the stub render fn with the Canary render fn, which will
|
64
|
+
// ignore the passed props.
|
65
|
+
Canary.bind(undefined, {
|
66
|
+
componentName: name
|
67
|
+
}))( // Call it now (after this it will be directly called).
|
68
|
+
props);
|
49
69
|
}; // Transfer object properties already assigned (eg propTypes, displayName)
|
50
70
|
// to a function which calls the stub render fn which checks the component
|
51
71
|
// status when first used.
|
@@ -19,7 +19,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
19
19
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
21
21
|
|
22
|
-
var
|
22
|
+
var _useResizeObserver = require("../../global/js/hooks/useResizeObserver");
|
23
23
|
|
24
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
25
25
|
|
@@ -33,9 +33,7 @@ var _devtools = require("../../global/js/utils/devtools");
|
|
33
33
|
|
34
34
|
var _react2 = require("@carbon/react");
|
35
35
|
|
36
|
-
var
|
37
|
-
|
38
|
-
var _excluded = ["additionalInfo", "className", "closeIconDescription", "content", "copyrightText", "legalText", "links", "logo", "modalAriaLabel", "onClose", "open", "tabListAriaLabel", "title"];
|
36
|
+
var _excluded = ["additionalInfo", "className", "closeIconDescription", "copyrightText", "content", "links", "logo", "modalAriaLabel", "onClose", "open", "title", "version"];
|
39
37
|
|
40
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
41
39
|
|
@@ -61,16 +59,15 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
61
59
|
var additionalInfo = _ref.additionalInfo,
|
62
60
|
className = _ref.className,
|
63
61
|
closeIconDescription = _ref.closeIconDescription,
|
64
|
-
content = _ref.content,
|
65
62
|
copyrightText = _ref.copyrightText,
|
66
|
-
|
63
|
+
content = _ref.content,
|
67
64
|
links = _ref.links,
|
68
65
|
logo = _ref.logo,
|
69
66
|
modalAriaLabel = _ref.modalAriaLabel,
|
70
67
|
onClose = _ref.onClose,
|
71
68
|
open = _ref.open,
|
72
|
-
tabListAriaLabel = _ref.tabListAriaLabel,
|
73
69
|
title = _ref.title,
|
70
|
+
version = _ref.version,
|
74
71
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
75
72
|
|
76
73
|
var _useState = (0, _react.useState)(true),
|
@@ -94,14 +91,13 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
94
91
|
bodyRef.current = contentRef.current.parentElement;
|
95
92
|
}, [bodyRef]); // Detect resize of the ModalBody to recalculate whether scrolling is enabled
|
96
93
|
|
97
|
-
(0,
|
98
|
-
|
99
|
-
targetRef: bodyRef
|
94
|
+
(0, _useResizeObserver.useResizeObserver)(bodyRef, {
|
95
|
+
callback: handleResize
|
100
96
|
});
|
101
97
|
return /*#__PURE__*/_react.default.createElement(_react2.ComposedModal, (0, _extends2.default)({}, rest, {
|
102
98
|
className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
|
103
|
-
className
|
104
|
-
|
99
|
+
className // Apply any supplied class names to the main HTML element.
|
100
|
+
),
|
105
101
|
"aria-label": modalAriaLabel
|
106
102
|
}, _objectSpread({
|
107
103
|
onClose: onClose,
|
@@ -124,59 +120,42 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
124
120
|
className: "".concat(blockClass, "__body-content"),
|
125
121
|
ref: contentRef,
|
126
122
|
id: contentId
|
127
|
-
},
|
123
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
124
|
+
className: "".concat(blockClass, "__version")
|
125
|
+
}, version), links && links.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
128
126
|
className: "".concat(blockClass, "__links-container")
|
129
|
-
}, links
|
127
|
+
}, links.map(function (link, i) {
|
130
128
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
131
129
|
key: i
|
132
130
|
}, link);
|
133
|
-
})),
|
134
|
-
className: "".concat(blockClass, "
|
135
|
-
},
|
131
|
+
})), content && /*#__PURE__*/_react.default.createElement("p", {
|
132
|
+
className: "".concat(blockClass, "__content")
|
133
|
+
}, content), copyrightText && /*#__PURE__*/_react.default.createElement("p", {
|
136
134
|
className: "".concat(blockClass, "__copyright-text")
|
137
|
-
}, copyrightText))), /*#__PURE__*/_react.default.createElement(_react2.
|
135
|
+
}, copyrightText))), additionalInfo && additionalInfo.length > 0 && /*#__PURE__*/_react.default.createElement(_react2.Theme, {
|
136
|
+
theme: "g100"
|
137
|
+
}, /*#__PURE__*/_react.default.createElement(_react2.ModalFooter, {
|
138
138
|
className: "".concat(blockClass, "__footer")
|
139
|
-
},
|
140
|
-
className: "".concat(blockClass, "
|
139
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
140
|
+
className: "".concat(blockClass, "__footer-label")
|
141
141
|
}, additionalInfo[0].label), /*#__PURE__*/_react.default.createElement("p", {
|
142
|
-
className: "".concat(blockClass, "
|
143
|
-
}, additionalInfo[0].content))
|
144
|
-
className: "".concat(blockClass, "__tab-container")
|
145
|
-
}, /*#__PURE__*/_react.default.createElement(_react2.Tabs, null, /*#__PURE__*/_react.default.createElement(_react2.TabList, {
|
146
|
-
"aria-label": tabListAriaLabel
|
147
|
-
}, additionalInfo.map(function (tab, index) {
|
148
|
-
return /*#__PURE__*/_react.default.createElement(_react2.Tab, {
|
149
|
-
key: index
|
150
|
-
}, tab.label);
|
151
|
-
})), /*#__PURE__*/_react.default.createElement(_react2.TabPanels, null, additionalInfo.map(function (tab, index) {
|
152
|
-
return /*#__PURE__*/_react.default.createElement(_react2.TabPanel, {
|
153
|
-
key: index
|
154
|
-
}, tab.content);
|
155
|
-
})))))));
|
142
|
+
className: "".concat(blockClass, "__footer-content")
|
143
|
+
}, additionalInfo[0].content))));
|
156
144
|
}); // Return a placeholder if not released and not enabled by feature flag
|
157
145
|
|
158
146
|
|
159
147
|
exports.AboutModal = AboutModal;
|
160
148
|
exports.AboutModal = AboutModal = _settings.pkg.checkComponentEnabled(AboutModal, componentName);
|
161
|
-
AboutModal.displayName = componentName;
|
162
|
-
|
163
|
-
var tabListAriaLabelRequiredProps = function tabListAriaLabelRequiredProps(type) {
|
164
|
-
return (0, _propsHelper.isRequiredIf)(type, function (_ref2) {
|
165
|
-
var additionalInfo = _ref2.additionalInfo;
|
166
|
-
return additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.length;
|
167
|
-
});
|
168
|
-
}; // The types and DocGen commentary for the component props,
|
149
|
+
AboutModal.displayName = componentName; // The types and DocGen commentary for the component props,
|
169
150
|
// in alphabetical order (for consistency).
|
170
151
|
// See https://www.npmjs.com/package/prop-types#usage.
|
171
152
|
|
172
|
-
|
173
153
|
AboutModal.propTypes = {
|
174
154
|
/**
|
175
|
-
*
|
176
|
-
*
|
177
|
-
*
|
178
|
-
*
|
179
|
-
* other in the footer.
|
155
|
+
* If you are legally required to display logos of technologies used
|
156
|
+
* to build your product you can provide this in the additionalInfo.
|
157
|
+
* Additional information will be displayed in the footer. The label
|
158
|
+
* and content are displayed one above the other in the footer (optional)
|
180
159
|
*/
|
181
160
|
additionalInfo: _propTypes.default.arrayOf(_propTypes.default.shape({
|
182
161
|
label: _propTypes.default.string,
|
@@ -194,26 +173,21 @@ AboutModal.propTypes = {
|
|
194
173
|
closeIconDescription: _propTypes.default.string.isRequired,
|
195
174
|
|
196
175
|
/**
|
197
|
-
*
|
198
|
-
*
|
199
|
-
* user name, user role, browser version, browser OS etc.
|
200
|
-
*/
|
201
|
-
content: _propTypes.default.node.isRequired,
|
202
|
-
|
203
|
-
/**
|
204
|
-
* Trademark and copyright information. Suggested format for copyright -
|
205
|
-
* "Copyright © 2018 Company".
|
176
|
+
* Subhead text providing any relevant product disclaimers including
|
177
|
+
* legal information (optional)
|
206
178
|
*/
|
207
|
-
|
179
|
+
content: _propTypes.default.node,
|
208
180
|
|
209
181
|
/**
|
210
|
-
*
|
182
|
+
* Trademark and copyright information. Displays first year of
|
183
|
+
* product release to current year.
|
211
184
|
*/
|
212
|
-
|
185
|
+
copyrightText: _propTypes.default.string.isRequired,
|
213
186
|
|
214
187
|
/**
|
215
|
-
* An array of Carbon `Link`
|
216
|
-
*
|
188
|
+
* An array of Carbon `Link` component if there are additional information
|
189
|
+
* to call out within the card. The about modal should be used to display
|
190
|
+
* the product information and not where users go to find help (optional)
|
217
191
|
*/
|
218
192
|
links: _propTypes.default.arrayOf(_propTypes.default.element),
|
219
193
|
|
@@ -239,12 +213,15 @@ AboutModal.propTypes = {
|
|
239
213
|
open: _propTypes.default.bool,
|
240
214
|
|
241
215
|
/**
|
242
|
-
*
|
216
|
+
* Header text that provides the product name. The IBM Services logo
|
217
|
+
* consists of two discrete, but required, elements: the iconic
|
218
|
+
* IBM 8-bar logo represented alongside the IBM Services logotype.
|
219
|
+
* Please follow these guidelines to ensure proper execution.
|
243
220
|
*/
|
244
|
-
|
221
|
+
title: _propTypes.default.node.isRequired,
|
245
222
|
|
246
223
|
/**
|
247
|
-
*
|
224
|
+
* Text that provides information on the version number of your product.
|
248
225
|
*/
|
249
|
-
|
226
|
+
version: _propTypes.default.string.isRequired
|
250
227
|
};
|