@sproutsocial/seeds-react-menu 1.7.6 → 1.7.8
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 +33 -0
- package/dist/esm/index.js +19 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +38 -21
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/NestedMenu/NestedMenu.stories.tsx +94 -0
- package/src/NestedMenu/NestedMenu.tsx +2 -0
- package/src/NestedMenu/NestedMenuPopout.tsx +18 -1
- package/src/NestedMenu/__tests__/NestedMenu.test.tsx +83 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,22 +8,22 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[32m89.95 KB[39m
|
|
12
|
-
[32mCJS[39m [1mdist/v2/index.js [22m[32m70.74 KB[39m
|
|
13
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m175.36 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m146.40 KB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in 342ms
|
|
16
|
-
[32mESM[39m [1mdist/esm/index.js [22m[32m70.92 KB[39m
|
|
17
11
|
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m60.19 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m71.37 KB[39m
|
|
18
13
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js [22m[32m9.15 KB[39m
|
|
19
|
-
[32mESM[39m [1mdist/esm/index.js.map [22m[32m151.40 KB[39m
|
|
20
14
|
[32mESM[39m [1mdist/esm/v2/index.js.map [22m[32m126.72 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m152.31 KB[39m
|
|
21
16
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js.map [22m[32m22.93 KB[39m
|
|
22
|
-
[32mESM[39m ⚡️ Build success in
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 406ms
|
|
18
|
+
[32mCJS[39m [1mdist/v2/index.js [22m[32m70.74 KB[39m
|
|
19
|
+
[32mCJS[39m [1mdist/index.js [22m[32m90.48 KB[39m
|
|
20
|
+
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m146.40 KB[39m
|
|
21
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m176.30 KB[39m
|
|
22
|
+
[32mCJS[39m ⚡️ Build success in 418ms
|
|
23
23
|
[34mDTS[39m Build start
|
|
24
|
-
[32mDTS[39m ⚡️ Build success in
|
|
24
|
+
[32mDTS[39m ⚡️ Build success in 16674ms
|
|
25
25
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m39.04 KB[39m
|
|
26
26
|
[32mDTS[39m [1mdist/v2/index.d.ts [22m[32m4.87 KB[39m
|
|
27
27
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m39.04 KB[39m
|
|
28
28
|
[32mDTS[39m [1mdist/v2/index.d.mts [22m[32m4.87 KB[39m
|
|
29
|
-
Done in
|
|
29
|
+
Done in 18.21s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-menu
|
|
2
2
|
|
|
3
|
+
## 1.7.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @sproutsocial/seeds-react-theme@3.3.1
|
|
8
|
+
- @sproutsocial/seeds-react-box@1.1.9
|
|
9
|
+
- @sproutsocial/seeds-react-icon@2.0.5
|
|
10
|
+
- @sproutsocial/seeds-react-label@1.0.8
|
|
11
|
+
- @sproutsocial/seeds-react-token-input@1.4.16
|
|
12
|
+
- @sproutsocial/seeds-react-checkbox@1.3.13
|
|
13
|
+
- @sproutsocial/seeds-react-input@1.4.16
|
|
14
|
+
- @sproutsocial/seeds-react-popout@2.4.16
|
|
15
|
+
- @sproutsocial/seeds-react-button@1.3.10
|
|
16
|
+
- @sproutsocial/seeds-react-switch@1.2.13
|
|
17
|
+
- @sproutsocial/seeds-react-radio@1.3.7
|
|
18
|
+
|
|
19
|
+
## 1.7.7
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 564ce83: Fix NestedMenu focus management to return focus to toggle button when menu closes (DS-3901)
|
|
24
|
+
|
|
25
|
+
**Changes:**
|
|
26
|
+
|
|
27
|
+
- Added `toggleElementRef` to NestedMenu component to track toggle button element
|
|
28
|
+
- Merged refs in NestedMenuPopout using `mergeRefs()` utility to combine Popout's ref with internal ref
|
|
29
|
+
- Added explicit focus management in `onClose` callback to ensure focus returns to toggle button
|
|
30
|
+
- Added focus management tests to verify behavior
|
|
31
|
+
- Added Storybook story "Focus Management (DS-3901)" to demonstrate the fix
|
|
32
|
+
|
|
33
|
+
**Impact:**
|
|
34
|
+
Users navigating by keyboard will now properly have focus returned to the toggle button when NestedMenu closes via Escape key, clicking menu items, or navigating through nested menus. This improves accessibility and keyboard navigation UX.
|
|
35
|
+
|
|
3
36
|
## 1.7.6
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -2207,8 +2207,10 @@ var NestedMenuRoot = ({
|
|
|
2207
2207
|
};
|
|
2208
2208
|
|
|
2209
2209
|
// src/NestedMenu/NestedMenuPopout.tsx
|
|
2210
|
+
import "react";
|
|
2210
2211
|
import { motion as motion2 } from "motion/react";
|
|
2211
2212
|
import styled9 from "styled-components";
|
|
2213
|
+
import { mergeRefs as mergeRefs4 } from "@sproutsocial/seeds-react-utilities";
|
|
2212
2214
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2213
2215
|
var StyledDiv = styled9(motion2.div)`
|
|
2214
2216
|
overflow: hidden;
|
|
@@ -2218,6 +2220,8 @@ var NestedMenuPopout = ({
|
|
|
2218
2220
|
menuToggleElement,
|
|
2219
2221
|
width,
|
|
2220
2222
|
onClose,
|
|
2223
|
+
toggleElementRef,
|
|
2224
|
+
focusLockProps,
|
|
2221
2225
|
...popoutProps
|
|
2222
2226
|
}) => {
|
|
2223
2227
|
const { activeMenuContext, rootMenuContextProps, resetSelectedMenuPath } = useNestedMenuContext();
|
|
@@ -2227,13 +2231,20 @@ var NestedMenuPopout = ({
|
|
|
2227
2231
|
lockPlacement: true,
|
|
2228
2232
|
onClose: () => {
|
|
2229
2233
|
onClose?.();
|
|
2230
|
-
setTimeout(() =>
|
|
2234
|
+
setTimeout(() => {
|
|
2235
|
+
toggleElementRef.current?.focus();
|
|
2236
|
+
resetSelectedMenuPath?.();
|
|
2237
|
+
}, 200);
|
|
2231
2238
|
},
|
|
2232
2239
|
isOpen: !!rootMenuContextProps.isOpen,
|
|
2233
2240
|
openMenu: rootMenuContextProps.openMenu,
|
|
2234
2241
|
closeMenu: rootMenuContextProps.closeMenu,
|
|
2235
2242
|
width,
|
|
2236
2243
|
content: (props) => /* @__PURE__ */ jsx30(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
|
|
2244
|
+
focusLockProps: {
|
|
2245
|
+
crossFrame: false,
|
|
2246
|
+
...focusLockProps
|
|
2247
|
+
},
|
|
2237
2248
|
...popoutProps,
|
|
2238
2249
|
children: (toggleProps) => /* @__PURE__ */ jsx30(
|
|
2239
2250
|
MenuToggleProvider,
|
|
@@ -2241,7 +2252,11 @@ var NestedMenuPopout = ({
|
|
|
2241
2252
|
menuContext: {
|
|
2242
2253
|
...activeMenuContext,
|
|
2243
2254
|
...rootMenuContextProps,
|
|
2244
|
-
...toggleProps
|
|
2255
|
+
...toggleProps,
|
|
2256
|
+
ref: mergeRefs4(
|
|
2257
|
+
toggleProps.ref,
|
|
2258
|
+
toggleElementRef
|
|
2259
|
+
)
|
|
2245
2260
|
},
|
|
2246
2261
|
children: menuToggleElement
|
|
2247
2262
|
}
|
|
@@ -2319,6 +2334,7 @@ var NestedMenu = ({
|
|
|
2319
2334
|
const [currentMenuId, setCurrentMenuId] = useState(initialMenuId);
|
|
2320
2335
|
const [isAdding, setIsAdding] = useState(false);
|
|
2321
2336
|
const popoutUpdateRef = useRef2();
|
|
2337
|
+
const toggleElementRef = useRef2(null);
|
|
2322
2338
|
const setSelectedMenuId = (id) => {
|
|
2323
2339
|
setIsAdding(true);
|
|
2324
2340
|
setSelectedMenuPath((currentPath) => [...currentPath, id]);
|
|
@@ -2483,6 +2499,7 @@ var NestedMenu = ({
|
|
|
2483
2499
|
) }),
|
|
2484
2500
|
menuToggleElement,
|
|
2485
2501
|
width,
|
|
2502
|
+
toggleElementRef,
|
|
2486
2503
|
scheduleUpdateRef: (callback) => {
|
|
2487
2504
|
popoutUpdateRef.current = callback;
|
|
2488
2505
|
externalPopoutUpdateRef?.(callback);
|