@razorpay/blade 12.17.1 → 12.19.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 (66) hide show
  1. package/build/lib/native/components/ActionList/ActionListItem.js +4 -4
  2. package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
  3. package/build/lib/native/components/ActionList/componentIds.js +1 -1
  4. package/build/lib/native/components/ActionList/componentIds.js.map +1 -1
  5. package/build/lib/native/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -1
  6. package/build/lib/native/components/Icons/AndroidIcon/AndroidIcon.js +12 -0
  7. package/build/lib/native/components/Icons/AndroidIcon/AndroidIcon.js.map +1 -0
  8. package/build/lib/native/components/Icons/AppleIcon/AppleIcon.js +12 -0
  9. package/build/lib/native/components/Icons/AppleIcon/AppleIcon.js.map +1 -0
  10. package/build/lib/native/components/Icons/KeyIcon/KeyIcon.js +12 -0
  11. package/build/lib/native/components/Icons/KeyIcon/KeyIcon.js.map +1 -0
  12. package/build/lib/native/components/index.js +4 -1
  13. package/build/lib/native/components/index.js.map +1 -1
  14. package/build/lib/web/development/components/ActionList/ActionListBox.web.js +170 -36
  15. package/build/lib/web/development/components/ActionList/ActionListBox.web.js.map +1 -1
  16. package/build/lib/web/development/components/ActionList/ActionListItem.js +48 -29
  17. package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
  18. package/build/lib/web/development/components/ActionList/componentIds.js +2 -1
  19. package/build/lib/web/development/components/ActionList/componentIds.js.map +1 -1
  20. package/build/lib/web/development/components/ActionList/index.js +1 -1
  21. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/tokens.js +8 -2
  22. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -1
  23. package/build/lib/web/development/components/Icons/AndroidIcon/AndroidIcon.js +45 -0
  24. package/build/lib/web/development/components/Icons/AndroidIcon/AndroidIcon.js.map +1 -0
  25. package/build/lib/web/development/components/Icons/AndroidIcon/index.js +2 -0
  26. package/build/lib/web/development/components/Icons/AndroidIcon/index.js.map +1 -0
  27. package/build/lib/web/development/components/Icons/AppleIcon/AppleIcon.js +37 -0
  28. package/build/lib/web/development/components/Icons/AppleIcon/AppleIcon.js.map +1 -0
  29. package/build/lib/web/development/components/Icons/AppleIcon/index.js +2 -0
  30. package/build/lib/web/development/components/Icons/AppleIcon/index.js.map +1 -0
  31. package/build/lib/web/development/components/Icons/KeyIcon/KeyIcon.js +42 -0
  32. package/build/lib/web/development/components/Icons/KeyIcon/KeyIcon.js.map +1 -0
  33. package/build/lib/web/development/components/Icons/KeyIcon/index.js +2 -0
  34. package/build/lib/web/development/components/Icons/KeyIcon/index.js.map +1 -0
  35. package/build/lib/web/development/components/Icons/index.js +3 -0
  36. package/build/lib/web/development/components/Icons/index.js.map +1 -1
  37. package/build/lib/web/development/components/index.js +4 -1
  38. package/build/lib/web/development/components/index.js.map +1 -1
  39. package/build/lib/web/production/components/ActionList/ActionListBox.web.js +170 -36
  40. package/build/lib/web/production/components/ActionList/ActionListBox.web.js.map +1 -1
  41. package/build/lib/web/production/components/ActionList/ActionListItem.js +48 -29
  42. package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
  43. package/build/lib/web/production/components/ActionList/componentIds.js +2 -1
  44. package/build/lib/web/production/components/ActionList/componentIds.js.map +1 -1
  45. package/build/lib/web/production/components/ActionList/index.js +1 -1
  46. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/tokens.js +8 -2
  47. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -1
  48. package/build/lib/web/production/components/Icons/AndroidIcon/AndroidIcon.js +45 -0
  49. package/build/lib/web/production/components/Icons/AndroidIcon/AndroidIcon.js.map +1 -0
  50. package/build/lib/web/production/components/Icons/AndroidIcon/index.js +2 -0
  51. package/build/lib/web/production/components/Icons/AndroidIcon/index.js.map +1 -0
  52. package/build/lib/web/production/components/Icons/AppleIcon/AppleIcon.js +37 -0
  53. package/build/lib/web/production/components/Icons/AppleIcon/AppleIcon.js.map +1 -0
  54. package/build/lib/web/production/components/Icons/AppleIcon/index.js +2 -0
  55. package/build/lib/web/production/components/Icons/AppleIcon/index.js.map +1 -0
  56. package/build/lib/web/production/components/Icons/KeyIcon/KeyIcon.js +42 -0
  57. package/build/lib/web/production/components/Icons/KeyIcon/KeyIcon.js.map +1 -0
  58. package/build/lib/web/production/components/Icons/KeyIcon/index.js +2 -0
  59. package/build/lib/web/production/components/Icons/KeyIcon/index.js.map +1 -0
  60. package/build/lib/web/production/components/Icons/index.js +3 -0
  61. package/build/lib/web/production/components/Icons/index.js.map +1 -1
  62. package/build/lib/web/production/components/index.js +4 -1
  63. package/build/lib/web/production/components/index.js.map +1 -1
  64. package/build/types/components/index.d.ts +25 -3
  65. package/build/types/components/index.native.d.ts +25 -3
  66. package/package.json +3 -2
@@ -71,7 +71,7 @@ export { AccordionItemHeader } from './Accordion/AccordionItemHeader.js';
71
71
  export { AccordionItemBody } from './Accordion/AccordionItemBody.js';
72
72
  export { AccordionItem } from './Accordion/AccordionItem.js';
73
73
  export { ActionList } from './ActionList/ActionList.js';
