@carbon/ibm-products 2.60.0-rc.0 → 2.61.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/css/index-full-carbon.css +113 -497
  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 +64 -492
  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 +93 -492
  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 +93 -510
  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/ActionBar/ActionBar.d.ts +3 -3
  18. package/es/components/ActionBar/ActionBar.js +47 -150
  19. package/es/components/ActionBar/ActionBarOverflowItems.js +1 -1
  20. package/es/components/Checklist/ChecklistChart.js +1 -1
  21. package/es/components/Coachmark/Coachmark.js +1 -1
  22. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +1 -1
  23. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +3 -3
  24. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +4 -1
  25. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +7 -2
  26. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +7 -2
  27. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +15 -15
  28. package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
  29. package/es/components/ConditionBuilder/utils/util.js +7 -1
  30. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +1 -3
  31. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -2
  32. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
  33. package/es/components/Datagrid/useDatagrid.js +2 -2
  34. package/es/components/Datagrid/useInfiniteScroll.js +2 -5
  35. package/es/components/Datagrid/useRowIsMouseOver.d.ts +1 -1
  36. package/es/components/Datagrid/useRowIsMouseOver.js +2 -1
  37. package/es/components/Datagrid/useStickyColumn.d.ts +1 -1
  38. package/es/components/Datagrid/useStickyColumn.js +1 -1
  39. package/es/components/FilterSummary/FilterSummary.js +1 -1
  40. package/es/components/InterstitialScreen/InterstitialScreen.js +1 -1
  41. package/es/components/Nav/NavItem.js +1 -1
  42. package/es/components/NotificationsPanel/NotificationsPanel.d.ts +5 -0
  43. package/es/components/NotificationsPanel/NotificationsPanel.js +11 -17
  44. package/es/components/OptionsTile/OptionsTile.d.ts +2 -3
  45. package/es/components/OptionsTile/OptionsTile.js +49 -97
  46. package/es/components/PageHeader/PageHeader.js +16 -14
  47. package/es/components/PageHeader/PageHeaderTitle.js +2 -2
  48. package/es/components/ScrollGradient/ScrollGradient.js +74 -25
  49. package/es/components/ScrollGradient/constants.d.ts +0 -5
  50. package/es/components/ScrollGradient/constants.js +2 -47
  51. package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +1 -1
  52. package/es/components/TagOverflow/TagOverflow.d.ts +5 -1
  53. package/es/components/Tearsheet/Tearsheet.d.ts +5 -1
  54. package/es/components/Tearsheet/TearsheetNarrow.d.ts +5 -1
  55. package/es/components/WebTerminal/WebTerminal.js +0 -13
  56. package/es/global/js/hooks/useControllableState.d.ts +12 -24
  57. package/es/global/js/hooks/useControllableState.js +18 -60
  58. package/es/global/js/hooks/useOverflowItems.d.ts +7 -2
  59. package/es/global/js/hooks/useOverflowItems.js +50 -17
  60. package/es/global/js/hooks/useOverflowString.d.ts +9 -0
  61. package/es/global/js/hooks/useOverflowString.js +52 -0
  62. package/es/global/js/hooks/usePresence.d.ts +1 -1
  63. package/es/global/js/hooks/usePresence.js +2 -2
  64. package/es/global/js/utils/checkForOverflow.js +1 -11
  65. package/es/global/js/utils/clamp.d.ts +7 -0
  66. package/es/global/js/utils/clamp.js +25 -0
  67. package/es/global/js/utils/debounce.d.ts +7 -0
  68. package/es/global/js/utils/debounce.js +30 -0
  69. package/es/global/js/utils/deepCompareObject.d.ts +7 -0
  70. package/es/global/js/utils/deepCompareObject.js +47 -0
  71. package/es/global/js/utils/throttle.d.ts +7 -0
  72. package/es/global/js/utils/throttle.js +19 -0
  73. package/es/global/js/utils/uuidv4.d.ts +2 -2
  74. package/es/global/js/utils/uuidv4.js +3 -2
  75. package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +2787 -0
  76. package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +1013 -943
  77. package/lib/components/ActionBar/ActionBar.d.ts +3 -3
  78. package/lib/components/ActionBar/ActionBar.js +45 -148
  79. package/lib/components/ActionBar/ActionBarOverflowItems.js +1 -1
  80. package/lib/components/Checklist/ChecklistChart.js +2 -2
  81. package/lib/components/Coachmark/Coachmark.js +2 -2
  82. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +4 -4
  83. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +2 -2
  84. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +3 -0
  85. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +6 -1
  86. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -1
  87. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +15 -15
  88. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
  89. package/lib/components/ConditionBuilder/utils/util.js +7 -0
  90. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +1 -3
  91. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -2
  92. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
  93. package/lib/components/Datagrid/useDatagrid.js +2 -2
  94. package/lib/components/Datagrid/useInfiniteScroll.js +2 -5
  95. package/lib/components/Datagrid/useRowIsMouseOver.d.ts +1 -1
  96. package/lib/components/Datagrid/useRowIsMouseOver.js +3 -2
  97. package/lib/components/Datagrid/useStickyColumn.d.ts +1 -1
  98. package/lib/components/Datagrid/useStickyColumn.js +2 -2
  99. package/lib/components/FilterSummary/FilterSummary.js +2 -2
  100. package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -3
  101. package/lib/components/Nav/NavItem.js +2 -2
  102. package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +5 -0
  103. package/lib/components/NotificationsPanel/NotificationsPanel.js +11 -17
  104. package/lib/components/OptionsTile/OptionsTile.d.ts +2 -3
  105. package/lib/components/OptionsTile/OptionsTile.js +49 -97
  106. package/lib/components/PageHeader/PageHeader.js +16 -14
  107. package/lib/components/PageHeader/PageHeaderTitle.js +2 -2
  108. package/lib/components/ScrollGradient/ScrollGradient.js +72 -23
  109. package/lib/components/ScrollGradient/constants.d.ts +0 -5
  110. package/lib/components/ScrollGradient/constants.js +1 -48
  111. package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +2 -2
  112. package/lib/components/TagOverflow/TagOverflow.d.ts +5 -1
  113. package/lib/components/Tearsheet/Tearsheet.d.ts +5 -1
  114. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +5 -1
  115. package/lib/components/WebTerminal/WebTerminal.js +0 -13
  116. package/lib/global/js/hooks/useControllableState.d.ts +12 -24
  117. package/lib/global/js/hooks/useControllableState.js +17 -59
  118. package/lib/global/js/hooks/useOverflowItems.d.ts +7 -2
  119. package/lib/global/js/hooks/useOverflowItems.js +49 -16
  120. package/lib/global/js/hooks/useOverflowString.d.ts +9 -0
  121. package/lib/global/js/hooks/useOverflowString.js +55 -0
  122. package/lib/global/js/hooks/usePresence.d.ts +1 -1
  123. package/lib/global/js/hooks/usePresence.js +2 -2
  124. package/lib/global/js/utils/checkForOverflow.js +0 -11
  125. package/lib/global/js/utils/clamp.d.ts +7 -0
  126. package/lib/global/js/utils/clamp.js +27 -0
  127. package/lib/global/js/utils/debounce.d.ts +7 -0
  128. package/lib/global/js/utils/debounce.js +32 -0
  129. package/lib/global/js/utils/deepCompareObject.d.ts +7 -0
  130. package/lib/global/js/utils/deepCompareObject.js +49 -0
  131. package/lib/global/js/utils/throttle.d.ts +7 -0
  132. package/lib/global/js/utils/throttle.js +21 -0
  133. package/lib/global/js/utils/uuidv4.d.ts +2 -2
  134. package/lib/global/js/utils/uuidv4.js +3 -2
  135. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +2913 -0
  136. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +1018 -948
  137. package/package.json +6 -7
  138. package/scss/components/NotificationsPanel/_notifications-panel.scss +33 -20
  139. package/scss/components/ScrollGradient/_scroll-gradient.scss +30 -0
  140. package/scss/components/UserAvatar/_user-avatar.scss +2 -6
  141. package/scss/components/WebTerminal/_web-terminal.scss +13 -1
  142. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +0 -2959
  143. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +0 -3085
