@sproutsocial/seeds-react-menu 1.11.7 → 1.11.9

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.11.7",
3
+ "version": "1.11.9",
4
4
  "description": "Seeds React Menu",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -37,17 +37,17 @@
37
37
  "dependencies": {
38
38
  "@radix-ui/react-popover": "^1.1.2",
39
39
  "@sproutsocial/seeds-react-box": "^1.1.16",
40
- "@sproutsocial/seeds-react-button": "^2.0.3",
41
- "@sproutsocial/seeds-react-checkbox": "^1.3.31",
42
- "@sproutsocial/seeds-react-icon": "^2.3.5",
43
- "@sproutsocial/seeds-react-input": "^1.5.14",
40
+ "@sproutsocial/seeds-react-button": "^2.0.4",
41
+ "@sproutsocial/seeds-react-checkbox": "^1.3.32",
42
+ "@sproutsocial/seeds-react-icon": "^2.3.6",
43
+ "@sproutsocial/seeds-react-input": "^1.5.15",
44
44
  "@sproutsocial/seeds-react-label": "^1.0.16",
45
- "@sproutsocial/seeds-react-popout": "^2.4.36",
45
+ "@sproutsocial/seeds-react-popout": "^2.4.37",
46
46
  "@sproutsocial/seeds-react-radio": "^1.3.16",
47
- "@sproutsocial/seeds-react-switch": "^1.2.30",
47
+ "@sproutsocial/seeds-react-switch": "^1.2.31",
48
48
  "@sproutsocial/seeds-react-system-props": "^3.0.2",
49
49
  "@sproutsocial/seeds-react-theme": "^3.6.2",
50
- "@sproutsocial/seeds-react-token-input": "^1.4.36",
50
+ "@sproutsocial/seeds-react-token-input": "^1.4.37",
51
51
  "@sproutsocial/seeds-react-utilities": "^4.3.0",
52
52
  "@base-ui/react": "^1.3.0",
53
53
  "@tanstack/react-virtual": "^3.13.12",
@@ -57,7 +57,7 @@
57
57
  "styled-system": "^5.1.5"
58
58
  },
59
59
  "devDependencies": {
60
- "@sproutsocial/seeds-react-tooltip": "^1.1.18",
60
+ "@sproutsocial/seeds-react-tooltip": "^1.1.19",
61
61
  "@sproutsocial/eslint-config-seeds": "*",
62
62
  "@sproutsocial/seeds-react-testing-library": "*",
63
63
  "@sproutsocial/seeds-testing": "*",
@@ -344,3 +344,30 @@ export const VirtualizedSelectAll: Story = {
344
344
  </div>
345
345
  ),
346
346
  };
347
+
348
+ export const CustomSearch: Story = {
349
+ name: "Custom search (title + author)",
350
+ render: () => (
351
+ <div style={{ width: "300px" }}>
352
+ <FormField label="Pick books">
353
+ {({ id }) => (
354
+ <MultiCombobox
355
+ id={id}
356
+ data={books}
357
+ itemToString={itemToString}
358
+ renderItem={renderItem}
359
+ placeholder="Search by title or author..."
360
+ filter={(item, query) => {
361
+ const book = item as (typeof books)[number];
362
+ const q = query.toLowerCase();
363
+ return (
364
+ book.title.toLowerCase().includes(q) ||
365
+ book.author.toLowerCase().includes(q)
366
+ );
367
+ }}
368
+ />
369
+ )}
370
+ </FormField>
371
+ </div>
372
+ ),
373
+ };
@@ -65,6 +65,7 @@ interface MultiComboboxBaseProps {
65
65
  isLoading?: boolean;
66
66
  loadingText?: string;
67
67
  disabled?: boolean;
68
+ filter?: ((item: unknown, query: string) => boolean) | null;
68
69
  }
69
70
 
70
71
  interface MultiComboboxDataProps<T extends DataWithId>
@@ -125,6 +126,7 @@ export function MultiCombobox<T extends DataWithId>(
125
126
  emptyText = "No results found.",
126
127
  isLoading = false,
127
128
  loadingText = "Loading...",
129
+ filter,
128
130
  } = props;
129
131
 
130
132
  const isChildrenMode = "children" in props && props.children != null;
