@sproutsocial/seeds-react-menu 1.11.1 → 1.11.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.
@@ -6,6 +6,18 @@ import styled4 from "styled-components";
6
6
  // src/v3/SeedsPortal.tsx
7
7
  import * as React from "react";
8
8
  import { DisablePortalToBodyContext } from "@sproutsocial/seeds-react-portal";
9
+ function useSeedsPortalContainer() {
10
+ const disablePortalToBody = React.useContext(DisablePortalToBodyContext);
11
+ const containerRef = React.useRef(null);
12
+ const [portalContainer, setPortalContainer] = React.useState(void 0);
13
+ React.useEffect(() => {
14
+ if (disablePortalToBody && containerRef.current) {
15
+ const dialogContent = containerRef.current.closest("[role='dialog']");
16
+ setPortalContainer(dialogContent ?? containerRef.current);
17
+ }
18
+ }, [disablePortalToBody]);
19
+ return { containerRef, portalContainer, disablePortalToBody };
20
+ }
9
21
 
10
22
  // src/v3/Common/SelectItem.tsx
11
23
  import "react";
@@ -51,6 +63,74 @@ var StyledItemIndicator = styled(Select.ItemIndicator)`
51
63
  }
52
64
  `;
53
65
  var StyledItemText = styled(Select.ItemText)``;
66
+ function CheckIcon() {
67
+ return /* @__PURE__ */ jsx(Icon, { name: "check-outline", fixedWidth: true, "aria-hidden": true });
68
+ }
69
+ function SelectItem({
70
+ value,
71
+ label,
72
+ disabled,
73
+ inputType = "icon",
74
+ renderItem,
75
+ hidden
76
+ }) {
77
+ return /* @__PURE__ */ jsxs(
78
+ StyledItem,
79
+ {
80
+ value,
81
+ disabled,
82
+ style: hidden ? { display: "none" } : void 0,
83
+ "data-qa-menu-item": label,
84
+ children: [
85
+ inputType === "radio" ? /* @__PURE__ */ jsx(
86
+ StyledItemIndicator,
87
+ {
88
+ keepMounted: true,
89
+ render: (_props, state) => /* @__PURE__ */ jsx(
90
+ Radio,
91
+ {
92
+ checked: state.selected,
93
+ onChange: () => {
94
+ },
95
+ tabIndex: -1,
96
+ id: `radio-${value}`,
97
+ name: "select-item"
98
+ }
99
+ )
100
+ }
101
+ ) : inputType === "checkbox" ? /* @__PURE__ */ jsx(
102
+ StyledItemIndicator,
103
+ {
104
+ keepMounted: true,
105
+ render: (_props, state) => /* @__PURE__ */ jsx(
106
+ Checkbox,
107
+ {
108
+ checked: state.selected,
109
+ onChange: () => {
110
+ },
111
+ tabIndex: -1,
112
+ id: `checkbox-${value}`,
113
+ name: "select-item"
114
+ }
115
+ )
116
+ }
117
+ ) : inputType === "icon" ? /* @__PURE__ */ jsx(StyledItemIndicator, { keepMounted: true, children: /* @__PURE__ */ jsx(CheckIcon, {}) }) : null,
118
+ /* @__PURE__ */ jsx(StyledItemText, { children: renderItem ? renderItem() : label })
119
+ ]
120
+ }
121
+ );
122
+ }
123
+
124
+ // src/v3/Common/groupItems.ts
125
+ function groupItems(data, groupBy) {
126
+ const map = /* @__PURE__ */ new Map();
127
+ for (const item of data) {
128
+ const key = groupBy(item);
129
+ if (!map.has(key)) map.set(key, []);
130
+ map.get(key).push(item);
131
+ }
132
+ return Array.from(map.entries()).map(([value, items]) => ({ value, items }));
133
+ }
54
134
 
55
135
  // src/v3/Common/SelectStyles.tsx
56
136
  import { Select as Select2 } from "@base-ui/react/select";
@@ -96,6 +176,11 @@ var SelectTrigger = styled2(Select2.Trigger)`
96
176
  &[data-popup-open] [data-chevron] {
97
177
  transform: rotate(-180deg);
98
178
  }
179
+
180
+ &[data-disabled] {
181
+ opacity: 0.4;
182
+ cursor: not-allowed;
183
+ }
99
184
  `;
100
185
  var SelectValue = styled2(Select2.Value)`
101
186
  min-width: 0;
@@ -180,7 +265,13 @@ var StyledChevron = styled3.div`
180
265
  transition: transform 0.15s;
181
266
  ${({ $isOpen }) => $isOpen && "transform: rotate(-180deg);"}
182
267
  `;
183
- function CheckIcon() {
268
+ function ChevronIcon() {
269
+ return /* @__PURE__ */ jsx2(Icon2, { name: "chevron-down-outline", fixedWidth: true, "aria-hidden": true });
270
+ }
271
+ function ClearIcon() {
272
+ return /* @__PURE__ */ jsx2(Icon2, { name: "circle-x-outline", fixedWidth: true, "aria-hidden": true, size: "mini" });
273
+ }
274
+ function CheckIcon2() {
184
275
  return /* @__PURE__ */ jsx2(Icon2, { name: "check-outline", fixedWidth: true, "aria-hidden": true });
185
276
  }
186
277
 
@@ -197,6 +288,115 @@ var StyledValue = styled4(Select3.Value)`
197
288
  color: ${({ theme }) => theme.colors.text.subtext};
198
289
  }
199
290
  `;
291
+ function SingleSelect(props) {
292
+ const { id, placeholder, includePlaceholderItem } = props;
293
+ const isChildrenMode = "children" in props && props.children != null;
294
+ const selectedItemId = props.selectedItemId;
295
+ const defaultSelectedItemId = props.defaultSelectedItemId;
296
+ const onSelectedItemIdChange = props.onSelectedItemIdChange;
297
+ const data = isChildrenMode ? [] : props.data;
298
+ const itemToString = isChildrenMode ? () => "" : props.itemToString;
299
+ const renderItem = isChildrenMode ? void 0 : props.renderItem;
300
+ const inputType = isChildrenMode ? "icon" : props.inputType ?? "icon";
301
+ const renderSelection = isChildrenMode ? void 0 : props.renderSelection;
302
+ const groupBy = isChildrenMode ? void 0 : props.groupBy;
303
+ const renderGroupHeading = isChildrenMode ? void 0 : props.renderGroupHeading;
304
+ const children = isChildrenMode ? props.children : void 0;
305
+ const { containerRef, portalContainer } = useSeedsPortalContainer();
306
+ const items = React4.useMemo(() => {
307
+ const dataItems = data.map((item) => ({
308
+ value: String(item.id),
309
+ label: itemToString(item)
310
+ }));
311
+ if (includePlaceholderItem) {
312
+ return [{ value: null, label: placeholder ?? "" }, ...dataItems];
313
+ }
314
+ return dataItems;
315
+ }, [data, itemToString, includePlaceholderItem, placeholder]);
316
+ const dataWithPlaceholder = includePlaceholderItem ? [{ id: null, value: null, label: placeholder ?? "" }, ...data] : data;
317
+ const isControlled = selectedItemId !== void 0;
318
+ const [internalValue, setInternalValue] = React4.useState(
319
+ defaultSelectedItemId != null ? String(defaultSelectedItemId) : null
320
+ );
321
+ const value = isControlled ? selectedItemId != null ? String(selectedItemId) : null : internalValue;
322
+ const selectedItem = React4.useMemo(
323
+ () => value != null ? data.find((d) => String(d.id) === value) ?? null : null,
324
+ [data, value]
325
+ );
326
+ function handleValueChange(newValue) {
327
+ if (!isControlled) {
328
+ setInternalValue(newValue);
329
+ }
330
+ if (onSelectedItemIdChange) {
331
+ if (newValue == null) {
332
+ onSelectedItemIdChange(null);
333
+ } else {
334
+ const item = data.find((d) => String(d.id) === newValue);
335
+ onSelectedItemIdChange(item ? item.id : null);
336
+ }
337
+ }
338
+ }
339
+ return /* @__PURE__ */ jsxs2(Field, { children: [
340
+ /* @__PURE__ */ jsx3("div", { ref: containerRef, style: { position: "relative" } }),
341
+ /* @__PURE__ */ jsxs2(
342
+ Select3.Root,
343
+ {
344
+ items,
345
+ value,
346
+ disabled: props.disabled,
347
+ onValueChange: handleValueChange,
348
+ id,
349
+ children: [
350
+ /* @__PURE__ */ jsxs2(SelectTrigger, { children: [
351
+ /* @__PURE__ */ jsx3(StyledValue, { placeholder, children: renderSelection && selectedItem ? renderSelection(selectedItem) : void 0 }),
352
+ /* @__PURE__ */ jsx3(SelectIcon, { children: /* @__PURE__ */ jsx3(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx3(ChevronIcon, {}) }) })
353
+ ] }),
354
+ /* @__PURE__ */ jsx3(Select3.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx3(SelectPositioner, { sideOffset: 8, alignItemWithTrigger: false, children: /* @__PURE__ */ jsxs2(SelectPopup, { children: [
355
+ /* @__PURE__ */ jsx3(Select3.ScrollUpArrow, {}),
356
+ /* @__PURE__ */ jsx3(Select3.List, { children: children ? children : groupBy ? groupItems(data, groupBy).map((group, index, arr) => /* @__PURE__ */ jsxs2(React4.Fragment, { children: [
357
+ /* @__PURE__ */ jsxs2(SelectGroup, { children: [
358
+ /* @__PURE__ */ jsx3(SelectGroupLabel, { children: renderGroupHeading ? renderGroupHeading(group.value) : group.value }),
359
+ group.items.map((item) => /* @__PURE__ */ jsx3(
360
+ SelectItem,
361
+ {
362
+ value: String(item.id),
363
+ label: itemToString(item),
364
+ disabled: item.disabled,
365
+ inputType,
366
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
367
+ },
368
+ item.id
369
+ ))
370
+ ] }),
371
+ index < arr.length - 1 && /* @__PURE__ */ jsx3(SelectSeparator, {})
372
+ ] }, group.value)) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
373
+ includePlaceholderItem && /* @__PURE__ */ jsx3(
374
+ SelectItem,
375
+ {
376
+ value: null,
377
+ label: placeholder ?? ""
378
+ },
379
+ "placeholder"
380
+ ),
381
+ data.map((item) => /* @__PURE__ */ jsx3(
382
+ SelectItem,
383
+ {
384
+ value: String(item.id),
385
+ label: itemToString(item),
386
+ disabled: item.disabled,
387
+ inputType,
388
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
389
+ },
390
+ item.id
391
+ ))
392
+ ] }) }),
393
+ /* @__PURE__ */ jsx3(Select3.ScrollDownArrow, {})
394
+ ] }) }) })
395
+ ]
396
+ }
397
+ )
398
+ ] });
399
+ }
200
400
 
201
401
  // src/v3/MultiSelect.tsx
202
402
  import * as React5 from "react";
@@ -217,6 +417,119 @@ var Placeholder = styled5.div`
217
417
  padding-bottom: 2px;
