@carbon/ibm-products 2.42.1-canary.7 → 2.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/css/index-full-carbon.css +302 -9
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +302 -9
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +302 -9
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +6 -0
  14. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +74 -33
  15. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
  16. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +95 -12
  17. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
  18. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +27 -9
  19. package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +38 -33
  20. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
  21. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +44 -0
  22. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
  23. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +95 -14
  24. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  25. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
  26. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
  27. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
  28. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
  29. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +197 -67
  30. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
  31. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +69 -0
  32. package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
  33. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  34. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
  35. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
  36. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
  37. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
  38. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
  39. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -2
  40. package/es/components/Datagrid/types/index.d.ts +2 -0
  41. package/es/components/Datagrid/useColumnOrder.d.ts +7 -1
  42. package/es/components/Datagrid/useFiltering.d.ts +8 -1
  43. package/es/components/Datagrid/useFiltering.js +8 -7
  44. package/es/components/Datagrid/useFlexResize.d.ts +1 -1
  45. package/es/components/Datagrid/useFlexResize.js +11 -11
  46. package/es/components/Datagrid/useNestedRows.js +24 -2
  47. package/es/components/Datagrid/useOnRowClick.d.ts +8 -1
  48. package/es/components/Datagrid/useOnRowClick.js +2 -1
  49. package/es/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
  50. package/es/components/Datagrid/useRowIsMouseOver.js +1 -1
  51. package/es/components/Datagrid/useSelectRows.d.ts +8 -1
  52. package/es/components/Datagrid/useSelectRows.js +3 -2
  53. package/es/components/Datagrid/useSortableColumns.d.ts +10 -3
  54. package/es/components/Datagrid/useSortableColumns.js +3 -2
  55. package/es/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
  56. package/es/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
  57. package/es/components/SidePanel/SidePanel.js +4 -2
  58. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +6 -0
  59. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +73 -32
  60. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
  61. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +92 -9
  62. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
  63. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +26 -8
  64. package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +36 -31
  65. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
  66. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +52 -0
  67. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
  68. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +92 -11
  69. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  70. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
  71. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
  72. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
  73. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
  74. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +195 -64
  75. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
  76. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +77 -0
  77. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
  78. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  79. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
  80. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
  81. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
  82. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
  83. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
  84. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -2
  85. package/lib/components/Datagrid/types/index.d.ts +2 -0
  86. package/lib/components/Datagrid/useColumnOrder.d.ts +7 -1
  87. package/lib/components/Datagrid/useFiltering.d.ts +8 -1
  88. package/lib/components/Datagrid/useFiltering.js +8 -7
  89. package/lib/components/Datagrid/useFlexResize.d.ts +1 -1
  90. package/lib/components/Datagrid/useFlexResize.js +11 -11
  91. package/lib/components/Datagrid/useNestedRows.js +24 -2
  92. package/lib/components/Datagrid/useOnRowClick.d.ts +8 -1
  93. package/lib/components/Datagrid/useOnRowClick.js +2 -1
  94. package/lib/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
  95. package/lib/components/Datagrid/useRowIsMouseOver.js +1 -1
  96. package/lib/components/Datagrid/useSelectRows.d.ts +8 -1
  97. package/lib/components/Datagrid/useSelectRows.js +3 -2
  98. package/lib/components/Datagrid/useSortableColumns.d.ts +10 -3
  99. package/lib/components/Datagrid/useSortableColumns.js +3 -2
  100. package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
  101. package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
  102. package/lib/components/SidePanel/SidePanel.js +4 -2
  103. package/package.json +3 -3
  104. package/scss/components/ConditionBuilder/_condition-builder.scss +21 -1
  105. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +22 -3
  106. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +58 -21
  107. package/telemetry.yml +23 -0
  108. /package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
  109. /package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
