@carbon/ibm-products 2.43.2-canary.103 → 2.43.2-canary.105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) 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/ActionBar/ActionBar.d.ts +58 -2
  14. package/es/components/ActionBar/ActionBar.js +14 -9
  15. package/es/components/ActionBar/ActionBarItem.d.ts +36 -2
  16. package/es/components/ActionBar/ActionBarItem.js +7 -4
  17. package/es/components/ActionBar/ActionBarOverflowItems.d.ts +55 -16
  18. package/es/components/ActionBar/ActionBarOverflowItems.js +8 -4
  19. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +1 -0
  20. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +17 -4
  21. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
  22. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +6 -4
  23. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -1
  24. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +8 -2
  25. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +3 -0
  26. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  27. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -4
  28. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +15 -7
  29. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  30. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +9 -3
  31. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +19 -6
  32. package/lib/components/ActionBar/ActionBar.d.ts +58 -2
  33. package/lib/components/ActionBar/ActionBar.js +14 -9
  34. package/lib/components/ActionBar/ActionBarItem.d.ts +36 -2
  35. package/lib/components/ActionBar/ActionBarItem.js +6 -3
  36. package/lib/components/ActionBar/ActionBarOverflowItems.d.ts +55 -16
  37. package/lib/components/ActionBar/ActionBarOverflowItems.js +8 -4
  38. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +1 -0
  39. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +16 -3
  40. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -2
  41. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +5 -3
  42. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -1
  43. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +8 -2
  44. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +3 -0
  45. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  46. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -4
  47. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +15 -7
  48. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  49. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +9 -3
  50. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +19 -6
  51. package/package.json +2 -2
  52. package/scss/components/ConditionBuilder/_condition-builder.scss +3 -0
  53. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +11 -2
  54. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +41 -31
@@ -44,11 +44,14 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
44
44
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
45
45
  open = _useState2[0],
46
46
  setOpen = _useState2[1];
47
- var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', label]),
48
- _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 3),
47
+ var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', 'addPropertyText', 'addOperatorText', 'addValueText', label]),
48
+ _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 6),
49
49
  invalidText = _useTranslations2[0],
50
50
  addConditionText = _useTranslations2[1],
51
- labelText = _useTranslations2[2];
51
+ addPropertyText = _useTranslations2[2],
52
+ addOperatorText = _useTranslations2[3],
53
+ addValueText = _useTranslations2[4],
54
+ labelText = _useTranslations2[5];
52
55
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
53
56
  conditionBuilderRef = _useContext.conditionBuilderRef;
54
57
  var getPropertyDetails = function getPropertyDetails() {
@@ -133,6 +136,19 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
133
136
  manageInvalidSelection();
134
137
  }
135
138
  };
