@carbon/ibm-products 2.44.0 → 2.45.0-rc.1

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 (195) hide show
  1. package/css/index-full-carbon.css +118 -15
  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 +203 -5
  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 +118 -15
  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 +118 -15
  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/Coachmark/Coachmark.js +12 -7
  18. package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  19. package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
  20. package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  21. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +35 -22
  22. package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
  23. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  24. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
  25. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  26. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +23 -11
  27. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  28. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
  29. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
  30. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
  31. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +29 -16
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  34. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +23 -20
  36. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
  37. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  41. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
  42. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
  43. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
  44. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
  45. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  46. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
  47. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  48. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -17
  49. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  50. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
  51. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  52. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
  53. package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  54. package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
  55. package/es/components/ConditionBuilder/utils/util.js +1 -9
  56. package/es/components/CreateFullPage/CreateFullPage.js +2 -2
  57. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
  58. package/es/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
  59. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  60. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
  61. package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
  62. package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
  63. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
  64. package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
  65. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  66. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  67. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
  68. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
  69. package/es/components/Datagrid/types/index.d.ts +28 -6
  70. package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
  71. package/es/components/Datagrid/useCustomizeColumns.js +4 -3
  72. package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
  73. package/es/components/Datagrid/useNestedRowExpander.js +1 -3
  74. package/es/components/Datagrid/useRowExpander.js +1 -3
  75. package/es/components/Datagrid/useSelectRows.js +2 -1
  76. package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
  77. package/es/components/Datagrid/useStickyColumn.js +12 -9
  78. package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
  79. package/es/components/EditInPlace/EditInPlace.js +21 -10
  80. package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
  81. package/es/components/EditTearsheet/EditTearsheet.js +44 -9
  82. package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
  83. package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
  84. package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
  85. package/es/components/Nav/NavItem.js +12 -3
  86. package/es/components/OptionsTile/OptionsTile.js +11 -6
  87. package/es/components/PageHeader/PageHeader.js +1 -0
  88. package/es/components/SearchBar/SearchBar.d.ts +1 -1
  89. package/es/components/SearchBar/SearchBar.js +2 -2
  90. package/es/components/SidePanel/SidePanel.js +17 -21
  91. package/es/components/SidePanel/motion/variants.d.ts +4 -6
  92. package/es/components/SidePanel/motion/variants.js +10 -11
  93. package/es/components/Tearsheet/TearsheetShell.js +3 -1
  94. package/es/components/WebTerminal/WebTerminal.js +10 -12
  95. package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
  96. package/es/global/js/package-settings.d.ts +1 -1
  97. package/es/global/js/package-settings.js +1 -1
  98. package/es/settings.d.ts +1 -1
  99. package/lib/components/Coachmark/Coachmark.js +12 -7
  100. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  101. package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
  102. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  103. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +34 -21
  104. package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
  105. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  106. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
  107. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  108. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +22 -10
  109. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  110. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
  111. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
  112. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
  113. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +28 -15
  114. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  115. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  116. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  117. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +22 -20
  118. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
  119. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
  120. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  121. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
  122. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  123. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
  124. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
  125. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
  126. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
  127. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  128. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
  129. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  130. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -15
  131. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  132. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
  133. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  134. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
  135. package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  136. package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
  137. package/lib/components/ConditionBuilder/utils/util.js +0 -9
  138. package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
  139. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
  140. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
  141. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  142. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
  143. package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
  144. package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
  145. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
  146. package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
  147. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  148. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  149. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
  150. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
  151. package/lib/components/Datagrid/types/index.d.ts +28 -6
  152. package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
  153. package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
  154. package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
  155. package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
  156. package/lib/components/Datagrid/useRowExpander.js +1 -3
  157. package/lib/components/Datagrid/useSelectRows.js +2 -1
  158. package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
  159. package/lib/components/Datagrid/useStickyColumn.js +12 -9
  160. package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
  161. package/lib/components/EditInPlace/EditInPlace.js +21 -10
  162. package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
  163. package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
  164. package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
  165. package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
  166. package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
  167. package/lib/components/Nav/NavItem.js +10 -1
  168. package/lib/components/OptionsTile/OptionsTile.js +11 -6
  169. package/lib/components/PageHeader/PageHeader.js +1 -0
  170. package/lib/components/SearchBar/SearchBar.d.ts +1 -1
  171. package/lib/components/SearchBar/SearchBar.js +2 -2
  172. package/lib/components/SidePanel/SidePanel.js +16 -20
  173. package/lib/components/SidePanel/motion/variants.d.ts +4 -6
  174. package/lib/components/SidePanel/motion/variants.js +10 -11
  175. package/lib/components/Tearsheet/TearsheetShell.js +3 -1
  176. package/lib/components/WebTerminal/WebTerminal.js +10 -12
  177. package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
  178. package/lib/global/js/package-settings.d.ts +1 -1
  179. package/lib/global/js/package-settings.js +1 -1
  180. package/lib/settings.d.ts +1 -1
  181. package/package.json +4 -4
  182. package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
  183. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
  184. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
  185. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
  186. package/scss/components/Datagrid/_datagrid.scss +0 -4
  187. package/scss/components/HTTPErrors/_http-errors.scss +77 -0
  188. package/scss/components/OptionsTile/_options-tile.scss +6 -6
  189. package/scss/components/SidePanel/_side-panel.scss +1 -1
  190. package/scss/components/_index-released-only.scss +1 -0
  191. package/telemetry.yml +12 -2
  192. package/es/global/js/utils/window.d.ts +0 -2
  193. package/es/global/js/utils/window.js +0 -12
  194. package/lib/global/js/utils/window.d.ts +0 -2
  195. package/lib/global/js/utils/window.js +0 -16
