@carbon/ibm-products 2.40.0 → 2.40.1-canary.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/css/index-full-carbon.css +38 -35
  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 +2 -1
  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 +38 -35
  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 +701 -35
  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/ConditionBuilder/ConditionBlock/ConditionBlock.js +3 -3
  18. package/es/components/ConditionBuilder/ConditionBuilder.js +6 -1
  19. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +3 -3
  20. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +1 -1
  21. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +2 -2
  22. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +3 -3
  23. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  24. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +1 -1
  25. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +30 -18
  26. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -3
  27. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +7 -7
  28. package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +6 -6
  29. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +11 -11
  30. package/es/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +1 -0
  31. package/es/components/ConditionBuilder/utils/checkForHoldingKey.js +16 -0
  32. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
  33. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +125 -0
  34. package/es/components/ConditionBuilder/utils/util.d.ts +1 -1
  35. package/es/components/ConditionBuilder/utils/util.js +34 -5
  36. package/es/components/Datagrid/Datagrid/DatagridContent.js +2 -2
  37. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +3 -4
  38. package/es/components/PageHeader/PageHeader.js +1 -0
  39. package/es/components/TagOverflow/TagOverflow.js +35 -20
  40. package/es/components/TagOverflow/TagOverflowModal.d.ts +3 -1
  41. package/es/components/TagOverflow/TagOverflowModal.js +14 -20
  42. package/es/components/TagOverflow/TagOverflowPopover.js +19 -4
  43. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +3 -3
  44. package/lib/components/ConditionBuilder/ConditionBuilder.js +6 -1
  45. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +3 -3
  46. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +1 -1
  47. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +2 -2
  48. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +3 -3
  49. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  50. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +1 -1
  51. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +29 -17
  52. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -3
  53. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +7 -7
  54. package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +6 -6
  55. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +11 -11
  56. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +1 -0
  57. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.js +20 -0
  58. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
  59. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +129 -0
  60. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -1
  61. package/lib/components/ConditionBuilder/utils/util.js +36 -4
  62. package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -2
  63. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +3 -4
  64. package/lib/components/PageHeader/PageHeader.js +1 -0
  65. package/lib/components/TagOverflow/TagOverflow.js +34 -19
  66. package/lib/components/TagOverflow/TagOverflowModal.d.ts +3 -1
  67. package/lib/components/TagOverflow/TagOverflowModal.js +14 -20
  68. package/lib/components/TagOverflow/TagOverflowPopover.js +19 -4
  69. package/package.json +2 -2
  70. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +4 -4
  71. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +34 -34
  72. package/scss/components/Datagrid/styles/_datagrid.scss +2 -1
  73. package/scss/components/TagOverflow/_tag-overflow.scss +5 -2
  74. package/scss/components/_index-with-carbon.scss +1 -0
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useRef, useState, useCallback, useEffect } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
@@ -19,13 +19,13 @@ import { TagOverflowPopover } from './TagOverflowPopover.js';
19
19
  import { TagOverflowModal } from './TagOverflowModal.js';
20
20
 
21
21
  var _excluded = ["items", "tagComponent", "align", "showAllTagsLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "className", "containingElementRef", "measurementOffset", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange"],
22
- _excluded2 = ["className", "id"];
22
+ _excluded2 = ["className", "id"],
23
+ _excluded3 = ["tagType"],
24
+ _excluded4 = ["id", "label", "tagType", "onClose"];
23
25
  var blockClass = "".concat(pkg.prefix, "--tag-overflow");
24
26
  var componentName = 'TagOverflow';
25
27
  var allTagsModalSearchThreshold = 10;
26
28
 
27
- // TODO: support prop overflowType
28
-
29
29
  // Default values for props
30
30
  var defaults = {
31
31
  items: [],
@@ -164,39 +164,53 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
164
164
  visibleItemsArr = (_visibleItemsArr = visibleItemsArr) === null || _visibleItemsArr === void 0 ? void 0 : _visibleItemsArr.slice(0, maxVisible);
165
165
  }
166
166
  var hiddenItems = items === null || items === void 0 ? void 0 : items.slice(visibleItemsArr.length);
167
- var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (item) {
168
- return {
169
- type: item.tagType,
170
- label: item.label,
171
- id: item.id
172
- };
167
+ var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (_ref2) {
168
+ var tagType = _ref2.tagType,
169
+ other = _objectWithoutProperties(_ref2, _excluded3);
170
+ return _objectSpread2({
171
+ type: tagType
172
+ }, other);
173
173
  });
