@carbon/ibm-products 2.43.2-canary.102 → 2.43.2-canary.104

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/css/index-full-carbon.css +1147 -95
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +1147 -95
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +1147 -95
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +1 -0
  14. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +17 -4
  15. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
  16. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +6 -4
  17. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -1
  18. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +8 -2
  19. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +3 -0
  20. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  21. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -4
  22. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +15 -7
  23. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  24. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +9 -3
  25. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +19 -6
  26. package/es/components/EmptyStates/EmptyState.d.ts +72 -5
  27. package/es/components/EmptyStates/EmptyState.js +8 -5
  28. package/es/components/EmptyStates/EmptyStateV2.d.ts +2 -2
  29. package/es/components/EmptyStates/EmptyStateV2.js +1 -1
  30. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +1 -0
  31. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +16 -3
  32. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
  33. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +5 -3
  34. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -1
  35. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +8 -2
  36. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +3 -0
  37. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  38. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -4
  39. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +15 -7
  40. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  41. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +9 -3
  42. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +19 -6
  43. package/lib/components/EmptyStates/EmptyState.d.ts +72 -5
  44. package/lib/components/EmptyStates/EmptyState.js +8 -5
  45. package/lib/components/EmptyStates/EmptyStateV2.d.ts +2 -2
  46. package/lib/components/EmptyStates/EmptyStateV2.js +1 -1
  47. package/package.json +3 -3
  48. package/scss/components/ConditionBuilder/_condition-builder.scss +3 -0
  49. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +11 -2
  50. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +41 -31
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useContext, useState } from 'react';
9
+ import React__default, { useContext, useState, useEffect } from 'react';
10
10
  import { Close } from '@carbon/react/icons';
11
11
  import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
12
12
  import PropTypes from '../../../node_modules/prop-types/index.js';
@@ -52,7 +52,8 @@ var ConditionBlock = function ConditionBlock(props) {
52
52
  showConditionSubGroupPreviewHandler = props.showConditionSubGroupPreviewHandler,
53
53
  hideConditionPreviewHandler = props.hideConditionPreviewHandler,
54
54
  showConditionPreviewHandler = props.showConditionPreviewHandler,
55
- isLastCondition = props.isLastCondition;
55
+ isLastCondition = props.isLastCondition,
56
+ setShowDeletionPreviewForSubgroups = props.setShowDeletionPreviewForSubgroups;
56
57
  var _useContext = useContext(ConditionBuilderContext),
57
58
  inputConfig = _useContext.inputConfig,
58
59
  variant = _useContext.variant,
@@ -93,6 +94,15 @@ var ConditionBlock = function ConditionBlock(props) {
93
94
  textarea: ConditionBuilderItemText
94
95
  };
95
96
  var ItemComponent = property ? itemComponents[type] : null;
97
+ useEffect(function () {
98
+ var _group$conditions, _group$conditions2;
99
+ if (showDeletionPreview && (group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.length) > 1 && group !== null && group !== void 0 && (_group$conditions2 = group.conditions) !== null && _group$conditions2 !== void 0 && _group$conditions2[1].conditions && group.conditions[1].id !== condition.id) {
100
+ setShowDeletionPreviewForSubgroups === null || setShowDeletionPreviewForSubgroups === void 0 || setShowDeletionPreviewForSubgroups(true);
101
+ } else {
102
+ setShowDeletionPreviewForSubgroups === null || setShowDeletionPreviewForSubgroups === void 0 || setShowDeletionPreviewForSubgroups(false);
103
+ }
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps
105
+ }, [showDeletionPreview]);
96
106
  var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
97
107
  focusThisField(evt, conditionBuilderRef);
98
108
  onStatementChange(v);
@@ -112,10 +122,9 @@ var ConditionBlock = function ConditionBlock(props) {
112
122
  popoverToOpen: checkIsValid(newOperator) ? 'valueField' : ''
113
123
  }));
114
124
  };
