@carbon/ibm-products 1.50.0 → 1.52.0
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/README.md +10 -5
- package/css/index-full-carbon.css +131 -82
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +38 -11
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +131 -82
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +131 -82
- 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/AboutModal/AboutModal.js +3 -4
- package/es/components/ActionBar/ActionBar.js +9 -18
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -13
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +8 -8
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +5 -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 +17 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +14 -0
- package/es/components/Datagrid/index.js +1 -0
- package/es/components/Datagrid/useActionsColumn.js +10 -7
- package/es/components/Datagrid/useCustomizeColumns.js +5 -1
- package/es/components/Datagrid/useEditableCell.js +12 -0
- package/es/components/Datagrid/useExpandedRow.js +11 -7
- package/es/components/Datagrid/useFiltering.js +15 -10
- package/es/components/Datagrid/useInlineEdit.js +17 -8
- package/es/components/Datagrid/useNestedRows.js +10 -6
- package/es/components/Datagrid/useOnRowClick.js +9 -1
- package/es/components/Datagrid/useSelectRows.js +2 -0
- package/es/components/EditInPlace/EditInPlace.js +43 -0
- package/es/components/EditInPlace/index.js +8 -0
- package/es/components/ExampleComponent/ExampleComponent.js +32 -4
- package/es/components/ExampleComponent/useExample.js +49 -0
- package/es/components/InlineEdit/InlineEdit.js +5 -1
- package/es/components/InlineEditV1/InlineEditV1.js +7 -2
- package/es/components/InlineEditV2/InlineEditV2.js +51 -15
- package/es/components/NonLinearReading/NonLinearReading.js +7 -7
- package/es/components/PageHeader/PageHeader.js +28 -31
- package/es/components/SidePanel/SidePanel.js +25 -26
- package/es/components/TagSet/TagSet.js +5 -7
- package/es/components/Tearsheet/TearsheetShell.js +4 -6
- package/es/components/index.js +2 -1
- package/es/global/js/hooks/useResizeObserver.js +74 -0
- package/es/global/js/package-settings.js +35 -4
- package/es/global/js/utils/test-helper.js +34 -3
- package/es/settings.js +40 -29
- package/lib/components/AboutModal/AboutModal.js +3 -4
- package/lib/components/ActionBar/ActionBar.js +9 -18
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -13
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +4 -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 +17 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +15 -0
- package/lib/components/Datagrid/index.js +7 -0
- package/lib/components/Datagrid/useActionsColumn.js +7 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -0
- package/lib/components/Datagrid/useEditableCell.js +20 -0
- package/lib/components/Datagrid/useExpandedRow.js +4 -0
- package/lib/components/Datagrid/useFiltering.js +8 -2
- package/lib/components/Datagrid/useInlineEdit.js +19 -8
- package/lib/components/Datagrid/useNestedRows.js +9 -6
- package/lib/components/Datagrid/useOnRowClick.js +9 -1
- package/lib/components/Datagrid/useSelectRows.js +2 -0
- package/lib/components/EditInPlace/EditInPlace.js +46 -0
- package/lib/components/EditInPlace/index.js +12 -0
- package/lib/components/ExampleComponent/ExampleComponent.js +35 -4
- package/lib/components/ExampleComponent/useExample.js +58 -0
- package/lib/components/InlineEdit/InlineEdit.js +5 -1
- package/lib/components/InlineEditV1/InlineEditV1.js +7 -2
- package/lib/components/InlineEditV2/InlineEditV2.js +53 -16
- package/lib/components/NonLinearReading/NonLinearReading.js +6 -6
- package/lib/components/PageHeader/PageHeader.js +28 -31
- package/lib/components/SidePanel/SidePanel.js +25 -26
- package/lib/components/TagSet/TagSet.js +5 -7
- package/lib/components/Tearsheet/TearsheetShell.js +4 -6
- package/lib/components/index.js +13 -0
- package/lib/global/js/hooks/useResizeObserver.js +83 -0
- package/lib/global/js/package-settings.js +34 -3
- package/lib/global/js/utils/test-helper.js +37 -5
- package/lib/settings.js +41 -30
- package/package.json +2 -3
- package/scss/components/Datagrid/styles/_useSelectAllToggle.scss +10 -7
- package/scss/components/InlineEditV2/_inline-edit-v2.scss +52 -11
- package/scss/components/InlineEditV2/_storybook-styles.scss +9 -2
- package/scss/components/NonLinearReading/_non-linear-reading.scss +76 -67
- package/scss/components/NonLinearReading/_storybook-styles.scss +16 -0
|
@@ -14,7 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _framerMotion = require("framer-motion");
|
|
15
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
16
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
var
|
|
17
|
+
var _useResizeObserver = require("../../global/js/hooks/useResizeObserver");
|
|
18
18
|
var _motion = require("@carbon/motion");
|
|
19
19
|
var _devtools = require("../../global/js/utils/devtools");
|
|
20
20
|
var _propsHelper = require("../../global/js/utils/props-helper");
|
|
@@ -51,7 +51,7 @@ var defaults = {
|
|
|
51
51
|
* Side panels keep users in-context of a page while performing tasks like navigating, editing, viewing details, or configuring something new.
|
|
52
52
|
*/
|
|
53
53
|
var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
54
|
-
var _window,
|
|
54
|
+
var _window, _ref5, _cx4;
|
|
55
55
|
var actionToolbarButtons = _ref.actionToolbarButtons,
|
|
56
56
|
actions = _ref.actions,
|
|
57
57
|
_ref$animateTitle = _ref.animateTitle,
|
|
@@ -163,8 +163,9 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
163
163
|
}, [labelText, title]);
|
|
164
164
|
|
|
165
165
|
/* istanbul ignore next */
|
|
166
|
-
var handleResize = function handleResize(
|
|
166
|
+
var handleResize = function handleResize(_ref2) {
|
|
167
167
|
var _sidePanelOuter$style3;
|
|
168
|
+
var height = _ref2.height;
|
|
168
169
|
setPanelHeight(height);
|
|
169
170
|
var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
|
|
170
171
|
var actionsContainer = getActionsContainerElement();
|
|
@@ -351,9 +352,9 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
351
352
|
|
|
352
353
|
// adds focus trap functionality
|
|
353
354
|
/* istanbul ignore next */
|
|
354
|
-
var handleBlur = function handleBlur(
|
|
355
|
-
var oldActiveNode =
|
|
356
|
-
currentActiveNode =
|
|
355
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
356
|
+
var oldActiveNode = _ref3.target,
|
|
357
|
+
currentActiveNode = _ref3.relatedTarget;
|
|
357
358
|
// focus trap should only be set if the side panel is a `slideOver` type
|
|
358
359
|
if (open && sidePanelInnerRef && !slideIn) {
|
|
359
360
|
(0, _wrapFocus.default)({
|
|
@@ -366,7 +367,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
366
367
|
}
|
|
367
368
|
};
|
|
368
369
|
var primaryActionContainerClassNames = (0, _classnames.default)(["".concat(blockClass, "__actions-container"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__actions-container-condensed"), condensedActions)]);
|
|
369
|
-
var mainPanelClassNames = (0, _classnames.default)([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (
|
|
370
|
+
var mainPanelClassNames = (0, _classnames.default)([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref5 = {}, (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-right-placement"), placement === 'right'), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-left-placement"), placement === 'left'), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), _ref5)]);
|
|
370
371
|
var renderHeader = function renderHeader() {
|
|
371
372
|
var _cx, _cx2;
|
|
372
373
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -395,17 +396,17 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
395
396
|
className: (0, _classnames.default)("".concat(blockClass, "__subtitle-text"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-text-no-animation"), !animateTitle), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-text-no-animation-no-action-toolbar"), !animateTitle && (!actionToolbarButtons || !actionToolbarButtons.length)), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-text-is-animating"), !animationComplete && animateTitle), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-without-title"), !title), _cx2))
|
|
396
397
|
}, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/_react.default.createElement("div", {
|
|
397
398
|
className: (0, _classnames.default)("".concat(blockClass, "__action-toolbar"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__action-toolbar-no-animation"), !animateTitle))
|
|
398
|
-
}, actionToolbarButtons.map(function (
|
|
399
|
-
var label =
|
|
400
|
-
kind =
|
|
401
|
-
icon =
|
|
402
|
-
tooltipPosition =
|
|
403
|
-
tooltipAlignment =
|
|
404
|
-
leading =
|
|
405
|
-
disabled =
|
|
406
|
-
className =
|
|
407
|
-
onClick =
|
|
408
|
-
rest = (0, _objectWithoutProperties2.default)(
|
|
399
|
+
}, actionToolbarButtons.map(function (_ref6) {
|
|
400
|
+
var label = _ref6.label,
|
|
401
|
+
kind = _ref6.kind,
|
|
402
|
+
icon = _ref6.icon,
|
|
403
|
+
tooltipPosition = _ref6.tooltipPosition,
|
|
404
|
+
tooltipAlignment = _ref6.tooltipAlignment,
|
|
405
|
+
leading = _ref6.leading,
|
|
406
|
+
disabled = _ref6.disabled,
|
|
407
|
+
className = _ref6.className,
|
|
408
|
+
onClick = _ref6.onClick,
|
|
409
|
+
rest = (0, _objectWithoutProperties2.default)(_ref6, _excluded2);
|
|
409
410
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({}, rest, {
|
|
410
411
|
key: label,
|
|
411
412
|
kind: kind || 'ghost',
|
|
@@ -433,10 +434,8 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
433
434
|
}, title));
|
|
434
435
|
};
|
|
435
436
|
var contentRef = ref || sidePanelRef;
|
|
436
|
-
(0,
|
|
437
|
-
|
|
438
|
-
onResize: handleResize,
|
|
439
|
-
targetRef: contentRef
|
|
437
|
+
(0, _useResizeObserver.useResizeObserver)(contentRef, {
|
|
438
|
+
callback: handleResize
|
|
440
439
|
});
|
|
441
440
|
return /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, null, open && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_framerMotion.motion.div, (0, _extends2.default)({}, (0, _devtools.getDevtoolsProps)(componentName), rest, {
|
|
442
441
|
id: "".concat(blockClass, "-outer"),
|
|
@@ -590,8 +589,8 @@ SidePanel.propTypes = {
|
|
|
590
589
|
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
|
591
590
|
* This prop is required when using the `slideIn` variant of the side panel.
|
|
592
591
|
*/
|
|
593
|
-
selectorPageContent: _propTypes.default.string.isRequired.if(function (
|
|
594
|
-
var slideIn =
|
|
592
|
+
selectorPageContent: _propTypes.default.string.isRequired.if(function (_ref8) {
|
|
593
|
+
var slideIn = _ref8.slideIn;
|
|
595
594
|
return slideIn;
|
|
596
595
|
}),
|
|
597
596
|
/**
|
|
@@ -614,8 +613,8 @@ SidePanel.propTypes = {
|
|
|
614
613
|
/**
|
|
615
614
|
* Sets the title text
|
|
616
615
|
*/
|
|
617
|
-
title: _propTypes.default.string.isRequired.if(function (
|
|
618
|
-
var labelText =
|
|
616
|
+
title: _propTypes.default.string.isRequired.if(function (_ref9) {
|
|
617
|
+
var labelText = _ref9.labelText;
|
|
619
618
|
return labelText;
|
|
620
619
|
})
|
|
621
620
|
};
|
|
@@ -17,7 +17,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
17
17
|
var _TagSetOverflow = require("./TagSetOverflow");
|
|
18
18
|
var _TagSetModal = require("./TagSetModal");
|
|
19
19
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
20
|
-
var
|
|
20
|
+
var _useResizeObserver = require("../../global/js/hooks/useResizeObserver");
|
|
21
21
|
var _devtools = require("../../global/js/utils/devtools");
|
|
22
22
|
var _propsHelper = require("../../global/js/utils/props-helper");
|
|
23
23
|
var _settings = require("../../settings");
|
|
@@ -205,13 +205,11 @@ var TagSet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
205
205
|
var handleModalClose = function handleModalClose() {
|
|
206
206
|
setShowAllModalOpen(false);
|
|
207
207
|
};
|
|
208
|
-
(0,
|
|
209
|
-
|
|
210
|
-
targetRef: sizingContainerRef
|
|
208
|
+
(0, _useResizeObserver.useResizeObserver)(sizingContainerRef, {
|
|
209
|
+
callback: handleSizerTagsResize
|
|
211
210
|
});
|
|
212
|
-
(0,
|
|
213
|
-
|
|
214
|
-
targetRef: tagSetRef
|
|
211
|
+
(0, _useResizeObserver.useResizeObserver)(tagSetRef, {
|
|
212
|
+
callback: handleResize
|
|
215
213
|
});
|
|
216
214
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
|
217
215
|
className: (0, _classnames.default)([blockClass, className]),
|
|
@@ -12,7 +12,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactDom = require("react-dom");
|
|
15
|
-
var
|
|
15
|
+
var _useResizeObserver2 = require("../../global/js/hooks/useResizeObserver");
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
17
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
18
18
|
var _settings = require("../../settings");
|
|
@@ -93,12 +93,10 @@ var TearsheetShell = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
|
93
93
|
}
|
|
94
94
|
}, [portalTargetIn]);
|
|
95
95
|
var localRef = (0, _react.useRef)();
|
|
96
|
+
var resizer = (0, _react.useRef)(null);
|
|
96
97
|
var modalRef = ref || localRef;
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
}),
|
|
100
|
-
width = _useResizeDetector.width,
|
|
101
|
-
resizer = _useResizeDetector.ref;
|
|
98
|
+
var _useResizeObserver = (0, _useResizeObserver2.useResizeObserver)(resizer),
|
|
99
|
+
width = _useResizeObserver.width;
|
|
102
100
|
|
|
103
101
|
// Keep track of the stack depth and our position in it (1-based, 0=closed)
|
|
104
102
|
var _useState3 = (0, _react.useState)(0),
|
package/lib/components/index.js
CHANGED
|
@@ -99,6 +99,12 @@ Object.defineProperty(exports, "EditFullPage", {
|
|
|
99
99
|
return _EditFullPage.EditFullPage;
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
+
Object.defineProperty(exports, "EditInPlace", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function get() {
|
|
105
|
+
return _EditInPlace.EditInPlace;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
102
108
|
Object.defineProperty(exports, "EditSidePanel", {
|
|
103
109
|
enumerable: true,
|
|
104
110
|
get: function get() {
|
|
@@ -387,6 +393,12 @@ Object.defineProperty(exports, "useDisableSelectRows", {
|
|
|
387
393
|
return _Datagrid.useDisableSelectRows;
|
|
388
394
|
}
|
|
389
395
|
});
|
|
396
|
+
Object.defineProperty(exports, "useEditableCell", {
|
|
397
|
+
enumerable: true,
|
|
398
|
+
get: function get() {
|
|
399
|
+
return _Datagrid.useEditableCell;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
390
402
|
Object.defineProperty(exports, "useExpandedRow", {
|
|
391
403
|
enumerable: true,
|
|
392
404
|
get: function get() {
|
|
@@ -497,4 +509,5 @@ var _EditTearsheetNarrow = require("./EditTearsheetNarrow");
|
|
|
497
509
|
var _EditFullPage = require("./EditFullPage");
|
|
498
510
|
var _EditUpdateCards = require("./EditUpdateCards");
|
|
499
511
|
var _InlineEdit = require("./InlineEdit");
|
|
512
|
+
var _EditInPlace = require("./EditInPlace");
|
|
500
513
|
var _NonLinearReading = require("./NonLinearReading");
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useResizeObserver = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
/**
|
|
11
|
+
* Copyright IBM Corp. 2023, 2023
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var useResizeObserver = function useResizeObserver(ref) {
|
|
18
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
19
|
+
callback: null,
|
|
20
|
+
throttleInterval: 0
|
|
21
|
+
};
|
|
22
|
+
var callback = options.callback,
|
|
23
|
+
throttleInterval = options.throttleInterval;
|
|
24
|
+
var _useState = (0, _react.useState)(0),
|
|
25
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
26
|
+
width = _useState2[0],
|
|
27
|
+
setWidth = _useState2[1];
|
|
28
|
+
var _useState3 = (0, _react.useState)(0),
|
|
29
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
30
|
+
height = _useState4[0],
|
|
31
|
+
setHeight = _useState4[1];
|
|
32
|
+
var throttleTimeout = (0, _react.useRef)(null);
|
|
33
|
+
var entriesToHandle = (0, _react.useRef)(null);
|
|
34
|
+
(0, _react.useLayoutEffect)(function () {
|
|
35
|
+
if (!(ref !== null && ref !== void 0 && ref.current)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
var doCallbacks = function doCallbacks() {
|
|
39
|
+
if (!(ref !== null && ref !== void 0 && ref.current) || !Array.isArray(entriesToHandle === null || entriesToHandle === void 0 ? void 0 : entriesToHandle.current)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
var entry = entriesToHandle.current[0];
|
|
43
|
+
setWidth(entry.contentRect.width);
|
|
44
|
+
setHeight(entry.contentRect.height);
|
|
45
|
+
throttleTimeout.current = null;
|
|
46
|
+
callback && callback(entry.contentRect);
|
|
47
|
+
};
|
|
48
|
+
var observer = new ResizeObserver(function (entries) {
|
|
49
|
+
// always update entriesToHandle
|
|
50
|
+
entriesToHandle.current = entries;
|
|
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
|
+
|
|
56
|
+
// set up throttle
|
|
57
|
+
throttleTimeout.current = setTimeout(function () {
|
|
58
|
+
// do callbacks
|
|
59
|
+
doCallbacks();
|
|
60
|
+
// reset throttle
|
|
61
|
+
throttleTimeout.current = null;
|
|
62
|
+
}, throttleInterval);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
// no throttle do callbacks every time
|
|
66
|
+
doCallbacks();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// observe all refs passed
|
|
71
|
+
observer.observe(ref.current);
|
|
72
|
+
return function () {
|
|
73
|
+
observer.disconnect();
|
|
74
|
+
observer = null;
|
|
75
|
+
};
|
|
76
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
+
}, [ref, options]);
|
|
78
|
+
return {
|
|
79
|
+
width: width,
|
|
80
|
+
height: height
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
exports.useResizeObserver = useResizeObserver;
|
|
@@ -25,6 +25,7 @@ var defaults = {
|
|
|
25
25
|
CreateTearsheet: true,
|
|
26
26
|
CreateTearsheetStep: true,
|
|
27
27
|
CreateTearsheetDivider: true,
|
|
28
|
+
EditInPlace: true,
|
|
28
29
|
EmptyState: true,
|
|
29
30
|
ErrorEmptyState: true,
|
|
30
31
|
ExportModal: true,
|
|
@@ -78,7 +79,15 @@ var defaults = {
|
|
|
78
79
|
// feature level flags
|
|
79
80
|
feature: {
|
|
80
81
|
'a-new-feature': false,
|
|
81
|
-
'default-portal-target-body': true
|
|
82
|
+
'default-portal-target-body': true,
|
|
83
|
+
'Datagrid.useExpandedRow': false,
|
|
84
|
+
'Datagrid.useNestedRows': false,
|
|
85
|
+
'Datagrid.useInlineEdit': false,
|
|
86
|
+
'Datagrid.useActionsColumn': false,
|
|
87
|
+
'Datagrid.useFiltering': false,
|
|
88
|
+
'Datagrid.useCustomizeColumns': false,
|
|
89
|
+
'ExampleComponent.secondaryIcon': false,
|
|
90
|
+
'ExampleComponent.useExample': false
|
|
82
91
|
}
|
|
83
92
|
};
|
|
84
93
|
var warningMessageComponent = function warningMessageComponent(property) {
|
|
@@ -87,6 +96,9 @@ var warningMessageComponent = function warningMessageComponent(property) {
|
|
|
87
96
|
var warningMessageFeature = function warningMessageFeature(property) {
|
|
88
97
|
return "Carbon for IBM Products (WARNING): Feature \"".concat(property, "\" enabled via feature flags.");
|
|
89
98
|
};
|
|
99
|
+
var errorMessageFeature = function errorMessageFeature(property) {
|
|
100
|
+
return "Carbon for IBM Products (Error): Feature \"".concat(property, "\" not enabled. To enable see the notes on feature flags in the README.");
|
|
101
|
+
};
|
|
90
102
|
var warningMessageAllComponents = 'Carbon for IBM Products (WARNING): All components enabled through use of setAllComponents. This includes components that have not yet completed their review process.';
|
|
91
103
|
var warningMessageAllFeatures = 'Carbon for IBM Products (WARNING): All features enabled through use of setAllFeatures';
|
|
92
104
|
|
|
@@ -108,7 +120,10 @@ var allFeatures = all.INITIAL;
|
|
|
108
120
|
var silent = false;
|
|
109
121
|
var component = new Proxy(_objectSpread({}, defaults.component), {
|
|
110
122
|
set: function set(target, property, value) {
|
|
111
|
-
|
|
123
|
+
if (target[property] !== true && !silent && value) {
|
|
124
|
+
// not already true, not silent, and now true
|
|
125
|
+
console.warn(warningMessageComponent(property));
|
|
126
|
+
}
|
|
112
127
|
target[property] = value;
|
|
113
128
|
return true; // value set
|
|
114
129
|
},
|
|
@@ -119,7 +134,15 @@ var component = new Proxy(_objectSpread({}, defaults.component), {
|
|
|
119
134
|
});
|
|
120
135
|
var feature = new Proxy(_objectSpread({}, defaults.feature), {
|
|
121
136
|
set: function set(target, property, value) {
|
|
122
|
-
|
|
137
|
+
// If we receive a feature flag that doesn't exist in our defaults we should not log
|
|
138
|
+
// a warning message and instead just return
|
|
139
|
+
if (!Object.getOwnPropertyDescriptor(defaults.feature, property)) {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
if (target[property] !== true && !silent && value) {
|
|
143
|
+
// not already true, not silent, and now true
|
|
144
|
+
console.warn(warningMessageFeature(property));
|
|
145
|
+
}
|
|
123
146
|
target[property] = value;
|
|
124
147
|
return true; // value set
|
|
125
148
|
},
|
|
@@ -148,6 +171,14 @@ var _default = {
|
|
|
148
171
|
var byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
149
172
|
return byDefault ? defaults.feature[featureName] : feature[featureName];
|
|
150
173
|
},
|
|
174
|
+
checkReportFeatureEnabled: function checkReportFeatureEnabled(featureName) {
|
|
175
|
+
if (feature[featureName]) {
|
|
176
|
+
// NOTE: Warning emitted if feature flag is enabled (see Proxy above)
|
|
177
|
+
return true;
|
|
178
|
+
} else {
|
|
179
|
+
console.error(errorMessageFeature(featureName));
|
|
180
|
+
}
|
|
181
|
+
},
|
|
151
182
|
isFeaturePublic: function isFeaturePublic(featureName) {
|
|
152
183
|
var byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
153
184
|
return Object.prototype.hasOwnProperty.call(byDefault ? defaults.feature : feature, featureName);
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.scssCompile = exports.scssCheck = exports.required = exports.mockHTMLElement = exports.invalid = exports.expectWarnAsync = exports.expectWarn = exports.expectMultipleWarn = exports.expectMultipleError = exports.expectError = exports.deprecatedUsage = exports.deprecated = void 0;
|
|
7
|
+
exports.scssCompile = exports.scssCheck = exports.required = exports.mockHTMLElement = exports.invalid = exports.expectWarnAsync = exports.expectWarn = exports.expectMultipleWarn = exports.expectMultipleError = exports.expectLogging = exports.expectError = exports.deprecatedUsage = exports.deprecated = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -194,6 +194,40 @@ var expectMultipleWarn = function expectMultipleWarn(messages, test) {
|
|
|
194
194
|
warn.mockRestore();
|
|
195
195
|
return result;
|
|
196
196
|
};
|
|
197
|
+
exports.expectMultipleWarn = expectMultipleWarn;
|
|
198
|
+
var checkLogging = function checkLogging(mock, message) {
|
|
199
|
+
if (message) {
|
|
200
|
+
var _expect4;
|
|
201
|
+
expect(mock).toBeCalled();
|
|
202
|
+
(_expect4 = expect(mock)).toHaveBeenCalledWith.apply(_expect4, (0, _toConsumableArray2.default)(makeMatcherArray(message)));
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* A helper function to enable a test to expect a single call to
|
|
208
|
+
* console.error, for example when intentionally omitting a required prop
|
|
209
|
+
* or supplying an invalid prop type or value for the purposes of the test.
|
|
210
|
+
* @param {errors: {string|regex|function|[]}, warnings: {string|regex|function|[]}} messages the expected parameters for the call to
|
|
211
|
+
* console.error or console.warn, which must be called exactly once. A single string or regex or an
|
|
212
|
+
* expect matcher can be used to match a single-argument call to console.error (most common),
|
|
213
|
+
* while an array of strings and/or regex and/or expect matchers can be used to match a
|
|
214
|
+
* multiple-argument call. Strings can be full or substring matches to the corresponding
|
|
215
|
+
* argument.
|
|
216
|
+
* @param {Function} test the test function to call, during which the call to
|
|
217
|
+
* console.error will be expected.
|
|
218
|
+
*/
|
|
219
|
+
var expectLogging = function expectLogging(_ref2, test) {
|
|
220
|
+
var errors = _ref2.errors,
|
|
221
|
+
warnings = _ref2.warnings;
|
|
222
|
+
var error = jest.spyOn(console, 'error').mockImplementation(jest.fn());
|
|
223
|
+
var warn = jest.spyOn(console, 'warn').mockImplementation(jest.fn());
|
|
224
|
+
var result = test();
|
|
225
|
+
checkLogging(error, errors);
|
|
226
|
+
checkLogging(warn, warnings);
|
|
227
|
+
error.mockRestore();
|
|
228
|
+
warn.mockRestore();
|
|
229
|
+
return result;
|
|
230
|
+
};
|
|
197
231
|
|
|
198
232
|
/**
|
|
199
233
|
* A helper function to enable a test to expect a single call to
|
|
@@ -208,13 +242,11 @@ var expectMultipleWarn = function expectMultipleWarn(messages, test) {
|
|
|
208
242
|
* @param {Function} test the test function to call, during which the call to
|
|
209
243
|
* console.error will be expected.
|
|
210
244
|
*/
|
|
211
|
-
exports.
|
|
245
|
+
exports.expectLogging = expectLogging;
|
|
212
246
|
var expectError = function expectError(message, test) {
|
|
213
|
-
var _expect4;
|
|
214
247
|
var error = jest.spyOn(console, 'error').mockImplementation(jest.fn());
|
|
215
248
|
var result = test();
|
|
216
|
-
|
|
217
|
-
(_expect4 = expect(error)).toHaveBeenCalledWith.apply(_expect4, (0, _toConsumableArray2.default)(makeMatcherArray(message)));
|
|
249
|
+
checkLogging(error, message);
|
|
218
250
|
error.mockRestore();
|
|
219
251
|
return result;
|
|
220
252
|
};
|
package/lib/settings.js
CHANGED
|
@@ -10,6 +10,7 @@ var _packageSettings = _interopRequireDefault(require("./global/js/package-setti
|
|
|
10
10
|
var _carbonComponents = require("carbon-components");
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _themes = require("@carbon/themes");
|
|
13
|
+
var _pconsole = _interopRequireDefault(require("./global/js/utils/pconsole"));
|
|
13
14
|
var carbon = {
|
|
14
15
|
get prefix() {
|
|
15
16
|
return _carbonComponents.settings.prefix;
|
|
@@ -21,31 +22,43 @@ var carbon = {
|
|
|
21
22
|
return _themes.themes;
|
|
22
23
|
}
|
|
23
24
|
};
|
|
25
|
+
exports.carbon = carbon;
|
|
26
|
+
var componentDeprecatedWarning = function componentDeprecatedWarning(name, details) {
|
|
27
|
+
return "Carbon for IBM Products (WARNING): Component \"".concat(name, "\" is deprecated. ").concat(details);
|
|
28
|
+
};
|
|
29
|
+
_packageSettings.default.logDeprecated = function (component, name) {
|
|
30
|
+
if (component !== null && component !== void 0 && component.deprecated) {
|
|
31
|
+
var _pconsole$level;
|
|
32
|
+
var _component$deprecated = component.deprecated,
|
|
33
|
+
level = _component$deprecated.level,
|
|
34
|
+
details = _component$deprecated.details;
|
|
35
|
+
var logUsing = (_pconsole$level = _pconsole.default === null || _pconsole.default === void 0 ? void 0 : _pconsole.default[level]) !== null && _pconsole$level !== void 0 ? _pconsole$level : _pconsole.default.error;
|
|
36
|
+
logUsing(componentDeprecatedWarning(name || component.displayName, details));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
24
39
|
|
|
25
40
|
// Check that a component is enabled. This function returns a stub which checks
|
|
26
41
|
// the component status on first use and then renders as the component or as
|
|
27
42
|
// a Canary placeholder initialized with the name of the replaced component.
|
|
28
43
|
// Note that the returned stub carries any other properties which had already
|
|
29
44
|
// been assigned (eg propTypes, displayName, etc).
|
|
30
|
-
exports.carbon = carbon;
|
|
31
45
|
_packageSettings.default.checkComponentEnabled = function (component, name) {
|
|
32
46
|
if (component.render) {
|
|
33
47
|
// The component is a forward-ref, so make a stub forward-ref.
|
|
34
48
|
var forward = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
+
_packageSettings.default.logDeprecated(component, name); // may log don't care about result
|
|
50
|
+
// Replace the stub's render fn so this test only happens once.
|
|
51
|
+
return (forward.render = _packageSettings.default.isComponentEnabled(name) || !_packageSettings.default.isComponentPublic(name) ?
|
|
52
|
+
// If the component is enabled, or if it's not a public component,
|
|
53
|
+
// replace the stub's render fn with the component's render fn.
|
|
54
|
+
component.render :
|
|
55
|
+
// Note that Canary is a direct render fn (not a forward-ref) and
|
|
56
|
+
// will ignore the passed props and ref (if any)
|
|
57
|
+
_Canary.Canary.bind(undefined, {
|
|
58
|
+
componentName: name
|
|
59
|
+
}))(
|
|
60
|
+
// Call it now (after this it will be directly called).
|
|
61
|
+
props, ref);
|
|
49
62
|
});
|
|
50
63
|
|
|
51
64
|
// Transfer object properties already assigned (eg propTypes, displayName)
|
|
@@ -55,22 +68,20 @@ _packageSettings.default.checkComponentEnabled = function (component, name) {
|
|
|
55
68
|
} else {
|
|
56
69
|
// The component is a direct render fn, so make a stub render fn.
|
|
57
70
|
var _render = function render(props) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
);
|
|
71
|
+
_packageSettings.default.logDeprecated(component, name); // may log don't care about result
|
|
72
|
+
// Replace the stub render fn so this test only happens once.
|
|
73
|
+
return (_render = _packageSettings.default.isComponentEnabled(name) || !_packageSettings.default.isComponentPublic(name) ?
|
|
74
|
+
// If the component is enabled, or if it's not a public component,
|
|
75
|
+
// replace the stub render fn with the component render fn.
|
|
76
|
+
component :
|
|
77
|
+
// Replace the stub render fn with the Canary render fn, which will
|
|
78
|
+
// ignore the passed props.
|
|
79
|
+
_Canary.Canary.bind(undefined, {
|
|
80
|
+
componentName: name
|
|
81
|
+
}))(
|
|
82
|
+
// Call it now (after this it will be directly called).
|
|
83
|
+
props);
|
|
72
84
|
};
|
|
73
|
-
|
|
74
85
|
// Transfer object properties already assigned (eg propTypes, displayName)
|
|
75
86
|
// to a function which calls the stub render fn which checks the component
|
|
76
87
|
// status when first used.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/ibm-products",
|
|
3
3
|
"description": "Carbon for IBM Products",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.52.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"immutability-helper": "^3.1.1",
|
|
78
78
|
"react-dnd": "^15.1.2",
|
|
79
79
|
"react-dnd-html5-backend": "^15.1.3",
|
|
80
|
-
"react-resize-detector": "^8.0.3",
|
|
81
80
|
"react-table": "^7.8.0",
|
|
82
81
|
"react-window": "^1.8.8"
|
|
83
82
|
},
|
|
@@ -95,5 +94,5 @@
|
|
|
95
94
|
"react": "^16.8.6 || ^17.0.1",
|
|
96
95
|
"react-dom": "^16.8.6 || ^17.0.1"
|
|
97
96
|
},
|
|
98
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "179302ccba3098ee42eae60cdf7ae5b4754a0759"
|
|
99
98
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
1
|
+
//
|
|
2
|
+
// Copyright IBM Corp. 2021, 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
|
+
//
|
|
8
7
|
|
|
9
8
|
@import './variables';
|
|
10
9
|
|
|
@@ -29,3 +28,7 @@ th.#{$block-class}__select-all-toggle-on {
|
|
|
29
28
|
th.#{$block-class}__select-all-toggle-on.button {
|
|
30
29
|
margin-left: $spacing-01;
|
|
31
30
|
}
|
|
31
|
+
|
|
32
|
+
.#{$block-class}__select-all-toggle-overflow.#{$carbon-prefix}--overflow-menu-options--sm.#{$carbon-prefix}--overflow-menu-options[data-floating-menu-direction='bottom']::after {
|
|
33
|
+
width: $spacing-13;
|
|
34
|
+
}
|