@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,8 +1,48 @@
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 CoachmarkFixedProps {
9
+ /**
10
+ * CoachmarkFixed should use a single CoachmarkOverlayElements component as a child.
11
+ */
12
+ children: ReactNode;
13
+ /**
14
+ * Optional class name for this component.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Function to call when the Coachmark closes.
19
+ */
20
+ onClose?: () => void;
21
+ /**
22
+ * By default, the Coachmark will be appended to the end of `document.body`.
23
+ * The Coachmark will remain persistent as the user navigates the app until
24
+ * the user closes the Coachmark.
25
+ *
26
+ * Alternatively, the app developer can tightly couple the Coachmark to a DOM
27
+ * element or other component by specifying a CSS selector. The Coachmark will
28
+ * remain visible as long as that element remains visible or mounted. When the
29
+ * element is hidden or component is unmounted, the Coachmark will disappear.
30
+ */
31
+ portalTarget?: string;
32
+ /**
33
+ * The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
34
+ */
35
+ tagline: string;
36
+ /**
37
+ * Determines the theme of the component.
38
+ */
39
+ theme?: 'light' | 'dark';
40
+ }
1
41
  /**
2
42
  * Fixed coachmarks are used to call out specific functionality or concepts
3
43
  * within the UI that may not be intuitive but are important for the
4
44
  * user to gain understanding of the product's main value and discover new use cases.
5
45
  * This variant allows the a coachmark overlay to be displayed by interacting with the tagline.
6
46
  */
7
- export let CoachmarkFixed: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
8
- import React from 'react';
47
+ export declare let CoachmarkFixed: React.ForwardRefExoticComponent<CoachmarkFixedProps & React.RefAttributes<HTMLDivElement>>;
48
+ export {};
@@ -59,7 +59,7 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
59
59
  _ref$theme = _ref.theme,
60
60
  theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
61
61
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
62
- var overlayRef = React.useRef();
62
+ var overlayRef = React.useRef(null);
63
63
  var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
64
64
  var _useState = React.useState(false),
65
65
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
@@ -181,7 +181,9 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
181
181
  onTransitionEnd: handleTransitionEnd,
182
182
  theme: theme,
183
183
  className: cx__default["default"](fixedIsVisible && "".concat(overlayBlockClass, "--is-visible"), overlayBlockClass)
184
- }, children), portalNode)));
184
+ }, children),
185
+ // Default to `document.body` when `portalNode` is `null`
186
+ portalNode || document.body)));
185
187
  });
186
188
 
187
189
  // Return a placeholder if not released and not enabled by feature flag
@@ -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 {};
@@ -28,11 +28,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
28
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
29
29
 
30
30
  var _excluded = ["className", "children", "isVisible", "media", "nextButtonText", "previousButtonLabel", "closeButtonLabel"];
31
-
32
31
  // The block part of our conventional BEM class names (blockClass__E--M).
33
32
  var blockClass = "".concat(settings.pkg.prefix, "--coachmark-overlay-elements");
34
33
  var componentName = 'CoachmarkOverlayElements';
35
-
36
34
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
37
35
 
38
36
  // Default values can be included here and then assigned to the prop params,
@@ -145,8 +143,9 @@ exports.CoachmarkOverlayElements = /*#__PURE__*/React__default["default"].forwar
145
143
  title: previousButtonLabel,
146
144
  disabled: scrollPosition === 0,
147
145
  onClick: function onClick() {
146
+ var _scrollRef$current, _scrollRef$current$sc;
148
147
  var targetStep = lodash.clamp(currentProgStep - 1, progStepFloor, progStepCeil);
149
- scrollRef.current.scrollToView(targetStep);
148
+ 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);
150
149
  setCurrentProgStep(targetStep);
151
150
  }