139
+ var getLabel = function getLabel() {
140
+ if (propertyLabel) {
141
+ return propertyLabel;
142
+ } else if (rest['data-name'] === 'propertyField') {
143
+ return addPropertyText;
144
+ } else if (rest['data-name'] === 'operatorField') {
145
+ return addOperatorText;
146
+ } else if (rest['data-name'] === 'valueField') {
147
+ return addValueText;
148
+ } else {
149
+ return addConditionText;
150
+ }
151
+ };
136
152
  return /*#__PURE__*/React__default["default"].createElement(react.Popover, {
137
153
  open: open,
138
154
  isTabTip: true,
@@ -141,7 +157,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
141
157
  ref: popoverRef,
142
158
  onRequestClose: closePopover
143
159
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
144
- label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : addConditionText,
160
+ label: getLabel(),
145
161
  hideLabel: !label ? true : false,
146
162
  onClick: togglePopover,
147
163
  className: className,
@@ -59,6 +59,10 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
59
59
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
60
60
  showConditionSubGroupPreview = _useState4[0],
61
61
  setShowConditionSubGroupPreview = _useState4[1];
62
+ var _useState5 = React.useState(false),
63
+ _useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
64
+ showDeletionPreviewForSubgroups = _useState6[0],
65
+ setShowDeletionPreviewForSubgroups = _useState6[1];
62
66
  var conditionBuilderContentRef = React.useRef();
63
67
  var onRemoveHandler = function onRemoveHandler(conditionId, evt, conditionIndex) {
64
68
  if (group.conditions.length > 1) {
@@ -89,9 +93,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
89
93
  groupedItems.conditions.push(item);
90
94
  }
91
95
  });
92
- onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
93
- conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(groupedItems.conditions), _rollupPluginBabelHelpers.toConsumableArray(groupedItems.groups))
94
- }));
96
+ onRemove(evt);
97
+ // onChange({
98
+ // ...group,
99
+ // conditions: [...groupedItems.conditions, ...groupedItems.groups],
100
+ // });
95
101
  } else {
96
102
  onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
97
103
  conditions: group.conditions.filter(function (condition) {
@@ -164,10 +170,11 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
164
170
  };
165
171
  setTimeout(function () {
166
172
  var currentRowToFocus = conditionBuilderContentRef.current.querySelector("[role=\"row\"][aria-level=\"".concat(rowIdentity.ariaLevel, "\"][aria-posinset=\"").concat(rowIdentity.ariaPosInSet, "\"]"));
167
- util.manageTabIndexAndFocus(currentRowToFocus, conditionBuilderRef);
173
+ util.manageTabIndexAndFocus(currentRowToFocus === null || currentRowToFocus === void 0 ? void 0 : currentRowToFocus.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
168
174
  }, 0);
169
175
  } else if ((prevRows === null || prevRows === void 0 ? void 0 : prevRows.length) > 1) {
170
- util.manageTabIndexAndFocus(prevRows[prevRows.length - 2], conditionBuilderRef);
176
+ var _prevRows;
177
+ util.manageTabIndexAndFocus((_prevRows = prevRows[prevRows.length - 2]) === null || _prevRows === void 0 ? void 0 : _prevRows.querySelector('[data-name="closeCondition"]'), conditionBuilderRef);
171
178
  }
172
179
  }
173
180
  };
@@ -288,7 +295,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
288
295
  return /*#__PURE__*/React__default["default"].createElement(React.Fragment, {
289
296
  key: eachCondition.id
290
297
  }, eachCondition.conditions ? /*#__PURE__*/React__default["default"].createElement("div", {
291
- className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block subgroup ").concat(DataConfigs.blockClass, "__gap"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__gap-bottom"), group.conditions.length < conditionIndex + 1))
298
+ className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block subgroup ").concat(DataConfigs.blockClass, "__gap"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__gap-bottom"), group.conditions.length < conditionIndex + 1), "".concat(DataConfigs.blockClass, "__subgroup_deletionPreview"), showDeletionPreviewForSubgroups), {})
292
299
  }, /*#__PURE__*/React__default["default"].createElement(ConditionConnector["default"], {
293
300
  className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom ").concat(DataConfigs.blockClass, "__groupConnector"),
294
301
  operator: group.groupOperator,
@@ -336,7 +343,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
336
343
  _showConditionPreviewHandler(conditionIndex);
337
344
  },
338
345
  hideConditionPreviewHandler: hideConditionPreviewHandler,
339
- isLastCondition: isLastCondition
346
+ isLastCondition: isLastCondition,
347
+ setShowDeletionPreviewForSubgroups: setShowDeletionPreviewForSubgroups
340
348
  })), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
341
349
  previewType: "subGroup",
342
350
  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
  }
