@carbon/ibm-products 2.44.0 → 2.45.0-rc.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 (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 +25 -7
  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 +25 -7
  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
@@ -16,12 +16,13 @@ var index = require('../../../node_modules/prop-types/index.js');
16
16
  var icons = require('@carbon/react/icons');
17
17
  var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
18
18
  var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
19
+ var useTranslations = require('../utils/useTranslations.js');
19
20
 
20
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
22
 
22
23
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
24
 
24
- var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config"];
25
+ var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren"];
25
26
  var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
26
27
  var children = _ref.children,
27
28
  className = _ref.className,
@@ -33,23 +34,36 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
33
34
  condition = _ref.condition,
34
35
  popOverClassName = _ref.popOverClassName,
35
36
  config = _ref.config,
37
+ renderChildren = _ref.renderChildren,
36
38
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
37
39
  var contentRef = React.useRef(null);
40
+ var popoverRef = React.useRef(null);
38
41
  var _useState = React.useState(false),
39
42
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
40
43
  open = _useState2[0],
41
44
  setOpen = _useState2[1];
45
+ var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', label, 'invalidDateText']),
46
+ _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 4),
47
+ invalidText = _useTranslations2[0],
48
+ addConditionText = _useTranslations2[1],
49
+ labelText = _useTranslations2[2],
50
+ invalidDateText = _useTranslations2[3];
42
51
  var getPropertyDetails = function getPropertyDetails() {
43
52
  if (label === 'INVALID') {
44
53
  return {
45
- propertyLabel: DataConfigs.translateWithId('invalid_text'),
54
+ propertyLabel: invalidText,
55
+ isInvalid: true
56
+ };
57
+ } else if (label === 'INVALID_DATE') {
58
+ return {
59
+ propertyLabel: invalidDateText,
46
60
  isInvalid: true
47
61
  };
48
62
  }
49
- var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) : label;
63
+ var propertyId = rest['data-name'] == 'valueField' && type ? DataConfigs.valueRenderers[type](label, config) : labelText;
50
64
  return {
51
65
  isInvalid: false,
52
- propertyLabel: DataConfigs.translateWithId(propertyId)
66
+ propertyLabel: propertyId
53
67
  };
54
68
  };
55
69
  var _getPropertyDetails = getPropertyDetails(),
@@ -65,60 +79,68 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
65
79
  //if any condition is changed, state prop is triggered
66
80
  if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
67
81
  // close the previous popover
68
- setOpen(false);
69
- } else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'one_of') {
82
+ closePopover();
83
+ } else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'oneOf') {
70
84
  //close the current popover if the field is valueField and is a single select dropdown. For all other inputs ,popover need to be open on value changes.
71
- setOpen(false);
85
+ closePopover();
72
86
  }
73
87
  if (condition.popoverToOpen == currentField) {
74
88
  //current popover need to be opened
75
- setOpen(true);
89
+ openPopOver();
76
90
  }
77
91
  } else {
78
92
  // when we change any statement(if/ excl.if) which is not part of condition state, label change is triggered.
79
93
  //close popOver when statement is changed.
80
- setOpen(false);
94
+ closePopover();
81
95
  }
82
96
  // eslint-disable-next-line react-hooks/exhaustive-deps
83
97
  }, [condition, label]);
84
98
  React.useEffect(function () {
85
99
  //this will focus the first input field in the popover
86
100
  if (open && contentRef.current) {
87
- var firstFocusableElement = contentRef.current.querySelector('input');
101
+ var firstFocusableElement = contentRef.current.querySelector('input,textarea');
88
102
  if (firstFocusableElement) {
89
103
  firstFocusableElement.focus();
90
104
  }
91
105
  }
92
106
  }, [contentRef, open]);