@@ -5,21 +5,22 @@
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';
9
- import React__default, { useState, useRef, useEffect } from 'react';
8
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useRef } from 'react';
10
10
  import PropTypes from '../../_virtual/index.js';
11
11
  import cx from 'classnames';
12
12
  import { pkg } from '../../settings.js';
13
- import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
14
13
  import { Button } from '@carbon/react';
15
14
  import uuidv4 from '../../global/js/utils/uuidv4.js';
16
15
  import { prepareProps } from '../../global/js/utils/props-helper.js';
17
16
  import { ActionBarItem } from './ActionBarItem.js';
18
17
  import { ActionBarOverflowItems } from './ActionBarOverflowItems.js';
18
+ import { useOverflowItems } from '../../global/js/hooks/useOverflowItems.js';
19
19
 
20
20
  var _excluded = ["actions", "className", "maxVisible", "menuOptionsClass", "onWidthChange", "overflowAriaLabel", "overflowMenuRef", "rightAlign"],
21
- _excluded2 = ["key", "id"],
22
- _excluded3 = ["key"];
21
+ _excluded2 = ["id"],
22
+ _excluded3 = ["key", "id"];
23
+
23
24
  // The block part of our conventional BEM class names (blockClass__E--M).
24
25
  var blockClass = "".concat(pkg.prefix, "--action-bar");
25
26
  var componentName = 'ActionBar';
@@ -44,160 +45,56 @@ var ActionBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
44
45
  overflowMenuRef = _ref.overflowMenuRef,
45
46
  rightAlign = _ref.rightAlign,