@@ -6,11 +6,11 @@
6
6
  */
7
7
 
8
8
  import { slicedToArray as _slicedToArray, defineProperty as _defineProperty, objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useContext, useState, Fragment } from 'react';
9
+ import React__default, { useContext, useState, useRef, Fragment } from 'react';
10
10
  import ConditionBlock from '../ConditionBlock/ConditionBlock.js';
11
11
  import PropTypes from '../../../node_modules/prop-types/index.js';
12
12
  import cx from 'classnames';
13
- import { blockClass, translateWithId, statementConfig } from '../ConditionBuilderContext/DataConfigs.js';
13
+ import { blockClass, statementConfig } from '../ConditionBuilderContext/DataConfigs.js';
14
14
  import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
15
15
  import { focusThisField } from '../utils/util.js';
16
16
  import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.js';
@@ -18,8 +18,8 @@ import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBui
18
18
  import uuidv4 from '../../../global/js/utils/uuidv4.js';
19
19
  import ConditionPreview from '../ConditionPreview/ConditionPreview.js';
20
20
  import { ItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js';
21
+ import { useTranslations } from '../utils/useTranslations.js';
21
22
 
22
- var _ConditionPreview, _ConditionPreview2;
23
23
  /**
24
24
  *
25
25
  * state - this is the current group that is being rendered . This can be a inner group or outer group
@@ -28,12 +28,17 @@ var _ConditionPreview, _ConditionPreview2;
28
28
  */
29
29
 
30
30
  var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
31
+ var _ConditionPreview, _ConditionPreview2;
31
32
  var group = _ref.group,
32
33
  aria = _ref.aria,
33
34
  onRemove = _ref.onRemove,
34
35
  onChange = _ref.onChange,
35
36
  conditionBuilderRef = _ref.conditionBuilderRef,
36
37
  className = _ref.className;
38
+ var _useTranslations = useTranslations(['condition_builder_group', 'conditionText']),
39
+ _useTranslations2 = _slicedToArray(_useTranslations, 2),
40
+ conditionBuilderGroupText = _useTranslations2[0],
41
+ conditionText = _useTranslations2[1];
37
42
  var _useContext = useContext(ConditionBuilderContext),
38
43
  variant = _useContext.variant;
39
44
  var _useState = useState(-1),
@@ -44,14 +49,15 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
44
49
  _useState4 = _slicedToArray(_useState3, 2),
45
50
  showConditionSubGroupPreview = _useState4[0],
46
51
  setShowConditionSubGroupPreview = _useState4[1];
47
- var onRemoveHandler = function onRemoveHandler(conditionId, evt) {
52
+ var conditionBuilderContentRef = useRef();
53
+ var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
48
54
  if (group.conditions.length > 1) {
55
+ variant == 'tree' ? handleFocusOnCloseTree(evt) : handleFocusOnClose(evt, conditionIndex);
49
56
  onChange(_objectSpread2(_objectSpread2({}, group), {}, {
50
57
  conditions: group.conditions.filter(function (condition) {
51
58
  return conditionId !== condition.id;
52
59
  })
53
60
  }));
54
- handleFocusOnClose(evt);
55
61
  } else {
56
62
  onRemove(evt);
57
63
  }
@@ -74,11 +80,50 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
74
80
  conditions: [].concat(_toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _toConsumableArray(group.conditions.slice(conditionIndex + 1)))
75
81
  }));
