@carbon/ibm-products 2.38.0-alpha.5 → 2.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. package/css/index-full-carbon.css +227 -0
  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 +218 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +227 -0
  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 +445 -0
  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/ActionSet/ActionSet.js +3 -2
  18. package/es/components/Card/Card.js +50 -9
  19. package/es/components/Card/CardFooter.d.ts +5 -1
  20. package/es/components/Card/CardFooter.js +11 -1
  21. package/es/components/Carousel/Carousel.d.ts +6 -2
  22. package/es/components/Checklist/Checklist.d.ts +100 -2
  23. package/es/components/Checklist/Checklist.js +19 -15
  24. package/es/components/Checklist/Checklist.types.d.ts +19 -0
  25. package/es/components/Checklist/Checklist.types.js +22 -0
  26. package/es/components/Checklist/ChecklistChart.d.ts +6 -2
  27. package/es/components/Checklist/ChecklistChart.js +14 -33
  28. package/es/components/Checklist/ChecklistIcon.d.ts +5 -1
  29. package/es/components/Checklist/ChecklistIcon.js +9 -4
  30. package/es/components/Coachmark/Coachmark.d.ts +65 -2
  31. package/es/components/Coachmark/Coachmark.js +7 -10
  32. package/es/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
  33. package/es/components/Coachmark/CoachmarkDragbar.js +3 -1
  34. package/es/components/Coachmark/CoachmarkHeader.d.ts +27 -2
  35. package/es/components/Coachmark/CoachmarkHeader.js +0 -1
  36. package/es/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
  37. package/es/components/Coachmark/CoachmarkOverlay.js +18 -15
  38. package/es/components/Coachmark/CoachmarkTagline.d.ts +27 -2
  39. package/es/components/Coachmark/CoachmarkTagline.js +0 -1
  40. package/es/components/Coachmark/utils/enums.d.ts +20 -20
  41. package/es/components/Coachmark/utils/enums.js +22 -20
  42. package/es/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
  43. package/es/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
  44. package/es/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
  45. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
  46. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
  47. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
  48. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
  49. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  50. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +14 -24
  51. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
  52. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
  53. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
  54. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
  55. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
  56. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
  57. package/es/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
  58. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
  59. package/es/components/DataSpreadsheet/DataSpreadsheet.js +48 -27
  60. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
  61. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +60 -39
  62. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
  63. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +39 -27
  64. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
  65. package/es/components/DataSpreadsheet/types/index.d.ts +30 -0
  66. package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
  67. package/es/components/GetStartedCard/GetStartedCard.d.ts +5 -0
  68. package/es/components/GetStartedCard/GetStartedCard.js +82 -0
  69. package/es/components/GetStartedCard/index.d.ts +1 -0
  70. package/es/components/Guidebanner/Guidebanner.js +2 -2
  71. package/es/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
  72. package/es/components/NotificationsPanel/NotificationsPanel.js +10 -10
  73. package/es/components/SearchBar/SearchBar.d.ts +10 -1
  74. package/es/components/SearchBar/SearchBar.js +26 -20
  75. package/es/components/SidePanel/SidePanel.js +1 -1
  76. package/es/components/TagOverflow/TagOverflow.d.ts +5 -0
  77. package/es/components/TagOverflow/TagOverflow.js +153 -29
  78. package/es/components/TagOverflow/TagOverflowModal.d.ts +29 -0
  79. package/es/components/TagOverflow/TagOverflowModal.js +112 -0
  80. package/es/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
  81. package/es/components/TagOverflow/TagOverflowPopover.js +135 -0
  82. package/es/components/TagSet/TagSet.d.ts +87 -3
  83. package/es/components/TagSet/TagSet.js +20 -9
  84. package/es/components/TagSet/TagSetModal.d.ts +32 -26
  85. package/es/components/TagSet/TagSetModal.js +5 -5
  86. package/es/components/TagSet/TagSetOverflow.d.ts +45 -2
  87. package/es/components/TagSet/TagSetOverflow.js +14 -12
  88. package/es/components/WebTerminal/WebTerminal.js +2 -2
  89. package/es/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
  90. package/es/components/WebTerminal/hooks/index.d.ts +16 -11
  91. package/es/components/WebTerminal/hooks/index.js +1 -1
  92. package/es/components/index.d.ts +1 -0
  93. package/es/global/js/package-settings.d.ts +2 -1
  94. package/es/global/js/package-settings.js +2 -1
  95. package/es/index.js +1 -0
  96. package/es/node_modules/@carbon/colors/es/index.js +4 -1
  97. package/es/settings.d.ts +2 -1
  98. package/lib/components/ActionSet/ActionSet.js +2 -1
  99. package/lib/components/Card/Card.js +50 -9
  100. package/lib/components/Card/CardFooter.d.ts +5 -1
  101. package/lib/components/Card/CardFooter.js +11 -1
  102. package/lib/components/Carousel/Carousel.d.ts +6 -2
  103. package/lib/components/Checklist/Checklist.d.ts +100 -2
  104. package/lib/components/Checklist/Checklist.js +19 -15
  105. package/lib/components/Checklist/Checklist.types.d.ts +19 -0
  106. package/lib/components/Checklist/Checklist.types.js +27 -0
  107. package/lib/components/Checklist/ChecklistChart.d.ts +6 -2
  108. package/lib/components/Checklist/ChecklistChart.js +17 -36
  109. package/lib/components/Checklist/ChecklistIcon.d.ts +5 -1
  110. package/lib/components/Checklist/ChecklistIcon.js +9 -4
  111. package/lib/components/Coachmark/Coachmark.d.ts +65 -2
  112. package/lib/components/Coachmark/Coachmark.js +6 -9
  113. package/lib/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
  114. package/lib/components/Coachmark/CoachmarkDragbar.js +3 -1
  115. package/lib/components/Coachmark/CoachmarkHeader.d.ts +27 -2
  116. package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
  117. package/lib/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
  118. package/lib/components/Coachmark/CoachmarkOverlay.js +18 -15
  119. package/lib/components/Coachmark/CoachmarkTagline.d.ts +27 -2
  120. package/lib/components/Coachmark/CoachmarkTagline.js +0 -1
  121. package/lib/components/Coachmark/utils/enums.d.ts +20 -20
  122. package/lib/components/Coachmark/utils/enums.js +22 -20
  123. package/lib/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
  124. package/lib/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
  125. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
  126. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
  127. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
  128. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
  129. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
  130. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  131. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +13 -23
  132. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
  133. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
  134. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
  135. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
  136. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
  137. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
  138. package/lib/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
  139. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
  140. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +48 -27
  141. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
  142. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +59 -38
  143. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
  144. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +39 -27
  145. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
  146. package/lib/components/DataSpreadsheet/types/index.d.ts +30 -0
  147. package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
  148. package/lib/components/GetStartedCard/GetStartedCard.d.ts +5 -0
  149. package/lib/components/GetStartedCard/GetStartedCard.js +88 -0
  150. package/lib/components/GetStartedCard/index.d.ts +1 -0
  151. package/lib/components/Guidebanner/Guidebanner.js +2 -2
  152. package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
  153. package/lib/components/NotificationsPanel/NotificationsPanel.js +10 -10
  154. package/lib/components/SearchBar/SearchBar.d.ts +10 -1
  155. package/lib/components/SearchBar/SearchBar.js +26 -18
  156. package/lib/components/SidePanel/SidePanel.js +1 -1
  157. package/lib/components/TagOverflow/TagOverflow.d.ts +5 -0
  158. package/lib/components/TagOverflow/TagOverflow.js +154 -28
  159. package/lib/components/TagOverflow/TagOverflowModal.d.ts +29 -0
  160. package/lib/components/TagOverflow/TagOverflowModal.js +121 -0
  161. package/lib/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
  162. package/lib/components/TagOverflow/TagOverflowPopover.js +144 -0
  163. package/lib/components/TagSet/TagSet.d.ts +87 -3
  164. package/lib/components/TagSet/TagSet.js +20 -9
  165. package/lib/components/TagSet/TagSetModal.d.ts +32 -26
  166. package/lib/components/TagSet/TagSetModal.js +3 -3
  167. package/lib/components/TagSet/TagSetOverflow.d.ts +45 -2
  168. package/lib/components/TagSet/TagSetOverflow.js +14 -12
  169. package/lib/components/WebTerminal/WebTerminal.js +2 -2
  170. package/lib/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
  171. package/lib/components/WebTerminal/hooks/index.d.ts +16 -11
  172. package/lib/components/WebTerminal/hooks/index.js +1 -1
  173. package/lib/components/index.d.ts +1 -0
  174. package/lib/global/js/package-settings.d.ts +2 -1
  175. package/lib/global/js/package-settings.js +2 -1
  176. package/lib/index.js +5 -0
  177. package/lib/node_modules/@carbon/colors/es/index.js +6 -0
  178. package/lib/settings.d.ts +2 -1
  179. package/package.json +3 -3
  180. package/scss/components/Checklist/_carbon-imports.scss +2 -2
  181. package/scss/components/GetStartedCard/_carbon-imports.scss +9 -0
  182. package/scss/components/GetStartedCard/_get-started-card.scss +135 -0
  183. package/scss/components/GetStartedCard/_index-with-carbon.scss +9 -0
  184. package/scss/components/GetStartedCard/_index.scss +8 -0
  185. package/scss/components/TagOverflow/_tag-overflow.scss +157 -0
  186. package/scss/components/_index-released-only-with-carbon.scss +2 -1
  187. package/scss/components/_index-released-only.scss +2 -1
  188. package/scss/components/_index-with-carbon.scss +2 -0
  189. package/scss/components/_index.scss +1 -0
  190. package/telemetry.yml +28 -24