218
418
  margin: 2px 8px 0px 0px;
219
419
  `;
420
+ function MultiSelect(props) {
421
+ const { id, placeholder = "Select..." } = props;
422
+ const isChildrenMode = "children" in props && props.children != null;
423
+ const data = isChildrenMode ? [] : props.data;
424
+ const itemToString = isChildrenMode ? () => "" : props.itemToString;
425
+ const renderItem = isChildrenMode ? void 0 : props.renderItem;
426
+ const customRenderSelections = isChildrenMode ? void 0 : props.customRenderSelections;
427
+ const maxSelections = isChildrenMode ? void 0 : props.maxSelections;
428
+ const renderSelection = isChildrenMode ? void 0 : props.renderSelection;
429
+ const removeSelectedItems = isChildrenMode ? false : props.removeSelectedItems ?? false;
430
+ const inputType = isChildrenMode ? "checkbox" : removeSelectedItems ? "none" : props.inputType ?? "checkbox";
431
+ const selectedItemIds = props.selectedItemIds;
432
+ const defaultSelectedItemIds = props.defaultSelectedItemIds;
433
+ const onSelectedItemIdsChange = props.onSelectedItemIdsChange;
434
+ const groupBy = isChildrenMode ? void 0 : props.groupBy;
435
+ const renderGroupHeading = isChildrenMode ? void 0 : props.renderGroupHeading;
436
+ const children = isChildrenMode ? props.children : void 0;
437
+ const { containerRef, portalContainer } = useSeedsPortalContainer();
438
+ const isControlled = selectedItemIds !== void 0;
439
+ const [internalValue, setInternalValue] = React5.useState(
440
+ () => defaultSelectedItemIds?.map(String) ?? []
441
+ );
442
+ const value = isControlled ? selectedItemIds.map(String) : internalValue;
443
+ const items = React5.useMemo(
444
+ () => data.map((item) => ({
445
+ value: String(item.id),
446
+ label: itemToString(item)
447
+ })),
448
+ [data, itemToString]
449
+ );
450
+ const selectedItems = React5.useMemo(
451
+ () => value.map((v) => data.find((d) => String(d.id) === v)).filter((d) => d != null),
452
+ [data, value]
453
+ );
454
+ function handleValueChange(newValues) {
455
+ if (!isControlled) {
456
+ setInternalValue(newValues);
457
+ }
458
+ if (onSelectedItemIdsChange) {
459
+ const ids = newValues.map((v) => {
460
+ const item = data.find((d) => String(d.id) === v);
461
+ return item ? item.id : v;
462
+ });
463
+ onSelectedItemIdsChange(ids);
464
+ }
465
+ }
466
+ return /* @__PURE__ */ jsxs3(Field, { children: [
467
+ /* @__PURE__ */ jsx4("div", { ref: containerRef, style: { position: "relative" } }),
468
+ /* @__PURE__ */ jsxs3(
469
+ Select4.Root,
470
+ {
471
+ multiple: true,
472
+ items,
473
+ value,
474
+ onValueChange: handleValueChange,
475
+ disabled: props.disabled,
476
+ id,
477
+ children: [
478
+ /* @__PURE__ */ jsxs3(SelectTrigger, { children: [
479
+ /* @__PURE__ */ jsx4(SelectValue, { children: () => {
480
+ if (renderSelection) return renderSelection(selectedItems);
481
+ if (selectedItems.length === 0)
482
+ return /* @__PURE__ */ jsx4(Placeholder, { children: placeholder });
483
+ const visibleItems = maxSelections != null ? selectedItems.slice(0, maxSelections) : selectedItems;
484
+ const overflowCount = maxSelections != null && selectedItems.length > maxSelections ? selectedItems.length - maxSelections : 0;
485
+ const text = visibleItems.map(
486
+ (item) => customRenderSelections ? customRenderSelections(item) : itemToString(item)
487
+ ).join(", ");
488
+ return /* @__PURE__ */ jsxs3(SelectionText, { children: [
489
+ text,
490
+ overflowCount > 0 ? `, +${overflowCount}` : ""
491
+ ] });
492
+ } }),
493
+ /* @__PURE__ */ jsx4(SelectIcon, { children: /* @__PURE__ */ jsx4(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx4(ChevronIcon, {}) }) })
494
+ ] }),
495
+ /* @__PURE__ */ jsx4(Select4.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx4(SelectPositioner, { sideOffset: 8, alignItemWithTrigger: false, children: /* @__PURE__ */ jsxs3(SelectPopup, { children: [
496
+ /* @__PURE__ */ jsx4(Select4.ScrollUpArrow, {}),
497
+ /* @__PURE__ */ jsx4(Select4.List, { children: children ? children : groupBy ? groupItems(data, groupBy).map((group, index, arr) => /* @__PURE__ */ jsxs3(React5.Fragment, { children: [
498
+ /* @__PURE__ */ jsxs3(SelectGroup, { children: [
499
+ /* @__PURE__ */ jsx4(SelectGroupLabel, { children: renderGroupHeading ? renderGroupHeading(group.value) : group.value }),
500
+ group.items.map((item) => /* @__PURE__ */ jsx4(
501
+ SelectItem,
502
+ {
503
+ value: String(item.id),
504
+ label: itemToString(item),
505
+ disabled: item.disabled,
506
+ inputType,
507
+ hidden: removeSelectedItems && value.includes(String(item.id)),
508
+ renderItem: renderItem ? () => renderItem(item) : void 0
509
+ },
510
+ item.id
511
+ ))
512
+ ] }),
513
+ index < arr.length - 1 && /* @__PURE__ */ jsx4(SelectSeparator, {})
514
+ ] }, group.value)) : data.map((item) => /* @__PURE__ */ jsx4(
515
+ SelectItem,
516
+ {
517
+ value: String(item.id),
518
+ label: itemToString(item),
519
+ disabled: item.disabled,
520
+ inputType,
521
+ hidden: removeSelectedItems && value.includes(String(item.id)),
522
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
523
+ },
524
+ item.id
525
+ )) }),
526
+ /* @__PURE__ */ jsx4(Select4.ScrollDownArrow, {})
527
+ ] }) }) })
528
+ ]
529
+ }
530
+ )
531
+ ] });
532
+ }
220
533
 
221
534
  // src/v3/SingleCombobox.tsx
222
535
  import * as React8 from "react";
@@ -255,6 +568,11 @@ var ComboboxInputGroup = styled6(Combobox.InputGroup)`
255
568
  &:focus-within {
256
569
  ${focusRing2}
257
570
  }
571
+
572
+ &[data-disabled] {
573
+ opacity: 0.4;
574
+ cursor: not-allowed;
575
+ }
258
576
  `;
259
577
  var ComboboxInput = styled6(Combobox.Input)`
260
578
  flex: 1;
@@ -270,6 +588,10 @@ var ComboboxInput = styled6(Combobox.Input)`
270
588
  &::placeholder {
271
589
  color: ${({ theme }) => theme.colors.text.subtext};
272
590
  }
591
+
592
+ &:disabled {
593
+ cursor: not-allowed;
594
+ }
273
595
  `;
274
596
  var ComboboxTokenInput = styled6(Combobox.Input)`
275
597
  flex: 1;
@@ -286,6 +608,10 @@ var ComboboxTokenInput = styled6(Combobox.Input)`
286
608
  &::placeholder {
287
609
  color: ${({ theme }) => theme.colors.text.subtext};
288
610
  }
611
+
612
+ &:disabled {
613
+ cursor: not-allowed;
614
+ }
289
615
  `;
290
616
  var ComboboxActionButtons = styled6.div`
291
617
  display: flex;
