@carbon/ibm-products 1.46.0 → 1.46.2

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.
Files changed (39) hide show
  1. package/README.md +17 -0
  2. package/css/index-full-carbon.css +40 -12
  3. package/css/index-full-carbon.css.map +1 -1
  4. package/css/index-full-carbon.min.css +4 -2
  5. package/css/index-full-carbon.min.css.map +1 -1
  6. package/css/index-without-carbon.css +40 -12
  7. package/css/index-without-carbon.css.map +1 -1
  8. package/css/index-without-carbon.min.css +4 -2
  9. package/css/index-without-carbon.min.css.map +1 -1
  10. package/css/index.css +40 -12
  11. package/css/index.css.map +1 -1
  12. package/css/index.min.css +4 -2
  13. package/css/index.min.css.map +1 -1
  14. package/es/components/Card/CardFooter.js +2 -2
  15. package/es/components/Datagrid/Datagrid/DatagridRow.js +37 -10
  16. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +18 -4
  17. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +15 -2
  18. package/es/components/Datagrid/useActionsColumn.js +22 -1
  19. package/es/components/Datagrid/useDefaultStringRenderer.js +1 -1
  20. package/es/components/Datagrid/useNestedRows.js +2 -4
  21. package/es/components/Datagrid/useSelectAllToggle.js +16 -2
  22. package/es/components/Datagrid/useSelectRows.js +17 -3
  23. package/es/components/Datagrid/useStickyColumn.js +19 -5
  24. package/lib/components/Card/CardFooter.js +2 -2
  25. package/lib/components/Datagrid/Datagrid/DatagridRow.js +37 -10
  26. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +20 -3
  27. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +14 -1
  28. package/lib/components/Datagrid/useActionsColumn.js +22 -1
  29. package/lib/components/Datagrid/useDefaultStringRenderer.js +1 -1
  30. package/lib/components/Datagrid/useNestedRows.js +2 -4
  31. package/lib/components/Datagrid/useSelectAllToggle.js +19 -2
  32. package/lib/components/Datagrid/useSelectRows.js +19 -2
  33. package/lib/components/Datagrid/useStickyColumn.js +18 -4
  34. package/package.json +2 -2
  35. package/scss/components/Datagrid/styles/_datagrid.scss +24 -7
  36. package/scss/components/Datagrid/styles/_useNestedRows.scss +17 -0
  37. package/scss/components/Datagrid/styles/_useSelectAllToggle.scss +11 -8
  38. package/scss/components/Datagrid/styles/_useStickyColumn.scss +3 -3
  39. package/scss/components/OptionsTile/_options-tile.scss +8 -1
@@ -1,21 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- var _react = _interopRequireDefault(require("react"));
14
+ var _react = _interopRequireWildcard(require("react"));
13
15
  var _classnames = _interopRequireDefault(require("classnames"));
14
16
  var _carbonComponentsReact = require("carbon-components-react");
15
17
  var _DatagridSelectAll = require("./Datagrid/DatagridSelectAll");
16
18
  var _commonColumnIds = require("./common-column-ids");
17
19
  var _settings = require("../../settings");
18
20
  var _excluded = ["onChange"];
