@carbon/ibm-products 2.37.0 → 2.38.0-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ export namespace DatagridContent {
14
14
  DatagridPagination: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
15
15
  CustomizeColumnsTearsheet: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
16
16
  isFetching: PropTypes.Requireable<boolean>;
17
+ skeletonRowCount: PropTypes.Requireable<number>;
17
18
  fullHeightDatagrid: PropTypes.Requireable<boolean>;
18
19
  filterProps: PropTypes.Requireable<object>;
19
20
  variableRowHeight: PropTypes.Requireable<boolean>;
@@ -184,6 +184,7 @@ DatagridContent.propTypes = {
184
184
  DatagridPagination: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
185
185
  CustomizeColumnsTearsheet: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
186
186
  isFetching: PropTypes.bool,
187
+ skeletonRowCount: PropTypes.number,
187
188
  fullHeightDatagrid: PropTypes.bool,
188
189
  filterProps: PropTypes.object,
189
190
  variableRowHeight: PropTypes.bool,
@@ -1,6 +1,6 @@
1
1
  export default useSkeletons;
2
2
  /**
3
- * Copyright IBM Corp. 2020, 2023
3
+ * Copyright IBM Corp. 2020, 2024
4
4
  *
5
5
  * This source code is licensed under the Apache-2.0 license found in the
6
6
  * LICENSE file in the root directory of this source tree.
@@ -8,7 +8,7 @@
8
8
  import { toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
 
10
10
  /**
11
- * Copyright IBM Corp. 2020, 2023
11
+ * Copyright IBM Corp. 2020, 2024
12
12
  *
13
13
  * This source code is licensed under the Apache-2.0 license found in the
14
14
  * LICENSE file in the root directory of this source tree.
@@ -17,7 +17,11 @@ import { toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupP
17
17
  var useSkeletons = function useSkeletons(hooks) {
18
18
  var useInstance = function useInstance(instance) {
19
19
  var isFetching = instance.isFetching,
20
- rows = instance.rows;
20
+ rows = instance.rows,
21
+ skeletonRowCount = instance.skeletonRowCount;
22
+ if (isFetching && skeletonRowCount === 0) {
23
+ throw new Error('skeletonRowCount cannot be set to 0, if isFetching is true');
24
+ }
21
25
  var skeletonRow = function skeletonRow(id) {
22
26
  return {
23
27
  isSkeleton: true,
@@ -25,7 +29,11 @@ var useSkeletons = function useSkeletons(hooks) {
25
29
  id: id
26
30
  };
27
31
  };
28
- var rowsWithSkeletons = [].concat(_toConsumableArray(rows), [skeletonRow('skeleton-row-1'), skeletonRow('skeleton-row-2'), skeletonRow('skeleton-row-3')]);
32
+ var rowsWithSkeletons = [].concat(_toConsumableArray(rows), _toConsumableArray(Array.from({
33
+ length: skeletonRowCount || 3
34
+ }, function (_, index) {
35
+ return skeletonRow("skeleton-row-".concat(index + 1));
36
+ })));
29
37
  Object.assign(instance, {
30
38
  rows: isFetching ? rowsWithSkeletons : rows
31
39
  });
@@ -14,6 +14,7 @@ export namespace DatagridContent {
14
14
  DatagridPagination: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
15
15
  CustomizeColumnsTearsheet: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
16
16
  isFetching: PropTypes.Requireable<boolean>;
17
+ skeletonRowCount: PropTypes.Requireable<number>;
17
18
  fullHeightDatagrid: PropTypes.Requireable<boolean>;
18
19
  filterProps: PropTypes.Requireable<object>;
19
20
  variableRowHeight: PropTypes.Requireable<boolean>;
@@ -193,6 +193,7 @@ DatagridContent.propTypes = {
193
193
  DatagridPagination: index["default"].oneOfType([index["default"].element, index["default"].func]),
194
194
  CustomizeColumnsTearsheet: index["default"].oneOfType([index["default"].element, index["default"].func]),
195
195
  isFetching: index["default"].bool,
196
+ skeletonRowCount: index["default"].number,
196
197
  fullHeightDatagrid: index["default"].bool,
197
198
  filterProps: index["default"].object,
198
199
  variableRowHeight: index["default"].bool,
@@ -1,6 +1,6 @@
1
1
  export default useSkeletons;
2
2
  /**
3
- * Copyright IBM Corp. 2020, 2023
3
+ * Copyright IBM Corp. 2020, 2024
4
4
  *
5
5
  * This source code is licensed under the Apache-2.0 license found in the
6
6
  * LICENSE file in the root directory of this source tree.
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
13
 
14
14
  /**
15
- * Copyright IBM Corp. 2020, 2023
15
+ * Copyright IBM Corp. 2020, 2024
16
16
  *
17
17
  * This source code is licensed under the Apache-2.0 license found in the
18
18
  * LICENSE file in the root directory of this source tree.
@@ -21,7 +21,11 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
21
21
  var useSkeletons = function useSkeletons(hooks) {
22
22
  var useInstance = function useInstance(instance) {
23
23
  var isFetching = instance.isFetching,
24
- rows = instance.rows;
24
+ rows = instance.rows,
25
+ skeletonRowCount = instance.skeletonRowCount;
26
+ if (isFetching && skeletonRowCount === 0) {
27
+ throw new Error('skeletonRowCount cannot be set to 0, if isFetching is true');
28
+ }
25
29
  var skeletonRow = function skeletonRow(id) {
26
30
  return {
27
31
  isSkeleton: true,
@@ -29,7 +33,11 @@ var useSkeletons = function useSkeletons(hooks) {
29
33
  id: id
30
34
  };
31
35
  };
32
- var rowsWithSkeletons = [].concat(_rollupPluginBabelHelpers.toConsumableArray(rows), [skeletonRow('skeleton-row-1'), skeletonRow('skeleton-row-2'), skeletonRow('skeleton-row-3')]);
36
+ var rowsWithSkeletons = [].concat(_rollupPluginBabelHelpers.toConsumableArray(rows), _rollupPluginBabelHelpers.toConsumableArray(Array.from({
37
+ length: skeletonRowCount || 3
38
+ }, function (_, index) {
39
+ return skeletonRow("skeleton-row-".concat(index + 1));
40
+ })));
33
41
  Object.assign(instance, {
34
42
  rows: isFetching ? rowsWithSkeletons : rows
35
43
  });
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": "2.37.0",
4
+ "version": "2.38.0-alpha.5+70e9c92e4",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -48,6 +48,7 @@
48
48
  "clean": "rimraf es lib css scss",
49
49
  "generate": "cross-env FORCE_COLOR=1 node scripts/generate",
50
50
  "postinstall": "ibmtelemetry --config=telemetry.yml",
51
+ "telemetry-config": "ibmtelemetry-config --id 495342db-5046-4ecf-85ea-9ffceb6f8cdf --endpoint https://collector-prod.1am6wm210aow.us-south.codeengine.appdomain.cloud/v1/metrics --files ./src/components/**/*.(tsx|js|jsx)",
51
52
  "test": "jest --colors",
52
53
  "//upgrade-dependencies": "# don't upgrade carbon (done globally), react/react-dom (explicit range peer dependency), chalk (issue #1596)",
53
54
  "upgrade-dependencies": "npm-check-updates -u --dep dev,peer,prod --color --reject '/(carbon|^react$|^react-dom$|^chalk$|^namor)/'"
@@ -62,6 +63,7 @@
62
63
  "@babel/preset-env": "^7.23.9",
63
64
  "@babel/preset-react": "^7.23.3",
64
65
  "@babel/preset-typescript": "^7.21.5",
66
+ "@ibm/telemetry-js-config-generator": "^1.0.3",
65
67
  "@rollup/plugin-babel": "^6.0.0",
66
68
  "@rollup/plugin-commonjs": "^25.0.0",
67
69
  "@rollup/plugin-node-resolve": "^15.0.0",
@@ -114,5 +116,5 @@
114
116
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
115
117
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
116
118
  },
117
- "gitHead": "c2a0c5dcbee48c0da2a211c09e2a505fd39e7203"
119
+ "gitHead": "70e9c92e41968c9840e77d15e721193d085d50a1"
118
120
  }