74
- export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection } from './ActionList/ActionListItem.js';
74
+ export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection, ActionListSectionTitle } from './ActionList/ActionListItem.js';
75
75
  export { ActionListItemAsset } from './ActionList/ActionListItemAsset.web.js';
76
76
  export { Alert } from './Alert/Alert.js';
77
77
  export { Amount } from './Amount/Amount.js';
@@ -135,9 +135,11 @@ export { default as AlignJustifyIcon } from './Icons/AlignJustifyIcon/AlignJusti
135
135
  export { default as AlignLeftIcon } from './Icons/AlignLeftIcon/AlignLeftIcon.js';
136
136
  export { default as AlignRightIcon } from './Icons/AlignRightIcon/AlignRightIcon.js';
137
137
  export { default as AnchorIcon } from './Icons/AnchorIcon/AnchorIcon.js';
138
+ export { default as AndroidIcon } from './Icons/AndroidIcon/AndroidIcon.js';
138
139
  export { default as AnnouncementIcon } from './Icons/AnnouncementIcon/AnnouncementIcon.js';
139
140
  export { default as ApertureIcon } from './Icons/ApertureIcon/ApertureIcon.js';
140
141
  export { default as AppStoreIcon } from './Icons/AppStoreIcon/AppStoreIcon.js';
142
+ export { default as AppleIcon } from './Icons/AppleIcon/AppleIcon.js';
141
143
  export { default as ArrowDownIcon } from './Icons/ArrowDownIcon/ArrowDownIcon.js';
142
144
  export { default as ArrowDownLeftIcon } from './Icons/ArrowDownLeftIcon/ArrowDownLeftIcon.js';
143
145
  export { default as ArrowDownRightIcon } from './Icons/ArrowDownRightIcon/ArrowDownRightIcon.js';
@@ -307,6 +309,7 @@ export { default as InstantSettlementIcon } from './Icons/InstantSettlementIcon/
307
309
  export { default as InternationalPaymentsIcon } from './Icons/InternationalPaymentsIcon/InternationalPaymentsIcon.js';
308
310
  export { default as InvoicesIcon } from './Icons/InvoicesIcon/InvoicesIcon.js';
309
311
  export { default as ItalicIcon } from './Icons/ItalicIcon/ItalicIcon.js';
312
+ export { default as KeyIcon } from './Icons/KeyIcon/KeyIcon.js';
310
313
  export { default as KeyboardIcon } from './Icons/KeyboardIcon/KeyboardIcon.js';
311
314
  export { default as LayersIcon } from './Icons/LayersIcon/LayersIcon.js';
312
315
  export { default as LayoutIcon } from './Icons/LayoutIcon/LayoutIcon.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
1
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import React__default from 'react';
4
- import { FixedSizeList } from 'react-window';
5
+ import React__default, { useCallback } from 'react';
6
+ import { VariableSizeList } from 'react-window';
5
7
  import { StyledListBoxWrapper } from './styles/StyledListBoxWrapper.web.js';
6
8
  import { getActionListPadding, actionListMaxHeight } from './styles/getBaseListBoxWrapperStyles.js';
9
+ import { componentIds } from './componentIds.js';
10
+ import { ActionListSectionTitle } from './ActionListItem.js';
7
11
  import { useBottomSheetContext } from '../BottomSheet/BottomSheetContext.js';
8
12
  import '../../utils/assignWithoutSideEffects/index.js';
9
13
  import '../../utils/makeAccessible/index.js';
10
14
  import '../../utils/makeAnalyticsAttribute/index.js';
11
15
  import { useIsMobile } from '../../utils/useIsMobile.js';
12
- import { getItemHeight } from '../BaseMenu/BaseMenuItem/tokens.js';
16
+ import { actionListSectionTitleHeight, actionListDividerHeight, getActionListItemHeight } from '../BaseMenu/BaseMenuItem/tokens.js';
13
17
  import '../../utils/index.js';
14
18
  import { useDropdown } from '../Dropdown/useDropdown.js';
15
19
  import { dropdownComponentIds } from '../Dropdown/dropdownComponentIds.js';
20
+ import '../../utils/isValidAllowedChildren/index.js';
21
+ import '../Divider/index.js';
16
22
  import { jsx } from 'react/jsx-runtime';
17
23
  import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
18
24
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
19
25
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
26
+ import { getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
27
+ import { Divider } from '../Divider/Divider.js';
20
28
  import useTheme from '../BladeProvider/useTheme.js';
21
29
 
22
30
  var _excluded = ["childrenWithId", "actionListItemWrapperRole", "isMultiSelectable"],
@@ -44,18 +52,52 @@ var ActionListBox = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__d
44
52
  displayName: 'ActionListBox'
45
53
  });
46
54
 
55
+ /**
56
+ * get the height of the item based on the componentId
57
+ */
58
+ var getItemHeight = function getItemHeight(_ref2) {
59
+ var _itemData$index;
60
+ var index = _ref2.index,
61
+ itemData = _ref2.itemData,
62
+ actionListItemHeight = _ref2.actionListItemHeight;
63
+ if (getComponentId(itemData[index]) === componentIds.ActionListItem) {
64
+ return actionListItemHeight;
65
+ }
66
+ if (getComponentId(itemData[index]) === componentIds.ActionListSectionTitle) {
67
+ return actionListSectionTitleHeight;
68
+ }
69
+ // @ts-expect-error: key does exist
70
+ if ((_itemData$index = itemData[index]) !== null && _itemData$index !== void 0 && _itemData$index.key.includes('divider')) {
71
+ return actionListDividerHeight;
72
+ }
73
+ return 0;
74
+ };
75
+
47
76
  /**
48
77
  * Returns the height of item and height of container based on theme and device
49
78
  */
