@carbon/ibm-products 2.42.1-canary.2 → 2.42.1-canary.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. package/css/index-full-carbon.css +302 -9
  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 +302 -9
  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 +302 -9
  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/Carousel/Carousel.d.ts +1 -1
  14. package/es/components/Carousel/Carousel.js +1 -1
  15. package/es/components/Coachmark/CoachmarkDragbar.d.ts +1 -1
  16. package/es/components/Coachmark/CoachmarkDragbar.js +1 -1
  17. package/es/components/Coachmark/CoachmarkHeader.d.ts +1 -1
  18. package/es/components/Coachmark/CoachmarkHeader.js +1 -1
  19. package/es/components/Coachmark/CoachmarkOverlay.d.ts +1 -1
  20. package/es/components/Coachmark/CoachmarkOverlay.js +1 -1
  21. package/es/components/Coachmark/CoachmarkTagline.d.ts +1 -1
  22. package/es/components/Coachmark/CoachmarkTagline.js +1 -1
  23. package/es/components/CoachmarkStack/CoachmarkStackHome.d.ts +1 -1
  24. package/es/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
  25. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +6 -0
  26. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +74 -33
  27. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
  28. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +95 -12
  29. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
  30. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +27 -9
  31. package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +38 -33
  32. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
  33. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +44 -0
  34. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
  35. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +95 -14
  36. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  37. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
  38. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
  39. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
  41. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +197 -67
  42. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
  43. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +69 -0
  44. package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
  45. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  46. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
  47. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
  48. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
  49. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +13 -3
  50. package/es/components/Datagrid/types/index.d.ts +2 -0
  51. package/es/components/Datagrid/useColumnOrder.d.ts +7 -1
  52. package/es/components/Datagrid/useNestedRows.js +24 -2
  53. package/es/components/Datagrid/useOnRowClick.d.ts +8 -1
  54. package/es/components/Datagrid/useOnRowClick.js +2 -1
  55. package/es/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
  56. package/es/components/Datagrid/useRowIsMouseOver.js +1 -1
  57. package/es/components/Datagrid/useSelectRows.d.ts +8 -1
  58. package/es/components/Datagrid/useSelectRows.js +3 -2
  59. package/es/components/Datagrid/useSortableColumns.d.ts +10 -3
  60. package/es/components/Datagrid/useSortableColumns.js +3 -2
  61. package/es/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
  62. package/es/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
  63. package/es/components/InterstitialScreenView/InterstitialScreenView.d.ts +1 -1
  64. package/es/components/InterstitialScreenView/InterstitialScreenView.js +1 -1
  65. package/es/components/SidePanel/SidePanel.d.ts +2 -2
  66. package/es/components/SidePanel/SidePanel.js +5 -3
  67. package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +1 -1
  68. package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +1 -1
  69. package/es/feature-flags.js +18 -0
  70. package/es/global/js/package-settings.js +2 -2
  71. package/es/index.d.ts +1 -0
  72. package/es/index.js +1 -0
  73. package/lib/components/Carousel/Carousel.d.ts +1 -1
  74. package/lib/components/Carousel/Carousel.js +1 -1
  75. package/lib/components/Coachmark/CoachmarkDragbar.d.ts +1 -1
  76. package/lib/components/Coachmark/CoachmarkDragbar.js +1 -1
  77. package/lib/components/Coachmark/CoachmarkHeader.d.ts +1 -1
  78. package/lib/components/Coachmark/CoachmarkHeader.js +1 -1
  79. package/lib/components/Coachmark/CoachmarkOverlay.d.ts +1 -1
  80. package/lib/components/Coachmark/CoachmarkOverlay.js +1 -1
  81. package/lib/components/Coachmark/CoachmarkTagline.d.ts +1 -1
  82. package/lib/components/Coachmark/CoachmarkTagline.js +1 -1
  83. package/lib/components/CoachmarkStack/CoachmarkStackHome.d.ts +1 -1
  84. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
  85. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +6 -0
  86. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +73 -32
  87. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +15 -1
  88. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +92 -9
  89. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +11 -2
  90. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +26 -8
  91. package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.js +36 -31
  92. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.d.ts +2 -0
  93. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +52 -0
  94. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +5 -0
  95. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +92 -11
  96. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  97. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -0
  98. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +7 -0
  99. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +8 -1
  100. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -1
  101. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +195 -64
  102. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +10 -0
  103. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +77 -0
  104. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
  105. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  106. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
  107. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
  108. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
  109. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +13 -3
  110. package/lib/components/Datagrid/types/index.d.ts +2 -0
  111. package/lib/components/Datagrid/useColumnOrder.d.ts +7 -1
  112. package/lib/components/Datagrid/useNestedRows.js +24 -2
  113. package/lib/components/Datagrid/useOnRowClick.d.ts +8 -1
  114. package/lib/components/Datagrid/useOnRowClick.js +2 -1
  115. package/lib/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
  116. package/lib/components/Datagrid/useRowIsMouseOver.js +1 -1
  117. package/lib/components/Datagrid/useSelectRows.d.ts +8 -1
  118. package/lib/components/Datagrid/useSelectRows.js +3 -2
  119. package/lib/components/Datagrid/useSortableColumns.d.ts +10 -3
  120. package/lib/components/Datagrid/useSortableColumns.js +3 -2
  121. package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
  122. package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
  123. package/lib/components/InterstitialScreenView/InterstitialScreenView.d.ts +1 -1
  124. package/lib/components/InterstitialScreenView/InterstitialScreenView.js +1 -1
  125. package/lib/components/SidePanel/SidePanel.d.ts +2 -2
  126. package/lib/components/SidePanel/SidePanel.js +5 -3
  127. package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +1 -1
  128. package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +1 -1
  129. package/lib/feature-flags.js +40 -0
  130. package/lib/global/js/package-settings.js +2 -2
  131. package/lib/index.d.ts +1 -0
  132. package/lib/index.js +1 -0
  133. package/package.json +3 -3
  134. package/scss/components/ConditionBuilder/_condition-builder.scss +21 -1
  135. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +22 -3
  136. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +58 -21
  137. package/scss/components/NonLinearReading/_non-linear-reading.scss +1 -1
  138. /package/es/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
  139. /package/lib/components/ConditionBuilder/{ConditionConnector → ConditionBuilderConnector}/ConditionConnector.d.ts +0 -0