76
82
  };
77
- var handleFocusOnClose = function handleFocusOnClose(e) {
78
- var _e$currentTarget;
79
- var previousClose = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.closest('[role="row"]')) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.previousSibling) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.querySelector('[data-name="closeCondition"]');
80
- if (previousClose) {
81
- previousClose.focus();
83
+ var handleFocusOnClose = function handleFocusOnClose(e, conditionIndex) {
84
+ var _e$currentTarget$clos;
85
+ //get all close buttons.
86
+ //if the last condition is closing, focus the second last one.
87
+ //or focus the next one.
88
+ 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
+ if (conditionIndex == currentGroupCloseButtons.length - 1) {
90
+ var _currentGroupCloseBut;
91
+ (_currentGroupCloseBut = currentGroupCloseButtons[conditionIndex - 1]) === null || _currentGroupCloseBut === void 0 || _currentGroupCloseBut.focus();
92
+ } else {
93
+ var _currentGroupCloseBut2;
94
+ (_currentGroupCloseBut2 = currentGroupCloseButtons[conditionIndex + 1]) === null || _currentGroupCloseBut2 === void 0 || _currentGroupCloseBut2.focus();
95
+ }
96
+ };
97
+ var handleFocusOnCloseTree = function handleFocusOnCloseTree(evt) {
98
+ var _evt$currentTarget, _evt$currentTarget2, _conditionBuilderCont, _conditionBuilderCont2;
99
+ //getting the current aria-level and aria-posinset.
100
+ var currentLevel = (_evt$currentTarget = evt.currentTarget) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.closest('[role="row"]')) === null || _evt$currentTarget === void 0 ? void 0 : _evt$currentTarget.getAttribute('aria-level');
101
+ var currentPos = (_evt$currentTarget2 = evt.currentTarget) === null || _evt$currentTarget2 === void 0 || (_evt$currentTarget2 = _evt$currentTarget2.closest('[role="row"]')) === null || _evt$currentTarget2 === void 0 ? void 0 : _evt$currentTarget2.getAttribute('aria-posinset');
102
+
103
+ //finding the next and previous items in same level
104
+ var nextElement = (_conditionBuilderCont = conditionBuilderContentRef.current) === null || _conditionBuilderCont === void 0 ? void 0 : _conditionBuilderCont.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) + 1, "\"]"));
105
+ var prevElement = (_conditionBuilderCont2 = conditionBuilderContentRef.current) === null || _conditionBuilderCont2 === void 0 ? void 0 : _conditionBuilderCont2.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) - 1, "\"]"));
106
+ //checking if next level is a valid condition. If then, focus the close button inside that condition
107
+ //Otherwise , check the previous item is a valid condition
108
+
109
+ 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();
112
+ } 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();
115
+ }
116
+ //If there are no valid condition in this group, focus next or previous row
117
+ else {
118
+ var _conditionBuilderCont3, _conditionBuilderCont4;
119
+ var prevRows = (_conditionBuilderCont3 = conditionBuilderContentRef.current) === null || _conditionBuilderCont3 === void 0 ? void 0 : _conditionBuilderCont3.querySelectorAll("[aria-level=\"".concat(Number(currentLevel) - 1, "\"][role=\"row\"]"));
120
+ var nextRow = (_conditionBuilderCont4 = conditionBuilderContentRef.current) === null || _conditionBuilderCont4 === void 0 ? void 0 : _conditionBuilderCont4.querySelector("[aria-level=\"".concat(Number(currentLevel) + 1, "\"][role=\"row\"]"));
121
+ if (nextRow) {
122
+ nextRow === null || nextRow === void 0 || nextRow.focus();
123
+ } 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();
126
+ }
82
127
  }