@@ -27,7 +27,8 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
27
  var ConditionPreview = function ConditionPreview(_ref) {
28
28
  var _ConditionBuilderItem, _ConditionBuilderItem2, _ConditionBuilderItem3;
29
29
  var previewType = _ref.previewType,
30
- group = _ref.group;
30
+ group = _ref.group,
31
+ colorIndex = _ref.colorIndex;
31
32
  var _useState = React.useState(false),
32
33
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
33
34
  animate = _useState2[0],
@@ -59,6 +60,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
59
60
  className: "".concat(DataConfigs.blockClass, "__statement-button"),
60
61
  label: group.groupOperator
61
62
  })), /*#__PURE__*/React__default["default"].createElement("div", {
63
+ "data-color-index": colorIndex,
62
64
  "aria-hidden": true,
63
65
  className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group ").concat(DataConfigs.blockClass, "__condition-wrapper ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__group-wrapper "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
64
66
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -67,7 +69,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
67
69
  className: "".concat(DataConfigs.blockClass, "__statement-button"),
68
70
  label: ifText
69
71
  })), getConditionSection())), previewType == 'subGroup' && /*#__PURE__*/React__default["default"].createElement("div", {
70
- className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
72
+ className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__gap-bottom"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
71
73
  }, /*#__PURE__*/React__default["default"].createElement("div", {
72
74
  className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
73
75
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
@@ -80,7 +82,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
80
82
  className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__groupConnector"),
81
83
  operator: ifText
82
84
  }), getConditionSection()))), previewType == 'condition' && /*#__PURE__*/React__default["default"].createElement("div", {
83
- className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
85
+ className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__gap-bottom"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
84
86
  }, /*#__PURE__*/React__default["default"].createElement("div", {
85
87
  className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
86
88
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
@@ -91,6 +93,10 @@ var ConditionPreview = function ConditionPreview(_ref) {
91
93
  };
92
94
  var ConditionPreview$1 = ConditionPreview;
93
95
  ConditionPreview.propTypes = {
96
+ /**
97
+ * index of the color for next group
98
+ */
99
+ colorIndex: index["default"].number,
94
100
  /**
95
101
  * current conditional group
96
102
  */
@@ -39,12 +39,18 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
39
39
  var allItems = [];
40
40
  switch (key) {
41
41
  case 'ArrowUp':
42
+ evt.preventDefault();
42
43
  //traverse through the popover options, search box, selectAll button
43
44
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
44
45
  util.traverseReverse(eachElem, index, allElements, null, null, conditionBuilderRef);
45
46
  });
47
+ //scroll to top when we reach a the top of the list to make search box visible
48
+ if (Array.from(evt.target.closest('ul').querySelectorAll('li')).indexOf(evt.target) === 1) {
49
+ parentContainer.querySelector(".".concat(DataConfigs.blockClass, "__popover-content-wrapper")).scrollTop = 0;
50
+ }
46
51
  break;
47
52
  case 'ArrowDown':
53
+ evt.preventDefault();
48
54
  //traverse through the popover options, search box, selectAll button
49
55
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
50
56
  util.traverseClockVise(eachElem, index, allElements, null, null, conditionBuilderRef);
@@ -72,12 +78,19 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
72
78
  }
73
79
  break;
74
80
  case 'Enter':
75
- if (isMultiSelect !== 'true') {
81
+ if (isMultiSelect === 'true') {
76
82
  if (document.activeElement.type !== 'button') {
77
83
  var _document$activeEleme2;
84
+ //for button , enter key is click which already handled by framework, for other elements trigger click
85
+ (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
86
+ }
87
+ evt.preventDefault();
88
+ } else {
89
+ if (document.activeElement.type !== 'button') {
90
+ var _document$activeEleme3;
78
91
  //for button , enter key is click which already handled by framework, else trigger click
79
92
  util.focusThisField(evt, conditionBuilderRef);
80
- (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
93
+ (_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === void 0 || _document$activeEleme3.click();
81
94
  }
82
95
  }
83
96
  break;
@@ -88,7 +101,7 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
88
101
  }
89
102
  };
90
103
  var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
91
- var _document$activeEleme3;
104
+ var _document$activeEleme4;
92
105
  switch (evt.key) {
93
106
  case 'ArrowRight':
94
107
  evt.preventDefault();
@@ -148,9 +161,9 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
148
161
  }
149
162
  break;
150
163
  case 'Enter':
151
- 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) {
152
- var _document$activeEleme4;
153
- (_document$activeEleme4 = document.activeElement) === null || _document$activeEleme4 === void 0 || (_document$activeEleme4 = _document$activeEleme4.querySelectorAll("button")[0]) === null || _document$activeEleme4 === void 0 || _document$activeEleme4.click();
164
+ 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) {
165
+ var _document$activeEleme5;
166
+ (_document$activeEleme5 = document.activeElement) === null || _document$activeEleme5 === void 0 || (_document$activeEleme5 = _document$activeEleme5.querySelectorAll("button")[0]) === null || _document$activeEleme5 === void 0 || _document$activeEleme5.click();
154
167
  }
155
168
  break;
156
169
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.43.2-canary.103+95b756345",
4
+ "version": "2.43.2-canary.105+30b4fdb2a",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -120,5 +120,5 @@
120
120
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
121
121
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
122
122
  },
123
- "gitHead": "95b7563457730ea24fed77e9aca2c964d9d713ac"
123
+ "gitHead": "30b4fdb2a315b501d3e33f93ea45b6f967117aed"
124
124
  }
@@ -73,3 +73,6 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
73
73
  .#{$block-class}__group-separator {
74
74
  width: fit-content;
75
75
  }