@@ -529,6 +855,11 @@ var ComboboxTokenInputGroup = styled6(Combobox.InputGroup)`
529
855
  &:focus-within {
530
856
  ${focusRing2}
531
857
  }
858
+
859
+ &[data-disabled] {
860
+ opacity: 0.4;
861
+ cursor: not-allowed;
862
+ }
532
863
  `;
533
864
  var Token = styled6.span`
534
865
  display: inline-flex;
@@ -589,6 +920,11 @@ var SearchableSelectTrigger = styled6(Combobox.Trigger)`
589
920
  &[data-popup-open] [data-chevron] {
590
921
  transform: rotate(-180deg);
591
922
  }
923
+
924
+ &[data-disabled] {
925
+ opacity: 0.4;
926
+ cursor: not-allowed;
927
+ }
592
928
  `;
593
929
  var SearchableSelectTriggerIcon = styled6(Combobox.Icon)`
594
930
  display: flex;
@@ -666,6 +1002,11 @@ var SearchableSelectTokenTrigger = styled6(Combobox.Trigger)`
666
1002
  &[data-popup-open] [data-chevron] {
667
1003
  transform: rotate(-180deg);
668
1004
  }
1005
+
1006
+ &[data-disabled] {
1007
+ opacity: 0.4;
1008
+ cursor: not-allowed;
1009
+ }
669
1010
  `;
670
1011
 
671
1012
  // src/v3/Common/ComboboxItem.tsx
@@ -674,6 +1015,7 @@ function ComboboxItemInner({
674
1015
  value,
675
1016
  itemId,
676
1017
  label,
1018
+ disabled,
677
1019
  inputType = "icon",
678
1020
  renderItem,
679
1021
  index,
@@ -688,6 +1030,8 @@ function ComboboxItemInner({
688
1030
  "data-index": dataIndex,
689
1031
  style,
690
1032
  ref,
1033
+ disabled,
1034
+ "data-qa-menu-item": label,
691
1035
  children: [
692
1036
  inputType === "radio" ? /* @__PURE__ */ jsx6(
693
1037
  ComboboxItemIndicator,
@@ -721,22 +1065,312 @@ function ComboboxItemInner({
721
1065
  }
722
1066
  )
723
1067
  }
724
- ) : inputType === "icon" ? /* @__PURE__ */ jsx6(ComboboxItemIndicator, { keepMounted: true, children: /* @__PURE__ */ jsx6(CheckIcon, {}) }) : null,
1068
+ ) : inputType === "icon" ? /* @__PURE__ */ jsx6(ComboboxItemIndicator, { keepMounted: true, children: /* @__PURE__ */ jsx6(CheckIcon2, {}) }) : null,
725
1069
  /* @__PURE__ */ jsx6("span", { children: renderItem ? renderItem() : label })
726
1070
  ]
727
1071
  }
728
1072
  );
729
1073
  }
730
1074
  var ComboboxItem2 = React6.forwardRef(ComboboxItemInner);
1075
+ var ComboboxItem_default = ComboboxItem2;
731
1076
 
732
1077
  // src/v3/Common/VirtualizedComboboxList.tsx
733
1078
  import * as React7 from "react";
734
1079
  import { Combobox as Combobox2 } from "@base-ui/react/combobox";
735
1080
  import { useVirtualizer } from "@tanstack/react-virtual";
736
1081
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1082
+ var ITEM_HEIGHT = 32;
1083
+ function isGroupHeaderSentinel(v) {
1084
+ return typeof v === "object" && v !== null && "__groupHeader" in v;
1085
+ }
1086
+ function isSelectAllSentinel(v) {
1087
+ return typeof v === "object" && v !== null && "__selectAll" in v;
1088
+ }
1089
+ function VirtualizedComboboxList({
1090
+ open,
1091
+ virtualizerRef,
1092
+ value,
1093
+ groups,
1094
+ data,
1095
+ itemToString,
1096
+ inputType,
1097
+ renderItem,
1098
+ renderGroupHeading
1099
+ }) {
1100
+ const filteredItems = Combobox2.useFilteredItems();
1101
+ const scrollElementRef = React7.useRef(null);
1102
+ const virtualizer = useVirtualizer({
1103
+ enabled: open,
1104
+ count: filteredItems.length,
1105
+ getScrollElement: () => scrollElementRef.current,
1106
+ estimateSize: () => ITEM_HEIGHT,
1107
+ overscan: 20,
1108
+ paddingStart: 4,
1109
+ paddingEnd: 4,
1110
+ scrollPaddingStart: 4,
1111
+ scrollPaddingEnd: 4
1112
+ });
1113
+ React7.useImperativeHandle(virtualizerRef, () => virtualizer);
1114
+ const handleScrollRef = React7.useCallback(
1115
+ (el) => {
1116
+ scrollElementRef.current = el;
1117
+ if (el) virtualizer.measure();
1118
+ },
1119
+ [virtualizer]
1120
+ );
1121
+ if (!filteredItems.length) return null;
1122
+ const selectedArray = Array.isArray(value) ? value : value != null ? [value] : [];
1123
+ const totalSize = virtualizer.getTotalSize();
1124
+ return /* @__PURE__ */ jsx7(
1125
+ "div",
1126
+ {
1127
+ role: "presentation",
1128
+ ref: handleScrollRef,
1129
+ style: {
1130
+ flex: 1,
1131
+ minHeight: 0,
1132
+ overflowY: "auto",
1133
+ overscrollBehavior: "contain"
1134
+ },
1135
+ children: /* @__PURE__ */ jsx7(
1136
+ "div",
1137
+ {
1138
+ role: "presentation",
1139
+ style: { position: "relative", width: "100%", height: totalSize },
1140
+ children: virtualizer.getVirtualItems().map((virtualItem) => {
1141
+ const row = filteredItems[virtualItem.index];
1142
+ if (!row) return null;
1143
+ const baseStyle = {
1144
+ position: "absolute",
1145
+ top: 0,
1146
+ left: 0,
1147
+ width: "100%",
1148
+ transform: `translateY(${virtualItem.start}px)`,
1149
+ boxSizing: "border-box"
1150
+ };
1151
+ if (isSelectAllSentinel(row)) {
1152
+ const selectedCount = selectedArray.length;
1153
+ const totalCount = data.length;
1154
+ const state = selectedCount === 0 ? "none" : selectedCount === totalCount ? "all" : "partial";
1155
+ return /* @__PURE__ */ jsxs5(
1156
+ ComboboxSelectAllItem,
1157
+ {
1158
+ index: virtualItem.index,
1159
+ "data-index": virtualItem.index,
1160
+ value: row,
1161
+ style: baseStyle,
1162
+ ref: virtualizer.measureElement,
1163
+ children: [
1164
+ /* @__PURE__ */ jsx7(ComboboxGroupHeaderCheckbox, { $state: state, id: "__selectAll" }),
1165
+ "Select all"
1166
+ ]
1167
+ },
1168
+ virtualItem.key
1169
+ );
1170
+ }
1171
+ if (isGroupHeaderSentinel(row)) {
1172
+ const group = groups?.find((g) => g.value === row.groupName);
1173
+ const groupItems2 = group?.items ?? [];
1174
+ const selectedCount = groupItems2.filter(
1175
+ (item2) => selectedArray.some((s) => s.id === item2.id)
1176
+ ).length;
1177
+ const state = selectedCount === 0 ? "none" : selectedCount === groupItems2.length ? "all" : "partial";
1178
+ return /* @__PURE__ */ jsxs5(
1179
+ ComboboxGroupHeaderItem,
1180
+ {
1181
+ index: virtualItem.index,
1182
+ "data-index": virtualItem.index,
1183
+ value: row,
1184
+ style: baseStyle,
1185
+ ref: virtualizer.measureElement,
1186
+ children: [
1187
+ /* @__PURE__ */ jsx7(
1188
+ ComboboxGroupHeaderCheckbox,
1189
+ {
1190
+ $state: state,
1191
+ id: `__header-${row.groupName}`
1192
+ }
1193
+ ),
1194
+ renderGroupHeading ? renderGroupHeading(row.groupName) : row.groupName
1195
+ ]
1196
+ },
1197
+ virtualItem.key
1198
+ );
1199
+ }
1200
+ const item = row;
1201
+ return /* @__PURE__ */ jsx7(
1202
+ ComboboxItem_default,
1203
+ {
1204
+ index: virtualItem.index,
1205
+ "data-index": virtualItem.index,
1206
+ value: item,
1207
+ itemId: String(item.id),
1208
+ label: itemToString(item),
1209
+ inputType,
1210
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item),
1211
+ style: baseStyle,
1212
+ ref: virtualizer.measureElement
1213
+ },
1214
+ virtualItem.key
1215
+ );
1216
+ })
1217
+ }
1218
+ )
1219
+ }
1220
+ );
1221
+ }
737
1222
 
738
1223
  // src/v3/SingleCombobox.tsx
739
1224
  import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1225
