@sproutsocial/seeds-react-menu 1.7.11 → 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.
@@ -8,22 +8,22 @@ $ tsup --dts
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 90.48 KB
12
- CJS dist/v2/index.js 70.74 KB
13
- CJS dist/v2/index.js.map 146.40 KB
14
- CJS dist/index.js.map 176.30 KB
15
- CJS ⚡️ Build success in 328ms
16
- ESM dist/esm/v2/index.js 60.19 KB
17
- ESM dist/esm/chunk-ROQATIB7.js 9.15 KB
18
11
  ESM dist/esm/index.js 71.37 KB
19
- ESM dist/esm/v2/index.js.map 126.72 KB
20
- ESM dist/esm/chunk-ROQATIB7.js.map 22.93 KB
12
+ ESM dist/esm/v2/index.js 60.77 KB
13
+ ESM dist/esm/chunk-ROQATIB7.js 9.15 KB
21
14
  ESM dist/esm/index.js.map 152.31 KB
22
- ESM ⚡️ Build success in 329ms
15
+ ESM dist/esm/v2/index.js.map 128.10 KB
16
+ ESM dist/esm/chunk-ROQATIB7.js.map 22.93 KB
17
+ ESM ⚡️ Build success in 327ms
18
+ CJS dist/index.js 90.48 KB
19
+ CJS dist/v2/index.js 71.31 KB
20
+ CJS dist/index.js.map 176.30 KB
21
+ CJS dist/v2/index.js.map 147.74 KB
22
+ CJS ⚡️ Build success in 329ms
23
23
  DTS Build start
24
- DTS ⚡️ Build success in 16193ms
24
+ DTS ⚡️ Build success in 16527ms
25
25
  DTS dist/index.d.ts 39.04 KB
26
26
  DTS dist/v2/index.d.ts 4.87 KB
27
27
  DTS dist/index.d.mts 39.04 KB
28
28
  DTS dist/v2/index.d.mts 4.87 KB
29
- Done in 17.63s.
29
+ Done in 18.11s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @sproutsocial/seeds-react-menu
2
2
 
3
+ ## 1.7.13
4
+
5
+ ### Patch Changes
6
+
7
+ - b57173d: Fixes for multiselect
8
+
9
+ ## 1.7.12
10
+
11
+ ### Patch Changes
12
+
13
+ - @sproutsocial/seeds-react-checkbox@1.3.17
14
+ - @sproutsocial/seeds-react-input@1.4.20
15
+ - @sproutsocial/seeds-react-label@1.0.11
16
+ - @sproutsocial/seeds-react-radio@1.3.10
17
+ - @sproutsocial/seeds-react-token-input@1.4.20
18
+
3
19
  ## 1.7.11
4
20
 
5
21
  ### Patch Changes
@@ -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.indexOf(dataItem);
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.indexOf(dataItem);
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 && uncontrolledInputValue !== selectedItemString) {
1443
- setUncontrolledInputValue(selectedItemString);
1444
- } else if (isInputValueControlled && inputValue !== selectedItemString) {
1445
- updateInputValue(selectedItemString);
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 && type !== useCombobox.stateChangeTypes.InputBlur) {
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.indexOf(dataItem);
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
- ...restProps,
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
  }