@carbon/ibm-products 2.19.2 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. package/css/index-full-carbon.css +147 -111
  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-released-only.css +28 -20
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +28 -20
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +51 -22
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ActionSet/ActionSet.js +3 -4
  18. package/es/components/AddSelect/AddSelectBody.js +2 -2
  19. package/es/components/AddSelect/AddSelectRow.js +2 -2
  20. package/es/components/Card/Card.js +1 -2
  21. package/es/components/Card/CardHeader.js +1 -2
  22. package/es/components/CreateFullPage/CreateFullPageStep.js +1 -2
  23. package/es/components/CreateTearsheet/CreateTearsheetStep.js +1 -2
  24. package/es/components/DataSpreadsheet/DataSpreadsheet.js +1 -2
  25. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -2
  26. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -2
  27. package/es/components/Datagrid/Datagrid/DatagridContent.js +2 -7
  28. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
  29. package/es/components/Datagrid/Datagrid/DatagridRow.js +9 -10
  30. package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -2
  31. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +61 -11
  32. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +28 -14
  33. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -2
  34. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -3
  35. package/es/components/Datagrid/Datagrid/addons/Filtering/motion/variants.js +63 -41
  36. package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +1 -5
  37. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
  38. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +2 -2
  39. package/es/components/Datagrid/useActionsColumn.js +1 -2
  40. package/es/components/Datagrid/useDefaultStringRenderer.js +1 -2
  41. package/es/components/Datagrid/useFiltering.js +1 -0
  42. package/es/components/Datagrid/useNestedRowExpander.js +1 -2
  43. package/es/components/Datagrid/useNestedRows.js +49 -33
  44. package/es/components/Datagrid/useOnRowClick.js +1 -1
  45. package/es/components/Datagrid/useSelectRows.js +1 -2
  46. package/es/components/Datagrid/useSortableColumns.js +1 -2
  47. package/es/components/Datagrid/useStickyColumn.js +3 -4
  48. package/es/components/Datagrid/utils/filterPropsForTesting.js +149 -0
  49. package/es/components/EditInPlace/EditInPlace.js +1 -2
  50. package/es/components/EditTearsheet/EditTearsheetForm.js +1 -2
  51. package/es/components/FilterSummary/FilterSummary.js +15 -12
  52. package/es/components/NotificationsPanel/NotificationsPanel.js +2 -3
  53. package/es/components/PageHeader/PageHeader.js +9 -11
  54. package/es/components/Saving/Saving.js +6 -6
  55. package/es/components/SidePanel/SidePanel.js +12 -7
  56. package/es/components/TagSet/TagSetOverflow.js +1 -2
  57. package/es/components/Tearsheet/Tearsheet.js +5 -0
  58. package/es/components/Tearsheet/TearsheetNarrow.js +5 -0
  59. package/es/components/Tearsheet/TearsheetShell.js +10 -10
  60. package/es/components/WebTerminal/WebTerminal.js +1 -2
  61. package/lib/components/ActionSet/ActionSet.js +3 -4
  62. package/lib/components/AddSelect/AddSelectBody.js +2 -2
  63. package/lib/components/AddSelect/AddSelectRow.js +2 -2
  64. package/lib/components/Card/Card.js +1 -2
  65. package/lib/components/Card/CardHeader.js +1 -2
  66. package/lib/components/CreateFullPage/CreateFullPageStep.js +1 -2
  67. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +1 -2
  68. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +1 -2
  69. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -2
  70. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -2
  71. package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -7
  72. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
  73. package/lib/components/Datagrid/Datagrid/DatagridRow.js +9 -10
  74. package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -2
  75. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +60 -10
  76. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +27 -13
  77. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -2
  78. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -3
  79. package/lib/components/Datagrid/Datagrid/addons/Filtering/motion/variants.js +63 -41
  80. package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +1 -5
  81. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
  82. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +2 -2
  83. package/lib/components/Datagrid/useActionsColumn.js +1 -2
  84. package/lib/components/Datagrid/useDefaultStringRenderer.js +1 -2
  85. package/lib/components/Datagrid/useFiltering.js +1 -0
  86. package/lib/components/Datagrid/useNestedRowExpander.js +1 -2
  87. package/lib/components/Datagrid/useNestedRows.js +49 -33
  88. package/lib/components/Datagrid/useOnRowClick.js +1 -1
  89. package/lib/components/Datagrid/useSelectRows.js +1 -2
  90. package/lib/components/Datagrid/useSortableColumns.js +1 -2
  91. package/lib/components/Datagrid/useStickyColumn.js +3 -4
  92. package/lib/components/Datagrid/utils/filterPropsForTesting.js +156 -0
  93. package/lib/components/EditInPlace/EditInPlace.js +1 -2
  94. package/lib/components/EditTearsheet/EditTearsheetForm.js +1 -2
  95. package/lib/components/FilterSummary/FilterSummary.js +15 -12
  96. package/lib/components/NotificationsPanel/NotificationsPanel.js +2 -3
  97. package/lib/components/PageHeader/PageHeader.js +9 -11
  98. package/lib/components/Saving/Saving.js +6 -6
  99. package/lib/components/SidePanel/SidePanel.js +12 -7
  100. package/lib/components/TagSet/TagSetOverflow.js +1 -2
  101. package/lib/components/Tearsheet/Tearsheet.js +5 -0
  102. package/lib/components/Tearsheet/TearsheetNarrow.js +5 -0
  103. package/lib/components/Tearsheet/TearsheetShell.js +10 -10
  104. package/lib/components/WebTerminal/WebTerminal.js +1 -2
  105. package/package.json +4 -4
  106. package/scss/components/Datagrid/styles/_datagrid.scss +8 -0
  107. package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +11 -8
  108. package/scss/components/Saving/_saving.scss +6 -0
  109. package/scss/components/SidePanel/_side-panel.scss +9 -3
  110. package/scss/components/TagSet/_tag-set.scss +4 -1
