@sproutsocial/seeds-react-menu 1.10.1 → 1.10.3

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.1",
3
+ "version": "1.10.3",
4
4
  "description": "Seeds React Menu",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -32,17 +32,17 @@
32
32
  "dependencies": {
33
33
  "@radix-ui/react-popover": "^1.1.2",
34
34
  "@sproutsocial/seeds-react-box": "^1.1.14",
35
- "@sproutsocial/seeds-react-button": "^1.4.1",
36
- "@sproutsocial/seeds-react-checkbox": "^1.3.25",
37
- "@sproutsocial/seeds-react-icon": "^2.2.6",
38
- "@sproutsocial/seeds-react-input": "^1.5.8",
35
+ "@sproutsocial/seeds-react-button": "^1.4.2",
36
+ "@sproutsocial/seeds-react-checkbox": "^1.3.26",
37
+ "@sproutsocial/seeds-react-icon": "^2.3.0",
38
+ "@sproutsocial/seeds-react-input": "^1.5.9",
39
39
  "@sproutsocial/seeds-react-label": "^1.0.14",
40
- "@sproutsocial/seeds-react-popout": "^2.4.29",
40
+ "@sproutsocial/seeds-react-popout": "^2.4.30",
41
41
  "@sproutsocial/seeds-react-radio": "^1.3.14",
42
- "@sproutsocial/seeds-react-switch": "^1.2.24",
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.29",
45
+ "@sproutsocial/seeds-react-token-input": "^1.4.30",
46
46
  "@sproutsocial/seeds-react-utilities": "^4.3.0",
47
47
  "@tanstack/react-virtual": "^3.13.12",
48
48
  "downshift": "9.0.4",
@@ -51,7 +51,7 @@
51
51
  "styled-system": "^5.1.5"
52
52
  },
53
53
  "devDependencies": {
54
- "@sproutsocial/seeds-react-tooltip": "^1.1.11",
54
+ "@sproutsocial/seeds-react-tooltip": "^1.1.12",
55
55
  "@sproutsocial/eslint-config-seeds": "*",
56
56
  "@sproutsocial/seeds-react-testing-library": "*",
57
57
  "@sproutsocial/seeds-testing": "*",
@@ -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
 
@@ -131,6 +133,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
131
133
 
132
134
  return (
133
135
  <MenuHeading
136
+ ref={rowVirtualizer.measureElement}
134
137
  key={virtualItem.key}
135
138
  {...headingItemProps}
136
139
  $highlighted={highlightedIndex === virtualItem.index}
@@ -158,6 +161,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
158
161
  : false;
159
162
  return (
160
163
  <MenuItem
164
+ ref={rowVirtualizer.measureElement}
161
165
  key={virtualItem.key}
162
166
  inputType={inputType}
163
167
  selected={isItemSelected}
@@ -188,6 +192,7 @@ export const VirtualizedComboboxContent = <T extends DataWithId>({
188
192
  }}
189
193
  $highlighted={highlightedIndex === virtualItem.index}
190
194
  $active={false}
195
+ ref={rowVirtualizer.measureElement}
191
196
  >
192
197
  {renderItem(dataItem)}
193
198
  </MenuItem>
@@ -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}