76
+ .#{$block-class}__tooltip {
77
+ word-break: break-all;
78
+ }
@@ -36,6 +36,15 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
36
36
  background-color: $tag-background-red;
37
37
  color: $tag-color-red;
38
38
  }
39
+ .#{$block-class}__subgroup_deletionPreview {
40
+ .#{$block-class}__group {
41
+ /* stylelint-disable max-nesting-depth */
42
+ button {
43
+ background-color: $tag-background-red;
44
+ color: $tag-color-red;
45
+ }
46
+ }
47
+ }
39
48
 
40
49
  .#{$block-class}__condition__deletion-preview
41
50
  .#{$block-class}__button:not(
@@ -63,6 +72,7 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
63
72
  }
64
73
  .#{$block-class}__group-preview-animate {
65
74
  height: auto;
75
+ color: $text-secondary;
66
76
  opacity: 0.5;
67
77
  pointer-events: none;
68
78
  transition: all $duration-moderate-02 motion(exit, expressive);
@@ -70,10 +80,9 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
70
80
  .#{$block-class}__connector--disabled {
71
81
  display: flex;
72
82
  min-width: $spacing-10;
73
- align-items: center;
74
83
  background-color: $layer;
75
84
  color: $text-helper;
76
- padding-inline: $spacing-03;
85
+ pointer-events: none;
77
86
  }
78
87
  .#{$block-class}__condition-wrapper
79
88
  > .#{$block-class}__condition-block:last-child
@@ -1,4 +1,5 @@
1
1
  @use 'sass:list';
2
+ @use 'sass:math';
2
3
  @use 'sass:string';
3
4
  @use '@carbon/react/scss/theme' as *;
4
5
  @use '../../../global/styles/project-settings' as c4p-settings;
@@ -167,21 +168,11 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
167
168
  }
168
169
  //need to revamp to a simpler logic
169
170
  $colors: (
170
- ($purple-70, $purple-60, $purple-50, $purple-40, $purple-30, $purple-20),
171
- ($cyan-70, $cyan-60, $cyan-50, $cyan-40, $cyan-30, $cyan-20),
172
- ($teal-70, $teal-60, $teal-50, $teal-40, $teal-30, $teal-20),
173
- (
174
- $magenta-70,
175
- $magenta-60,
176
- $magenta-50,
177
- $magenta-40,
178
- $magenta-30,
179
- $magenta-20
180
- ),
181
- ($red-70, $red-60, $red-50, $red-40, $red-30, $red-20),
182
- ($orange-70, $orange-60, $orange-50, $orange-40, $orange-30, $orange-20),
183
- ($yellow-70, $yellow-60, $yellow-50, $yellow-40, $yellow-30, $yellow-20),
184
- ($green-70, $green-60, $green-50, $green-40, $green-30, $green-20)
171
+ ($purple-70, $purple-60, $purple-50, $purple-40, $purple-30),
172
+ ($blue-70, $blue-60, $blue-50, $blue-40, $blue-30),
173
+ ($cyan-70, $cyan-60, $cyan-50, $cyan-40, $cyan-30),
174
+ ($teal-70, $teal-60, $teal-50, $teal-40, $teal-30),
175
+ ($green-70, $green-60, $green-50, $green-40, $green-30)
185
176
  );
186
177
 