46
47
  rest = _objectWithoutProperties(_ref, _excluded);
47
- var _useState = useState(0),
48
- _useState2 = _slicedToArray(_useState, 2),
49
- displayCount = _useState2[0],
50
- setDisplayCount = _useState2[1];
51
- var _useState3 = useState([]),
52
- _useState4 = _slicedToArray(_useState3, 2),
53
- displayedItems = _useState4[0],
54
- setDisplayedItems = _useState4[1];
55
- var _useState5 = useState(null),
56
- _useState6 = _slicedToArray(_useState5, 2),
57
- hiddenSizingItems = _useState6[0],
58
- setHiddenSizingItems = _useState6[1];
59
48
  var internalId = useRef(uuidv4());
60
49
  var refDisplayedItems = useRef(null);
61
- var sizingRef = useRef(null);
62
- var sizes = useRef({});
63
50
  var backupRef = useRef(null);
64
51
  var localRef = ref || backupRef;
65
-
66
- // create hidden sizing items
67
- useEffect(function () {
68
- // Hidden action bar and items used to calculate sizes
69
- setHiddenSizingItems(/*#__PURE__*/React__default.createElement("div", {
70
- className: "".concat(blockClass, "__hidden-sizing-items"),
71
- "aria-hidden": true,
72
- ref: sizingRef
73
- }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(ActionBarOverflowItems, {
74
- className: "".concat(blockClass, "__hidden-sizing-item"),
75
- overflowAriaLabel: "hidden sizing overflow items",
76
- overflowMenuRef: overflowMenuRef,
77
- overflowItems: [],
78
- key: "hidden-overflow-menu",
79
- tabIndex: -1
80
- }), actions.map(function (_ref2) {
81
- var key = _ref2.key,
82
- id = _ref2.id,
83
- rest = _objectWithoutProperties(_ref2, _excluded2);
84
- return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, rest, {
85
- // ensure id is not duplicated
86
- "data-original-id": id,
87
- key: "hidden-item-".concat(key),
88
- className: "".concat(blockClass, "__hidden-sizing-item"),
89
- tabIndex: -1
90
- }));
91
- }))));
92
- }, [actions, overflowMenuRef]);
93
-
94
- // creates displayed items based on actions, displayCount and alignment
95
- useEffect(function () {
96
- // Calculate the displayed items
97
- var newDisplayedItems = actions.map(function (_ref3) {
98
- var key = _ref3.key,
99
- rest = _objectWithoutProperties(_ref3, _excluded3);
100
- return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, rest, {
101
- key: key
102
- }));
103
- });
104
-
105
- // extract any there is not enough room for into newOverflowItems
106
- var newOverflowItems = newDisplayedItems.splice(displayCount);
107
-
108
- // add overflow menu if needed
109
- if (newOverflowItems.length) {
110
- newDisplayedItems.push(/*#__PURE__*/React__default.createElement(ActionBarOverflowItems, {
111
- menuOptionsClass: menuOptionsClass,
112
- overflowAriaLabel: overflowAriaLabel,
113
- overflowMenuRef: overflowMenuRef,
114
- overflowItems: newOverflowItems,
115
- key: "overflow-menu-".concat(internalId.current)
116
- }));
117
- }
118
- setDisplayedItems(newDisplayedItems);
119
- }, [actions, displayCount, overflowAriaLabel, menuOptionsClass, overflowMenuRef]);
120
-
121
- // determine display count based on space available and width of pageActions
122
- var checkFullyVisibleItems = function checkFullyVisibleItems() {
123
- /* istanbul ignore if */
124
- if (sizingRef.current) {
125
- var _refDisplayedItems$cu;
126
- var sizingItems = Array.from(sizingRef.current.querySelectorAll(".".concat(blockClass, "__hidden-sizing-item")));
127
-
128
- // first item is always the overflow even if nothing else is rendered
129
- var overflowItem = sizingItems.shift();
130
-
131
- // determine how many will fit
132
- var spaceAvailable = (_refDisplayedItems$cu = refDisplayedItems.current) === null || _refDisplayedItems$cu === undefined ? undefined : _refDisplayedItems$cu.offsetWidth;
133
- var willFit = 0;
134
- var maxVisibleWidth = 0;
135
- var fitLimit = maxVisible ? Math.min(maxVisible, sizingItems.length) : sizingItems.length;
136
-
137
- // loop checking the space available
138
- for (var i = 0; i < fitLimit; i++) {
139
- var newSpaceAvailable = spaceAvailable && spaceAvailable - sizingItems[i].offsetWidth;
140
-
141
- // update maxVisibleWidth for later use by onWidthChange
142
- maxVisibleWidth += sizingItems[i].offsetWidth;
143
- if (newSpaceAvailable && newSpaceAvailable >= 0) {
144
- spaceAvailable = newSpaceAvailable;
145
- willFit += 1;
146
- }
147
- }
148
-
149
- // if not enough space for all items then make room for the overflow
150
- var overflowWidth = overflowItem.offsetWidth;
151
- if (willFit < sizingItems.length) {
152
- // Check space for overflow
153
- while (willFit > 0 && spaceAvailable && spaceAvailable < overflowWidth) {
154
- willFit -= 1;
155
-
156
- // Highly unlikely that any action bar item is narrower than the overflow item
157
-
158
- // Make sure by removing items in reverse order
159
- spaceAvailable += sizingItems[willFit].offsetWidth;
160
- }
161
- }
162
- if (onWidthChange && (sizes.current.minWidth !== overflowWidth || sizes.current.maxWidth !== maxVisibleWidth)) {
163
- sizes.current.minWidth = overflowWidth;
164
- sizes.current.maxWidth = maxVisibleWidth;
165
- // emit onWidthChange
166
- onWidthChange({
167
- minWidth: overflowWidth,
168
- maxWidth: maxVisibleWidth
169
- });
170
- }
171
- if (willFit < 1) {
172
- setDisplayCount(0);
173
- } else {
174
- setDisplayCount(willFit);
175
- }
176
- }
177
- };
178
- useEffect(function () {
179
- checkFullyVisibleItems();
180
- // eslint-disable-next-line react-hooks/exhaustive-deps
181
- }, [maxVisible, hiddenSizingItems]);
182
-
183
- // /* istanbul ignore next */ // not sure how to fake window resize
184
- var handleResize = function handleResize() {
185
- // when the hidden sizing items change size
186
- /* istanbul ignore next */
187
- // not sure how to fake window resize
188
- checkFullyVisibleItems();
189
- };
190
-
191
- // // resize of the items
192
- useResizeObserver(sizingRef, handleResize);
193
- useResizeObserver(localRef, handleResize);
52
+ var _offsetRef = useRef(null);
53
+ var offsetRef = overflowMenuRef || _offsetRef;
54
+ var _items = actions.map(function (action) {
55
+ return _objectSpread2({
56
+ id: action === null || action === undefined ? undefined : action.key
57
+ }, action);
58
+ });
59
+ var _useOverflowItems = useOverflowItems(_items, localRef, offsetRef, maxVisible, onWidthChange),
60
+ visibleItems = _useOverflowItems.visibleItems,
61
+ hiddenItems = _useOverflowItems.hiddenItems,
62
+ itemRefHandler = _useOverflowItems.itemRefHandler,
63
+ offsetRefHandler = _useOverflowItems.offsetRefHandler;
64
+ var overflowMenuItems = hiddenItems === null || hiddenItems === undefined ? undefined : hiddenItems.map(function (_ref2) {
65
+ var key = _ref2.id,
66
+ rest = _objectWithoutProperties(_ref2, _excluded2);
67
+ return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, rest, {
68
+ key: key
69
+ }));
70
+ });
194
71
  return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