152
151
  }, previousButtonLabel), currentProgStep < progStepCeil ? /*#__PURE__*/React__default["default"].createElement(react.Button, {
@@ -155,8 +154,9 @@ exports.CoachmarkOverlayElements = /*#__PURE__*/React__default["default"].forwar
155
154
  title: nextButtonText,
156
155
  disabled: scrollPosition === 1,
157
156
  onClick: function onClick() {
157
+ var _scrollRef$current2, _scrollRef$current2$s;
158
158
  var targetStep = lodash.clamp(currentProgStep + 1, progStepFloor, progStepCeil);
159
- scrollRef.current.scrollToView(targetStep);
159
+ 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);
160
160
  setCurrentProgStep(targetStep);
161
161
  }
162
162
  }, nextButtonText) : closeButtonLabel && /*#__PURE__*/React__default["default"].createElement(react.Button, _rollupPluginBabelHelpers["extends"]({
@@ -201,6 +201,7 @@ exports.CoachmarkOverlayElements.propTypes = {
201
201
  * If a single media element is required, use `{render}`.
202
202
  * If a stepped animation is required, use `{filePaths}`.
203
203
  */
204
+ /**@ts-ignore*/
204
205
  media: index["default"].oneOfType([index["default"].shape({
205
206
  render: index["default"].func
206
207
  }), index["default"].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';
@@ -37,20 +37,21 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
37
37
  */
38
38
 
39
39
  var ConditionBlock = function ConditionBlock(props) {
40
- var _props$state = props.state,
41
- property = _props$state.property,
42
- value = _props$state.value,
43
- operator = _props$state.operator;
40
+ var _props$condition = props.condition,
41
+ property = _props$condition.property,
42
+ value = _props$condition.value,
43
+ operator = _props$condition.operator;
44
44
  var onRemove = props.onRemove,
45
45
  onChange = props.onChange,
46
- state = props.state,
46
+ condition = props.condition,
47
47
  conjunction = props.conjunction,
48
48
  onConnectorOperatorChange = props.onConnectorOperatorChange,
49
49
  isStatement = props.isStatement,
50
50
  group = props.group,
51
51
  onStatementChange = props.onStatementChange,
52
52
  addConditionHandler = props.addConditionHandler,
53
- conditionIndex = props.conditionIndex;
53
+ conditionIndex = props.conditionIndex,
54
+ isLastCondition = props.isLastCondition;
54
55
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
55
56
  inputConfig = _useContext.inputConfig;
56
57
  var itemComponents = {
@@ -69,13 +70,9 @@ var ConditionBlock = function ConditionBlock(props) {
69
70
  var getCurrentConfig = function getCurrentConfig(property) {
70
71
  var _inputConfig$properti, _inputConfig$properti2;
71
72
  return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.filter(function (eachProperty) {
72
- var _eachProperty$label;
73
- return ((_eachProperty$label = eachProperty.label) === null || _eachProperty$label === void 0 ? void 0 : _eachProperty$label.toUpperCase()) == (property === null || property === void 0 ? void 0 : property.toUpperCase());
73
+ return eachProperty.id == property;
74
74
  })[0]) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
75
75
  };
76
- var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
77
- return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
78
- };
79
76
  var _getCurrentConfig = getCurrentConfig(property),
80
77
  icon = _getCurrentConfig.icon,
81
78
  type = _getCurrentConfig.type,
@@ -90,7 +87,7 @@ var ConditionBlock = function ConditionBlock(props) {
90
87
  onConnectorOperatorChange(op);
91
88
  };
92
89
  var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
93
- onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
90
+ onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
94
91
  property: newProperty,
95
92
  operator: undefined,
96
93
  value: '',
@@ -98,14 +95,14 @@ var ConditionBlock = function ConditionBlock(props) {
98
95
  }));
99
96
  };
100
97
  var onOperatorChangeHandler = function onOperatorChangeHandler(newOperator) {
101
- onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
98
+ onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
102
99
  operator: newOperator,
103
100
  value: undefined,
104
101
  popoverToOpen: 'valueField'
105
102
  }));
106
103
  };
107
104
  var onValueChangeHandler = function onValueChangeHandler(newValue) {
108
- onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
105
+ onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
109
106
  value: newValue,
110
107
  popoverToOpen: ''
111
108
  }));
