@carbon/ibm-products 2.45.0 → 2.46.0

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 (124) hide show
  1. package/css/index-full-carbon.css +261 -124
  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 +3 -0
  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 +81 -86
  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 +182 -110
  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/ActionBar/ActionBarItem.js +1 -1
  18. package/es/components/Coachmark/Coachmark.d.ts +6 -1
  19. package/es/components/Coachmark/Coachmark.js +37 -6
  20. package/es/components/Coachmark/CoachmarkOverlay.js +2 -4
  21. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -7
  22. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +20 -14
  23. package/es/components/ConditionBuilder/ConditionBuilder.js +3 -3
  24. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +8 -5
  25. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +4 -2
  26. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  27. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -3
  28. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +1 -3
  29. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +26 -30
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +6 -1
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +4 -1
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  34. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +47 -23
  36. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  37. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +3 -3
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -3
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -2
  40. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +1 -3
  41. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +62 -32
  42. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
  43. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +52 -46
  44. package/es/components/ConditionBuilder/utils/util.d.ts +6 -5
  45. package/es/components/ConditionBuilder/utils/util.js +35 -17
  46. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +6 -0
  47. package/es/components/DataSpreadsheet/DataSpreadsheet.js +77 -38
  48. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +4 -0
  49. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +10 -1
  50. package/es/components/DataSpreadsheet/types/index.d.ts +1 -0
  51. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +34 -10
  52. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +33 -1
  53. package/es/components/Datagrid/types/index.d.ts +14 -2
  54. package/es/components/Datagrid/useDisableSelectRows.d.ts +2 -1
  55. package/es/components/Datagrid/useDisableSelectRows.js +27 -22
  56. package/es/components/StringFormatter/StringFormatter.js +14 -3
  57. package/es/components/StringFormatter/utils/enums.d.ts +20 -1
  58. package/es/components/StringFormatter/utils/enums.js +22 -2
  59. package/es/components/Tearsheet/TearsheetShell.d.ts +1 -1
  60. package/es/components/Tearsheet/TearsheetShell.js +4 -2
  61. package/es/global/js/hooks/useFocus.d.ts +1 -0
  62. package/es/global/js/hooks/useFocus.js +5 -2
  63. package/es/node_modules/@carbon/icon-helpers/es/index.js +49 -62
  64. package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1020 -1058
  65. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +881 -758
  66. package/lib/components/ActionBar/ActionBarItem.js +1 -1
  67. package/lib/components/Coachmark/Coachmark.d.ts +6 -1
  68. package/lib/components/Coachmark/Coachmark.js +36 -5
  69. package/lib/components/Coachmark/CoachmarkOverlay.js +2 -4
  70. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -7
  71. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +19 -13
  72. package/lib/components/ConditionBuilder/ConditionBuilder.js +3 -3
  73. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +8 -5
  74. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +4 -2
  75. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  76. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -3
  77. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +1 -3
  78. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +25 -29
  79. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  80. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +6 -1
  81. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +4 -1
  82. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  83. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  84. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +46 -22
  85. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  86. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +3 -3
  87. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -3
  88. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -2
  89. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +1 -3
  90. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +61 -31
  91. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
  92. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +51 -44
  93. package/lib/components/ConditionBuilder/utils/util.d.ts +6 -5
  94. package/lib/components/ConditionBuilder/utils/util.js +36 -16
  95. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +6 -0
  96. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +77 -38
  97. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +4 -0
  98. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +10 -1
  99. package/lib/components/DataSpreadsheet/types/index.d.ts +1 -0
  100. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +34 -10
  101. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +32 -0
  102. package/lib/components/Datagrid/types/index.d.ts +14 -2
  103. package/lib/components/Datagrid/useDisableSelectRows.d.ts +2 -1
  104. package/lib/components/Datagrid/useDisableSelectRows.js +27 -22
  105. package/lib/components/StringFormatter/StringFormatter.js +13 -2
  106. package/lib/components/StringFormatter/utils/enums.d.ts +20 -1
  107. package/lib/components/StringFormatter/utils/enums.js +23 -1
  108. package/lib/components/Tearsheet/TearsheetShell.d.ts +1 -1
  109. package/lib/components/Tearsheet/TearsheetShell.js +3 -1
  110. package/lib/global/js/hooks/useFocus.d.ts +1 -0
  111. package/lib/global/js/hooks/useFocus.js +5 -1
  112. package/lib/node_modules/@carbon/icon-helpers/es/index.js +49 -62
  113. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1036 -1074
  114. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +946 -823
  115. package/package.json +6 -6
  116. package/scss/components/Coachmark/_coachmark-overlay.scss +6 -70
  117. package/scss/components/Coachmark/_coachmark.scss +5 -4
  118. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +1 -3
  119. package/scss/components/ConditionBuilder/_condition-builder.scss +4 -0
  120. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +6 -1
  121. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +1 -1
  122. package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +7 -5
  123. package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +5 -4
  124. package/telemetry.yml +5 -14