@@ -168,7 +168,6 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
168
168
  onClick: handleSelectAllClick,
169
169
  className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), _defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
170
170
  }, "\xA0")), headerGroup.headers.map(function (column, index) {
171
- var _cx2;
172
171
  var selectedHeader = checkSelectedHeaderCell(index, selectionAreas, 'column', rows);
173
172
  return /*#__PURE__*/React.createElement("div", _extends({
174
173
  key: "column_".concat(index),
@@ -188,7 +187,7 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
188
187
  height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
189
188
  width: (column === null || column === void 0 ? void 0 : column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
190
189
  },
191
- className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell(index, selectionAreas, 'column')), _defineProperty(_cx2, "".concat(blockClass, "__th--selected-header"), selectedHeader), _defineProperty(_cx2, "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive), _cx2)),
190
+ className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
192
191
  type: "button"
193
192
  }, column.render('Header')));
194
193
  }));
@@ -29,7 +29,6 @@ import { clearSingleFilter } from './addons/Filtering/FilterProvider';
29
29
  var blockClass = "".concat(pkg.prefix, "--datagrid");
30
30
  var gcClass = "".concat(blockClass, "__grid-container");
31
31
  export var DatagridContent = function DatagridContent(_ref) {
32
- var _cx5;
33
32
  var datagridState = _ref.datagridState,
34
33
  title = _ref.title;
35
34
  var _useContext = useContext(InlineEditContext),
@@ -132,8 +131,6 @@ export var DatagridContent = function DatagridContent(_ref) {
132
131
  useSubscribeToEventEmitter(CLEAR_SINGLE_FILTER, function (id) {
133
132
  return clearSingleFilter(id, setAllFilters, state);
134
133
  });
135
-
136
- /* istanbul ignore next */
137
134
  var renderFilterSummary = function renderFilterSummary() {
138
135
  return state.filters.length > 0 && /*#__PURE__*/React.createElement(FilterSummary, {
139
136
  className: "".concat(blockClass, "__filter-summary"),
@@ -146,15 +143,13 @@ export var DatagridContent = function DatagridContent(_ref) {
146
143
  });
147
144
  };
148
145
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
149
- className: cx("".concat(gcClass), (_cx5 = {}, _defineProperty(_cx5, "".concat(gcClass, "-active"), gridActive), _defineProperty(_cx5, "".concat(gcClass, "-active--without-toolbar"), withInlineEdit && !DatagridActions), _defineProperty(_cx5, "".concat(gcClass, "-inline-edit"), withInlineEdit), _defineProperty(_cx5, "".concat(blockClass, "__full-height"), withVirtualScroll || fullHeightDatagrid), _defineProperty(_cx5, "".concat(blockClass, "__with-pagination"), DatagridPagination), _defineProperty(_cx5, "".concat(blockClass, "__dense-header"), useDenseHeader), _cx5)),
146
+ className: cx("".concat(gcClass), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(gcClass, "-active"), gridActive), "".concat(gcClass, "-active--without-toolbar"), withInlineEdit && !DatagridActions), "".concat(gcClass, "-inline-edit"), withInlineEdit), "".concat(blockClass, "__full-height"), withVirtualScroll || fullHeightDatagrid), "".concat(blockClass, "__with-pagination"), DatagridPagination), "".concat(blockClass, "__dense-header"), useDenseHeader)),
150
147
  title: gridTitle,
151
148
  description: gridDescription