@@ -134,7 +131,8 @@ var ConditionBlock = function ConditionBlock(props) {
134
131
  title: DataConfigs.translateWithId('condition'),
135
132
  "data-name": "connectorField",
136
133
  popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
137
- className: "".concat(DataConfigs.blockClass, "__statement-button")
134
+ className: "".concat(DataConfigs.blockClass, "__statement-button"),
135
+ tabIndex: 0
138
136
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
139
137
  conditionState: {
140
138
  value: group.statement,
@@ -154,7 +152,7 @@ var ConditionBlock = function ConditionBlock(props) {
154
152
  renderIcon: icon !== null && icon !== void 0 ? icon : null,
155
153
  className: "".concat(DataConfigs.blockClass, "__property-field"),
156
154
  "data-name": "propertyField",
157
- state: state,
155
+ condition: condition,
158
156
  type: type
159
157
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
160
158
  conditionState: {
@@ -169,7 +167,7 @@ var ConditionBlock = function ConditionBlock(props) {
169
167
  label: operator,
170
168
  title: DataConfigs.translateWithId('operator'),
171
169
  "data-name": "operatorField",
172
- state: state,
170
+ condition: condition,
173
171
  type: type
174
172
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
175
173
  config: {
@@ -186,7 +184,7 @@ var ConditionBlock = function ConditionBlock(props) {
186
184
  title: label,
187
185
  showToolTip: true,
188
186
  "data-name": "valueField",
189
- state: state,
187
+ condition: condition,
190
188
  config: config
191
189
  }, /*#__PURE__*/React__default["default"].createElement(ItemComponent, {
192
190
  conditionState: {
@@ -229,6 +227,10 @@ ConditionBlock.propTypes = {
229
227
  * object hold aria attributes
230
228
  */
231
229
  aria: index["default"].object,
230
+ /**
231
+ * object that hold the current condition
232
+ */
233
+ condition: index["default"].object,
232
234
  /**
233
235
  * index of the current condition
234
236
  */
@@ -241,6 +243,10 @@ ConditionBlock.propTypes = {
241
243
  * object that hold the current group object where is condition is part of
242
244
  */
243
245
  group: index["default"].object,
246
+ /**
247
+ * callback to add a new condition
248
+ */
249
+ isLastCondition: index["default"].func,
244
250
  /**
245
251
  * boolean that decides to show the statement(if/ excl.if)
246
252
  */
@@ -260,11 +266,7 @@ ConditionBlock.propTypes = {
260
266
  /**
261
267
  * callback to handle the statement(if/ excl.if) change
262
268
  */
263
- onStatementChange: index["default"].func,
264
- /**
265
- * object that hold the current condition
266
- */
267
- state: index["default"].object
269
+ onStatementChange: index["default"].func
268
270
  };
269
271
 
270
272
  exports["default"] = ConditionBlock$1;
@@ -33,13 +33,13 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
33
33
  showToolTip = _ref.showToolTip,
34
34
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
35
35
  var Button = function Button() {
36
- return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({}, rest, {
36
+ return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
37
37
  // role={'gridcell'}
38
38
  tabIndex: -1,
39
39
  className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__condition-builder-button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
40
40
  type: "button",
41
41
  onClick: onClick
42
- }), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && label);
42
+ }, rest), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && label);
43
43
  };
44
44
  return hideLabel || showToolTip ? /*#__PURE__*/React__default["default"].createElement(react.Tooltip, _rollupPluginBabelHelpers["extends"]({
45
45
  label: label,
@@ -31,16 +31,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
31
31
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
32
32
  rootState = _useContext.rootState,
33
33
  setRootState = _useContext.setRootState;
34
- var _useState = React.useState(true),
34
+ var _useState = React.useState(false),
35
35
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
36
36
  isConditionBuilderActive = _useState2[0],
37
37
  setIsConditionBuilderActive = _useState2[1];
38
38
  React.useEffect(function () {
39
39
  var _rootState$groups;
40
40
  if (rootState !== null && rootState !== void 0 && (_rootState$groups = rootState.groups) !== null && _rootState$groups !== void 0 && _rootState$groups.length) {
41
- setIsConditionBuilderActive(false);
42
- } else {
43
41
  setIsConditionBuilderActive(true);
42
+ } else {
43
+ setIsConditionBuilderActive(false);
44
44
  }
45
45
  if (getConditionState) {
46
46
  getConditionState(rootState);
@@ -48,26 +48,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
48
48
 
49
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
50
50
  }, [rootState, conditionBuilderRef]);
51
- React.useEffect(function () {
52
- if (isConditionBuilderActive == false) {
53
- if (conditionBuilderRef.current) {
54
- var initial = conditionBuilderRef.current.querySelector('[role="gridcell"] button');
55
- if (initial) {
56
- initial.setAttribute('tabindex', '0');
57
- }
58
- }
59
- }
60
- }, [isConditionBuilderActive, conditionBuilderRef]);
61
51
  var onStartConditionBuilder = function onStartConditionBuilder() {
62
52
  //when add condition button is clicked.
63
- setIsConditionBuilderActive(false);
53
+ setIsConditionBuilderActive(true);
64
54
  setRootState(initialState !== null && initialState !== void 0 ? initialState : ConditionBuilderProvider.emptyState); //here we can set an empty skeleton object for an empty condition builder,
65
55
  //or we can even pre-populate some existing builder and continue editing
66
56
  };
67
- var _onRemove = React.useCallback(function (groupIndex) {
57
+ var _onRemove = React.useCallback(function (groupId) {
68
58
  setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
69
- groups: rootState.groups.filter(function (group, gIndex) {
70
- return groupIndex !== gIndex;
59
+ groups: rootState.groups.filter(function (group) {
60
+ return groupId !== group.id;
71
61
  })
72
62
  }));
73
63
  }, [setRootState, rootState]);
@@ -76,16 +66,15 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
76
66
  * This method is triggered from inner components. This will be called every time when any change is to be updated in the rootState.
77
67
  * This gets the updated group as argument.
78
68
  */
69
+ var groups = [].concat(_rollupPluginBabelHelpers.toConsumableArray(rootState.groups.slice(0, groupIndex)), [updatedGroup], _rollupPluginBabelHelpers.toConsumableArray(rootState.groups.slice(groupIndex + 1)));
79
70
  setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
80
- groups: rootState.groups.map(function (group, gIndex) {
81
- return groupIndex === gIndex ? updatedGroup : group;
82
- })
71
+ groups: groups
83
72
  }));
84
73
  };
85
74
  return /*#__PURE__*/React__default["default"].createElement("div", {
86
75
  className: "".concat(DataConfigs.blockClass, "__content-container"),
87
76
  tabIndex: -1
88
- }, isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
77
+ }, !isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
89
78
  className: "".concat(DataConfigs.blockClass, "__condition-builder"),
90
79
  renderIcon: function renderIcon(props) {
91
80
  return /*#__PURE__*/React__default["default"].createElement(icons.Add, _rollupPluginBabelHelpers["extends"]({
@@ -98,15 +87,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
98
87
  onClick: onStartConditionBuilder
99
88
  }, startConditionLabel), rootState && (rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.map(function (eachGroup, groupIndex) {
100
89
  return /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder["default"], {
90
+ className: "".concat(DataConfigs.blockClass, "__condition-builder__group"),
101
91
  key: groupIndex,
102
92
  aria: {
103
93
  level: 1,
104
94
  posinset: groupIndex * 2 + 1,
105
95
  setsize: rootState.groups.length * 2
106
96
  },
107
- state: eachGroup,
97
+ group: eachGroup,
108
98
  onRemove: function onRemove() {
109
- _onRemove(groupIndex);
99
+ _onRemove(eachGroup.id);
110
100
  },
111
101
  onChange: function onChange(updatedGroup) {
112
102
  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
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
13
13
  var React = require('react');
14
14
  var index = require('../../../node_modules/prop-types/index.js');
15
+ var uuidv4 = require('../../../global/js/utils/uuidv4.js');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -22,11 +23,13 @@ var emptyState = {
22
23
  groupSeparateOperator: null,
23
24
  groupOperator: 'and',
24
25
  statement: 'if',
26
+ id: uuidv4["default"](),
25
27
  conditions: [{
26
28
  property: undefined,
27
29
  operator: '',
28
30
  value: '',
29
- popoverToOpen: 'propertyField'
31
+ popoverToOpen: 'propertyField',
32
+ id: uuidv4["default"]()
30
33
  }]
31
34
  }]
32
35
  };
@@ -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
  }
@@ -21,7 +21,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
21
21
 
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
 
24
- var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "state", "popOverClassName", "config"];
24
+ var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config"];
25
25
  var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
26
26
  var children = _ref.children,
27
27
  className = _ref.className,
@@ -30,7 +30,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
30
30
  title = _ref.title,
31
31
  type = _ref.type,
32
32
  showToolTip = _ref.showToolTip,
33
- state = _ref.state,
33
+ condition = _ref.condition,
34
34
  popOverClassName = _ref.popOverClassName,
35
35
  config = _ref.config,
36
36
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
@@ -53,17 +53,17 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
53
53
  * rest['data-name'] holds the current field name
54
54
  * popoverToOpen hold the next popover to be opened if required
55
55
  */
56
- if (state) {
56
+ if (condition) {
57
57
  var currentField = rest['data-name'];
58
58
  //if any condition is changed, state prop is triggered
59
- if (state.popoverToOpen && currentField !== state.popoverToOpen) {
59
+ if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
60
60
  // close the previous popover
61
61
  setOpen(false);
62
- } else if (currentField == 'valueField' && type == 'option' && state.operator !== 'one-of') {
62
+ } else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'one-of') {
63
63
  //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.
64
64
  setOpen(false);
65
65
  }
66
- if (state.popoverToOpen == currentField) {
66
+ if (condition.popoverToOpen == currentField) {
67
67
  //current popover need to be opened
68
68
  setOpen(true);
69
69
  }
@@ -73,7 +73,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
73
73
  setOpen(false);
74
74
  }
75
75
  // eslint-disable-next-line react-hooks/exhaustive-deps
76
- }, [state, label]);
76
+ }, [condition, label]);
77
77
  React.useEffect(function () {
78
78
  //this will focus the first input field in the popover
79
79
  if (open && contentRef.current) {
@@ -121,6 +121,10 @@ ConditionBuilderItem.propTypes = {
121
121
  * Provide an optional class to be applied to the containing node.
122
122
  */
123
123
  className: index["default"].string,
124
+ /**
125
+ * current condition state object
126
+ */
127
+ condition: index["default"].object,
124
128
  /**
125
129
  * this is the config object again the current property from inputConfig
126
130
  */
@@ -142,10 +146,6 @@ ConditionBuilderItem.propTypes = {
142
146
  * show tool tip
143
147
  */
144
148
  showToolTip: index["default"].bool,
145
- /**
146
- * current condition state object
147
- */
148
- state: index["default"].object,
149
149
  /**
150
150
  * title of the popover
151
151
  */
@@ -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';