@@ -1,6 +1,50 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React, { ReactNode } from 'react';
8
+ interface CoachmarkOverlayElementsProps {
9
+ /**
10
+ * CoachmarkOverlayElements should be used with one or many CoachmarkOverlayElement components as children.
11
+ * @see CoachmarkOverlayElement
12
+ */
13
+ children: ReactNode;
14
+ /**
15
+ * Optional class name for this component.
16
+ */
17
+ className?: string;
18
+ /**
19
+ * The visibility of CoachmarkOverlayElements is
20
+ * managed in the parent component.
21
+ */
22
+ isVisible?: boolean;
23
+ /**
24
+ * The object describing an image in one of two shapes.
25
+ * If a single media element is required, use `{render}`.
26
+ * If a stepped animation is required, use `{filePaths}`.
27
+ */
28
+ media?: {
29
+ render?: () => ReactNode;
30
+ filePaths?: string[];
31
+ };
32
+ /**
33
+ * The label for the Next button.
34
+ */
35
+ nextButtonText?: string;
36
+ /**
37
+ * The label for the Previous button.
38
+ */
39
+ previousButtonLabel?: string;
40
+ /**
41
+ * The label for the Close button.
42
+ */
43
+ closeButtonLabel?: string;
44
+ }
1
45
  /**
2
46
  * Composable container to allow for the displaying of CoachmarkOverlayElement
3
47
  * components in a carousel fashion.
4
48
  */