21
+ 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); }
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
23
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
24
  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) { (0, _defineProperty2.default)(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; }
21
25
  var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
@@ -71,6 +75,19 @@ var SelectRow = function SelectRow(datagridState) {
71
75
  onRadioSelect = datagridState.onRadioSelect,
72
76
  columns = datagridState.columns,
73
77
  withStickyColumn = datagridState.withStickyColumn;
78
+ var _useState = (0, _react.useState)(window.innerWidth),
79
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
80
+ windowSize = _useState2[0],
81
+ setWindowSize = _useState2[1];
82
+ (0, _react.useLayoutEffect)(function () {
83
+ function updateSize() {
84
+ setWindowSize(window.innerWidth);
85
+ }
86
+ window.addEventListener('resize', updateSize);
87
+ return function () {
88
+ return window.removeEventListener('resize', updateSize);
89
+ };
90
+ }, []);
74
91
  var selectDisabled = isFetching || row.getRowProps().selectDisabled;
75
92
  var _row$getToggleRowSele = row.getToggleRowSelectedProps(),
76
93
  onChange = _row$getToggleRowSele.onChange,
@@ -91,7 +108,7 @@ var SelectRow = function SelectRow(datagridState) {
91
108
  },
92
109
  id: "".concat(tableId, "-").concat(row.index),
93
110
  name: "".concat(tableId, "-").concat(row.index, "-name"),
94
- className: (0, _classnames.default)("".concat(blockClass, "__checkbox-cell"), cellProps.className, (0, _defineProperty2.default)({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), isFirstColumnStickyLeft)),
111
+ className: (0, _classnames.default)("".concat(blockClass, "__checkbox-cell"), cellProps.className, (0, _defineProperty2.default)({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)),
95
112
  ariaLabel: "".concat(tableId, "-row-").concat(row.index) // TODO: aria label should be i18n'ed
96
113
  ,
97
114
  disabled: selectDisabled
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _react = require("react");
10
11
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
11
12
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -19,8 +20,21 @@ var OFFSET_SCROLL_CLASS = "".concat(styleClassPrefix, "-offset-scroll");
19
20
  var useStickyColumn = function useStickyColumn(hooks) {
20
21
  var tableBodyRef = (0, _react.useRef)();
21
22
  var stickyHeaderCellRef = (0, _react.useRef)();
22
- hooks.getCellProps.push(changeProps.bind(null, 'cell', null));
23
- hooks.getHeaderProps.push(changeProps.bind(null, 'header', stickyHeaderCellRef));
23
+ var _useState = (0, _react.useState)(window.innerWidth),
24
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
25
+ windowSize = _useState2[0],
26
+ setWindowSize = _useState2[1];
27
+ (0, _react.useLayoutEffect)(function () {
28
+ function updateSize() {
29
+ setWindowSize(window.innerWidth);
30
+ }
31
+ window.addEventListener('resize', updateSize);
32
+ return function () {
33
+ return window.removeEventListener('resize', updateSize);
34
+ };
35
+ }, []);
36
+ hooks.getCellProps.push(changeProps.bind(null, 'cell', null, windowSize));
37
+ hooks.getHeaderProps.push(changeProps.bind(null, 'header', stickyHeaderCellRef, windowSize));
24
38
  hooks.getTableBodyProps.push(addTableBodyProps.bind(null, tableBodyRef));
25
39
  hooks.getHeaderGroupProps.push(function (props) {
26
40
  return [props, {
@@ -114,7 +128,7 @@ var addTableBodyProps = function addTableBodyProps(tableBodyRef, props) {
114
128
  ref: tableBodyRef
115
129
  }];
116
130
  };
117
- var changeProps = function changeProps(elementName, headerCellRef, props, data) {
131
+ var changeProps = function changeProps(elementName, headerCellRef, windowSize, props, data) {
118
132
  var column = data.column || data.cell.column;
119
133
  if (column.sticky === 'right') {
120
134
  var _cx;
@@ -127,7 +141,7 @@ var changeProps = function changeProps(elementName, headerCellRef, props, data)
127
141
  if (column.sticky === 'left') {
128
142
  var _data$instance, _cx2;
129
143
  return [props, _objectSpread({
130
- className: (0, _classnames.default)((_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), true), (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), data === null || data === void 0 ? void 0 : (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows), _cx2))
144
+ className: (0, _classnames.default)((_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), true && windowSize > 671), (0, _defineProperty2.default)(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 ? void 0 : (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize > 671), _cx2))
131
145
  }, headerCellRef && {
132
146
  ref: headerCellRef
133
147
  })];
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.46.0",
4
+ "version": "1.46.2",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -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": "ff776c9f98e52d84bf0f50a60bb113e3d6f64c10"
98
+ "gitHead": "3ea7d485b3cc004a95bf621a26727847329391a3"
99
99
  }
@@ -35,6 +35,7 @@
35
35
  align-items: center;
36
36
  color: $text-01;
37
37
  }
38
+
38
39
  .#{$block-class}__head-select-all.#{$block-class}__checkbox-cell.#{$block-class}__checkbox-cell-sticky-left {
39
40
  position: sticky;
40
41
  z-index: 1;
@@ -46,6 +47,7 @@
46
47
  align-items: center;
47
48
  padding-top: 0;
48
49
  padding-bottom: 0;
50
+
49
51
  &.#{$block-class}__cell--spacer {
50
52
  padding: 0;
51
53
  }
@@ -61,6 +63,7 @@
61
63
  align-items: center;
62
64
  padding-top: 0;
63
65
  }
66
+
64
67
  &.#{$block-class}__checkbox-cell-sticky-left {
65
68
  position: sticky;
66
69
  left: 0;
@@ -146,6 +149,7 @@
146
149
  }
147
150
  }
148
151
  }