@@ -9,6 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var icons = require('@carbon/react/icons');
14
15
  var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
@@ -21,28 +22,110 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
22
 
22
23
  var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
23
24
  var className = _ref.className,
24
- onClick = _ref.onClick;
25
+ onClick = _ref.onClick,
26
+ addConditionSubGroupHandler = _ref.addConditionSubGroupHandler,
27
+ showConditionSubGroupPreviewHandler = _ref.showConditionSubGroupPreviewHandler,
28
+ hideConditionSubGroupPreviewHandler = _ref.hideConditionSubGroupPreviewHandler,
29
+ showConditionPreviewHandler = _ref.showConditionPreviewHandler,
30
+ hideConditionPreviewHandler = _ref.hideConditionPreviewHandler,
31
+ enableSubGroup = _ref.enableSubGroup,
32
+ buttonLabel = _ref.buttonLabel;
33
+ var _useState = React.useState(false),
34
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
35
+ isAddSubgroup = _useState2[0],
36
+ setIsAddSubgroup = _useState2[1];
37
+ var showAddSubGroup = function showAddSubGroup() {
38
+ setIsAddSubgroup(true);
39
+ };
40
+ var hideAddSubGroup = function hideAddSubGroup() {
41
+ setIsAddSubgroup(false);
42
+ };
43
+ var onClickHandler = function onClickHandler() {
44
+ hideConditionPreviewHandler === null || hideConditionPreviewHandler === void 0 || hideConditionPreviewHandler();
45
+ onClick();
46
+ };
47
+ var previewHandlers = function previewHandlers() {
48
+ return enableSubGroup ? {
49
+ onMouseEnter: showConditionPreviewHandler,
50
+ onMouseLeave: hideConditionPreviewHandler,
51
+ onFocus: showConditionPreviewHandler,
52
+ onBlur: hideConditionPreviewHandler
53
+ } : {};
54
+ };
55
+ var previewHandlersForSubgroup = function previewHandlersForSubgroup() {
56
+ return {
57
+ onMouseEnter: showConditionSubGroupPreviewHandler,
58
+ onMouseLeave: hideConditionSubGroupPreviewHandler,
59
+ onFocus: showConditionSubGroupPreviewHandler,
60
+ onBlur: hideConditionSubGroupPreviewHandler
61
+ };
62
+ };
63
+ var wrapperProps = enableSubGroup ? {
64
+ role: 'gridcell',
65
+ 'aria-label': DataConfigs.translateWithId('add-condition')
66
+ } : {};
25
67
  return /*#__PURE__*/React__default["default"].createElement("div", {
26
- className: className,
27
- role: "gridcell"
28
- }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
68
+ className: "".concat(className, " ").concat(DataConfigs.blockClass, "__add-button-wrapper"),
69
+ role: !enableSubGroup ? 'gridcell' : 'none',
70
+ "aria-label": !enableSubGroup ? DataConfigs.translateWithId('add_condition_row') : undefined,
71
+ onMouseEnter: showAddSubGroup,
72
+ onMouseLeave: hideAddSubGroup,
73
+ onFocus: showAddSubGroup,
74
+ onBlur: hideAddSubGroup
75
+ }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
29
76
  renderIcon: icons.AddAlt,
