@sproutsocial/seeds-react-menu 1.10.2 → 1.10.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-menu",
3
- "version": "1.10.2",
3
+ "version": "1.10.4",
4
4
  "description": "Seeds React Menu",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "@sproutsocial/seeds-react-switch": "^1.2.25",
43
43
  "@sproutsocial/seeds-react-system-props": "^3.0.2",
44
44
  "@sproutsocial/seeds-react-theme": "^3.6.0",
45
- "@sproutsocial/seeds-react-token-input": "^1.4.30",
45
+ "@sproutsocial/seeds-react-token-input": "^1.4.31",
46
46
  "@sproutsocial/seeds-react-utilities": "^4.3.0",
47
47
  "@tanstack/react-virtual": "^3.13.12",
48
48
  "downshift": "9.0.4",
@@ -137,7 +137,7 @@ const generateBooks = (count: number): Book[] => {
137
137
 
138
138
  return books;
139
139
  };
140
- const largeBookSet = generateBooks(1000);
140
+ const largeBookSet = generateBooks(100);
141
141
 
142
142
  const renderItem = (item: Book) => (
143
143
  <>
@@ -61,6 +61,7 @@ export function MultiAutocomplete<T extends DataWithId>({
61
61
  groupBy,
62
62
  renderGroupHeading,
63
63
  isVirtualized = false,
64
+ estimatedItemHeight,
64
65
  showSelectedItems = false,
65
66
  selectHeadings = false,
66
67
  selectAllItem,
@@ -448,6 +449,7 @@ export function MultiAutocomplete<T extends DataWithId>({
448
449
  allData={data}
449
450
  selectAllItem={selectAllItem}
450
451
  isVirtualized={isVirtualized}
452
+ estimatedItemHeight={estimatedItemHeight}
451
453
  {...menuProps}
452
454
  />
453
455
  }
@@ -56,6 +56,7 @@ export function SingleAutocomplete<T extends DataWithId>({
56
56
  groupBy,
57
57
  renderGroupHeading,
58
58
  isVirtualized = false,
59
+ estimatedItemHeight,
59
60
  EmptyState,
60
61
  placeholder,
61
62
  onSelectedItemIdChange,
@@ -337,6 +338,7 @@ export function SingleAutocomplete<T extends DataWithId>({
337
338
  selectHeadings={false}
338
339
  groupBy={groupBy}
339
340
  isVirtualized={isVirtualized}
341
+ estimatedItemHeight={estimatedItemHeight}
340
342
  placeholderItem={includePlaceholderItem ? placeholderItem : undefined}
341
343
  {...menuProps}
342
344
  />
@@ -30,6 +30,7 @@ interface ComboboxContentProps<T extends DataWithId>
30
30
  allData?: T[];
31
31
  selectAllItem?: ToggleItem;
32
32
  placeholderItem?: ToggleItem;
33
+ estimatedItemHeight?: number;
33
34
  }
34
35
 
35
36
  export const VirtualizedComboboxContent = <T extends DataWithId>({
@@ -48,6 +49,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
48
49
  groupBy,
49
50
  allData,
50
51
  selectAllItem,
52
+ estimatedItemHeight = 35,
51
53
  ...rest
52
54
  }: ComboboxContentProps<T>) => {
53
55
  const containerRef = useRef(null);
@@ -60,7 +62,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
60
62
  getScrollElement: () => containerRef.current,
61
63
  estimateSize: (index) => {
62
64
  const item = items[index];
63
- return isGroupHeading(item) ? 30 : 35;
65
+ return isGroupHeading(item) ? 40 : estimatedItemHeight;
64
66
  },
65
67
  });
66
68
 
@@ -76,7 +78,10 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
76
78
 
77
79
  const virtualItems = rowVirtualizer.getVirtualItems();
78
80
 
79
- const menuProps = getMenuProps({ ref: containerRef });
81
+ const menuProps = getMenuProps(
82
+ { ref: containerRef },
83
+ { suppressRefError: true }
84
+ );
80
85
  return (
81
86
  <div {...menuProps} {...rest}>
82
87
  {!hasItems && EmptyState ? (
@@ -131,6 +136,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
131
136
 
132
137
  return (
133
138
  <MenuHeading
139
+ ref={rowVirtualizer.measureElement}
134
140
  key={virtualItem.key}
135
141
  {...headingItemProps}
136
142
  $highlighted={highlightedIndex === virtualItem.index}
@@ -158,6 +164,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
158
164
  : false;
159
165
  return (
160
166
  <MenuItem
167
+ ref={rowVirtualizer.measureElement}
161
168
  key={virtualItem.key}
162
169
  inputType={inputType}
163
170
  selected={isItemSelected}
@@ -188,6 +195,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
188
195
  }}
189
196
  $highlighted={highlightedIndex === virtualItem.index}
190
197
  $active={false}
198
+ ref={rowVirtualizer.measureElement}
191
199
  >
192
200
  {renderItem(dataItem)}
193
201
  </MenuItem>
@@ -221,7 +229,7 @@ export const NormalComboboxContent = <T extends DataWithId>({
221
229
  // Check if there are any actual items (not just headings)
222
230
  const hasItems = items.some((item) => !isGroupHeading(item));
223
231
 
224
- const menuProps = getMenuProps();
232
+ const menuProps = getMenuProps({}, { suppressRefError: true });
225
233
 
226
234
  return (
227
235
  <div {...menuProps} {...rest}>
@@ -347,7 +355,7 @@ export const GroupedComboboxContent = <T extends DataWithId>({
347
355
  // Check if there are any actual items (not just headings)
348
356
  const hasItems = items.some((item) => !isGroupHeading(item));
349
357
 
350
- const menuProps = getMenuProps();
358
+ const menuProps = getMenuProps({}, { suppressRefError: true });
351
359
 
352
360
  const groupedItems = groupItems(
353
361
  items as T[],
@@ -14,6 +14,7 @@ export interface BaseSelectProps<T extends DataWithId> {
14
14
  groupBy?: (item: T) => string;
15
15
  renderGroupHeading?: (label: string) => string;
16
16
  isVirtualized?: boolean;
17
+ estimatedItemHeight?: number;
17
18
  placeholder: string;
18
19
  onIsOpenChange?: (isOpen: boolean) => void;
19
20
  stateReducer?: any;
@@ -66,6 +66,7 @@ export function MultiSelect<T extends DataWithId>({
66
66
  groupBy,
67
67
  renderGroupHeading,
68
68
  isVirtualized = false,
69
+ estimatedItemHeight,
69
70
  showSelectedItems = false,
70
71
  selectHeadings = false,
71
72
  selectAllItem,
@@ -398,6 +399,7 @@ export function MultiSelect<T extends DataWithId>({
398
399
  allData={data}
399
400
  selectAllItem={selectAllItem}
400
401
  isVirtualized={isVirtualized}
402
+ estimatedItemHeight={estimatedItemHeight}
401
403
  {...menuProps}
402
404
  />
403
405
  }
@@ -56,6 +56,7 @@ export function SingleSelect<T extends DataWithId>({
56
56
  groupBy,
57
57
  renderGroupHeading,
58
58
  isVirtualized = false,
59
+ estimatedItemHeight,
59
60
  placeholder,
60
61
  onSelectedItemIdChange,
61
62
  onIsOpenChange,
@@ -265,6 +266,7 @@ export function SingleSelect<T extends DataWithId>({
265
266
  itemToString={itemToString}
266
267
  inputType={inputType}
267
268
  isVirtualized={isVirtualized}
269
+ estimatedItemHeight={estimatedItemHeight}
268
270
  groupBy={groupBy}
269
271
  selectHeadings={false}
270
272
  {...menuProps}