83
128
  };
84
129
  var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
@@ -113,7 +158,12 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
113
158
  setShowConditionPreview(-1);
114
159
  };
115
160
  var onStatementChangeHandler = function onStatementChangeHandler(updatedStatement) {
161
+ var _statementConfig$find;
162
+ var groupOperator = (_statementConfig$find = statementConfig.find(function (statement) {
163
+ return statement.id == updatedStatement;
164
+ })) === null || _statementConfig$find === void 0 ? void 0 : _statementConfig$find.connector;
116
165
  onChange(_objectSpread2(_objectSpread2({}, group), {}, {
166
+ groupOperator: groupOperator,
117
167
  statement: updatedStatement
118
168
  }));
119
169
  };
@@ -129,7 +179,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
129
179
  }, /*#__PURE__*/React__default.createElement("div", {
130
180
  className: "".concat(blockClass, "__condition-wrapper"),
131
181
  role: "grid",
132
- "aria-label": translateWithId('condition_builder_group')
182
+ "aria-label": conditionBuilderGroupText
133
183
  }, group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.map(function (eachCondition, conditionIndex) {
134
184
  return /*#__PURE__*/React__default.createElement("div", {
135
185
  key: eachCondition.id,
@@ -150,7 +200,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
150
200
  },
151
201
  addConditionHandler: addConditionHandler,
152
202
  onRemove: function onRemove(e) {
153
- onRemoveHandler(eachCondition.id, e);
203
+ onRemoveHandler(eachCondition.id, e, conditionIndex);
154
204
  },
155
205
  onConnectorOperatorChange: onConnectorOperatorChange,
156
206
  onStatementChange: onStatementChangeHandler,
@@ -163,7 +213,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
163
213
  return /*#__PURE__*/React__default.createElement("div", {
164
214
  className: "".concat(className, " ").concat(blockClass, "__condition-wrapper"),
165
215
  role: aria.level === 1 ? 'rowgroup' : undefined,
166
- "aria-label": aria.level == 1 ? translateWithId('condition_builder_group') : undefined
216
+ "aria-label": aria.level == 1 ? conditionBuilderGroupText : undefined,
217
+ ref: conditionBuilderContentRef
167
218
  }, /*#__PURE__*/React__default.createElement("div", {
168
219
  tabIndex: 0,
169
220
  role: "row",
@@ -172,14 +223,14 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
172
223
  "aria-setsize": aria.setsize
173
224
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
174
225
  label: group.statement,
175
- title: translateWithId('condition'),
226
+ title: conditionText,
176
227
  "data-name": "connectorField",
177
228
  popOverClassName: "".concat(blockClass, "__gap"),
178
229
  className: "".concat(blockClass, "__statement-button")
179
230
  }, /*#__PURE__*/React__default.createElement(ItemOption, {
180
231
  conditionState: {
181
232
  value: group.statement,
182
- label: translateWithId('condition')
233
+ label: conditionText
183
234
  },
184
235
  onChange: function onChange(v, evt) {
185
236
  focusThisField(evt);
@@ -243,9 +294,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
243
294
  hideConditionPreviewHandler: hideConditionPreviewHandler,
244
295
  isLastCondition: isLastCondition
245
296
  })), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default.createElement(ConditionPreview, {
246
- previewType: "subGroup"
297
+ previewType: "subGroup",
298
+ group: group
247
299
  }))), conditionIndex == showConditionPreview && (_ConditionPreview2 || (_ConditionPreview2 = /*#__PURE__*/React__default.createElement(ConditionPreview, {
248
- previewType: "condition"
300
+ previewType: "condition",
301
+ group: group
249
302
  }))));
250
303
  }));