+ function SingleCombobox(props) {
1226
+ const {
1227
+ id,
1228
+ placeholder = "Search...",
1229
+ emptyText = "No results found."
1230
+ } = props;
1231
+ const isChildrenMode = "children" in props && props.children != null;
1232
+ const data = isChildrenMode ? [] : props.data;
1233
+ const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
1234
+ const renderItem = isChildrenMode ? void 0 : props.renderItem;
1235
+ const inputType = isChildrenMode ? "icon" : props.inputType ?? "icon";
1236
+ const isVirtualized = isChildrenMode ? false : props.isVirtualized ?? false;
1237
+ const groupBy = isChildrenMode ? void 0 : isVirtualized ? void 0 : props.groupBy;
1238
+ const renderGroupHeading = isChildrenMode ? void 0 : isVirtualized ? void 0 : props.renderGroupHeading;
1239
+ const children = isChildrenMode ? props.children : void 0;
1240
+ const selectedItemId = props.selectedItemId;
1241
+ const defaultSelectedItemId = props.defaultSelectedItemId;
1242
+ const onSelectedItemIdChange = props.onSelectedItemIdChange;
1243
+ const { containerRef, portalContainer } = useSeedsPortalContainer();
1244
+ const [open, setOpen] = React8.useState(false);
1245
+ const virtualizerRef = React8.useRef(null);
1246
+ const isControlled = selectedItemId !== void 0;
1247
+ const idToItem = React8.useCallback(
1248
+ (id2) => {
1249
+ if (id2 == null) return null;
1250
+ return data.find((d) => String(d.id) === String(id2)) ?? null;
1251
+ },
1252
+ [data]
1253
+ );
1254
+ const [internalValue, setInternalValue] = React8.useState(
1255
+ () => idToItem(defaultSelectedItemId)
1256
+ );
1257
+ const value = isControlled ? idToItem(selectedItemId) : internalValue;
1258
+ function handleValueChange(newItem) {
1259
+ if (!isControlled) {
1260
+ setInternalValue(newItem);
1261
+ }
1262
+ if (onSelectedItemIdChange) {
1263
+ onSelectedItemIdChange(newItem ? newItem.id : null);
1264
+ }
1265
+ }
1266
+ const groups = React8.useMemo(
1267
+ () => groupBy ? groupItems(data, groupBy) : null,
1268
+ [data, groupBy]
1269
+ );
1270
+ return /* @__PURE__ */ jsxs6(Field, { children: [
1271
+ /* @__PURE__ */ jsx8("div", { ref: containerRef, style: { position: "relative" } }),
1272
+ /* @__PURE__ */ jsxs6(
1273
+ Combobox3.Root,
1274
+ {
1275
+ id,
1276
+ value,
1277
+ onValueChange: handleValueChange,
1278
+ itemToStringLabel: itemToString,
1279
+ isItemEqualToValue: (a, b) => a != null && b != null && a.id === b.id,
1280
+ items: isVirtualized ? data : groups ?? (isChildrenMode ? void 0 : data),
1281
+ virtualized: isVirtualized,
1282
+ disabled: props.disabled,
1283
+ open,
1284
+ onOpenChange: setOpen,
1285
+ onItemHighlighted: isVirtualized ? (item, { reason, index }) => {
1286
+ const virt = virtualizerRef.current;
1287
+ if (!item || !virt) return;
1288
+ const isStart = index === 0;
1289
+ const isEnd = index === virt.options.count - 1;
1290
+ if (reason === "none" || reason === "keyboard" && (isStart || isEnd)) {
1291
+ queueMicrotask(() => {
1292
+ virt.scrollToIndex(index, {
1293
+ align: isEnd ? "start" : "end"
1294
+ });
1295
+ });
1296
+ }
1297
+ } : void 0,
1298
+ children: [
1299
+ /* @__PURE__ */ jsxs6(ComboboxInputGroup, { children: [
1300
+ /* @__PURE__ */ jsx8(ComboboxInput, { placeholder, id }),
1301
+ /* @__PURE__ */ jsxs6(ComboboxActionButtons, { children: [
1302
+ /* @__PURE__ */ jsx8(ComboboxClear, { "aria-label": "Clear selection", children: /* @__PURE__ */ jsx8(ClearIcon, {}) }),
1303
+ /* @__PURE__ */ jsx8(ComboboxTrigger, { "aria-label": "Open popup", children: /* @__PURE__ */ jsx8(StyledChevron, { $isOpen: open, children: /* @__PURE__ */ jsx8(ChevronIcon, {}) }) })
1304
+ ] })
1305
+ ] }),
1306
+ /* @__PURE__ */ jsx8(Combobox3.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx8(ComboboxPositioner, { sideOffset: 4, children: /* @__PURE__ */ jsxs6(
1307
+ ComboboxPopup,
1308
+ {
1309
+ style: isVirtualized ? { display: "flex", flexDirection: "column" } : void 0,
1310
+ children: [
1311
+ /* @__PURE__ */ jsx8(ComboboxEmpty, { children: emptyText }),
1312
+ /* @__PURE__ */ jsx8(
1313
+ ComboboxList,
1314
+ {
1315
+ style: isVirtualized ? {
1316
+ padding: 0,
1317
+ flex: 1,
1318
+ minHeight: 0,
1319
+ display: "flex",
1320
+ flexDirection: "column"
1321
+ } : void 0,
1322
+ children: isVirtualized ? /* @__PURE__ */ jsx8(
1323
+ VirtualizedComboboxList,
1324
+ {
1325
+ open,
1326
+ virtualizerRef,
1327
+ value,
1328
+ groups,
1329
+ data,
1330
+ itemToString,
1331
+ inputType,
1332
+ renderItem,
1333
+ renderGroupHeading
1334
+ }
1335
+ ) : children ? children : groups ? (group, index) => /* @__PURE__ */ jsxs6(React8.Fragment, { children: [
1336
+ /* @__PURE__ */ jsxs6(ComboboxGroup, { items: group.items, children: [
1337
+ /* @__PURE__ */ jsx8(ComboboxGroupLabel, { children: renderGroupHeading ? renderGroupHeading(group.value) : group.value }),
1338
+ /* @__PURE__ */ jsx8(Combobox3.Collection, { children: (item) => /* @__PURE__ */ jsx8(
1339
+ ComboboxItem_default,
1340
+ {
1341
+ value: item,
1342
+ itemId: String(item.id),
1343
+ label: itemToString(item),
1344
+ disabled: item.disabled,
1345
+ inputType,
1346
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1347
+ },
1348
+ item.id
1349
+ ) })
1350
+ ] }),
1351
+ index < groups.length - 1 && /* @__PURE__ */ jsx8(ComboboxSeparator, {})
1352
+ ] }, group.value) : (item) => /* @__PURE__ */ jsx8(
1353
+ ComboboxItem_default,
1354
+ {
1355
+ value: item,
1356
+ itemId: String(item.id),
1357
+ label: itemToString(item),
1358
+ disabled: item.disabled,
1359
+ inputType,
1360
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1361
+ },
1362
+ item.id
1363
+ )
1364
+ }
1365
+ )
1366
+ ]
1367
+ }
1368
+ ) }) })
1369
+ ]
1370
+ }
1371
+ )
1372
+ ] });
1373
+ }
740
1374
 
741
1375
  // src/v3/MultiCombobox.tsx
742
1376
  import * as React9 from "react";
@@ -744,12 +1378,490 @@ import { Combobox as Combobox4 } from "@base-ui/react/combobox";
744
1378
  import "@tanstack/react-virtual";
745
1379
  import Icon3 from "@sproutsocial/seeds-react-icon";
746
1380
  import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1381