187
178
  @for $i from 1 through list.length($colors) {
@@ -191,10 +182,30 @@ $colors: (
191
182
  )
192
183
  );
193
184
  $group-colors: list.nth($colors, $i);
194
- @each $color in $group-colors {
185
+ $group-colors-length: list.length($group-colors);
186
+
187
+ //this is to select and add color to the new group preview
188
+ .#{$block-class}__group-preview[data-color-index='#{($i%list.length($colors))}']
189
+ button {
190
+ /* stylelint-disable-next-line carbon/theme-token-use */
191
+ $next-group-color: list.nth($colors, ($i%list.length($colors)) +1);
192
+ /* stylelint-disable-next-line carbon/theme-token-use */
193
+ box-shadow: inset 0 #{$spacing-01} 0 0 list.nth($next-group-color, 1);
194
+ }
195
+
196
+ //we need to select the group color from the $colors array and need to repeat the colors after $colors.length subgroups
197
+ @for $el-index from 1 through 50 {
198
+ $item-index: $el-index;
199
+ /* stylelint-disable-next-line carbon/theme-token-use */
200
+ $item-index: ((($item-index - 1) % $group-colors-length) +1);
195
201
  #{$selector} {
196
- /* stylelint-disable-next-line carbon/theme-token-use */
197
- --#{$block-class}__condition-wrapper-color: #{$color};
202
+ @if $item-index != 1 {
203
+ /* stylelint-disable-next-line carbon/theme-token-use */
204
+ --#{$block-class}__condition-wrapper-color: #{list.nth(
205
+ $group-colors,
206
+ $item-index
207
+ )}; // stylelint-disable-line carbon/theme-token-use
208
+ }
198
209
  }
199
210
 
200
211
  $selector: list.append(
@@ -211,13 +222,12 @@ $colors: (
211
222
  .#{$block-class}__groupConnector {
212
223
  background-color: $layer;
213
224
  }
214
- .#{$block-class}__condition-wrapper > :nth-child(1) .#{$block-class}__button,
215
- .#{$block-class}__condition-wrapper
225
+ .#{$block-class}__condition-wrapper:not(.#{$block-class}__group-preview)
226
+ > :nth-child(1)
227
+ .#{$block-class}__button,
228
+ .#{$block-class}__condition-wrapper:not(.#{$block-class}__group-preview)
216
229
  > :nth-child(2)
217
- .#{$block-class}__button:not(
218
- .#{$block-class}__add-button,
219
- .#{$block-class}__add-condition-sub-group
220
- ) {
230
+ .#{$block-class}__button {
221
231
  /* stylelint-disable-next-line carbon/theme-token-use */
222
232
  box-shadow: inset 0 #{$spacing-01} 0 0 var(--#{$block-class}__condition-wrapper-color);
223
233
  }
@@ -237,24 +247,24 @@ $colors: (
237
247
  .#{$block-class}__add-condition-sub-group-wrapper {
238
248
  z-index: -1;
239
249
  width: 0;
240
- margin-left: -50%;
241
- opacity: 0;
242
250
  pointer-events: none;
251
+ transform: translateX(-100%);
243
252
  // stylelint-disable-next-line carbon/motion-duration-use, carbon/motion-easing-use
244
- transition: all linear $duration-fast-02;
253
+ transition: transform motion(exit, productive) $duration-fast-02;
245
254
  }
246
255
  .#{$block-class}__add-condition-sub-group-wrapper--show {
247
256
  z-index: 0;
248
257
  width: auto;
249
- margin-left: 0;
250
- opacity: 1;
251
258
  pointer-events: all;
252
- // stylelint-disable-next-line carbon/motion-duration-use, carbon/motion-easing-use
253
- transition: all linear $duration-fast-02;
259
+ transform: translateX(0);
254
260
  }
255
261
  .#{$block-class}__invalid-input {
256
262
  display: flex;
257
263
  }
258
264
  .#{$block-class}__invalid-input > svg {
259
265
  color: $support-warning;
266
+ /* stylelint-disable max-nesting-depth */
267
+ > path:first-child {
268
+ fill: $icon-primary;
269
+ }
260
270
  }