@sproutsocial/seeds-react-menu 1.12.1 → 1.12.2
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +13 -0
- package/dist/esm/v3/index.js +191 -56
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/v3/index.d.mts +10 -0
- package/dist/v3/index.d.ts +10 -0
- package/dist/v3/index.js +191 -56
- package/dist/v3/index.js.map +1 -1
- package/package.json +9 -9
- package/src/v3/Common/VirtualizedComboboxList.tsx +29 -2
- package/src/v3/Common/sentinels.ts +13 -0
- package/src/v3/MultiCombobox.stories.tsx +34 -0
- package/src/v3/MultiCombobox.tsx +214 -55
- package/src/v3/MultiSearchableSelect.tsx +6 -1
- package/src/v3/MultiSelect.tsx +3 -1
- package/src/v3/SingleCombobox.tsx +7 -1
- package/src/v3/SingleSearchableSelect.tsx +3 -1
- package/src/v3/SingleSelect.stories.tsx +19 -0
- package/src/v3/SingleSelect.tsx +3 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -9,27 +9,27 @@ $ tsup --dts
|
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[32mCJS[39m [1mdist/index.js [22m[32m92.65 KB[39m
|
|
12
|
-
[32mCJS[39m [1mdist/v3/index.js [22m[32m94.25 KB[39m
|
|
13
12
|
[32mCJS[39m [1mdist/v2/index.js [22m[32m73.18 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/v3/index.js [22m[32m99.79 KB[39m
|
|
14
14
|
[32mCJS[39m [1mdist/index.js.map [22m[32m180.28 KB[39m
|
|
15
|
-
[32mCJS[39m [1mdist/v3/index.js.map [22m[32m162.97 KB[39m
|
|
16
15
|
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m152.19 KB[39m
|
|
17
|
-
[32mCJS[39m
|
|
16
|
+
[32mCJS[39m [1mdist/v3/index.js.map [22m[32m173.17 KB[39m
|
|
17
|
+
[32mCJS[39m ⚡️ Build success in 91ms
|
|
18
18
|
[32mESM[39m [1mdist/esm/index.js [22m[32m73.60 KB[39m
|
|
19
|
+
[32mESM[39m [1mdist/esm/v3/index.js [22m[32m88.52 KB[39m
|
|
19
20
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js [22m[32m9.15 KB[39m
|
|
20
21
|
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m62.63 KB[39m
|
|
21
|
-
[32mESM[39m [1mdist/esm/v3/index.js [22m[32m83.10 KB[39m
|
|
22
22
|
[32mESM[39m [1mdist/esm/index.js.map [22m[32m156.29 KB[39m
|
|
23
|
+
[32mESM[39m [1mdist/esm/v3/index.js.map [22m[32m173.24 KB[39m
|
|
23
24
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js.map [22m[32m22.93 KB[39m
|
|
24
25
|
[32mESM[39m [1mdist/esm/v2/index.js.map [22m[32m132.57 KB[39m
|
|
25
|
-
[32mESM[39m
|
|
26
|
-
[32mESM[39m ⚡️ Build success in 68ms
|
|
26
|
+
[32mESM[39m ⚡️ Build success in 91ms
|
|
27
27
|
[34mDTS[39m Build start
|
|
28
|
-
[32mDTS[39m ⚡️ Build success in
|
|
28
|
+
[32mDTS[39m ⚡️ Build success in 6715ms
|
|
29
29
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m39.11 KB[39m
|
|
30
30
|
[32mDTS[39m [1mdist/v2/index.d.ts [22m[32m5.55 KB[39m
|
|
31
|
-
[32mDTS[39m [1mdist/v3/index.d.ts [22m[
|
|
31
|
+
[32mDTS[39m [1mdist/v3/index.d.ts [22m[32m18.28 KB[39m
|
|
32
32
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m39.11 KB[39m
|
|
33
33
|
[32mDTS[39m [1mdist/v2/index.d.mts [22m[32m5.55 KB[39m
|
|
34
|
-
[32mDTS[39m [1mdist/v3/index.d.mts [22m[
|
|
35
|
-
Done in 7.
|
|
34
|
+
[32mDTS[39m [1mdist/v3/index.d.mts [22m[32m18.28 KB[39m
|
|
35
|
+
Done in 7.46s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-menu
|
|
2
2
|
|
|
3
|
+
## 1.12.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c5a6ad9: Add aria-describedby to all base-ui components, and creatable functionality to Multicombobox
|
|
8
|
+
- @sproutsocial/seeds-react-icon@2.3.7
|
|
9
|
+
- @sproutsocial/seeds-react-button@2.0.5
|
|
10
|
+
- @sproutsocial/seeds-react-checkbox@1.3.33
|
|
11
|
+
- @sproutsocial/seeds-react-input@1.5.16
|
|
12
|
+
- @sproutsocial/seeds-react-switch@1.2.32
|
|
13
|
+
- @sproutsocial/seeds-react-token-input@1.4.38
|
|
14
|
+
- @sproutsocial/seeds-react-popout@2.4.38
|
|
15
|
+
|
|
3
16
|
## 1.12.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -291,6 +291,7 @@ var StyledValue = styled4(Select3.Value)`
|
|
|
291
291
|
`;
|
|
292
292
|
function SingleSelect(props) {
|
|
293
293
|
const { id, placeholder, includePlaceholderItem } = props;
|
|
294
|
+
const ariaDescribedBy = props["aria-describedby"];
|
|
294
295
|
const isChildrenMode = "children" in props && props.children != null;
|
|
295
296
|
const selectedItemId = props.selectedItemId;
|
|
296
297
|
const defaultSelectedItemId = props.defaultSelectedItemId;
|
|
@@ -348,7 +349,7 @@ function SingleSelect(props) {
|
|
|
348
349
|
onValueChange: handleValueChange,
|
|
349
350
|
id,
|
|
350
351
|
children: [
|
|
351
|
-
/* @__PURE__ */ jsxs2(SelectTrigger, { children: [
|
|
352
|
+
/* @__PURE__ */ jsxs2(SelectTrigger, { "aria-describedby": ariaDescribedBy, children: [
|
|
352
353
|
/* @__PURE__ */ jsx3(StyledValue, { placeholder, children: renderSelection && selectedItem ? renderSelection(selectedItem) : void 0 }),
|
|
353
354
|
/* @__PURE__ */ jsx3(SelectIcon, { children: /* @__PURE__ */ jsx3(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx3(ChevronIcon, {}) }) })
|
|
354
355
|
] }),
|
|
@@ -420,6 +421,7 @@ var Placeholder = styled5.div`
|
|
|
420
421
|
`;
|
|
421
422
|
function MultiSelect(props) {
|
|
422
423
|
const { id, placeholder = "Select..." } = props;
|
|
424
|
+
const ariaDescribedBy = props["aria-describedby"];
|
|
423
425
|
const isChildrenMode = "children" in props && props.children != null;
|
|
424
426
|
const data = isChildrenMode ? [] : props.data;
|
|
425
427
|
const itemToString = isChildrenMode ? () => "" : props.itemToString;
|
|
@@ -476,7 +478,7 @@ function MultiSelect(props) {
|
|
|
476
478
|
disabled: props.disabled,
|
|
477
479
|
id,
|
|
478
480
|
children: [
|
|
479
|
-
/* @__PURE__ */ jsxs3(SelectTrigger, { children: [
|
|
481
|
+
/* @__PURE__ */ jsxs3(SelectTrigger, { "aria-describedby": ariaDescribedBy, children: [
|
|
480
482
|
/* @__PURE__ */ jsx4(SelectValue, { children: () => {
|
|
481
483
|
if (renderSelection) return renderSelection(selectedItems);
|
|
482
484
|
if (selectedItems.length === 0)
|
|
@@ -1087,6 +1089,12 @@ function makePlaceholderSentinel(label) {
|
|
|
1087
1089
|
function isPlaceholderSentinel(v) {
|
|
1088
1090
|
return typeof v === "object" && v !== null && "__placeholder" in v;
|
|
1089
1091
|
}
|
|
1092
|
+
function makeCreatableSentinel(label) {
|
|
1093
|
+
return { __creatable: true, label };
|
|
1094
|
+
}
|
|
1095
|
+
function isCreatableSentinel(v) {
|
|
1096
|
+
return typeof v === "object" && v !== null && "__creatable" in v;
|
|
1097
|
+
}
|
|
1090
1098
|
|
|
1091
1099
|
// src/v3/Common/VirtualizedComboboxList.tsx
|
|
1092
1100
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -1106,7 +1114,8 @@ function VirtualizedComboboxList({
|
|
|
1106
1114
|
itemToString,
|
|
1107
1115
|
inputType,
|
|
1108
1116
|
renderItem,
|
|
1109
|
-
renderGroupHeading
|
|
1117
|
+
renderGroupHeading,
|
|
1118
|
+
renderCreatableItem
|
|
1110
1119
|
}) {
|
|
1111
1120
|
const filteredItems = Combobox2.useFilteredItems();
|
|
1112
1121
|
const scrollElementRef = React7.useRef(null);
|
|
@@ -1224,6 +1233,17 @@ function VirtualizedComboboxList({
|
|
|
1224
1233
|
virtualItem.key
|
|
1225
1234
|
);
|
|
1226
1235
|
}
|
|
1236
|
+
if (isCreatableSentinel(row)) {
|
|
1237
|
+
if (renderCreatableItem) {
|
|
1238
|
+
return renderCreatableItem(
|
|
1239
|
+
row,
|
|
1240
|
+
baseStyle,
|
|
1241
|
+
virtualItem.index,
|
|
1242
|
+
virtualizer.measureElement
|
|
1243
|
+
);
|
|
1244
|
+
}
|
|
1245
|
+
return null;
|
|
1246
|
+
}
|
|
1227
1247
|
const item = row;
|
|
1228
1248
|
return /* @__PURE__ */ jsx7(
|
|
1229
1249
|
ComboboxItem_default,
|
|
@@ -1257,6 +1277,7 @@ function SingleCombobox(props) {
|
|
|
1257
1277
|
emptyText = "No results found.",
|
|
1258
1278
|
filter
|
|
1259
1279
|
} = props;
|
|
1280
|
+
const ariaDescribedBy = props["aria-describedby"];
|
|
1260
1281
|
const isChildrenMode = "children" in props && props.children != null;
|
|
1261
1282
|
const data = isChildrenMode ? [] : props.data;
|
|
1262
1283
|
const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
|
|
@@ -1327,7 +1348,14 @@ function SingleCombobox(props) {
|
|
|
1327
1348
|
} : void 0,
|
|
1328
1349
|
children: [
|
|
1329
1350
|
/* @__PURE__ */ jsxs6(ComboboxInputGroup, { children: [
|
|
1330
|
-
/* @__PURE__ */ jsx8(
|
|
1351
|
+
/* @__PURE__ */ jsx8(
|
|
1352
|
+
ComboboxInput,
|
|
1353
|
+
{
|
|
1354
|
+
placeholder,
|
|
1355
|
+
id,
|
|
1356
|
+
"aria-describedby": ariaDescribedBy
|
|
1357
|
+
}
|
|
1358
|
+
),
|
|
1331
1359
|
/* @__PURE__ */ jsxs6(ComboboxActionButtons, { children: [
|
|
1332
1360
|
/* @__PURE__ */ jsx8(ComboboxClear, { "aria-label": "Clear selection", children: /* @__PURE__ */ jsx8(ClearIcon, {}) }),
|
|
1333
1361
|
/* @__PURE__ */ jsx8(ComboboxTrigger, { "aria-label": "Open popup", children: /* @__PURE__ */ jsx8(StyledChevron, { $isOpen: open, children: /* @__PURE__ */ jsx8(ChevronIcon, {}) }) })
|
|
@@ -1429,6 +1457,7 @@ function MultiCombobox(props) {
|
|
|
1429
1457
|
inputValue,
|
|
1430
1458
|
onInputValueChange
|
|
1431
1459
|
} = props;
|
|
1460
|
+
const ariaDescribedBy = props["aria-describedby"];
|
|
1432
1461
|
const isChildrenMode = "children" in props && props.children != null;
|
|
1433
1462
|
const data = isChildrenMode ? [] : props.data;
|
|
1434
1463
|
const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
|
|
@@ -1445,12 +1474,16 @@ function MultiCombobox(props) {
|
|
|
1445
1474
|
const selectAll = Boolean(selectAllProp);
|
|
1446
1475
|
const selectAllLabel = typeof selectAllProp === "string" ? selectAllProp : "Select all";
|
|
1447
1476
|
const isVirtualized = isChildrenMode ? false : props.isVirtualized ?? false;
|
|
1477
|
+
const creatableProp = isChildrenMode ? false : props.creatable ?? false;
|
|
1478
|
+
const onCreateProp = isChildrenMode ? void 0 : props.onCreate;
|
|
1448
1479
|
const children = isChildrenMode ? props.children : void 0;
|
|
1449
1480
|
const selectedItemIds = props.selectedItemIds;
|
|
1450
1481
|
const defaultSelectedItemIds = props.defaultSelectedItemIds;
|
|
1451
1482
|
const onSelectedItemIdsChange = props.onSelectedItemIdsChange;
|
|
1452
1483
|
const { containerRef, portalContainer } = useSeedsPortalContainer();
|
|
1453
1484
|
const [open, setOpen] = React9.useState(false);
|
|
1485
|
+
const [internalInputValue, setInternalInputValue] = React9.useState("");
|
|
1486
|
+
const skipNextInputChangeRef = React9.useRef(false);
|
|
1454
1487
|
const virtualizerRef = React9.useRef(null);
|
|
1455
1488
|
const isControlled = selectedItemIds !== void 0;
|
|
1456
1489
|
const idsToItems = React9.useCallback(
|
|
@@ -1469,6 +1502,18 @@ function MultiCombobox(props) {
|
|
|
1469
1502
|
() => groupBy ? groupItems(visibleData, groupBy) : null,
|
|
1470
1503
|
[visibleData, groupBy]
|
|
1471
1504
|
);
|
|
1505
|
+
const currentInputValue = inputValue ?? internalInputValue;
|
|
1506
|
+
const creatableSentinel = React9.useMemo(() => {
|
|
1507
|
+
if (!creatableProp) return null;
|
|
1508
|
+
const trimmed = currentInputValue.trim();
|
|
1509
|
+
if (!trimmed) return null;
|
|
1510
|
+
const lowered = trimmed.toLocaleLowerCase();
|
|
1511
|
+
const exactExists = data.some(
|
|
1512
|
+
(d) => itemToString(d).trim().toLocaleLowerCase() === lowered
|
|
1513
|
+
);
|
|
1514
|
+
if (exactExists) return null;
|
|
1515
|
+
return makeCreatableSentinel(trimmed);
|
|
1516
|
+
}, [creatableProp, currentInputValue, data, itemToString]);
|
|
1472
1517
|
const flatItems = React9.useMemo(() => {
|
|
1473
1518
|
if (!selectHeadings && !selectAll) return null;
|
|
1474
1519
|
if (!groups && !selectAll) return null;
|
|
@@ -1490,6 +1535,18 @@ function MultiCombobox(props) {
|
|
|
1490
1535
|
onSelectedItemIdsChange(items.map((item) => item.id));
|
|
1491
1536
|
}
|
|
1492
1537
|
function handleValueChange(next) {
|
|
1538
|
+
const creatableClicked = next.find(isCreatableSentinel);
|
|
1539
|
+
if (creatableClicked) {
|
|
1540
|
+
const newItem = onCreateProp?.(creatableClicked.label);
|
|
1541
|
+
const realItems2 = next.filter(
|
|
1542
|
+
(v) => !isGroupHeaderSentinel2(v) && !isSelectAllSentinel2(v) && !isCreatableSentinel(v)
|
|
1543
|
+
);
|
|
1544
|
+
setSelectedItems(newItem ? [...realItems2, newItem] : realItems2);
|
|
1545
|
+
skipNextInputChangeRef.current = true;
|
|
1546
|
+
setInternalInputValue("");
|
|
1547
|
+
onInputValueChange?.("");
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1493
1550
|
const selectAllClicked = next.filter(isSelectAllSentinel2);
|
|
1494
1551
|
const groupSentinels = next.filter(isGroupHeaderSentinel2);
|
|
1495
1552
|
const realItems = next.filter(
|
|
@@ -1527,6 +1584,16 @@ function MultiCombobox(props) {
|
|
|
1527
1584
|
setSelectedItems(updated);
|
|
1528
1585
|
}
|
|
1529
1586
|
function handleSimpleValueChange(newItems) {
|
|
1587
|
+
const creatableClicked = newItems.find(isCreatableSentinel);
|
|
1588
|
+
if (creatableClicked) {
|
|
1589
|
+
const newItem = onCreateProp?.(creatableClicked.label);
|
|
1590
|
+
const realItems = newItems.filter((v) => !isCreatableSentinel(v));
|
|
1591
|
+
setSelectedItems(newItem ? [...realItems, newItem] : realItems);
|
|
1592
|
+
skipNextInputChangeRef.current = true;
|
|
1593
|
+
setInternalInputValue("");
|
|
1594
|
+
onInputValueChange?.("");
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1530
1597
|
setSelectedItems(newItems);
|
|
1531
1598
|
}
|
|
1532
1599
|
function removeItem(item, e) {
|
|
@@ -1562,6 +1629,9 @@ function MultiCombobox(props) {
|
|
|
1562
1629
|
renderGroupHeading ? renderGroupHeading(row.groupName) : row.groupName
|
|
1563
1630
|
] }, `__header-${row.groupName}`);
|
|
1564
1631
|
}
|
|
1632
|
+
if (isCreatableSentinel(row)) {
|
|
1633
|
+
return renderCreatableItem(row);
|
|
1634
|
+
}
|
|
1565
1635
|
const item = row;
|
|
1566
1636
|
return /* @__PURE__ */ jsx9(
|
|
1567
1637
|
ComboboxItem_default,
|
|
@@ -1576,7 +1646,28 @@ function MultiCombobox(props) {
|
|
|
1576
1646
|
item.id
|
|
1577
1647
|
);
|
|
1578
1648
|
}
|
|
1579
|
-
|
|
1649
|
+
function renderCreatableItem(sentinel, style, index, measureRef) {
|
|
1650
|
+
return /* @__PURE__ */ jsx9(
|
|
1651
|
+
ComboboxItem_default,
|
|
1652
|
+
{
|
|
1653
|
+
value: sentinel,
|
|
1654
|
+
itemId: "__creatable",
|
|
1655
|
+
label: `Create "${sentinel.label}"`,
|
|
1656
|
+
inputType: "none",
|
|
1657
|
+
renderItem: () => /* @__PURE__ */ jsxs7(Fragment6, { children: [
|
|
1658
|
+
/* @__PURE__ */ jsx9(Icon3, { name: "plus-outline", size: "mini" }),
|
|
1659
|
+
`Create "${sentinel.label}"`
|
|
1660
|
+
] }),
|
|
1661
|
+
style,
|
|
1662
|
+
index,
|
|
1663
|
+
"data-index": index,
|
|
1664
|
+
ref: measureRef
|
|
1665
|
+
},
|
|
1666
|
+
"__creatable"
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
const baseItems = flatItems ?? groups ?? (isChildrenMode ? void 0 : visibleData);
|
|
1670
|
+
const rootItems = creatableSentinel && Array.isArray(baseItems) ? [...baseItems, creatableSentinel] : baseItems;
|
|
1580
1671
|
const hasSentinels = selectAll || selectHeadings;
|
|
1581
1672
|
const rootValue = hasSentinels ? [...value] : value;
|
|
1582
1673
|
return /* @__PURE__ */ jsxs7(Field, { children: [
|
|
@@ -1593,9 +1684,23 @@ function MultiCombobox(props) {
|
|
|
1593
1684
|
if (!nextOpen && eventDetails.reason === "item-press") return;
|
|
1594
1685
|
setOpen(nextOpen);
|
|
1595
1686
|
},
|
|
1596
|
-
filter,
|
|
1597
|
-
|
|
1598
|
-
|
|
1687
|
+
filter: creatableProp ? (item, query) => {
|
|
1688
|
+
if (isCreatableSentinel(item)) return true;
|
|
1689
|
+
if (filter) return filter(item, query);
|
|
1690
|
+
if (isGroupHeaderSentinel2(item) || isSelectAllSentinel2(item))
|
|
1691
|
+
return true;
|
|
1692
|
+
const label = itemToString(item);
|
|
1693
|
+
return label.toLowerCase().includes(query.toLowerCase());
|
|
1694
|
+
} : filter,
|
|
1695
|
+
inputValue: creatableProp ? currentInputValue : inputValue,
|
|
1696
|
+
onInputValueChange: creatableProp ? (v) => {
|
|
1697
|
+
if (skipNextInputChangeRef.current) {
|
|
1698
|
+
skipNextInputChangeRef.current = false;
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
setInternalInputValue(v);
|
|
1702
|
+
onInputValueChange?.(v);
|
|
1703
|
+
} : onInputValueChange,
|
|
1599
1704
|
onItemHighlighted: isVirtualized ? (item, { reason, index }) => {
|
|
1600
1705
|
const virt = virtualizerRef.current;
|
|
1601
1706
|
if (!item || !virt) return;
|
|
@@ -1615,15 +1720,17 @@ function MultiCombobox(props) {
|
|
|
1615
1720
|
hasSentinels ? handleValueChange : handleSimpleValueChange
|
|
1616
1721
|
),
|
|
1617
1722
|
itemToStringLabel: (item) => {
|
|
1618
|
-
if (!item || isGroupHeaderSentinel2(item) || isSelectAllSentinel2(item))
|
|
1723
|
+
if (!item || isGroupHeaderSentinel2(item) || isSelectAllSentinel2(item) || isCreatableSentinel(item))
|
|
1619
1724
|
return "";
|
|
1620
1725
|
return itemToString(item);
|
|
1621
1726
|
},
|
|
1622
1727
|
isItemEqualToValue: (a, b) => {
|
|
1728
|
+
if (isCreatableSentinel(a) && isCreatableSentinel(b))
|
|
1729
|
+
return a.label === b.label;
|
|
1623
1730
|
if (isGroupHeaderSentinel2(a) && isGroupHeaderSentinel2(b))
|
|
1624
1731
|
return a.groupName === b.groupName;
|
|
1625
1732
|
if (isSelectAllSentinel2(a) && isSelectAllSentinel2(b)) return true;
|
|
1626
|
-
if (!isGroupHeaderSentinel2(a) && !isSelectAllSentinel2(a) && !isGroupHeaderSentinel2(b) && !isSelectAllSentinel2(b))
|
|
1733
|
+
if (!isGroupHeaderSentinel2(a) && !isSelectAllSentinel2(a) && !isCreatableSentinel(a) && !isGroupHeaderSentinel2(b) && !isSelectAllSentinel2(b) && !isCreatableSentinel(b))
|
|
1627
1734
|
return a.id === b.id;
|
|
1628
1735
|
return false;
|
|
1629
1736
|
},
|
|
@@ -1656,7 +1763,8 @@ function MultiCombobox(props) {
|
|
|
1656
1763
|
ComboboxTokenInput,
|
|
1657
1764
|
{
|
|
1658
1765
|
id,
|
|
1659
|
-
placeholder: value.length > 0 ? "" : placeholder
|
|
1766
|
+
placeholder: value.length > 0 ? "" : placeholder,
|
|
1767
|
+
"aria-describedby": ariaDescribedBy
|
|
1660
1768
|
}
|
|
1661
1769
|
),
|
|
1662
1770
|
/* @__PURE__ */ jsxs7(ComboboxActionButtons, { children: [
|
|
@@ -1693,37 +1801,55 @@ function MultiCombobox(props) {
|
|
|
1693
1801
|
itemToString,
|
|
1694
1802
|
inputType,
|
|
1695
1803
|
renderItem,
|
|
1696
|
-
renderGroupHeading
|
|
1804
|
+
renderGroupHeading,
|
|
1805
|
+
renderCreatableItem: creatableProp ? (sentinel, style, index, measureRef) => renderCreatableItem(
|
|
1806
|
+
sentinel,
|
|
1807
|
+
style,
|
|
1808
|
+
index,
|
|
1809
|
+
measureRef
|
|
1810
|
+
) : void 0
|
|
1697
1811
|
}
|
|
1698
|
-
) : children ? children : flatItems ? (row) => renderSentinelRow(row) : groups ? (group, index) =>
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}
|
|
1725
|
-
item
|
|
1726
|
-
|
|
1812
|
+
) : children ? children : flatItems ? (row) => renderSentinelRow(row) : groups ? (group, index) => {
|
|
1813
|
+
if (isCreatableSentinel(group)) {
|
|
1814
|
+
return renderCreatableItem(group);
|
|
1815
|
+
}
|
|
1816
|
+
const g = group;
|
|
1817
|
+
return /* @__PURE__ */ jsxs7(React9.Fragment, { children: [
|
|
1818
|
+
/* @__PURE__ */ jsxs7(ComboboxGroup, { items: g.items, children: [
|
|
1819
|
+
/* @__PURE__ */ jsx9(ComboboxGroupLabel, { children: renderGroupHeading ? renderGroupHeading(g.value) : g.value }),
|
|
1820
|
+
/* @__PURE__ */ jsx9(Combobox4.Collection, { children: (item) => /* @__PURE__ */ jsx9(
|
|
1821
|
+
ComboboxItem_default,
|
|
1822
|
+
{
|
|
1823
|
+
value: item,
|
|
1824
|
+
itemId: String(item.id),
|
|
1825
|
+
label: itemToString(item),
|
|
1826
|
+
disabled: item.disabled,
|
|
1827
|
+
inputType,
|
|
1828
|
+
renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
|
|
1829
|
+
},
|
|
1830
|
+
item.id
|
|
1831
|
+
) })
|
|
1832
|
+
] }),
|
|
1833
|
+
index < groups.length - 1 && /* @__PURE__ */ jsx9(ComboboxSeparator, {})
|
|
1834
|
+
] }, g.value);
|
|
1835
|
+
} : (item) => {
|
|
1836
|
+
if (isCreatableSentinel(item)) {
|
|
1837
|
+
return renderCreatableItem(item);
|
|
1838
|
+
}
|
|
1839
|
+
const dataItem = item;
|
|
1840
|
+
return /* @__PURE__ */ jsx9(
|
|
1841
|
+
ComboboxItem_default,
|
|
1842
|
+
{
|
|
1843
|
+
value: dataItem,
|
|
1844
|
+
itemId: String(dataItem.id),
|
|
1845
|
+
label: itemToString(dataItem),
|
|
1846
|
+
disabled: dataItem.disabled,
|
|
1847
|
+
inputType,
|
|
1848
|
+
renderItem: renderItem ? () => renderItem(dataItem) : () => itemToString(dataItem)
|
|
1849
|
+
},
|
|
1850
|
+
dataItem.id
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1727
1853
|
}
|
|
1728
1854
|
)
|
|
1729
1855
|
]
|
|
@@ -1751,6 +1877,7 @@ function SingleSearchableSelect(props) {
|
|
|
1751
1877
|
loadingText = "Loading...",
|
|
1752
1878
|
filter
|
|
1753
1879
|
} = props;
|
|
1880
|
+
const ariaDescribedBy = props["aria-describedby"];
|
|
1754
1881
|
const isChildrenMode = "children" in props && props.children != null;
|
|
1755
1882
|
const data = isChildrenMode ? [] : props.data;
|
|
1756
1883
|
const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
|
|
@@ -1825,7 +1952,7 @@ function SingleSearchableSelect(props) {
|
|
|
1825
1952
|
}
|
|
1826
1953
|
} : void 0,
|
|
1827
1954
|
children: [
|
|
1828
|
-
/* @__PURE__ */ jsxs8(SearchableSelectTrigger, { id, children: [
|
|
1955
|
+
/* @__PURE__ */ jsxs8(SearchableSelectTrigger, { id, "aria-describedby": ariaDescribedBy, children: [
|
|
1829
1956
|
/* @__PURE__ */ jsx10(SearchableSelectPlaceholder, { children: /* @__PURE__ */ jsx10(Combobox5.Value, { placeholder, children: value ? renderSelection ? renderSelection(value) : itemToString(value) : placeholder }) }),
|
|
1830
1957
|
/* @__PURE__ */ jsx10(SearchableSelectTriggerIcon, { children: /* @__PURE__ */ jsx10(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx10(ChevronIcon, {}) }) })
|
|
1831
1958
|
] }),
|
|
@@ -1950,6 +2077,7 @@ function MultiSearchableSelect(props) {
|
|
|
1950
2077
|
loadingText = "Loading...",
|
|
1951
2078
|
filter
|
|
1952
2079
|
} = props;
|
|
2080
|
+
const ariaDescribedBy = props["aria-describedby"];
|
|
1953
2081
|
const isChildrenMode = "children" in props && props.children != null;
|
|
1954
2082
|
const data = isChildrenMode ? [] : props.data;
|
|
1955
2083
|
const itemToString = isChildrenMode ? (_item) => "" : props.itemToString;
|
|
@@ -2133,20 +2261,27 @@ function MultiSearchableSelect(props) {
|
|
|
2133
2261
|
},
|
|
2134
2262
|
items: rootItems,
|
|
2135
2263
|
children: [
|
|
2136
|
-
/* @__PURE__ */ jsxs9(
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2264
|
+
/* @__PURE__ */ jsxs9(
|
|
2265
|
+
SearchableSelectTokenTrigger,
|
|
2266
|
+
{
|
|
2267
|
+
id,
|
|
2268
|
+
"aria-describedby": ariaDescribedBy,
|
|
2269
|
+
children: [
|
|
2270
|
+
renderSelection ? renderSelection(value) : value.length > 0 ? (() => {
|
|
2271
|
+
const visibleItems = maxSelections != null ? value.slice(0, maxSelections) : value;
|
|
2272
|
+
const overflowCount = maxSelections != null && value.length > maxSelections ? value.length - maxSelections : 0;
|
|
2273
|
+
const text = visibleItems.map(
|
|
2274
|
+
(item) => customRenderSelections ? customRenderSelections(item) : itemToString(item)
|
|
2275
|
+
).join(", ");
|
|
2276
|
+
return /* @__PURE__ */ jsxs9(SelectionText2, { children: [
|
|
2277
|
+
text,
|
|
2278
|
+
overflowCount > 0 ? `, +${overflowCount}` : ""
|
|
2279
|
+
] });
|
|
2280
|
+
})() : /* @__PURE__ */ jsx11(SearchableSelectPlaceholder, { children: placeholder }),
|
|
2281
|
+
/* @__PURE__ */ jsx11(SearchableSelectTriggerIcon, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx11(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx11(ChevronIcon, {}) }) })
|
|
2282
|
+
]
|
|
2283
|
+
}
|
|
2284
|
+
),
|
|
2150
2285
|
/* @__PURE__ */ jsx11(Combobox6.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx11(ComboboxPositioner, { sideOffset: 4, children: /* @__PURE__ */ jsxs9(
|
|
2151
2286
|
SearchableSelectPopup,
|
|
2152
2287
|
{
|