152
149
  }, /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), /*#__PURE__*/React.createElement("div", {
153
150
  className: cx("".concat(blockClass, "__table-container"), _defineProperty({}, "".concat(blockClass, "__table-container--filter-open"), panelOpen)),
154
151
  ref: gridAreaRef
155
- }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React.createElement(FilterPanel, _extends({
156
- updateMethod: "batch"
157
- }, getFilterFlyoutProps(), {
152
+ }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React.createElement(FilterPanel, _extends({}, getFilterFlyoutProps(), {
158
153
  title: filterProps.panelTitle,
159
154
  filterSections: filterProps.sections,
160
155
  autoHideFilters: filterProps.autoHideFilters,
@@ -46,6 +46,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
46
46
  dispatch = _ref.dispatch,
47
47
  onColResizeEnd = _ref.onColResizeEnd,
48
48
  resizerAriaLabel = _ref.resizerAriaLabel;
49
+ // eslint-disable-next-line no-unused-vars
49
50
  var role = resizerProps.role,
50
51
  headerProps = _objectWithoutProperties(resizerProps, _excluded);
51
52
  var mouseDownHandler = function mouseDownHandler(evt) {
@@ -71,9 +72,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
71
72
  var keyUpHandler = function keyUpHandler() {
72
73
  handleColumnResizeEndEvent(dispatch, onColResizeEnd, header.id, true);
73
74
  };
74
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, headerProps, role === 'separator' && {
75
- role: role
76
- }, {
75
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, headerProps, {
77
76
  onMouseDown: mouseDownHandler,
78
77
  onKeyDown: keyDownHandler,
79
78
  onKeyUp: keyUpHandler,
@@ -128,16 +127,14 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
128
127
  headerGroupClassName = _headerGroup$getHeade.className,
129
128
  role = _headerGroup$getHeade.role,
130
129
  headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded2);
131
- return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroupProps, role === 'row' && {
132
- role: role
133
- }, {
130
+ return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroupProps, {
134
131
  className: cx("".concat(blockClass, "__head"), headerGroupClassName),
135
132
  ref: headRef
136
133
  }), datagridState.headers.filter(function (_ref3) {
137
134
  var isVisible = _ref3.isVisible;
138
135
  return isVisible;
139
136
  }).map(function (header, index) {
140
- var _header$getResizerPro, _cx;
137
+ var _header$getResizerPro;
141
138
  if (header.id === selectionColumnId) {
142
139
  // render directly without the wrapper TableHeader
143
140
  return header.render('Header', {
@@ -160,12 +157,10 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
160
157
  headerProps = _objectWithoutProperties(_header$getHeaderProp, _excluded3);
161
158
  var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
162
159
  return /*#__PURE__*/React.createElement(TableHeader, _extends({}, headerProps, {
163
- className: cx(headerClassName, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__resizableColumn"), resizerProps), _defineProperty(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), _defineProperty(_cx, "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), _defineProperty(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _defineProperty(_cx, "".concat(blockClass, "__header-actions-column"), header.isAction), _cx)),
160
+ className: cx(headerClassName, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header.isSorted), "".concat(blockClass, "__header-actions-column"), header.isAction)),
164
161
  key: header.id,
165
162
  "aria-hidden": header.id === 'spacer' && 'true'
166
- }, getAccessibilityProps(header), role === 'columnheader' && {
167
- role: role
168
- }), header.render('Header'), resizerProps && !header.isAction && /*#__PURE__*/React.createElement(ResizeHeader, {
163
+ }, getAccessibilityProps(header)), header.render('Header'), resizerProps && !header.isAction && /*#__PURE__*/React.createElement(ResizeHeader, {
169
164
  resizerProps: resizerProps,
170
165
  header: header,
171
166
  handleOnMouseDownResize: handleOnMouseDownResize,
@@ -29,7 +29,6 @@ var rowHeights = {
29
29
 
30
30
  // eslint-disable-next-line react/prop-types
31
31
  var DatagridRow = function DatagridRow(datagridState) {
32
- var _cx;
33
32
  var row = datagridState.row,
34
33
  rowSize = datagridState.rowSize,
35
34
  withNestedRows = datagridState.withNestedRows,
@@ -93,7 +92,7 @@ var DatagridRow = function DatagridRow(datagridState) {
93
92
  hoverHandler(event);
94
93
  }
95
94
  };
96
- var rowClassNames = cx("".concat(blockClass, "__carbon-row"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), _defineProperty(_cx, "".concat(carbon.prefix, "--data-table--selected"), row.isSelected), _cx));
95
+ var rowClassNames = cx("".concat(blockClass, "__carbon-row"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), "".concat(carbon.prefix, "--data-table--selected"), row.isSelected));
97
96
  var setAdditionalRowProps = function setAdditionalRowProps() {
98
97
  if (withNestedRows || withExpandedRows) {
99
98
  return {
@@ -102,6 +101,8 @@ var DatagridRow = function DatagridRow(datagridState) {
102
101
  }
103
102
  return {};
104
103
  };
104
+
105
+ // eslint-disable-next-line no-unused-vars
105
106
  var _row$getRowProps = row.getRowProps(),
106
107
  role = _row$getRowProps.role,
107
108
  rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
@@ -116,11 +117,10 @@ var DatagridRow = function DatagridRow(datagridState) {
116
117
  onFocus: hoverHandler,
117
118
  onBlur: focusRemover,
118
119
  onKeyUp: handleOnKeyUp
119
- }, setAdditionalRowProps(), role === 'row' && {
120
- role: role
121
- }), row.cells.map(function (cell, index) {
122
- var _cell$column;
120
+ }, setAdditionalRowProps()), row.cells.map(function (cell, index) {
121
+ var _cell$column, _content$props;
123
122
  var cellProps = cell.getCellProps();
123
+ // eslint-disable-next-line no-unused-vars
124
124
  var children = cellProps.children,
125
125
  role = cellProps.role,
126
126
  restProps = _objectWithoutProperties(cellProps, _excluded2);
@@ -131,13 +131,12 @@ var DatagridRow = function DatagridRow(datagridState) {
131
131
  key: cell.column.id
132
132
  });
133
133
  }
134
+ var title = content === null || content === void 0 || (_content$props = content.props) === null || _content$props === void 0 || (_content$props = _content$props.children[0]) === null || _content$props === void 0 || (_content$props = _content$props.props) === null || _content$props === void 0 ? void 0 : _content$props.value;
134
135
  return /*#__PURE__*/React.createElement(TableCell, _extends({
135
136
  className: cx("".concat(blockClass, "__cell"), _defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), row.canExpand && index === 0))
136
137
  }, restProps, {
137
- key: cell.column.id
138
- // avoid unnecessary role assignment to cells
139
- }, role === 'cell' && {
140
- role: role
138
+ key: cell.column.id,
139
+ title: title
141
140
  }), content);
142
141
  })), renderExpandedRow());
143
142
  };
@@ -17,7 +17,6 @@ import { CSS } from '@dnd-kit/utilities';
17
17
  import { useSortable } from '@dnd-kit/sortable';
18
18
  var blockClass = "".concat(pkg.prefix, "--datagrid");
19
19
  var DraggableElement = function DraggableElement(_ref) {
20
- var _cx;
21
20
  var id = _ref.id,
22
21
  children = _ref.children,
23
22
  classList = _ref.classList,
@@ -49,7 +48,7 @@ var DraggableElement = function DraggableElement(_ref) {
49
48
  transition: transition
50
49
  };
51
50
  return /*#__PURE__*/React.createElement("li", _extends({
52
- className: cx(classList, "".concat(blockClass, "__draggable-handleHolder"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__draggable-handleHolder--selected"), selected), _defineProperty(_cx, "".concat(blockClass, "__draggable-handleHolder--sticky"), isSticky), _defineProperty(_cx, "".concat(blockClass, "__draggable-handleHolder--dragging"), isDragging), _cx)),
51
+ className: cx(classList, "".concat(blockClass, "__draggable-handleHolder"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__draggable-handleHolder--selected"), selected), "".concat(blockClass, "__draggable-handleHolder--sticky"), isSticky), "".concat(blockClass, "__draggable-handleHolder--dragging"), isDragging)),
53
52
  id: id,
54
53
  ref: setNodeRef,
55
54
  style: style
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  // @flow
4
4
  /**
5
- * Copyright IBM Corp. 2022, 2023
5
+ * Copyright IBM Corp. 2022, 2024
6
6
  *
7
7
  * This source code is licensed under the Apache-2.0 license found in the
8
8
  * LICENSE file in the root directory of this source tree.
@@ -13,25 +13,30 @@ import { IconButton, usePrefix } from '@carbon/react';
13
13
  import cx from 'classnames';
14
14
  import PropTypes from 'prop-types';
15
15
  import React, { useRef, useState, useEffect } from 'react';
16
- import { useClickOutside } from '../../../../../global/js/hooks';
16
+ import { useClickOutside, useWindowResize } from '../../../../../global/js/hooks';
17
17
  import { pkg } from '../../../../../settings';
18
18
  import { ActionSet } from '../../../../ActionSet';
19
19
  import { BATCH, CLEAR_FILTERS, FLYOUT, INSTANT } from './constants';
20
20
  import { useSubscribeToEventEmitter, useFilters, useShouldDisableButtons } from './hooks';
21
+ import { px, breakpoints } from '@carbon/layout';
21
22
  var blockClass = "".concat(pkg.prefix, "--datagrid");
22
23
  var componentClass = "".concat(blockClass, "-filter-flyout");
24
+ var defaults = {
25
+ flyoutIconDescription: 'Open filters',
26
+ title: 'Filter',
27
+ primaryActionLabel: 'Apply',
28
+ secondaryActionLabel: 'Cancel'
29
+ };
23
30
  var FilterFlyout = function FilterFlyout(_ref) {
24
- var _cx2;
25
- var _ref$updateMethod = _ref.updateMethod,
26
- updateMethod = _ref$updateMethod === void 0 ? BATCH : _ref$updateMethod,
31
+ var updateMethod = _ref.updateMethod,
27
32
  _ref$flyoutIconDescri = _ref.flyoutIconDescription,
28
- flyoutIconDescription = _ref$flyoutIconDescri === void 0 ? 'Open filters' : _ref$flyoutIconDescri,
33
+ flyoutIconDescription = _ref$flyoutIconDescri === void 0 ? defaults.flyoutIconDescription : _ref$flyoutIconDescri,
29
34
  _ref$filters = _ref.filters,
30
35
  filters = _ref$filters === void 0 ? [] : _ref$filters,
31
36
  _ref$title = _ref.title,
32
- title = _ref$title === void 0 ? 'Filter' : _ref$title,
37
+ title = _ref$title === void 0 ? defaults.title : _ref$title,
33
38
  _ref$primaryActionLab = _ref.primaryActionLabel,
34
- primaryActionLabel = _ref$primaryActionLab === void 0 ? 'Apply' : _ref$primaryActionLab,
39
+ primaryActionLabel = _ref$primaryActionLab === void 0 ? defaults.primaryActionLabel : _ref$primaryActionLab,
35
40
  _ref$onFlyoutOpen = _ref.onFlyoutOpen,
36
41
  onFlyoutOpen = _ref$onFlyoutOpen === void 0 ? function () {} : _ref$onFlyoutOpen,
37
42
  _ref$onFlyoutClose = _ref.onFlyoutClose,
@@ -41,7 +46,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
41
46
  _ref$onCancel = _ref.onCancel,
42
47
  onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
43
48
  _ref$secondaryActionL = _ref.secondaryActionLabel,
44
- secondaryActionLabel = _ref$secondaryActionL === void 0 ? 'Cancel' : _ref$secondaryActionL,
49
+ secondaryActionLabel = _ref$secondaryActionL === void 0 ? defaults.secondaryActionLabel : _ref$secondaryActionL,
45
50
  setAllFilters = _ref.setAllFilters,
46
51
  _ref$data = _ref.data,
47
52
  data = _ref$data === void 0 ? [] : _ref$data,
@@ -52,6 +57,10 @@ var FilterFlyout = function FilterFlyout(_ref) {
52
57
  _useState2 = _slicedToArray(_useState, 2),
53
58
  open = _useState2[0],
54
59
  setOpen = _useState2[1];
60
+ var _useState3 = useState(false),
61
+ _useState4 = _slicedToArray(_useState3, 2),
62
+ stackedLayout = _useState4[0],
63
+ setStackedLayout = _useState4[1];
55
64
  var _useFilters = useFilters({
56
65
  updateMethod: updateMethod,
57
66
  filters: filters,
@@ -68,9 +77,13 @@ var FilterFlyout = function FilterFlyout(_ref) {
68
77
  renderFilter = _useFilters.renderFilter,
69
78
  filtersObjectArray = _useFilters.filtersObjectArray,
70
79
  lastAppliedFilters = _useFilters.lastAppliedFilters;
80
+ var width = breakpoints.md.width;
81
+ var mdPxWidth = parseInt(width) * 16;
71
82
 
72
83
  /** Refs */
73
84
  var filterFlyoutRef = useRef(null);
85
+ var flyoutInnerRef = useRef(null);
86
+ var flyoutFiltersContainerRef = useRef(null);
74
87
 
75
88
  /** State from hooks */
76
89
  var _useShouldDisableButt = useShouldDisableButtons({
@@ -82,6 +95,36 @@ var FilterFlyout = function FilterFlyout(_ref) {
82
95
  shouldDisableButtons = _useShouldDisableButt2[0],
83
96
  setShouldDisableButtons = _useShouldDisableButt2[1];
84
97
 
98
+ // Skip resize testing
99
+ /* istanbul ignore next */
100
+ var handleResize = function handleResize(current) {
101
+ var filterFlyoutRefPosition = flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current.getBoundingClientRect();
102
+ var originalFlyoutWidth = parseInt(window.getComputedStyle(flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current).getPropertyValue('width'));
103
+ // Check to see if left value from flyout getBoundingClientRect is a negative number
104
+ // If it is, that is the amount we need to subtract from the flyout width
105
+ if (Math.sign(filterFlyoutRefPosition.left) === -1) {
106
+ var newFlyoutWidth = originalFlyoutWidth - Math.abs(filterFlyoutRefPosition.left);
107
+ flyoutInnerRef.current.style.width = px(newFlyoutWidth);
108
+ }
109
+ // Check to see if left value from flyout getBoundingClientRect is a positive number or 0
110
+ // If it is, that is the amount we need to add to the flyout width until we reach the
111
+ // max-width of the flyout (642)
112
+ if (originalFlyoutWidth < 642 && Math.sign(filterFlyoutRefPosition.left) === 1 || Math.sign(filterFlyoutRefPosition.left).toString() === '0') {
113
+ var _newFlyoutWidth = originalFlyoutWidth + Math.abs(filterFlyoutRefPosition.left);
114
+ flyoutInnerRef.current.style.width = px(_newFlyoutWidth);
115
+ }
116
+ // Begin stacking filters at this specific point
117
+ if ((current === null || current === void 0 ? void 0 : current.innerWidth) <= mdPxWidth + 254) {
118
+ setStackedLayout(true);
119
+ } else {
120
+ setStackedLayout(false);
121
+ }
122
+ };
123
+ useWindowResize(function (_ref2) {
124
+ var current = _ref2.current;
125
+ handleResize(current);
126
+ });
127
+
85
128
  /** Memos */
86
129
  var showActionSet = updateMethod === BATCH;
87
130
  var carbonPrefix = usePrefix();
@@ -94,7 +137,12 @@ var FilterFlyout = function FilterFlyout(_ref) {
94
137
  var closeFlyout = function closeFlyout() {
95
138
  setOpen(false);
96
139
  onFlyoutClose();
140
+ flyoutInnerRef.current.style.width = px(642);
97
141
  };
142
+ useEffect(function () {
143
+ // Initialize flyout width
144
+ flyoutInnerRef.current.style.width = px(642);
145
+ }, []);
98
146
  var apply = function apply() {
99
147
  setAllFilters(filtersObjectArray);
100
148
  closeFlyout();
@@ -162,13 +210,15 @@ var FilterFlyout = function FilterFlyout(_ref) {
162
210
  className: cx("".concat(componentClass, "__trigger"), _defineProperty({}, "".concat(componentClass, "__trigger--open"), open)),
163
211
  disabled: data.length === 0
164
212
  }, /*#__PURE__*/React.createElement(Filter, null)), /*#__PURE__*/React.createElement("div", {
165
- className: cx(componentClass, (_cx2 = {}, _defineProperty(_cx2, "".concat(componentClass, "--open"), open), _defineProperty(_cx2, "".concat(componentClass, "--batch"), showActionSet), _defineProperty(_cx2, "".concat(componentClass, "--instant"), !showActionSet), _cx2))
213
+ className: cx(componentClass, _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentClass, "--open"), open), "".concat(componentClass, "--batch"), showActionSet), "".concat(componentClass, "--instant"), !showActionSet)),
214
+ ref: flyoutInnerRef
166
215
  }, /*#__PURE__*/React.createElement("div", {
167
216
  className: "".concat(componentClass, "__inner-container")
168
217
  }, /*#__PURE__*/React.createElement("span", {
169
218
  className: "".concat(componentClass, "__title")
170
219
  }, title), /*#__PURE__*/React.createElement("div", {
171
- className: "".concat(componentClass, "__filters")
220
+ className: cx("".concat(componentClass, "__filters"), _defineProperty({}, "".concat(componentClass, "__stacked"), stackedLayout)),
221
+ ref: flyoutFiltersContainerRef
172
222
  }, renderFilters())), renderActionSet()));
173
223
  };
174
224
  FilterFlyout.propTypes = {
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  /**
5
- * Copyright IBM Corp. 2022, 2023
5
+ * Copyright IBM Corp. 2022, 2024
6
6
  *
7
7
  * This source code is licensed under the Apache-2.0 license found in the
8
8
  * LICENSE file in the root directory of this source tree.
@@ -20,20 +20,26 @@ import { Close } from '@carbon/react/icons';
20
20
  import { FilterContext } from '.';
21
21
  import PropTypes from 'prop-types';
22
22
  import cx from 'classnames';
23
- import { motion } from 'framer-motion';
23
+ import { motion, useReducedMotion } from 'framer-motion';
24
24
  import { pkg } from '../../../../../settings';
25
25
  import { rem } from '@carbon/layout';
26
26
  var blockClass = "".concat(pkg.prefix, "--datagrid");
27
27
  export var componentClass = "".concat(blockClass, "-filter-panel");
28
28
  var MotionActionSet = motion(ActionSet);
29
+ var defaults = {
30
+ title: 'Filter',
31
+ closeIconDescription: 'Close filter panel',
32
+ primaryActionLabel: 'Apply',
33
+ secondaryActionLabel: 'Cancel',
34
+ searchLabelText: 'Filter search',
35
+ searchPlaceholder: 'Find filters'
36
+ };
29
37
  var FilterPanel = function FilterPanel(_ref) {
30
- var _cx;
31
38
  var _ref$title = _ref.title,
32
- title = _ref$title === void 0 ? 'Filter' : _ref$title,
39
+ title = _ref$title === void 0 ? defaults.title : _ref$title,
33
40
  _ref$closeIconDescrip = _ref.closeIconDescription,
34
- closeIconDescription = _ref$closeIconDescrip === void 0 ? 'Close filter panel' : _ref$closeIconDescrip,
35
- _ref$updateMethod = _ref.updateMethod,
36
- updateMethod = _ref$updateMethod === void 0 ? BATCH : _ref$updateMethod,
41
+ closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
42
+ updateMethod = _ref.updateMethod,
37
43
  filterSections = _ref.filterSections,
38
44
  setAllFilters = _ref.setAllFilters,
39
45
  _ref$onApply = _ref.onApply,
@@ -49,13 +55,13 @@ var FilterPanel = function FilterPanel(_ref) {
49
55
  _ref$filterPanelMinHe = _ref.filterPanelMinHeight,
50
56
  filterPanelMinHeight = _ref$filterPanelMinHe === void 0 ? 600 : _ref$filterPanelMinHe,
51
57
  _ref$primaryActionLab = _ref.primaryActionLabel,
52
- primaryActionLabel = _ref$primaryActionLab === void 0 ? 'Apply' : _ref$primaryActionLab,
58
+ primaryActionLabel = _ref$primaryActionLab === void 0 ? defaults.primaryActionLabel : _ref$primaryActionLab,
53
59
  _ref$secondaryActionL = _ref.secondaryActionLabel,
54
- secondaryActionLabel = _ref$secondaryActionL === void 0 ? 'Cancel' : _ref$secondaryActionL,
60
+ secondaryActionLabel = _ref$secondaryActionL === void 0 ? defaults.secondaryActionLabel : _ref$secondaryActionL,
55
61
  _ref$searchLabelText = _ref.searchLabelText,
56
- searchLabelText = _ref$searchLabelText === void 0 ? 'Filter search' : _ref$searchLabelText,
62
+ searchLabelText = _ref$searchLabelText === void 0 ? defaults.searchLabelText : _ref$searchLabelText,
57
63
  _ref$searchPlaceholde = _ref.searchPlaceholder,
58
- searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Find filters' : _ref$searchPlaceholde,
64
+ searchPlaceholder = _ref$searchPlaceholde === void 0 ? defaults.searchPlaceholder : _ref$searchPlaceholde,
59
65
  _ref$reactTableFilter = _ref.reactTableFiltersState,
60
66
  reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter,
61
67
  _ref$autoHideFilters = _ref.autoHideFilters,
@@ -107,6 +113,7 @@ var FilterPanel = function FilterPanel(_ref) {
107
113
  _useShouldDisableButt2 = _slicedToArray(_useShouldDisableButt, 2),
108
114
  shouldDisableButtons = _useShouldDisableButt2[0],
109
115
  setShouldDisableButtons = _useShouldDisableButt2[1];
116
+ var shouldReduceMotion = useReducedMotion();
110
117
 
111
118
  /** Memos */
112
119
  var showActionSet = useMemo(function () {
@@ -149,6 +156,7 @@ var FilterPanel = function FilterPanel(_ref) {
149
156
  }],
150
157
  className: "".concat(componentClass, "__action-set"),
151
158
  ref: actionSetRef,
159
+ custom: shouldReduceMotion,
152
160
  variants: actionSetVariants
153
161
  });
154
162
  };
@@ -178,16 +186,19 @@ var FilterPanel = function FilterPanel(_ref) {
178
186
  var filterHeadingHeight = (_filterHeadingRef$cur = filterHeadingRef.current) === null || _filterHeadingRef$cur === void 0 ? void 0 : _filterHeadingRef$cur.getBoundingClientRect().height;
179
187
  var filterSearchHeight = (_filterSearchRef$curr = filterSearchRef.current) === null || _filterSearchRef$curr === void 0 ? void 0 : _filterSearchRef$curr.getBoundingClientRect().height;
180
188
  var actionSetHeight = (_actionSetRef$current = actionSetRef.current) === null || _actionSetRef$current === void 0 ? void 0 : _actionSetRef$current.getBoundingClientRect().height;
181
- var height = "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat(showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === BATCH ? actionSetHeight : 0, "px)");
189
+ var height = "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat( /* istanbul ignore next */
190
+ showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === BATCH ? actionSetHeight : 0, "px)");
182
191
  return height;
183
192
  };
184
193
  return /*#__PURE__*/React.createElement(motion.div, {
185
194
  ref: filterPanelRef,
186
- className: cx(componentClass, "".concat(componentClass, "__container"), (_cx = {}, _defineProperty(_cx, "".concat(componentClass, "--open"), panelOpen), _defineProperty(_cx, "".concat(componentClass, "--batch"), showActionSet), _defineProperty(_cx, "".concat(componentClass, "--instant"), !showActionSet), _cx)),
195
+ className: cx(componentClass, "".concat(componentClass, "__container"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentClass, "--open"), panelOpen), "".concat(componentClass, "--batch"), showActionSet), "".concat(componentClass, "--instant"), !showActionSet)),
187
196
  initial: false,
188
197
  animate: panelOpen ? 'visible' : 'hidden',
198
+ custom: shouldReduceMotion,
189
199
  variants: panelVariants
190
200
  }, /*#__PURE__*/React.createElement(motion.div, {
201
+ custom: shouldReduceMotion,
191
202
  variants: innerContainerVariants
192
203
  }, /*#__PURE__*/React.createElement("header", {
193
204
  ref: filterHeadingRef,
@@ -206,7 +217,10 @@ var FilterPanel = function FilterPanel(_ref) {
206
217
  tooltipPosition: "bottom",
207
218
  tooltipAlignment: "end",
208
219
  onClick: closePanel
209
- }), showFilterSearch && /*#__PURE__*/React.createElement("div", {
220
+ }), showFilterSearch &&
221
+ /*#__PURE__*/
222
+ /* istanbul ignore next */
223
+ React.createElement("div", {
210
224
  ref: filterSearchRef,
211
225
  className: "".concat(componentClass, "__search")
212
226
  }, /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(Search, {
@@ -50,8 +50,7 @@ var useFilters = function useFilters(_ref2) {
50
50
  setAllFilters = _ref2.setAllFilters,
51
51
  variation = _ref2.variation,
52
52
  reactTableFiltersState = _ref2.reactTableFiltersState,
53
- _ref2$onCancel = _ref2.onCancel,
54
- onCancel = _ref2$onCancel === void 0 ? function () {} : _ref2$onCancel,
53
+ onCancel = _ref2.onCancel,
55
54
  panelOpen = _ref2.panelOpen,
56
55
  autoHideFilters = _ref2.autoHideFilters,
57
56
  isFetching = _ref2.isFetching;
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /**
3
- * Copyright IBM Corp. 2023, 2023
3
+ * Copyright IBM Corp. 2023, 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.
@@ -18,8 +18,7 @@ import isEqual from 'lodash/isEqual';
18
18
  * @returns {Array} returns a tuple of the state and setter function
19
19
  */
20
20
  var useShouldDisableButtons = function useShouldDisableButtons(_ref) {
21
- var _ref$initialValue = _ref.initialValue,
22
- initialValue = _ref$initialValue === void 0 ? true : _ref$initialValue,
21
+ var initialValue = _ref.initialValue,
23
22
  filtersState = _ref.filtersState,
24
23
  prevFiltersRef = _ref.prevFiltersRef;
25
24
  var _useState = useState(initialValue),
@@ -1,55 +1,77 @@
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
+
1
8
  import { DURATIONS, EASINGS } from '../../../../../../global/js/utils/motionConstants';
2
9
  import { ACTION_SET_HEIGHT, PANEL_WIDTH } from '../constants';
3
10
  export var panelVariants = {
4
- hidden: {
5
- width: 0,
6
- overflow: 'hidden',
7
- transition: {
8
- duration: DURATIONS.fast02,
9
- ease: EASINGS.productive.exit,
10
- when: 'afterChildren'
11
- }
11
+ hidden: function hidden(shouldReduceMotion) {
12
+ return {
13
+ width: 0,
14
+ overflow: 'hidden',
15
+ transition: {
16
+ duration: shouldReduceMotion ? 0 : DURATIONS.fast02,
17
+ ease: shouldReduceMotion ? 0 : EASINGS.productive.exit,
18
+ when: 'afterChildren'
19
+ }
20
+ };
12
21
  },
13
- visible: {
14
- width: PANEL_WIDTH,
15
- overflow: 'visible',
16
- transition: {
17
- duration: DURATIONS.moderate02,
18
- ease: EASINGS.productive.entrance,
19
- when: 'beforeChildren'
20
- }
22
+ visible: function visible(shouldReduceMotion) {
23
+ return {
24
+ width: PANEL_WIDTH,
25
+ overflow: 'visible',
26
+ transition: {
27
+ duration: shouldReduceMotion ? 0 : DURATIONS.moderate02,
28
+ ease: shouldReduceMotion ? 0 : EASINGS.productive.entrance,
29
+ when: 'beforeChildren'
30
+ }
31
+ };
21
32
  }
22
33
  };
23
34
  export var innerContainerVariants = {
24
- hidden: {
25
- opacity: 0,
26
- transition: {
27
- duration: DURATIONS.fast01,
28
- ease: EASINGS.productive.exit
29
- }
35
+ hidden: function hidden(shouldReduceMotion) {
36
+ return {
37
+ opacity: 0,
38
+ transition: {
39
+ duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast01,
40
+ ease: shouldReduceMotion ? 0 : EASINGS.productive.exit
41
+ }
42
+ };
30
43
  },
31
- visible: {
32
- opacity: 1,
33
- transition: {
34
- duration: DURATIONS.fast02,
35
- ease: EASINGS.productive.entrance,
36
- when: 'beforeChildren'
37
- }
44
+ visible: function visible(shouldReduceMotion) {
45
+ return {
46
+ opacity: 1,
47
+ transition: {
48
+ duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast02,
49
+ ease: shouldReduceMotion ? 0 : EASINGS.productive.entrance,
50
+ when: shouldReduceMotion ? null : 'beforeChildren'
51
+ }
52
+ };
38
53
  }
39
54
  };
40
55
  export var actionSetVariants = {
41
- hidden: {
42
- y: ACTION_SET_HEIGHT,
43
- transition: {
44
- duration: DURATIONS.fast01,
45
- ease: EASINGS.productive.exit
46
- }
56
+ hidden: function hidden(shouldReduceMotion) {
57
+ return {
58
+ y: shouldReduceMotion ? 0 : ACTION_SET_HEIGHT,
59
+ opacity: shouldReduceMotion ? 0 : 1,
60
+ transition: {
61
+ duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast01,
62
+ ease: shouldReduceMotion ? 0 : EASINGS.productive.exit
63
+ }
64
+ };
47
65
  },
48
- visible: {
49
- y: 0,
50
- transition: {
51
- duration: DURATIONS.fast02,
52
- ease: EASINGS.productive.entrance
53
- }
66
+ visible: function visible(shouldReduceMotion) {
67
+ return {
68
+ y: 0,
69
+ opacity: 1,
70
+ transition: {
71
+ duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast02,
72
+ ease: shouldReduceMotion ? 0 : EASINGS.productive.entrance,
73
+ delay: shouldReduceMotion ? 0.075 : 0
74
+ }
75
+ };
54
76
  }
55
77
  };
@@ -23,9 +23,7 @@ var applyInitialFilters = function applyInitialFilters(filterState, initialFilte
23
23
  };
24
24
 
25
25
  // This functions takes the filters passed in and makes an object to track it's state
26
- export var getInitialStateFromFilters = function getInitialStateFromFilters(filters) {
27
- var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
28
- var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
26
+ export var getInitialStateFromFilters = function getInitialStateFromFilters(filters, variation, initialFilters) {
29
27
  var initialFilterState = {};
30
28
  var setInitialState = function setInitialState(_ref) {
31
29
  var type = _ref.type,
@@ -80,8 +78,6 @@ export var getInitialStateFromFilters = function getInitialStateFromFilters(filt
80
78
  return setInitialState(filter);
81
79
  });
82
80
  });
83
- } else {
84
- console.error('No variation passed into useInitialStateFromFilters');
85
81
  }
86
82
  if (initialFilters.length > 0) {
87
83
  applyInitialFilters(initialFilterState, initialFilters);