@@ -6,15 +6,17 @@
6
6
  */
7
7
 
8
8
  import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useRef, useState, useEffect } from 'react';
9
+ import React__default, { useRef, useState, useContext, useEffect } from 'react';
10
10
  import { Popover, PopoverContent, Layer } from '@carbon/react';
11
11
  import PropTypes from '../../../node_modules/prop-types/index.js';
12
12
  import { Add } from '@carbon/react/icons';
13
13
  import { blockClass, valueRenderers } from '../ConditionBuilderContext/DataConfigs.js';
14
14
  import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
15
15
  import { useTranslations } from '../utils/useTranslations.js';
16
+ import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
17
+ import { handleKeyDownForPopover } from '../utils/handleKeyboardEvents.js';
16
18
 
17
- var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren"];
19
+ var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren", "onChange"];
18
20
  var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
19
21
  var children = _ref.children,
20
22
  className = _ref.className,
@@ -27,30 +29,29 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
27
29
  popOverClassName = _ref.popOverClassName,
28
30
  config = _ref.config,
29
31
  renderChildren = _ref.renderChildren,
32
+ onChange = _ref.onChange,
30
33
  rest = _objectWithoutProperties(_ref, _excluded);
31
- var contentRef = useRef(null);
32
34
  var popoverRef = useRef(null);
33
35
  var _useState = useState(false),
34
36
  _useState2 = _slicedToArray(_useState, 2),
35
37
  open = _useState2[0],
36
38
  setOpen = _useState2[1];
37
- var _useTranslations = useTranslations(['invalidText', 'addConditionText', label, 'invalidDateText']),
38
- _useTranslations2 = _slicedToArray(_useTranslations, 4),
39
+ var _useTranslations = useTranslations(['invalidText', 'addConditionText', label]),
40
+ _useTranslations2 = _slicedToArray(_useTranslations, 3),
39
41
  invalidText = _useTranslations2[0],
40
42
  addConditionText = _useTranslations2[1],
41
- labelText = _useTranslations2[2],
42
- invalidDateText = _useTranslations2[3];
43
+ labelText = _useTranslations2[2];
44
+ var _useContext = useContext(ConditionBuilderContext),
45
+ conditionBuilderRef = _useContext.conditionBuilderRef;
43
46
  var getPropertyDetails = function getPropertyDetails() {
44
- if (label === 'INVALID') {
47
+ var _ref2 = condition || {},
48
+ property = _ref2.property,
49
+ operator = _ref2.operator;
50
+ if (label === 'INVALID' || rest['data-name'] === 'propertyField' && property === 'INVALID' || rest['data-name'] === 'operatorField' && operator === 'INVALID') {
45
51
  return {
46
52
  propertyLabel: invalidText,
47
53
  isInvalid: true
48
54
  };
49
- } else if (label === 'INVALID_DATE') {
50
- return {
51
- propertyLabel: invalidDateText,
52
- isInvalid: true
53
- };
54
55
  }
55
56
  var propertyId = rest['data-name'] == 'valueField' && type ? valueRenderers[type](label, config) : labelText;
56
57
  return {
@@ -89,27 +90,46 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
89
90
  }, [condition, label]);
90
91
  useEffect(function () {
91
92
  //this will focus the first input field in the popover
92
- if (open && contentRef.current) {
93
- var firstFocusableElement = contentRef.current.querySelector('input,textarea');
93
+ if (open && popoverRef.current) {
94
+ var firstFocusableElement = popoverRef.current.querySelector('input,textarea');
94
95
  if (firstFocusableElement) {
95
- firstFocusableElement.focus();
96
+ setTimeout(function () {
97
+ return firstFocusableElement.focus();
98
+ }, 0);
96
99
  }
97
100
  }
98
- }, [contentRef, open]);
101
+ }, [popoverRef, open]);
102
+ var manageInvalidSelection = function manageInvalidSelection() {
103
+ //when the user didn't select any value , we need to show as incomplete
104
+ if (rest['data-name'] === 'propertyField' && !(condition !== null && condition !== void 0 && condition.property) || rest['data-name'] === 'operatorField' && !(condition !== null && condition !== void 0 && condition.operator) || rest['data-name'] === 'valueField' && !(condition !== null && condition !== void 0 && condition.value)) {
105
+ onChange === null || onChange === void 0 || onChange('INVALID');
106
+ }
107
+ };
99
108
  var closePopover = function closePopover() {
100
- return setOpen(false);
109
+ if (open) {
110
+ manageInvalidSelection();
111
+ }
112
+ setOpen(false);
101
113
  };
102
114
  var openPopOver = function openPopOver() {
103
115
  return setOpen(true);
104
116
  };
105
117
  var togglePopover = function togglePopover() {
106
- return setOpen(!open);
118
+ if (children || renderChildren) {
119
+ setOpen(!open);
120
+ }
121
+ };
122
+ var handleKeyDownHandler = function handleKeyDownHandler(evt) {
123
+ handleKeyDownForPopover(evt, conditionBuilderRef, popoverRef);
124
+ if (evt.key === 'Escape') {
125
+ manageInvalidSelection();
126
+ }
107
127
  };
