@sproutsocial/seeds-react-menu 1.11.2 → 1.11.4

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,28 +8,28 @@ $ tsup --dts
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- ESM dist/esm/v2/index.js 62.63 KB
12
- ESM dist/esm/index.js 73.57 KB
13
- ESM dist/esm/v3/index.js 79.98 KB
14
- ESM dist/esm/chunk-ROQATIB7.js 9.15 KB
15
- ESM dist/esm/v2/index.js.map 132.57 KB
16
- ESM dist/esm/index.js.map 156.22 KB
17
- ESM dist/esm/v3/index.js.map 156.55 KB
18
- ESM dist/esm/chunk-ROQATIB7.js.map 22.93 KB
19
- ESM ⚡️ Build success in 86ms
20
11
  CJS dist/index.js 92.62 KB
21
- CJS dist/v3/index.js 91.02 KB
22
12
  CJS dist/v2/index.js 73.18 KB
13
+ CJS dist/v3/index.js 93.61 KB
23
14
  CJS dist/index.js.map 180.20 KB
24
- CJS dist/v3/index.js.map 156.57 KB
25
15
  CJS dist/v2/index.js.map 152.19 KB
26
- CJS ⚡️ Build success in 86ms
16
+ CJS dist/v3/index.js.map 161.54 KB
17
+ CJS ⚡️ Build success in 117ms
18
+ ESM dist/esm/index.js 73.57 KB
19
+ ESM dist/esm/v3/index.js 82.46 KB
20
+ ESM dist/esm/chunk-ROQATIB7.js 9.15 KB
21
+ ESM dist/esm/v2/index.js 62.63 KB
22
+ ESM dist/esm/index.js.map 156.22 KB
23
+ ESM dist/esm/chunk-ROQATIB7.js.map 22.93 KB
24
+ ESM dist/esm/v3/index.js.map 161.58 KB
25
+ ESM dist/esm/v2/index.js.map 132.57 KB
26
+ ESM ⚡️ Build success in 117ms
27
27
  DTS Build start
28
- DTS ⚡️ Build success in 6472ms
28
+ DTS ⚡️ Build success in 6908ms
29
29
  DTS dist/index.d.ts 39.08 KB
30
30
  DTS dist/v2/index.d.ts 5.55 KB
31
- DTS dist/v3/index.d.ts 17.59 KB
31
+ DTS dist/v3/index.d.ts 17.65 KB
32
32
  DTS dist/index.d.mts 39.08 KB
33
33
  DTS dist/v2/index.d.mts 5.55 KB
34
- DTS dist/v3/index.d.mts 17.59 KB
35
- Done in 7.21s.
34
+ DTS dist/v3/index.d.mts 17.65 KB
35
+ Done in 7.71s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sproutsocial/seeds-react-menu
2
2
 
3
+ ## 1.11.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 1094671: ADd placeholder for single searchable select
8
+
9
+ ## 1.11.3
10
+
11
+ ### Patch Changes
12
+
13
+ - fe0d0f9: Include disabled items and placeholder items for all components
14
+
3
15
  ## 1.11.2
4
16
 
5
17
  ### Patch Changes