30
- onClick: onClick,
77
+ onClick: onClickHandler
78
+ }, previewHandlers(), {
31
79
  className: "".concat(DataConfigs.blockClass, "__add-button"),
32
80
  hideLabel: true,
33
- label: DataConfigs.translateWithId('add-condition')
34
- }));
81
+ "data-name": "addButton",
82
+ label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : DataConfigs.translateWithId('add-condition'),
83
+ wrapperProps: wrapperProps
84
+ })), isAddSubgroup && enableSubGroup && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
85
+ renderIcon: icons.TextNewLine,
86
+ onClick: addConditionSubGroupHandler,
87
+ className: "".concat(DataConfigs.blockClass, "__add-condition-group ").concat(DataConfigs.blockClass, "__gap-left"),
88
+ hideLabel: true,
89
+ label: DataConfigs.translateWithId('add-condition'),
90
+ wrapperProps: wrapperProps
91
+ }, previewHandlersForSubgroup())));
35
92
  };
36
93
  var ConditionBuilderAdd$1 = ConditionBuilderAdd;
37
94
  ConditionBuilderAdd.propTypes = {
95
+ /**
96
+ * handler for hiding sub group preview
97
+ */
98
+ addConditionSubGroupHandler: index["default"].func,
99
+ /**
100
+ * handler for hiding sub group preview
101
+ */ /**
102
+ * tooltip label for plus button
103
+ */
104
+ buttonLabel: index["default"].string,
38
105
  /**
39
106
  * Provide an optional class to be applied to the containing node.
40
107
  */
41
108
  className: index["default"].string,
42
109
  /**
43
- * callback triggered on click of add button
110
+ * boolean to enable sub groups for the tree variant
111
+ */
112
+ enableSubGroup: index["default"].bool,
113
+ /**
114
+ * handler for hiding sub group preview
115
+ */
116
+ hideConditionPreviewHandler: index["default"].func,
117
+ hideConditionSubGroupPreviewHandler: index["default"].func,
118
+ /**
119
+ * handler for hiding sub group preview
120
+ */ /**
121
+ * callback triggered on click of add button
122
+ */
123
+ onClick: index["default"].func,
124
+ showConditionPreviewHandler: index["default"].func,
125
+ showConditionSubGroupPreviewHandler: index["default"].func
126
+ /**
127
+ * handler for hiding sub group preview
44
128
  */
45
- onClick: index["default"].func
46
129
  };
47
130
 
48
131
  exports["default"] = ConditionBuilderAdd$1;
