@sproutsocial/seeds-react-menu 1.1.1 → 1.2.1
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 +20 -0
- package/dist/esm/index.js +110 -53
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +123 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Autocomplete/Autocomplete.stories.tsx +30 -1
- package/src/Autocomplete/AutocompleteSelect.tsx +24 -0
- package/src/Autocomplete/SingleAutocomplete.tsx +1 -1
- package/src/Autocomplete/index.ts +1 -0
- package/src/MenuContent/styles.tsx +5 -1
- package/src/MenuContext.tsx +3 -1
- package/src/MenuRoot/MenuRoot.tsx +39 -10
- package/src/NestedMenu/NestedMenu.stories.tsx +16 -8
- package/src/NestedMenu/NestedMenu.tsx +3 -0
- package/src/NestedMenu/NestedMenuItem.tsx +11 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -84,14 +84,14 @@ ESM Build start
|
|
|
84
84
|
╵ [32m~~~~~~~~~[0m
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
CJS dist/index.js 140.98 KB
|
|
88
|
+
CJS dist/index.js.map 362.59 KB
|
|
89
|
+
CJS ⚡️ Build success in 539ms
|
|
90
|
+
ESM dist/esm/index.js 131.36 KB
|
|
91
|
+
ESM dist/esm/index.js.map 361.32 KB
|
|
92
|
+
ESM ⚡️ Build success in 545ms
|
|
93
93
|
DTS Build start
|
|
94
|
-
DTS ⚡️ Build success in
|
|
95
|
-
DTS dist/index.d.ts 32.
|
|
96
|
-
DTS dist/index.d.mts 32.
|
|
97
|
-
Done in
|
|
94
|
+
DTS ⚡️ Build success in 15626ms
|
|
95
|
+
DTS dist/index.d.ts 32.53 KB
|
|
96
|
+
DTS dist/index.d.mts 32.53 KB
|
|
97
|
+
Done in 17.69s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-menu
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d309821: - Update all menus so that they set the menu width to the toggle width by default, with a minimum width of 200px
|
|
8
|
+
- Fix recently introduced bug that made the `width` prop stop working
|
|
9
|
+
- 4bcd4f3: Fix error: "downshift: You forgot to call the getMenuProps getter function on your component / element."
|
|
10
|
+
|
|
11
|
+
## 1.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 34ef27e: Added an `AutocompleteSelect` component that combines autocomplete behavior with the appearance of a `Select`.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 9fdb2f8: Supports onClick prop on a NestedMenuItem without a childMenuId
|
|
20
|
+
- Fixes a bug where the onClick prop on a NestedMenuItem would not be triggered unless the item had a childMenuId
|
|
21
|
+
- 64c536e: Adjust focus styling due to a bug where focus appeared on MenuContent when focus is applied at global level
|
|
22
|
+
|
|
3
23
|
## 1.1.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -2121,7 +2121,11 @@ import styled3 from "styled-components";
|
|
|
2121
2121
|
var StyledMenuContent = styled3.ul`
|
|
2122
2122
|
margin: 0;
|
|
2123
2123
|
padding: 0;
|
|
2124
|
-
|
|
2124
|
+
|
|
2125
|
+
&:focus {
|
|
2126
|
+
outline: none;
|
|
2127
|
+
box-shadow: none;
|
|
2128
|
+
}
|
|
2125
2129
|
`;
|
|
2126
2130
|
|
|
2127
2131
|
// src/hooks/useMenuChildren.tsx
|
|
@@ -2543,9 +2547,14 @@ var MenuGroup = ({
|
|
|
2543
2547
|
MenuGroup.__MENU_PRIMITIVE_TYPE = "MenuGroup";
|
|
2544
2548
|
|
|
2545
2549
|
// src/MenuRoot/MenuRoot.tsx
|
|
2546
|
-
import
|
|
2550
|
+
import React7, {
|
|
2551
|
+
useCallback as useCallback2,
|
|
2552
|
+
useEffect,
|
|
2553
|
+
useLayoutEffect
|
|
2554
|
+
} from "react";
|
|
2547
2555
|
import styled7 from "styled-components";
|
|
2548
2556
|
import { Popout } from "@sproutsocial/seeds-react-popout";
|
|
2557
|
+
import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
2549
2558
|
|
|
2550
2559
|
// ../../seeds-design-tokens/seeds-motion/dist/seeds-motion-unitless.esm.js
|
|
2551
2560
|
var MOTION_DURATION_FAST = 0.15;
|
|
@@ -2622,7 +2631,7 @@ var MenuRoot = ({
|
|
|
2622
2631
|
children,
|
|
2623
2632
|
menuToggleElement,
|
|
2624
2633
|
popoutProps: { placement = "bottom", focusLockProps, ...popoutProps } = {},
|
|
2625
|
-
width: width2
|
|
2634
|
+
width: width2,
|
|
2626
2635
|
...contextProps
|
|
2627
2636
|
}) => {
|
|
2628
2637
|
const {
|
|
@@ -2631,14 +2640,22 @@ var MenuRoot = ({
|
|
|
2631
2640
|
closeMenu,
|
|
2632
2641
|
inputValue,
|
|
2633
2642
|
hiddenItemsCount = 0,
|
|
2634
|
-
items
|
|
2643
|
+
items,
|
|
2644
|
+
getMenuProps
|
|
2635
2645
|
} = contextProps;
|
|
2636
|
-
const
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2646
|
+
const toggleElementRef = React7.useRef(null);
|
|
2647
|
+
const [finalWidth, setFinalWidth] = React7.useState();
|
|
2648
|
+
const min_width = 200;
|
|
2649
|
+
useLayoutEffect(() => {
|
|
2650
|
+
if (width2) {
|
|
2651
|
+
setFinalWidth(width2);
|
|
2652
|
+
} else if (toggleElementRef.current?.offsetWidth) {
|
|
2653
|
+
const toggleWidth = toggleElementRef.current.offsetWidth;
|
|
2654
|
+
setFinalWidth(Math.max(toggleWidth, min_width));
|
|
2655
|
+
} else {
|
|
2656
|
+
setFinalWidth(min_width);
|
|
2657
|
+
}
|
|
2658
|
+
}, [width2, toggleElementRef.current?.offsetWidth]);
|
|
2642
2659
|
useEffect(() => {
|
|
2643
2660
|
if (!inputValue) return;
|
|
2644
2661
|
if (items && hiddenItemsCount >= items.length && isOpen) {
|
|
@@ -2646,6 +2663,7 @@ var MenuRoot = ({
|
|
|
2646
2663
|
}
|
|
2647
2664
|
}, [hiddenItemsCount, items?.length, isOpen, inputValue]);
|
|
2648
2665
|
const menuContext = useMenu(contextProps);
|
|
2666
|
+
getMenuProps?.({}, { suppressRefError: true });
|
|
2649
2667
|
return /* @__PURE__ */ jsx10(
|
|
2650
2668
|
MenuPopout,
|
|
2651
2669
|
{
|
|
@@ -2654,8 +2672,22 @@ var MenuRoot = ({
|
|
|
2654
2672
|
openMenu,
|
|
2655
2673
|
closeMenu,
|
|
2656
2674
|
content: /* @__PURE__ */ jsx10(MenuContentProvider, { menuContext, children }),
|
|
2675
|
+
width: finalWidth,
|
|
2657
2676
|
...popoutProps,
|
|
2658
|
-
children: (toggleProps) => /* @__PURE__ */ jsx10(
|
|
2677
|
+
children: (toggleProps) => /* @__PURE__ */ jsx10(
|
|
2678
|
+
MenuToggleProvider,
|
|
2679
|
+
{
|
|
2680
|
+
menuContext: {
|
|
2681
|
+
...menuContext,
|
|
2682
|
+
...toggleProps,
|
|
2683
|
+
ref: mergeRefs(
|
|
2684
|
+
toggleProps.ref,
|
|
2685
|
+
toggleElementRef
|
|
2686
|
+
)
|
|
2687
|
+
},
|
|
2688
|
+
children: menuToggleElement
|
|
2689
|
+
}
|
|
2690
|
+
)
|
|
2659
2691
|
}
|
|
2660
2692
|
);
|
|
2661
2693
|
};
|
|
@@ -2959,7 +2991,7 @@ var MenuSearchTokenInput = ({
|
|
|
2959
2991
|
import React14 from "react";
|
|
2960
2992
|
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
2961
2993
|
import { Box as Box3 } from "@sproutsocial/seeds-react-box";
|
|
2962
|
-
import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
2994
|
+
import { mergeRefs as mergeRefs2 } from "@sproutsocial/seeds-react-utilities";
|
|
2963
2995
|
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2964
2996
|
var SubmenuItemTrigger = ({
|
|
2965
2997
|
id,
|
|
@@ -2968,7 +3000,7 @@ var SubmenuItemTrigger = ({
|
|
|
2968
3000
|
...rest
|
|
2969
3001
|
}) => {
|
|
2970
3002
|
const { getToggleButtonProps, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
|
|
2971
|
-
const toggleRef = ref && innerRef ?
|
|
3003
|
+
const toggleRef = ref && innerRef ? mergeRefs2([ref, innerRef].filter(Boolean)) : ref || innerRef;
|
|
2972
3004
|
return /* @__PURE__ */ jsx16(
|
|
2973
3005
|
MenuItem,
|
|
2974
3006
|
{
|
|
@@ -3872,8 +3904,29 @@ var AutocompleteTokenInput = ({
|
|
|
3872
3904
|
);
|
|
3873
3905
|
};
|
|
3874
3906
|
|
|
3907
|
+
// src/Autocomplete/AutocompleteSelect.tsx
|
|
3908
|
+
import Icon4 from "@sproutsocial/seeds-react-icon";
|
|
3909
|
+
import "react";
|
|
3910
|
+
import styled10 from "styled-components";
|
|
3911
|
+
import { Accessory } from "@sproutsocial/seeds-react-input";
|
|
3912
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3913
|
+
var StyledAutocompleteInput = styled10(AutocompleteInput)`
|
|
3914
|
+
${Accessory} {
|
|
3915
|
+
pointer-events: none;
|
|
3916
|
+
}
|
|
3917
|
+
`;
|
|
3918
|
+
var AutocompleteSelect = (props) => {
|
|
3919
|
+
return /* @__PURE__ */ jsx26(
|
|
3920
|
+
StyledAutocompleteInput,
|
|
3921
|
+
{
|
|
3922
|
+
elemAfter: /* @__PURE__ */ jsx26(Icon4, { name: "chevron-down" }),
|
|
3923
|
+
...props
|
|
3924
|
+
}
|
|
3925
|
+
);
|
|
3926
|
+
};
|
|
3927
|
+
|
|
3875
3928
|
// src/NestedMenu/NestedMenu.tsx
|
|
3876
|
-
import { useId, useEffect as
|
|
3929
|
+
import { useId, useEffect as useEffect5, useState } from "react";
|
|
3877
3930
|
import { AnimatePresence as AnimatePresence2, motion as motion3 } from "motion/react";
|
|
3878
3931
|
import { useSelect as useSelect6 } from "downshift";
|
|
3879
3932
|
|
|
@@ -3903,7 +3956,7 @@ var nestedMenuStateReducer = (_state, actionAndChanges) => {
|
|
|
3903
3956
|
|
|
3904
3957
|
// src/NestedMenu/NestedMenuContext.tsx
|
|
3905
3958
|
import { createContext as createContext2, useContext as useContext5 } from "react";
|
|
3906
|
-
import { jsx as
|
|
3959
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3907
3960
|
var defaultNestedMenuContext = {
|
|
3908
3961
|
selectedMenuPath: [],
|
|
3909
3962
|
setSelectedMenuId: () => {
|
|
@@ -3927,7 +3980,7 @@ var NestedMenuProvider = ({
|
|
|
3927
3980
|
children,
|
|
3928
3981
|
...nestedMenuProps
|
|
3929
3982
|
}) => {
|
|
3930
|
-
return /* @__PURE__ */
|
|
3983
|
+
return /* @__PURE__ */ jsx27(NestedMenuContext.Provider, { value: nestedMenuProps, children });
|
|
3931
3984
|
};
|
|
3932
3985
|
var useNestedMenuContext = () => {
|
|
3933
3986
|
const nestedMenuContextValue = useContext5(NestedMenuContext);
|
|
@@ -3940,13 +3993,13 @@ var useNestedMenuContext = () => {
|
|
|
3940
3993
|
};
|
|
3941
3994
|
|
|
3942
3995
|
// src/NestedMenu/NestedMenuContent.tsx
|
|
3943
|
-
import { useEffect as
|
|
3944
|
-
import { mergeRefs as
|
|
3996
|
+
import { useEffect as useEffect4, useRef } from "react";
|
|
3997
|
+
import { mergeRefs as mergeRefs3 } from "@sproutsocial/seeds-react-utilities";
|
|
3945
3998
|
|
|
3946
3999
|
// src/NestedMenu/NestedMenuItem.tsx
|
|
3947
|
-
import { Icon as
|
|
4000
|
+
import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
|
|
3948
4001
|
import { Box as Box4 } from "@sproutsocial/seeds-react-box";
|
|
3949
|
-
import { jsx as
|
|
4002
|
+
import { jsx as jsx28, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3950
4003
|
var NestedMenuItem = ({
|
|
3951
4004
|
children,
|
|
3952
4005
|
childMenuId,
|
|
@@ -3954,21 +4007,23 @@ var NestedMenuItem = ({
|
|
|
3954
4007
|
...rest
|
|
3955
4008
|
}) => {
|
|
3956
4009
|
const { setSelectedMenuId } = useNestedMenuContext();
|
|
3957
|
-
const onClickProps = childMenuId ? {
|
|
4010
|
+
const onClickProps = childMenuId || onClickProp ? {
|
|
3958
4011
|
onClick: (e) => {
|
|
3959
4012
|
onClickProp?.(e);
|
|
3960
|
-
|
|
4013
|
+
if (childMenuId) {
|
|
4014
|
+
setSelectedMenuId?.(childMenuId);
|
|
4015
|
+
}
|
|
3961
4016
|
}
|
|
3962
4017
|
} : {};
|
|
3963
|
-
return /* @__PURE__ */
|
|
4018
|
+
return /* @__PURE__ */ jsx28(MenuItem, { ...onClickProps, ...rest, children: /* @__PURE__ */ jsxs6(Box4, { display: "flex", justifyContent: "space-between", children: [
|
|
3964
4019
|
children,
|
|
3965
|
-
childMenuId && /* @__PURE__ */
|
|
4020
|
+
childMenuId && /* @__PURE__ */ jsx28(MenuItemActionRight, { children: /* @__PURE__ */ jsx28(Icon5, { name: "arrow-right-outline" }) })
|
|
3966
4021
|
] }) });
|
|
3967
4022
|
};
|
|
3968
4023
|
NestedMenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
3969
4024
|
|
|
3970
4025
|
// src/NestedMenu/NestedMenuContent.tsx
|
|
3971
|
-
import { jsx as
|
|
4026
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3972
4027
|
var NestedMenuContent = ({
|
|
3973
4028
|
innerRef: innerRefProp = null,
|
|
3974
4029
|
onKeyDown: onKeyDownProp,
|
|
@@ -3980,9 +4035,9 @@ var NestedMenuContent = ({
|
|
|
3980
4035
|
const { highlightedIndex, items } = useMenuContentContext();
|
|
3981
4036
|
const { setSelectedMenuId, selectedMenuPath, goBack } = useNestedMenuContext();
|
|
3982
4037
|
const internalRef = useRef(null);
|
|
3983
|
-
const innerRef =
|
|
4038
|
+
const innerRef = mergeRefs3(internalRef, innerRefProp);
|
|
3984
4039
|
const contentProps = children ? { children } : { menuItems, MenuItemComponent };
|
|
3985
|
-
|
|
4040
|
+
useEffect4(() => {
|
|
3986
4041
|
internalRef?.current?.focus();
|
|
3987
4042
|
}, []);
|
|
3988
4043
|
const onKeyDown = (e) => {
|
|
@@ -4005,7 +4060,7 @@ var NestedMenuContent = ({
|
|
|
4005
4060
|
break;
|
|
4006
4061
|
}
|
|
4007
4062
|
};
|
|
4008
|
-
return /* @__PURE__ */
|
|
4063
|
+
return /* @__PURE__ */ jsx29(
|
|
4009
4064
|
MenuContent,
|
|
4010
4065
|
{
|
|
4011
4066
|
onKeyDown,
|
|
@@ -4019,19 +4074,19 @@ NestedMenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
|
|
|
4019
4074
|
|
|
4020
4075
|
// src/NestedMenu/NestedMenuHeader.tsx
|
|
4021
4076
|
import { Button as Button2 } from "@sproutsocial/seeds-react-button";
|
|
4022
|
-
import { Icon as
|
|
4077
|
+
import { Icon as Icon6 } from "@sproutsocial/seeds-react-icon";
|
|
4023
4078
|
import { AnimatePresence, motion } from "motion/react";
|
|
4024
|
-
import { jsx as
|
|
4079
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4025
4080
|
var NestedMenuHeader = ({
|
|
4026
4081
|
backArrowLabel,
|
|
4027
4082
|
...props
|
|
4028
4083
|
}) => {
|
|
4029
4084
|
const { goBack, selectedMenuPath, animationSpeed } = useNestedMenuContext();
|
|
4030
4085
|
const showBackArrow = selectedMenuPath.length > 1;
|
|
4031
|
-
return /* @__PURE__ */
|
|
4086
|
+
return /* @__PURE__ */ jsx30(
|
|
4032
4087
|
MenuHeader,
|
|
4033
4088
|
{
|
|
4034
|
-
leftAction: /* @__PURE__ */
|
|
4089
|
+
leftAction: /* @__PURE__ */ jsx30(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx30(
|
|
4035
4090
|
motion.div,
|
|
4036
4091
|
{
|
|
4037
4092
|
initial: { opacity: 0 },
|
|
@@ -4040,7 +4095,7 @@ var NestedMenuHeader = ({
|
|
|
4040
4095
|
opacity: 0,
|
|
4041
4096
|
transition: { duration: animationSpeed }
|
|
4042
4097
|
},
|
|
4043
|
-
children: showBackArrow ? /* @__PURE__ */
|
|
4098
|
+
children: showBackArrow ? /* @__PURE__ */ jsx30(Button2, { onClick: goBack, ariaLabel: backArrowLabel, children: /* @__PURE__ */ jsx30(Icon6, { name: "arrow-left" }) }) : void 0
|
|
4044
4099
|
},
|
|
4045
4100
|
`${selectedMenuPath}-header--button`
|
|
4046
4101
|
) }),
|
|
@@ -4050,8 +4105,8 @@ var NestedMenuHeader = ({
|
|
|
4050
4105
|
};
|
|
4051
4106
|
|
|
4052
4107
|
// src/NestedMenu/NestedMenuRoot.tsx
|
|
4053
|
-
import
|
|
4054
|
-
import { jsx as
|
|
4108
|
+
import React25 from "react";
|
|
4109
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4055
4110
|
var NestedMenuRoot = ({
|
|
4056
4111
|
children,
|
|
4057
4112
|
menuToggleElement,
|
|
@@ -4059,21 +4114,21 @@ var NestedMenuRoot = ({
|
|
|
4059
4114
|
}) => {
|
|
4060
4115
|
const menuContext = useMenu(contextProps);
|
|
4061
4116
|
const { setActiveMenuContext, selectedMenuPath } = useNestedMenuContext();
|
|
4062
|
-
|
|
4117
|
+
React25.useEffect(() => {
|
|
4063
4118
|
setActiveMenuContext(menuContext);
|
|
4064
4119
|
}, [
|
|
4065
4120
|
selectedMenuPath[selectedMenuPath.length - 1],
|
|
4066
4121
|
menuContext.selectedItem,
|
|
4067
4122
|
menuContext.selectedItems?.length
|
|
4068
4123
|
]);
|
|
4069
|
-
return /* @__PURE__ */
|
|
4124
|
+
return /* @__PURE__ */ jsx31(MenuContentProvider, { menuContext, children });
|
|
4070
4125
|
};
|
|
4071
4126
|
|
|
4072
4127
|
// src/NestedMenu/NestedMenuPopout.tsx
|
|
4073
4128
|
import { motion as motion2 } from "motion/react";
|
|
4074
|
-
import
|
|
4075
|
-
import { jsx as
|
|
4076
|
-
var StyledDiv =
|
|
4129
|
+
import styled11 from "styled-components";
|
|
4130
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
4131
|
+
var StyledDiv = styled11(motion2.div)`
|
|
4077
4132
|
overflow: hidden;
|
|
4078
4133
|
`;
|
|
4079
4134
|
var NestedMenuPopout = ({
|
|
@@ -4083,7 +4138,7 @@ var NestedMenuPopout = ({
|
|
|
4083
4138
|
...popoutProps
|
|
4084
4139
|
}) => {
|
|
4085
4140
|
const { activeMenuContext, rootMenuContextProps, resetSelectedMenuPath } = useNestedMenuContext();
|
|
4086
|
-
return /* @__PURE__ */
|
|
4141
|
+
return /* @__PURE__ */ jsx32(
|
|
4087
4142
|
MenuPopout,
|
|
4088
4143
|
{
|
|
4089
4144
|
...popoutProps,
|
|
@@ -4092,8 +4147,8 @@ var NestedMenuPopout = ({
|
|
|
4092
4147
|
openMenu: rootMenuContextProps.openMenu,
|
|
4093
4148
|
closeMenu: rootMenuContextProps.closeMenu,
|
|
4094
4149
|
width: width2,
|
|
4095
|
-
content: (props) => /* @__PURE__ */
|
|
4096
|
-
children: (toggleProps) => /* @__PURE__ */
|
|
4150
|
+
content: (props) => /* @__PURE__ */ jsx32(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
|
|
4151
|
+
children: (toggleProps) => /* @__PURE__ */ jsx32(
|
|
4097
4152
|
MenuToggleProvider,
|
|
4098
4153
|
{
|
|
4099
4154
|
menuContext: {
|
|
@@ -4109,7 +4164,7 @@ var NestedMenuPopout = ({
|
|
|
4109
4164
|
};
|
|
4110
4165
|
|
|
4111
4166
|
// src/NestedMenu/NestedMenu.tsx
|
|
4112
|
-
import { jsx as
|
|
4167
|
+
import { jsx as jsx33, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4113
4168
|
var NestedMenu = ({
|
|
4114
4169
|
initialMenuId,
|
|
4115
4170
|
menus,
|
|
@@ -4143,7 +4198,7 @@ var NestedMenu = ({
|
|
|
4143
4198
|
...useSelectReturnProps,
|
|
4144
4199
|
...restDefaults
|
|
4145
4200
|
};
|
|
4146
|
-
|
|
4201
|
+
useEffect5(() => {
|
|
4147
4202
|
if (!useSelectReturnProps.isOpen) {
|
|
4148
4203
|
setHasLoadedOnce(false);
|
|
4149
4204
|
} else {
|
|
@@ -4160,6 +4215,7 @@ var NestedMenu = ({
|
|
|
4160
4215
|
id: nestedMenuId,
|
|
4161
4216
|
onIsOpenChange: onNestedIsOpenChange
|
|
4162
4217
|
};
|
|
4218
|
+
rootMenuContextProps.getMenuProps?.({}, { suppressRefError: true });
|
|
4163
4219
|
const [selectedMenuPath, setSelectedMenuPath] = useState([initialMenuId]);
|
|
4164
4220
|
const [activeMenuContext, setActiveMenuContext] = useState(defaultMenuContext);
|
|
4165
4221
|
const [currentMenuId, setCurrentMenuId] = useState(initialMenuId);
|
|
@@ -4168,7 +4224,7 @@ var NestedMenu = ({
|
|
|
4168
4224
|
setIsAdding(true);
|
|
4169
4225
|
setSelectedMenuPath((currentPath) => [...currentPath, id]);
|
|
4170
4226
|
};
|
|
4171
|
-
|
|
4227
|
+
useEffect5(() => {
|
|
4172
4228
|
if (selectedMenuPath.length > 0) {
|
|
4173
4229
|
const newMenuId = selectedMenuPath[selectedMenuPath.length - 1];
|
|
4174
4230
|
setCurrentMenuId(newMenuId);
|
|
@@ -4262,7 +4318,7 @@ var NestedMenu = ({
|
|
|
4262
4318
|
initialIsOpen: true,
|
|
4263
4319
|
children: (
|
|
4264
4320
|
// Handles the smooth animating of the content
|
|
4265
|
-
/* @__PURE__ */
|
|
4321
|
+
/* @__PURE__ */ jsx33(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsxs7(
|
|
4266
4322
|
motion3.div,
|
|
4267
4323
|
{
|
|
4268
4324
|
variants: contentVariants,
|
|
@@ -4271,7 +4327,7 @@ var NestedMenu = ({
|
|
|
4271
4327
|
exit: "leave",
|
|
4272
4328
|
custom: { isAdding, hasLoadedOnce },
|
|
4273
4329
|
children: [
|
|
4274
|
-
MenuHeaderComponent && /* @__PURE__ */
|
|
4330
|
+
MenuHeaderComponent && /* @__PURE__ */ jsx33(
|
|
4275
4331
|
MenuHeaderComponent,
|
|
4276
4332
|
{
|
|
4277
4333
|
backArrowLabel,
|
|
@@ -4279,7 +4335,7 @@ var NestedMenu = ({
|
|
|
4279
4335
|
}
|
|
4280
4336
|
),
|
|
4281
4337
|
children && children,
|
|
4282
|
-
menuItems && !children && /* @__PURE__ */
|
|
4338
|
+
menuItems && !children && /* @__PURE__ */ jsx33(
|
|
4283
4339
|
NestedMenuContent,
|
|
4284
4340
|
{
|
|
4285
4341
|
menuItems,
|
|
@@ -4293,7 +4349,7 @@ var NestedMenu = ({
|
|
|
4293
4349
|
),
|
|
4294
4350
|
...restMenuProps
|
|
4295
4351
|
};
|
|
4296
|
-
return /* @__PURE__ */
|
|
4352
|
+
return /* @__PURE__ */ jsx33(
|
|
4297
4353
|
NestedMenuProvider,
|
|
4298
4354
|
{
|
|
4299
4355
|
...{
|
|
@@ -4307,11 +4363,11 @@ var NestedMenu = ({
|
|
|
4307
4363
|
setActiveMenuContext,
|
|
4308
4364
|
animationSpeed
|
|
4309
4365
|
},
|
|
4310
|
-
children: /* @__PURE__ */
|
|
4366
|
+
children: /* @__PURE__ */ jsx33(
|
|
4311
4367
|
NestedMenuPopout,
|
|
4312
4368
|
{
|
|
4313
4369
|
content: MenuComponent && // Handles the rerender of the component
|
|
4314
|
-
/* @__PURE__ */
|
|
4370
|
+
/* @__PURE__ */ jsx33(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsx33(
|
|
4315
4371
|
motion3.div,
|
|
4316
4372
|
{
|
|
4317
4373
|
variants: menuVariants,
|
|
@@ -4319,7 +4375,7 @@ var NestedMenu = ({
|
|
|
4319
4375
|
animate: "enter",
|
|
4320
4376
|
exit: "leave",
|
|
4321
4377
|
custom: { isAdding, hasLoadedOnce },
|
|
4322
|
-
children: /* @__PURE__ */
|
|
4378
|
+
children: /* @__PURE__ */ jsx33(MenuComponent, { ...nestedMenuProps })
|
|
4323
4379
|
},
|
|
4324
4380
|
`${currentMenuId}-content`
|
|
4325
4381
|
) }),
|
|
@@ -4335,6 +4391,7 @@ export {
|
|
|
4335
4391
|
ActionMenu,
|
|
4336
4392
|
Autocomplete,
|
|
4337
4393
|
AutocompleteInput,
|
|
4394
|
+
AutocompleteSelect,
|
|
4338
4395
|
AutocompleteTokenInput,
|
|
4339
4396
|
CustomPopoutContent,
|
|
4340
4397
|
INPUT_TYPES,
|