107
+ var closePopover = function closePopover() {
108
+ return setOpen(false);
109
+ };
110
+ var openPopOver = function openPopOver() {
111
+ return setOpen(true);
112
+ };
113
+ var togglePopover = function togglePopover() {
114
+ return setOpen(!open);
115
+ };
93
116
  return /*#__PURE__*/React__default["default"].createElement(react.Popover, {
94
117
  open: open,
95
118
  isTabTip: true,
96
119
  role: "gridcell",
97
120
  className: popOverClassName,
98
- onRequestClose: function onRequestClose() {
99
- setOpen(false);
100
- }
121
+ ref: popoverRef,
122
+ onRequestClose: closePopover
101
123
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
102
- label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : DataConfigs.translateWithId('add_condition'),
124
+ label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : addConditionText,
103
125
  hideLabel: !label ? true : false,
104
- onClick: function onClick() {
105
- children ? setOpen(!open) : null;
106
- },
126
+ onClick: togglePopover,
107
127
  className: className,
108
128
  "aria-haspopup": true,
109
129
  "aria-expanded": open,
110
130
  renderIcon: renderIcon ? renderIcon : label == undefined ? icons.Add : null,
111
131
  showToolTip: showToolTip,
112
- isInvalid: isInvalid
113
- }, rest)), /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
132
+ isInvalid: isInvalid,
133
+ condition: condition
134
+ }, rest)), open && /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
114
135
  className: "".concat(DataConfigs.blockClass, "__item__content"),
115
136
  role: "dialog",
116
- "aria-label": "".concat(title)
137
+ "aria-label": title
117
138
  }, /*#__PURE__*/React__default["default"].createElement(react.Layer, null, /*#__PURE__*/React__default["default"].createElement("h1", {
118
139
  className: "".concat(DataConfigs.blockClass, "__item__title")
119
140
  }, title), /*#__PURE__*/React__default["default"].createElement("div", {
120
- ref: contentRef
121
- }, open && children))));
141
+ ref: contentRef,
142
+ className: "".concat(DataConfigs.blockClass, "__popover-content")
143
+ }, renderChildren ? renderChildren(popoverRef) : children))));
122
144
  };
123
145
  ConditionBuilderItem.propTypes = {
124
146
  /**
@@ -146,6 +168,10 @@ ConditionBuilderItem.propTypes = {
146
168
  * class name for popover
147
169
  */
148
170
  popOverClassName: index["default"].string,
171
+ /**
172
+ * callback prop that returns the jsx for children
173
+ */
174
+ renderChildren: index["default"].func,
149
175
  /**
150
176
  * Optional prop to allow overriding the icon rendering.
151
177
  */
@@ -1,11 +1,13 @@
1
- export function ConditionBuilderItemDate({ conditionState, onChange }: {
1
+ export function ConditionBuilderItemDate({ conditionState, onChange, parentRef, }: {
2
2
  conditionState: any;
3
3
  onChange: any;
4
+ parentRef: any;
4
5
  }): import("react/jsx-runtime").JSX.Element;
5
6
  export namespace ConditionBuilderItemDate {
6
7
  namespace propTypes {
7
8
  let conditionState: PropTypes.Requireable<object>;
8
9
  let onChange: PropTypes.Requireable<(...args: any[]) => any>;
10
+ let parentRef: PropTypes.Requireable<object>;
9
11
  }
10
12
  }
11
13
  import PropTypes from 'prop-types';
@@ -9,11 +9,12 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var react = require('@carbon/react');
14
15
  var settings = require('../../../../settings.js');
15
16
  var index = require('../../../../node_modules/prop-types/index.js');
16
- var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
17
+ var useTranslations = require('../../utils/useTranslations.js');
17
18
 
18
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
20
 
@@ -22,17 +23,26 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
23
  var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
23
24
  var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
24
25
  var conditionState = _ref.conditionState,
25
- onChange = _ref.onChange;
26
+ onChange = _ref.onChange,
27
+ parentRef = _ref.parentRef;
26
28
  var DatePickerInputRef = React.useRef();
29
+ var _useTranslations = useTranslations.useTranslations(['startText', 'endText']),
30
+ _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
31
+ startText = _useTranslations2[0],
32
+ endText = _useTranslations2[1];
27
33
  var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
34
+ var onCloseHandler = function onCloseHandler(selectedDate) {
35
+ onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID_DATE');
36
+ };
28
37
  return /*#__PURE__*/React__default["default"].createElement("div", {
29
38
  className: "".concat(blockClass, "__item-date ")
30
39
  }, datePickerType == 'single' && /*#__PURE__*/React__default["default"].createElement(react.DatePicker, {
31
40
  ref: DatePickerInputRef,
32
41
  dateFormat: "d/m/Y",
33
42
  datePickerType: "single",
34
- onClose: onChange,
35
- value: conditionState.value
43
+ value: conditionState.value,
44
+ onClose: onCloseHandler,
45
+ appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
36
46
  }, /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
37
47
  id: "datePicker",
38
48
  placeholder: "dd/mm/yyyy",
@@ -41,16 +51,17 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
41
51
  ref: DatePickerInputRef,
42
52
  dateFormat: "d/m/Y",
43
53
  datePickerType: datePickerType,
44
- onClose: onChange,
45
- value: conditionState.value
54
+ onClose: onCloseHandler,
55
+ value: conditionState.value,
56
+ appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
46
57
  }, /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
47
58
  id: "datePickerStart",
48
59
  placeholder: "dd/mm/yyyy",
49
- labelText: DataConfigs.translateWithId('start')
60
+ labelText: startText
50
61
  }), /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, {
51
62
  id: "datePickerEnd",
52
63
  placeholder: "dd/mm/yyyy",
53
- labelText: DataConfigs.translateWithId('end')
64
+ labelText: endText
54
65
  })));