50
- var getVirtualItemParams = function getVirtualItemParams(_ref2) {
51
- var theme = _ref2.theme,
52
- isMobile = _ref2.isMobile;
53
- var itemHeightResponsive = getItemHeight(theme);
79
+ var getVirtualItemParams = function getVirtualItemParams(_ref3) {
80
+ var theme = _ref3.theme,
81
+ isMobile = _ref3.isMobile,
82
+ itemCount = _ref3.itemCount,
83
+ itemData = _ref3.itemData;
84
+ var itemHeightResponsive = getActionListItemHeight(theme);
54
85
  var actionListPadding = getActionListPadding(theme);
86
+ var actionListItemHeight = isMobile ? itemHeightResponsive.itemHeightMobile : itemHeightResponsive.itemHeightDesktop;
87
+ var shouldCalculateMinimumHeight = itemCount <= 10;
55
88
  var actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;
89
+ var actionListBoxMinHeight = shouldCalculateMinimumHeight ? itemData.reduce(function (acc, _, index) {
90
+ var itemHeight = getItemHeight({
91
+ index: index,
92
+ itemData: itemData,
93
+ actionListItemHeight: actionListItemHeight
94
+ });
95
+ return acc + itemHeight;
96
+ }, 0) : actionListBoxHeight;
97
+ var finalActionListBoxHeight = Math.min(actionListBoxHeight, actionListBoxMinHeight);
56
98
  return {
57
- itemHeight: isMobile ? itemHeightResponsive.itemHeightMobile : itemHeightResponsive.itemHeightDesktop,
58
- actionListBoxHeight: actionListBoxHeight
99
+ actionListItemHeight: actionListItemHeight,
100
+ actionListBoxHeight: finalActionListBoxHeight
59
101
  };
60
102
  };
61
103
 
@@ -74,11 +116,34 @@ var useFilteredItems = function useFilteredItems(children) {
74
116
  if (!hasAutoComplete) {
75
117
  return childrenArray;
76
118
  }
77
-
78
- // @ts-expect-error: props does exist
79
- var filteredItems = childrenArray.filter(function (item) {
80
- return filteredValues.includes(item.props.value);
81
- });
119
+ var filteredItems = childrenArray.reduce(function (acc, item, index) {
120
+ if (getComponentId(item) === componentIds.ActionListSection) {
121
+ var sectionTitle = /*#__PURE__*/jsx(ActionListSectionTitle, {
122
+ // @ts-expect-error: props does exist
123
+ title: item === null || item === void 0 ? void 0 : item.props.title,
124
+ isInsideVirtualizedList: true
125
+ }, index);
126
+ // @ts-expect-error: props does exist
127
+ var sectionChildren = item === null || item === void 0 ? void 0 : item.props.children;
128
+ var divider = index !== childrenArray.length - 1 ? /*#__PURE__*/jsx(Divider, {
129
+ marginX: "spacing.3",
130
+ marginY: "spacing.1"
131
+ }, "divider-".concat(index)) : null;
132
+ var filteredSectionChildren = sectionChildren.filter(function (item) {
133
+ return filteredValues.includes(item.props.value);
134
+ });
135
+ if (filteredSectionChildren.length !== 0) {
136
+ acc.push.apply(acc, [sectionTitle].concat(_toConsumableArray(filteredSectionChildren), [divider]));
137
+ }
138
+ } else {
139
+ // @ts-expect-error: props does exist
140
+ var value = item === null || item === void 0 ? void 0 : item.props.value;
141
+ if (filteredValues.includes(value)) {
142
+ acc.push(item);
143
+ }
144
+ }
145
+ return acc;
146
+ }, []);
82
147
  return filteredItems;
83
148
  }, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);
84
149
  return {
@@ -86,20 +151,45 @@ var useFilteredItems = function useFilteredItems(children) {
86
151
  itemCount: items.length
87
152
  };
88
153
  };