108
128
  return /*#__PURE__*/React__default.createElement(Popover, {
109
129
  open: open,
110
130
  isTabTip: true,
111
131
  role: "gridcell",
112
- className: popOverClassName,
132
+ className: "".concat(popOverClassName, " ").concat(blockClass, "__popover"),
113
133
  ref: popoverRef,
114
134
  onRequestClose: closePopover
115
135
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
@@ -124,13 +144,13 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
124
144
  isInvalid: isInvalid,
125
145
  condition: condition
126
146
  }, rest)), open && /*#__PURE__*/React__default.createElement(PopoverContent, {
127
- className: "".concat(blockClass, "__item__content"),
147
+ className: "".concat(blockClass, "__popover-content-wrapper"),
128
148
  role: "dialog",
129
- "aria-label": title
149
+ "aria-label": title,
150
+ onKeyDown: handleKeyDownHandler
130
151
  }, /*#__PURE__*/React__default.createElement(Layer, null, /*#__PURE__*/React__default.createElement("h1", {
131
152
  className: "".concat(blockClass, "__item__title")
132
153
  }, title), /*#__PURE__*/React__default.createElement("div", {
133
- ref: contentRef,
134
154
  className: "".concat(blockClass, "__popover-content")
135
155
  }, renderChildren ? renderChildren(popoverRef) : children))));
136
156
  };
@@ -156,6 +176,10 @@ ConditionBuilderItem.propTypes = {
156
176
  * text to be displayed in the field
157
177
  */
158
178
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]),
179
+ /**
180
+ * callback to update the current condition of the state tree
181
+ */
182
+ onChange: PropTypes.func,
159
183
  /**
160
184
  * class name for popover
161
185
  */
@@ -24,7 +24,7 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
24
24
  endText = _useTranslations2[1];
25
25
  var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
26
26
  var onCloseHandler = function onCloseHandler(selectedDate) {
27
- onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID_DATE');
27
+ onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID');
28
28
  };