251
304
  };
@@ -1,9 +1,11 @@
1
1
  export default ConditionPreview;
2
- declare function ConditionPreview({ previewType }: {
2
+ declare function ConditionPreview({ previewType, group }: {
3
3
  previewType: any;
4
+ group: any;
4
5
  }): import("react/jsx-runtime").JSX.Element;
5
6
  declare namespace ConditionPreview {
6
7
  namespace propTypes {
8
+ let group: PropTypes.Requireable<object>;
7
9
  let previewType: PropTypes.Requireable<string>;
8
10
  }
9
11
  }
@@ -9,33 +9,46 @@ import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } fr
9
9
  import React__default, { useState, useEffect } from 'react';
10
10
  import cx from 'classnames';
11
11
  import PropTypes from '../../../node_modules/prop-types/index.js';
12
- import { blockClass, translateWithId } from '../ConditionBuilderContext/DataConfigs.js';
12
+ import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
13
13
  import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
14
14
  import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.js';
15
+ import { useTranslations } from '../utils/useTranslations.js';
16
+ import { Bee } from '@carbon/react/icons';
15
17
 
16
18
  var ConditionPreview = function ConditionPreview(_ref) {
17
- var previewType = _ref.previewType;
19
+ var _ConditionBuilderItem, _ConditionBuilderItem2, _ConditionBuilderItem3;
20
+ var previewType = _ref.previewType,
21
+ group = _ref.group;
18
22
  var _useState = useState(false),
19
23
  _useState2 = _slicedToArray(_useState, 2),
20
24
  animate = _useState2[0],
21
25
  setAnimate = _useState2[1];
26
+ var _useTranslations = useTranslations(['valueText', 'operatorText', 'propertyText', 'ifText']),
27
+ _useTranslations2 = _slicedToArray(_useTranslations, 4),
28
+ propertyText = _useTranslations2[0],
29
+ operatorText = _useTranslations2[1],
30
+ valueText = _useTranslations2[2],
31
+ ifText = _useTranslations2[3];
22
32
  useEffect(function () {
23
33
  setAnimate(true);
24
34
  }, []);
25
35
  var getConditionSection = function getConditionSection() {
26
- return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
27
- label: translateWithId('property')
28
- }), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
29
- label: translateWithId('operator')
30
- }), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
31
- label: translateWithId('value')
32
- }));
36
+ return /*#__PURE__*/React__default.createElement("div", {
37
+ className: "".concat(blockClass, "__preview-condition")
38
+ }, _ConditionBuilderItem || (_ConditionBuilderItem = /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
39
+ label: propertyText,
40
+ renderIcon: Bee
41
+ })), _ConditionBuilderItem2 || (_ConditionBuilderItem2 = /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
42
+ label: operatorText
43
+ })), _ConditionBuilderItem3 || (_ConditionBuilderItem3 = /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
44
+ label: valueText
45
+ })));
33
46
  };
34
47
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, previewType == 'newGroup' && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
35
48
  className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
36
49
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
37
50
  className: "".concat(blockClass, "__statement-button"),