@@ -1,5 +1,4 @@
1
- export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, ...rest }: {
2
- [x: string]: any;
1
+ export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, }: {
3
2
  className: any;
4
3
  label: any;
5
4
  hideLabel: any;
@@ -7,16 +6,26 @@ export function ConditionBuilderButton({ className, label, hideLabel, tooltipAli
7
6
  renderIcon: any;
8
7
  onClick: any;
9
8
  showToolTip: any;
9
+ wrapperProps: any;
10
+ onBlur: any;
11
+ onFocus: any;
12
+ onMouseEnter: any;
13
+ onMouseLeave: any;
10
14
  }): import("react/jsx-runtime").JSX.Element;
11
15
  export namespace ConditionBuilderButton {
12
16
  namespace propTypes {
13
17
  let className: PropTypes.Requireable<string>;
14
18
  let hideLabel: PropTypes.Requireable<boolean>;
15
19
  let label: PropTypes.Requireable<string>;
20
+ let onBlur: PropTypes.Requireable<(...args: any[]) => any>;
16
21
  let onClick: PropTypes.Requireable<(...args: any[]) => any>;
22
+ let onFocus: PropTypes.Requireable<(...args: any[]) => any>;
23
+ let onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
24
+ let onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
17
25
  let renderIcon: PropTypes.Requireable<object>;
18
26
  let showToolTip: PropTypes.Requireable<boolean>;
19
27
  let tooltipAlign: PropTypes.Requireable<string>;
28
+ let wrapperProps: PropTypes.Requireable<object>;
20
29
  }
21
30
  }
22
31
  import PropTypes from 'prop-types';
@@ -21,9 +21,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
21
21
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
22
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
23
 
24
- var _excluded = ["className", "label", "hideLabel", "tooltipAlign", "renderIcon", "onClick", "showToolTip"];
25
24
  var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
26
- var _Icon;
25
+ var _Icon, _span;
27
26
  var className = _ref.className,
28
27
  label = _ref.label,
29
28
  hideLabel = _ref.hideLabel,
@@ -31,21 +30,29 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
31
30
  Icon = _ref.renderIcon,
32
31
  onClick = _ref.onClick,
33
32
  showToolTip = _ref.showToolTip,
34
- rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
33
+ wrapperProps = _ref.wrapperProps,
34
+ onBlur = _ref.onBlur,
35
+ onFocus = _ref.onFocus,
36
+ onMouseEnter = _ref.onMouseEnter,
37
+ onMouseLeave = _ref.onMouseLeave;
35
38
  var Button = function Button() {
36
- return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
39
+ return /*#__PURE__*/React__default["default"].createElement("button", {
37
40
  // role={'gridcell'}
38
41
  tabIndex: -1,
39
42
  className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
40
43
  type: "button",
41
- onClick: onClick
42
- }, rest), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && label);
44
+ onClick: onClick,
45
+ onBlur: onBlur,
46
+ onFocus: onFocus,
47
+ onMouseEnter: onMouseEnter,
48
+ onMouseLeave: onMouseLeave
49
+ }, Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && (_span || (_span = /*#__PURE__*/React__default["default"].createElement("span", null, label))));
43
50
  };
44
51
  return hideLabel || showToolTip ? /*#__PURE__*/React__default["default"].createElement(react.Tooltip, _rollupPluginBabelHelpers["extends"]({
45
52
  label: label,
46
53
  align: tooltipAlign,
47
54
  className: "".concat(DataConfigs.blockClass, "__con-tooltip")
48
- }, rest.wrapperProps), Button()) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, Button());
55
+ }, wrapperProps), Button()) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, Button());
49
56
  };
