@carbon/ibm-products 1.53.1 → 1.54.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +15 -15
- package/es/components/AboutModal/AboutModal.js +1 -3
- package/es/components/ActionBar/ActionBar.js +4 -6
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -6
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +3 -9
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +1 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +35 -36
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -26
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +0 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +50 -17
- package/es/components/Datagrid/useFiltering.js +1 -1
- package/es/components/Datagrid/utils/makeData.js +1 -1
- package/es/components/PageHeader/PageHeader.js +2 -6
- package/es/components/SidePanel/SidePanel.js +1 -3
- package/es/components/TagSet/TagSet.js +2 -6
- package/es/global/js/hooks/useResizeObserver.js +14 -28
- package/es/global/js/utils/story-helper.js +1 -1
- package/lib/components/AboutModal/AboutModal.js +1 -3
- package/lib/components/ActionBar/ActionBar.js +4 -6
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -6
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +3 -9
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +1 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +33 -35
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -26
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +0 -7
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +48 -15
- package/lib/components/Datagrid/useFiltering.js +1 -1
- package/lib/components/Datagrid/utils/makeData.js +1 -1
- package/lib/components/PageHeader/PageHeader.js +2 -6
- package/lib/components/SidePanel/SidePanel.js +1 -3
- package/lib/components/TagSet/TagSet.js +2 -6
- package/lib/global/js/hooks/useResizeObserver.js +13 -27
- package/lib/global/js/utils/story-helper.js +1 -1
- package/package.json +7 -7
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +0 -21
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +0 -30
@@ -14,13 +14,7 @@ var _react = require("react");
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
15
15
|
*/
|
16
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;
|
17
|
+
var useResizeObserver = function useResizeObserver(ref, callback) {
|
24
18
|
var _useState = (0, _react.useState)(0),
|
25
19
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
26
20
|
width = _useState2[0],
|
@@ -29,8 +23,14 @@ var useResizeObserver = function useResizeObserver(ref) {
|
|
29
23
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
30
24
|
height = _useState4[0],
|
31
25
|
setHeight = _useState4[1];
|
32
|
-
var throttleTimeout = (0, _react.useRef)(null);
|
33
26
|
var entriesToHandle = (0, _react.useRef)(null);
|
27
|
+
var cb = (0, _react.useRef)(callback);
|
28
|
+
(0, _react.useEffect)(function () {
|
29
|
+
// ref for callback removes it as dependency fro useLayoutEffect
|
30
|
+
// This significantly reduces repeated calls if a function is redefined on every
|
31
|
+
// render
|
32
|
+
cb.current = callback;
|
33
|
+
}, [callback]);
|
34
34
|
(0, _react.useLayoutEffect)(function () {
|
35
35
|
if (!(ref !== null && ref !== void 0 && ref.current)) {
|
36
36
|
return;
|
@@ -42,29 +42,15 @@ var useResizeObserver = function useResizeObserver(ref) {
|
|
42
42
|
var entry = entriesToHandle.current[0];
|
43
43
|
setWidth(entry.contentRect.width);
|
44
44
|
setHeight(entry.contentRect.height);
|
45
|
-
|
46
|
-
callback && callback(entry.contentRect);
|
45
|
+
cb.current && cb.current(entry.contentRect);
|
47
46
|
};
|
48
47
|
var observer = new ResizeObserver(function (entries) {
|
49
48
|
// always update entriesToHandle
|
50
49
|
entriesToHandle.current = entries;
|
51
|
-
|
52
|
-
//
|
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
|
50
|
+
window.requestAnimationFrame(function () {
|
51
|
+
// do callbacks
|
66
52
|
doCallbacks();
|
67
|
-
}
|
53
|
+
});
|
68
54
|
});
|
69
55
|
|
70
56
|
// observe all refs passed
|
@@ -74,7 +60,7 @@ var useResizeObserver = function useResizeObserver(ref) {
|
|
74
60
|
observer = null;
|
75
61
|
};
|
76
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
77
|
-
}, [ref
|
63
|
+
}, [ref]);
|
78
64
|
return {
|
79
65
|
width: width,
|
80
66
|
height: height
|
@@ -75,7 +75,7 @@ exports.prepareStory = prepareStory;
|
|
75
75
|
var CodesandboxLink = function CodesandboxLink(_ref) {
|
76
76
|
var exampleDirectory = _ref.exampleDirectory;
|
77
77
|
return /*#__PURE__*/_react.default.createElement("a", {
|
78
|
-
href: "https://codesandbox.io/s/github/carbon-design-system/ibm-
|
78
|
+
href: "https://codesandbox.io/s/github/carbon-design-system/ibm-products/tree/main_v1/examples/carbon-for-ibm-products/".concat(exampleDirectory)
|
79
79
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
80
80
|
alt: "Edit on CodeSandbox",
|
81
81
|
src: "https://codesandbox.io/static/img/play-codesandbox.svg"
|
package/package.json
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.54.1",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
8
8
|
"repository": {
|
9
9
|
"type": "git",
|
10
|
-
"url": "https://github.com/carbon-design-system/ibm-
|
11
|
-
"directory": "packages/
|
10
|
+
"url": "https://github.com/carbon-design-system/ibm-products.git",
|
11
|
+
"directory": "packages/ibm-products"
|
12
12
|
},
|
13
|
-
"bugs": "https://github.com/carbon-design-system/ibm-
|
13
|
+
"bugs": "https://github.com/carbon-design-system/ibm-products/issues",
|
14
14
|
"sideEffects": [
|
15
15
|
"**/global/js/utils/props-helper.js",
|
16
16
|
"**/*.css",
|
@@ -53,7 +53,7 @@
|
|
53
53
|
"devDependencies": {
|
54
54
|
"@babel/cli": "^7.20.7",
|
55
55
|
"@babel/core": "^7.20.12",
|
56
|
-
"babel-preset-ibm-cloud-cognitive": "^0.14.
|
56
|
+
"babel-preset-ibm-cloud-cognitive": "^0.14.28",
|
57
57
|
"chalk": "^4.1.2",
|
58
58
|
"change-case": "^4.1.2",
|
59
59
|
"copyfiles": "^2.4.1",
|
@@ -61,7 +61,7 @@
|
|
61
61
|
"fs-extra": "^11.1.0",
|
62
62
|
"glob": "^8.1.0",
|
63
63
|
"jest": "^29.4.2",
|
64
|
-
"jest-config-ibm-cloud-cognitive": "^0.24.
|
64
|
+
"jest-config-ibm-cloud-cognitive": "^0.24.15",
|
65
65
|
"jest-environment-jsdom": "^29.4.2",
|
66
66
|
"namor": "^1.1.2",
|
67
67
|
"npm-check-updates": "^16.7.4",
|
@@ -95,5 +95,5 @@
|
|
95
95
|
"react": "^16.8.6 || ^17.0.1",
|
96
96
|
"react-dom": "^16.8.6 || ^17.0.1"
|
97
97
|
},
|
98
|
-
"gitHead": "
|
98
|
+
"gitHead": "d492e0ac9ef45929459680ea97274be0fcee61e5"
|
99
99
|
}
|
package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
-
/*
|
3
|
-
* Licensed Materials - Property of IBM
|
4
|
-
* 5724-Q36
|
5
|
-
* (c) Copyright IBM Corp. 2022
|
6
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
7
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
8
|
-
*/
|
9
|
-
import { useState } from 'react';
|
10
|
-
import { FLYOUT } from '../constants';
|
11
|
-
import { getInitialStateFromFilters } from '../utils';
|
12
|
-
var useInitialStateFromFilters = function useInitialStateFromFilters(filters) {
|
13
|
-
var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
|
14
|
-
var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
15
|
-
var _useState = useState(getInitialStateFromFilters(filters, variation, initialFilters)),
|
16
|
-
_useState2 = _slicedToArray(_useState, 2),
|
17
|
-
state = _useState2[0],
|
18
|
-
setState = _useState2[1];
|
19
|
-
return [state, setState];
|
20
|
-
};
|
21
|
-
export default useInitialStateFromFilters;
|
package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
5
|
-
value: true
|
6
|
-
});
|
7
|
-
exports.default = void 0;
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
|
-
var _react = require("react");
|
10
|
-
var _constants = require("../constants");
|
11
|
-
var _utils = require("../utils");
|
12
|
-
/*
|
13
|
-
* Licensed Materials - Property of IBM
|
14
|
-
* 5724-Q36
|
15
|
-
* (c) Copyright IBM Corp. 2022
|
16
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
17
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
18
|
-
*/
|
19
|
-
|
20
|
-
var useInitialStateFromFilters = function useInitialStateFromFilters(filters) {
|
21
|
-
var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.FLYOUT;
|
22
|
-
var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
23
|
-
var _useState = (0, _react.useState)((0, _utils.getInitialStateFromFilters)(filters, variation, initialFilters)),
|
24
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
25
|
-
state = _useState2[0],
|
26
|
-
setState = _useState2[1];
|
27
|
-
return [state, setState];
|
28
|
-
};
|
29
|
-
var _default = useInitialStateFromFilters;
|
30
|
-
exports.default = _default;
|