174
174
  setVisibleItems(visibleItemsArr);
175
175
  setOverflowItems(overflowItemsArr);
176
176
  onOverflowTagChange === null || onOverflowTagChange === void 0 || onOverflowTagChange(overflowItemsArr);
177
177
  }, [containerWidth, items, maxVisible, getVisibleItems, onOverflowTagChange]);
178
+ var handleTagOnClose = useCallback(function (onClose, index) {
179
+ onClose === null || onClose === void 0 || onClose();
180
+ if (index <= visibleItems.length - 1) {
181
+ setPopoverOpen(false);
182
+ }
183
+ }, [visibleItems]);
178
184
  return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
179
185
  className: cx(blockClass, className, "".concat(blockClass, "--align-").concat(align), _defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
180
186
  ref: containerRef,
181
187
  role: "main"
182
- }, getDevtoolsProps(componentName)), visibleItems.length > 0 && visibleItems.map(function (item) {
188
+ }, getDevtoolsProps(componentName)), visibleItems.length > 0 && visibleItems.map(function (item, index) {
183
189
  // Render custom components
184
190
  if (tagComponent) {
185
191
  return getCustomComponent(item);
186
192
  } else {
193
+ var id = item.id,
194
+ label = item.label,
195
+ tagType = item.tagType,
196
+ _onClose = item.onClose,
197
+ other = _objectWithoutProperties(item, _excluded4);
187
198
  // If there is no template prop, then render items as Tags
188
199
  return /*#__PURE__*/React__default.createElement("div", {
189
200
  ref: function ref(node) {
190
- return itemRefHandler(item.id, node);
201
+ return itemRefHandler(id, node);
191
202
  },
192
- key: item.id
203
+ key: id
193
204
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
194
- align: "bottom",
195
- label: item.label
196
- }, /*#__PURE__*/React__default.createElement(Tag, {
205
+ align: overflowAlign,
206
+ label: label
207
+ }, /*#__PURE__*/React__default.createElement(Tag, _extends({}, other, {
197
208
  className: "".concat(blockClass, "__item--tag"),
198
- type: item.tagType
199
- }, item.label)));
209
+ type: tagType,
210
+ onClose: function onClose() {
211
+ return handleTagOnClose(_onClose, index);
212
+ }
213
+ }), label)));
200
214
  }