195
72
  className: cx([blockClass, className]),
196
73
  ref: localRef
197
- }), hiddenSizingItems, /*#__PURE__*/React__default.createElement("div", {
74
+ }), /*#__PURE__*/React__default.createElement("div", {
198
75
  ref: refDisplayedItems,
199
76
  className: cx(["".concat(blockClass, "__displayed-items"), _defineProperty({}, "".concat(blockClass, "__displayed-items--right"), rightAlign)])
200
- }, displayedItems));
77
+ }, visibleItems.map(function (_ref4) {
78
+ var key = _ref4.key,
79
+ id = _ref4.id,
80
+ rest = _objectWithoutProperties(_ref4, _excluded3);
81
+ return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, _objectSpread2({
82
+ id: id
83
+ }, rest), {
84
+ key: key,
85
+ ref: function ref(node) {
86
+ itemRefHandler(id, node);
87
+ }
88
+ }));
89
+ }), (overflowMenuItems === null || overflowMenuItems === undefined ? undefined : overflowMenuItems.length) > 0 && /*#__PURE__*/React__default.createElement(ActionBarOverflowItems, {
90
+ menuOptionsClass: menuOptionsClass,
91
+ overflowAriaLabel: overflowAriaLabel,
92
+ overflowMenuRef: function overflowMenuRef(node) {
93
+ return offsetRef.current = offsetRefHandler(node);
94
+ },
95
+ overflowItems: overflowMenuItems,
96
+ key: "overflow-menu-".concat(internalId.current)
97
+ })));
201
98
  });
202
99
  ActionBar = pkg.checkComponentEnabled(ActionBar, componentName);
203
100
  ActionBar.displayName = componentName;
@@ -80,7 +80,7 @@ ActionBarOverflowItems.propTypes = {
80
80
  /**@ts-ignore */
81
81
  overflowMenuRef: PropTypes.oneOfType([PropTypes.shape({
82
82
  current: PropTypes.elementType
83
- }), PropTypes.object]),
83
+ }), PropTypes.object, PropTypes.func]),
84
84
  /**
85
85
  * Optional tab index
86
86
  */