+ function makeGroupHeaderSentinel(groupName) {
1382
+ return { __groupHeader: true, groupName };
1383
+ }
1384
+ function isGroupHeaderSentinel2(v) {
1385
+ return typeof v === "object" && v !== null && "__groupHeader" in v;
1386
+ }
1387
+ var SELECT_ALL_SENTINEL = { __selectAll: true };
1388
+ function isSelectAllSentinel2(v) {
1389
+ return typeof v === "object" && v !== null && "__selectAll" in v;
1390
+ }
1391
+ function MultiCombobox(props) {
1392
+ const {
1393
+ id,
1394
+ placeholder = "Search...",
1395
+ emptyText = "No results found.",
1396
+ isLoading = false,
1397
+ loadingText = "Loading..."
1398
+ } = props;
1399
+ const isChildrenMode = "children" in props && props.children != null;
1400
+ const data = isChildrenMode ? [] : props.data;
1401
+ const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
1402
+ const renderItem = isChildrenMode ? void 0 : props.renderItem;
1403
+ const renderToken = isChildrenMode ? void 0 : props.renderToken;
1404
+ const renderSelection = isChildrenMode ? void 0 : props.renderSelection;
1405
+ const maxTokens = isChildrenMode ? void 0 : props.maxTokens;
1406
+ const removeSelectedItems = isChildrenMode ? false : props.removeSelectedItems ?? false;
1407
+ const inputType = isChildrenMode ? "checkbox" : removeSelectedItems ? "none" : props.inputType ?? "checkbox";
1408
+ const groupBy = isChildrenMode ? void 0 : props.groupBy;
1409
+ const renderGroupHeading = isChildrenMode ? void 0 : props.renderGroupHeading;
1410
+ const selectHeadings = isChildrenMode ? false : props.selectHeadings ?? false;
1411
+ const selectAll = isChildrenMode ? false : props.selectAll ?? false;
1412
+ const isVirtualized = isChildrenMode ? false : props.isVirtualized ?? false;
1413
+ const children = isChildrenMode ? props.children : void 0;
1414
+ const selectedItemIds = props.selectedItemIds;
1415
+ const defaultSelectedItemIds = props.defaultSelectedItemIds;
1416
+ const onSelectedItemIdsChange = props.onSelectedItemIdsChange;
1417
+ const { containerRef, portalContainer } = useSeedsPortalContainer();
1418
+ const [open, setOpen] = React9.useState(false);
1419
+ const virtualizerRef = React9.useRef(null);
1420
+ const isControlled = selectedItemIds !== void 0;
1421
+ const idsToItems = React9.useCallback(
1422
+ (ids) => ids.map((id2) => data.find((d) => d.id === id2)).filter((d) => d != null),
1423
+ [data]
1424
+ );
1425
+ const [internalValue, setInternalValue] = React9.useState(
1426
+ () => defaultSelectedItemIds ? idsToItems(defaultSelectedItemIds) : []
1427
+ );
1428
+ const value = isControlled ? idsToItems(selectedItemIds) : internalValue;
1429
+ const visibleData = React9.useMemo(
1430
+ () => removeSelectedItems ? data.filter((item) => !value.some((v) => v.id === item.id)) : data,
1431
+ [data, value, removeSelectedItems]
1432
+ );
1433
+ const groups = React9.useMemo(
1434
+ () => groupBy ? groupItems(visibleData, groupBy) : null,
1435
+ [visibleData, groupBy]
1436
+ );
1437
+ const flatItems = React9.useMemo(() => {
1438
+ if (!groups || !selectHeadings && !selectAll) return null;
1439
+ const rows = [];
1440
+ if (selectAll) rows.push(SELECT_ALL_SENTINEL);
1441
+ for (const group of groups) {
1442
+ rows.push(makeGroupHeaderSentinel(group.value));
1443
+ rows.push(...group.items);
1444
+ }
1445
+ return rows;
1446
+ }, [groups, selectHeadings, selectAll]);
1447
+ function setSelectedItems(items) {
1448
+ if (!isControlled) setInternalValue(items);
1449
+ if (onSelectedItemIdsChange)
1450
+ onSelectedItemIdsChange(items.map((item) => item.id));
1451
+ }
1452
+ function handleValueChange(next) {
1453
+ const selectAllClicked = next.filter(isSelectAllSentinel2);
1454
+ const groupSentinels = next.filter(isGroupHeaderSentinel2);
1455
+ const realItems = next.filter(
1456
+ (v) => !isGroupHeaderSentinel2(v) && !isSelectAllSentinel2(v)
1457
+ );
1458
+ if (selectAllClicked.length > 0) {
1459
+ const allSelected = data.every(
1460
+ (d) => realItems.some((s) => s.id === d.id)
1461
+ );
1462
+ setSelectedItems(allSelected ? [] : [...data]);
1463
+ return;
1464
+ }
1465
+ if (groupSentinels.length === 0) {
1466
+ setSelectedItems(realItems);
1467
+ return;
1468
+ }
1469
+ let updated = [...realItems];
1470
+ for (const sentinel of groupSentinels) {
1471
+ const group = groups?.find((g) => g.value === sentinel.groupName);
1472
+ if (!group) continue;
1473
+ const allSelected = group.items.every(
1474
+ (item) => updated.some((s) => s.id === item.id)
1475
+ );
1476
+ if (allSelected) {
1477
+ updated = updated.filter(
1478
+ (s) => !group.items.some((item) => item.id === s.id)
1479
+ );
1480
+ } else {
1481
+ const missing = group.items.filter(
1482
+ (item) => !updated.some((s) => s.id === item.id)
1483
+ );
1484
+ updated = [...updated, ...missing];
1485
+ }
1486
+ }
1487
+ setSelectedItems(updated);
1488
+ }
1489
+ function handleSimpleValueChange(newItems) {
1490
+ setSelectedItems(newItems);
1491
+ }
1492
+ function removeItem(item, e) {
1493
+ e.preventDefault();
1494
+ e.stopPropagation();
1495
+ setSelectedItems(value.filter((v) => v.id !== item.id));
1496
+ }
1497
+ function renderSentinelRow(row) {
1498
+ if (isSelectAllSentinel2(row)) {
1499
+ const totalCount = data.length;
1500
+ const selectedCount = value.length;
1501
+ const state = selectedCount === 0 ? "none" : selectedCount === totalCount ? "all" : "partial";
1502
+ return /* @__PURE__ */ jsxs7(ComboboxSelectAllItem, { value: row, children: [
1503
+ /* @__PURE__ */ jsx9(ComboboxGroupHeaderCheckbox, { $state: state, id: "__selectAll" }),
1504
+ "Select all"
1505
+ ] }, "__selectAll");
1506
+ }
1507
+ if (isGroupHeaderSentinel2(row)) {
1508
+ const group = groups?.find((g) => g.value === row.groupName);
1509
+ const groupItemsList = group?.items ?? [];
1510
+ const selectedCount = groupItemsList.filter(
1511
+ (item2) => value.some((s) => s.id === item2.id)
1512
+ ).length;
1513
+ const state = selectedCount === 0 ? "none" : selectedCount === groupItemsList.length ? "all" : "partial";
1514
+ return /* @__PURE__ */ jsxs7(ComboboxGroupHeaderItem, { value: row, children: [
1515
+ /* @__PURE__ */ jsx9(
1516
+ ComboboxGroupHeaderCheckbox,
1517
+ {
1518
+ $state: state,
1519
+ id: `__header-${row.groupName}`
1520
+ }
1521
+ ),
1522
+ renderGroupHeading ? renderGroupHeading(row.groupName) : row.groupName
1523
+ ] }, `__header-${row.groupName}`);
1524
+ }
1525
+ const item = row;
1526
+ return /* @__PURE__ */ jsx9(
1527
+ ComboboxItem_default,
1528
+ {
1529
+ value: item,
1530
+ itemId: String(item.id),
1531
+ label: itemToString(item),
1532
+ disabled: item.disabled,
1533
+ inputType,
1534
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1535
+ },
1536
+ item.id
1537
+ );
1538
+ }
1539
+ const rootItems = flatItems ?? groups ?? (isChildrenMode ? void 0 : visibleData);
1540
+ const hasSentinels = selectAll || selectHeadings;
1541
+ const rootValue = hasSentinels ? [...value] : value;
1542
+ return /* @__PURE__ */ jsxs7(Field, { children: [
1543
+ /* @__PURE__ */ jsx9("div", { ref: containerRef, style: { position: "relative" } }),
1544
+ /* @__PURE__ */ jsxs7(
1545
+ Combobox4.Root,
1546
+ {
1547
+ multiple: true,
1548
+ id,
1549
+ virtualized: isVirtualized,
1550
+ open,
1551
+ disabled: props.disabled,
1552
+ onOpenChange: setOpen,
1553
+ onItemHighlighted: isVirtualized ? (item, { reason, index }) => {
1554
+ const virt = virtualizerRef.current;
1555
+ if (!item || !virt) return;
1556
+ const isStart = index === 0;
1557
+ const isEnd = index === virt.options.count - 1;
1558
+ if (reason === "none" || reason === "keyboard" && (isStart || isEnd)) {
1559
+ queueMicrotask(() => {
1560
+ virt.scrollToIndex(index, {
1561
+ align: isEnd ? "start" : "end"
1562
+ });
1563
+ });
1564
+ }
1565
+ } : void 0,
1566
+ value: rootValue,
1567
+ onValueChange: (
1568
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1569
+ hasSentinels ? handleValueChange : handleSimpleValueChange
1570
+ ),
1571
+ itemToStringLabel: (item) => {
1572
+ if (!item || isGroupHeaderSentinel2(item) || isSelectAllSentinel2(item))
1573
+ return "";
1574
+ return itemToString(item);
1575
+ },
1576
+ isItemEqualToValue: (a, b) => {
1577
+ if (isGroupHeaderSentinel2(a) && isGroupHeaderSentinel2(b))
1578
+ return a.groupName === b.groupName;
1579
+ if (isSelectAllSentinel2(a) && isSelectAllSentinel2(b)) return true;
1580
+ if (!isGroupHeaderSentinel2(a) && !isSelectAllSentinel2(a) && !isGroupHeaderSentinel2(b) && !isSelectAllSentinel2(b))
1581
+ return a.id === b.id;
1582
+ return false;
1583
+ },
1584
+ items: rootItems,
1585
+ children: [
1586
+ /* @__PURE__ */ jsx9(ComboboxTokenInputGroup, { children: /* @__PURE__ */ jsxs7(ComboboxToken, { children: [
1587
+ renderSelection ? renderSelection(value) : (() => {
1588
+ const visibleTokens = maxTokens != null ? value.slice(0, maxTokens) : value;
1589
+ const overflow = maxTokens != null ? value.length - maxTokens : 0;
1590
+ return /* @__PURE__ */ jsxs7(Fragment6, { children: [
1591
+ visibleTokens.map((item) => /* @__PURE__ */ jsxs7(Token, { children: [
1592
+ renderToken ? renderToken(item) : itemToString(item),
1593
+ /* @__PURE__ */ jsx9(
1594
+ TokenRemove,
1595
+ {
1596
+ "aria-label": `Remove ${itemToString(item)}`,
1597
+ onPointerDown: (e) => e.preventDefault(),
1598
+ onClick: (e) => removeItem(item, e),
1599
+ children: /* @__PURE__ */ jsx9(Icon3, { name: "x-outline", size: "mini" })
1600
+ }
1601
+ )
1602
+ ] }, item.id)),
1603
+ overflow > 0 && /* @__PURE__ */ jsxs7(Token, { children: [
1604
+ "+",
1605
+ overflow
1606
+ ] }, "__overflow")
1607
+ ] });
1608
+ })(),
1609
+ /* @__PURE__ */ jsx9(
1610
+ ComboboxTokenInput,
1611
+ {
1612
+ id,
1613
+ placeholder: value.length > 0 ? "" : placeholder
1614
+ }
1615
+ ),
1616
+ /* @__PURE__ */ jsxs7(ComboboxActionButtons, { children: [
1617
+ /* @__PURE__ */ jsx9(ComboboxClear, { "aria-label": "Clear all", children: /* @__PURE__ */ jsx9(ClearIcon, {}) }),
1618
+ /* @__PURE__ */ jsx9(ComboboxTrigger, { "aria-label": "Open popup", children: /* @__PURE__ */ jsx9(StyledChevron, { $isOpen: open, children: /* @__PURE__ */ jsx9(ChevronIcon, {}) }) })
1619
+ ] })
1620
+ ] }) }),
1621
+ /* @__PURE__ */ jsx9(Combobox4.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx9(ComboboxPositioner, { sideOffset: 4, children: /* @__PURE__ */ jsxs7(
1622
+ ComboboxPopup,
1623
+ {
1624
+ "aria-busy": isLoading || void 0,
1625
+ style: isVirtualized ? { display: "flex", flexDirection: "column" } : void 0,
1626
+ children: [
1627
+ /* @__PURE__ */ jsx9(ComboboxStatus, { children: isLoading ? loadingText : null }),
1628
+ /* @__PURE__ */ jsx9(ComboboxEmpty, { children: isLoading ? null : emptyText }),
1629
+ /* @__PURE__ */ jsx9(
1630
+ ComboboxList,
1631
+ {
1632
+ style: isVirtualized ? {
1633
+ padding: 0,
1634
+ flex: 1,
1635
+ minHeight: 0,
1636
+ display: "flex",
1637
+ flexDirection: "column"
1638
+ } : void 0,
1639
+ children: isVirtualized ? /* @__PURE__ */ jsx9(
1640
+ VirtualizedComboboxList,
1641
+ {
1642
+ open,
1643
+ virtualizerRef,
1644
+ value,
1645
+ groups,
1646
+ data: visibleData,
1647
+ itemToString,
1648
+ inputType,
1649
+ renderItem,
1650
+ renderGroupHeading
1651
+ }
1652
+ ) : children ? children : flatItems ? (row) => renderSentinelRow(row) : groups ? (group, index) => /* @__PURE__ */ jsxs7(React9.Fragment, { children: [
1653
+ /* @__PURE__ */ jsxs7(ComboboxGroup, { items: group.items, children: [
1654
+ /* @__PURE__ */ jsx9(ComboboxGroupLabel, { children: renderGroupHeading ? renderGroupHeading(group.value) : group.value }),
1655
+ /* @__PURE__ */ jsx9(Combobox4.Collection, { children: (item) => /* @__PURE__ */ jsx9(
1656
+ ComboboxItem_default,
1657
+ {
1658
+ value: item,
1659
+ itemId: String(item.id),
1660
+ label: itemToString(item),
1661
+ disabled: item.disabled,
1662
+ inputType,
1663
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1664
+ },
1665
+ item.id
1666
+ ) })
1667
+ ] }),
1668
+ index < groups.length - 1 && /* @__PURE__ */ jsx9(ComboboxSeparator, {})
1669
+ ] }, group.value) : (item) => /* @__PURE__ */ jsx9(
1670
+ ComboboxItem_default,
1671
+ {
1672
+ value: item,
1673
+ itemId: String(item.id),
1674
+ label: itemToString(item),
1675
+ disabled: item.disabled,
1676
+ inputType,
1677
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1678
+ },
1679
+ item.id
1680
+ )
1681
+ }
1682
+ )
1683
+ ]
1684
+ }
1685
+ ) }) })
1686
+ ]
1687
+ }
1688
+ )
1689
+ ] });
1690
+ }
747
1691
 