50
57
  ConditionBuilderButton.propTypes = {
51
58
  /**
@@ -60,10 +67,17 @@ ConditionBuilderButton.propTypes = {
60
67
  * label of the button
61
68
  */
62
69
  label: index["default"].string,
70
+ /**
71
+ * mouse events callbacks
72
+ */
73
+ onBlur: index["default"].func,
63
74
  /**
64
75
  * callback triggered on click of add button
65
76
  */
66
77
  onClick: index["default"].func,
78
+ onFocus: index["default"].func,
79
+ onMouseEnter: index["default"].func,
80
+ onMouseLeave: index["default"].func,
67
81
  /**
68
82
  * Optional prop to allow overriding the icon rendering.
69
83
  */
@@ -77,7 +91,11 @@ ConditionBuilderButton.propTypes = {
77
91
  /**
78
92
  * tooltip position
79
93
  */
80
- tooltipAlign: index["default"].string
94
+ tooltipAlign: index["default"].string,
95
+ /**
96
+ * optional props for tree grid to add role and aria-label to wrapper span
97
+ */
98
+ wrapperProps: index["default"].object
81
99
  };
82
100
 
83
101
  exports.ConditionBuilderButton = ConditionBuilderButton;
@@ -14,21 +14,22 @@ var React = require('react');
14
14
  var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
15
15
  var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
16
16
  var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
17
- var settings = require('../../../settings.js');
18
17
  var index = require('../../../node_modules/prop-types/index.js');
19
18
  var util = require('../utils/util.js');
19
+ var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
20
20
 
21
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
22
 
23
23
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
24
 
25
25
  var _excluded = ["operator", "className", "onChange"];
26
- var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
27
- function ConditionConnector(_ref) {
26
+ var ConditionConnector = function ConditionConnector(_ref) {
28
27
  var operator = _ref.operator,
29
28
  className = _ref.className,
30
29
  onChange = _ref.onChange,
31
30
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
31
+ var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
32
+ variant = _useContext.variant;
32
33
  var handleConnectorHover = React.useCallback(function (parentGroup, isHover) {
33
34
  if (isHover) {
34
35
  parentGroup.classList.add('hoveredConnector');
@@ -48,33 +49,37 @@ function ConditionConnector(_ref) {
48
49
  onChange(op);
49
50
  util.focusThisField(evt);
50
51
  };
51
- return (
52
- /*#__PURE__*/
53
- // <div className={className} {...rest}>
54
- React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, _rollupPluginBabelHelpers["extends"]({
55
- label: operator,
56
- title: DataConfigs.translateWithId('connector'),
57
- "data-name": "connectorField",
58
- onMouseEnter: activeConnectorHandler,
59
- onMouseLeave: inActiveConnectorHandler,
60
- onFocus: activeConnectorHandler,
61
- onBlur: inActiveConnectorHandler
62
- }, rest, {
63
- popOverClassName: className,
64
- className: "".concat(blockClass, "__connector-button ")
65
- }), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
66
- config: {
67
- options: DataConfigs.connectorConfig
68
- },
69
- conditionState: {
70
- value: operator,
71
- label: DataConfigs.translateWithId('connector')
72
- },
73
- onChange: onChangeHandler
74
- }))
75
- // </div>
76
- );
77
- }
52
+ return variant == 'tree' ? /*#__PURE__*/React__default["default"].createElement("span", {
53
+ className: "".concat(className, " ").concat(DataConfigs.blockClass, "__connector-disabled")
54
+ }, operator) :
55
+ /*#__PURE__*/
56
+ // <div className={className} {...rest}>
57
+ React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, _rollupPluginBabelHelpers["extends"]({
58
+ label: operator,
59
+ title: DataConfigs.translateWithId('connector'),
60
+ "data-name": "connectorField",
61
+ onMouseEnter: activeConnectorHandler,
62
+ onMouseLeave: inActiveConnectorHandler,
63
+ onFocus: activeConnectorHandler,
64
+ onBlur: inActiveConnectorHandler
65
+ }, rest, {
66
+ popOverClassName: className,
67
+ className: "".concat(DataConfigs.blockClass, "__connector-button ")
68
+ }), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
69
+ config: {
70
+ options: DataConfigs.connectorConfig
71
+ },
72
+ conditionState: {
73
+ value: operator,
74
+ label: DataConfigs.translateWithId('connector')
75
+ },
76
+ onChange: onChangeHandler
77
+ }))
78
+
79
+ // </div>
80
+ ;
81
+ };
82
+ var ConditionConnector$1 = ConditionConnector;
78
83
  ConditionConnector.propTypes = {
79
84
  /**
80
85
  * Provide an optional class to be applied to the containing node.
@@ -90,4 +95,4 @@ ConditionConnector.propTypes = {
90
95
  operator: index["default"].string
91
96
  };
92
97
 
93
- exports["default"] = ConditionConnector;
98
+ exports["default"] = ConditionConnector$1;
@@ -0,0 +1,2 @@
1
+ export default GroupConnector;
2
+ declare function GroupConnector(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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
+
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var React = require('react');
13
+ var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
14
+ var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
15
+ var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
16
+ var util = require('../utils/util.js');
17
+ var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
18
+
19
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
+
21
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
+
23
+ var GroupConnector = function GroupConnector() {
24
+ var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
25
+ rootState = _useContext.rootState;
26
+ return /*#__PURE__*/React__default["default"].createElement("div", {
27
+ className: "".concat(DataConfigs.blockClass, "__group-separator"),
28
+ role: "row",
29
+ tabIndex: -1,
30
+ "aria-level": 1
31
+ }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
32
+ label: rootState.operator,
33
+ title: DataConfigs.translateWithId('condition'),
34
+ "data-name": "connectorField",
35
+ popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
36
+ className: "".concat(DataConfigs.blockClass, "__statement-button")
37
+ }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
38
+ conditionState: {
39
+ value: rootState.operator,
40
+ label: DataConfigs.translateWithId('condition')
41
+ },
42
+ onChange: function onChange(v, e) {
43
+ util.focusThisField(e);
44
+ },
45
+ config: {
46
+ options: DataConfigs.connectorConfig
47
+ }
48
+ })));
49
+ };
50
+ var GroupConnector$1 = GroupConnector;
51
+
52
+ exports["default"] = GroupConnector$1;
@@ -7,7 +7,12 @@ declare function ConditionBuilderContent({ startConditionLabel, conditionBuilder
7
7
  }): import("react/jsx-runtime").JSX.Element;