@@ -194,7 +194,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
194
194
  headerProps = _rollupPluginBabelHelpers["extends"]({}, (_rollupPluginBabelHelpers.objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
195
195
  var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
196
196
  return /*#__PURE__*/React__default["default"].createElement(react.TableHeader, _rollupPluginBabelHelpers["extends"]({}, headerProps, {
197
- className: cx__default["default"](header === null || header === void 0 ? void 0 : header.className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default["default"].isValidElement(header === null || header === void 0 ? void 0 : header.slug))),
197
+ className: cx__default["default"](header === null || header === void 0 ? void 0 : header.className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default["default"].isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
198
198
  key: header.id,
199
199
  "aria-hidden": header.id === 'spacer' && 'true'
200
200
  }, getAccessibilityProps(header)), header.render('Header'), renderSlug(header.slug), resizerProps && !header.isAction && /*#__PURE__*/React__default["default"].createElement(ResizeHeader, {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2020, 2023
2
+ * Copyright IBM Corp. 2020, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -15,7 +15,6 @@ var reactWindow = require('react-window');
15
15
  var react = require('@carbon/react');
16
16
  var settings = require('../../../settings.js');
17
17
  var DatagridHead = require('./DatagridHead.js');
18
- var layout = require('@carbon/layout');
19
18
  var useResizeObserver = require('../../../global/js/hooks/useResizeObserver.js');
20
19
 
21
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -80,10 +79,6 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
80
79
  if (headWrapEl) {
81
80
  headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
82
81
  }
83
- var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
84
- if (spacerColumn) {
85
- spacerColumn.style.width = layout.px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
86
- }
87
82
  }
88
83
  var testRefValue = testRef === null || testRef === void 0 ? void 0 : testRef.current;
89
84
  testRefValue === null || testRefValue === void 0 || testRefValue.addEventListener('scroll', handleScroll);
@@ -82,7 +82,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
82
82
  };
83
83
  var onCheckboxCheck = function onCheckboxCheck(col, value) {
84
84
  var changedDefinitions = columnObjects.map(function (definition) {
85
- if (Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) {
85
+ if ((Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) && definition.canFilter && !definition.disabled) {
86
86
  return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, definition), {}, {
87
87
  isVisible: value
88
88
  });
@@ -106,9 +106,12 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
106
106
  React.useEffect(function () {
107
107
  var notFilterableCount = columnObjects.filter(function (col) {
108
108
  return !col.canFilter;
109
- });
110
- setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount.length);
111
- setTotalColumns(columnObjects.length - notFilterableCount.length);
109
+ }).length;
110
+ var actionCount = columnObjects.filter(function (col) {
111
+ return col.id === 'actions';
112
+ }).length;
113
+ setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount - actionCount);
114
+ setTotalColumns(columnObjects.length - notFilterableCount - actionCount);
112
115
  }, [getVisibleColumnsCount, columnObjects]);
113
116
  return /*#__PURE__*/React__default["default"].createElement(TearsheetNarrow.TearsheetNarrow, {
114
117
  className: "".concat(blockClass, "__customize-columns-tearsheet"),
@@ -1,2 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2024
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
+ */
7
+ declare const useFilterContext: () => any;
1
8
  export default useFilterContext;
2
- declare function useFilterContext(): any;
@@ -20,6 +20,7 @@ export namespace InlineEditCell {
20
20
  rows: PropTypes.Requireable<(object | null | undefined)[]>;
21
21
  rowSize: PropTypes.Requireable<string>;
22
22
  tableId: PropTypes.Requireable<string>;
23
+ cellEditing: PropTypes.Requireable<object>;
23
24
  }>>;
24
25
  let nonEditCell: PropTypes.Requireable<boolean>;
25
26
  let placeholder: PropTypes.Requireable<string>;
@@ -45,7 +45,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
45
45
  var columnIndex = instance.columns.findIndex(function (col) {
46
46
  return col.id === columnId;
47
47
  });
48
- var cellId = "column-".concat(columnIndex, "-row-").concat(cell.row.index);
48
+ var rowIndex = cell.row.index;
49
+ var cellId = "column-".concat(columnIndex, "-row-").concat(rowIndex);
49
50
  var _useContext = React.useContext(InlineEditContext.InlineEditContext),
50
51
  state = _useContext.state,
51
52
  dispatch = _useContext.dispatch;
@@ -81,6 +82,14 @@ var InlineEditCell = function InlineEditCell(_ref) {
81
82
  var rowSize = instance.rowSize,
82
83
  onDataUpdate = instance.onDataUpdate;
83
84
  var saveCellData;
85
+ if (inEditMode) {
86
+ instance.cellEditing = {
87
+ cellId: cellId,
88
+ columnIndex: columnIndex,
89
+ rowIndex: rowIndex,
90
+ curCellValue: cellValue
91
+ };
92
+ }
84
93
  React.useEffect(function () {
85
94
  setInitialValue(value);
86
95
  var columnId = cell.column.id;
@@ -478,7 +487,8 @@ InlineEditCell.propTypes = {
478
487
  onDataUpdate: index["default"].func,
479
488
  rows: index["default"].arrayOf(index["default"].object),
480
489
  rowSize: index["default"].string,
481
- tableId: index["default"].string
490
+ tableId: index["default"].string,
491
+ cellEditing: index["default"].object
482
492
  }),
483
493
  nonEditCell: index["default"].bool,
484
494
  placeholder: index["default"].string,
@@ -192,6 +192,8 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
192
192
  onVirtualScroll?: (evt?: boolean) => void;
193
193
  fetchMoreData?: () => void;
194
194
  loadMoreThreshold?: number;
195
+ onRowClick?: (row: any, event: any) => void;
196
+ onSort?: boolean;
195
197
  }
196
198
  export interface ResizeHeaderProps {
197
199
  resizerProps?: ResizerProps;
@@ -1,2 +1,8 @@
1
- export default useColumnOrder;
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
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
+ */
2
7
  import { useColumnOrder } from 'react-table';
8
+ export default useColumnOrder;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2024
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
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useFiltering: (hooks: Hooks) => void;
1
9
  export default useFiltering;
2
- declare function useFiltering(hooks: any): void;
@@ -67,12 +67,13 @@ var useFiltering = function useFiltering(hooks) {
67
67
  });
68
68
  }, []);
69
69
  hooks.useInstance.push(function (instance) {
70
- var filterProps = instance.filterProps,
71
- setAllFilters = instance.setAllFilters,
72
- setFilter = instance.setFilter,
73
- headers = instance.headers,
74
- data = instance.data,
75
- state = instance.state;
70
+ var _ref4 = instance,
71
+ filterProps = _ref4.filterProps,
72
+ setAllFilters = _ref4.setAllFilters,
73
+ setFilter = _ref4.setFilter,
74
+ headers = _ref4.headers,
75
+ data = _ref4.data,
76
+ state = _ref4.state;
76
77
  var defaultProps = {
77
78
  variation: 'flyout',
78
79
  updateMethod: constants.BATCH,
@@ -88,7 +89,7 @@ var useFiltering = function useFiltering(hooks) {
88
89
  });
89
90
  };
90
91
  Object.assign(instance, {
91
- filterProps: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, defaultProps), instance.filterProps),
92
+ filterProps: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, defaultProps), instance === null || instance === void 0 ? void 0 : instance.filterProps),
92
93
  filterTypes: filterTypes,
93
94
  getFilterFlyoutProps: getFilterFlyoutProps,
94
95
  FilterFlyout: FilterFlyout["default"]
@@ -1,6 +1,6 @@
1
1
  export default useFlexResize;
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.
@@ -11,31 +11,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
13
 
14
+ /* eslint-disable no-unreachable */
14
15
  /**
15
- * Copyright IBM Corp. 2020, 2023
16
+ * Copyright IBM Corp. 2020, 2024
16
17
  *
17
18
  * This source code is licensed under the Apache-2.0 license found in the
18
19
  * LICENSE file in the root directory of this source tree.
19
20
  */
20
21
 
21
22
  var useFlexResize = function useFlexResize(hooks) {
22
- var spacer = {
23
- id: 'spacer',
24
- width: 0,
25
- disableSortBy: true,
26
- disableResizing: true
27
- };
28
23
  hooks.visibleColumns.push(function (columns) {
29
- // always move actions and spacer to the end
24
+ // always move actions to the end
30
25
  var actionsIdx = columns.findIndex(function (col) {
31
26
  return col.isAction;
32
27
  });
33
28
  if (actionsIdx === -1) {
34
- return [].concat(_rollupPluginBabelHelpers.toConsumableArray(columns), [spacer]);
29
+ var _lastCol = columns.at(-1);
30
+ _lastCol.isFlexCol = true;
31
+ return _rollupPluginBabelHelpers.toConsumableArray(columns);
35
32
  }
36
33
  var cols = _rollupPluginBabelHelpers.toConsumableArray(columns);
37
34
  var actions = cols.splice(actionsIdx, 1)[0];
38
- cols.splice(columns.length, 0, spacer, actions);
35
+ cols.splice(columns.length, 0, actions);
36
+ // the last non-action action column should flex remaining space
37
+ var lastCol = columns.at(-2);
38
+ lastCol.isFlexCol = true;
39
39
  return cols;
40
40
  });
41
41
  var changeProps = function changeProps(props, data) {
@@ -43,7 +43,7 @@ var useFlexResize = function useFlexResize(hooks) {
43
43
  if (!column && data.cell) {
44
44
  column = data.cell.column;
45
45
  }
46
- if (column.id === spacer.id) {
46
+ if (column.isFlexCol) {
47
47
  return [props, {
48
48
  style: {
49
49
  flex: '1 1 0'
@@ -23,6 +23,23 @@ var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
23
23
  var useNestedRows = function useNestedRows(hooks) {
24
24
  useNestedRowExpander["default"](hooks);
25
25
  var useInstance = function useInstance(instance) {
26
+ React.useEffect(function () {
27
+ var rows = instance.rows;
28
+ var defaultExpandedRows = rows.filter(function (row) {
29
+ var _row$original;
30
+ return row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.defaultExpanded;
31
+ });
32
+ if (defaultExpandedRows !== null && defaultExpandedRows !== void 0 && defaultExpandedRows.length) {
33
+ defaultExpandedRows.map(function (defaultExpandedRow) {
34
+ if (!defaultExpandedRow.isExpanded && !defaultExpandedRow.hasExpanded) {
35
+ var _defaultExpandedRow$t;
36
+ defaultExpandedRow === null || defaultExpandedRow === void 0 || (_defaultExpandedRow$t = defaultExpandedRow.toggleRowExpanded) === null || _defaultExpandedRow$t === void 0 || _defaultExpandedRow$t.call(defaultExpandedRow);
37
+ defaultExpandedRow.hasExpanded = true;
38
+ return;
39
+ }
40
+ });
41
+ }
42
+ }, [instance, instance.rows]);
26
43
  // This useEffect will expand rows if they exist in the initialState obj
27
44
  React.useEffect(function () {
28
45
  var rows = instance.rows,
@@ -54,16 +71,21 @@ var useNestedRows = function useNestedRows(hooks) {
54
71
  }
55
72
  }];
56
73
  };
74
+ var getIndentation = function getIndentation(depth) {
75
+ return 32 * depth + 16;
76
+ }; // row indentation padding
57
77
  var getCellProps = function getCellProps(props, _ref3) {
58
78
  var cell = _ref3.cell,
59
79
  instance = _ref3.instance;
60
- // reduce the "first cell"s width to compensate added (left) margin
80
+ // we add a dynamic -ve margin right only if the cell is resized below minimum width i.e 50px, else we set the width based on indentation at different levels
61
81
  var isFirstCell = instance.columns.findIndex(function (c) {
62
82
  return c.id === cell.column.id;
63
83
  }) === 0;
64
84
  return [props, {
65
85
  style: {
66
- marginRight: "".concat(isFirstCell && cell.row.depth > 0 ? "".concat(-32 * cell.row.depth - 18, "px") : '')
86
+ marginRight: isFirstCell && cell.row.depth > 0 && parseInt(props.style.width, 10) <= getIndentation(cell.row.depth) + 50 // indentation padding + expander cell or empty cell width
87
+ ? "".concat(parseInt(props.style.width, 10) - (getIndentation(cell.row.depth) + 50), "px") : '',
88
+ width: isFirstCell && cell.row.depth > 0 ? parseInt(props.style.width, 10) - getIndentation(cell.row.depth) : props.style.width
67
89
  }
68
90
  }];
69
91
  };
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useOnRowClick: (hooks: Hooks) => void;
1
9
  export default useOnRowClick;
2
- declare function useOnRowClick(hooks: any): void;
@@ -13,7 +13,8 @@ var settings = require('../../settings.js');
13
13
 
14
14
  var useOnRowClick = function useOnRowClick(hooks) {
15
15
  var useInstance = function useInstance(rowInstance) {
16
- var onRowClick = rowInstance.onRowClick;
16
+ var _ref = rowInstance,
17
+ onRowClick = _ref.onRowClick;
17
18
  var getRowProps = function getRowProps(props, datagridState) {
18
19
  var isFetching = datagridState.isFetching,
19
20
  row = datagridState.row,
@@ -1,2 +1,3 @@
1
+ import { Hooks } from 'react-table';
2
+ declare const useRowIsMouseOver: (hooks: Hooks) => void;
1
3
  export default useRowIsMouseOver;
2
- declare function useRowIsMouseOver(hooks: any): void;
@@ -25,7 +25,7 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
25
25
  setMouseOverRowIndex = _useState2[1];
26
26
  var onMouseChange = useDebounce(function (datagridState) {
27
27
  var row = datagridState.row;
28
- setMouseOverRowIndex(row.index);
28
+ setMouseOverRowIndex(row === null || row === void 0 ? void 0 : row.index);
29
29
  }, 100);
30
30
  var getRowProps = function getRowProps(props, datagridState) {
31
31
  var onMouseOver = function onMouseOver() {
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useSelectRows: (hooks: Hooks) => void;
1
9
  export default useSelectRows;
2
- declare function useSelectRows(hooks: any): void;
@@ -117,7 +117,8 @@ var SelectRow = function SelectRow(datagridState) {
117
117
  dispatch: dispatch,
118
118
  rowData: row,
119
119
  isChecked: event.target.checked,
120
- getRowId: getRowId
120
+ getRowId: getRowId,
121
+ selectAll: null
121
122
  });
122
123
  };
123
124
  var selectDisabled = isFetching || row.getRowProps().disabled;
@@ -137,7 +138,7 @@ var SelectRow = function SelectRow(datagridState) {
137
138
  onSelect: onSelectHandler,
138
139
  id: rowId,
139
140
  name: "".concat(rowId, "-name"),
140
- className: cx__default["default"]([checkboxClass, cellProps.className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)]),
141
+ className: cx__default["default"]([checkboxClass, cellProps.className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && Number(windowSize) > 671)]),
141
142
  ariaLabel: title,
142
143
  disabled: selectDisabled
143
144
  }));
@@ -1,6 +1,13 @@
1
- export function getNewSortOrder(sortOrder: any): {
2
- newSortDesc: undefined;
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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
+ */
7
+ import { Hooks } from 'react-table';
8
+ export declare const getNewSortOrder: (sortOrder?: boolean | string) => {
9
+ newSortDesc: boolean;
3
10
  newOrder: string;
4
11
  };
12
+ declare const useSortableColumns: (hooks: Hooks) => void;
5
13
  export default useSortableColumns;
6
- declare function useSortableColumns(hooks: any): void;
@@ -31,7 +31,7 @@ var ordering = {
31
31
  };
32
32
  var getNewSortOrder = function getNewSortOrder(sortOrder) {
33
33
  var order = {
34
- newSortDesc: undefined,
34
+ newSortDesc: false,
35
35
  newOrder: ordering.NONE
36
36
  };
37
37
  if (sortOrder === false || sortOrder === ordering.DESC) {
@@ -146,7 +146,8 @@ var useSortableColumns = function useSortableColumns(hooks) {
146
146
  return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _rollupPluginBabelHelpers.toConsumableArray(sortableColumns);
147
147
  };
148
148
  var sortInstanceProps = function sortInstanceProps(instance) {
149
- var onSort = instance.onSort;
149
+ var _ref3 = instance,
150
+ onSort = _ref3.onSort;
150
151
  Object.assign(instance, {
151
152
  manualSortBy: !!onSort,
152
153
  isTableSortable: true
@@ -1 +1,8 @@
1
- export function getAutoSizedColumnWidth(rows: Array<object>, accessor: string, headerText: string): number;
1
+ /**
2
+ * Copyright IBM Corp. 2023, 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
+ */
7
+ import { Row } from 'react-table';
8
+ export declare const getAutoSizedColumnWidth: (rows: Array<Row<object>>, accessor: string, headerText: string) => number;
@@ -18,13 +18,6 @@ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHel
18
18
  * LICENSE file in the root directory of this source tree.
19
19
  */
20
20
 
21
- /**
22
- * Calculates the auto sized width of a column
23
- * @param {Array<object>} rows - The datagrid rows
24
- * @param {string} accessor - The accessor for the column
25
- * @param {string} headerText - The header text for the column
26
- */
27
-
28
21
  var getAutoSizedColumnWidth = function getAutoSizedColumnWidth(rows, accessor, headerText) {
29
22
  var maxWidth = 400;
30
23
  var minWidth = 58;
@@ -104,7 +104,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
104
104
  var subtitleRef = React.useRef(null);
105
105
  var previousState = usePreviousValue.usePreviousValue({
106
106
  size: size,
107
- open: open
107
+ open: open,
108
+ currentStep: currentStep
108
109
  });
109
110
  var _useState3 = React.useState(-1),
110
111
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
@@ -171,9 +172,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
171
172
  if (sidePanelRef && panelRefValue) {
172
173
  var _animatedScrollRef$cu;
173
174
  var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
174
- if (scrollableSection) {
175
+ if (previousState && previousState['currentStep'] !== currentStep && scrollableSection) {
175
176
  scrollableSection.scrollTop = 0;
176
177
  }
178
+
177
179
  // The size of the panel has changed while it is still opened
178
180
  // so we need to scroll it to the top and reset the header
179
181
  // height css custom property
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.42.1-canary.7+793b7d211",
4
+ "version": "2.43.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -97,7 +97,7 @@
97
97
  "dependencies": {
98
98
  "@babel/runtime": "^7.23.9",
99
99
  "@carbon/feature-flags": "^0.20.0",
100
- "@carbon/ibm-products-styles": "^2.38.1",
100
+ "@carbon/ibm-products-styles": "^2.39.0",
101
101
  "@carbon/telemetry": "^0.1.0",
102
102
  "@dnd-kit/core": "^6.0.8",
103
103
  "@dnd-kit/modifiers": "^7.0.0",
@@ -121,5 +121,5 @@
121
121
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
122
122
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
123
123
  },
124
- "gitHead": "793b7d211624906e2dea5e39fa5995572b3c1628"
124
+ "gitHead": "4deacf2fbc44a543db6141a63a0f4d988900a0c5"
125
125
  }
@@ -27,7 +27,9 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
27
27
  // .#{$block-class} {
28
28
  // // TODO: Styles.
29
29
  // }
30
-
30
+ .#{$block-class} {
31
+ padding: $spacing-06;
32
+ }
31
33
  .#{$block-class}__condition-builder__group {
32
34
  display: flex;
33
35
  }
@@ -47,5 +49,23 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
47
49
  }
48
50
  .#{$block-class}__condition-block {
49
51
  display: flex;
52
+ width: max-content;
50
53
  flex-direction: row;
51
54
  }
55
+ .#{$block-class}__content-container {
56
+ display: flex;
57
+ flex-direction: column;
58
+ row-gap: $spacing-02;
59
+ }
60
+ .#{$block-class}__heading {
61
+ margin-top: $spacing-03;
62
+ margin-bottom: $spacing-03;
63
+ }
64
+ .#{$block-class}__tree
65
+ .#{$block-class}__actions-container
66
+ .#{$block-class}__condition-wrapper {
67
+ flex-direction: column;
68
+ }
69
+ .#{$block-class}__group-separator {
70
+ margin-top: $spacing-02;
71
+ }
@@ -1,3 +1,4 @@
1
+ @use '@carbon/react/scss/theme' as *;
1
2
  @use '@carbon/react/scss/spacing' as *;
2
3
  @use '@carbon/react/scss/motion';
3
4
  @use '@carbon/styles/scss/components/tag' as *;
@@ -5,6 +6,7 @@
5
6
  @use '../../../global/styles/project-settings' as c4p-settings;
6
7
  @use '@carbon/styles/scss/type';
7
8
  @use '@carbon/styles/scss/type' as *;
9
+ @use '@carbon/react/scss/utilities';
8
10
 
9
11
  $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
10
12
 
@@ -14,12 +16,17 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
14
16
  display: inline-flex;
15
17
  }
16
18
 
17
- [role='row']:focus {
19
+ .#{$block-class} [role='row'] {
20
+ position: relative;
21
+ outline: none;
22
+ }
23
+ .#{$block-class} [role='row']:focus::after {
18
24
  @include focus-outline.focus-outline('outline');
19
25
 
20
- outline-offset: 0;
26
+ position: absolute;
27
+ content: '';
28
+ inset: 0;
21
29
  }
22
-
23
30
  .#{$block-class}__condition__deletion-preview
24
31
  .#{$block-class}__button:not(
25
32
  .#{$block-class}__statement-button,
@@ -44,3 +51,15 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
44
51
  text-overflow: ellipsis;
45
52
  text-wrap: nowrap;
46
53
  }
54
+ .#{$block-class}__group-preview {
55
+ opacity: 0.5;
56
+ pointer-events: none;
57
+ }
58
+ .#{$block-class}__connector-disabled {
59
+ display: flex;
60
+ min-width: $spacing-10;
61
+ align-items: center;
62
+ background-color: $layer;
63
+ color: $text-helper;
64
+ padding-inline: $spacing-03;
65
+ }