201
215
  }), /*#__PURE__*/React__default.createElement("span", {
202
216
  className: "".concat(blockClass, "__indicator"),
@@ -218,6 +232,7 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
218
232
  open: showAllModalOpen,
219
233
  title: allTagsModalTitle,
220
234
  onClose: handleModalClose,
235
+ overflowType: overflowType,
221
236
  searchLabel: allTagsModalSearchLabel,
222
237
  searchPlaceholder: allTagsModalSearchPlaceholderText,
223
238
  portalTarget: allTagsModalTarget
@@ -236,8 +251,8 @@ var tagTypes = Object.keys(TYPES);
236
251
  * The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
237
252
  * @returns null if no problems
238
253
  */
239
- var string_required_if_more_than_10_tags = isRequiredIf(PropTypes.string, function (_ref2) {
240
- var items = _ref2.items;
254
+ var string_required_if_more_than_10_tags = isRequiredIf(PropTypes.string, function (_ref3) {
255
+ var items = _ref3.items;
241
256
  return items && items.length > allTagsModalSearchThreshold;
242
257
  });
243
258
 
@@ -1,10 +1,11 @@
1
- export function TagOverflowModal({ allTags, className, title, onClose, open, portalTarget: portalTargetIn, searchLabel, searchPlaceholder, ...rest }: {
1
+ export function TagOverflowModal({ allTags, className, title, onClose, open, overflowType, portalTarget: portalTargetIn, searchLabel, searchPlaceholder, ...rest }: {
2
2
  [x: string]: any;
3
3
  allTags: any;
4
4
  className: any;
5
5
  title: any;
6
6
  onClose: any;
7
7
  open: any;
8
+ overflowType: any;
8
9
  portalTarget: any;
9
10
  searchLabel?: string | undefined;
10
11
  searchPlaceholder: any;
@@ -17,6 +18,7 @@ export namespace TagOverflowModal {
17
18
  let className: PropTypes.Requireable<string>;
18
19
  let onClose: PropTypes.Requireable<(...args: any[]) => any>;
19
20
  let open: PropTypes.Requireable<boolean>;
21
+ let overflowType: PropTypes.Requireable<string>;
20
22
  let portalTarget: PropTypes.Requireable<PropTypes.ReactNodeLike>;
21
23
  let searchLabel: PropTypes.Requireable<string>;
22
24
  let searchPlaceholder: PropTypes.Requireable<string>;
@@ -14,8 +14,8 @@ import { pkg } from '../../settings.js';
14
14
  import { prepareProps } from '../../global/js/utils/props-helper.js';
15
15
  import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
16
16
 
17
- var _excluded = ["allTags", "className", "title", "onClose", "open", "portalTarget", "searchLabel", "searchPlaceholder"],
18
- _excluded2 = ["label", "id"];
17
+ var _excluded = ["allTags", "className", "title", "onClose", "open", "overflowType", "portalTarget", "searchLabel", "searchPlaceholder"],
18
+ _excluded2 = ["label", "id", "filter"];
19
19
  var componentName = 'TagOverflowModal';
20
20
  var blockClass = "".concat(pkg.prefix, "--tag-overflow-modal");
21
21
 
@@ -30,6 +30,7 @@ var TagOverflowModal = function TagOverflowModal(_ref) {
30
30
  title = _ref.title,
31
31
  onClose = _ref.onClose,
32
32
  open = _ref.open,
33
+ overflowType = _ref.overflowType,
33
34
  portalTargetIn = _ref.portalTarget,
34
35
  _ref$searchLabel = _ref.searchLabel,
35
36
  searchLabel = _ref$searchLabel === void 0 ? defaults.searchLabel : _ref$searchLabel,
@@ -41,23 +42,13 @@ var TagOverflowModal = function TagOverflowModal(_ref) {
41
42
  setSearch = _useState2[1];
42
43
  var renderPortalUse = usePortalTarget(portalTargetIn);
43
44
  var getFilteredItems = function getFilteredItems() {
44
- var newFilteredModalTags = [];
45
- if (open) {
46
- if (search === '') {
47
- newFilteredModalTags = allTags.slice(0);
48
- } else {
49
- var lCaseSearch = search.toLocaleLowerCase();
50
- allTags.forEach(function (tag) {
51
- var _tag$dataSearch, _tag$label;
52
- var dataSearch = (_tag$dataSearch = tag['data-search']) === null || _tag$dataSearch === void 0 || (_tag$dataSearch = _tag$dataSearch.toLocaleLowerCase()) === null || _tag$dataSearch === void 0 ? void 0 : _tag$dataSearch.indexOf(lCaseSearch);
53
- var labelSearch = (_tag$label = tag.label) === null || _tag$label === void 0 || (_tag$label = _tag$label.toLocaleLowerCase()) === null || _tag$label === void 0 ? void 0 : _tag$label.indexOf(lCaseSearch);
54
- if (dataSearch > -1 || labelSearch > -1) {
55
- newFilteredModalTags.push(tag);
56
- }
57
- });
58
- }
45
+ if (open && search) {
46
+ return allTags.filter(function (tag) {
47
+ var _tag$label;
48
+ return (_tag$label = tag.label) === null || _tag$label === void 0 || (_tag$label = _tag$label.toLocaleLowerCase()) === null || _tag$label === void 0 ? void 0 : _tag$label.includes(search.toLocaleLowerCase());
49
+ });
59
50
  }
60
- return newFilteredModalTags;
51
+ return allTags;
61
52
  };
62
53
  var handleSearch = function handleSearch(evt) {
63
54
  setSearch(evt.target.value || '');
@@ -86,10 +77,12 @@ var TagOverflowModal = function TagOverflowModal(_ref) {
86
77
  }, getFilteredItems().map(function (_ref2) {
87
78
  var label = _ref2.label,
88
79
  id = _ref2.id,
80
+ filter = _ref2.filter,
89
81
  other = _objectWithoutProperties(_ref2, _excluded2);
82
+ var isFilterable = overflowType === 'tag' ? filter : false;
90
83
  return /*#__PURE__*/React__default.createElement(Tag, _extends({}, other, {
91
- filter: false,
92
- key: id
84
+ key: id,
85
+ filter: isFilterable
93
86
  }), label);
94
87
  })), /*#__PURE__*/React__default.createElement("div", {
95
88
  className: "".concat(blockClass, "__fade")
@@ -102,6 +95,7 @@ TagOverflowModal.propTypes = {
102
95
  className: PropTypes.string,
103
96
  onClose: PropTypes.func,
104
97
  open: PropTypes.bool,
98
+ overflowType: PropTypes.oneOf(['default', 'tag']),
105
99
  portalTarget: PropTypes.node,
106
100
  searchLabel: PropTypes.string,
107
101
  searchPlaceholder: PropTypes.string,
@@ -13,7 +13,8 @@ import { Popover, Tag, PopoverContent, Link } from '@carbon/react';
13
13
  import { pkg } from '../../settings.js';
14
14
  import { useClickOutside } from '../../global/js/hooks/useClickOutside.js';
15
15
 
16
- var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"];
16
+ var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"],
17
+ _excluded2 = ["label", "id", "tagType", "filter", "onClose"];
17
18
  var componentName = 'TagOverflowPopover';
18
19
  var blockClass = "".concat(pkg.prefix, "--tag-overflow-popover");
19
20
 
@@ -80,11 +81,25 @@ var TagOverflowPopover = /*#__PURE__*/React__default.forwardRef(function (_ref,
80
81
  className: "".concat(blockClass, "__content")
81
82
  }, /*#__PURE__*/React__default.createElement("ul", {
82
83
  className: "".concat(blockClass, "__tag-list")
83
- }, getOverflowPopoverItems().map(function (tag) {
84
+ }, getOverflowPopoverItems().map(function (_ref2) {
85
+ var label = _ref2.label,
86
+ id = _ref2.id,
87
+ tagType = _ref2.tagType,
88
+ filter = _ref2.filter,
89
+ _onClose = _ref2.onClose,
90
+ other = _objectWithoutProperties(_ref2, _excluded2);
91
+ var typeValue = overflowType === 'tag' ? 'high-contrast' : tagType;
92
+ var isFilterable = overflowType === 'tag' ? filter : false;
84
93
  return /*#__PURE__*/React__default.createElement("li", {
85
94
  className: cx("".concat(blockClass, "__tag-item"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__tag-item--default"), overflowType === 'default'), "".concat(blockClass, "__tag-item--tag"), overflowType === 'tag')),
86
- key: tag.id
87
- }, tag.label);
95
+ key: id
96
+ }, overflowType === 'tag' ? /*#__PURE__*/React__default.createElement(Tag, _extends({}, other, {
97
+ onClose: function onClose() {
98
+ return _onClose === null || _onClose === void 0 ? void 0 : _onClose();
99
+ },
100
+ type: typeValue,
101
+ filter: isFilterable
102
+ }), label) : label);
88
103
  })), overflowTags.length > allTagsModalSearchThreshold && /*#__PURE__*/React__default.createElement(Link, {
89
104
  className: "".concat(blockClass, "__show-all-tags-link"),
90
105
  href: "",
@@ -79,8 +79,8 @@ var ConditionBlock = function ConditionBlock(props) {
79
79
  config = _getCurrentConfig.config,
80
80
  label = _getCurrentConfig.label;
81
81
  var ItemComponent = property ? itemComponents[type] : null;
82
- var onStatementChangeHandler = function onStatementChangeHandler(v, e) {
83
- util.focusThisField(e);
82
+ var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
83
+ util.focusThisField(evt);
84
84
  onStatementChange(v);
85
85
  };
86
86
  var onConnectorOperatorChangeHandler = function onConnectorOperatorChangeHandler(op) {
@@ -119,7 +119,7 @@ var ConditionBlock = function ConditionBlock(props) {
119
119
  });
120
120
  };
121
121
  return /*#__PURE__*/React__default["default"].createElement("div", {
122
- className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block conditionBlockWrapper ").concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__condition-builder-condition__deletion-preview"), showDeletionPreview)),
122
+ className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block conditionBlockWrapper ").concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__condition__deletion-preview"), showDeletionPreview)),
123
123
  key: conditionIndex,
124
124
  role: "row",
125
125
  "aria-label": DataConfigs.translateWithId('condition_row'),
@@ -19,6 +19,7 @@ var ConditionBuilderContent = require('./ConditionBuilderContent/ConditionBuilde
19
19
  var ConditionBuilderProvider = require('./ConditionBuilderContext/ConditionBuilderProvider.js');
20
20
  var settings = require('../../settings.js');
21
21
  var DataConfigs = require('./ConditionBuilderContext/DataConfigs.js');
22
+ var handleKeyboardEvents = require('./utils/handleKeyboardEvents.js');
22
23
 
23
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
25
 
@@ -64,6 +65,9 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
64
65
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
65
66
  var localRef = React.useRef();
66
67
  var conditionBuilderRef = ref || localRef;
68
+ var handleKeyDownHandler = function handleKeyDownHandler(evt) {
69
+ handleKeyboardEvents.handleKeyDown(evt, conditionBuilderRef);
70
+ };
67
71
  return /*#__PURE__*/React__default["default"].createElement(ConditionBuilderProvider.ConditionBuilderProvider, {
68
72
  inputConfig: inputConfig,
69
73
  popOverSearchThreshold: popOverSearchThreshold,
@@ -82,7 +86,8 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
82
86
  role: "main",
83
87
  ref: conditionBuilderRef
84
88
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement(react.VStack, {
85
- className: "".concat(DataConfigs.blockClass, "__").concat(variant)
89
+ className: "".concat(DataConfigs.blockClass, "__").concat(variant),
90
+ onKeyDown: handleKeyDownHandler
86
91
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderContent["default"], {
87
92
  startConditionLabel: startConditionLabel,
88
93
  conditionBuilderRef: conditionBuilderRef,
@@ -23,14 +23,14 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
23
23
  var className = _ref.className,
24
24
  onClick = _ref.onClick;
25
25
  return /*#__PURE__*/React__default["default"].createElement("div", {
26
- className: className
26
+ className: className,
27
+ role: "gridcell"
27
28
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
28
29
  renderIcon: icons.AddAlt,
29
30
  onClick: onClick,
30
31
  className: "".concat(DataConfigs.blockClass, "__add-button"),
31
32
  hideLabel: true,
32
- label: DataConfigs.translateWithId('add-condition'),
33
- role: "gridcell"
33
+ label: DataConfigs.translateWithId('add-condition')
34
34
  }));
35
35
  };
36
36
  var ConditionBuilderAdd$1 = ConditionBuilderAdd;
@@ -36,7 +36,7 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
36
36
  return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
37
37
  // role={'gridcell'}
38
38
  tabIndex: -1,
39
- className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__condition-builder-button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
39
+ className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
40
40
  type: "button",
41
41
  onClick: onClick
42
42
  }, rest), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && label);
@@ -75,7 +75,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
75
75
  className: "".concat(DataConfigs.blockClass, "__content-container"),
76
76
  tabIndex: -1
77
77
  }, !isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
78
- className: "".concat(DataConfigs.blockClass, "__condition-builder"),
78
+ className: "".concat(DataConfigs.blockClass, "__add-condition-button"),
79
79
  renderIcon: function renderIcon(props) {
80
80
  return /*#__PURE__*/React__default["default"].createElement(icons.Add, _rollupPluginBabelHelpers["extends"]({
81
81
  size: 16
@@ -87,7 +87,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
87
87
  onClick: onStartConditionBuilder
88
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
89
  return /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder["default"], {
90
- className: "".concat(DataConfigs.blockClass, "__condition-builder__group"),
90
+ className: "".concat(DataConfigs.blockClass, "__group"),
91
91
  key: groupIndex,
92
92
  aria: {
93
93
  level: 1,
@@ -77,7 +77,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
77
77
  React.useEffect(function () {
78
78
  //this will focus the first input field in the popover
79
79
  if (open && contentRef.current) {
80
- var firstFocusableElement = contentRef.current.querySelector('input, button,li');
80
+ var firstFocusableElement = contentRef.current.querySelector('input');
81
81
  if (firstFocusableElement) {
82
82
  firstFocusableElement.focus();
83
83
  }
@@ -103,11 +103,11 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
103
103
  renderIcon: renderIcon ? renderIcon : label == undefined ? icons.Add : null,
104
104
  showToolTip: showToolTip
105
105
  }, rest)), /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, {
106
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item__content"),
106
+ className: "".concat(DataConfigs.blockClass, "__item__content"),
107
107
  role: "dialog",
108
108
  "aria-label": "".concat(title)
109
109
  }, /*#__PURE__*/React__default["default"].createElement(react.Layer, null, /*#__PURE__*/React__default["default"].createElement("h1", {
110
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item__title")
110
+ className: "".concat(DataConfigs.blockClass, "__item__title")
111
111
  }, title), /*#__PURE__*/React__default["default"].createElement("div", {
112
112
  ref: contentRef
113
113
  }, open && children))));
@@ -26,7 +26,7 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
26
26
  var DatePickerInputRef = React.useRef();
27
27
  var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
28
28
  return /*#__PURE__*/React__default["default"].createElement("div", {
29
- className: "".concat(blockClass, "__condition-builder-item-date ")
29
+ className: "".concat(blockClass, "__item-date ")
30
30
  }, datePickerType == 'single' && /*#__PURE__*/React__default["default"].createElement(react.DatePicker, {
31
31
  ref: DatePickerInputRef,
32
32
  dateFormat: "d/m/Y",
@@ -29,7 +29,7 @@ var ConditionBuilderItemNumber = function ConditionBuilderItemNumber(_ref) {
29
29
  onChange(value + '');
30
30
  };
31
31
  return /*#__PURE__*/React__default["default"].createElement("div", {
32
- className: "".concat(blockClass, "__condition-builder-item-number")
32
+ className: "".concat(blockClass, "__item-number")
33
33
  }, /*#__PURE__*/React__default["default"].createElement(react.NumberInput, {
34
34
  label: conditionState.property,
35
35
  hideLabel: true,
@@ -41,6 +41,7 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
41
41
  filteredItems = _useState4[0],
42
42
  setFilteredItems = _useState4[1];
43
43
  var selection = Array.isArray(conditionState.value) ? conditionState.value : conditionState.value !== undefined ? [conditionState.value] : [];
44
+ var contentRef = React.useRef();
44
45
  React.useEffect(function () {
45
46
  if (!allOptions && getOptions) {
46
47
  var fetchData = /*#__PURE__*/function () {
@@ -71,8 +72,18 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
71
72
  }
72
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
73
74
  }, []);
74
- var handleSelectAll = function handleSelectAll(e) {
75
- if (e.currentTarget.dataset.selectedAll == 'false') {
75
+ React.useEffect(function () {
76
+ //this will focus the first input field in the popover
77
+
78
+ if (contentRef.current) {
79
+ var _contentRef$current;
80
+ var firstFocusableElement = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.querySelector('input, button,li');
81
+ firstFocusableElement === null || firstFocusableElement === void 0 || firstFocusableElement.focus();
82
+ }
83
+ // eslint-disable-next-line react-hooks/exhaustive-deps
84
+ }, [allOptions]);
85
+ var handleSelectAll = function handleSelectAll(evt) {
86
+ if (evt.currentTarget.dataset.selectedAll == 'false') {
76
87
  onChange(undefined);
77
88
  } else {
78
89
  onChange(allOptions.map(function (op) {
@@ -80,31 +91,32 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
80
91
  }));
81
92
  }
82
93
  };
83
- var onSearchChangeHandler = function onSearchChangeHandler(e) {
84
- var value = e.target.value;
94
+ var onSearchChangeHandler = function onSearchChangeHandler(evt) {
95
+ var value = evt.target.value;
85
96
  var _filteredItems = allOptions.filter(function (opt) {
86
97
  return opt.label.toLowerCase().includes(value.toLowerCase());
87
98
  });
88
99
  setFilteredItems(_filteredItems);
89
100
  };
90
- var onClickHandler = function onClickHandler(e, option, isSelected) {
101
+ var onClickHandler = function onClickHandler(evt, option, isSelected) {
91
102
  if (multiSelectable) {
92
103
  if (isSelected) {
93
104
  var items = selection.filter(function (v) {
94
105
  return v !== option.id;
95
106
  });
96
- onChange(items.length > 0 ? items : undefined, e);
107
+ onChange(items.length > 0 ? items : undefined, evt);
97
108
  } else {
98
- onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(selection), [option.id]), e);
109
+ onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(selection), [option.id]), evt);
99
110
  }
100
111
  } else {
101
- onChange(option.id, e);
112
+ onChange(option.id, evt);
102
113
  }
103
114
  };
104
115
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, allOptions && /*#__PURE__*/React__default["default"].createElement("div", {
105
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option")
116
+ className: "".concat(DataConfigs.blockClass, "__item-option"),
117
+ ref: contentRef
106
118
  }, (config.includeSearch || allOptions.length > popOverSearchThreshold) && /*#__PURE__*/React__default["default"].createElement("div", {
107
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__search")
119
+ className: "".concat(DataConfigs.blockClass, "__item-option__search")
108
120
  }, /*#__PURE__*/React__default["default"].createElement(react.Search, {
109
121
  size: "sm",
110
122
  labelText: DataConfigs.translateWithId('clear_search'),
@@ -130,25 +142,25 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
130
142
  key: option.id,
131
143
  role: "option",
132
144
  "aria-selected": isSelected,
133
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option"),
145
+ className: "".concat(DataConfigs.blockClass, "__item-option__option"),
134
146
  onKeyUp: function onKeyUp() {
135
147
  return false;
136
148
  },
137
- onClick: function onClick(e) {
138
- return onClickHandler(e, option, isSelected);
149
+ onClick: function onClick(evt) {
150
+ return onClickHandler(evt, option, isSelected);
139
151
  }
140
152
  }, /*#__PURE__*/React__default["default"].createElement("div", {
141
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option-content")
153
+ className: "".concat(DataConfigs.blockClass, "__item-option__option-content")
142
154
  }, multiSelectable ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
143
155
  className: "".concat(DataConfigs.blockClass, "__option-check-box")
144
156
  }, isSelected ? _CheckboxCheckedFille || (_CheckboxCheckedFille = /*#__PURE__*/React__default["default"].createElement(icons.CheckboxCheckedFilled, null)) : _Checkbox || (_Checkbox = /*#__PURE__*/React__default["default"].createElement(icons.Checkbox, null))), /*#__PURE__*/React__default["default"].createElement("span", {
145
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option-label")
157
+ className: "".concat(DataConfigs.blockClass, "__item-option__option-label")
146
158
  }, option.label), Icon && /*#__PURE__*/React__default["default"].createElement("span", {
147
159
  className: "".concat(DataConfigs.blockClass, "__option-icon")
148
160
  }, /*#__PURE__*/React__default["default"].createElement(Icon, null))) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
149
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-option__option-label")
161
+ className: "".concat(DataConfigs.blockClass, "__item-option__option-label")
150
162
  }, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
151
- className: "".concat(DataConfigs.blockClass, "__condition-builder-checkmark")
163
+ className: "".concat(DataConfigs.blockClass, "__checkmark")
152
164
  }))));
153
165
  }))), !allOptions && (_SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null))));
154
166
  };
@@ -23,14 +23,14 @@ var ConditionBuilderItemText = function ConditionBuilderItemText(_ref) {
23
23
  var conditionState = _ref.conditionState,
24
24
  _onChange = _ref.onChange;
25
25
  return /*#__PURE__*/React__default["default"].createElement("div", {
26
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-text")
26
+ className: "".concat(DataConfigs.blockClass, "__item-text")
27
27
  }, /*#__PURE__*/React__default["default"].createElement(react.TextInput, {
28
28
  labelText: conditionState.property,
29
29
  hideLabel: true,
30
30
  value: (_conditionState$value = conditionState.value) !== null && _conditionState$value !== void 0 ? _conditionState$value : '',
31
31
  id: (_conditionState$prope = conditionState.property) === null || _conditionState$prope === void 0 ? void 0 : _conditionState$prope.replace(/\s/g, ''),
32
- onChange: function onChange(e) {
33
- _onChange(e.target.value);
32
+ onChange: function onChange(evt) {
33
+ _onChange(evt.target.value);
34
34
  }
35
35
  }));
36
36
  };
@@ -41,17 +41,17 @@ var ConditionBuilderItemTime = function ConditionBuilderItemTime(_ref) {
41
41
  onChange(timeValue ? timeToUpdate : undefined);
42
42
  // eslint-disable-next-line react-hooks/exhaustive-deps
43
43
  }, [timeValue, dayZoneValue, timeZoneValue]);
44
- var setTimeZone = function setTimeZone(e) {
45
- setTimeZoneValue(e.target.value);
44
+ var setTimeZone = function setTimeZone(evt) {
45
+ setTimeZoneValue(evt.target.value);
46
46
  };
47
- var setDayZone = function setDayZone(e) {
48
- setDayZoneValue(e.target.value);
47
+ var setDayZone = function setDayZone(evt) {
48
+ setDayZoneValue(evt.target.value);
49
49
  };
50
- var setTime = function setTime(e) {
51
- setTimeValue(e.target.value);
50
+ var setTime = function setTime(evt) {
51
+ setTimeValue(evt.target.value);
52
52
  };
53
53
  return /*#__PURE__*/React__default["default"].createElement("div", {
54
- className: "".concat(DataConfigs.blockClass, "__condition-builder-item-time")
54
+ className: "".concat(DataConfigs.blockClass, "__item-time")
55
55
  }, /*#__PURE__*/React__default["default"].createElement(react.TimePicker, {
56
56
  id: "time-picker",
57
57
  labelText: "Select a time",
@@ -36,17 +36,17 @@ function ConditionConnector(_ref) {
36
36
  parentGroup.classList.remove('hoveredConnector');
37
37
  }
38
38
  }, []);
39
- var activeConnectorHandler = function activeConnectorHandler(e) {
40
- var parentGroup = e.currentTarget.closest('.eachGroup');
39
+ var activeConnectorHandler = function activeConnectorHandler(evt) {
40
+ var parentGroup = evt.currentTarget.closest('.eachGroup');
41
41
  handleConnectorHover(parentGroup, true);
42
42
  };
43
- var inActiveConnectorHandler = function inActiveConnectorHandler(e) {
44
- var parentGroup = e.currentTarget.closest('.eachGroup');
43
+ var inActiveConnectorHandler = function inActiveConnectorHandler(evt) {
44
+ var parentGroup = evt.currentTarget.closest('.eachGroup');
45
45
  handleConnectorHover(parentGroup, false);
46
46
  };
47
- var onChangeHandler = function onChangeHandler(op, e) {
47
+ var onChangeHandler = function onChangeHandler(op, evt) {
48
48
  onChange(op);
49
- util.focusThisField(e);
49
+ util.focusThisField(evt);
50
50
  };
51
51
  return (
52
52
  /*#__PURE__*/
@@ -34,16 +34,16 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
34
34
  onChange = _ref.onChange,
35
35
  conditionBuilderRef = _ref.conditionBuilderRef,
36
36
  className = _ref.className;
37
- var onRemoveHandler = function onRemoveHandler(conditionId, e) {
37
+ var onRemoveHandler = function onRemoveHandler(conditionId, evt) {
38
38
  if (group.conditions.length > 1) {
39
39
  onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
40
40
  conditions: group.conditions.filter(function (condition) {
41
41
  return conditionId !== condition.id;
42
42
  })
43
43
  }));
44
- handleFocusOnClose(e);
44
+ handleFocusOnClose(evt);
45
45
  } else {
46
- onRemove();
46
+ onRemove(evt);
47
47
  }
48
48
  };
49
49
  var onChangeHandler = function onChangeHandler(updatedCondition, conditionIndex) {
@@ -67,9 +67,9 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
67
67
  var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
68
68
  return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
69
69
  };
70
- var handleFocusOnClose = function handleFocusOnClose(e) {
71
- var _e$currentTarget;
72
- var previousClose = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.closest('[role="row"]')) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.previousSibling) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.querySelector('[data-name="closeCondition"]');
70
+ var handleFocusOnClose = function handleFocusOnClose(evt) {
71
+ var _evt$currentTarget;
72
+ var previousClose = (_evt$currentTarget = evt.currentTarget) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.closest('[role="row"]')) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.parentElement) === null || _evt$currentTarget === void 0 || (_evt$currentTarget = _evt$currentTarget.previousSibling) === null || _evt$currentTarget === void 0 ? void 0 : _evt$currentTarget.querySelector('[data-name="closeCondition"]');
73
73
  if (previousClose) {
74
74
  previousClose.focus();
75
75
  }
@@ -84,7 +84,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
84
84
  return /*#__PURE__*/React__default["default"].createElement("div", {
85
85
  key: eachCondition.id
86
86
  }, eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder, {
87
- className: "".concat(DataConfigs.blockClass, "__condition-builder__group"),
87
+ className: "".concat(DataConfigs.blockClass, "__group"),
88
88
  aria: {
89
89
  level: aria.level + 1,
90
90
  posinset: conditionIndex + 1,
@@ -94,8 +94,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
94
94
  onChange: function onChange(updatedCondition) {
95
95
  onChangeHandler(updatedCondition, conditionIndex);
96
96
  },
97
- onRemove: function onRemove(e) {
98
- onRemoveHandler(eachCondition.id, e);
97
+ onRemove: function onRemove(evt) {
98
+ onRemoveHandler(eachCondition.id, evt);
99
99
  },
100
100
  conditionBuilderRef: conditionBuilderRef
101
101
  }), !eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
@@ -114,8 +114,8 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
114
114
  onChangeHandler(updatedConditions, conditionIndex);
115
115
  },
116
116
  addConditionHandler: addConditionHandler,
117
- onRemove: function onRemove(e) {
118
- onRemoveHandler(eachCondition.id, e);
117
+ onRemove: function onRemove(evt) {
118
+ onRemoveHandler(eachCondition.id, evt);
119
119
  },
120
120
  onConnectorOperatorChange: function onConnectorOperatorChange(op) {
121
121
  onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
@@ -0,0 +1 @@
1
+ export function checkForHoldingKey(evt: any, key: any): any;