748
1692
  // src/v3/SingleSearchableSelect.tsx
749
1693
  import * as React10 from "react";
750
1694
  import { Combobox as Combobox5 } from "@base-ui/react/combobox";
751
1695
  import "@tanstack/react-virtual";
752
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1696
+ import { Fragment as Fragment8, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1697
+ function SingleSearchableSelect(props) {
1698
+ const {
1699
+ id,
1700
+ placeholder = "Select...",
1701
+ includePlaceholderItem,
1702
+ searchPlaceholder = "Search...",
1703
+ emptyText = "No results found.",
1704
+ isLoading = false,
1705
+ loadingText = "Loading..."
1706
+ } = props;
1707
+ const isChildrenMode = "children" in props && props.children != null;
1708
+ const data = isChildrenMode ? [] : props.data;
1709
+ const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
1710
+ const renderItem = isChildrenMode ? void 0 : props.renderItem;
1711
+ const renderSelection = isChildrenMode ? void 0 : props.renderSelection;
1712
+ const inputType = isChildrenMode ? "icon" : props.inputType ?? "icon";
1713
+ const isVirtualized = isChildrenMode ? false : props.isVirtualized ?? false;
1714
+ const groupBy = isChildrenMode ? void 0 : isVirtualized ? void 0 : props.groupBy;
1715
+ const renderGroupHeading = isChildrenMode ? void 0 : isVirtualized ? void 0 : props.renderGroupHeading;
1716
+ const children = isChildrenMode ? props.children : void 0;
1717
+ const selectedItemId = props.selectedItemId;
1718
+ const defaultSelectedItemId = props.defaultSelectedItemId;
1719
+ const onSelectedItemIdChange = props.onSelectedItemIdChange;
1720
+ const { containerRef, portalContainer } = useSeedsPortalContainer();
1721
+ const [open, setOpen] = React10.useState(false);
1722
+ const virtualizerRef = React10.useRef(null);
1723
+ const isControlled = selectedItemId !== void 0;
1724
+ const idToItem = React10.useCallback(
1725
+ (id2) => {
1726
+ if (id2 == null) return null;
1727
+ return data.find((d) => String(d.id) === String(id2)) ?? null;
1728
+ },
1729
+ [data]
1730
+ );
1731
+ const [internalValue, setInternalValue] = React10.useState(
1732
+ () => idToItem(defaultSelectedItemId)
1733
+ );
1734
+ const value = isControlled ? idToItem(selectedItemId) : internalValue;
1735
+ function handleValueChange(newItem) {
1736
+ if (!isControlled) setInternalValue(newItem);
1737
+ if (onSelectedItemIdChange) {
1738
+ onSelectedItemIdChange(newItem ? newItem.id : null);
1739
+ }
1740
+ }
1741
+ const groups = React10.useMemo(
1742
+ () => groupBy ? groupItems(data, groupBy) : null,
1743
+ [data, groupBy]
1744
+ );
1745
+ return /* @__PURE__ */ jsxs8(Field, { children: [
1746
+ /* @__PURE__ */ jsx10("div", { ref: containerRef, style: { position: "relative" } }),
1747
+ /* @__PURE__ */ jsxs8(
1748
+ Combobox5.Root,
1749
+ {
1750
+ id,
1751
+ value,
1752
+ disabled: props.disabled,
1753
+ onValueChange: handleValueChange,
1754
+ itemToStringLabel: itemToString,
1755
+ isItemEqualToValue: (a, b) => a != null && b != null && a.id === b.id,
1756
+ items: isVirtualized ? data : groups ?? (isChildrenMode ? void 0 : data),
1757
+ virtualized: isVirtualized,
1758
+ open,
1759
+ onOpenChange: setOpen,
1760
+ onItemHighlighted: isVirtualized ? (item, { reason, index }) => {
1761
+ const virt = virtualizerRef.current;
1762
+ if (!item || !virt) return;
1763
+ const isStart = index === 0;
1764
+ const isEnd = index === virt.options.count - 1;
1765
+ if (reason === "none" || reason === "keyboard" && (isStart || isEnd)) {
1766
+ queueMicrotask(() => {
1767
+ virt.scrollToIndex(index, {
1768
+ align: isEnd ? "start" : "end"
1769
+ });
1770
+ });
1771
+ }
1772
+ } : void 0,
1773
+ children: [
1774
+ /* @__PURE__ */ jsxs8(SearchableSelectTrigger, { id, children: [
1775
+ /* @__PURE__ */ jsx10(SearchableSelectPlaceholder, { children: /* @__PURE__ */ jsx10(Combobox5.Value, { placeholder, children: value ? renderSelection ? renderSelection(value) : itemToString(value) : null }) }),
1776
+ /* @__PURE__ */ jsx10(SearchableSelectTriggerIcon, { children: /* @__PURE__ */ jsx10(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx10(ChevronIcon, {}) }) })
1777
+ ] }),
1778
+ /* @__PURE__ */ jsx10(Combobox5.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx10(ComboboxPositioner, { sideOffset: 4, children: /* @__PURE__ */ jsxs8(
1779
+ SearchableSelectPopup,
1780
+ {
1781
+ "aria-busy": isLoading || void 0,
1782
+ style: { display: "flex", flexDirection: "column" },
1783
+ children: [
1784
+ /* @__PURE__ */ jsx10(SearchableSelectSearchContainer, { children: /* @__PURE__ */ jsx10(
1785
+ SearchableSelectInput,
1786
+ {
1787
+ placeholder: searchPlaceholder,
1788
+ autoFocus: true
1789
+ }
1790
+ ) }),
1791
+ /* @__PURE__ */ jsx10(ComboboxStatus, { children: isLoading ? loadingText : null }),
1792
+ /* @__PURE__ */ jsx10(ComboboxEmpty, { children: isLoading ? null : emptyText }),
1793
+ /* @__PURE__ */ jsx10(
1794
+ SearchableSelectList,
1795
+ {
1796
+ style: isVirtualized ? {
1797
+ padding: 0,
1798
+ flex: 1,
1799
+ minHeight: 0,
1800
+ display: "flex",
1801
+ flexDirection: "column"
1802
+ } : void 0,
1803
+ children: isVirtualized ? /* @__PURE__ */ jsx10(
1804
+ VirtualizedComboboxList,
1805
+ {
1806
+ open,
1807
+ virtualizerRef,
1808
+ value,
1809
+ groups: null,
1810
+ data,
1811
+ itemToString,
1812
+ inputType,
1813
+ renderItem
1814
+ }
1815
+ ) : children ? children : groups ? (group, index) => /* @__PURE__ */ jsxs8(React10.Fragment, { children: [
1816
+ /* @__PURE__ */ jsxs8(ComboboxGroup, { items: group.items, children: [
1817
+ /* @__PURE__ */ jsx10(ComboboxGroupLabel, { children: renderGroupHeading ? renderGroupHeading(group.value) : group.value }),
1818
+ /* @__PURE__ */ jsx10(Combobox5.Collection, { children: (item) => /* @__PURE__ */ jsx10(
1819
+ ComboboxItem_default,
1820
+ {
1821
+ value: item,
1822
+ itemId: String(item.id),
1823
+ label: itemToString(item),
1824
+ disabled: item.disabled,
1825
+ inputType,
1826
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1827
+ },
1828
+ item.id
1829
+ ) })
1830
+ ] }),
1831
+ index < groups.length - 1 && /* @__PURE__ */ jsx10(ComboboxSeparator, {})
1832
+ ] }, group.value) : /* @__PURE__ */ jsxs8(Fragment8, { children: [
1833
+ includePlaceholderItem && /* @__PURE__ */ jsx10(
1834
+ ComboboxItem_default,
1835
+ {
1836
+ value: null,
1837
+ itemId: "placeholder",
1838
+ label: placeholder
1839
+ },
1840
+ "placeholder"
1841
+ ),
1842
+ /* @__PURE__ */ jsx10(Combobox5.Collection, { children: (item) => /* @__PURE__ */ jsx10(
1843
+ ComboboxItem_default,
1844
+ {
1845
+ value: item,
1846
+ itemId: String(item.id),
1847
+ label: itemToString(item),
1848
+ disabled: item.disabled,
1849
+ inputType,
1850
+ renderItem: renderItem ? () => renderItem(item) : void 0
1851
+ },
1852
+ item.id
1853
+ ) })
1854
+ ] })
1855
+ }
1856
+ )
1857
+ ]
1858
+ }
1859
+ ) }) })
1860
+ ]
1861
+ }
1862
+ )
1863
+ ] });
1864
+ }
753
1865
 