29
29
  return /*#__PURE__*/React__default.createElement("div", {
30
30
  className: "".concat(blockClass, "__item-date ")
@@ -22,7 +22,7 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
22
22
  invalidNumberWarnText = _useTranslations2[0];
23
23
  var onChangeHandler = function onChangeHandler(e, _ref2) {
24
24
  var value = _ref2.value;
25
- if (!isNaN(value) && checkIfValid(value)) {
25
+ if (value !== '' && !isNaN(value) && checkIfValid(value)) {
26
26
  var _config$unit;
27
27
  onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
28
28
  } else {
@@ -36,8 +36,8 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
36
36
  return true;
37
37
  };
38
38
  var getDefaultValue = function getDefaultValue() {
39
- var _conditionState$value;
40
- return (_conditionState$value = conditionState.value) === null || _conditionState$value === void 0 || (_conditionState$value = _conditionState$value.split(' ')) === null || _conditionState$value === void 0 ? void 0 : _conditionState$value[0];
39
+ var _conditionState$value, _conditionState$value2;
40
+ return (_conditionState$value = (_conditionState$value2 = conditionState.value) === null || _conditionState$value2 === void 0 || (_conditionState$value2 = _conditionState$value2.split(' ')) === null || _conditionState$value2 === void 0 ? void 0 : _conditionState$value2[0]) !== null && _conditionState$value !== void 0 ? _conditionState$value : '';
41
41
  };
42
42
  return /*#__PURE__*/React__default.createElement("div", {
43
43
  className: "".concat(blockClass, "__item-number")
@@ -113,14 +113,17 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
113
113
  setSearchValue(value);
114
114
  };
115
115
  var onClickHandler = function onClickHandler(evt, option, isSelected) {
116
+ var updatedSelections = selection.filter(function (item) {
117
+ return item !== 'INVALID';
118
+ });
116
119
  if (multiSelectable) {
117
120
  if (isSelected) {
118
- var items = selection.filter(function (v) {
121
+ var items = updatedSelections.filter(function (v) {
119
122
  return v.id !== option.id;
120
123
  });
121
- onChange(items.length > 0 ? items : undefined, evt);
124
+ onChange(items.length > 0 ? items : undefined);
122
125
  } else {
123
- onChange([].concat(_toConsumableArray(selection), [option]), evt);
126
+ onChange([].concat(_toConsumableArray(updatedSelections), [option]));
124
127
  }
125
128
  } else {
126
129
  onChange(option, evt);
@@ -10,9 +10,10 @@ import React__default from 'react';
10
10
  import { TextArea, TextInput } from '@carbon/react';
11
11
  import PropTypes from '../../../../node_modules/prop-types/index.js';
12
12
  import { blockClass } from '../../ConditionBuilderContext/DataConfigs.js';
13
+ import { checkIsValid } from '../../utils/util.js';
13
14
 
14
15
  var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
15
- var _conditionState$value, _conditionState$prope;
16
+ var _conditionState$prope;
16
17
  var conditionState = _ref.conditionState,
17
18
  _onChange = _ref.onChange,
18
19
  config = _ref.config,
@@ -20,7 +21,7 @@ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
20
21
  var inputProps = _objectSpread2({
21
22
  labelText: conditionState.property,
22
23
  hideLabel: true,
23
- value: (_conditionState$value = conditionState.value) !== null && _conditionState$value !== void 0 ? _conditionState$value : '',
24
+ value: checkIsValid(conditionState.value) ? conditionState.value : '',
24
25
  id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
25
26
  onChange: function onChange(evt) {
26
27
  _onChange(evt.target.value);
@@ -5,19 +5,17 @@ export default ConditionGroupBuilder;
5
5
  * All the inner components of group are called from here.
6
6
  * @returns
7
7
  */
8
- declare function ConditionGroupBuilder({ group, aria, onRemove, onChange, conditionBuilderRef, className, }: {
8
+ declare function ConditionGroupBuilder({ group, aria, onRemove, onChange, className, }: {
9
9
  group: any;
10
10
  aria: any;
11
11
  onRemove: any;
12
12
  onChange: any;
13
- conditionBuilderRef: any;
14
13
  className: any;
15
14
  }): import("react/jsx-runtime").JSX.Element;
16
15
  declare namespace ConditionGroupBuilder {
17
16
  namespace propTypes {
18
17
  let aria: PropTypes.Requireable<object>;
19
18
  let className: PropTypes.Requireable<string>;
20
- let conditionBuilderRef: PropTypes.Requireable<object>;
21
19
  let group: PropTypes.Requireable<object>;
22
20
  let onChange: PropTypes.Requireable<(...args: any[]) => any>;
23
21
  let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
@@ -12,7 +12,7 @@ import PropTypes from '../../../node_modules/prop-types/index.js';
12
12
  import cx from 'classnames';
13
13
  import { blockClass, statementConfig } from '../ConditionBuilderContext/DataConfigs.js';
14
14
  import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
15
- import { focusThisField } from '../utils/util.js';
15
+ import { focusThisField, manageTabIndexAndFocus } from '../utils/util.js';
16
16
  import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.js';
17
17
  import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
18
18
  import uuidv4 from '../../../global/js/utils/uuidv4.js';
@@ -33,14 +33,15 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
33
33
  aria = _ref.aria,
34
34
  onRemove = _ref.onRemove,
35
35
  onChange = _ref.onChange,
36
- conditionBuilderRef = _ref.conditionBuilderRef,
37
36
  className = _ref.className;
38
- var _useTranslations = useTranslations(['condition_builder_group', 'conditionText']),
39
- _useTranslations2 = _slicedToArray(_useTranslations, 2),
37
+ var _useTranslations = useTranslations(['conditionBuilderGroupText', 'conditionText', 'conditionBuilderText']),
38
+ _useTranslations2 = _slicedToArray(_useTranslations, 3),
40
39
  conditionBuilderGroupText = _useTranslations2[0],
41
- conditionText = _useTranslations2[1];
40
+ conditionText = _useTranslations2[1],
41
+ conditionBuilderText = _useTranslations2[2];
42
42
  var _useContext = useContext(ConditionBuilderContext),
43
- variant = _useContext.variant;
43
+ variant = _useContext.variant,
44
+ conditionBuilderRef = _useContext.conditionBuilderRef;
44
45
  var _useState = useState(-1),
45
46
  _useState2 = _slicedToArray(_useState, 2),
46
47
  showConditionPreview = _useState2[0],
@@ -53,11 +54,42 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
53
54
  var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
54
55
  if (group.conditions.length > 1) {
55
56
  variant == 'tree' ? handleFocusOnCloseTree(evt) : handleFocusOnClose(evt, conditionIndex);
56
- onChange(_objectSpread2(_objectSpread2({}, group), {}, {
57
- conditions: group.conditions.filter(function (condition) {
58
- return conditionId !== condition.id;
59
- })
60
- }));
57
+ if (group.conditions[1].conditions && group.conditions[1].id !== conditionId) {
58
+ //when we remove every plain conditions of a group without deleting the subgroup, we need to restructure the group
59
+ //the inner group become outer group and same level subgroups become plain conditions
60
+
61
+ //ensure we are deleting last condition , not the subgroup
62
+
63
+ //spreading out the condition inside the subgroup
64
+ var allConditions = group.conditions.reduce(function (acc, item) {
65
+ if (item.conditions) {
66
+ return acc.concat(item.conditions);
67
+ }
68
+ return acc;
69
+ }, []);
70
+
71
+ //we always have conditions first and then subgroups, so ordering accordingly
72
+ var groupedItems = {
73
+ groups: [],
74
+ conditions: []
75
+ };
76
+ allConditions.forEach(function (item) {
77
+ if (item.conditions) {
78
+ groupedItems.groups.push(item);
79
+ } else {
80
+ groupedItems.conditions.push(item);
81
+ }
82
+ });
83
+ onChange(_objectSpread2(_objectSpread2({}, group), {}, {
84
+ conditions: [].concat(_toConsumableArray(groupedItems.conditions), _toConsumableArray(groupedItems.groups))
85
+ }));
86
+ } else {
87
+ onChange(_objectSpread2(_objectSpread2({}, group), {}, {
88
+ conditions: group.conditions.filter(function (condition) {
89
+ return conditionId !== condition.id;
90
+ })
91
+ }));
92
+ }
61
93
  } else {
62
94
  onRemove(evt);
63
95
  }
@@ -87,11 +119,9 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
87
119
  //or focus the next one.
88
120
  var currentGroupCloseButtons = (_e$currentTarget$clos = e.currentTarget.closest(".".concat(blockClass, "__group"))) === null || _e$currentTarget$clos === void 0 ? void 0 : _e$currentTarget$clos.querySelectorAll('[data-name="closeCondition"]');
89
121
  if (conditionIndex == currentGroupCloseButtons.length - 1) {
90
- var _currentGroupCloseBut;
91
- (_currentGroupCloseBut = currentGroupCloseButtons[conditionIndex - 1]) === null || _currentGroupCloseBut === void 0 || _currentGroupCloseBut.focus();
122
+ manageTabIndexAndFocus(currentGroupCloseButtons[conditionIndex - 1], conditionBuilderRef);
92
123
  } else {
93
- var _currentGroupCloseBut2;
94
- (_currentGroupCloseBut2 = currentGroupCloseButtons[conditionIndex + 1]) === null || _currentGroupCloseBut2 === void 0 || _currentGroupCloseBut2.focus();
124
+ manageTabIndexAndFocus(currentGroupCloseButtons[conditionIndex + 1], conditionBuilderRef);
95
125
  }
96
126
  };
97
127
  var handleFocusOnCloseTree = function handleFocusOnCloseTree(evt) {
@@ -107,11 +137,9 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
107
137
  //Otherwise , check the previous item is a valid condition
108
138
 
109
139
  if (nextElement !== null && nextElement !== void 0 && nextElement.classList.contains("".concat(blockClass, "__condition-block"))) {
110
- var _nextElement$querySel;
111
- nextElement === null || nextElement === void 0 || (_nextElement$querySel = nextElement.querySelector('[data-name="closeCondition"]')) === null || _nextElement$querySel === void 0 || _nextElement$querySel.focus();
140
+ manageTabIndexAndFocus(nextElement === null || nextElement === void 0 ? void 0 : nextElement.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
112
141
  } else if (prevElement !== null && prevElement !== void 0 && prevElement.classList.contains("".concat(blockClass, "__condition-block"))) {
113
- var _prevElement$querySel;
114
- prevElement === null || prevElement === void 0 || (_prevElement$querySel = prevElement.querySelector('[data-name="closeCondition"]')) === null || _prevElement$querySel === void 0 || _prevElement$querySel.focus();
142
+ manageTabIndexAndFocus(prevElement === null || prevElement === void 0 ? void 0 : prevElement.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
115
143
  }
116
144
  //If there are no valid condition in this group, focus next or previous row
117
145
  else {
@@ -119,10 +147,18 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
119
147
  var prevRows = (_conditionBuilderCont3 = conditionBuilderContentRef.current) === null || _conditionBuilderCont3 === void 0 ? void 0 : _conditionBuilderCont3.querySelectorAll("[aria-level=\"".concat(Number(currentLevel) - 1, "\"][role=\"row\"]"));
120
148
  var nextRow = (_conditionBuilderCont4 = conditionBuilderContentRef.current) === null || _conditionBuilderCont4 === void 0 ? void 0 : _conditionBuilderCont4.querySelector("[aria-level=\"".concat(Number(currentLevel) + 1, "\"][role=\"row\"]"));
121
149
  if (nextRow) {
122
- nextRow === null || nextRow === void 0 || nextRow.focus();
150
+ //since there are no condition in current group, this group will move one level up
151
+
152
+ var rowIdentity = {
153
+ ariaLevel: Number(nextRow.ariaLevel) - 1,
154
+ ariaPosInSet: nextRow.ariaPosInSet
155
+ };
156
+ setTimeout(function () {
157
+ var currentRowToFocus = conditionBuilderContentRef.current.querySelector("[role=\"row\"][aria-level=\"".concat(rowIdentity.ariaLevel, "\"][aria-posinset=\"").concat(rowIdentity.ariaPosInSet, "\"]"));
158
+ manageTabIndexAndFocus(currentRowToFocus, conditionBuilderRef);
159
+ }, 0);
123
160
  } else if ((prevRows === null || prevRows === void 0 ? void 0 : prevRows.length) > 1) {
124
- var _prevRows;
125
- (_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 || _prevRows.focus();
161
+ manageTabIndexAndFocus(prevRows[prevRows.length - 2], conditionBuilderRef);
126
162
  }
127
163
  }
128
164
  };
@@ -179,7 +215,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
179
215
  }, /*#__PURE__*/React__default.createElement("div", {
180
216
  className: "".concat(blockClass, "__condition-wrapper"),
181
217
  role: "grid",
182
- "aria-label": conditionBuilderGroupText
218
+ "aria-label": conditionBuilderText
183
219
  }, group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.map(function (eachCondition, conditionIndex) {
184
220
  return /*#__PURE__*/React__default.createElement("div", {
185
221
  key: eachCondition.id,
@@ -233,7 +269,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
233
269
  label: conditionText
234
270
  },
235
271
  onChange: function onChange(v, evt) {
236
- focusThisField(evt);
272
+ focusThisField(evt, conditionBuilderRef);
237
273
  onStatementChangeHandler(v);
238
274
  },
239
275
  config: {
@@ -245,7 +281,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
245
281
  }, eachCondition.conditions ? /*#__PURE__*/React__default.createElement("div", {
246
282
  className: cx("".concat(blockClass, "__condition-block subgroup ").concat(blockClass, "__gap"), _defineProperty({}, "".concat(blockClass, "__gap-bottom"), group.conditions.length < conditionIndex + 1))
247
283
  }, /*#__PURE__*/React__default.createElement(ConditionConnector, {
248
- className: "".concat(blockClass, "__gap ").concat(blockClass, "__groupConnector"),
284
+ className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom ").concat(blockClass, "__groupConnector"),
249
285
  operator: group.groupOperator,
250
286
  "aria-hidden": true
251
287
  }), /*#__PURE__*/React__default.createElement(ConditionGroupBuilder, {
@@ -261,8 +297,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
261
297
  },
262
298
  onRemove: function onRemove(e) {
263
299
  onRemoveHandler(eachCondition.id, e);
264
- },
265
- conditionBuilderRef: conditionBuilderRef
300
+ }
266
301
  })) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(ConditionBlock, {
267
302
  conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
268
303
  aria: {
@@ -317,11 +352,6 @@ ConditionGroupBuilder.propTypes = {
317
352
  * Provide an optional class to be applied to the containing node.
318
353
  */
319
354
  className: PropTypes.string,
320
- /**
321
- className: PropTypes.string,
322
- * ref of condition builder
323
- */
324
- conditionBuilderRef: PropTypes.object,
325
355
  group: PropTypes.object,
326
356
  /**
327
357
  * callback to update the current condition of the state tree
@@ -1 +1,2 @@
1
1
  export function handleKeyDown(evt: any, conditionBuilderRef: any, variant: any): void;
2
+ export function handleKeyDownForPopover(evt: any, conditionBuilderRef: any, popoverRef: any): void;
@@ -7,25 +7,27 @@
7
7
 
8
8
  import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
10
- import { checkForHoldingKey, focusThisField, traverseReverse, traverseClockVise, focusThisItem } from './util.js';
10
+ import { focusThisItem, manageTabIndexAndFocus, traverseClockVise, traverseReverse, checkForHoldingKey, focusThisField } from './util.js';
11
11
 
12
12
  var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef, variant) {
13
+ var _activeElement$closes;
13
14
  var activeElement = document.activeElement;
15
+ if (!((_activeElement$closes = activeElement.closest(".".concat(blockClass, "__popover"))) !== null && _activeElement$closes !== void 0 && _activeElement$closes.querySelector('[role="dialog"]'))) {
16
+ handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
17
+ }
18
+ };
19
+ var handleKeyDownForPopover = function handleKeyDownForPopover(evt, conditionBuilderRef, popoverRef) {
14
20
  if (excludeKeyPress(evt)) {
15
21
  return;
16
22
  }
17
- if (activeElement.closest("[role=\"dialog\"]")) {
18
- handleKeyPressForPopover(evt, activeElement.closest("[role=\"dialog\"]"));
19
- } else {
20
- handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
21
- }
23
+ handleKeyPressForPopover(evt, popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current, conditionBuilderRef);
22
24
  };
25
+
23
26
  //skipping keyboard handling for date and time fields to get take carbon's
24
27
  var excludeKeyPress = function excludeKeyPress(evt) {
25
- var _evt$target$closest, _evt$target$closest2;
26
- return !['Escape'].includes(evt.key) && (((_evt$target$closest = evt.target.closest(".".concat(blockClass, "__item-date"))) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.length) || ((_evt$target$closest2 = evt.target.closest(".".concat(blockClass, "__item-time"))) === null || _evt$target$closest2 === void 0 ? void 0 : _evt$target$closest2.length));
28
+ return !['Escape'].includes(evt.key) && (evt.target.closest(".".concat(blockClass, "__item-date")) || evt.target.closest(".".concat(blockClass, "__item-time")));
27
29
  };
28
- var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
30
+ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer, conditionBuilderRef) {
29
31
  var _parentContainer$quer;
30
32
  var key = evt.key;
31
33
  var isHoldingShiftKey = checkForHoldingKey(evt, 'shiftKey');
@@ -35,22 +37,22 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
35
37
  case 'ArrowUp':
36
38
  //traverse through the popover options, search box, selectAll button
37
39
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
38
- traverseReverse(eachElem, index, allElements);
40
+ traverseReverse(eachElem, index, allElements, null, null, conditionBuilderRef);
39
41
  });
40
42
  break;
41
43
  case 'ArrowDown':
42
44
  //traverse through the popover options, search box, selectAll button
43
45
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
44
- traverseClockVise(eachElem, index, allElements);
46
+ traverseClockVise(eachElem, index, allElements, null, null, conditionBuilderRef);
45
47
  });
46
48
  break;
47
49
  case 'Tab':
48
50
  allItems = [].concat(_toConsumableArray(Array.from(parentContainer.querySelectorAll(".".concat(blockClass, "__selectAll-button,[role=\"searchbox\"]")))), [parentContainer.querySelector("[role=\"option\"]")]);
49
51
  allItems.forEach(function (eachElem, index, allElements) {
50
52
  if (isHoldingShiftKey) {
51
- traverseReverse(eachElem, index, allElements, true, true);
53
+ traverseReverse(eachElem, index, allElements, true, true, conditionBuilderRef);
52
54
  } else {
53
- traverseClockVise(eachElem, index, allElements, true, true);
55
+ traverseClockVise(eachElem, index, allElements, true, true, conditionBuilderRef);
54
56
  }
55
57
  });
56
58
  evt.preventDefault();
@@ -70,40 +72,41 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
70
72
  if (document.activeElement.type !== 'button') {
71
73
  var _document$activeEleme2;
72
74
  //for button , enter key is click which already handled by framework, else trigger click
73
- focusThisField(evt);
75
+ focusThisField(evt, conditionBuilderRef);
74
76
  (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
75
77
  }
76
78
  }
77
79
  break;
78
80
  case 'Escape':
79
- //focus the corresponding field in which the popover is triggered
80
- focusThisField(evt);
81
+ //focus the corresponding field in which the popover is triggered\
82
+ focusThisField(evt, conditionBuilderRef);
81
83
  break;
82
84
  }
83
85
  };
84
86
  var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
87
+ var _document$activeEleme3;
85
88
  switch (evt.key) {
86
89
  case 'ArrowRight':
87
90
  evt.preventDefault();
88
91
  if (variant == 'tree') {
89
- var _evt$target$closest3;
90
- var allCellsInRow = Array.from((_evt$target$closest3 = evt.target.closest('[role="row"]')) === null || _evt$target$closest3 === void 0 ? void 0 : _evt$target$closest3.querySelectorAll('[role="gridcell"] button'));
91
- if (evt.target.getAttribute('role') == 'row') {
92
+ var _evt$target$closest;
93
+ var allCellsInRow = Array.from((_evt$target$closest = evt.target.closest('[role="row"]')) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.querySelectorAll('[role="gridcell"] button'));
94
+ if (allCellsInRow.length === 1) {
95
+ evt.target = evt.target.closest('[role="row"]');
96
+ handleRowNavigationTree(evt, conditionBuilderRef, variant);
97
+ //focus next row
98
+ } else if (evt.target.getAttribute('role') == 'row') {
92
99
  //when current focus is on a row, then we need to enter inside and focus the first cell of that row
93
- if (allCellsInRow.length === 1) {
94
- handleRowNavigationTree(evt, conditionBuilderRef, variant);
95
- //focus next row
96
- } else {
97
- var _allCellsInRow$;
98
- (_allCellsInRow$ = allCellsInRow[0]) === null || _allCellsInRow$ === void 0 || _allCellsInRow$.focus();
99
- }
100
+
101
+ //focus first cell
102
+ manageTabIndexAndFocus(allCellsInRow[0], conditionBuilderRef);
100
103
  } else {
101
104
  //finding the next cell to be focussed
102
105
  //next cell = current cell index + 1
103
106
 
104
107
  var currentItemIndex = allCellsInRow.indexOf(evt.target);
105
108
  if (currentItemIndex < allCellsInRow.length - 1) {
106
- focusThisItem(allCellsInRow[currentItemIndex + 1]);
109
+ focusThisItem(allCellsInRow[currentItemIndex + 1], conditionBuilderRef);
107
110
  }
108
111
  }
109
112
  } else {
@@ -114,17 +117,17 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
114
117
  evt.preventDefault();
115
118
  if (variant == 'tree') {
116
119
  if (evt.target.getAttribute('role') !== 'row') {
117
- var _evt$target$closest4;
120
+ var _evt$target$closest2;
118
121
  //when any cell is focussed, arrow left will select the previous cell or current row
119
122
 
120
- var allItems = Array.from((_evt$target$closest4 = evt.target.closest('[role="row"]')) === null || _evt$target$closest4 === void 0 ? void 0 : _evt$target$closest4.querySelectorAll('[role="gridcell"] button'));
121
- var _currentItemIndex = allItems.indexOf(evt.target);
123
+ var _allCellsInRow = Array.from((_evt$target$closest2 = evt.target.closest('[role="row"]')) === null || _evt$target$closest2 === void 0 ? void 0 : _evt$target$closest2.querySelectorAll('[role="gridcell"] button'));
124
+ var _currentItemIndex = _allCellsInRow.indexOf(evt.target);
122
125
  if (_currentItemIndex > 0) {
123
- focusThisItem(allItems[_currentItemIndex - 1]);
126
+ focusThisItem(_allCellsInRow[_currentItemIndex - 1], conditionBuilderRef);
124
127
  } else {
125
128
  //focus the row
126
129
  var wrapper = evt.target.closest("[role=\"row\"]");
127
- wrapper.focus();
130
+ manageTabIndexAndFocus(wrapper, conditionBuilderRef);
128
131
  }
129
132
  }
130
133
  } else {
@@ -140,6 +143,12 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
140
143
  handleRowNavigation(evt, conditionBuilderRef, variant);
141
144
  }
142
145
  break;
146
+ case 'Enter':
147
+ if (((_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === void 0 || (_document$activeEleme3 = _document$activeEleme3.querySelectorAll("button")) === null || _document$activeEleme3 === void 0 ? void 0 : _document$activeEleme3.length) === 1) {
148
+ var _document$activeEleme4;
149
+ (_document$activeEleme4 = document.activeElement) === null || _document$activeEleme4 === void 0 || (_document$activeEleme4 = _document$activeEleme4.querySelectorAll("button")[0]) === null || _document$activeEleme4 === void 0 || _document$activeEleme4.click();
150
+ }
151
+ break;
143
152
  }
144
153
  };
145
154
  var getRows = function getRows(conditionBuilderRef) {
@@ -155,9 +164,9 @@ var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
155
164
  var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef, variant) {
156
165
  var rows = getRows(conditionBuilderRef);
157
166
  var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
158
- navigateToNextRowCell(evt, currentRowIndex, rows, variant);
167
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant, conditionBuilderRef);
159
168
  };
160
- function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
169
+ var handleRowNavigationTree = function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
161
170
  var rows = getRows(conditionBuilderRef);
162
171
  var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
163
172
  var nextRowIndex = currentRowIndex;
@@ -175,15 +184,13 @@ function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
175
184
  nextRowIndex = rows.length - 1;
176
185
  }
177
186
  if (nextRowIndex !== currentRowIndex) {
178
- rows[currentRowIndex].setAttribute('tabindex', '-1');
179
- rows[nextRowIndex].setAttribute('tabindex', '0');
180
- rows[nextRowIndex].focus();
187
+ manageTabIndexAndFocus(rows[nextRowIndex], conditionBuilderRef);
181
188
  }
182
189
  } else {
183
- navigateToNextRowCell(evt, currentRowIndex, rows, variant);
190
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant, conditionBuilderRef);
184
191
  }
185
- }
186
- var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant) {
192
+ };
193
+ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant, conditionBuilderRef) {
187
194
  //when the current focussed element is a cell of any row, arrow up/down will focus the next row same cell.
188
195
 
189
196
  var nextRowIndex = currentRowIndex;
@@ -196,21 +203,20 @@ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex,
196
203
  var nextRow = rows[nextRowIndex];
197
204
  var itemName = evt.target.dataset.name;
198
205
  if (nextRow !== null && nextRow !== void 0 && nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) {
199
- var _nextRow$querySelecto;
200
- nextRow === null || nextRow === void 0 || (_nextRow$querySelecto = nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) === null || _nextRow$querySelecto === void 0 || _nextRow$querySelecto.focus();
206
+ manageTabIndexAndFocus(nextRow === null || nextRow === void 0 ? void 0 : nextRow.querySelector("[data-name=\"".concat(itemName, "\"]")), conditionBuilderRef);
201
207
  } else if (variant === 'tree') {
202
208
  //when the next row is a if statement , then that row is focused. From any cell of last row of an group , arrow down select the next row (if)
203
- nextRow === null || nextRow === void 0 || nextRow.focus();
209
+ manageTabIndexAndFocus(nextRow, conditionBuilderRef);
204
210
  }
205
211
  };
206
212
  var handleCellNavigation = function handleCellNavigation(evt, conditionBuilderRef) {
207
213
  conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
208
214
  if (evt.key === 'ArrowRight') {
209
- traverseClockVise(eachElem, index, allElements);
215
+ traverseClockVise(eachElem, index, allElements, null, null, conditionBuilderRef);
210
216
  } else {
211
- traverseReverse(eachElem, index, allElements);
217
+ traverseReverse(eachElem, index, allElements, null, null, conditionBuilderRef);
212
218
  }
213
219
  });
214
220
  };
215
221
 
216
- export { handleKeyDown };
222
+ export { handleKeyDown, handleKeyDownForPopover };