38
- label: translateWithId('and')
51
+ label: group.groupOperator
39
52
  })), /*#__PURE__*/React__default.createElement("div", {
40
53
  "aria-hidden": true,
41
54
  className: cx(["".concat(blockClass, "__group ").concat(blockClass, "__condition-wrapper ").concat(blockClass, "__group-preview ").concat(blockClass, "__group-wrapper "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
@@ -43,32 +56,36 @@ var ConditionPreview = function ConditionPreview(_ref) {
43
56
  className: "".concat(blockClass, "__gap")
44
57
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
45
58
  className: "".concat(blockClass, "__statement-button"),
46
- label: translateWithId('if')
59
+ label: ifText
47
60
  })), getConditionSection())), previewType == 'subGroup' && /*#__PURE__*/React__default.createElement("div", {
48
61
  className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
49
62
  }, /*#__PURE__*/React__default.createElement("div", {
50
63
  className: "".concat(blockClass, "__condition-block ").concat(blockClass, "__gap")
51
64
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
52
- label: translateWithId('and'),
65
+ label: group.groupOperator,
53
66
  className: "".concat(blockClass, "__statement-button"),
54
67
  popOverClassName: "".concat(blockClass, "__gap")
55
68
  }), /*#__PURE__*/React__default.createElement("div", {
56
69
  className: "".concat(blockClass, "__group ").concat(blockClass, "__condition-wrapper")
57
70
  }, /*#__PURE__*/React__default.createElement(ConditionConnector, {
58
71
  className: "".concat(blockClass, "__gap ").concat(blockClass, "__groupConnector"),
59
- operator: translateWithId('if')
72
+ operator: ifText
60
73
  }), getConditionSection()))), previewType == 'condition' && /*#__PURE__*/React__default.createElement("div", {
61
74
  className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
62
75
  }, /*#__PURE__*/React__default.createElement("div", {
63
76
  className: "".concat(blockClass, "__condition-block ").concat(blockClass, "__gap")
64
77
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
65
- label: translateWithId('and'),
78
+ label: group.groupOperator,
66
79
  className: "".concat(blockClass, "__statement-button"),
67
80
  popOverClassName: "".concat(blockClass, "__gap")
68
81
  }), getConditionSection())));
69
82
  };
70
83
  var ConditionPreview$1 = ConditionPreview;
71
84
  ConditionPreview.propTypes = {
85
+ /**
86
+ * current conditional group
87
+ */
88
+ group: PropTypes.object,
72
89
  /**
73
90
  * type of review to be displayed
74
91
  */
@@ -1 +1 @@
1
- export function handleKeyDown(evt: any, conditionBuilderRef: any): void;
1
+ export function handleKeyDown(evt: any, conditionBuilderRef: any, variant: any): void;
@@ -7,16 +7,24 @@
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 } from './util.js';
10
+ import { checkForHoldingKey, focusThisField, traverseReverse, traverseClockVise, focusThisItem } from './util.js';
11
11
 
12
- var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
12
+ var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef, variant) {
13
13
  var activeElement = document.activeElement;
14
+ if (excludeKeyPress(evt)) {
15
+ return;
16
+ }
14
17
  if (activeElement.closest("[role=\"dialog\"]")) {
15
18
  handleKeyPressForPopover(evt, activeElement.closest("[role=\"dialog\"]"));
16
19
  } else {
17
- handleKeyPressForMainContent(evt, conditionBuilderRef);
20
+ handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
18
21
  }
19
22
  };
23
+ //skipping keyboard handling for date and time fields to get take carbon's
24
+ 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));
27
+ };
20
28
  var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
21
29
  var _parentContainer$quer;
22
30
  var key = evt.key;
@@ -62,8 +70,8 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
62
70
  if (document.activeElement.type !== 'button') {
63
71
  var _document$activeEleme2;
64
72
  //for button , enter key is click which already handled by framework, else trigger click
65
- (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
66
73
  focusThisField(evt);
74
+ (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
67
75
  }
68
76
  }
69
77
  break;
@@ -73,8 +81,70 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
73
81
  break;
74
82
  }
75
83
  };