55
66
  };
56
67
  ConditionBuilderItemDate.propTypes = {
@@ -61,7 +72,11 @@ ConditionBuilderItemDate.propTypes = {
61
72
  /**
62
73
  * callback to update state oin date change
63
74
  */
64
- onChange: index["default"].func
75
+ onChange: index["default"].func,
76
+ /**
77
+ * reference to the popover node
78
+ */
79
+ parentRef: index["default"].object
65
80
  };
66
81
 
67
82
  exports.ConditionBuilderItemDate = ConditionBuilderItemDate;
@@ -9,10 +9,12 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var react = require('@carbon/react');
14
15
  var index = require('../../../../node_modules/prop-types/index.js');
15
16
  var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
17
+ var useTranslations = require('../../utils/useTranslations.js');
16
18
 
17
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
20
 
@@ -23,9 +25,12 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
23
25
  var conditionState = _ref.conditionState,
24
26
  config = _ref.config,
25
27
  onChange = _ref.onChange;
28
+ var _useTranslations = useTranslations.useTranslations(['invalidNumberWarnText']),
29
+ _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 1),
30
+ invalidNumberWarnText = _useTranslations2[0];
26
31
  var onChangeHandler = function onChangeHandler(e, _ref2) {
27
32
  var value = _ref2.value;
28
- if (checkIfValid(value)) {
33
+ if (!isNaN(value) && checkIfValid(value)) {
29
34
  var _config$unit;
30
35
  onChange("".concat(value, " ").concat((_config$unit = config.unit) !== null && _config$unit !== void 0 ? _config$unit : ''));
31
36
  } else {
@@ -44,18 +49,16 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
44
49
  };
45
50
  return /*#__PURE__*/React__default["default"].createElement("div", {
46
51
  className: "".concat(DataConfigs.blockClass, "__item-number")
47
- }, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, {
52
+ }, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, _rollupPluginBabelHelpers["extends"]({
48
53
  label: conditionState.property,
49
54
  hideLabel: true,
50
- defaultValue: getDefaultValue(),
51
55
  id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
52
- min: config.min,
53
- max: config.max,
54
- step: config.step,
55
- invalidText: DataConfigs.translateWithId('text_invalid_number'),
56
+ invalidText: invalidNumberWarnText,
56
57
  allowEmpty: true,
57
58
  onChange: onChangeHandler
58
- }));
59
+ }, config, {
60
+ defaultValue: getDefaultValue()
61
+ })));
59
62
  };