@@ -9,11 +9,11 @@ import { objectWithoutProperties as _objectWithoutProperties, createForOfIterato
9
9
  import React__default, { useEffect } from 'react';
10
10
  import PropTypes from '../../_virtual/index.js';
11
11
  import cx from 'classnames';
12
- import clamp from 'lodash/clamp';
13
12
  import { purple50, gray20, gray70 } from '../../node_modules/@carbon/colors/es/index.js';
14
13
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
15
14
  import { pkg } from '../../settings.js';
16
15
  import { Themes } from './Checklist.types.js';
16
+ import { clamp } from '../../global/js/utils/clamp.js';
17
17
 
18
18
  var _excluded = ["className", "value", "theme"];
19
19
  var blockClass = "".concat(pkg.prefix, "--checklist__chart");
@@ -16,7 +16,7 @@ import { createPortal } from 'react-dom';
16
16
  import cx from 'classnames';
17
17
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
18
18
  import { pkg } from '../../settings.js';
19
- import { throttle } from 'lodash';
19
+ import { throttle } from '../../global/js/utils/throttle.js';
20
20
  import { Popover, PopoverContent } from '@carbon/react';
21
21
  import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
22
22
 
@@ -12,7 +12,7 @@ import { Carousel } from '../Carousel/Carousel.js';
12
12
  import '../Carousel/CarouselItem.js';
13
13
  import PropTypes from '../../_virtual/index.js';
14
14
  import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia/SteppedAnimatedMedia.js';
15
- import { clamp } from 'lodash';
15
+ import { clamp } from '../../global/js/utils/clamp.js';
16
16
  import cx from 'classnames';
17
17
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
18
18
  import pconsole from '../../global/js/utils/pconsole.js';
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useRef, useState, useContext, useEffect } from 'react';
10
- import { Popover, PopoverContent, Layer } from '@carbon/react';
10
+ import { Popover, PopoverContent, Layer, Section, Heading } from '@carbon/react';
11
11
  import PropTypes from '../../../_virtual/index.js';
12
12
  import { Add } from '@carbon/react/icons';
13
13
  import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
@@ -189,11 +189,11 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
189
189
  role: "dialog",
190
190
  "aria-label": title,
191
191
  onKeyDown: handleKeyDownHandler
192
- }, /*#__PURE__*/React__default.createElement(Layer, null, /*#__PURE__*/React__default.createElement("h1", {
192
+ }, /*#__PURE__*/React__default.createElement(Layer, null, /*#__PURE__*/React__default.createElement(Section, null, /*#__PURE__*/React__default.createElement(Heading, {
193
193
  className: "".concat(blockClass, "__item__title")
194
194
  }, title), /*#__PURE__*/React__default.createElement("div", {
195
195
  className: "".concat(blockClass, "__popover-content")
196
- }, renderChildren ? renderChildren(popoverRef) : children))));
196
+ }, renderChildren ? renderChildren(popoverRef) : children)))));
197
197
  };