84
+ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
85
+ switch (evt.key) {
86
+ case 'ArrowRight':
87
+ evt.preventDefault();
88
+ 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
+ //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
+ } else {
101
+ //finding the next cell to be focussed
102
+ //next cell = current cell index + 1
103
+
104
+ var currentItemIndex = allCellsInRow.indexOf(evt.target);
105
+ if (currentItemIndex < allCellsInRow.length - 1) {
106
+ focusThisItem(allCellsInRow[currentItemIndex + 1]);
107
+ }
108
+ }
109
+ } else {
110
+ handleCellNavigation(evt, conditionBuilderRef);
111
+ }
112
+ break;
113
+ case 'ArrowLeft':
114
+ evt.preventDefault();
115
+ if (variant == 'tree') {
116
+ if (evt.target.getAttribute('role') !== 'row') {
117
+ var _evt$target$closest4;
118
+ //when any cell is focussed, arrow left will select the previous cell or current row
119
+
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);
122
+ if (_currentItemIndex > 0) {
123
+ focusThisItem(allItems[_currentItemIndex - 1]);
124
+ } else {
125
+ //focus the row
126
+ var wrapper = evt.target.closest("[role=\"row\"]");
127
+ wrapper.focus();
128
+ }
129
+ }
130
+ } else {
131
+ handleCellNavigation(evt, conditionBuilderRef);
132
+ }
133
+ break;
134
+ case 'ArrowUp':
135
+ case 'ArrowDown':
136
+ evt.preventDefault();
137
+ if (variant == 'tree') {
138
+ handleRowNavigationTree(evt, conditionBuilderRef, variant);
139
+ } else {
140
+ handleRowNavigation(evt, conditionBuilderRef, variant);
141
+ }
142
+ break;
143
+ }
144
+ };
76
145
  var getRows = function getRows(conditionBuilderRef) {
77
- return Array.from(conditionBuilderRef.current.querySelectorAll('[role="row"]'));
146
+ var _conditionBuilderRef$;
147
+ return Array.from((_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 ? void 0 : _conditionBuilderRef$.querySelectorAll('[role="row"]'));
78
148
  };
79
149
  var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
80
150
  var rows = getRows(conditionBuilderRef);
@@ -82,14 +152,39 @@ var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
82
152
  return row.contains(element);
83
153
  });
84
154
  };
85
- var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef) {
155
+ var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef, variant) {
86
156
  var rows = getRows(conditionBuilderRef);
87
157
  var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
88
- navigateToNextRowCell(evt, currentRowIndex, rows);
158
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant);
89
159
  };
90
- var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows) {
91
- var _nextRow$querySelecto;
92
- //when the focussed element is a cell of the row which has only 1 cell (connector or statement) , focus the next row
160
+ function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
161
+ var rows = getRows(conditionBuilderRef);
162
+ var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
163
+ var nextRowIndex = currentRowIndex;
164
+ if (evt.target.getAttribute('role') == 'row') {
165
+ if (['ArrowDown', 'ArrowRight'].includes(evt.key)) {
166
+ nextRowIndex += 1;
167
+ } else if (evt.key === 'ArrowUp') {
168
+ nextRowIndex -= 1;
169
+ }
170
+
171
+ //maintaining selection for first and last rows
172
+ if (nextRowIndex < 0) {
173
+ nextRowIndex = 0;
174
+ } else if (nextRowIndex >= rows.length) {
175
+ nextRowIndex = rows.length - 1;
176
+ }
177
+ if (nextRowIndex !== currentRowIndex) {
178
+ rows[currentRowIndex].setAttribute('tabindex', '-1');
179
+ rows[nextRowIndex].setAttribute('tabindex', '0');
180
+ rows[nextRowIndex].focus();
181
+ }
182
+ } else {
183
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant);
184
+ }
185
+ }
186
+ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant) {
187
+ //when the current focussed element is a cell of any row, arrow up/down will focus the next row same cell.
93
188
 
94
189
  var nextRowIndex = currentRowIndex;
95
190
  if (evt.key === 'ArrowUp') {
@@ -100,25 +195,22 @@ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex,
100
195
  }
101
196
  var nextRow = rows[nextRowIndex];
102
197
  var itemName = evt.target.dataset.name;
103
- nextRow === null || nextRow === void 0 || (_nextRow$querySelecto = nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) === null || _nextRow$querySelecto === void 0 || _nextRow$querySelecto.focus();
104
- };
105
- var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef) {
106
- switch (evt.key) {
107
- case 'ArrowRight':
108
- case 'ArrowLeft':
109
- conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
110
- if (evt.key === 'ArrowRight') {
111
- traverseClockVise(eachElem, index, allElements);
112
- } else {
113
- traverseReverse(eachElem, index, allElements);
114
- }
115
- });
116
- break;
117
- case 'ArrowUp':
118
- case 'ArrowDown':
119
- handleRowNavigation(evt, conditionBuilderRef);
120
- break;
198
+ 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();
201
+ } else if (variant === 'tree') {
202
+ //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();
121
204
  }