@@ -69,6 +69,7 @@ function CheckIcon() {
69
69
  function SelectItem({
70
70
  value,
71
71
  label,
72
+ disabled,
72
73
  inputType = "icon",
73
74
  renderItem,
74
75
  hidden
@@ -77,6 +78,7 @@ function SelectItem({
77
78
  StyledItem,
78
79
  {
79
80
  value,
81
+ disabled,
80
82
  style: hidden ? { display: "none" } : void 0,
81
83
  "data-qa-menu-item": label,
82
84
  children: [
@@ -138,6 +140,7 @@ var Field = styled2.div`
138
140
  display: flex;
139
141
  flex-direction: column;
140
142
  gap: ${({ theme }) => theme.space[200]};
143
+ width: 100%;
141
144
  `;
142
145
  var SelectLabel = styled2(Select2.Label)`
143
146
  font-size: ${({ theme }) => theme.typography[200].fontSize};
@@ -359,6 +362,7 @@ function SingleSelect(props) {
359
362
  {
360
363
  value: String(item.id),
361
364
  label: itemToString(item),
365
+ disabled: item.disabled,
362
366
  inputType,
363
367
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
364
368
  },
@@ -366,29 +370,27 @@ function SingleSelect(props) {
366
370
  ))
367
371
  ] }),
368
372
  index < arr.length - 1 && /* @__PURE__ */ jsx3(SelectSeparator, {})
369
- ] }, group.value)) : (
370
- // TODO: need to add a placeholder item when includePlaceholderItem is true
371
- /* @__PURE__ */ jsxs2(Fragment2, { children: [
372
- includePlaceholderItem && /* @__PURE__ */ jsx3(
373
- SelectItem,
374
- {
375
- value: null,
376
- label: placeholder ?? ""
377
- },
378
- "placeholder"
379
- ),
380
- data.map((item) => /* @__PURE__ */ jsx3(
381
- SelectItem,
382
- {
383
- value: String(item.id),
384
- label: itemToString(item),
385
- inputType,
386
- renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
387
- },
388
- item.id
389
- ))
390
- ] })
391
- ) }),
373
+ ] }, group.value)) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
374
+ includePlaceholderItem && /* @__PURE__ */ jsx3(
375
+ SelectItem,
376
+ {
377
+ value: null,
378
+ label: placeholder ?? ""
379
+ },
380
+ "placeholder"
381
+ ),
382
+ data.map((item) => /* @__PURE__ */ jsx3(
383
+ SelectItem,
384
+ {
385
+ value: String(item.id),
386
+ label: itemToString(item),
387
+ disabled: item.disabled,
388
+ inputType,
389
+ renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
390
+ },
391
+ item.id
392
+ ))
393
+ ] }) }),
392
394
  /* @__PURE__ */ jsx3(Select3.ScrollDownArrow, {})
393
395
  ] }) }) })
394
396
  ]
@@ -501,6 +503,7 @@ function MultiSelect(props) {
501
503
  {
502
504
  value: String(item.id),
503
505
  label: itemToString(item),
506
+ disabled: item.disabled,
504
507
  inputType,
505
508
  hidden: removeSelectedItems && value.includes(String(item.id)),
506
509
  renderItem: renderItem ? () => renderItem(item) : void 0
@@ -514,6 +517,7 @@ function MultiSelect(props) {
514
517
  {
515
518
  value: String(item.id),
516
519
  label: itemToString(item),
520
+ disabled: item.disabled,
517
521
  inputType,
518
522
  hidden: removeSelectedItems && value.includes(String(item.id)),
519
523
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
@@ -1012,6 +1016,7 @@ function ComboboxItemInner({
1012
1016
  value,
1013
1017
  itemId,
1014
1018
  label,
1019
+ disabled,
1015
1020
  inputType = "icon",
1016
1021
  renderItem,
1017
1022
  index,
@@ -1026,6 +1031,7 @@ function ComboboxItemInner({
1026
1031
  "data-index": dataIndex,
1027
1032
  style,
1028
1033
  ref,
1034
+ disabled,
1029
1035
  "data-qa-menu-item": label,
1030
1036
  children: [
1031
1037
  inputType === "radio" ? /* @__PURE__ */ jsx6(
@@ -1073,6 +1079,16 @@ var ComboboxItem_default = ComboboxItem2;
1073
1079
  import * as React7 from "react";
1074
1080
  import { Combobox as Combobox2 } from "@base-ui/react/combobox";
1075
1081
  import { useVirtualizer } from "@tanstack/react-virtual";
1082
+
1083
+ // src/v3/Common/sentinels.ts
1084
+ function makePlaceholderSentinel(label) {
1085
+ return { __placeholder: true, label };
1086
+ }
1087
+ function isPlaceholderSentinel(v) {
1088
+ return typeof v === "object" && v !== null && "__placeholder" in v;
1089
+ }
1090
+
1091
+ // src/v3/Common/VirtualizedComboboxList.tsx
1076
1092
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1077
1093
  var ITEM_HEIGHT = 32;
1078
1094
  function isGroupHeaderSentinel(v) {
@@ -1134,7 +1150,7 @@ function VirtualizedComboboxList({
1134
1150
  style: { position: "relative", width: "100%", height: totalSize },
1135
1151
  children: virtualizer.getVirtualItems().map((virtualItem) => {
1136
1152
  const row = filteredItems[virtualItem.index];
1137
- if (!row) return null;
1153
+ if (row == null) return null;
1138
1154
  const baseStyle = {
1139
1155
  position: "absolute",
1140
1156
  top: 0,
@@ -1143,6 +1159,22 @@ function VirtualizedComboboxList({
1143
1159
  transform: `translateY(${virtualItem.start}px)`,
1144
1160
  boxSizing: "border-box"
1145
1161
  };
1162
+ if (isPlaceholderSentinel(row)) {
1163
+ return /* @__PURE__ */ jsx7(
1164
+ ComboboxItem_default,
1165
+ {
1166
+ index: virtualItem.index,
1167
+ "data-index": virtualItem.index,
1168
+ value: row,
1169
+ itemId: "placeholder",
1170
+ label: row.label,
1171
+ inputType,
1172
+ style: baseStyle,
1173
+ ref: virtualizer.measureElement
1174
+ },
1175
+ "placeholder"
1176
+ );
1177
+ }
1146
1178
  if (isSelectAllSentinel(row)) {
1147
1179
  const selectedCount = selectedArray.length;
1148
1180
  const totalCount = data.length;
@@ -1201,6 +1233,7 @@ function VirtualizedComboboxList({
1201
1233
  value: item,
1202
1234
  itemId: String(item.id),
1203
1235
  label: itemToString(item),
1236
+ disabled: item.disabled,
1204
1237
  inputType,
1205
1238
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item),
1206
1239
  style: baseStyle,
@@ -1336,6 +1369,7 @@ function SingleCombobox(props) {
1336
1369
  value: item,
1337
1370
  itemId: String(item.id),
1338
1371
  label: itemToString(item),
1372
+ disabled: item.disabled,
1339
1373
  inputType,
1340
1374
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1341
1375
  },
@@ -1349,6 +1383,7 @@ function SingleCombobox(props) {
1349
1383
  value: item,
1350
1384
  itemId: String(item.id),
1351
1385
  label: itemToString(item),
1386
+ disabled: item.disabled,
1352
1387
  inputType,
1353
1388
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1354
1389
  },
@@ -1522,6 +1557,7 @@ function MultiCombobox(props) {
1522
1557
  value: item,
1523
1558
  itemId: String(item.id),
1524
1559
  label: itemToString(item),
1560
+ disabled: item.disabled,
1525
1561
  inputType,
1526
1562
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1527
1563
  },
@@ -1650,6 +1686,7 @@ function MultiCombobox(props) {
1650
1686
  value: item,
1651
1687
  itemId: String(item.id),
1652
1688
  label: itemToString(item),
1689
+ disabled: item.disabled,
1653
1690
  inputType,
1654
1691
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1655
1692
  },
@@ -1663,6 +1700,7 @@ function MultiCombobox(props) {
1663
1700
  value: item,
1664
1701
  itemId: String(item.id),
1665
1702
  label: itemToString(item),
1703
+ disabled: item.disabled,
1666
1704
  inputType,
1667
1705
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1668
1706
  },
@@ -1683,11 +1721,12 @@ function MultiCombobox(props) {
1683
1721
  import * as React10 from "react";
1684
1722
  import { Combobox as Combobox5 } from "@base-ui/react/combobox";
1685
1723
  import "@tanstack/react-virtual";
1686
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1724
+ import { Fragment as Fragment8, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1687
1725
  function SingleSearchableSelect(props) {
1688
1726
  const {
1689
1727
  id,
1690
1728
  placeholder = "Select...",
1729
+ includePlaceholderItem,
1691
1730
  searchPlaceholder = "Search...",
1692
1731
  emptyText = "No results found.",
1693
1732
  isLoading = false,
@@ -1722,9 +1761,10 @@ function SingleSearchableSelect(props) {
1722
1761
  );
1723
1762
  const value = isControlled ? idToItem(selectedItemId) : internalValue;
1724
1763
  function handleValueChange(newItem) {
1725
- if (!isControlled) setInternalValue(newItem);
1764
+ const realItem = newItem == null || isPlaceholderSentinel(newItem) ? null : newItem;
1765
+ if (!isControlled) setInternalValue(realItem);
1726
1766
  if (onSelectedItemIdChange) {
1727
- onSelectedItemIdChange(newItem ? newItem.id : null);
1767
+ onSelectedItemIdChange(realItem ? realItem.id : null);
1728
1768
  }
1729
1769
  }
1730
1770
  const groups = React10.useMemo(
@@ -1740,9 +1780,14 @@ function SingleSearchableSelect(props) {
1740
1780
  value,
1741
1781
  disabled: props.disabled,
1742
1782
  onValueChange: handleValueChange,
1743
- itemToStringLabel: itemToString,
1744
- isItemEqualToValue: (a, b) => a != null && b != null && a.id === b.id,
1745
- items: isVirtualized ? data : groups ?? (isChildrenMode ? void 0 : data),
1783
+ itemToStringLabel: (item) => isPlaceholderSentinel(item) ? item.label : itemToString(item),
1784
+ isItemEqualToValue: (a, b) => {
1785
+ if (isPlaceholderSentinel(a) && isPlaceholderSentinel(b)) return true;
1786
+ if (isPlaceholderSentinel(a)) return b == null;
1787
+ if (isPlaceholderSentinel(b)) return a == null;
1788
+ return a != null && b != null && a.id === b.id;
1789
+ },
1790
+ items: isVirtualized ? includePlaceholderItem ? [makePlaceholderSentinel(placeholder), ...data] : data : groups ?? (isChildrenMode ? void 0 : data),
1746
1791
  virtualized: isVirtualized,
1747
1792
  open,
1748
1793
  onOpenChange: setOpen,
@@ -1761,7 +1806,7 @@ function SingleSearchableSelect(props) {
1761
1806
  } : void 0,
1762
1807
  children: [
1763
1808
  /* @__PURE__ */ jsxs8(SearchableSelectTrigger, { id, children: [
1764
- /* @__PURE__ */ jsx10(SearchableSelectPlaceholder, { children: /* @__PURE__ */ jsx10(Combobox5.Value, { placeholder, children: value ? renderSelection ? renderSelection(value) : itemToString(value) : null }) }),
1809
+ /* @__PURE__ */ jsx10(SearchableSelectPlaceholder, { children: /* @__PURE__ */ jsx10(Combobox5.Value, { placeholder, children: value ? renderSelection ? renderSelection(value) : itemToString(value) : placeholder }) }),
1765
1810
  /* @__PURE__ */ jsx10(SearchableSelectTriggerIcon, { children: /* @__PURE__ */ jsx10(StyledChevron, { "data-chevron": true, children: /* @__PURE__ */ jsx10(ChevronIcon, {}) }) })
1766
1811
  ] }),
1767
1812
  /* @__PURE__ */ jsx10(Combobox5.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx10(ComboboxPositioner, { sideOffset: 4, children: /* @__PURE__ */ jsxs8(
@@ -1810,6 +1855,7 @@ function SingleSearchableSelect(props) {
1810
1855
  value: item,
1811
1856
  itemId: String(item.id),
1812
1857
  label: itemToString(item),
1858
+ disabled: item.disabled,
1813
1859
  inputType,
1814
1860
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
1815
1861
  },
@@ -1817,17 +1863,30 @@ function SingleSearchableSelect(props) {
1817
1863
  ) })
1818
1864
  ] }),
1819
1865
  index < groups.length - 1 && /* @__PURE__ */ jsx10(ComboboxSeparator, {})
1820
- ] }, group.value) : (item) => /* @__PURE__ */ jsx10(
1821
- ComboboxItem_default,
1822
- {
1823
- value: item,
1824
- itemId: String(item.id),
1825
- label: itemToString(item),
1826
- inputType,
1827
- renderItem: renderItem ? () => renderItem(item) : void 0
1828
- },
1829
- item.id
1830
- )
1866
+ ] }, group.value) : /* @__PURE__ */ jsxs8(Fragment8, { children: [
1867
+ includePlaceholderItem && /* @__PURE__ */ jsx10(
1868
+ ComboboxItem_default,
1869
+ {
1870
+ value: makePlaceholderSentinel(placeholder),
1871
+ itemId: "placeholder",
1872
+ label: placeholder,
1873
+ inputType
1874
+ },
1875
+ "placeholder"
1876
+ ),
1877
+ /* @__PURE__ */ jsx10(Combobox5.Collection, { children: (item) => /* @__PURE__ */ jsx10(
1878
+ ComboboxItem_default,
1879
+ {
1880
+ value: item,
1881
+ itemId: String(item.id),
1882
+ label: itemToString(item),
1883
+ disabled: item.disabled,
1884
+ inputType,
1885
+ renderItem: renderItem ? () => renderItem(item) : void 0
1886
+ },
1887
+ item.id
1888
+ ) })
1889
+ ] })
1831
1890
  }
1832
1891
  )
1833
1892
  ]
@@ -1998,6 +2057,7 @@ function MultiSearchableSelect(props) {
1998
2057
  value: item,
1999
2058
  itemId: String(item.id),
2000
2059
  label: itemToString(item),
2060
+ disabled: item.disabled,
2001
2061
  inputType,
2002
2062
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
2003
2063
  },
@@ -2112,6 +2172,7 @@ function MultiSearchableSelect(props) {
2112
2172
  value: item,
2113
2173
  itemId: String(item.id),
2114
2174
  label: itemToString(item),
2175
+ disabled: item.disabled,
2115
2176
  inputType,
2116
2177
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
2117
2178
  },
@@ -2125,6 +2186,7 @@ function MultiSearchableSelect(props) {
2125
2186
  value: item,
2126
2187
  itemId: String(item.id),
2127
2188
  label: itemToString(item),
2189
+ disabled: item.disabled,
2128
2190
  inputType,
2129
2191
  renderItem: renderItem ? () => renderItem(item) : () => itemToString(item)
2130
2192
  },