8
8
  declare namespace ConditionBuilderContent {
9
9
  namespace propTypes {
10
+ let actions: PropTypes.Requireable<(PropTypes.InferProps<{
11
+ id: PropTypes.Requireable<number>;
12
+ label: PropTypes.Requireable<string>;
13
+ }> | null | undefined)[]>;
10
14
  let conditionBuilderRef: PropTypes.Requireable<object>;
15
+ let getActionsState: PropTypes.Requireable<(...args: any[]) => any>;
11
16
  let getConditionState: PropTypes.Validator<(...args: any[]) => any>;
12
17
  let initialState: PropTypes.Requireable<PropTypes.InferProps<{
13
18
  groups: PropTypes.Requireable<(PropTypes.InferProps<{
@@ -17,24 +17,37 @@ var icons = require('@carbon/react/icons');
17
17
  var ConditionGroupBuilder = require('../ConditionGroupBuilder/ConditionGroupBuilder.js');
18
18
  var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
19
19
  var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
20
+ var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
21
+ var uuidv4 = require('../../../global/js/utils/uuidv4.js');
22
+ var ConditionPreview = require('../ConditionPreview/ConditionPreview.js');
23
+ var GroupConnector = require('../ConditionBuilderConnector/GroupConnector.js');
20
24
 
21
25
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
26
 
23
27
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
28
 
29
+ var _Heading, _GroupConnector, _ConditionPreview;
25
30
  var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
26
31
  var _rootState$groups2;
27
32
  var startConditionLabel = _ref.startConditionLabel,
28
33
  conditionBuilderRef = _ref.conditionBuilderRef,
29
34
  getConditionState = _ref.getConditionState,
30
35
  initialState = _ref.initialState;
36
+ // const { rootState, setRootState, variant, actionState } = useContext(
37
+ // ConditionBuilderContext
38
+ // );
31
39
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
32
40
  rootState = _useContext.rootState,
33
- setRootState = _useContext.setRootState;
41
+ setRootState = _useContext.setRootState,
42
+ variant = _useContext.variant;
34
43
  var _useState = React.useState(false),
35
44
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
36
45
  isConditionBuilderActive = _useState2[0],
37
46
  setIsConditionBuilderActive = _useState2[1];
47
+ var _useState3 = React.useState(false),
48
+ _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
49
+ showConditionGroupPreview = _useState4[0],
50
+ setShowConditionGroupPreview = _useState4[1];
38
51
  React.useEffect(function () {
39
52
  var _rootState$groups;
40
53
  if (rootState !== null && rootState !== void 0 && (_rootState$groups = rootState.groups) !== null && _rootState$groups !== void 0 && _rootState$groups.length) {
@@ -47,7 +60,12 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
47
60
  }
48
61
 
49
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
50
- }, [rootState, conditionBuilderRef]);
63
+ }, [rootState]);
64
+
65
+ // useEffect(() => {
66
+ // getActionsState?.(actionState);
67
+ // // eslint-disable-next-line react-hooks/exhaustive-deps
68
+ // }, [actionState]);
51
69
  var onStartConditionBuilder = function onStartConditionBuilder() {
52
70
  //when add condition button is clicked.
53
71
  setIsConditionBuilderActive(true);
@@ -71,10 +89,28 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
71
89
  groups: groups
72
90
  }));
73
91
  };