122
205
  };
206
+ var handleCellNavigation = function handleCellNavigation(evt, conditionBuilderRef) {
207
+ conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
208
+ if (evt.key === 'ArrowRight') {
209
+ traverseClockVise(eachElem, index, allElements);
210
+ } else {
211
+ traverseReverse(eachElem, index, allElements);
212
+ }
213
+ });
214
+ };
123
215
 
124
216
  export { handleKeyDown };
@@ -0,0 +1 @@
1
+ export function useTranslations(translationKeys: any): any;
@@ -0,0 +1,26 @@
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
+
8
+ import { useContext } from 'react';
9
+ import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
10
+ import { translationsObject } from '../ConditionBuilderContext/translationObject.js';
11
+
12
+ var useTranslations = function useTranslations(translationKeys) {
13
+ var _useContext = useContext(ConditionBuilderContext),
14
+ translateWithId = _useContext.translateWithId;
15
+ return translationKeys.map(function (translationKey) {
16
+ if (translateWithId !== null && translateWithId !== void 0 && translateWithId(translationKey)) {
17
+ return translateWithId(translationKey);
18
+ } else if (translationsObject[translationKey]) {
19
+ return translationsObject[translationKey];
20
+ } else {
21
+ return translationKey;
22
+ }
23
+ });
24
+ };
25
+
26
+ export { useTranslations };
@@ -48,13 +48,5 @@ var checkForHoldingKey = function checkForHoldingKey(evt, key) {
48
48
  }
49
49
  return evt[key];
50
50
  };
51
- var checkDuplicateAction = function checkDuplicateAction(actionState, selectedId, currentActionId) {
52
- if (selectedId !== currentActionId && actionState.find(function (eachAction) {
53
- return eachAction.id === selectedId;
54
- })) {
55
- return true;
56
- }
57
- return false;
58
- };
59
51
 
60
- export { checkDuplicateAction, checkForHoldingKey, focusThisField, focusThisItem, traverseClockVise, traverseReverse };
52
+ export { checkForHoldingKey, focusThisField, focusThisItem, traverseClockVise, traverseReverse };
@@ -89,6 +89,7 @@ var CreateFullPage = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
89
89
  _useState10 = _slicedToArray(_useState9, 2),
90
90
  modalIsOpen = _useState10[0],
91
91
  setModalIsOpen = _useState10[1];
92
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
92
93
  var previousState = usePreviousValue({
93
94
  currentStep: currentStep,
94
95
  open: open
@@ -146,8 +147,7 @@ var CreateFullPage = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
146
147
  useResetCreateComponent({
147
148
  firstIncludedStep: firstIncludedStep,
148
149
  previousState: previousState,
149
- /**@ts-ignore */
150
- open: open,
150
+ open: true,
151
151
  setCurrentStep: setCurrentStep,
152
152
  stepData: stepData,
153
153
  /**@ts-ignore */
@@ -20,6 +20,10 @@ interface DataSpreadsheetProps {
20
20
  * The data that will build the column headers
21
21
  */
22
22
  columns?: readonly Column<object>[];
23
+ /**
24
+ * Disable column swapping, default false
25
+ */
26
+ disableColumnSwapping?: boolean;
23
27
  /**
24
28
  * The spreadsheet data that will be rendered in the body of the spreadsheet component
25
29
  */
@@ -50,6 +54,10 @@ interface DataSpreadsheetProps {
50
54
  * The event handler that is called when the selection area values change
51
55
  */
52
56
  onSelectionAreaChange?: () => void;
57
+ /**
58
+ * Read-only table
59
+ */
60
+ readOnlyTable?: boolean;
53
61
  /**
54
62
  * Position of the custom row numbering component
55
63
  */