5
- export let CoachmarkOverlayElements: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
6
- import React from 'react';
49
+ export declare let CoachmarkOverlayElements: React.ForwardRefExoticComponent<CoachmarkOverlayElementsProps & React.RefAttributes<HTMLDivElement>>;
50
+ export {};
@@ -19,11 +19,9 @@ import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia/SteppedAnimatedMed
19
19
  import { Carousel } from '../Carousel/Carousel.js';
20
20
 
21
21
  var _excluded = ["className", "children", "isVisible", "media", "nextButtonText", "previousButtonLabel", "closeButtonLabel"];
22
-
23
22
  // The block part of our conventional BEM class names (blockClass__E--M).
24
23
  var blockClass = "".concat(pkg.prefix, "--coachmark-overlay-elements");
25
24
  var componentName = 'CoachmarkOverlayElements';
26
-
27
25
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
28
26
 
29
27
  // Default values can be included here and then assigned to the prop params,
@@ -136,8 +134,9 @@ var CoachmarkOverlayElements = /*#__PURE__*/React__default.forwardRef(function (
136
134
  title: previousButtonLabel,
137
135
  disabled: scrollPosition === 0,
138
136
  onClick: function onClick() {
137
+ var _scrollRef$current, _scrollRef$current$sc;
139
138
  var targetStep = clamp(currentProgStep - 1, progStepFloor, progStepCeil);
140
- scrollRef.current.scrollToView(targetStep);
139
+ scrollRef === null || scrollRef === void 0 || (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 || (_scrollRef$current$sc = _scrollRef$current.scrollToView) === null || _scrollRef$current$sc === void 0 || _scrollRef$current$sc.call(_scrollRef$current, targetStep);
141
140
  setCurrentProgStep(targetStep);
142
141
  }
143
142
  }, previousButtonLabel), currentProgStep < progStepCeil ? /*#__PURE__*/React__default.createElement(Button, {
@@ -146,8 +145,9 @@ var CoachmarkOverlayElements = /*#__PURE__*/React__default.forwardRef(function (
146
145
  title: nextButtonText,
147
146
  disabled: scrollPosition === 1,
148
147
  onClick: function onClick() {
148
+ var _scrollRef$current2, _scrollRef$current2$s;
149
149
  var targetStep = clamp(currentProgStep + 1, progStepFloor, progStepCeil);
150
- scrollRef.current.scrollToView(targetStep);
150
+ scrollRef === null || scrollRef === void 0 || (_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 || (_scrollRef$current2$s = _scrollRef$current2.scrollToView) === null || _scrollRef$current2$s === void 0 || _scrollRef$current2$s.call(_scrollRef$current2, targetStep);
151
151
  setCurrentProgStep(targetStep);
152
152
  }
153
153
  }, nextButtonText) : closeButtonLabel && /*#__PURE__*/React__default.createElement(Button, _extends({
@@ -192,6 +192,7 @@ CoachmarkOverlayElements.propTypes = {
192
192
  * If a single media element is required, use `{render}`.
193
193
  * If a stepped animation is required, use `{filePaths}`.
194
194
  */
195
+ /**@ts-ignore*/
195
196
  media: PropTypes.oneOfType([PropTypes.shape({
196
197
  render: PropTypes.func
197
198
  }), PropTypes.shape({
@@ -7,15 +7,16 @@ declare namespace ConditionBlock {
7
7
  namespace propTypes {
8
8
  let addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
9
9
  let aria: PropTypes.Requireable<object>;
10
+ let condition: PropTypes.Requireable<object>;
10
11
  let conditionIndex: PropTypes.Requireable<number>;
11
12
  let conjunction: PropTypes.Requireable<string>;
12
13
  let group: PropTypes.Requireable<object>;
14
+ let isLastCondition: PropTypes.Requireable<(...args: any[]) => any>;
13
15
  let isStatement: PropTypes.Requireable<boolean>;
14
16
  let onChange: PropTypes.Requireable<(...args: any[]) => any>;
15
17
  let onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
16
18
  let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
17
19
  let onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
18
- let state: PropTypes.Requireable<object>;
19
20
  }
20
21
  }
21
22
  import PropTypes from 'prop-types';
@@ -28,20 +28,21 @@ import ConditionBuilderAdd from '../ConditionBuilderAdd/ConditionBuilderAdd.js';
28
28
  */
29
29
 
30
30
  var ConditionBlock = function ConditionBlock(props) {
31
- var _props$state = props.state,
32
- property = _props$state.property,
33
- value = _props$state.value,
34
- operator = _props$state.operator;
31
+ var _props$condition = props.condition,
32
+ property = _props$condition.property,
33
+ value = _props$condition.value,
34
+ operator = _props$condition.operator;
35
35
  var onRemove = props.onRemove,
36
36
  onChange = props.onChange,
37
- state = props.state,
37
+ condition = props.condition,
38
38
  conjunction = props.conjunction,
39
39
  onConnectorOperatorChange = props.onConnectorOperatorChange,
40
40
  isStatement = props.isStatement,
41
41
  group = props.group,
42
42
  onStatementChange = props.onStatementChange,
43
43
  addConditionHandler = props.addConditionHandler,
44
- conditionIndex = props.conditionIndex;
44
+ conditionIndex = props.conditionIndex,
45
+ isLastCondition = props.isLastCondition;
45
46
  var _useContext = useContext(ConditionBuilderContext),
46
47
  inputConfig = _useContext.inputConfig;
47
48
  var itemComponents = {
@@ -60,13 +61,9 @@ var ConditionBlock = function ConditionBlock(props) {
60
61
  var getCurrentConfig = function getCurrentConfig(property) {
61
62
  var _inputConfig$properti, _inputConfig$properti2;
62
63
  return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.filter(function (eachProperty) {
63
- var _eachProperty$label;
64
- return ((_eachProperty$label = eachProperty.label) === null || _eachProperty$label === void 0 ? void 0 : _eachProperty$label.toUpperCase()) == (property === null || property === void 0 ? void 0 : property.toUpperCase());
64
+ return eachProperty.id == property;
65
65
  })[0]) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
66
66
  };
67
- var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
68
- return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
69
- };
70
67
  var _getCurrentConfig = getCurrentConfig(property),
71
68
  icon = _getCurrentConfig.icon,
72
69
  type = _getCurrentConfig.type,
@@ -81,7 +78,7 @@ var ConditionBlock = function ConditionBlock(props) {
81
78
  onConnectorOperatorChange(op);
82
79
  };
83
80
  var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
84
- onChange(_objectSpread2(_objectSpread2({}, state), {}, {
81
+ onChange(_objectSpread2(_objectSpread2({}, condition), {}, {
85
82
  property: newProperty,
86
83
  operator: undefined,
87
84
  value: '',
@@ -89,14 +86,14 @@ var ConditionBlock = function ConditionBlock(props) {
89
86
  }));
90
87
  };
91
88
  var onOperatorChangeHandler = function onOperatorChangeHandler(newOperator) {
92
- onChange(_objectSpread2(_objectSpread2({}, state), {}, {
89
+ onChange(_objectSpread2(_objectSpread2({}, condition), {}, {
93
90
  operator: newOperator,
94
91
  value: undefined,
95
92
  popoverToOpen: 'valueField'
96
93
  }));
97
94
  };
98
95
  var onValueChangeHandler = function onValueChangeHandler(newValue) {
99
- onChange(_objectSpread2(_objectSpread2({}, state), {}, {
96
+ onChange(_objectSpread2(_objectSpread2({}, condition), {}, {
100
97
  value: newValue,
101
98
  popoverToOpen: ''
102
99
  }));
@@ -125,7 +122,8 @@ var ConditionBlock = function ConditionBlock(props) {
125
122
  title: translateWithId('condition'),
126
123
  "data-name": "connectorField",
127
124
  popOverClassName: "".concat(blockClass, "__gap"),
128
- className: "".concat(blockClass, "__statement-button")
125
+ className: "".concat(blockClass, "__statement-button"),
126
+ tabIndex: 0
129
127
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
130
128
  conditionState: {
131
129
  value: group.statement,
@@ -145,7 +143,7 @@ var ConditionBlock = function ConditionBlock(props) {
145
143
  renderIcon: icon !== null && icon !== void 0 ? icon : null,
146
144
  className: "".concat(blockClass, "__property-field"),
147
145
  "data-name": "propertyField",
148
- state: state,
146
+ condition: condition,
149
147
  type: type
150
148
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
151
149
  conditionState: {
@@ -160,7 +158,7 @@ var ConditionBlock = function ConditionBlock(props) {
160
158
  label: operator,
161
159
  title: translateWithId('operator'),
162
160
  "data-name": "operatorField",
163
- state: state,
161
+ condition: condition,
164
162
  type: type
165
163
  }, /*#__PURE__*/React__default.createElement(ConditionBuilderItemOption, {
166
164
  config: {
@@ -177,7 +175,7 @@ var ConditionBlock = function ConditionBlock(props) {
177
175
  title: label,
178
176
  showToolTip: true,
179
177
  "data-name": "valueField",
180
- state: state,
178
+ condition: condition,
181
179
  config: config
182
180
  }, /*#__PURE__*/React__default.createElement(ItemComponent, {
183
181
  conditionState: {
@@ -220,6 +218,10 @@ ConditionBlock.propTypes = {
220
218
  * object hold aria attributes
221
219
  */
222
220
  aria: PropTypes.object,
221
+ /**
222
+ * object that hold the current condition
223
+ */
224
+ condition: PropTypes.object,
223
225
  /**
224
226
  * index of the current condition
225
227
  */
@@ -232,6 +234,10 @@ ConditionBlock.propTypes = {
232
234
  * object that hold the current group object where is condition is part of
233
235
  */
234
236
  group: PropTypes.object,
237
+ /**
238
+ * callback to add a new condition
239
+ */
240
+ isLastCondition: PropTypes.func,
235
241
  /**
236
242
  * boolean that decides to show the statement(if/ excl.if)
237
243
  */
@@ -251,11 +257,7 @@ ConditionBlock.propTypes = {
251
257
  /**
252
258
  * callback to handle the statement(if/ excl.if) change
253
259
  */
254
- onStatementChange: PropTypes.func,
255
- /**
256
- * object that hold the current condition
257
- */
258
- state: PropTypes.object
260
+ onStatementChange: PropTypes.func
259
261
  };
260
262
 
261
263
  export { ConditionBlock$1 as default };
@@ -24,13 +24,13 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
24
24
  showToolTip = _ref.showToolTip,
25
25
  rest = _objectWithoutProperties(_ref, _excluded);
26
26
  var Button = function Button() {
27
- return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
27
+ return /*#__PURE__*/React__default.createElement("button", _extends({
28
28
  // role={'gridcell'}
29
29
  tabIndex: -1,
30
30
  className: cx([className, "".concat(blockClass, "__condition-builder-button"), _defineProperty({}, "".concat(blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
31
31
  type: "button",
32
32
  onClick: onClick
33
- }), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default.createElement(Icon, null))), !hideLabel && label);
33
+ }, rest), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default.createElement(Icon, null))), !hideLabel && label);
34
34
  };
35
35
  return hideLabel || showToolTip ? /*#__PURE__*/React__default.createElement(Tooltip, _extends({
36
36
  label: label,
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, extends as _extends, toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useContext, useState, useEffect, useCallback } from 'react';
10
10
  import PropTypes from '../../../node_modules/prop-types/index.js';
11
11
  import { Button } from '@carbon/react';
@@ -23,16 +23,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
23
23
  var _useContext = useContext(ConditionBuilderContext),
24
24
  rootState = _useContext.rootState,
25
25
  setRootState = _useContext.setRootState;
26
- var _useState = useState(true),
26
+ var _useState = useState(false),
27
27
  _useState2 = _slicedToArray(_useState, 2),
28
28
  isConditionBuilderActive = _useState2[0],
29
29
  setIsConditionBuilderActive = _useState2[1];
30
30
  useEffect(function () {
31
31
  var _rootState$groups;
32
32
  if (rootState !== null && rootState !== void 0 && (_rootState$groups = rootState.groups) !== null && _rootState$groups !== void 0 && _rootState$groups.length) {
33
- setIsConditionBuilderActive(false);
34
- } else {
35
33
  setIsConditionBuilderActive(true);
34
+ } else {
35
+ setIsConditionBuilderActive(false);
36
36
  }
37
37
  if (getConditionState) {
38
38
  getConditionState(rootState);
@@ -40,26 +40,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
40
40
 
41
41
  // eslint-disable-next-line react-hooks/exhaustive-deps
42
42
  }, [rootState, conditionBuilderRef]);
43
- useEffect(function () {
44
- if (isConditionBuilderActive == false) {
45
- if (conditionBuilderRef.current) {
46
- var initial = conditionBuilderRef.current.querySelector('[role="gridcell"] button');
47
- if (initial) {
48
- initial.setAttribute('tabindex', '0');
49
- }
50
- }
51
- }
52
- }, [isConditionBuilderActive, conditionBuilderRef]);
53
43
  var onStartConditionBuilder = function onStartConditionBuilder() {
54
44
  //when add condition button is clicked.
55
- setIsConditionBuilderActive(false);
45
+ setIsConditionBuilderActive(true);
56
46
  setRootState(initialState !== null && initialState !== void 0 ? initialState : emptyState); //here we can set an empty skeleton object for an empty condition builder,
57
47
  //or we can even pre-populate some existing builder and continue editing
58
48
  };
59
- var _onRemove = useCallback(function (groupIndex) {
49
+ var _onRemove = useCallback(function (groupId) {
60
50
  setRootState(_objectSpread2(_objectSpread2({}, rootState), {}, {
61
- groups: rootState.groups.filter(function (group, gIndex) {
62
- return groupIndex !== gIndex;
51
+ groups: rootState.groups.filter(function (group) {
52
+ return groupId !== group.id;
63
53
  })
64
54
  }));
65
55
  }, [setRootState, rootState]);
@@ -68,16 +58,15 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
68
58
  * This method is triggered from inner components. This will be called every time when any change is to be updated in the rootState.
69
59
  * This gets the updated group as argument.
70
60
  */
61
+ var groups = [].concat(_toConsumableArray(rootState.groups.slice(0, groupIndex)), [updatedGroup], _toConsumableArray(rootState.groups.slice(groupIndex + 1)));
71
62
  setRootState(_objectSpread2(_objectSpread2({}, rootState), {}, {
72
- groups: rootState.groups.map(function (group, gIndex) {
73
- return groupIndex === gIndex ? updatedGroup : group;
74
- })
63
+ groups: groups
75
64
  }));
76
65
  };
77
66
  return /*#__PURE__*/React__default.createElement("div", {
78
67
  className: "".concat(blockClass, "__content-container"),
79
68
  tabIndex: -1
80
- }, isConditionBuilderActive && /*#__PURE__*/React__default.createElement(Button, {
69
+ }, !isConditionBuilderActive && /*#__PURE__*/React__default.createElement(Button, {
81
70
  className: "".concat(blockClass, "__condition-builder"),
82
71
  renderIcon: function renderIcon(props) {
83
72
  return /*#__PURE__*/React__default.createElement(Add, _extends({
@@ -90,15 +79,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
90
79
  onClick: onStartConditionBuilder
91
80
  }, startConditionLabel), rootState && (rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.map(function (eachGroup, groupIndex) {
92
81
  return /*#__PURE__*/React__default.createElement(ConditionGroupBuilder, {
82
+ className: "".concat(blockClass, "__condition-builder__group"),
93
83
  key: groupIndex,
94
84
  aria: {
95
85
  level: 1,
96
86
  posinset: groupIndex * 2 + 1,
97
87
  setsize: rootState.groups.length * 2
98
88
  },
99
- state: eachGroup,
89
+ group: eachGroup,
100
90
  onRemove: function onRemove() {
101
- _onRemove(groupIndex);
91
+ _onRemove(eachGroup.id);
102
92
  },
103
93
  onChange: function onChange(updatedGroup) {
104
94
  onChangeHandler(updatedGroup, groupIndex);
@@ -3,11 +3,13 @@ export namespace emptyState {
3
3
  groupSeparateOperator: null;
4
4
  groupOperator: string;
5
5
  statement: string;
6
+ id: any;
6
7
  conditions: {
7
8
  property: undefined;
8
9
  operator: string;
9
10
  value: string;
10
11
  popoverToOpen: string;
12
+ id: any;
11
13
  }[];
12
14
  }[];
13
15
  }
@@ -8,17 +8,20 @@
8
8
  import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useState, createContext } from 'react';
10
10
  import PropTypes from '../../../node_modules/prop-types/index.js';
11
+ import uuidv4 from '../../../global/js/utils/uuidv4.js';
11
12
 
12
13
  var emptyState = {
13
14
  groups: [{
14
15
  groupSeparateOperator: null,
15
16
  groupOperator: 'and',
16
17
  statement: 'if',
18
+ id: uuidv4(),
17
19
  conditions: [{
18
20
  property: undefined,
19
21
  operator: '',
20
22
  value: '',
21
- popoverToOpen: 'propertyField'
23
+ popoverToOpen: 'propertyField',
24
+ id: uuidv4()
22
25
  }]
23
26
  }]
24
27
  };
@@ -1,4 +1,4 @@
1
- export function ConditionBuilderItem({ children, className, label, renderIcon, title, type, showToolTip, state, popOverClassName, config, ...rest }: {
1
+ export function ConditionBuilderItem({ children, className, label, renderIcon, title, type, showToolTip, condition, popOverClassName, config, ...rest }: {
2
2
  [x: string]: any;
3
3
  children: any;
4
4
  className: any;
@@ -7,7 +7,7 @@ export function ConditionBuilderItem({ children, className, label, renderIcon, t
7
7
  title: any;
8
8
  type: any;
9
9
  showToolTip: any;
10
- state: any;
10
+ condition: any;
11
11
  popOverClassName: any;
12
12
  config: any;
13
13
  }): import("react/jsx-runtime").JSX.Element;
@@ -15,12 +15,12 @@ export namespace ConditionBuilderItem {
15
15
  namespace propTypes {
16
16
  let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
17
  let className: PropTypes.Requireable<string>;
18
+ let condition: PropTypes.Requireable<object>;
18
19
  let config: PropTypes.Requireable<object>;
19
20
  let label: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
20
21
  let popOverClassName: PropTypes.Requireable<string>;
21
22
  let renderIcon: PropTypes.Requireable<object>;
22
23
  let showToolTip: PropTypes.Requireable<boolean>;
23
- let state: PropTypes.Requireable<object>;
24
24
  let title: PropTypes.Requireable<string>;
25
25
  let type: PropTypes.Requireable<string>;
26
26
  }
@@ -13,7 +13,7 @@ import { Add } from '@carbon/react/icons';
13
13
  import { valueRenderers, translateWithId, blockClass } from '../ConditionBuilderContext/DataConfigs.js';
14
14
  import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
15
15
 
16
- var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "state", "popOverClassName", "config"];
16
+ var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config"];
17
17
  var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
18
18
  var children = _ref.children,
19
19
  className = _ref.className,
@@ -22,7 +22,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
22
22
  title = _ref.title,
23
23
  type = _ref.type,
24
24
  showToolTip = _ref.showToolTip,
25
- state = _ref.state,
25
+ condition = _ref.condition,
26
26
  popOverClassName = _ref.popOverClassName,
27
27
  config = _ref.config,
28
28
  rest = _objectWithoutProperties(_ref, _excluded);
@@ -45,17 +45,17 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
45
45
  * rest['data-name'] holds the current field name
46
46
  * popoverToOpen hold the next popover to be opened if required
47
47
  */
48
- if (state) {
48
+ if (condition) {
49
49
  var currentField = rest['data-name'];
50
50
  //if any condition is changed, state prop is triggered
51
- if (state.popoverToOpen && currentField !== state.popoverToOpen) {
51
+ if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
52
52
  // close the previous popover
53
53
  setOpen(false);
54
- } else if (currentField == 'valueField' && type == 'option' && state.operator !== 'one-of') {
54
+ } else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'one-of') {
55
55
  //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.
56
56
  setOpen(false);
57
57
  }
58
- if (state.popoverToOpen == currentField) {
58
+ if (condition.popoverToOpen == currentField) {
59
59
  //current popover need to be opened
60
60
  setOpen(true);
61
61
  }
@@ -65,7 +65,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
65
65
  setOpen(false);
66
66
  }
67
67
  // eslint-disable-next-line react-hooks/exhaustive-deps
68
- }, [state, label]);
68
+ }, [condition, label]);
69
69
  useEffect(function () {
70
70
  //this will focus the first input field in the popover
71
71
  if (open && contentRef.current) {
@@ -113,6 +113,10 @@ ConditionBuilderItem.propTypes = {
113
113
  * Provide an optional class to be applied to the containing node.
114
114
  */
115
115
  className: PropTypes.string,
116
+ /**
117
+ * current condition state object
118
+ */
119
+ condition: PropTypes.object,
116
120
  /**
117
121
  * this is the config object again the current property from inputConfig
118
122
  */
@@ -134,10 +138,6 @@ ConditionBuilderItem.propTypes = {
134
138
  * show tool tip
135
139
  */
136
140
  showToolTip: PropTypes.bool,
137
- /**
138
- * current condition state object
139
- */
140
- state: PropTypes.object,
141
141
  /**
142
142
  * title of the popover
143
143
  */
@@ -5,20 +5,22 @@ export default ConditionGroupBuilder;
5
5
  * All the inner components of group are called from here.
6
6
  * @returns
7
7
  */
8
- declare function ConditionGroupBuilder({ state, aria, onRemove, onChange, conditionBuilderRef, }: {
9
- state: any;
8
+ declare function ConditionGroupBuilder({ group, aria, onRemove, onChange, conditionBuilderRef, className, }: {
9
+ group: any;
10
10
  aria: any;
11
11
  onRemove: any;
12
12
  onChange: any;
13
13
  conditionBuilderRef: any;
14
+ className: any;
14
15
  }): import("react/jsx-runtime").JSX.Element;
15
16
  declare namespace ConditionGroupBuilder {
16
17
  namespace propTypes {
17
18
  let aria: PropTypes.Requireable<object>;
19
+ let className: PropTypes.Requireable<string>;
18
20
  let conditionBuilderRef: PropTypes.Requireable<object>;
21
+ let group: PropTypes.Requireable<object>;
19
22
  let onChange: PropTypes.Requireable<(...args: any[]) => any>;
20
23
  let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
21
- let state: PropTypes.Requireable<object>;
22
24
  }
23
25
  }
24
26
  import PropTypes from 'prop-types';