74
- return /*#__PURE__*/React__default["default"].createElement("div", {
75
- className: "".concat(DataConfigs.blockClass, "__content-container"),
76
- tabIndex: -1
77
- }, !isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
92
+ var addConditionGroupHandler = function addConditionGroupHandler() {
93
+ var newGroup = {
94
+ groupSeparateOperator: 'and',
95
+ // 'or'|'and'|'null',
96
+ groupOperator: 'and',
97
+ //'and|or',
98
+ statement: 'if',
99
+ // 'if|exclude if',
100
+ id: uuidv4["default"](),
101
+ conditions: [{
102
+ property: undefined,
103
+ operator: '',
104
+ value: '',
105
+ popoverToOpen: 'propertyField',
106
+ id: uuidv4["default"]()
107
+ }]
108
+ };
109
+ setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
110
+ groups: [].concat(_rollupPluginBabelHelpers.toConsumableArray(rootState.groups), [newGroup])
111
+ }));
112
+ };
113
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
78
114
  className: "".concat(DataConfigs.blockClass, "__add-condition-button"),
79
115
  renderIcon: function renderIcon(props) {
80
116
  return /*#__PURE__*/React__default["default"].createElement(icons.Add, _rollupPluginBabelHelpers["extends"]({
@@ -85,10 +121,22 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
85
121
  kind: "ghost",
86
122
  size: "sm",
87
123
  onClick: onStartConditionBuilder
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) {
89
- return /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder["default"], {
124
+ }, startConditionLabel), isConditionBuilderActive &&
125
+ /*#__PURE__*/
126
+ // <h5 >Condition</h5>
127
+ React__default["default"].createElement(react.Section, {
128
+ className: "".concat(DataConfigs.blockClass, "__heading"),
129
+ level: 4
130
+ }, _Heading || (_Heading = /*#__PURE__*/React__default["default"].createElement(react.Heading, null, "Condition"))), /*#__PURE__*/React__default["default"].createElement("div", {
131
+ className: "".concat(DataConfigs.blockClass, "__content-container"),
132
+ role: "treegrid",
133
+ "aria-label": "condition builder tree"
134
+ }, rootState && (rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.map(function (eachGroup, groupIndex) {
135
+ return /*#__PURE__*/React__default["default"].createElement("div", {
136
+ key: eachGroup.id,
137
+ className: "".concat(DataConfigs.blockClass, "__group-wrapper")
138
+ }, /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder["default"], {
90
139
  className: "".concat(DataConfigs.blockClass, "__group"),
91
- key: groupIndex,
92
140
  aria: {
93
141
  level: 1,
94
142
  posinset: groupIndex * 2 + 1,
@@ -102,15 +150,48 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
102
150
  onChangeHandler(updatedGroup, groupIndex);
103
151
  },
104
152
  conditionBuilderRef: conditionBuilderRef
105
- });
106
- })));
153
+ }), groupIndex < rootState.groups.length - 1 && (_GroupConnector || (_GroupConnector = /*#__PURE__*/React__default["default"].createElement(GroupConnector["default"], null))));
154
+ })), isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, variant == 'tree' && /*#__PURE__*/React__default["default"].createElement("div", {
155
+ role: "row",
156
+ tabIndex: -1,
157
+ "aria-level": 1
158
+ }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
159
+ renderIcon: icons.TextNewLine,
160
+ onClick: addConditionGroupHandler,
161
+ onMouseEnter: function onMouseEnter() {
162
+ setShowConditionGroupPreview(true);
163
+ },
164
+ onMouseLeave: function onMouseLeave() {
165
+ setShowConditionGroupPreview(false);
166
+ },
167
+ className: "".concat(DataConfigs.blockClass, "__add-condition-group "),
168
+ hideLabel: true,
169
+ label: DataConfigs.translateWithId('add-condition-sub-group'),
170
+ wrapperProps: {
171
+ role: 'gridcell',
172
+ 'aria-label': DataConfigs.translateWithId('add-condition-sub-group')
173
+ }
174
+ })), showConditionGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
175
+ previewType: "newGroup"
176
+ }))))));
107
177
  };