115
- var onValueChangeHandler = function onValueChangeHandler(newValue, evt) {
125
+ var onValueChangeHandler = function onValueChangeHandler(newValue) {
116
126
  var currentCondition = _objectSpread2({}, condition);
117
127
  delete currentCondition.popoverToOpen;
118
- focusThisField(evt, conditionBuilderRef);
119
128
  onChange(_objectSpread2(_objectSpread2({}, currentCondition), {}, {
120
129
  value: newValue
121
130
  }));
@@ -308,6 +317,10 @@ ConditionBlock.propTypes = {
308
317
  * callback to handle the statement(if/ excl.if) change
309
318
  */
310
319
  onStatementChange: PropTypes.func,
320
+ /**
321
+ * method to set ShowDeletionPreviewForSubgroups
322
+ */
323
+ setShowDeletionPreviewForSubgroups: PropTypes.func,
311
324
  /**
312
325
  * handler for showing add condition preview
313
326
  */
@@ -87,11 +87,11 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
87
87
  })), enableSubGroup && /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
88
88
  renderIcon: TextNewLine,
89
89
  onClick: addConditionSubGroupHandler,
90
- className: cx("".concat(blockClass, "__add-condition-sub-group ").concat(blockClass, "__gap-left")),
90
+ className: cx("".concat(blockClass, "__add-condition-sub-group")),
91
91
  hideLabel: true,
92
92
  label: addSubgroupText,
93
93
  wrapperProps: wrapperProps,
94
- wrapperClassName: cx("".concat(blockClass, "__add-condition-sub-group-wrapper"), _defineProperty({}, "".concat(blockClass, "__add-condition-sub-group-wrapper--show"), isAddSubgroup))
94
+ wrapperClassName: cx("".concat(blockClass, "__add-condition-sub-group-wrapper ").concat(blockClass, "__gap-left"), _defineProperty({}, "".concat(blockClass, "__add-condition-sub-group-wrapper--show"), isAddSubgroup))
95
95
  }, previewHandlersForSubgroup())));
96
96
  };
97
97
  var ConditionBuilderAdd$1 = ConditionBuilderAdd;
@@ -9,7 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, extends as _extend
9
9
  import React__default from 'react';
10
10
  import cx from 'classnames';
11
11
  import PropTypes from '../../../node_modules/prop-types/index.js';
12
- import { Tooltip } from '@carbon/react';
12
+ import { usePrefix, Tooltip } from '@carbon/react';
13
13
  import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
14
14
  import { WarningAltFilled } from '@carbon/react/icons';
15
15
 
@@ -33,11 +33,11 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
33
33
  wrapperClassName = _ref.wrapperClassName,
34
34
  tabIndex = _ref.tabIndex,
35
35
  rest = _objectWithoutProperties(_ref, _excluded);
36
+ var carbonPrefix = usePrefix();
36
37
  var Button = function Button() {
37
38
  var _rest$dataName;
38
39
  var dataName = (_rest$dataName = rest['data-name']) !== null && _rest$dataName !== void 0 ? _rest$dataName : '';
39
40
  return /*#__PURE__*/React__default.createElement("button", _extends({
40
- // role={'gridcell'}
41
41
  tabIndex: tabIndex != undefined ? tabIndex : -1,
42
42
  className: cx([className, "".concat(blockClass, "__button"), _defineProperty({}, "".concat(blockClass, "__text-ellipsis"), showToolTip && !hideLabel && !isInvalid), _defineProperty({}, "".concat(blockClass, "__invalid-input"), isInvalid)]),
43
43
  type: "button",
@@ -52,8 +52,10 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
52
52
  return hideLabel || showToolTip ? /*#__PURE__*/React__default.createElement(Tooltip, _extends({
53
53
  label: label,
54
54
  align: tooltipAlign,
55
- className: "".concat(wrapperClassName)
56
- }, wrapperProps), Button()) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Button());
55
+ className: "".concat(wrapperClassName, " ").concat(blockClass, "__tooltip ").concat(carbonPrefix, "--icon-tooltip")
56
+ }, wrapperProps, {
57
+ leaveDelayMs: 0
58
+ }), Button()) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Button());
57
59
  };