60
63
  ConditionBuilderItemNumber.propTypes = {
61
64
  /**
@@ -16,6 +16,7 @@ var icons = require('@carbon/react/icons');
16
16
  var index = require('../../../../node_modules/prop-types/index.js');
17
17
  var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionBuilderProvider.js');
18
18
  var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
19
+ var useTranslations = require('../../utils/useTranslations.js');
19
20
 
20
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
22
 
@@ -30,6 +31,10 @@ var ItemOption = function ItemOption(_ref) {
30
31
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
31
32
  popOverSearchThreshold = _useContext.popOverSearchThreshold;
32
33
  var contentRef = React.useRef();
34
+ var _useTranslations = useTranslations.useTranslations(['propertyText', 'clearSearchText']),
35
+ _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
36
+ propertyText = _useTranslations2[0],
37
+ clearSearchText = _useTranslations2[1];
33
38
  var allOptions = config.options;
34
39
  var _useState = React.useState(''),
35
40
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
@@ -57,7 +62,7 @@ var ItemOption = function ItemOption(_ref) {
57
62
  setSearchValue(value);
58
63
  };
59
64
  var getAriaLabel = function getAriaLabel() {
60
- return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property');
65
+ return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : propertyText;
61
66
  };
62
67
  if (!allOptions) {
63
68
  return;
@@ -69,8 +74,8 @@ var ItemOption = function ItemOption(_ref) {
69
74
  className: "".concat(DataConfigs.blockClass, "__item-option__search")
70
75
  }, /*#__PURE__*/React__default["default"].createElement(react.Search, {
71
76
  size: "sm",
72
- labelText: DataConfigs.translateWithId('clear_search'),
73
- closeButtonLabelText: DataConfigs.translateWithId('clear_search'),
77
+ labelText: clearSearchText,
78
+ closeButtonLabelText: clearSearchText,
74
79
  onChange: onSearchChangeHandler
75
80
  })), /*#__PURE__*/React__default["default"].createElement("ul", {
76
81
  "aria-label": getAriaLabel(),
@@ -16,6 +16,7 @@ var icons = require('@carbon/react/icons');
16
16
  var index = require('../../../../node_modules/prop-types/index.js');
17
17
  var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionBuilderProvider.js');
18
18
  var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
19
+ var useTranslations = require('../../utils/useTranslations.js');
19
20
 
20
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
22
 
@@ -28,11 +29,15 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
28
29
  _ref$config = _ref.config,
29
30
  config = _ref$config === void 0 ? {} : _ref$config,
30
31
  onChange = _ref.onChange;
31
- var multiSelectable = conditionState.operator === 'one_of';
32
+ var multiSelectable = conditionState.operator === 'oneOf';
32
33
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
33
34
  popOverSearchThreshold = _useContext.popOverSearchThreshold,
34
35
  getOptions = _useContext.getOptions,
35
36
  rootState = _useContext.rootState;
37
+ var _useTranslations = useTranslations.useTranslations(['propertyText', 'clearSearchText']),
38
+ _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
39
+ propertyText = _useTranslations2[0],
40
+ clearSearchText = _useTranslations2[1];
36
41
  var contentRef = React.useRef();
37
42
  var _useState = React.useState(config.options),
38
43
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
@@ -130,7 +135,7 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
130
135
  }
131
136
  };
132
137
  var getAriaLabel = function getAriaLabel() {
133
- return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property');
138
+ return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : propertyText;
134
139
  };
135
140
  if (!allOptions) {
136
141
  return _SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null));
@@ -142,8 +147,8 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
142
147
  className: "".concat(DataConfigs.blockClass, "__item-option__search")