754
1866
  // src/v3/MultiSearchableSelect.tsx
755
1867
  import * as React11 from "react";
@@ -763,6 +1875,298 @@ var SelectionText2 = styled7.span`
763
1875
  text-overflow: ellipsis;
764
1876
  white-space: nowrap;
765
1877
  `;
1878
+ function makeGroupHeaderSentinel2(groupName) {
1879
+ return { __groupHeader: true, groupName };
1880
+ }
1881
+ function isGroupHeaderSentinel3(v) {
1882
+ return typeof v === "object" && v !== null && "__groupHeader" in v;
1883
+ }
1884
+ var SELECT_ALL_SENTINEL2 = { __selectAll: true };
1885
+ function isSelectAllSentinel3(v) {
1886
+ return typeof v === "object" && v !== null && "__selectAll" in v;
1887
+ }
1888
+ function MultiSearchableSelect(props) {
1889
+ const {
1890
+ id,
1891
+ placeholder = "Select...",
1892
+ searchPlaceholder = "Search...",
1893
+ emptyText = "No results found.",
1894
+ isLoading = false,
1895
+ loadingText = "Loading..."
1896
+ } = props;
1897
+ const isChildrenMode = "children" in props && props.children != null;
1898
+ const data = isChildrenMode ? [] : props.data;
1899
+ const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
1900
+ const renderItem = isChildrenMode ? void 0 : props.renderItem;
1901
+ const customRenderSelections = isChildrenMode ? void 0 : props.customRenderSelections;
1902
+ const maxSelections = isChildrenMode ? void 0 : props.maxSelections;
1903
+ const renderSelection = isChildrenMode ? void 0 : props.renderSelection;
1904
+ const removeSelectedItems = isChildrenMode ? false : props.removeSelectedItems ?? false;
1905
+ const inputType = isChildrenMode ? "checkbox" : removeSelectedItems ? "none" : props.inputType ?? "checkbox";
1906
+ const groupBy = isChildrenMode ? void 0 : props.groupBy;
1907
+ const renderGroupHeading = isChildrenMode ? void 0 : props.renderGroupHeading;
1908
+ const selectHeadings = isChildrenMode ? false : props.selectHeadings ?? false;
1909
+ const selectAll = isChildrenMode ? false : props.selectAll ?? false;
1910
+ const isVirtualized = isChildrenMode ? false : props.isVirtualized ?? false;
1911
+ const children = isChildrenMode ? props.children : void 0;
1912
+ const selectedItemIds = props.selectedItemIds;
1913
+ const defaultSelectedItemIds = props.defaultSelectedItemIds;
1914
+ const onSelectedItemIdsChange = props.onSelectedItemIdsChange;
1915
+ const { containerRef, portalContainer } = useSeedsPortalContainer();
1916
+ const [open, setOpen] = React11.useState(false);
1917
+ const virtualizerRef = React11.useRef(null);
1918
+ const isControlled = selectedItemIds !== void 0;
1919
+ const idsToItems = React11.useCallback(
1920
+ (ids) => ids.map((id2) => data.find((d) => d.id === id2)).filter((d) => d != null),
1921
+ [data]
1922
+ );
1923
+ const [internalValue, setInternalValue] = React11.useState(
1924
+ () => defaultSelectedItemIds ? idsToItems(defaultSelectedItemIds) : []
1925
+ );
1926
+ const value = isControlled ? idsToItems(selectedItemIds) : internalValue;
1927
+ const visibleData = React11.useMemo(
1928
+ () => removeSelectedItems ? data.filter((item) => !value.some((v) => v.id === item.id)) : data,
1929
+ [data, value, removeSelectedItems]
1930
+ );
1931
+ const groups = React11.useMemo(
1932
+ () => groupBy ? groupItems(visibleData, groupBy) : null,
1933
+ [visibleData, groupBy]
1934
+ );
1935
+ const flatItems = React11.useMemo(() => {
1936
+ if (!groups || !selectHeadings && !selectAll) return null;
1937
+ const rows = [];
1938
+ if (selectAll) rows.push(SELECT_ALL_SENTINEL2);
1939
+ for (const group of groups) {
1940
+ rows.push(makeGroupHeaderSentinel2(group.value));
1941
+ rows.push(...group.items);
1942
+ }
1943
+ return rows;
1944
+ }, [groups, selectHeadings, selectAll]);
1945
+ function setSelectedItems(items) {
1946
+ if (!isControlled) setInternalValue(items);
1947
+ if (onSelectedItemIdsChange)
1948
+ onSelectedItemIdsChange(items.map((item) => item.id));
1949
+ }
1950
+ function handleValueChange(next) {
1951
+ const selectAllClicked = next.filter(isSelectAllSentinel3);
1952
+ const groupSentinels = next.filter(isGroupHeaderSentinel3);
1953
+ const realItems = next.filter(
1954
+ (v) => !isGroupHeaderSentinel3(v) && !isSelectAllSentinel3(v)
1955
+ );
1956
+ if (selectAllClicked.length > 0) {
1957
+ const allSelected = data.every(
1958
+ (d) => realItems.some((s) => s.id === d.id)
1959
+ );
1960
+ setSelectedItems(allSelected ? [] : [...data]);
1961
+ return;
1962
+ }
1963
+ if (groupSentinels.length === 0) {
1964
+ setSelectedItems(realItems);
1965
+ return;
1966
+ }
1967
+ let updated = [...realItems];
1968
+ for (const sentinel of groupSentinels) {
1969
+ const group = groups?.find((g) => g.value === sentinel.groupName);
1970
+ if (!group) continue;
1971
+ const allSelected = group.items.every(
1972
+ (item) => updated.some((s) => s.id === item.id)
1973
+ );
1974
+ if (allSelected) {
1975
+ updated = updated.filter(
1976
+ (s) => !group.items.some((item) => item.id === s.id)
1977
+ );
1978
+ } else {
1979
+ const missing = group.items.filter(
1980
+ (item) => !updated.some((s) => s.id === item.id)
1981
+ );
1982
+ updated = [...updated, ...missing];
1983
+ }
1984
+ }
1985
+ setSelectedItems(updated);
1986
+ }
1987
+ function handleSimpleValueChange(newItems) {
1988
+ setSelectedItems(newItems);
1989
+ }
1990
+ function renderSentinelRow(row) {
1991
+ if (isSelectAllSentinel3(row)) {
1992
+ const totalCount = data.length;
1993
+ const selectedCount = value.length;
1994
+ const state = selectedCount === 0 ? "none" : selectedCount === totalCount ? "all" : "partial";
1995
+ return /* @__PURE__ */ jsxs9(ComboboxSelectAllItem, { value: row, children: [
1996
+ /* @__PURE__ */ jsx11(ComboboxGroupHeaderCheckbox, { $state: state, id: "__selectAll" }),
1997
+ "Select all"
1998
+ ] }, "__selectAll");
1999
+ }
2000
+ if (isGroupHeaderSentinel3(row)) {
2001
+ const group = groups?.find((g) => g.value === row.groupName);
2002
+ const groupItemsList = group?.items ?? [];
2003
+ const selectedCount = groupItemsList.filter(
2004
+ (item2) => value.some((s) => s.id === item2.id)
2005
+ ).length;
2006
+ const state = selectedCount === 0 ? "none" : selectedCount === groupItemsList.length ? "all" : "partial";
2007
+ return /* @__PURE__ */ jsxs9(ComboboxGroupHeaderItem, { value: row, children: [
2008
+ /* @__PURE__ */ jsx11(
2009
+ ComboboxGroupHeaderCheckbox,
2010
+ {
2011
+ $state: state,
2012
+ id: `__header-${row.groupName}`
2013
+ }
2014
+ ),
2015
+ renderGroupHeading ? renderGroupHeading(row.groupName) : row.groupName
2016
+ ] }, `__header-${row.groupName}`);
2017
+ }
2018
+ const item = row;
2019
+ return /* @__PURE__ */ jsx11(
2020
+ ComboboxItem_default,
2021
+ {
2022
+ value: item,
2023
+ itemId: String(item.id),
2024
+ label: itemToString(item),
2025
+ disabled: item.disabled,
2026
+ inputType,
2027
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
2028
+ },
2029
+ item.id
2030
+ );
2031
+ }
2032
+ const rootItems = flatItems ?? groups ?? (isChildrenMode ? void 0 : visibleData);
2033
+ const hasSentinels = selectAll || selectHeadings;
2034
+ const rootValue = hasSentinels ? [...value] : value;
2035
+ return /* @__PURE__ */ jsxs9(Field, { children: [
2036
+ /* @__PURE__ */ jsx11("div", { ref: containerRef, style: { position: "relative" } }),
2037
+ /* @__PURE__ */ jsxs9(
2038
+ Combobox6.Root,
2039
+ {
2040
+ multiple: true,
2041
+ id,
2042
+ virtualized: isVirtualized,
2043
+ open,
2044
+ disabled: props.disabled,
2045
+ onOpenChange: setOpen,
2046
+ onItemHighlighted: isVirtualized ? (item, { reason, index }) => {
2047
+ const virt = virtualizerRef.current;
2048
+ if (!item || !virt) return;
2049
+ const isStart = index === 0;
2050
+ const isEnd = index === virt.options.count - 1;
2051
+ if (reason === "none" || reason === "keyboard" && (isStart || isEnd)) {
2052
+ queueMicrotask(() => {
2053
+ virt.scrollToIndex(index, {
2054
+ align: isEnd ? "start" : "end"
2055
+ });
2056
+ });
2057
+ }
2058
+ } : void 0,
2059
+ value: rootValue,
2060
+ onValueChange: (
2061
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2062
+ hasSentinels ? handleValueChange : handleSimpleValueChange
2063
+ ),
2064
+ itemToStringLabel: (item) => {
2065
+ if (!item || isGroupHeaderSentinel3(item) || isSelectAllSentinel3(item))
2066
+ return "";
2067
+ return itemToString(item);
2068
+ },
2069
+ isItemEqualToValue: (a, b) => {
2070
+ if (isGroupHeaderSentinel3(a) && isGroupHeaderSentinel3(b))
2071
+ return a.groupName === b.groupName;
2072
+ if (isSelectAllSentinel3(a) && isSelectAllSentinel3(b)) return true;
2073
+ if (!isGroupHeaderSentinel3(a) && !isSelectAllSentinel3(a) && !isGroupHeaderSentinel3(b) && !isSelectAllSentinel3(b))
2074
+ return a.id === b.id;
2075
+ return false;
2076
+ },
2077
+ items: rootItems,
2078
+ children: [
2079
+ /* @__PURE__ */ jsxs9(SearchableSelectTokenTrigger, { id, children: [
2080
+ renderSelection ? renderSelection(value) : value.length > 0 ? (() => {
2081
+ const visibleItems = maxSelections != null ? value.slice(0, maxSelections) : value;
2082
+ const overflowCount = maxSelections != null && value.length > maxSelections ? value.length - maxSelections : 0;
2083
+ const text = visibleItems.map(
2084
+ (item) => customRenderSelections ? customRenderSelections(item) : itemToString(item)
2085
+ ).join(", ");
2086
+ return /* @__PURE__ */ jsxs9(SelectionText2, { children: [
2087
+ text,
2088
+ overflowCount > 0 ? `, +${overflowCount}` : ""
2089
+ ] });
2090
+ })() : /* @__PURE__ */ jsx11(SearchableSelectPlaceholder, { children: placeholder }),
2091
+ /* @__PURE__ */ jsx11(SearchableSelectTriggerIcon, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx11(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx11(ChevronIcon, {}) }) })
2092
+ ] }),
2093
+ /* @__PURE__ */ jsx11(Combobox6.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx11(ComboboxPositioner, { sideOffset: 4, children: /* @__PURE__ */ jsxs9(
2094
+ SearchableSelectPopup,
2095
+ {
2096
+ "aria-busy": isLoading || void 0,
2097
+ style: { display: "flex", flexDirection: "column" },
2098
+ children: [
2099
+ /* @__PURE__ */ jsx11(SearchableSelectSearchContainer, { children: /* @__PURE__ */ jsx11(
2100
+ SearchableSelectInput,
2101
+ {
2102
+ placeholder: searchPlaceholder,
2103
+ autoFocus: true
2104
+ }
2105
+ ) }),
2106
+ /* @__PURE__ */ jsx11(ComboboxStatus, { children: isLoading ? loadingText : null }),
2107
+ /* @__PURE__ */ jsx11(ComboboxEmpty, { children: isLoading ? null : emptyText }),
2108
+ /* @__PURE__ */ jsx11(
2109
+ SearchableSelectList,
2110
+ {
2111
+ style: isVirtualized ? {
2112
+ padding: 0,
2113
+ flex: 1,
2114
+ minHeight: 0,
2115
+ display: "flex",
2116
+ flexDirection: "column"
2117
+ } : void 0,
2118
+ children: isVirtualized ? /* @__PURE__ */ jsx11(
2119
+ VirtualizedComboboxList,
2120
+ {
2121
+ open,
2122
+ virtualizerRef,
2123
+ value,
2124
+ groups,
2125
+ data: visibleData,
2126
+ itemToString,
2127
+ inputType,
2128
+ renderItem,
2129
+ renderGroupHeading
2130
+ }
2131
+ ) : children ? children : flatItems ? (row) => renderSentinelRow(row) : groups ? (group, index) => /* @__PURE__ */ jsxs9(React11.Fragment, { children: [
2132
+ /* @__PURE__ */ jsxs9(ComboboxGroup, { items: group.items, children: [
2133
+ /* @__PURE__ */ jsx11(ComboboxGroupLabel, { children: renderGroupHeading ? renderGroupHeading(group.value) : group.value }),
2134
+ /* @__PURE__ */ jsx11(Combobox6.Collection, { children: (item) => /* @__PURE__ */ jsx11(
2135
+ ComboboxItem_default,
2136
+ {
2137
+ value: item,
2138
+ itemId: String(item.id),
2139
+ label: itemToString(item),
2140
+ disabled: item.disabled,
2141
+ inputType,
2142
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
2143
+ },
2144
+ item.id
2145
+ ) })
2146
+ ] }),
2147
+ index < groups.length - 1 && /* @__PURE__ */ jsx11(ComboboxSeparator, {})
2148
+ ] }, group.value) : (item) => /* @__PURE__ */ jsx11(
2149
+ ComboboxItem_default,
2150
+ {
2151
+ value: item,
2152
+ itemId: String(item.id),
2153
+ label: itemToString(item),
2154
+ disabled: item.disabled,
2155
+ inputType,
2156
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
2157
+ },
2158
+ item.id
2159
+ )
2160
+ }
2161
+ )
2162
+ ]
2163
+ }
2164
+ ) }) })
2165
+ ]
2166
+ }
2167
+ )
2168
+ ] });
2169
+ }
766
2170
  export {
767
2171
  ComboboxActionButtons,
768
2172
  ComboboxClear,
@@ -786,6 +2190,9 @@ export {
786
2190
  ComboboxTokenInput,
787
2191
  ComboboxTokenInputGroup,
788
2192
  ComboboxTrigger,
2193
+ MultiCombobox,
2194
+ MultiSearchableSelect,
2195
+ MultiSelect,
789
2196
  SearchableSelectInput,
790
2197
  SearchableSelectList,
791
2198
  SearchableSelectPlaceholder,
@@ -794,6 +2201,9 @@ export {
794
2201
  SearchableSelectTokenTrigger,
795
2202
  SearchableSelectTrigger,
796
2203
  SearchableSelectTriggerIcon,
2204
+ SingleCombobox,
2205
+ SingleSearchableSelect,
2206
+ SingleSelect,
797
2207
  Token,
798
2208
  TokenRemove
799
2209
  };