58
60
  ConditionBuilderButton.propTypes = {
59
61
  /**
@@ -14,6 +14,7 @@ import PropTypes from '../../../node_modules/prop-types/index.js';
14
14
  import { focusThisField } from '../utils/util.js';
15
15
  import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
16
16
  import { useTranslations } from '../utils/useTranslations.js';
17
+ import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
17
18
 
18
19
  var _excluded = ["operator", "className", "onChange"];
19
20
  var ConditionConnector = function ConditionConnector(_ref) {
@@ -48,7 +49,9 @@ var ConditionConnector = function ConditionConnector(_ref) {
48
49
  };
49
50
  return variant == 'tree' ? /*#__PURE__*/React__default.createElement("span", {
50
51
  className: "".concat(className, " ").concat(blockClass, "__connector--disabled")
51
- }, operator) :
52
+ }, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, {
53
+ label: operator
54
+ })) :
52
55
  /*#__PURE__*/
53
56
  // <div className={className} {...rest}>
54
57
  React__default.createElement(ConditionBuilderItem, _extends({
@@ -22,7 +22,7 @@ import { useTranslations } from '../utils/useTranslations.js';
22
22
 
23
23
  var _GroupConnector;
24
24
  var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
25
- var _rootState$groups2;
25
+ var _rootState$groups3;
26
26
  var startConditionLabel = _ref.startConditionLabel,
27
27
  getConditionState = _ref.getConditionState,
28
28
  getActionsState = _ref.getActionsState,
@@ -110,6 +110,11 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
110
110
  groups: [].concat(_toConsumableArray(rootState.groups), [newGroup])
111
111
  }));
112
112
  };