143
148
  }, /*#__PURE__*/React__default["default"].createElement(react.Search, {
144
149
  size: "sm",
145
- labelText: DataConfigs.translateWithId('clear_search'),
146
- closeButtonLabelText: DataConfigs.translateWithId('clear_search'),
150
+ labelText: clearSearchText,
151
+ closeButtonLabelText: clearSearchText,
147
152
  onChange: onSearchChangeHandler
148
153
  })), multiSelectable && /*#__PURE__*/React__default["default"].createElement("div", {
149
154
  className: "".concat(DataConfigs.blockClass, "__multiselectSelectionStatusContainer")
@@ -1,11 +1,15 @@
1
- export function ConditionBuilderItemText({ conditionState, onChange }: {
1
+ export function ConditionBuilderItemText({ conditionState, onChange, config, type, }: {
2
2
  conditionState: any;
3
3
  onChange: any;
4
+ config: any;
5
+ type: any;
4
6
  }): import("react/jsx-runtime").JSX.Element;
5
7
  export namespace ConditionBuilderItemText {
6
8
  namespace propTypes {
7
9
  let conditionState: PropTypes.Requireable<object>;
10
+ let config: PropTypes.Requireable<object>;
8
11
  let onChange: PropTypes.Requireable<(...args: any[]) => any>;
12
+ let type: PropTypes.Requireable<string>;
9
13
  }
10
14
  }
11
15
  import PropTypes from 'prop-types';
@@ -9,6 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var react = require('@carbon/react');
14
15
  var index = require('../../../../node_modules/prop-types/index.js');
@@ -21,10 +22,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
22
  var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
22
23
  var _conditionState$value, _conditionState$prope;
23
24
  var conditionState = _ref.conditionState,
24
- _onChange = _ref.onChange;
25
- return /*#__PURE__*/React__default["default"].createElement("div", {
26
- className: "".concat(DataConfigs.blockClass, "__item-text")
27
- }, /*#__PURE__*/React__default["default"].createElement(react.TextInput, {
25
+ _onChange = _ref.onChange,
26
+ config = _ref.config,
27
+ type = _ref.type;
28
+ var inputProps = _rollupPluginBabelHelpers.objectSpread2({
28
29
  labelText: conditionState.property,
29
30
  hideLabel: true,
30
31
  value: (_conditionState$value = conditionState.value) !== null && _conditionState$value !== void 0 ? _conditionState$value : '',
@@ -32,17 +33,28 @@ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
32
33
  onChange: function onChange(evt) {
33
34
  _onChange(evt.target.value);
34
35
  }
35
- }));
36
+ }, config);
37
+ return /*#__PURE__*/React__default["default"].createElement("div", {
38
+ className: "".concat(DataConfigs.blockClass, "__item-text")
39
+ }, type == 'textarea' ? /*#__PURE__*/React__default["default"].createElement(react.TextArea, inputProps) : /*#__PURE__*/React__default["default"].createElement(react.TextInput, inputProps));
36
40
  };
37
41
  ConditionBuilderItemText.propTypes = {
38
42
  /**
39
43
  * current condition object
40
44
  */
41
45
  conditionState: index["default"].object,
46
+ /**
47
+ * config of the current property
48
+ */
49
+ config: index["default"].object,
42
50
  /**
43
51
  * callback to update state oin date change
44
52
  */
45
- onChange: index["default"].func
53
+ onChange: index["default"].func,
54
+ /**
55
+ * current input type
56
+ */
57
+ type: index["default"].string
46
58
  };
47
59
 
48
60
  exports.ConditionBuilderItemText = ConditionBuilderItemText;
@@ -66,7 +66,7 @@ var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
66
66
  value: "PM",
67
67
  text: "PM"
68
68
  }))), /*#__PURE__*/React__default["default"].createElement(react.TimePickerSelect, {
69
- id: "time-picker-select-2",
69
+ id: "time-picker-time-zone",
70
70
  onChange: setTimeZone
71
71
  }, config === null || config === void 0 || (_config$timeZones2 = config.timeZones) === null || _config$timeZones2 === void 0 ? void 0 : _config$timeZones2.map(function (timeZone, index) {
72
72
  return /*#__PURE__*/React__default["default"].createElement(react.SelectItem, {
@@ -22,13 +22,13 @@ var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuil
22
22
  var uuidv4 = require('../../../global/js/utils/uuidv4.js');
23
23
  var ConditionPreview = require('../ConditionPreview/ConditionPreview.js');
24
24
  var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
25
+ var useTranslations = require('../utils/useTranslations.js');
25
26
 
26
27
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
28
 
28
29
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
30
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
30
31
 
31
- var _ConditionPreview, _ConditionPreview2;
32
32
  /**
33
33
  *
34
34
  * state - this is the current group that is being rendered . This can be a inner group or outer group
@@ -37,12 +37,17 @@ var _ConditionPreview, _ConditionPreview2;
37
37
  */
38
38
 
39
39
  var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
40
+ var _ConditionPreview, _ConditionPreview2;
40
41
  var group = _ref.group,
41
42
  aria = _ref.aria,
42
43
  onRemove = _ref.onRemove,
43
44
  onChange = _ref.onChange,
44
45
  conditionBuilderRef = _ref.conditionBuilderRef,
45
46
  className = _ref.className;
47
+ var _useTranslations = useTranslations.useTranslations(['condition_builder_group', 'conditionText']),
48
+ _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
49
+ conditionBuilderGroupText = _useTranslations2[0],
50
+ conditionText = _useTranslations2[1];
46
51
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
47
52
  variant = _useContext.variant;
48
53
  var _useState = React.useState(-1),
@@ -53,14 +58,15 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
53
58
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
54
59
  showConditionSubGroupPreview = _useState4[0],
55
60
  setShowConditionSubGroupPreview = _useState4[1];
56
- var onRemoveHandler = function onRemoveHandler(conditionId, evt) {
61
+ var conditionBuilderContentRef = React.useRef();
62
+ var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
57
63
  if (group.conditions.length > 1) {
64
+ variant == 'tree' ? handleFocusOnCloseTree(evt) : handleFocusOnClose(evt, conditionIndex);
58
65
  onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
59
66
  conditions: group.conditions.filter(function (condition) {
60
67
  return conditionId !== condition.id;
61
68
  })
62
69
  }));
63
- handleFocusOnClose(evt);
64
70
  } else {
65
71
  onRemove(evt);
66
72
  }
@@ -83,11 +89,50 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
83
89
  conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(conditionIndex + 1)))
84
90
  }));
