@sproutsocial/seeds-react-menu 1.2.0 → 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 +8 -0
- package/dist/esm/index.js +43 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +39 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Autocomplete/Autocomplete.stories.tsx +1 -1
- package/src/MenuContext.tsx +3 -1
- package/src/MenuRoot/MenuRoot.tsx +39 -10
- package/src/NestedMenu/NestedMenu.tsx +3 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -84,14 +84,14 @@ ESM Build start
|
|
|
84
84
|
╵ [32m~~~~~~~~~[0m
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
CJS dist/index.js 140.
|
|
88
|
-
CJS dist/index.js.map
|
|
89
|
-
CJS ⚡️ Build success in
|
|
90
|
-
ESM dist/esm/index.js
|
|
91
|
-
ESM dist/esm/index.js.map
|
|
92
|
-
ESM ⚡️ Build success in
|
|
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,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 1.2.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -2547,9 +2547,14 @@ var MenuGroup = ({
|
|
|
2547
2547
|
MenuGroup.__MENU_PRIMITIVE_TYPE = "MenuGroup";
|
|
2548
2548
|
|
|
2549
2549
|
// src/MenuRoot/MenuRoot.tsx
|
|
2550
|
-
import
|
|
2550
|
+
import React7, {
|
|
2551
|
+
useCallback as useCallback2,
|
|
2552
|
+
useEffect,
|
|
2553
|
+
useLayoutEffect
|
|
2554
|
+
} from "react";
|
|
2551
2555
|
import styled7 from "styled-components";
|
|
2552
2556
|
import { Popout } from "@sproutsocial/seeds-react-popout";
|
|
2557
|
+
import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
2553
2558
|
|
|
2554
2559
|
// ../../seeds-design-tokens/seeds-motion/dist/seeds-motion-unitless.esm.js
|
|
2555
2560
|
var MOTION_DURATION_FAST = 0.15;
|
|
@@ -2626,7 +2631,7 @@ var MenuRoot = ({
|
|
|
2626
2631
|
children,
|
|
2627
2632
|
menuToggleElement,
|
|
2628
2633
|
popoutProps: { placement = "bottom", focusLockProps, ...popoutProps } = {},
|
|
2629
|
-
width: width2
|
|
2634
|
+
width: width2,
|
|
2630
2635
|
...contextProps
|
|
2631
2636
|
}) => {
|
|
2632
2637
|
const {
|
|
@@ -2635,14 +2640,22 @@ var MenuRoot = ({
|
|
|
2635
2640
|
closeMenu,
|
|
2636
2641
|
inputValue,
|
|
2637
2642
|
hiddenItemsCount = 0,
|
|
2638
|
-
items
|
|
2643
|
+
items,
|
|
2644
|
+
getMenuProps
|
|
2639
2645
|
} = contextProps;
|
|
2640
|
-
const
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
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]);
|
|
2646
2659
|
useEffect(() => {
|
|
2647
2660
|
if (!inputValue) return;
|
|
2648
2661
|
if (items && hiddenItemsCount >= items.length && isOpen) {
|
|
@@ -2650,6 +2663,7 @@ var MenuRoot = ({
|
|
|
2650
2663
|
}
|
|
2651
2664
|
}, [hiddenItemsCount, items?.length, isOpen, inputValue]);
|
|
2652
2665
|
const menuContext = useMenu(contextProps);
|
|
2666
|
+
getMenuProps?.({}, { suppressRefError: true });
|
|
2653
2667
|
return /* @__PURE__ */ jsx10(
|
|
2654
2668
|
MenuPopout,
|
|
2655
2669
|
{
|
|
@@ -2658,8 +2672,22 @@ var MenuRoot = ({
|
|
|
2658
2672
|
openMenu,
|
|
2659
2673
|
closeMenu,
|
|
2660
2674
|
content: /* @__PURE__ */ jsx10(MenuContentProvider, { menuContext, children }),
|
|
2675
|
+
width: finalWidth,
|
|
2661
2676
|
...popoutProps,
|
|
2662
|
-
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
|
+
)
|
|
2663
2691
|
}
|
|
2664
2692
|
);
|
|
2665
2693
|
};
|
|
@@ -2963,7 +2991,7 @@ var MenuSearchTokenInput = ({
|
|
|
2963
2991
|
import React14 from "react";
|
|
2964
2992
|
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
2965
2993
|
import { Box as Box3 } from "@sproutsocial/seeds-react-box";
|
|
2966
|
-
import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
2994
|
+
import { mergeRefs as mergeRefs2 } from "@sproutsocial/seeds-react-utilities";
|
|
2967
2995
|
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2968
2996
|
var SubmenuItemTrigger = ({
|
|
2969
2997
|
id,
|
|
@@ -2972,7 +3000,7 @@ var SubmenuItemTrigger = ({
|
|
|
2972
3000
|
...rest
|
|
2973
3001
|
}) => {
|
|
2974
3002
|
const { getToggleButtonProps, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
|
|
2975
|
-
const toggleRef = ref && innerRef ?
|
|
3003
|
+
const toggleRef = ref && innerRef ? mergeRefs2([ref, innerRef].filter(Boolean)) : ref || innerRef;
|
|
2976
3004
|
return /* @__PURE__ */ jsx16(
|
|
2977
3005
|
MenuItem,
|
|
2978
3006
|
{
|
|
@@ -3966,7 +3994,7 @@ var useNestedMenuContext = () => {
|
|
|
3966
3994
|
|
|
3967
3995
|
// src/NestedMenu/NestedMenuContent.tsx
|
|
3968
3996
|
import { useEffect as useEffect4, useRef } from "react";
|
|
3969
|
-
import { mergeRefs as
|
|
3997
|
+
import { mergeRefs as mergeRefs3 } from "@sproutsocial/seeds-react-utilities";
|
|
3970
3998
|
|
|
3971
3999
|
// src/NestedMenu/NestedMenuItem.tsx
|
|
3972
4000
|
import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
|
|
@@ -4007,7 +4035,7 @@ var NestedMenuContent = ({
|
|
|
4007
4035
|
const { highlightedIndex, items } = useMenuContentContext();
|
|
4008
4036
|
const { setSelectedMenuId, selectedMenuPath, goBack } = useNestedMenuContext();
|
|
4009
4037
|
const internalRef = useRef(null);
|
|
4010
|
-
const innerRef =
|
|
4038
|
+
const innerRef = mergeRefs3(internalRef, innerRefProp);
|
|
4011
4039
|
const contentProps = children ? { children } : { menuItems, MenuItemComponent };
|
|
4012
4040
|
useEffect4(() => {
|
|
4013
4041
|
internalRef?.current?.focus();
|
|
@@ -4187,6 +4215,7 @@ var NestedMenu = ({
|
|
|
4187
4215
|
id: nestedMenuId,
|
|
4188
4216
|
onIsOpenChange: onNestedIsOpenChange
|
|
4189
4217
|
};
|
|
4218
|
+
rootMenuContextProps.getMenuProps?.({}, { suppressRefError: true });
|
|
4190
4219
|
const [selectedMenuPath, setSelectedMenuPath] = useState([initialMenuId]);
|
|
4191
4220
|
const [activeMenuContext, setActiveMenuContext] = useState(defaultMenuContext);
|
|
4192
4221
|
const [currentMenuId, setCurrentMenuId] = useState(initialMenuId);
|