113
+ var getColorIndex = function getColorIndex() {
114
+ var _rootState$groups$len, _rootState$groups2;
115
+ var groupLength = (_rootState$groups$len = rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.length) !== null && _rootState$groups$len !== void 0 ? _rootState$groups$len : 0;
116
+ return groupLength % 5;
117
+ };
113
118
  if (!isConditionBuilderActive) {
114
119
  return /*#__PURE__*/React__default.createElement(Button, {
115
120
  className: "".concat(blockClass, "__addConditionText-button"),
@@ -129,7 +134,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
129
134
  className: "".concat(blockClass, "__content-container"),
130
135
  role: "treegrid",
131
136
  "aria-label": "condition builder tree"
132
- }, rootState && (rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.map(function (eachGroup, groupIndex) {
137
+ }, rootState && (rootState === null || rootState === void 0 || (_rootState$groups3 = rootState.groups) === null || _rootState$groups3 === void 0 ? void 0 : _rootState$groups3.map(function (eachGroup, groupIndex) {
133
138
  return /*#__PURE__*/React__default.createElement("div", {
134
139
  key: eachGroup.id,
135
140
  className: "".concat(blockClass, "__group-wrapper")
@@ -169,6 +174,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
169
174
  }
170
175
  })), showConditionGroupPreview && /*#__PURE__*/React__default.createElement(ConditionPreview, {
171
176
  previewType: "newGroup",
177
+ colorIndex: getColorIndex(),
172
178
  group: {
173
179
  groupOperator: rootState.operator
174
180
  }
@@ -39,4 +39,7 @@ export namespace translationsObject {
39
39
  let conditionBuilderText: string;
40
40
  let actionSectionText: string;
41
41
  let conditionHeadingText: string;
42
+ let addPropertyText: string;
43
+ let addOperatorText: string;
44
+ let addValueText: string;
42
45
  }
@@ -32,7 +32,7 @@ var translationsObject = {
32
32
  connectorText: 'Connector',
33
33
  conditionRowText: 'Condition row',
34
34
  conditionRowGroupText: 'Condition row group',
35
- removeConditionText: 'Remove condition',
35
+ removeConditionText: 'Delete condition',
36
36
  addConditionRowText: 'Add condition row',
37
37
  startText: 'Start',
38
38
  endText: 'End',
@@ -45,7 +45,10 @@ var translationsObject = {
45
45
  invalidNumberWarnText: 'Invalid number, must be 0 or greater',
46
46
  conditionBuilderText: 'Condition Builder',
47
47
  actionSectionText: 'Action Section',
48
- conditionHeadingText: 'Condition'
48
+ conditionHeadingText: 'Condition',
49
+ addPropertyText: 'Add property',
50
+ addOperatorText: 'Add operator',
51
+ addValueText: 'Add value'
49
52
  };
50
53
 
51
54
  export { translationsObject };
@@ -36,11 +36,14 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
36
36
  _useState2 = _slicedToArray(_useState, 2),
37
37
  open = _useState2[0],
38
38
  setOpen = _useState2[1];
39
- var _useTranslations = useTranslations(['invalidText', 'addConditionText', label]),
40
- _useTranslations2 = _slicedToArray(_useTranslations, 3),
39
+ var _useTranslations = useTranslations(['invalidText', 'addConditionText', 'addPropertyText', 'addOperatorText', 'addValueText', label]),
40
+ _useTranslations2 = _slicedToArray(_useTranslations, 6),
41
41
  invalidText = _useTranslations2[0],
42
42
  addConditionText = _useTranslations2[1],
43
- labelText = _useTranslations2[2];
43
+ addPropertyText = _useTranslations2[2],
44
+ addOperatorText = _useTranslations2[3],
45
+ addValueText = _useTranslations2[4],
46
+ labelText = _useTranslations2[5];
44
47
  var _useContext = useContext(ConditionBuilderContext),
45
48
  conditionBuilderRef = _useContext.conditionBuilderRef;
46
49
  var getPropertyDetails = function getPropertyDetails() {
@@ -125,6 +128,19 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
125
128
  manageInvalidSelection();
126
129
  }
127
130
  };
131
+ var getLabel = function getLabel() {
132
+ if (propertyLabel) {
133
+ return propertyLabel;
134
+ } else if (rest['data-name'] === 'propertyField') {
135
+ return addPropertyText;
136
+ } else if (rest['data-name'] === 'operatorField') {
137
+ return addOperatorText;
138
+ } else if (rest['data-name'] === 'valueField') {
139
+ return addValueText;
140
+ } else {
141
+ return addConditionText;
142
+ }
143
+ };
128
144
  return /*#__PURE__*/React__default.createElement(Popover, {
129
145
  open: open,
130
146
  isTabTip: true,
@@ -133,7 +149,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
133
149
  ref: popoverRef,
134
150
  onRequestClose: closePopover
135
151
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
136
- label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : addConditionText,
152
+ label: getLabel(),
137
153
  hideLabel: !label ? true : false,
138
154
  onClick: togglePopover,
139
155
  className: className,
@@ -50,6 +50,10 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
50
50
  _useState4 = _slicedToArray(_useState3, 2),
51
51
  showConditionSubGroupPreview = _useState4[0],
52
52
  setShowConditionSubGroupPreview = _useState4[1];
53
+ var _useState5 = useState(false),
54
+ _useState6 = _slicedToArray(_useState5, 2),
55
+ showDeletionPreviewForSubgroups = _useState6[0],
56
+ setShowDeletionPreviewForSubgroups = _useState6[1];
53
57
  var conditionBuilderContentRef = useRef();
54
58
  var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
55
59
  if (group.conditions.length > 1) {
@@ -80,9 +84,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
80
84
  groupedItems.conditions.push(item);
81
85
  }
82
86
  });
83
- onChange(_objectSpread2(_objectSpread2({}, group), {}, {
84
- conditions: [].concat(_toConsumableArray(groupedItems.conditions), _toConsumableArray(groupedItems.groups))
85
- }));
87
+ onRemove(evt);
88
+ // onChange({
89
+ // ...group,
90
+ // conditions: [...groupedItems.conditions, ...groupedItems.groups],
91
+ // });
86
92
  } else {
87
93
  onChange(_objectSpread2(_objectSpread2({}, group), {}, {
88
94
  conditions: group.conditions.filter(function (condition) {
@@ -155,10 +161,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
155
161
  };
156
162
  setTimeout(function () {
157
163
  var currentRowToFocus = conditionBuilderContentRef.current.querySelector("[role=\"row\"][aria-level=\"".concat(rowIdentity.ariaLevel, "\"][aria-posinset=\"").concat(rowIdentity.ariaPosInSet, "\"]"));
158
- manageTabIndexAndFocus(currentRowToFocus, conditionBuilderRef);
164
+ manageTabIndexAndFocus(currentRowToFocus === null || currentRowToFocus === void 0 ? void 0 : currentRowToFocus.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
159
165
  }, 0);
160
166
  } else if ((prevRows === null || prevRows === void 0 ? void 0 : prevRows.length) > 1) {
161
- manageTabIndexAndFocus(prevRows[prevRows.length - 2], conditionBuilderRef);
167
+ var _prevRows;
168
+ manageTabIndexAndFocus((_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 ? void 0 : _prevRows.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
162
169
  }
163
170
  }
164
171
  };
@@ -279,7 +286,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
279
286
  return /*#__PURE__*/React__default.createElement(Fragment, {
280
287
  key: eachCondition.id
281
288
  }, eachCondition.conditions ? /*#__PURE__*/React__default.createElement("div", {
282
- className: cx("".concat(blockClass, "__condition-block subgroup ").concat(blockClass, "__gap"), _defineProperty({}, "".concat(blockClass, "__gap-bottom"), group.conditions.length < conditionIndex + 1))
289
+ className: cx("".concat(blockClass, "__condition-block subgroup ").concat(blockClass, "__gap"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__gap-bottom"), group.conditions.length < conditionIndex + 1), "".concat(blockClass, "__subgroup_deletionPreview"), showDeletionPreviewForSubgroups), {})
283
290
  }, /*#__PURE__*/React__default.createElement(ConditionConnector, {
284
291
  className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom ").concat(blockClass, "__groupConnector"),
285
292
  operator: group.groupOperator,
@@ -327,7 +334,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
327
334
  _showConditionPreviewHandler(conditionIndex);
328
335
  },
329
336
  hideConditionPreviewHandler: hideConditionPreviewHandler,
330
- isLastCondition: isLastCondition
337
+ isLastCondition: isLastCondition,
338
+ setShowDeletionPreviewForSubgroups: setShowDeletionPreviewForSubgroups
331
339
  })), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default.createElement(ConditionPreview, {
332
340
  previewType: "subGroup",
333
341
  group: group
@@ -1,10 +1,12 @@
1
1
  export default ConditionPreview;
2
- declare function ConditionPreview({ previewType, group }: {
2
+ declare function ConditionPreview({ previewType, group, colorIndex }: {
3
3
  previewType: any;
4
4
  group: any;
5
+ colorIndex: any;
5
6
  }): import("react/jsx-runtime").JSX.Element;
6
7
  declare namespace ConditionPreview {
7
8
  namespace propTypes {
9
+ let colorIndex: PropTypes.Requireable<number>;
8
10
  let group: PropTypes.Requireable<object>;
9
11
  let previewType: PropTypes.Requireable<string>;
10
12
  }
@@ -18,7 +18,8 @@ import { Bee } from '@carbon/react/icons';
18
18
  var ConditionPreview = function ConditionPreview(_ref) {
19
19
  var _ConditionBuilderItem, _ConditionBuilderItem2, _ConditionBuilderItem3;
20
20
  var previewType = _ref.previewType,
21
- group = _ref.group;
21
+ group = _ref.group,
22
+ colorIndex = _ref.colorIndex;
22
23
  var _useState = useState(false),
23
24
  _useState2 = _slicedToArray(_useState, 2),
24
25
  animate = _useState2[0],
@@ -50,6 +51,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
50
51
  className: "".concat(blockClass, "__statement-button"),
51
52
  label: group.groupOperator
52
53
  })), /*#__PURE__*/React__default.createElement("div", {
54
+ "data-color-index": colorIndex,
53
55
  "aria-hidden": true,
54
56
  className: cx(["".concat(blockClass, "__group ").concat(blockClass, "__condition-wrapper ").concat(blockClass, "__group-preview ").concat(blockClass, "__group-wrapper "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
55
57
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -58,7 +60,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
58
60
  className: "".concat(blockClass, "__statement-button"),
59
61
  label: ifText
60
62
  })), getConditionSection())), previewType == 'subGroup' && /*#__PURE__*/React__default.createElement("div", {
61
- className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
63
+ className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview ").concat(blockClass, "__gap-bottom"), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
62
64
  }, /*#__PURE__*/React__default.createElement("div", {
63
65
  className: "".concat(blockClass, "__condition-block ").concat(blockClass, "__gap")
64
66
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
@@ -71,7 +73,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
71
73
  className: "".concat(blockClass, "__gap ").concat(blockClass, "__groupConnector"),
72
74
  operator: ifText
73
75
  }), getConditionSection()))), previewType == 'condition' && /*#__PURE__*/React__default.createElement("div", {
74
- className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview "), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
76
+ className: cx(["".concat(blockClass, "__group__row ").concat(blockClass, "__group-preview ").concat(blockClass, "__gap-bottom"), _defineProperty({}, "".concat(blockClass, "__group-preview-animate"), animate)])
75
77
  }, /*#__PURE__*/React__default.createElement("div", {
76
78
  className: "".concat(blockClass, "__condition-block ").concat(blockClass, "__gap")
77
79
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
@@ -82,6 +84,10 @@ var ConditionPreview = function ConditionPreview(_ref) {
82
84
  };
83
85
  var ConditionPreview$1 = ConditionPreview;
84
86
  ConditionPreview.propTypes = {
87
+ /**
88
+ * index of the color for next group
89
+ */
90
+ colorIndex: PropTypes.number,
85
91
  /**
86
92
  * current conditional group
87
93
  */
@@ -35,12 +35,18 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
35
35
  var allItems = [];
36
36
  switch (key) {
37
37
  case 'ArrowUp':
38
+ evt.preventDefault();
38
39
  //traverse through the popover options, search box, selectAll button
39
40
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
40
41
  traverseReverse(eachElem, index, allElements, null, null, conditionBuilderRef);
41
42
  });
43
+ //scroll to top when we reach a the top of the list to make search box visible
44
+ if (Array.from(evt.target.closest('ul').querySelectorAll('li')).indexOf(evt.target) === 1) {
45
+ parentContainer.querySelector(".".concat(blockClass, "__popover-content-wrapper")).scrollTop = 0;
46
+ }
42
47
  break;
43
48
  case 'ArrowDown':
49
+ evt.preventDefault();
44
50
  //traverse through the popover options, search box, selectAll button
45
51
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
46
52
  traverseClockVise(eachElem, index, allElements, null, null, conditionBuilderRef);
@@ -68,12 +74,19 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
68
74
  }
69
75
  break;
70
76
  case 'Enter':
71
- if (isMultiSelect !== 'true') {
77
+ if (isMultiSelect === 'true') {
72
78
  if (document.activeElement.type !== 'button') {
73
79
  var _document$activeEleme2;
80
+ //for button , enter key is click which already handled by framework, for other elements trigger click
81
+ (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
82
+ }
83
+ evt.preventDefault();
84
+ } else {
85
+ if (document.activeElement.type !== 'button') {
86
+ var _document$activeEleme3;
74
87
  //for button , enter key is click which already handled by framework, else trigger click
75
88
  focusThisField(evt, conditionBuilderRef);
76
- (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
89
+ (_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === void 0 || _document$activeEleme3.click();
77
90
  }
78
91
  }
79
92
  break;
@@ -84,7 +97,7 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
84
97
  }
85
98
  };
86
99
  var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
87
- var _document$activeEleme3;
100
+ var _document$activeEleme4;
88
101
  switch (evt.key) {
89
102
  case 'ArrowRight':
90
103
  evt.preventDefault();
@@ -144,9 +157,9 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
144
157
  }
145
158
  break;
146
159
  case 'Enter':
147
- if (((_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === void 0 || (_document$activeEleme3 = _document$activeEleme3.querySelectorAll("button")) === null || _document$activeEleme3 === void 0 ? void 0 : _document$activeEleme3.length) === 1) {
148
- var _document$activeEleme4;
149
- (_document$activeEleme4 = document.activeElement) === null || _document$activeEleme4 === void 0 || (_document$activeEleme4 = _document$activeEleme4.querySelectorAll("button")[0]) === null || _document$activeEleme4 === void 0 || _document$activeEleme4.click();
160
+ if (((_document$activeEleme4 = document.activeElement) === null || _document$activeEleme4 === void 0 || (_document$activeEleme4 = _document$activeEleme4.querySelectorAll("button")) === null || _document$activeEleme4 === void 0 ? void 0 : _document$activeEleme4.length) === 1) {
161
+ var _document$activeEleme5;
162
+ (_document$activeEleme5 = document.activeElement) === null || _document$activeEleme5 === void 0 || (_document$activeEleme5 = _document$activeEleme5.querySelectorAll("button")[0]) === null || _document$activeEleme5 === void 0 || _document$activeEleme5.click();
150
163
  }
151
164
  break;
152
165
  }
@@ -1,9 +1,76 @@
1
- export namespace defaults {
2
- let position: string;
3
- let size: string;
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2021
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
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
8
+ import React, { ReactNode } from 'react';
9
+ import '../../global/js/utils/props-helper';
10
+ import { ButtonProps } from '@carbon/react';
11
+ import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
12
+ declare enum sizes {
13
+ lg = "lg",
14
+ sm = "sm"
15
+ }
16
+ export declare const defaults: {
17
+ position: string;
18
+ size: sizes;
19
+ };
20
+ interface EmptyStateProps {
21
+ /**
22
+ * Empty state action button
23
+ */
24
+ action?: {
25
+ kind?: 'primary' | 'secondary' | 'tertiary';
26
+ renderIcon?: CarbonIconType;
27
+ onClick?: ButtonProps['onClick'];
28
+ text?: string;
29
+ };
30
+ /**
31
+ * Provide an optional class to be applied to the containing node.
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Empty state illustration, specify the `src` for a provided illustration to be displayed. In the case of requiring a light and dark illustration of your own, simply pass the corresponding illustration based on the current theme of your application.
36
+ * For example: `illustration={appTheme === 'dark' ? darkIllustration : lightIllustration}`
37
+ */
38
+ illustration?: string;
39
+ /**
40
+ * The alt text for empty state svg images. If not provided , title will be used.
41
+ */
42
+ illustrationDescription?: string;
43
+ /**
44
+ * Designates the position of the illustration relative to the content
45
+ */
46
+ illustrationPosition?: 'top' | 'right' | 'bottom' | 'left';
47
+ /**
48
+ * Empty state link object
49
+ */
50
+ link?: {
51
+ text?: string | ReactNode;
52
+ href?: string;
53
+ };
54
+ /**
55
+ * Empty state size
56
+ */
57
+ size?: 'lg' | 'sm';
58
+ /**
59
+ * Empty state subtitle
60
+ */
61
+ subtitle?: string | ReactNode;
62
+ /**
63
+ * Empty state title
64
+ */
65
+ title: string | ReactNode;
66
+ /**
67
+ * Designates which version of the EmptyState component is being used.
68
+ * Refer to V2 documentation separately.
69
+ */
70
+ v2?: boolean;
4
71
  }
5
72
  /**
6
73
  * The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
7
74
  */
8
- export let EmptyState: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
9
- import React from 'react';
75
+ export declare let EmptyState: React.ForwardRefExoticComponent<EmptyStateProps & React.RefAttributes<HTMLDivElement>>;
76
+ export {};
@@ -22,13 +22,15 @@ var _excluded = ["v2"],
22
22
  // The block part of our conventional BEM class names (blockClass__E--M).
23
23
  var blockClass = "".concat(pkg.prefix, "--empty-state");
24
24
  var componentName = 'EmptyState';
25
-
26
- // Default values for props
25
+ var sizes = /*#__PURE__*/function (sizes) {
26
+ sizes["lg"] = "lg";
27
+ sizes["sm"] = "sm";
28
+ return sizes;
29
+ }(sizes || {}); // Default values for props
27
30
  var defaults = {
28
31
  position: 'top',
29
- size: 'lg'
32
+ size: sizes.lg
30
33
  };
31
-
32
34
  /**
33
35
  * The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
34
36
  */
@@ -64,7 +66,7 @@ var EmptyState = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
64
66
  link: link,
65
67
  size: size,
66
68
  subtitle: subtitle,
67
- title: title
69
+ title: title !== null && title !== void 0 ? title : ''
68
70
  }));
69
71
  });
70
72
 
@@ -92,6 +94,7 @@ EmptyState.propTypes = {
92
94
  /**
93
95
  * The alt text for custom provided illustrations
94
96
  */
97
+ /**@ts-ignore*/
95
98
  illustrationDescription: PropTypes.string.isRequired.if(function (_ref2) {
96
99
  var illustration = _ref2.illustration;
97
100
  return illustration;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2023, 2023
2
+ * Copyright IBM Corp. 2023, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -44,7 +44,7 @@ interface EmptyStateV2Props {
44
44
  * Props for the link. Refer to the Carbon Components link documentation for full list of props.
45
45
  */
46
46
  link?: {
47
- text?: string;
47
+ text?: string | ReactNode;
48
48
  };
49
49
  /**
50
50
  * Empty state size
@@ -107,7 +107,7 @@ EmptyStateV2.propTypes = {
107
107
  */
108
108
  /**@ts-ignore*/
109
109
  link: PropTypes.shape({
110
- text: PropTypes.string
110
+ text: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
111
111
  }),
112
112
  /**
113
113
  * Empty state size
@@ -20,6 +20,7 @@ declare namespace ConditionBlock {
20
20
  let onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
21
21
  let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
22
22
  let onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
23
+ let setShowDeletionPreviewForSubgroups: PropTypes.Requireable<(...args: any[]) => any>;
23
24
  let showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
24
25
  let showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
25
26
  let state: PropTypes.Requireable<object>;
@@ -61,7 +61,8 @@ var ConditionBlock = function ConditionBlock(props) {
61
61
  showConditionSubGroupPreviewHandler = props.showConditionSubGroupPreviewHandler,
62
62
  hideConditionPreviewHandler = props.hideConditionPreviewHandler,
63
63
  showConditionPreviewHandler = props.showConditionPreviewHandler,
64
- isLastCondition = props.isLastCondition;
64
+ isLastCondition = props.isLastCondition,
65
+ setShowDeletionPreviewForSubgroups = props.setShowDeletionPreviewForSubgroups;
65
66
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
66
67
  inputConfig = _useContext.inputConfig,
67
68
  variant = _useContext.variant,
@@ -102,6 +103,15 @@ var ConditionBlock = function ConditionBlock(props) {
102
103
  textarea: ConditionBuilderItemText.ConditionBuilderItemText
103
104
  };
104
105
  var ItemComponent = property ? itemComponents[type] : null;
106
+ React.useEffect(function () {
107
+ var _group$conditions, _group$conditions2;
108
+ if (showDeletionPreview && (group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.length) > 1 && group !== null && group !== void 0 && (_group$conditions2 = group.conditions) !== null && _group$conditions2 !== void 0 && _group$conditions2[1].conditions && group.conditions[1].id !== condition.id) {
109
+ setShowDeletionPreviewForSubgroups === null || setShowDeletionPreviewForSubgroups === void 0 || setShowDeletionPreviewForSubgroups(true);
110
+ } else {
111
+ setShowDeletionPreviewForSubgroups === null || setShowDeletionPreviewForSubgroups === void 0 || setShowDeletionPreviewForSubgroups(false);
112
+ }
113
+ // eslint-disable-next-line react-hooks/exhaustive-deps
114
+ }, [showDeletionPreview]);
105
115
  var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
106
116
  util.focusThisField(evt, conditionBuilderRef);
107
117
  onStatementChange(v);
@@ -121,10 +131,9 @@ var ConditionBlock = function ConditionBlock(props) {
121
131
  popoverToOpen: util.checkIsValid(newOperator) ? 'valueField' : ''
122
132
  }));
123
133
  };
124
- var onValueChangeHandler = function onValueChangeHandler(newValue, evt) {
134
+ var onValueChangeHandler = function onValueChangeHandler(newValue) {
125
135
  var currentCondition = _rollupPluginBabelHelpers.objectSpread2({}, condition);
126
136
  delete currentCondition.popoverToOpen;
127
- util.focusThisField(evt, conditionBuilderRef);
128
137
  onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, currentCondition), {}, {
129
138
  value: newValue
130
139
  }));
@@ -317,6 +326,10 @@ ConditionBlock.propTypes = {
317
326
  * callback to handle the statement(if/ excl.if) change
318
327
  */
319
328
  onStatementChange: index["default"].func,
329
+ /**
330
+ * method to set ShowDeletionPreviewForSubgroups
331
+ */
332
+ setShowDeletionPreviewForSubgroups: index["default"].func,
320
333
  /**
321
334
  * handler for showing add condition preview
322
335
  */