108
178
  var ConditionBuilderContent$1 = ConditionBuilderContent;
109
179
  ConditionBuilderContent.propTypes = {
180
+ /**
181
+ * optional array of object that give the list of actions.
182
+ */
183
+ actions: index["default"].arrayOf(index["default"].shape({
184
+ id: index["default"].number,
185
+ label: index["default"].string
186
+ })),
110
187
  /**
111
188
  * ref of condition builder
112
189
  */
113
190
  conditionBuilderRef: index["default"].object,
191
+ /**
192
+ * callback functions that will provide the updated action state back.
193
+ */
194
+ getActionsState: index["default"].func,
114
195
  /**
115
196
  * This is a callback function that returns the updated state
116
197
  */
@@ -1,4 +1,5 @@
1
1
  export namespace emptyState {
2
+ let operator: string;
2
3
  let groups: {
3
4
  groupSeparateOperator: null;
4
5
  groupOperator: string;
@@ -19,6 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
20
 
21
21
  var emptyState = {
22
+ operator: 'or',
22
23
  groups: [{
23
24
  groupSeparateOperator: null,
24
25
  groupOperator: 'and',
@@ -17,9 +17,12 @@ export namespace translationsObject {
17
17
  after: string;
18
18
  between: string;
19
19
  'add-condition': string;
20
+ 'add-condition-group': string;
21
+ 'add-condition-sub-group': string;
20
22
  condition: string;
21
23
  property: string;
22
24
  operator: string;
25
+ value: string;
23
26
  connector: string;
24
27
  condition_row: string;
25
28
  remove_condition: string;
@@ -27,5 +30,9 @@ export namespace translationsObject {
27
30
  start: string;
28
31
  end: string;
29
32
  clear_search: string;
33
+ actions: string;
34
+ then: string;
35
+ remove_action: string;
36
+ add_action: string;
30
37
  };
31
38
  }
@@ -28,16 +28,23 @@ var translationsObject = {
28
28
  after: 'is after',
29
29
  between: 'is between',
30
30
  'add-condition': 'Add Condition',
31
+ 'add-condition-group': 'Add Condition Group',
32
+ 'add-condition-sub-group': 'Add Condition sub group',
31
33
  condition: 'Condition',
32
34
  property: 'Property',
33
35
  operator: 'Operator',
36
+ value: 'Value',
34
37
  connector: 'Connector',
35
38
  condition_row: 'Condition row',
36
39
  remove_condition: 'Remove condition',
37
40
  add_condition_row: 'Add condition row',
38
41
  start: 'Start',
39
42
  end: 'End',
40
- clear_search: 'Clear search input'
43
+ clear_search: 'Clear search input',
44
+ actions: 'Actions',
45
+ then: 'then',
46
+ remove_action: 'Remove Action',
47
+ add_action: 'Add action'
41
48
  }
42
49
  };
43
50
 
@@ -95,7 +95,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
95
95
  label: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : DataConfigs.translateWithId('add-condition'),
96
96
  hideLabel: !label ? true : false,
97
97
  onClick: function onClick() {
98
- setOpen(!open);
98
+ children ? setOpen(!open) : null;
99
99
  },
100
100
  className: className,
101
101
  "aria-haspopup": true,