@sproutsocial/seeds-react-menu 0.6.0 → 1.0.0
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 +57 -0
- package/dist/esm/index.js +73 -30
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +34 -7
- package/dist/index.d.ts +34 -7
- package/dist/index.js +68 -25
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/ActionMenu/ActionMenu.stories.tsx +20 -24
- package/src/Autocomplete/MultiAutocomplete.tsx +0 -1
- package/src/Autocomplete/__tests__/Autocomplete.test.tsx +36 -0
- package/src/MenuContent/MenuContent.tsx +2 -0
- package/src/MenuContext.tsx +2 -1
- package/src/MenuFooter/styles.tsx +1 -1
- package/src/MenuGroup/MenuGroup.tsx +5 -1
- package/src/MenuGroup/styles.tsx +1 -1
- package/src/MenuHeader/MenuHeader.tsx +10 -7
- package/src/MenuHeader/styles.tsx +4 -0
- package/src/MenuItem/MenuItem.tsx +5 -1
- package/src/MenuItem/styles.tsx +4 -2
- package/src/MenuItem/useOptionProps.tsx +2 -2
- package/src/MenuRoot/MenuRoot.tsx +17 -3
- package/src/MenuSearchInput/MenuSearchInput.tsx +30 -8
- package/src/MenuSearchTokenInput/MenuSearchTokenInput.tsx +13 -3
- package/src/MultiSelectMenu/MultiSelectMenu.stories.tsx +51 -43
- package/src/NestedMenu/NestedMenuContent.tsx +5 -1
- package/src/NestedMenu/NestedMenuItem.tsx +5 -1
- package/src/SingleSelectMenu/SingleSelectMenu.stories.tsx +34 -28
- package/src/SubmenuItem/SubmenuItem.tsx +5 -1
- package/src/hooks/useDownshiftDefaults.tsx +11 -1
- package/src/hooks/useItemFiltering.tsx +2 -0
- package/src/hooks/useMenuChildren.tsx +11 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,14 +8,14 @@ CLI Target: es2022
|
|
|
8
8
|
CLI Cleaning output folder
|
|
9
9
|
CJS Build start
|
|
10
10
|
ESM Build start
|
|
11
|
-
CJS dist/index.js
|
|
12
|
-
CJS dist/index.js.map
|
|
13
|
-
CJS ⚡️ Build success in
|
|
14
|
-
ESM dist/esm/index.js
|
|
15
|
-
ESM dist/esm/index.js.map
|
|
16
|
-
ESM ⚡️ Build success in
|
|
11
|
+
CJS dist/index.js 127.24 KB
|
|
12
|
+
CJS dist/index.js.map 338.99 KB
|
|
13
|
+
CJS ⚡️ Build success in 552ms
|
|
14
|
+
ESM dist/esm/index.js 119.14 KB
|
|
15
|
+
ESM dist/esm/index.js.map 337.77 KB
|
|
16
|
+
ESM ⚡️ Build success in 565ms
|
|
17
17
|
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in
|
|
19
|
-
DTS dist/index.d.ts
|
|
20
|
-
DTS dist/index.d.mts
|
|
21
|
-
Done in
|
|
18
|
+
DTS ⚡️ Build success in 11080ms
|
|
19
|
+
DTS dist/index.d.ts 30.02 KB
|
|
20
|
+
DTS dist/index.d.mts 30.02 KB
|
|
21
|
+
Done in 14.90s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-menu
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 686f09d: Here's the initial stable version of the new Menu package!
|
|
8
|
+
The documentation for these new components is still a work in progress, but you can checkout examples of its usage in [our latest storybook instance](https://seeds-storybook-vite.netlify.app).
|
|
9
|
+
|
|
10
|
+
## Ready for use
|
|
11
|
+
|
|
12
|
+
These components have been tested and their APIs stable and ready for initial use.
|
|
13
|
+
|
|
14
|
+
- Primitives
|
|
15
|
+
- `MenuHeader` - a stylized region for the header of the menu
|
|
16
|
+
- `MenuContent` - the element used to wrap the list of options in the menu
|
|
17
|
+
- `MenuGroup` - a group element to wrap a list of items inside the content with an optional title
|
|
18
|
+
- `MenuItem` - to be used to compose each menu item in the list
|
|
19
|
+
- `MenuFooter` - a stylized region for the footer of the menu
|
|
20
|
+
- `MenuSearchInput` - a text search input for filtering the menu items
|
|
21
|
+
- `MenuSearchTokenInput` - a token input for searching and selecting items in a multiple select menu
|
|
22
|
+
- `MenuToggleButton` - an accessible button to handle opening and closing the menu
|
|
23
|
+
- `MenuLabel` - an accessible label to go along with a toggle button or autocomplete input
|
|
24
|
+
- Menus
|
|
25
|
+
- `ActionMenu` - perform an action using a dropdown with no selection state
|
|
26
|
+
- `SingleSelectMenu` - use a selection menu where only one item can be selected
|
|
27
|
+
- `MultiSelectMenu` - use a selection menu where multiple items may be selected
|
|
28
|
+
- `Autocomplete` - use a dropdown to perform autocomplete on an input
|
|
29
|
+
- `AutocompleteInput` - a custom toggle element for text inputs with autocomplete
|
|
30
|
+
- `AutcompleteTokenInput` - a custom toggle element for multiple selection with autocomplete
|
|
31
|
+
|
|
32
|
+
## Still Experimental
|
|
33
|
+
|
|
34
|
+
These components and utilities are stable enough to support the ready for use components, but may not be fully stable enough for individual use. Use with caution!
|
|
35
|
+
Future updates will stabilize these components for wider use.
|
|
36
|
+
|
|
37
|
+
- Primitives
|
|
38
|
+
- `MenuRoot` - the root of most of the menus which handles the Popout logic and initializing the menu's context data
|
|
39
|
+
- This currently includes the Popout but could go through API changes depending on if we keep the Popout embedded here
|
|
40
|
+
- The type for this may change, but should not affect the API of the Menus consuming it
|
|
41
|
+
- `useMenu`/`MenuContext` - used to drive and share data between the menu primitives
|
|
42
|
+
- This shared logic has the potential to change in order to resolve bugs, data inconsistency or performance concerns
|
|
43
|
+
- `SubmenuItem` - a menu item that can be used to open another menu, allowing for the use of submenus
|
|
44
|
+
- There are still a couple of outstanding bugs for this component
|
|
45
|
+
- This should be stable enough to start using, with bug fixes coming soon
|
|
46
|
+
- Menus
|
|
47
|
+
- `NestedMenu` - a nested menu with sliding panels similar to what currently exists in the web app
|
|
48
|
+
- We are still massaging the animation added to this component, but it will be ready soon
|
|
49
|
+
|
|
50
|
+
## Up Next
|
|
51
|
+
|
|
52
|
+
Here's what's coming soon but wasn't urgent for v1!
|
|
53
|
+
|
|
54
|
+
- Comprehensive seeds documentation as well as descriptive tsdocs for inline documentation
|
|
55
|
+
- Finishing off stable versions of the `SubmenuItem` and `NestedMenu`
|
|
56
|
+
- A `NestedFilterMenu` that can search all the items in a `NestedMenu`
|
|
57
|
+
- An `AutocompleteSelect` toggle element that can be used to create a searchable `Select` input
|
|
58
|
+
- Additional accessibility improvements and bug fixes
|
|
59
|
+
|
|
3
60
|
## 0.6.0
|
|
4
61
|
|
|
5
62
|
### Minor Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -141,7 +141,7 @@ var useMenu = ({
|
|
|
141
141
|
);
|
|
142
142
|
const isItemSelected = React.useCallback(
|
|
143
143
|
(id) => checkIfItemSelected({ id, selectedItem, selectedItemIds }),
|
|
144
|
-
[selectedItem, selectedItemIds]
|
|
144
|
+
[selectedItem?.id, selectedItemIds]
|
|
145
145
|
);
|
|
146
146
|
const getInputComponentProps = React.useCallback(
|
|
147
147
|
({ inputProps, ...props }) => {
|
|
@@ -1769,8 +1769,10 @@ var highlightedStyles = css4`
|
|
|
1769
1769
|
text-decoration: none;
|
|
1770
1770
|
`;
|
|
1771
1771
|
var activeStyles = css4`
|
|
1772
|
-
|
|
1773
|
-
color: ${({ theme: theme2 }) => theme2.colors.
|
|
1772
|
+
border: 1px solid ${({ theme: theme2 }) => theme2.colors.listItem.border.base};
|
|
1773
|
+
background-color: ${({ theme: theme2 }) => theme2.colors.menuItem.background.active};
|
|
1774
|
+
color: ${({ theme: theme2 }) => theme2.colors.text.body};
|
|
1775
|
+
text-decoration: none;
|
|
1774
1776
|
`;
|
|
1775
1777
|
var MenuItemContainer = styled.li`
|
|
1776
1778
|
box-sizing: border-box;
|
|
@@ -1939,10 +1941,10 @@ var useOptionProps = ({
|
|
|
1939
1941
|
inputLabelId,
|
|
1940
1942
|
...props
|
|
1941
1943
|
}) => {
|
|
1942
|
-
const { selectedItem,
|
|
1944
|
+
const { selectedItem, selectedItemIds, isListbox, isItemSelected } = useMenuContentContext();
|
|
1943
1945
|
const selected = useMemo2(
|
|
1944
1946
|
() => isItemSelected(id),
|
|
1945
|
-
[selectedItem,
|
|
1947
|
+
[selectedItem?.id, selectedItemIds]
|
|
1946
1948
|
);
|
|
1947
1949
|
const label = inputLabelId || `menu-item-child-${id}`;
|
|
1948
1950
|
return isListbox ? {
|
|
@@ -2017,6 +2019,7 @@ var MenuItem = ({
|
|
|
2017
2019
|
}
|
|
2018
2020
|
) });
|
|
2019
2021
|
};
|
|
2022
|
+
MenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
2020
2023
|
|
|
2021
2024
|
// src/MenuItem/MenuItemTypes.ts
|
|
2022
2025
|
var INPUT_TYPES = {
|
|
@@ -2065,6 +2068,10 @@ var MenuTitleText = styled2.h3`
|
|
|
2065
2068
|
var MenuChildrenContainer = styled2.div`
|
|
2066
2069
|
grid-column: 1 / -1;
|
|
2067
2070
|
margin-top: ${({ theme: theme2 }) => theme2.space[300]};
|
|
2071
|
+
|
|
2072
|
+
&:first-child {
|
|
2073
|
+
margin-top: 0;
|
|
2074
|
+
}
|
|
2068
2075
|
`;
|
|
2069
2076
|
var MenuHeaderFeatures = styled2.div`
|
|
2070
2077
|
display: flex;
|
|
@@ -2098,8 +2105,9 @@ var MenuHeader = ({
|
|
|
2098
2105
|
rightAction,
|
|
2099
2106
|
...rest
|
|
2100
2107
|
}) => {
|
|
2108
|
+
const showTopRow = title || leftAction || rightAction;
|
|
2101
2109
|
return /* @__PURE__ */ jsx4(Fragment2, { children: /* @__PURE__ */ jsxs2(MenuHeaderContainer, { $leftAction: !!leftAction, ...rest, children: [
|
|
2102
|
-
/* @__PURE__ */ jsxs2(MenuHeaderFeatures, { $leftAction: !!leftAction, children: [
|
|
2110
|
+
showTopRow && /* @__PURE__ */ jsxs2(MenuHeaderFeatures, { $leftAction: !!leftAction, children: [
|
|
2103
2111
|
leftAction && leftAction,
|
|
2104
2112
|
title && /* @__PURE__ */ jsx4(MenuTitleText, { $leftAction: !!leftAction, children: title }),
|
|
2105
2113
|
rightAction && /* @__PURE__ */ jsx4("div", { className: "right-action", children: rightAction })
|
|
@@ -2135,8 +2143,8 @@ var walkAllChildren = (children, callback) => {
|
|
|
2135
2143
|
});
|
|
2136
2144
|
};
|
|
2137
2145
|
var getComponentName = (element) => {
|
|
2138
|
-
if (element && typeof element === "object" && "type" in element && typeof element.type
|
|
2139
|
-
return element.type.
|
|
2146
|
+
if (element && typeof element === "object" && "type" in element && (typeof element.type === "function" || typeof element.type === "object") && "__MENU_PRIMITIVE_TYPE" in element.type && typeof element.type.__MENU_PRIMITIVE_TYPE === "string") {
|
|
2147
|
+
return element.type.__MENU_PRIMITIVE_TYPE;
|
|
2140
2148
|
}
|
|
2141
2149
|
};
|
|
2142
2150
|
var addMenuItem = ({
|
|
@@ -2217,8 +2225,6 @@ var setMenuItemsFromChildren = ({
|
|
|
2217
2225
|
walkAllChildren(children, (element) => {
|
|
2218
2226
|
switch (getComponentName(element)) {
|
|
2219
2227
|
case "MenuItem":
|
|
2220
|
-
case "SubmenuItem":
|
|
2221
|
-
case "NestedMenuItem":
|
|
2222
2228
|
const menuItem = element;
|
|
2223
2229
|
if (menuItemsMap[`${menuItem.props.id}`]) return;
|
|
2224
2230
|
addMenuItem({
|
|
@@ -2240,7 +2246,6 @@ var setMenuItemsFromChildren = ({
|
|
|
2240
2246
|
});
|
|
2241
2247
|
break;
|
|
2242
2248
|
case "MenuContent":
|
|
2243
|
-
case "NestedMenuContent":
|
|
2244
2249
|
addItemsFromContent({
|
|
2245
2250
|
// Cast element to the TypeMenuContentElement since we know it's a content and is needed for addItemsFromContent.
|
|
2246
2251
|
contentElement: element,
|
|
@@ -2335,6 +2340,7 @@ var MenuContent = ({
|
|
|
2335
2340
|
}
|
|
2336
2341
|
);
|
|
2337
2342
|
};
|
|
2343
|
+
MenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
|
|
2338
2344
|
|
|
2339
2345
|
// src/MenuFooter/MenuFooter.tsx
|
|
2340
2346
|
import "react";
|
|
@@ -2343,7 +2349,7 @@ import "react";
|
|
|
2343
2349
|
import styled4 from "styled-components";
|
|
2344
2350
|
import { Box as Box2 } from "@sproutsocial/seeds-react-box";
|
|
2345
2351
|
var StyledMenuFooterBox = styled4(Box2)`
|
|
2346
|
-
padding: ${(
|
|
2352
|
+
padding: ${({ theme: theme2 }) => theme2.space[350]} ${({ theme: theme2 }) => theme2.space[400]};
|
|
2347
2353
|
border-top: 1px solid ${(p) => p.theme.colors.container.border.base};
|
|
2348
2354
|
`;
|
|
2349
2355
|
|
|
@@ -2491,7 +2497,7 @@ var StyledMenuGroup = styled6.li`
|
|
|
2491
2497
|
${space}
|
|
2492
2498
|
`;
|
|
2493
2499
|
var StyledTitle = styled6(index_default.SmallSubHeadline)`
|
|
2494
|
-
font-size: ${({ theme: theme2 }) => theme2.typography[
|
|
2500
|
+
font-size: ${({ theme: theme2 }) => theme2.typography[100].fontSize};
|
|
2495
2501
|
margin: ${({ theme: theme2 }) => theme2.space[400]} ${({ theme: theme2 }) => theme2.space[400]}
|
|
2496
2502
|
0px ${({ theme: theme2 }) => theme2.space[400]};
|
|
2497
2503
|
`;
|
|
@@ -2534,9 +2540,10 @@ var MenuGroup = ({
|
|
|
2534
2540
|
}
|
|
2535
2541
|
);
|
|
2536
2542
|
};
|
|
2543
|
+
MenuGroup.__MENU_PRIMITIVE_TYPE = "MenuGroup";
|
|
2537
2544
|
|
|
2538
2545
|
// src/MenuRoot/MenuRoot.tsx
|
|
2539
|
-
import { useCallback as useCallback2 } from "react";
|
|
2546
|
+
import { useCallback as useCallback2, useEffect } from "react";
|
|
2540
2547
|
import styled7 from "styled-components";
|
|
2541
2548
|
import { Popout } from "@sproutsocial/seeds-react-popout";
|
|
2542
2549
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
@@ -2552,13 +2559,26 @@ var MenuRoot = ({
|
|
|
2552
2559
|
width: width2 = "300px",
|
|
2553
2560
|
...contextProps
|
|
2554
2561
|
}) => {
|
|
2555
|
-
const {
|
|
2562
|
+
const {
|
|
2563
|
+
isOpen,
|
|
2564
|
+
openMenu,
|
|
2565
|
+
closeMenu,
|
|
2566
|
+
inputValue,
|
|
2567
|
+
hiddenItemsCount = 0,
|
|
2568
|
+
items
|
|
2569
|
+
} = contextProps;
|
|
2556
2570
|
const setIsOpen = useCallback2(
|
|
2557
2571
|
(newIsOpen) => {
|
|
2558
2572
|
newIsOpen ? openMenu?.() : closeMenu?.();
|
|
2559
2573
|
},
|
|
2560
2574
|
[openMenu, closeMenu]
|
|
2561
2575
|
);
|
|
2576
|
+
useEffect(() => {
|
|
2577
|
+
if (!inputValue) return;
|
|
2578
|
+
if (items && hiddenItemsCount >= items.length && isOpen) {
|
|
2579
|
+
closeMenu?.();
|
|
2580
|
+
}
|
|
2581
|
+
}, [hiddenItemsCount, items?.length, isOpen, inputValue]);
|
|
2562
2582
|
const menuContext = useMenu(contextProps);
|
|
2563
2583
|
return /* @__PURE__ */ jsx10(
|
|
2564
2584
|
Popout,
|
|
@@ -2663,7 +2683,8 @@ var useItemFiltering = ({
|
|
|
2663
2683
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2664
2684
|
var MenuSearchInput = ({
|
|
2665
2685
|
getIsItemVisible,
|
|
2666
|
-
|
|
2686
|
+
inputProps,
|
|
2687
|
+
...restInputProps
|
|
2667
2688
|
}) => {
|
|
2668
2689
|
const {
|
|
2669
2690
|
items,
|
|
@@ -2679,14 +2700,15 @@ var MenuSearchInput = ({
|
|
|
2679
2700
|
setHiddenItemsMap
|
|
2680
2701
|
});
|
|
2681
2702
|
React11.useEffect(() => {
|
|
2682
|
-
updateFilteredItems({ inputValue:
|
|
2683
|
-
}, [isOpen,
|
|
2703
|
+
updateFilteredItems({ inputValue: restInputProps.value || "" });
|
|
2704
|
+
}, [isOpen, restInputProps.value]);
|
|
2705
|
+
const toggleButtonProps = getToggleButtonProps?.() || {};
|
|
2684
2706
|
const handleKeyDown = React11.useCallback(
|
|
2685
2707
|
(e) => {
|
|
2686
2708
|
if (e.key === " ") return;
|
|
2687
|
-
|
|
2709
|
+
toggleButtonProps.onKeyDown?.(e);
|
|
2688
2710
|
},
|
|
2689
|
-
[
|
|
2711
|
+
[toggleButtonProps.onKeyDown]
|
|
2690
2712
|
);
|
|
2691
2713
|
return /* @__PURE__ */ jsx13(
|
|
2692
2714
|
Input,
|
|
@@ -2696,7 +2718,13 @@ var MenuSearchInput = ({
|
|
|
2696
2718
|
},
|
|
2697
2719
|
onKeyDown: handleKeyDown,
|
|
2698
2720
|
autoComplete: false,
|
|
2699
|
-
|
|
2721
|
+
"aria-autocomplete": "list",
|
|
2722
|
+
inputProps: {
|
|
2723
|
+
["aria-activedescendant"]: toggleButtonProps["aria-activedescendant"],
|
|
2724
|
+
["aria-controls"]: toggleButtonProps["aria-controls"],
|
|
2725
|
+
...inputProps
|
|
2726
|
+
},
|
|
2727
|
+
...restInputProps
|
|
2700
2728
|
}
|
|
2701
2729
|
);
|
|
2702
2730
|
};
|
|
@@ -2832,12 +2860,13 @@ var MenuSearchTokenInput = ({
|
|
|
2832
2860
|
React13.useEffect(() => {
|
|
2833
2861
|
updateFilteredState(controlledValue);
|
|
2834
2862
|
}, [isOpen]);
|
|
2863
|
+
const toggleButtonProps = getToggleButtonProps?.() || {};
|
|
2835
2864
|
const handleKeyDown = React13.useCallback(
|
|
2836
2865
|
(e) => {
|
|
2837
2866
|
if (e.key === " ") return;
|
|
2838
|
-
|
|
2867
|
+
toggleButtonProps.onKeyDown?.(e);
|
|
2839
2868
|
},
|
|
2840
|
-
[
|
|
2869
|
+
[toggleButtonProps.onKeyDown]
|
|
2841
2870
|
);
|
|
2842
2871
|
return /* @__PURE__ */ jsx15(
|
|
2843
2872
|
MenuTokenInput,
|
|
@@ -2849,6 +2878,8 @@ var MenuSearchTokenInput = ({
|
|
|
2849
2878
|
onKeyDown: handleKeyDown,
|
|
2850
2879
|
inputProps: {
|
|
2851
2880
|
value: internalValue,
|
|
2881
|
+
["aria-activedescendant"]: toggleButtonProps["aria-activedescendant"],
|
|
2882
|
+
["aria-controls"]: toggleButtonProps["aria-controls"],
|
|
2852
2883
|
...inputProps
|
|
2853
2884
|
},
|
|
2854
2885
|
MenuContext: MenuContentContext,
|
|
@@ -3046,9 +3077,10 @@ var SubmenuItem = ({
|
|
|
3046
3077
|
}
|
|
3047
3078
|
);
|
|
3048
3079
|
};
|
|
3080
|
+
SubmenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
3049
3081
|
|
|
3050
3082
|
// src/ActionMenu/ActionMenu.tsx
|
|
3051
|
-
import React16, { useEffect } from "react";
|
|
3083
|
+
import React16, { useEffect as useEffect2 } from "react";
|
|
3052
3084
|
import {
|
|
3053
3085
|
useSelect as useSelect2
|
|
3054
3086
|
} from "downshift";
|
|
@@ -3172,31 +3204,40 @@ var defaultUseSelectPropsForMulti = {
|
|
|
3172
3204
|
var defaultUseComboboxPropsForMulti = {
|
|
3173
3205
|
stateReducer: useComboboxStateReducerForMulti
|
|
3174
3206
|
};
|
|
3207
|
+
var itemToKey2 = (item) => item?.id;
|
|
3175
3208
|
var useDownshiftDefaults = ({
|
|
3176
3209
|
isCombobox = false,
|
|
3177
3210
|
isMulti = false,
|
|
3178
3211
|
multiSelectProps = {}
|
|
3179
3212
|
} = {}) => {
|
|
3180
3213
|
const [hiddenItemsMap, setHiddenItemsMap] = React15.useState({});
|
|
3214
|
+
const hiddenItemsCount = React15.useMemo(
|
|
3215
|
+
() => Object.keys(hiddenItemsMap).filter(Boolean).length,
|
|
3216
|
+
[hiddenItemsMap]
|
|
3217
|
+
);
|
|
3181
3218
|
const isItemDisabled = React15.useCallback(
|
|
3182
3219
|
(item) => Boolean(item.disabled || hiddenItemsMap[item.id]),
|
|
3183
3220
|
[hiddenItemsMap]
|
|
3184
3221
|
);
|
|
3185
3222
|
return {
|
|
3186
3223
|
hiddenItemsMap,
|
|
3224
|
+
hiddenItemsCount,
|
|
3187
3225
|
setHiddenItemsMap,
|
|
3188
3226
|
defaultDownshiftProps: {
|
|
3189
3227
|
select: !isCombobox ? {
|
|
3228
|
+
itemToKey: itemToKey2,
|
|
3190
3229
|
// disabling while item.hidden so that hidden items are ignored by downshift
|
|
3191
3230
|
isItemDisabled,
|
|
3192
3231
|
...isMulti ? defaultUseSelectPropsForMulti : defaultUseSelectProps
|
|
3193
3232
|
} : {},
|
|
3194
3233
|
combobox: isCombobox ? {
|
|
3234
|
+
itemToKey: itemToKey2,
|
|
3195
3235
|
// disabling while item.hidden so that hidden items are ignored by downshift
|
|
3196
3236
|
isItemDisabled,
|
|
3197
3237
|
...isMulti ? defaultUseComboboxPropsForMulti : defaultUseComboboxProps
|
|
3198
3238
|
} : {},
|
|
3199
3239
|
multi: isMulti ? {
|
|
3240
|
+
itemToKey: itemToKey2,
|
|
3200
3241
|
// handles the prop name mapping for multi select
|
|
3201
3242
|
...getMultiSelectOverrides(multiSelectProps)
|
|
3202
3243
|
} : {}
|
|
@@ -3264,7 +3305,7 @@ var ActionMenu = ({
|
|
|
3264
3305
|
),
|
|
3265
3306
|
...useSelectProps
|
|
3266
3307
|
});
|
|
3267
|
-
|
|
3308
|
+
useEffect2(() => {
|
|
3268
3309
|
setCurrentSelectedItem(useSelectReturnProps.selectedItem);
|
|
3269
3310
|
}, [useSelectReturnProps.selectedItem]);
|
|
3270
3311
|
return /* @__PURE__ */ jsx17(
|
|
@@ -3504,7 +3545,7 @@ var MultiAutocomplete = ({
|
|
|
3504
3545
|
menuItems,
|
|
3505
3546
|
MenuItemComponent,
|
|
3506
3547
|
itemToString: itemToString2 = itemToString,
|
|
3507
|
-
itemToKey:
|
|
3548
|
+
itemToKey: itemToKey3 = itemToKey,
|
|
3508
3549
|
getIsItemVisible = getDefaultGetIsItemVisible(itemToString2),
|
|
3509
3550
|
showSelectedItemsInDropdown = false,
|
|
3510
3551
|
initialSelectedItems = [],
|
|
@@ -3557,7 +3598,7 @@ var MultiAutocomplete = ({
|
|
|
3557
3598
|
}, [selectedItemIds]);
|
|
3558
3599
|
const useMultipleSelectionReturnProps = useMultipleSelection2({
|
|
3559
3600
|
...defaultDownshiftProps.multi,
|
|
3560
|
-
itemToKey:
|
|
3601
|
+
itemToKey: itemToKey3,
|
|
3561
3602
|
selectedItems,
|
|
3562
3603
|
onSelectedItemsChange: ({ selectedItems: selectedItems2, ...changes }) => {
|
|
3563
3604
|
setSelectedItems(selectedItems2);
|
|
@@ -3569,7 +3610,7 @@ var MultiAutocomplete = ({
|
|
|
3569
3610
|
...defaultDownshiftProps.combobox,
|
|
3570
3611
|
items: allMenuItems,
|
|
3571
3612
|
itemToString: itemToString2,
|
|
3572
|
-
itemToKey:
|
|
3613
|
+
itemToKey: itemToKey3,
|
|
3573
3614
|
stateReducer: reduceReducers(
|
|
3574
3615
|
defaultDownshiftProps.combobox.stateReducer,
|
|
3575
3616
|
externalStateReducer
|
|
@@ -3757,7 +3798,7 @@ var nestedMenuStateReducer = (_state, actionAndChanges) => {
|
|
|
3757
3798
|
};
|
|
3758
3799
|
|
|
3759
3800
|
// src/NestedMenu/NestedMenuContent.tsx
|
|
3760
|
-
import { useEffect as
|
|
3801
|
+
import { useEffect as useEffect3, useRef } from "react";
|
|
3761
3802
|
import { mergeRefs as mergeRefs2 } from "@sproutsocial/seeds-react-utilities/src/index";
|
|
3762
3803
|
|
|
3763
3804
|
// src/NestedMenu/NestedMenuItem.tsx
|
|
@@ -3782,6 +3823,7 @@ var NestedMenuItem = ({
|
|
|
3782
3823
|
childMenuId && /* @__PURE__ */ jsx26(MenuItemActionRight, { children: /* @__PURE__ */ jsx26(Icon4, { name: "arrow-right-outline" }) })
|
|
3783
3824
|
] }) });
|
|
3784
3825
|
};
|
|
3826
|
+
NestedMenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
3785
3827
|
|
|
3786
3828
|
// src/NestedMenu/NestedMenuContent.tsx
|
|
3787
3829
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
@@ -3798,7 +3840,7 @@ var NestedMenuContent = ({
|
|
|
3798
3840
|
const internalRef = useRef(null);
|
|
3799
3841
|
const innerRef = mergeRefs2(internalRef, innerRefProp);
|
|
3800
3842
|
const contentProps = children ? { children } : { menuItems, MenuItemComponent };
|
|
3801
|
-
|
|
3843
|
+
useEffect3(() => {
|
|
3802
3844
|
internalRef?.current?.focus();
|
|
3803
3845
|
}, []);
|
|
3804
3846
|
const onKeyDown = (e) => {
|
|
@@ -3831,6 +3873,7 @@ var NestedMenuContent = ({
|
|
|
3831
3873
|
}
|
|
3832
3874
|
);
|
|
3833
3875
|
};
|
|
3876
|
+
NestedMenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
|
|
3834
3877
|
|
|
3835
3878
|
// src/NestedMenu/NestedMenu.tsx
|
|
3836
3879
|
import { Fragment as Fragment4, jsx as jsx28, jsxs as jsxs6 } from "react/jsx-runtime";
|