152
+
149
153
  .#{$block-class}__grid-container::-webkit-scrollbar-thumb {
150
154
  background-color: $text-03;
151
155
  }
@@ -154,6 +158,7 @@
154
158
  width: 6px;
155
159
  background-color: $ui-background;
156
160
  }
161
+
157
162
  .#{$block-class}__grid-container {
158
163
  display: block;
159
164
  width: 100%;
@@ -246,7 +251,9 @@
246
251
  td.#{$carbon-prefix}--table-column-checkbox,
247
252
  th.#{$carbon-prefix}--table-column-checkbox {
248
253
  /* stylelint-disable-next-line declaration-no-important */
249
- padding-right: $spacing-06 !important;
254
+ width: $spacing-09 !important;
255
+ /* stylelint-disable-next-line declaration-no-important */
256
+ padding-right: $spacing-05 !important;
250
257
  }
251
258
  }
252
259
 
@@ -318,7 +325,8 @@
318
325
  }
319
326
 
320
327
  .#{$block-class}__head-hidden-select-all {
321
- padding-right: $spacing-08;
328
+ padding-right: $spacing-09;
329
+
322
330
  &.#{$block-class}__select-all-sticky-left {
323
331
  position: sticky;
324
332
  z-index: 1;
@@ -360,6 +368,14 @@
360
368
  width: 100% !important;
361
369
  }
362
370
 
371
+ .#{$block-class}__sticky thead {
372
+ display: flex;
373
+
374
+ tr.#{$block-class}__sticky {
375
+ width: auto;
376
+ }
377
+ }
378
+
363
379
  .#{block-class}__displayFlex {
364
380
  position: relative;
365
381
  display: flex;
@@ -417,6 +433,7 @@
417
433
 
418
434
  .#{$block-class}__carbon-row-expanded {
419
435
  position: relative;
436
+
420
437
  &.#{$block-class}__carbon-row-expanded-hover-active::before {
421
438
  position: absolute;
422
439
  z-index: 2;
@@ -428,7 +445,7 @@
428
445
  );
429
446
  width: 1px;
430
447
  height: var(--#{$block-class}--indicator-height);
431
- border-left: 1px solid $interactive-01;
448
+ border-left: 1px solid $active-ui;
432
449
  content: '';
433
450
  }
434
451
  }
@@ -447,8 +464,11 @@
447
464
  }
448
465
 
449
466
  .#{$block-class}__table-toolbar {
467
+ display: flex;
450
468
  flex: 1 0 auto;
469
+ align-items: flex-end;
451
470
  }
471
+
452
472
  .#{$carbon-prefix}--table-toolbar {
453
473
  background: transparent;
454
474
  }
@@ -457,10 +477,6 @@
457
477
  flex: 1 1 100%;
458
478
  }
459
479
 
460
- .#{$carbon-prefix}--table-toolbar {
461
- padding-top: $spacing-07;
462
- }
463
-
464
480
  .#{$block-class}__toolbar-divider {
465
481
  position: relative;