198
198
  ConditionBuilderItem.propTypes = {
199
199
  /**
@@ -6,11 +6,12 @@
6
6
  */
7
7
 
8
8
  import { slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useRef } from 'react';
9
+ import React__default, { useRef, useContext } from 'react';
10
10
  import { DatePicker, DatePickerInput } from '@carbon/react';
11
11
  import PropTypes from '../../../../_virtual/index.js';
12
12
  import { useTranslations } from '../../utils/useTranslations.js';
13
13
  import { blockClass } from '../../utils/util.js';
14
+ import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
14
15
 
15
16
  var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
16
17
  var conditionState = _ref.conditionState,
@@ -21,6 +22,8 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
21
22
  _useTranslations2 = _slicedToArray(_useTranslations, 2),
22
23
  startText = _useTranslations2[0],
23
24
  endText = _useTranslations2[1];
25
+ var _useContext = useContext(ConditionBuilderContext);
26
+ _useContext.conditionBuilderRef;
24
27
  var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
25
28
  var onCloseHandler = function onCloseHandler(selectedDate) {
26
29
  onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID');
@@ -12,7 +12,7 @@ import { Checkmark } from '@carbon/react/icons';
12
12
  import PropTypes from '../../../../_virtual/index.js';
13
13
  import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
14
14
  import { useTranslations } from '../../utils/useTranslations.js';
15
- import { blockClass } from '../../utils/util.js';
15
+ import { blockClass, onKeyDownHandlerForSearch } from '../../utils/util.js';
16
16
 
17
17
  var ItemOption = function ItemOption(_ref) {
18
18
  var _ref$conditionState = _ref.conditionState,
@@ -27,6 +27,8 @@ var ItemOption = function ItemOption(_ref) {
27
27
  _useTranslations2 = _slicedToArray(_useTranslations, 2),
28
28
  propertyText = _useTranslations2[0],
29
29
  clearSearchText = _useTranslations2[1];
30
+ var _useContext2 = useContext(ConditionBuilderContext),
31
+ conditionBuilderRef = _useContext2.conditionBuilderRef;
30
32
  var allOptions = config.options;
31
33
  var _useState = useState(''),
32
34
  _useState2 = _slicedToArray(_useState, 2),
@@ -75,7 +77,10 @@ var ItemOption = function ItemOption(_ref) {
75
77
  size: "sm",
76
78
  labelText: clearSearchText,
77
79
  closeButtonLabelText: clearSearchText,
78
- onChange: onSearchChangeHandler
80
+ onChange: onSearchChangeHandler,
81
+ onKeyDown: function onKeyDown(evt) {
82
+ return onKeyDownHandlerForSearch(evt, conditionBuilderRef);
83
+ }
79
84
  })), /*#__PURE__*/React__default.createElement("ul", {
80
85
  "aria-label": getAriaLabel(),
81
86
  role: "listbox"
@@ -12,7 +12,7 @@ import { CheckboxCheckedFilled, Checkbox, Checkmark } from '@carbon/react/icons'
12
12
  import PropTypes from '../../../../_virtual/index.js';
13
13
  import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
14
14
  import { useTranslations } from '../../utils/useTranslations.js';
15
- import { checkForMultiSelectOperator, blockClass } from '../../utils/util.js';
15
+ import { checkForMultiSelectOperator, blockClass, onKeyDownHandlerForSearch } from '../../utils/util.js';
16
16
 
17
17
  var _SelectSkeleton, _CheckboxCheckedFille, _Checkbox;
18
18
  var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
@@ -30,6 +30,8 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
30
30
  _useTranslations2 = _slicedToArray(_useTranslations, 2),
31
31
  propertyText = _useTranslations2[0],
32
32
  clearSearchText = _useTranslations2[1];
33
+ var _useContext2 = useContext(ConditionBuilderContext),
34
+ conditionBuilderRef = _useContext2.conditionBuilderRef;
33
35
  var contentRef = useRef(null);
34
36
  var _useState = useState(config.options),
35
37
  _useState2 = _slicedToArray(_useState, 2),
@@ -149,7 +151,10 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
149
151
  size: "sm",
150
152
  labelText: clearSearchText,
151
153
  closeButtonLabelText: clearSearchText,
152
- onChange: onSearchChangeHandler
154
+ onChange: onSearchChangeHandler,
155
+ onKeyDown: function onKeyDown(evt) {
156
+ return onKeyDownHandlerForSearch(evt, conditionBuilderRef);
157
+ }
153
158
  })), multiSelectable && /*#__PURE__*/React__default.createElement("div", {
154
159
  className: "".concat(blockClass, "__multiselectSelectionStatusContainer")
155
160
  }, /*#__PURE__*/React__default.createElement("label", null, selection.length, "/", allOptions.length, " Selected"), /*#__PURE__*/React__default.createElement(Button, {
@@ -24,7 +24,7 @@ var handleKeyDownForPopover = function handleKeyDownForPopover(evt, conditionBui
24
24
 
25
25
  //skipping keyboard handling for date and time fields to get take carbon's
26
26
  var excludeKeyPress = function excludeKeyPress(evt) {
27
- return !['Escape'].includes(evt.key) && (evt.target.closest(".".concat(blockClass, "__item-date")) || evt.target.closest(".".concat(blockClass, "__item-time")));
27
+ return !['Escape'].includes(evt.key) && evt.target.closest(".".concat(blockClass, "__item-date"));
28
28
  };
29
29
  var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer, conditionBuilderRef) {
30
30
  var _parentContainer$quer, _parentContainer$quer2, _evt$target$closest$q, _evt$target$closest;
@@ -80,23 +80,23 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
80
80
  }
81
81
  break;
82
82
  case 'Enter':
83
- if (isMultiSelect === 'true') {
84
- if (document.activeElement.type !== 'button') {
85
- var _document$activeEleme2;
86
- //for button , enter key is click which already handled by framework, for other elements trigger click
87
- evt.preventDefault();
88
- (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === undefined || _document$activeEleme2.click();
89
- }
90
- } else {
91
- if (document.activeElement.type !== 'button') {
92
- var _document$activeEleme3;
93
- //for button , enter key is click which already handled by framework, else trigger click
94
- focusThisField(evt, conditionBuilderRef);
95
- (_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === undefined || _document$activeEleme3.click();
96
- }
83
+ if (document.activeElement.type !== 'button') {
84
+ var _document$activeEleme2;
85
+ //for button , enter key is click which already handled by framework, else trigger click
86
+ focusThisField(evt, conditionBuilderRef);
87
+ (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === undefined || _document$activeEleme2.click();
97
88
  }
98
89
  break;
99
90
  }
91
+ } else {
92
+ if (key === 'Enter' && !isHoldingShiftKey) {
93
+ if (document.activeElement.type !== 'button') {
94
+ var _document$activeEleme3;
95
+ //for button , enter key is click which already handled by framework, else trigger click
96
+ focusThisField(evt, conditionBuilderRef);
97
+ (_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === undefined || _document$activeEleme3.click();
98
+ }
99
+ }
100
100
  }
101
101
  };
102
102
  var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
@@ -10,3 +10,4 @@ export function checkIsValid(item: any): any;
10
10
  export function manageTabIndexAndFocus(currentElement: any, conditionBuilderRef: any): void;
11
11
  export function getValue(type: any, value: any, config: any): any;
12
12
  export function checkForMultiSelectOperator(condition: any, config: any): any;
13
+ export function onKeyDownHandlerForSearch(evt: any, conditionBuilderRef: any): void;
@@ -121,5 +121,11 @@ var checkForMultiSelectOperator = function checkForMultiSelectOperator(condition
121
121
  return (condition === null || condition === undefined ? undefined : condition.operator) === operator.id && operator.isMultiSelect;
122
122
  }));
123
123
  };
124
+ //this will close the popover on escape key on search box
125
+ var onKeyDownHandlerForSearch = function onKeyDownHandlerForSearch(evt, conditionBuilderRef) {
126
+ if (!evt.currentTarget.value && evt.key === 'Escape') {
127
+ focusThisField(evt, conditionBuilderRef);
128
+ }
129
+ };
124
130
 
125
- export { HIERARCHICAL_VARIANT, NON_HIERARCHICAL_VARIANT, blockClass, checkForHoldingKey, checkForMultiSelectOperator, checkIsValid, focusThisField, focusThisItem, getValue, manageTabIndexAndFocus, traverseClockVise, traverseReverse };
131
+ export { HIERARCHICAL_VARIANT, NON_HIERARCHICAL_VARIANT, blockClass, checkForHoldingKey, checkForMultiSelectOperator, checkIsValid, focusThisField, focusThisItem, getValue, manageTabIndexAndFocus, onKeyDownHandlerForSearch, traverseClockVise, traverseReverse };
@@ -5,10 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import isBoolean from 'lodash/isBoolean';
9
-
10
8
  var isColumnVisible = function isColumnVisible(colDef) {
11
- return isBoolean(colDef.isVisible) ? colDef.isVisible : true;
9
+ return typeof colDef.isVisible === 'boolean' ? colDef.isVisible : true;
12
10
  };
13
11
 
14
12
  export { isColumnVisible };
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { slicedToArray as _slicedToArray } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { useState, useEffect } from 'react';
10
- import isEqual from 'lodash/isEqual';
10
+ import { deepCompareObject as _deepCompareObject } from '../../../../../../global/js/utils/deepCompareObject.js';
11
11
 
12
12
  /**
13
13
  * Keeps track of the button disabled state
@@ -25,7 +25,7 @@ var useShouldDisableButtons = function useShouldDisableButtons(_ref) {
25
25
  shouldDisableButtons = _useState2[0],
26
26
  setShouldDisableButtons = _useState2[1];
27
27
  useEffect(function updateDisabledButtonsState() {
28
- setShouldDisableButtons(isEqual(filtersState, JSON.parse(prevFiltersRef.current)));
28
+ setShouldDisableButtons(_deepCompareObject(filtersState, JSON.parse(prevFiltersRef.current)));
29
29
  }, [filtersState, prevFiltersRef]);
30
30
  return [shouldDisableButtons, setShouldDisableButtons];
31
31
  };
@@ -8,7 +8,6 @@
8
8
  import React__default, { forwardRef } from 'react';
9
9
  import PropTypes from '../../../../../_virtual/index.js';
10
10
  import { RadioButtonGroup, RadioButton } from '@carbon/react';
11
- import isArray from 'lodash/isArray';
12
11
  import { pkg } from '../../../../../settings.js';
13
12
 
14
13
  var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
@@ -36,7 +35,7 @@ var RowSizeRadioGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
36
35
  orientation: "vertical",
37
36
  defaultSelected: getBackwardCompatibleRowSize(selectedOption),
38
37
  onChange: onChange
39
- }, rowSizes && isArray(rowSizes) && rowSizes.map(function (option) {
38
+ }, rowSizes && Array.isArray(rowSizes) && rowSizes.map(function (option) {
40
39
  var labelText;
41
40
  try {
42
41
  labelText = option.labelText || rowSizeLabels[option.value];
@@ -8,7 +8,6 @@
8
8
  import { objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { useMemo } from 'react';
10
10
  import { useFlexLayout, useResizeColumns, useFilters, useGlobalFilter, useSortBy, useExpanded, useTable, usePagination, useRowSelect } from 'react-table';
11
- import uniqueId from 'lodash/uniqueId';
12
11
  import useSkeletons from './useSkeletonRows.js';
13
12
  import useDefaultStringRenderer from './useDefaultStringRenderer.js';
14
13
  import useRowRenderer from './useRowRenderer.js';
@@ -17,6 +16,7 @@ import useHeaderRow from './Datagrid/DatagridHeaderRow.js';
17
16
  import useFlexResize from './useFlexResize.js';
18
17
  import useFloatingScroll from './useFloatingScroll.js';
19
18
  import { stateReducer } from './Datagrid/addons/stateReducer.js';
19
+ import uuidv4 from '../../global/js/utils/uuidv4.js';
20
20
 
21
21
  var useDatagrid = function useDatagrid(params) {
22
22
  var defaultPlugins = [useFlexLayout, useHeaderRow, useSkeletons, useResizeColumns, useRowRenderer, useDefaultStringRenderer, useRowSize, useFilters, useGlobalFilter, useSortBy, useExpanded];
@@ -34,7 +34,7 @@ var useDatagrid = function useDatagrid(params) {
34
34
  minWidth: 50
35
35
  };
36
36
  var tableId = useMemo(function () {
37
- return uniqueId('datagrid-table-id');
37
+ return uuidv4('datagrid-table-id');
38
38
  }, []);
39
39
  for (var _len = arguments.length, plugins = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
40
40
  plugins[_key - 1] = arguments[_key];
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { useCallback } from 'react';
9
- import debounce from 'lodash/debounce';
9
+ import { debounce } from '../../global/js/utils/debounce.js';
10
10
  import useParentDimensions from './useParentDimensions.js';
11
11
  import useResizeTable from './useResizeTable.js';
12
12
 
@@ -30,10 +30,7 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
30
30
  var loadMoreThresholdValue = typeof loadMoreThreshold === 'number' ? loadMoreThreshold : 200;
31
31
  var emptyFetchData = function emptyFetchData() {};
32
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
- var fetchMore = useCallback(debounce(fetchMoreData || emptyFetchData, 3000, {
34
- leading: true,
35
- trailing: false
36
- }), [fetchMoreData]);
33
+ var fetchMore = useCallback(debounce(fetchMoreData || emptyFetchData, 3000), [fetchMoreData]);
37
34
  var onScroll = function onScroll(_ref2) {
38
35
  var scrollDirection = _ref2.scrollDirection,
39
36
  scrollOffset = _ref2.scrollOffset;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2024
2
+ * Copyright IBM Corp. 2024, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { useState, useCallback } from 'react';
10
- import debounce from 'lodash/debounce';
10
+ import { debounce } from '../../global/js/utils/debounce.js';
11
11
 
12
12
  var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
13
13
  var useInstance = function useInstance(instance) {
@@ -20,6 +20,7 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
20
20
  setMouseOverRowIndex(row === null || row === undefined ? undefined : row.index);
21
21
  }, 100);
22
22
  var getRowProps = function getRowProps(props, datagridState) {
23
+ // @ts-expect-error
23
24
  var onMouseOver = function onMouseOver() {
24
25
  return onMouseChange(datagridState);
25
26
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2021, 2023
2
+ * Copyright IBM Corp. 2021, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { useRef, useState, useEffect, useLayoutEffect } from 'react';
10
- import debounce from 'lodash/debounce';
10
+ import { debounce } from '../../global/js/utils/debounce.js';
11
11
  import cx from 'classnames';
12
12
  import { pkg } from '../../settings.js';
13
13
 
@@ -14,7 +14,7 @@ import { ChevronDown } from '@carbon/react/icons';
14
14
  import PropTypes from '../../_virtual/index.js';
15
15
  import { TagSet } from '../TagSet/TagSet.js';
16
16
  import cx from 'classnames';
17
- import debounce from 'lodash/debounce';
17
+ import { debounce } from '../../global/js/utils/debounce.js';
18
18
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
19
19
  import { pkg } from '../../settings.js';
20
20
  import uuidv4 from '../../global/js/utils/uuidv4.js';
@@ -13,8 +13,8 @@ import { Carousel } from '../Carousel/Carousel.js';
13
13
  import '../Carousel/CarouselItem.js';
14
14
  import PropTypes from '../../_virtual/index.js';
15
15
  import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia/SteppedAnimatedMedia.js';
16
- import { clamp } from 'lodash';
17
16
  import cx from 'classnames';
17
+ import { clamp } from '../../global/js/utils/clamp.js';
18
18
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
19
19
  import { pkg } from '../../settings.js';
20
20
 
@@ -12,7 +12,7 @@ import cx from 'classnames';
12
12
  import { pkg } from '../../settings.js';
13
13
  import uuidv4 from '../../global/js/utils/uuidv4.js';
14
14
  import NavItemLink from './NavItemLink.js';
15
- import { Launch } from '../../node_modules/@carbon/icons-react/es/generated/bucket-9.js';
15
+ import { Launch } from '../../node_modules/@carbon/icons-react/es/generated/bucket-10.js';
16
16
 
17
17
  var _excluded = ["activeHref", "children", "className", "current", "disabled", "element", "href", "id", "label", "onClick", "tabIndex"];
18
18