89
- var VirtualListItem = function VirtualListItem(_ref3) {
90
- var index = _ref3.index,
91
- style = _ref3.style,
92
- data = _ref3.data;
154
+ var VirtualListItem = /*#__PURE__*/React__default.memo(function (_ref4) {
155
+ var index = _ref4.index,
156
+ style = _ref4.style,
157
+ data = _ref4.data,
158
+ onVirtualizedFocus = _ref4.onVirtualizedFocus;
159
+ var currentItem = data[index];
160
+ if ( /*#__PURE__*/React__default.isValidElement(currentItem) && getComponentId(currentItem) === componentIds.ActionListItem) {
161
+ // Clone the element passed via `data` and add the `_virtualizedIndex` prop
162
+ var elementWithIndex = /*#__PURE__*/React__default.cloneElement(currentItem, {
163
+ _virtualizedIndex: index,
164
+ _onVirtualizedFocus: onVirtualizedFocus
165
+ });
166
+ return /*#__PURE__*/jsx("div", {
167
+ style: style,
168
+ children: elementWithIndex
169
+ });
170
+ }
93
171
  return /*#__PURE__*/jsx("div", {
94
172
  style: style,
95
173
  children: data[index]
96
174
  });
97
- };
98
- var _ActionListVirtualizedBox = /*#__PURE__*/React__default.forwardRef(function (_ref4, ref) {
99
- var childrenWithId = _ref4.childrenWithId,
100
- actionListItemWrapperRole = _ref4.actionListItemWrapperRole,
101
- isMultiSelectable = _ref4.isMultiSelectable,
102
- rest = _objectWithoutProperties(_ref4, _excluded2);
175
+ }, function (prevProps, nextProps) {
176
+ // Custom comparison function to determine if component should update
177
+ return prevProps.index === nextProps.index && prevProps.style === nextProps.style && prevProps.data[prevProps.index] === nextProps.data[nextProps.index];
178
+ });
179
+ var _ActionListVirtualizedBox = /*#__PURE__*/React__default.forwardRef(function (_ref5, ref) {
180
+ var childrenWithId = _ref5.childrenWithId,
181
+ actionListItemWrapperRole = _ref5.actionListItemWrapperRole,
182
+ isMultiSelectable = _ref5.isMultiSelectable,
183
+ rest = _objectWithoutProperties(_ref5, _excluded2);
184
+ var virtualizedListRef = React__default.useRef(null);
185
+ var _React$useState = React__default.useState(0),
186
+ _React$useState2 = _slicedToArray(_React$useState, 2),
187
+ visibleStartIndex = _React$useState2[0],
188
+ setVisibleStartIndex = _React$useState2[1];
189
+ var _React$useState3 = React__default.useState(0),
190
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
191
+ visibleStopIndex = _React$useState4[0],
192
+ setVisibleStopIndex = _React$useState4[1];
103
193
  var items = React__default.Children.toArray(childrenWithId); // Convert children to an array
104
194
  var _useBottomSheetContex2 = useBottomSheetContext(),
105
195
  isInBottomSheet = _useBottomSheetContex2.isInBottomSheet;
@@ -112,33 +202,77 @@ var _ActionListVirtualizedBox = /*#__PURE__*/React__default.forwardRef(function
112
202
  var _React$useMemo = React__default.useMemo(function () {
113
203
  return getVirtualItemParams({
114
204
  theme: theme,
115
- isMobile: isMobile
205
+ isMobile: isMobile,
206
+ itemCount: itemCount,
207
+ itemData: itemData
116
208
  });
117
209
  },
118
210
  // eslint-disable-next-line react-hooks/exhaustive-deps
119
- [theme.name, isMobile]),
120
- itemHeight = _React$useMemo.itemHeight,
211
+ [theme.name, isMobile, itemCount, itemData]),
212
+ actionListItemHeight = _React$useMemo.actionListItemHeight,
121
213
  actionListBoxHeight = _React$useMemo.actionListBoxHeight;
214
+ React__default.useEffect(function () {
215
+ var _virtualizedListRef$c, _virtualizedListRef$c2;
216
+ virtualizedListRef === null || virtualizedListRef === void 0 ? void 0 : (_virtualizedListRef$c = virtualizedListRef.current) === null || _virtualizedListRef$c === void 0 ? void 0 : _virtualizedListRef$c.resetAfterIndex(0);
217
+ virtualizedListRef === null || virtualizedListRef === void 0 ? void 0 : (_virtualizedListRef$c2 = virtualizedListRef.current) === null || _virtualizedListRef$c2 === void 0 ? void 0 : _virtualizedListRef$c2.scrollToItem(0);
218
+ }, [itemCount]);
122
219
  return /*#__PURE__*/jsx(StyledListBoxWrapper, _objectSpread(_objectSpread(_objectSpread({
123
- isInBottomSheet: isInBottomSheet,
220
+ isInBottomSheet: isInBottomSheet
221
+ // in case of virtualized list, we only render visible items. so css will hide divider for every last item visible. instead of hiding the last divider of the list.
222
+ ,
124
223
  ref: ref
125
224
  }, makeAccessible({
126
225
  role: actionListItemWrapperRole,
127
226
  multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined
128
227
  })), makeAnalyticsAttribute(rest)), {}, {
129
- children: itemCount < 10 ? childrenWithId : /*#__PURE__*/jsx(FixedSizeList, {
228
+ children: /*#__PURE__*/jsx(VariableSizeList, {
229
+ ref: virtualizedListRef,
130
230
  height: actionListBoxHeight,
131
231
  width: "100%",
132
- itemSize: itemHeight,
232
+ itemSize: function itemSize(index) {
233
+ return getItemHeight({
234
+ index: index,
235
+ itemData: itemData,
236
+ actionListItemHeight: actionListItemHeight
237
+ });
238
+ },
133
239
  itemCount: itemCount,
134
- itemData: itemData
135
- // @ts-expect-error: props does exist
136
- ,
240
+ itemData: itemData,
137
241
  itemKey: function itemKey(index) {
138
- var _itemData$index;
139
- return (_itemData$index = itemData[index]) === null || _itemData$index === void 0 ? void 0 : _itemData$index.props.value;
242
+ var _ref6, _itemData$index$props, _itemData$index2, _itemData$index3, _itemData$index4;
243
+ return (// @ts-expect-error: props does exist
244
+ (_ref6 = (_itemData$index$props = (_itemData$index2 = itemData[index]) === null || _itemData$index2 === void 0 ? void 0 : _itemData$index2.props.value) !== null && _itemData$index$props !== void 0 ? _itemData$index$props : // @ts-expect-error: props does exist
245
+ (_itemData$index3 = itemData[index]) === null || _itemData$index3 === void 0 ? void 0 : _itemData$index3.props.title) !== null && _ref6 !== void 0 ? _ref6 : // @ts-expect-error: props does exist
246
+ (_itemData$index4 = itemData[index]) === null || _itemData$index4 === void 0 ? void 0 : _itemData$index4.props.key
247
+ );
248
+ },
249
+ onItemsRendered: function onItemsRendered(_ref7) {
250
+ var visibleStartIndex = _ref7.visibleStartIndex,
251
+ visibleStopIndex = _ref7.visibleStopIndex;
252
+ setVisibleStartIndex(visibleStartIndex);
253
+ setVisibleStopIndex(visibleStopIndex);
140
254
  },
141
- children: VirtualListItem
255
+ children: useCallback(function (_ref8) {
256
+ var index = _ref8.index,
257
+ style = _ref8.style,
258
+ data = _ref8.data;
259
+ return /*#__PURE__*/jsx(VirtualListItem, {
260
+ index: index,
261
+ style: style,
262
+ data: data,
263
+ onVirtualizedFocus: function onVirtualizedFocus(index) {
264
+ var _virtualizedListRef$c3, _virtualizedListRef$c4;
265
+ // We need scroll Direction to determine the index to focus
266
+ var scrollDirection = Math.round((visibleStartIndex + visibleStopIndex) / 2) > index ? 'top' : 'bottom';
267
+ virtualizedListRef === null || virtualizedListRef === void 0 ? void 0 : (_virtualizedListRef$c3 = virtualizedListRef.current) === null || _virtualizedListRef$c3 === void 0 ? void 0 : _virtualizedListRef$c3.resetAfterIndex(0);
268
+ /**
269
+ * we are scrolling to the item which is 3 items away from the current item.
270
+ * since we can have 2 item sectoin header and divider which are not focusable.
271
+ */
272
+ virtualizedListRef === null || virtualizedListRef === void 0 ? void 0 : (_virtualizedListRef$c4 = virtualizedListRef.current) === null || _virtualizedListRef$c4 === void 0 ? void 0 : _virtualizedListRef$c4.scrollToItem(index + (scrollDirection === 'top' ? -3 : 3), 'smart');
273
+ }
274
+ });
275
+ }, [visibleStartIndex, visibleStopIndex])
142
276
  })
143
277
  }));
144
278
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport { FixedSizeList as VirtualizedList } from 'react-window';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { actionListMaxHeight, getActionListPadding } from './styles/getBaseListBoxWrapperStyles';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { getItemHeight } from '~components/BaseMenu/BaseMenuItem/tokens';\nimport { useTheme } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(React.memo(_ActionListBox), {\n displayName: 'ActionListBox',\n});\n\n/**\n * Returns the height of item and height of container based on theme and device\n */\nconst getVirtualItemParams = ({\n theme,\n isMobile,\n}: {\n theme: Theme;\n isMobile: boolean;\n}): {\n itemHeight: number;\n actionListBoxHeight: number;\n} => {\n const itemHeightResponsive = getItemHeight(theme);\n const actionListPadding = getActionListPadding(theme);\n const actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;\n\n return {\n itemHeight: isMobile\n ? itemHeightResponsive.itemHeightMobile\n : itemHeightResponsive.itemHeightDesktop,\n actionListBoxHeight,\n };\n};\n\n/**\n * Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state\n */\nconst useFilteredItems = (\n children: React.ReactNode[],\n): {\n itemData: React.ReactNode[];\n itemCount: number;\n} => {\n const childrenArray = React.Children.toArray(children); // Convert children to an array\n\n const { filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer } = useDropdown();\n\n const items = React.useMemo(() => {\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n if (!hasAutoComplete) {\n return childrenArray;\n }\n\n // @ts-expect-error: props does exist\n const filteredItems = childrenArray.filter((item) => filteredValues.includes(item.props.value));\n return filteredItems;\n }, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);\n\n return {\n itemData: items,\n itemCount: items.length,\n };\n};\n\nconst VirtualListItem = ({\n index,\n style,\n data,\n}: {\n index: number;\n style: React.CSSProperties;\n data: React.ReactNode[];\n}): React.ReactElement => {\n return <div style={style}>{data[index]}</div>;\n};\n\nconst _ActionListVirtualizedBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const items = React.Children.toArray(childrenWithId); // Convert children to an array\n const { isInBottomSheet } = useBottomSheetContext();\n const { itemData, itemCount } = useFilteredItems(items);\n\n const isMobile = useIsMobile();\n const { theme } = useTheme();\n const { itemHeight, actionListBoxHeight } = React.useMemo(\n () => getVirtualItemParams({ theme, isMobile }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme.name, isMobile],\n );\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {itemCount < 10 ? (\n childrenWithId\n ) : (\n <VirtualizedList\n height={actionListBoxHeight}\n width=\"100%\"\n itemSize={itemHeight}\n itemCount={itemCount}\n itemData={itemData}\n // @ts-expect-error: props does exist\n itemKey={(index) => itemData[index]?.props.value}\n >\n {VirtualListItem}\n </VirtualizedList>\n )}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListVirtualizedBox = assignWithoutSideEffects(React.memo(_ActionListVirtualizedBox), {\n displayName: 'ActionListVirtualizedBox',\n});\n\nexport { ActionListBox, ActionListVirtualizedBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","memo","displayName","getVirtualItemParams","_ref2","theme","isMobile","itemHeightResponsive","getItemHeight","actionListPadding","getActionListPadding","actionListBoxHeight","actionListMaxHeight","itemHeight","itemHeightMobile","itemHeightDesktop","useFilteredItems","childrenArray","Children","toArray","_useDropdown","useDropdown","filteredValues","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","items","useMemo","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredItems","filter","item","includes","props","value","itemData","itemCount","length","VirtualListItem","_ref3","index","style","data","_ActionListVirtualizedBox","_ref4","_excluded2","_useBottomSheetContex2","_useFilteredItems","useIsMobile","_useTheme","useTheme","_React$useMemo","name","VirtualizedList","height","width","itemSize","itemKey","_itemData$index","ActionListVirtualizedBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAN,IAAA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vB,cAAK,CAACwB,IAAI,CAAC4C,yBAAyB,CAAC,EAAE;AAC/F3C,EAAAA,WAAW,EAAE,0BAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React, { useCallback } from 'react';\nimport type { VariableSizeList } from 'react-window';\nimport { VariableSizeList as VirtualizedList } from 'react-window';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { actionListMaxHeight, getActionListPadding } from './styles/getBaseListBoxWrapperStyles';\nimport { componentIds } from './componentIds';\nimport { ActionListSectionTitle } from './ActionListItem';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport {\n actionListSectionTitleHeight,\n actionListDividerHeight,\n getActionListItemHeight,\n} from '~components/BaseMenu/BaseMenuItem/tokens';\nimport { useTheme } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { Divider } from '~components/Divider';\nimport type { ActionListItemProps } from '~components/ActionList';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(React.memo(_ActionListBox), {\n displayName: 'ActionListBox',\n});\n\n/**\n * get the height of the item based on the componentId\n */\nconst getItemHeight = ({\n index,\n itemData,\n actionListItemHeight,\n}: {\n index: number;\n itemData: React.ReactNode[];\n actionListItemHeight: number;\n}): number => {\n if (getComponentId(itemData[index]) === componentIds.ActionListItem) {\n return actionListItemHeight;\n }\n\n if (getComponentId(itemData[index]) === componentIds.ActionListSectionTitle) {\n return actionListSectionTitleHeight;\n }\n // @ts-expect-error: key does exist\n if (itemData[index]?.key.includes('divider')) {\n return actionListDividerHeight;\n }\n return 0;\n};\n\n/**\n * Returns the height of item and height of container based on theme and device\n */\nconst getVirtualItemParams = ({\n theme,\n isMobile,\n itemCount,\n itemData,\n}: {\n theme: Theme;\n isMobile: boolean;\n itemCount: number;\n itemData: React.ReactNode[];\n}): {\n actionListItemHeight: number;\n actionListBoxHeight: number;\n} => {\n const itemHeightResponsive = getActionListItemHeight(theme);\n const actionListPadding = getActionListPadding(theme);\n const actionListItemHeight = isMobile\n ? itemHeightResponsive.itemHeightMobile\n : itemHeightResponsive.itemHeightDesktop;\n const shouldCalculateMinimumHeight = itemCount <= 10;\n const actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;\n const actionListBoxMinHeight = shouldCalculateMinimumHeight\n ? itemData.reduce<number>((acc, _, index) => {\n const itemHeight = getItemHeight({ index, itemData, actionListItemHeight });\n return acc + itemHeight;\n }, 0)\n : actionListBoxHeight;\n const finalActionListBoxHeight = Math.min(actionListBoxHeight, actionListBoxMinHeight);\n\n return {\n actionListItemHeight,\n actionListBoxHeight: finalActionListBoxHeight,\n };\n};\n\n/**\n * Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state\n */\nconst useFilteredItems = (\n children: React.ReactNode[],\n): {\n itemData: React.ReactNode[];\n itemCount: number;\n} => {\n const childrenArray = React.Children.toArray(children); // Convert children to an array\n\n const { filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer } = useDropdown();\n\n const items = React.useMemo(() => {\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n if (!hasAutoComplete) {\n return childrenArray;\n }\n\n const filteredItems = childrenArray.reduce<React.ReactNode[]>((acc, item, index) => {\n if (getComponentId(item) === componentIds.ActionListSection) {\n const sectionTitle = (\n <ActionListSectionTitle\n key={index}\n // @ts-expect-error: props does exist\n title={item?.props.title}\n isInsideVirtualizedList\n />\n );\n // @ts-expect-error: props does exist\n const sectionChildren = item?.props.children;\n\n const divider =\n index !== childrenArray.length - 1 ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" key={`divider-${index}`} />\n ) : null;\n const filteredSectionChildren = sectionChildren.filter(\n (item: { props: { value: string } }) => filteredValues.includes(item.props.value),\n );\n if (filteredSectionChildren.length !== 0) {\n acc.push(sectionTitle, ...filteredSectionChildren, divider);\n }\n } else {\n // @ts-expect-error: props does exist\n const value = item?.props.value;\n if (filteredValues.includes(value)) {\n acc.push(item);\n }\n }\n return acc;\n }, []);\n\n return filteredItems;\n }, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);\n\n return {\n itemData: items,\n itemCount: items.length,\n };\n};\n\nconst VirtualListItem = React.memo(\n ({\n index,\n style,\n data,\n onVirtualizedFocus,\n }: {\n index: number;\n style: React.CSSProperties;\n data: React.ReactNode[];\n onVirtualizedFocus: (index: number) => void;\n }): React.ReactElement | null => {\n const currentItem = data[index];\n\n if (\n React.isValidElement(currentItem) &&\n getComponentId(currentItem) === componentIds.ActionListItem\n ) {\n // Clone the element passed via `data` and add the `_virtualizedIndex` prop\n const elementWithIndex = React.cloneElement(\n currentItem as React.ReactElement<ActionListItemProps>,\n {\n _virtualizedIndex: index,\n _onVirtualizedFocus: onVirtualizedFocus,\n },\n );\n\n return <div style={style}>{elementWithIndex}</div>;\n }\n\n return <div style={style}>{data[index]}</div>;\n },\n (prevProps, nextProps) => {\n // Custom comparison function to determine if component should update\n return (\n prevProps.index === nextProps.index &&\n prevProps.style === nextProps.style &&\n prevProps.data[prevProps.index] === nextProps.data[nextProps.index]\n );\n },\n);\n\nconst _ActionListVirtualizedBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const virtualizedListRef = React.useRef<VariableSizeList>(null);\n const [visibleStartIndex, setVisibleStartIndex] = React.useState(0);\n const [visibleStopIndex, setVisibleStopIndex] = React.useState(0);\n const items = React.Children.toArray(childrenWithId); // Convert children to an array\n const { isInBottomSheet } = useBottomSheetContext();\n const { itemData, itemCount } = useFilteredItems(items);\n\n const isMobile = useIsMobile();\n const { theme } = useTheme();\n const { actionListItemHeight, actionListBoxHeight } = React.useMemo(\n () => getVirtualItemParams({ theme, isMobile, itemCount, itemData }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme.name, isMobile, itemCount, itemData],\n );\n React.useEffect(() => {\n virtualizedListRef?.current?.resetAfterIndex(0);\n virtualizedListRef?.current?.scrollToItem(0);\n }, [itemCount]);\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n // in case of virtualized list, we only render visible items. so css will hide divider for every last item visible. instead of hiding the last divider of the list.\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n <VirtualizedList<React.ReactNode[]>\n ref={virtualizedListRef}\n height={actionListBoxHeight}\n width=\"100%\"\n itemSize={(index) => getItemHeight({ index, itemData, actionListItemHeight })}\n itemCount={itemCount}\n itemData={itemData}\n itemKey={(index) =>\n // @ts-expect-error: props does exist\n itemData[index]?.props.value ??\n // @ts-expect-error: props does exist\n itemData[index]?.props.title ??\n // @ts-expect-error: props does exist\n itemData[index]?.props.key\n }\n onItemsRendered={({ visibleStartIndex, visibleStopIndex }) => {\n setVisibleStartIndex(visibleStartIndex);\n setVisibleStopIndex(visibleStopIndex);\n }}\n >\n {useCallback(\n ({ index, style, data }) => {\n return (\n <VirtualListItem\n index={index}\n style={style}\n data={data}\n onVirtualizedFocus={(index) => {\n // We need scroll Direction to determine the index to focus\n const scrollDirection =\n Math.round((visibleStartIndex + visibleStopIndex) / 2) > index\n ? 'top'\n : 'bottom';\n virtualizedListRef?.current?.resetAfterIndex(0);\n /**\n * we are scrolling to the item which is 3 items away from the current item.\n * since we can have 2 item sectoin header and divider which are not focusable.\n */\n virtualizedListRef?.current?.scrollToItem(\n index + (scrollDirection === 'top' ? -3 : 3),\n 'smart',\n );\n }}\n />\n );\n },\n [visibleStartIndex, visibleStopIndex],\n )}\n </VirtualizedList>\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListVirtualizedBox = assignWithoutSideEffects(React.memo(_ActionListVirtualizedBox), {\n displayName: 'ActionListVirtualizedBox',\n});\n\nexport { ActionListBox, ActionListVirtualizedBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","memo","displayName","getItemHeight","_ref2","_itemData$index","index","itemData","actionListItemHeight","getComponentId","componentIds","ActionListItem","ActionListSectionTitle","actionListSectionTitleHeight","key","includes","actionListDividerHeight","getVirtualItemParams","_ref3","theme","isMobile","itemCount","itemHeightResponsive","getActionListItemHeight","actionListPadding","getActionListPadding","itemHeightMobile","itemHeightDesktop","shouldCalculateMinimumHeight","actionListBoxHeight","actionListMaxHeight","actionListBoxMinHeight","reduce","acc","_","itemHeight","finalActionListBoxHeight","Math","min","useFilteredItems","childrenArray","Children","toArray","_useDropdown","useDropdown","filteredValues","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","items","useMemo","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredItems","item","ActionListSection","sectionTitle","title","props","isInsideVirtualizedList","sectionChildren","divider","length","Divider","marginX","marginY","concat","filteredSectionChildren","filter","value","push","apply","_toConsumableArray","VirtualListItem","_ref4","style","data","onVirtualizedFocus","currentItem","isValidElement","elementWithIndex","cloneElement","_virtualizedIndex","_onVirtualizedFocus","prevProps","nextProps","_ActionListVirtualizedBox","_ref5","_excluded2","virtualizedListRef","useRef","_React$useState","useState","_React$useState2","_slicedToArray","visibleStartIndex","setVisibleStartIndex","_React$useState3","_React$useState4","visibleStopIndex","setVisibleStopIndex","_useBottomSheetContex2","_useFilteredItems","useIsMobile","_useTheme","useTheme","_React$useMemo","name","useEffect","_virtualizedListRef$c","_virtualizedListRef$c2","current","resetAfterIndex","scrollToItem","VirtualizedList","height","width","itemSize","itemKey","_ref6","_itemData$index$props","_itemData$index2","_itemData$index3","_itemData$index4","onItemsRendered","_ref7","useCallback","_ref8","_virtualizedListRef$c3","_virtualizedListRef$c4","scrollDirection","round","ActionListVirtualizedBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAA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5 +1,5 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
3
  import React__default from 'react';
4
4
  import styled from 'styled-components';
5
5
  import { componentIds } from './componentIds.js';
@@ -22,17 +22,17 @@ import '../BaseMenu/index.js';
22
22
  import '../Checkbox/index.js';
23
23
  import '../Avatar/index.js';
24
24
  import '../../utils/makeAnalyticsAttribute/index.js';
25
- import { jsxs, jsx } from 'react/jsx-runtime';
25
+ import { jsx, jsxs } from 'react/jsx-runtime';
26
26
  import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
27
27
  import { makeSize } from '../../utils/makeSize/makeSize.js';
28
- import { isReactNative } from '../../utils/platform/isReactNative.js';
29
28
  import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
29
+ import { Text } from '../Typography/Text/Text.js';
30
+ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
31
+ import { isReactNative } from '../../utils/platform/isReactNative.js';
30
32
  import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
31
33
  import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
32
34
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
33
- import { Text } from '../Typography/Text/Text.js';
34
35
  import { Divider } from '../Divider/Divider.js';
35
- import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
36
36
  import { useBaseMenuItem } from '../BaseMenu/BaseMenuContext.js';
37
37
  import { Box } from '../Box/Box.js';
38
38
  import { Avatar } from '../Avatar/Avatar.web.js';
@@ -54,13 +54,32 @@ var StyledActionListSectionTitle = /*#__PURE__*/styled(BaseBox).withConfig({
54
54
  padding: makeSize(props.theme.spacing[3])
55
55
  };
56
56
  });
57
- var _ActionListSection = function _ActionListSection(_ref) {
57
+ var _ActionListSectionTitle = function _ActionListSectionTitle(_ref) {
58
58
  var title = _ref.title,
59
- children = _ref.children,
60
- testID = _ref.testID,
61
- _hideDivider = _ref._hideDivider,
62
- _sectionChildValues = _ref._sectionChildValues,
63
- rest = _objectWithoutProperties(_ref, _excluded);
59
+ _ref$isInsideVirtuali = _ref.isInsideVirtualizedList,
60
+ isInsideVirtualizedList = _ref$isInsideVirtuali === void 0 ? false : _ref$isInsideVirtuali;
61
+ return /*#__PURE__*/jsx(StyledActionListSectionTitle, _objectSpread(_objectSpread({}, makeAccessible({
62
+ hidden: !isInsideVirtualizedList,
63
+ role: isInsideVirtualizedList ? 'heading' : undefined
64
+ })), {}, {
65
+ children: /*#__PURE__*/jsx(Text, {
66
+ color: "surface.text.gray.muted",
67
+ size: "small",
68
+ weight: "semibold",
69
+ children: title
70
+ })
71
+ }));
72
+ };
73
+ var ActionListSectionTitle = /*#__PURE__*/assignWithoutSideEffects(_ActionListSectionTitle, {
74
+ componentId: componentIds.ActionListSectionTitle
75
+ });
76
+ var _ActionListSection = function _ActionListSection(_ref2) {
77
+ var title = _ref2.title,
78
+ children = _ref2.children,
79
+ testID = _ref2.testID,
80
+ _hideDivider = _ref2._hideDivider,
81
+ _sectionChildValues = _ref2._sectionChildValues,
82
+ rest = _objectWithoutProperties(_ref2, _excluded);
64
83
  var _useDropdown = useDropdown(),
65
84
  hasAutoCompleteInBottomSheetHeader = _useDropdown.hasAutoCompleteInBottomSheetHeader,
66
85
  dropdownTriggerer = _useDropdown.dropdownTriggerer,
@@ -84,16 +103,9 @@ var _ActionListSection = function _ActionListSection(_ref) {
84
103
  name: MetaConstants.ActionListSection,
85
104
  testID: testID
86
105
  })), makeAnalyticsAttribute(rest)), {}, {
87
- children: [isSectionVisible ? /*#__PURE__*/jsx(StyledActionListSectionTitle, _objectSpread(_objectSpread({}, makeAccessible({
88
- hidden: true
89
- })), {}, {
90
- children: /*#__PURE__*/jsx(Text, {
91
- color: "surface.text.gray.muted",
92
- size: "small",
93
- weight: "semibold",
94
- children: title
95
- })
96
- })) : null, /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({}, makeAccessible({
106
+ children: [isSectionVisible ? /*#__PURE__*/jsx(ActionListSectionTitle, {
107
+ title: title
108
+ }) : null, /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({}, makeAccessible({
97
109
  // On web, we just wrap it in another listbox to announce item count properly for particular group.
98
110
  // On React Native, we ignore it since `menu` + `group` role will take care of accessibility
99
111
  role: isReactNative() ? undefined : 'listbox'
@@ -105,11 +117,11 @@ var _ActionListSection = function _ActionListSection(_ref) {
105
117
  }) : null]
106
118
  }));
107
119
  };
108
- var ActionListSection = /*#__PURE__*/assignWithoutSideEffects(_ActionListSection, {
120
+ var ActionListSection = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListSection), {
109
121
  componentId: componentIds.ActionListSection
110
122
  });
111
- var _ActionListItemIcon = function _ActionListItemIcon(_ref2) {
112
- var icon = _ref2.icon;
123
+ var _ActionListItemIcon = function _ActionListItemIcon(_ref3) {
124
+ var icon = _ref3.icon;
113
125
  var Icon = icon;
114
126
  var _useBaseMenuItem = useBaseMenuItem(),
115
127
  color = _useBaseMenuItem.color,
@@ -123,8 +135,8 @@ var _ActionListItemIcon = function _ActionListItemIcon(_ref2) {
123
135
  var ActionListItemIcon = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemIcon, {
124
136
  componentId: componentIds.ActionListItemIcon
125
137
  });
126
- var _ActionListItemBadgeGroup = function _ActionListItemBadgeGroup(_ref3) {
127
- var children = _ref3.children;
138
+ var _ActionListItemBadgeGroup = function _ActionListItemBadgeGroup(_ref4) {
139
+ var children = _ref4.children;
128
140
  return /*#__PURE__*/jsx(Box, {
129
141
  display: "flex",
130
142
  alignItems: "center",
@@ -152,8 +164,8 @@ var _ActionListItemBadge = function _ActionListItemBadge(props) {
152
164
  var ActionListItemBadge = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemBadge, {
153
165
  componentId: componentIds.ActionListItemBadge
154
166
  });
155
- var _ActionListItemText = function _ActionListItemText(_ref4) {
156
- var children = _ref4.children;
167
+ var _ActionListItemText = function _ActionListItemText(_ref5) {
168
+ var children = _ref5.children;
157
169
  var _useBaseMenuItem2 = useBaseMenuItem(),
158
170
  isDisabled = _useBaseMenuItem2.isDisabled;
159
171
  return /*#__PURE__*/jsx(Text, {
@@ -210,6 +222,13 @@ var _ActionListItem = function _ActionListItem(props) {
210
222
  isKeydownPressed = _useDropdown2.isKeydownPressed,
211
223
  filteredValues = _useDropdown2.filteredValues,
212
224
  hasAutoCompleteInBottomSheetHeader = _useDropdown2.hasAutoCompleteInBottomSheetHeader;
225
+ React__default.useEffect(function () {
226
+ if (activeIndex === props._index && props._virtualizedIndex !== undefined) {
227
+ var _props$_onVirtualized;
228
+ (_props$_onVirtualized = props._onVirtualizedFocus) === null || _props$_onVirtualized === void 0 ? void 0 : _props$_onVirtualized.call(props, props._virtualizedIndex);
229
+ }
230
+ // eslint-disable-next-line react-hooks/exhaustive-deps
231
+ }, [activeIndex]);
213
232
  var hasAutoComplete = hasAutoCompleteInBottomSheetHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
214
233
  var renderOnWebAs = props.href ? 'a' : 'button';
215
234
 
@@ -310,5 +329,5 @@ var ActionListItem = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__
310
329
  displayName: componentIds.ActionListItem
311
330
  });
312
331
 
313
- export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection };
332
+ export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection, ActionListSectionTitle };
314
333
  //# sourceMappingURL=ActionListItem.js.map