85
91
  };
86
- var handleFocusOnClose = function handleFocusOnClose(e) {
87
- var _e$currentTarget;
88
- 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"]');
89
- if (previousClose) {
90
- previousClose.focus();
92
+ var handleFocusOnClose = function handleFocusOnClose(e, conditionIndex) {
93
+ var _e$currentTarget$clos;
94
+ //get all close buttons.
95
+ //if the last condition is closing, focus the second last one.
96
+ //or focus the next one.
97
+ var currentGroupCloseButtons = (_e$currentTarget$clos = e.currentTarget.closest(".".concat(DataConfigs.blockClass, "__group"))) === null || _e$currentTarget$clos === void 0 ? void 0 : _e$currentTarget$clos.querySelectorAll('[data-name="closeCondition"]');
98
+ if (conditionIndex == currentGroupCloseButtons.length - 1) {
99
+ var _currentGroupCloseBut;
100
+ (_currentGroupCloseBut = currentGroupCloseButtons[conditionIndex - 1]) === null || _currentGroupCloseBut === void 0 || _currentGroupCloseBut.focus();
101
+ } else {
102
+ var _currentGroupCloseBut2;
103
+ (_currentGroupCloseBut2 = currentGroupCloseButtons[conditionIndex + 1]) === null || _currentGroupCloseBut2 === void 0 || _currentGroupCloseBut2.focus();
104
+ }
105
+ };
106
+ var handleFocusOnCloseTree = function handleFocusOnCloseTree(evt) {
107
+ var _evt$currentTarget, _evt$currentTarget2, _conditionBuilderCont, _conditionBuilderCont2;
108
+ //getting the current aria-level and aria-posinset.
109
+ 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');
110
+ 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');
111
+
112
+ //finding the next and previous items in same level
113
+ var nextElement = (_conditionBuilderCont = conditionBuilderContentRef.current) === null || _conditionBuilderCont === void 0 ? void 0 : _conditionBuilderCont.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) + 1, "\"]"));
114
+ var prevElement = (_conditionBuilderCont2 = conditionBuilderContentRef.current) === null || _conditionBuilderCont2 === void 0 ? void 0 : _conditionBuilderCont2.querySelector("[aria-level=\"".concat(currentLevel, "\"][aria-posinset=\"").concat(Number(currentPos) - 1, "\"]"));
115
+ //checking if next level is a valid condition. If then, focus the close button inside that condition
116
+ //Otherwise , check the previous item is a valid condition
117
+
118
+ if (nextElement !== null && nextElement !== void 0 && nextElement.classList.contains("".concat(DataConfigs.blockClass, "__condition-block"))) {
119
+ var _nextElement$querySel;
120
+ nextElement === null || nextElement === void 0 || (_nextElement$querySel = nextElement.querySelector('[data-name="closeCondition"]')) === null || _nextElement$querySel === void 0 || _nextElement$querySel.focus();
121
+ } else if (prevElement !== null && prevElement !== void 0 && prevElement.classList.contains("".concat(DataConfigs.blockClass, "__condition-block"))) {
122
+ var _prevElement$querySel;
123
+ prevElement === null || prevElement === void 0 || (_prevElement$querySel = prevElement.querySelector('[data-name="closeCondition"]')) === null || _prevElement$querySel === void 0 || _prevElement$querySel.focus();
124
+ }
125
+ //If there are no valid condition in this group, focus next or previous row
126
+ else {
127
+ var _conditionBuilderCont3, _conditionBuilderCont4;
128
+ var prevRows = (_conditionBuilderCont3 = conditionBuilderContentRef.current) === null || _conditionBuilderCont3 === void 0 ? void 0 : _conditionBuilderCont3.querySelectorAll("[aria-level=\"".concat(Number(currentLevel) - 1, "\"][role=\"row\"]"));
129
+ var nextRow = (_conditionBuilderCont4 = conditionBuilderContentRef.current) === null || _conditionBuilderCont4 === void 0 ? void 0 : _conditionBuilderCont4.querySelector("[aria-level=\"".concat(Number(currentLevel) + 1, "\"][role=\"row\"]"));
130
+ if (nextRow) {
131
+ nextRow === null || nextRow === void 0 || nextRow.focus();
132
+ } else if ((prevRows === null || prevRows === void 0 ? void 0 : prevRows.length) > 1) {
133
+ var _prevRows;
134
+ (_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 || _prevRows.focus();
135
+ }
91
136
  }
92
137
  };