466
482
  }
@@ -527,6 +543,7 @@
527
543
  justify-content: center;
528
544
  padding: 0;
529
545
  margin: 0;
546
+
530
547
  .#{$carbon-prefix}--btn__icon {
531
548
  margin: 0;
532
549
  }
@@ -46,3 +46,20 @@
46
46
  background-color: $border-subtle;
47
47
  content: '';
48
48
  }
49
+
50
+ .#{$block-class} tr.#{$block-class}__carbon-nested-row {
51
+ td:first-child:empty,
52
+ .#{$block-class}__expandable-row-cell {
53
+ border-bottom: none;
54
+ }
55
+ }
56
+
57
+ .#{$carbon-prefix}--data-table td.#{$block-class}__expandable-row-cell {
58
+ padding-left: $spacing-03;
59
+ }
60
+
61
+ .#{$block-class}__carbon-row-expanded {
62
+ .#{$block-class}__expandable-row-cell {
63
+ border-bottom: none;
64
+ }
65
+ }
@@ -8,15 +8,18 @@
8
8
 
9
9
  @import './variables';
10
10
 
11
- th.#{$block-class}__select-all-toggle-on,
12
- td.#{$block-class}__select-all-toggle-on {
13
- /* stylelint-disable-next-line declaration-no-important */
14
- width: 4.5rem !important;
15
- /* stylelint-disable-next-line declaration-no-important */
16
- min-width: initial !important;
17
- box-sizing: border-box;
18
- flex: 0 0 auto;
11
+ .#{$block-class}__grid-container {
12
+ th.#{$block-class}__select-all-toggle-on,
13
+ td.#{$block-class}__select-all-toggle-on {
14
+ /* stylelint-disable-next-line declaration-no-important */
15
+ width: 4.5rem !important;
16
+ /* stylelint-disable-next-line declaration-no-important */
17
+ min-width: initial !important;
18
+ box-sizing: border-box;
19
+ flex: 0 0 auto;
20
+ }
19
21
  }
22
+
20
23
  th.#{$block-class}__select-all-toggle-on {
21
24
  display: flex;
22
25
  align-items: center;
@@ -14,7 +14,7 @@
14
14
  right: 0;
15
15
  display: flex;
16
16
  align-items: center;
17
- border-left: 1px solid $ui-03;
17
+ border-left: 1px solid $active-light-ui;
18
18
  }
19
19
 
20
20
  .#{$block-class}__right-sticky-column-header {
@@ -29,7 +29,7 @@
29
29
  left: 0;
30
30
  display: flex;
31
31
  align-items: center;
32
- border-right: 1px solid $ui-03;
32
+ border-right: 1px solid $active-light-ui;
33
33
  }
34
34
 
35
35
  .#{$block-class}__left-sticky-column-header {
@@ -41,7 +41,7 @@
41
41
 
42
42
  .#{$block-class}__left-sticky-column-cell.#{$block-class}__left-sticky-column-cell--with-extra-select-column,
43
43
  .#{$block-class}__left-sticky-column-header.#{$block-class}__left-sticky-column-header--with-extra-select-column {
44
- left: $spacing-08;
44
+ left: $spacing-09;
45
45
  }
46
46
 
47
47
  .#{$block-class}__sticky-noShadow {
@@ -23,12 +23,19 @@
23
23
  $block-class: #{$pkg-prefix}--options-tile;
24
24
 
25
25
  .#{$block-class} {
26
+ position: relative;
26
27
  border-bottom: 1px solid $ui-03;
27
28
  background-color: $ui-01;
28
29
  }
29
30
 
30
31
  .#{$block-class}__toggle-container {
31
- position: relative;
32
+ position: absolute;
33
+ top: 0;
34
+ right: 0;
35
+ bottom: 0;
36
+ width: calc(
37
+ #{$spacing-05} + 2rem + #{$spacing-05}
38
+ ); // spacing + toggle width + spacing
32
39
  }
33
40
 
34
41
  .#{$block-class}__toggle {