@@ -378,6 +380,7 @@ export function MultiCombobox<T extends DataWithId>(
378
380
  open={open}
379
381
  disabled={props.disabled}
380
382
  onOpenChange={setOpen}
383
+ filter={filter}
381
384
  onItemHighlighted={
382
385
  isVirtualized
383
386
  ? (item, { reason, index }) => {
@@ -412,3 +412,31 @@ export const LoadingWithToggle: Story = {
412
412
  );
413
413
  },
414
414
  };
415
+
416
+ export const CustomSearch: Story = {
417
+ name: "Custom search (title + author)",
418
+ render: () => (
419
+ <div style={{ width: "300px" }}>
420
+ <FormField label="Pick books">
421
+ {({ id }) => (
422
+ <MultiSearchableSelect
423
+ id={id}
424
+ data={books}
425
+ itemToString={itemToString}
426
+ renderItem={renderItem}
427
+ placeholder="Select books"
428
+ searchPlaceholder="Search by title or author..."
429
+ filter={(item, query) => {
430
+ const book = item as (typeof books)[number];
431
+ const q = query.toLowerCase();
432
+ return (
433
+ book.title.toLowerCase().includes(q) ||
434
+ book.author.toLowerCase().includes(q)
435
+ );
436
+ }}
437
+ />
438
+ )}
439
+ </FormField>
440
+ </div>
441
+ ),
442
+ };
@@ -72,6 +72,7 @@ interface MultiSearchableSelectBaseProps {
72
72
  isLoading?: boolean;
73
73
  loadingText?: string;
74
74
  disabled?: boolean;
75
+ filter?: ((item: unknown, query: string) => boolean) | null;
75
76
  }
76
77
 
77
78
  interface MultiSearchableSelectDataProps<T extends DataWithId>
@@ -132,6 +133,7 @@ export function MultiSearchableSelect<T extends DataWithId>(
132
133
  emptyText = "No results found.",
133
134
  isLoading = false,
134
135
  loadingText = "Loading...",
136
+ filter,
135
137
  } = props;
136
138
 
137
139
  const isChildrenMode = "children" in props && props.children != null;
@@ -365,6 +367,7 @@ export function MultiSearchableSelect<T extends DataWithId>(
365
367
  multiple
366
368
  id={id}
367
369
  virtualized={isVirtualized}
370
+ filter={filter}
368
371
  open={open}
369
372
  disabled={props.disabled}
370
373
  onOpenChange={setOpen}
@@ -191,3 +191,30 @@ export const Virtualized: Story = {
191
191
  </div>
192
192
  ),
193
193
  };
194
+
195
+ export const CustomSearch: Story = {
196
+ name: "Custom search (title + author)",
197
+ render: () => (
198
+ <div style={{ width: "300px" }}>
199
+ <FormField label="Pick a book">
200
+ {({ id }) => (
201
+ <SingleCombobox
202
+ id={id}
203
+ data={books}
204
+ itemToString={itemToString}
205
+ renderItem={renderItem}
206
+ placeholder="Search by title or author..."
207
+ filter={(item, query) => {
208
+ const book = item as (typeof books)[number];
209
+ const q = query.toLowerCase();
210
+ return (
211
+ book.title.toLowerCase().includes(q) ||
212
+ book.author.toLowerCase().includes(q)
213
+ );
214
+ }}
215
+ />
216
+ )}
217
+ </FormField>
218
+ </div>
219
+ ),
220
+ };
@@ -30,6 +30,7 @@ interface SingleComboboxBaseProps {
30
30
  placeholder?: string;
31
31
  emptyText?: string;
32
32
  disabled?: boolean;
33
+ filter?: ((item: unknown, query: string) => boolean) | null;
33
34
  }
34
35
 
35
36
  interface SingleComboboxDataBaseProps<T extends DataWithId>
@@ -86,6 +87,7 @@ export function SingleCombobox<T extends DataWithId>(
86
87
  id,
87
88
  placeholder = "Search...",
88
89
  emptyText = "No results found.",
90
+ filter,
89
91
  } = props;
90
92
 
91
93
  const isChildrenMode = "children" in props && props.children != null;
@@ -177,6 +179,7 @@ export function SingleCombobox<T extends DataWithId>(
177
179
  }
178
180
  virtualized={isVirtualized}
179
181
  disabled={props.disabled}
182
+ filter={filter}
180
183
  open={open}
181
184
  onOpenChange={setOpen}
182
185
  onItemHighlighted={
@@ -303,3 +303,31 @@ export const LoadingWithToggle: Story = {
303
303
  );
304
304
  },
305
305
  };
306
+
307
+ export const CustomSearch: Story = {
308
+ name: "Custom search (title + author)",
309
+ render: () => (
310
+ <div style={{ width: "300px" }}>
311
+ <FormField label="Pick a book">
312
+ {({ id }) => (
313
+ <SingleSearchableSelect
314
+ id={id}
315
+ data={books}
316
+ itemToString={itemToString}
317
+ renderItem={renderItem}
318
+ placeholder="Select a book"
319
+ searchPlaceholder="Search by title or author..."
320
+ filter={(item, query) => {
321
+ const book = item as (typeof books)[number];
322
+ const q = query.toLowerCase();
323
+ return (
324
+ book.title.toLowerCase().includes(q) ||
325
+ book.author.toLowerCase().includes(q)
326
+ );
327
+ }}
328
+ />
329
+ )}
330
+ </FormField>
331
+ </div>
332
+ ),
333
+ };
@@ -40,6 +40,7 @@ interface SingleSearchableSelectBaseProps {
40
40
  isLoading?: boolean;
41
41
  loadingText?: string;
42
42
  disabled?: boolean;
43
+ filter?: ((item: unknown, query: string) => boolean) | null;
43
44
  }
44
45
 
45
46
  interface SingleSearchableSelectDataBaseProps<T extends DataWithId>
@@ -103,6 +104,7 @@ export function SingleSearchableSelect<T extends DataWithId>(
103
104
  emptyText = "No results found.",
104
105
  isLoading = false,
105
106
  loadingText = "Loading...",
107
+ filter,
106
108
  } = props;
107
109
 
108
110
  const isChildrenMode = "children" in props && props.children != null;
@@ -210,6 +212,7 @@ export function SingleSearchableSelect<T extends DataWithId>(
210
212
  : groups ?? (isChildrenMode ? undefined : data)
211
213
  }
212
214
  virtualized={isVirtualized}
215
+ filter={filter}
213
216
  open={open}
214
217
  onOpenChange={setOpen}
215
218
  onItemHighlighted={