93
138
  var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
@@ -122,7 +167,12 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
122
167
  setShowConditionPreview(-1);
123
168
  };
124
169
  var onStatementChangeHandler = function onStatementChangeHandler(updatedStatement) {
170
+ var _statementConfig$find;
171
+ var groupOperator = (_statementConfig$find = DataConfigs.statementConfig.find(function (statement) {
172
+ return statement.id == updatedStatement;
173
+ })) === null || _statementConfig$find === void 0 ? void 0 : _statementConfig$find.connector;
125
174
  onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
175
+ groupOperator: groupOperator,
126
176
  statement: updatedStatement
127
177
  }));
128
178
  };
@@ -138,7 +188,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
138
188
  }, /*#__PURE__*/React__default["default"].createElement("div", {
139
189
  className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
140
190
  role: "grid",
141
- "aria-label": DataConfigs.translateWithId('condition_builder_group')
191
+ "aria-label": conditionBuilderGroupText
142
192
  }, group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.map(function (eachCondition, conditionIndex) {
143
193
  return /*#__PURE__*/React__default["default"].createElement("div", {
144
194
  key: eachCondition.id,
@@ -159,7 +209,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
159
209
  },
160
210
  addConditionHandler: addConditionHandler,
161
211
  onRemove: function onRemove(e) {
162
- onRemoveHandler(eachCondition.id, e);
212
+ onRemoveHandler(eachCondition.id, e, conditionIndex);
163
213
  },
164
214
  onConnectorOperatorChange: onConnectorOperatorChange,
165
215
  onStatementChange: onStatementChangeHandler,
@@ -172,7 +222,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
172
222
  return /*#__PURE__*/React__default["default"].createElement("div", {
173
223
  className: "".concat(className, " ").concat(DataConfigs.blockClass, "__condition-wrapper"),
174
224
  role: aria.level === 1 ? 'rowgroup' : undefined,
175
- "aria-label": aria.level == 1 ? DataConfigs.translateWithId('condition_builder_group') : undefined
225
+ "aria-label": aria.level == 1 ? conditionBuilderGroupText : undefined,
226
+ ref: conditionBuilderContentRef
176
227
  }, /*#__PURE__*/React__default["default"].createElement("div", {
177
228
  tabIndex: 0,
178
229
  role: "row",
@@ -181,14 +232,14 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
181
232
  "aria-setsize": aria.setsize
182
233
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
183
234
  label: group.statement,
184
- title: DataConfigs.translateWithId('condition'),
235
+ title: conditionText,
185
236
  "data-name": "connectorField",
186
237
  popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
187
238
  className: "".concat(DataConfigs.blockClass, "__statement-button")
188
239
  }, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
189
240
  conditionState: {
190
241
  value: group.statement,
191
- label: DataConfigs.translateWithId('condition')
242
+ label: conditionText
192
243
  },
193
244
  onChange: function onChange(v, evt) {
194
245
  util.focusThisField(evt);
@@ -252,9 +303,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
252
303
  hideConditionPreviewHandler: hideConditionPreviewHandler,
253
304
  isLastCondition: isLastCondition
254
305
  })), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
255
- previewType: "subGroup"
306
+ previewType: "subGroup",
307
+ group: group
256
308
  }))), conditionIndex == showConditionPreview && (_ConditionPreview2 || (_ConditionPreview2 = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
257
- previewType: "condition"
309
+ previewType: "condition",
310
+ group: group
258
311
  }))));
259
312
  }));
260
313
  };