@sproutsocial/seeds-react-menu 1.7.12 → 1.7.13
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 +6 -0
- package/dist/esm/v2/index.js +44 -26
- package/dist/esm/v2/index.js.map +1 -1
- package/dist/v2/index.js +44 -26
- package/dist/v2/index.js.map +1 -1
- package/package.json +1 -1
- package/src/v2/Autocomplete/MultiAutocomplete.tsx +16 -6
- package/src/v2/Autocomplete/SingleAutocomplete.tsx +23 -27
- package/src/v2/Common-V2/Popout.tsx +3 -1
- package/src/v2/Select/MultiSelect.tsx +7 -2
- package/src/v2/Select/SingleSelect.tsx +7 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,22 +8,22 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[32m90.48 KB[39m
|
|
12
|
-
[32mCJS[39m [1mdist/v2/index.js [22m[32m70.74 KB[39m
|
|
13
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m176.30 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m146.40 KB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in 381ms
|
|
16
11
|
[32mESM[39m [1mdist/esm/index.js [22m[32m71.37 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m60.77 KB[39m
|
|
17
13
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js [22m[32m9.15 KB[39m
|
|
18
|
-
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m60.19 KB[39m
|
|
19
14
|
[32mESM[39m [1mdist/esm/index.js.map [22m[32m152.31 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/esm/v2/index.js.map [22m[32m128.10 KB[39m
|
|
20
16
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js.map [22m[32m22.93 KB[39m
|
|
21
|
-
[32mESM[39m
|
|
22
|
-
[
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 327ms
|
|
18
|
+
[32mCJS[39m [1mdist/index.js [22m[32m90.48 KB[39m
|
|
19
|
+
[32mCJS[39m [1mdist/v2/index.js [22m[32m71.31 KB[39m
|
|
20
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m176.30 KB[39m
|
|
21
|
+
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m147.74 KB[39m
|
|
22
|
+
[32mCJS[39m ⚡️ Build success in 329ms
|
|
23
23
|
[34mDTS[39m Build start
|
|
24
|
-
[32mDTS[39m ⚡️ Build success in
|
|
24
|
+
[32mDTS[39m ⚡️ Build success in 16527ms
|
|
25
25
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m39.04 KB[39m
|
|
26
26
|
[32mDTS[39m [1mdist/v2/index.d.ts [22m[32m4.87 KB[39m
|
|
27
27
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m39.04 KB[39m
|
|
28
28
|
[32mDTS[39m [1mdist/v2/index.d.mts [22m[32m4.87 KB[39m
|
|
29
|
-
Done in 18.
|
|
29
|
+
Done in 18.11s.
|
package/CHANGELOG.md
CHANGED
package/dist/esm/v2/index.js
CHANGED
|
@@ -216,7 +216,7 @@ function Popout({
|
|
|
216
216
|
const radixRef = React2.useRef(null);
|
|
217
217
|
return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, onOpenChange: popoverOnOpenChange, children: [
|
|
218
218
|
/* @__PURE__ */ jsx(Popover.Trigger, { ref: radixRef, asChild: true, children }),
|
|
219
|
-
/* @__PURE__ */ jsx(Popover.Anchor, {}),
|
|
219
|
+
/* @__PURE__ */ jsx(Popover.Anchor, { children: /* @__PURE__ */ jsx("div", { style: { height: "1px" }, children: "\xA0" }) }),
|
|
220
220
|
/* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(
|
|
221
221
|
StyledContent,
|
|
222
222
|
{
|
|
@@ -1055,7 +1055,12 @@ function SingleSelect({
|
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
1057
1057
|
const dataItem = item;
|
|
1058
|
-
const itemIndex = itemsForSelect.
|
|
1058
|
+
const itemIndex = itemsForSelect.findIndex((selectItem) => {
|
|
1059
|
+
if (isToggleItem(selectItem)) {
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
1062
|
+
return itemToKey(selectItem) === itemToKey(dataItem);
|
|
1063
|
+
});
|
|
1059
1064
|
if (itemIndex === -1) {
|
|
1060
1065
|
return {};
|
|
1061
1066
|
}
|
|
@@ -1340,7 +1345,12 @@ function MultiSelect({
|
|
|
1340
1345
|
};
|
|
1341
1346
|
}
|
|
1342
1347
|
const dataItem = item;
|
|
1343
|
-
const itemIndex = itemsForSelect.
|
|
1348
|
+
const itemIndex = itemsForSelect.findIndex((selectItem) => {
|
|
1349
|
+
if (isGroupHeading(selectItem) || isToggleItem(selectItem)) {
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
return itemToKey(selectItem) === itemToKey(dataItem);
|
|
1353
|
+
});
|
|
1344
1354
|
if (itemIndex === -1) {
|
|
1345
1355
|
return {};
|
|
1346
1356
|
}
|
|
@@ -1439,10 +1449,14 @@ function SingleAutocomplete({
|
|
|
1439
1449
|
useEffect2(() => {
|
|
1440
1450
|
if (selectedItem && !isOpen) {
|
|
1441
1451
|
const selectedItemString = itemToString(selectedItem);
|
|
1442
|
-
if (!isInputValueControlled
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1452
|
+
if (!isInputValueControlled) {
|
|
1453
|
+
if (uncontrolledInputValue !== selectedItemString) {
|
|
1454
|
+
setUncontrolledInputValue(selectedItemString);
|
|
1455
|
+
}
|
|
1456
|
+
} else {
|
|
1457
|
+
if (inputValue !== selectedItemString) {
|
|
1458
|
+
onInputValueChange?.(selectedItemString);
|
|
1459
|
+
}
|
|
1446
1460
|
}
|
|
1447
1461
|
}
|
|
1448
1462
|
}, [
|
|
@@ -1450,7 +1464,9 @@ function SingleAutocomplete({
|
|
|
1450
1464
|
isOpen,
|
|
1451
1465
|
isInputValueControlled,
|
|
1452
1466
|
itemToString,
|
|
1453
|
-
uncontrolledInputValue
|
|
1467
|
+
uncontrolledInputValue,
|
|
1468
|
+
inputValue,
|
|
1469
|
+
onInputValueChange
|
|
1454
1470
|
]);
|
|
1455
1471
|
const updateSelectedItem = (newSelectedItem) => {
|
|
1456
1472
|
const newSelectedItemId = newSelectedItem ? itemToKey(newSelectedItem) : null;
|
|
@@ -1528,7 +1544,7 @@ function SingleAutocomplete({
|
|
|
1528
1544
|
selectedItem: newSelectedItem,
|
|
1529
1545
|
isOpen: newIsOpen
|
|
1530
1546
|
}) {
|
|
1531
|
-
if (newIsOpen !== void 0
|
|
1547
|
+
if (newIsOpen !== void 0) {
|
|
1532
1548
|
updateIsOpen(newIsOpen);
|
|
1533
1549
|
}
|
|
1534
1550
|
switch (type) {
|
|
@@ -1578,12 +1594,6 @@ function SingleAutocomplete({
|
|
|
1578
1594
|
inputProps["aria-controls"] = void 0;
|
|
1579
1595
|
}
|
|
1580
1596
|
const { ref, id: inputId, ...restProps } = inputProps;
|
|
1581
|
-
const handleBlur = (e) => {
|
|
1582
|
-
if (inputProps.onBlur) {
|
|
1583
|
-
inputProps.onBlur(e);
|
|
1584
|
-
}
|
|
1585
|
-
updateIsOpen(false);
|
|
1586
|
-
};
|
|
1587
1597
|
return /* @__PURE__ */ jsx9(
|
|
1588
1598
|
Popout,
|
|
1589
1599
|
{
|
|
@@ -1604,7 +1614,12 @@ function SingleAutocomplete({
|
|
|
1604
1614
|
getItemProps: (props) => {
|
|
1605
1615
|
const item = items[props.index];
|
|
1606
1616
|
const dataItem = item;
|
|
1607
|
-
const itemIndex = itemsForCombobox.
|
|
1617
|
+
const itemIndex = itemsForCombobox.findIndex((comboboxItem) => {
|
|
1618
|
+
if (isToggleItem(comboboxItem)) {
|
|
1619
|
+
return false;
|
|
1620
|
+
}
|
|
1621
|
+
return itemToKey(comboboxItem) === itemToKey(dataItem);
|
|
1622
|
+
});
|
|
1608
1623
|
if (itemIndex === -1) {
|
|
1609
1624
|
return {};
|
|
1610
1625
|
}
|
|
@@ -1630,9 +1645,7 @@ function SingleAutocomplete({
|
|
|
1630
1645
|
{
|
|
1631
1646
|
id,
|
|
1632
1647
|
inputProps: {
|
|
1633
|
-
|
|
1634
|
-
autoComplete: "off",
|
|
1635
|
-
onBlur: handleBlur
|
|
1648
|
+
autoComplete: "off"
|
|
1636
1649
|
},
|
|
1637
1650
|
innerRef: ref,
|
|
1638
1651
|
placeholder,
|
|
@@ -1642,8 +1655,7 @@ function SingleAutocomplete({
|
|
|
1642
1655
|
updateSelectedItem(null);
|
|
1643
1656
|
updateInputValue("");
|
|
1644
1657
|
},
|
|
1645
|
-
...restProps
|
|
1646
|
-
onBlur: handleBlur
|
|
1658
|
+
...restProps
|
|
1647
1659
|
}
|
|
1648
1660
|
)
|
|
1649
1661
|
}
|
|
@@ -1653,12 +1665,16 @@ function SingleAutocomplete({
|
|
|
1653
1665
|
// src/v2/Autocomplete/MultiAutocomplete.tsx
|
|
1654
1666
|
import { useState as useState5, useMemo as useMemo6 } from "react";
|
|
1655
1667
|
import { useCombobox as useCombobox2, useMultipleSelection as useMultipleSelection2 } from "downshift";
|
|
1656
|
-
import "@sproutsocial/seeds-react-label";
|
|
1657
1668
|
import { TokenInput } from "@sproutsocial/seeds-react-token-input";
|
|
1658
1669
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1659
1670
|
function defaultReducer4(state, actionAndChanges) {
|
|
1660
1671
|
const { changes, type } = actionAndChanges;
|
|
1661
1672
|
switch (type) {
|
|
1673
|
+
case useCombobox2.stateChangeTypes.InputBlur:
|
|
1674
|
+
return {
|
|
1675
|
+
...changes,
|
|
1676
|
+
isOpen: true
|
|
1677
|
+
};
|
|
1662
1678
|
case useCombobox2.stateChangeTypes.InputKeyDownEnter:
|
|
1663
1679
|
case useCombobox2.stateChangeTypes.ItemClick:
|
|
1664
1680
|
return {
|
|
@@ -1835,7 +1851,6 @@ function MultiAutocomplete({
|
|
|
1835
1851
|
} else {
|
|
1836
1852
|
updateSelectedItems([...data]);
|
|
1837
1853
|
}
|
|
1838
|
-
updateInputValue("");
|
|
1839
1854
|
} else if (selectHeadings && groupBy && isGroupHeading(newSelectedItem)) {
|
|
1840
1855
|
const groupLabel = newSelectedItem.label;
|
|
1841
1856
|
const groupItems2 = data.filter(
|
|
@@ -1853,7 +1868,6 @@ function MultiAutocomplete({
|
|
|
1853
1868
|
];
|
|
1854
1869
|
updateSelectedItems(newItems);
|
|
1855
1870
|
}
|
|
1856
|
-
updateInputValue("");
|
|
1857
1871
|
} else if (!isGroupHeading(newSelectedItem) && !isToggleItem(newSelectedItem)) {
|
|
1858
1872
|
const itemIndex = selectedItems.findIndex(
|
|
1859
1873
|
(item) => itemToKey(item) === itemToKey(newSelectedItem)
|
|
@@ -1865,7 +1879,6 @@ function MultiAutocomplete({
|
|
|
1865
1879
|
} else {
|
|
1866
1880
|
updateSelectedItems([...selectedItems, newSelectedItem]);
|
|
1867
1881
|
}
|
|
1868
|
-
updateInputValue("");
|
|
1869
1882
|
}
|
|
1870
1883
|
}
|
|
1871
1884
|
break;
|
|
@@ -1903,6 +1916,7 @@ function MultiAutocomplete({
|
|
|
1903
1916
|
if (inputProps.onBlur) {
|
|
1904
1917
|
inputProps.onBlur(e);
|
|
1905
1918
|
}
|
|
1919
|
+
updateIsOpen(false);
|
|
1906
1920
|
};
|
|
1907
1921
|
const inputPropsToSpread = { ...inputProps };
|
|
1908
1922
|
delete inputPropsToSpread.onBlur;
|
|
@@ -1985,7 +1999,11 @@ function MultiAutocomplete({
|
|
|
1985
1999
|
onClickToken: (e) => {
|
|
1986
2000
|
e.stopPropagation();
|
|
1987
2001
|
},
|
|
1988
|
-
onBlur: handleBlur
|
|
2002
|
+
onBlur: handleBlur,
|
|
2003
|
+
"aria-controls": void 0,
|
|
2004
|
+
"aria-expanded": void 0,
|
|
2005
|
+
"aria-haspopup": void 0,
|
|
2006
|
+
type: void 0
|
|
1989
2007
|
}
|
|
1990
2008
|
)
|
|
1991
2009
|
}
|