Updated the react-menu library from v2 to v4. #8061

This commit is contained in:
Pravesh Sharma 2024-10-30 17:08:24 +05:30 committed by GitHub
parent a9bfa8a71d
commit 2f4cae35bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 18 deletions

View File

@ -84,7 +84,7 @@
"@mui/x-date-pickers": "^7.7.1", "@mui/x-date-pickers": "^7.7.1",
"@projectstorm/react-diagrams": "^7.0.4", "@projectstorm/react-diagrams": "^7.0.4",
"@simonwep/pickr": "^1.5.1", "@simonwep/pickr": "^1.5.1",
"@szhsin/react-menu": "^2.2.0", "@szhsin/react-menu": "^4.2.2",
"@tanstack/react-query": "5.37.1", "@tanstack/react-query": "5.37.1",
"@tanstack/react-table": "^8.16.0", "@tanstack/react-table": "^8.16.0",
"@tanstack/react-virtual": "^3.8.4", "@tanstack/react-virtual": "^3.8.4",

View File

@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
import { import {
MenuItem, MenuItem,
ControlledMenu, ControlledMenu,
applyStatics,
Menu, Menu,
SubMenu, SubMenu,
} from '@szhsin/react-menu'; } from '@szhsin/react-menu';
@ -48,13 +47,17 @@ PgMenu.propTypes = {
menuButton: PropTypes.element, menuButton: PropTypes.element,
}; };
export const PgSubMenu = applyStatics(SubMenu)(({label, ...props})=>{ export const PgSubMenu = (({label, ...props})=>{
return ( return (
<SubMenu label={label} itemProps={{'data-label': label}} {...props} /> <SubMenu label={label} itemProps={{'data-label': label}} {...props} />
); );
}); });
export const PgMenuItem = applyStatics(MenuItem)(({hasCheck=false, checked=false, accesskey, shortcut, children, closeOnCheck=false, ...props})=>{ PgSubMenu.propTypes = {
label: PropTypes.string
};
export const PgMenuItem = (({hasCheck=false, checked=false, accesskey, shortcut, children, closeOnCheck=false, ...props})=>{
let onClick = props.onClick; let onClick = props.onClick;
if(hasCheck) { if(hasCheck) {
@ -83,7 +86,7 @@ PgMenuItem.propTypes = {
children: CustomPropTypes.children, children: CustomPropTypes.children,
closeOnCheck: PropTypes.bool, closeOnCheck: PropTypes.bool,
onClick: PropTypes.func, onClick: PropTypes.func,
dataLabel: PropTypes.string, datalabel: PropTypes.string,
}; };
export function usePgMenuGroup() { export function usePgMenuGroup() {

View File

@ -32,7 +32,7 @@ describe('Menu', ()=>{
}; };
it('init', ()=>{ it('init', ()=>{
ctrlMount(); ctrlMount();
const menu = screen.getByRole('menu'); const menu = screen.getByRole('menu',{hidden: true});
expect(menu.getAttribute('data-state')).toBe('closed'); expect(menu.getAttribute('data-state')).toBe('closed');
}); });

View File

@ -3033,16 +3033,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@szhsin/react-menu@npm:^2.2.0": "@szhsin/react-menu@npm:^4.2.2":
version: 2.3.4 version: 4.2.2
resolution: "@szhsin/react-menu@npm:2.3.4" resolution: "@szhsin/react-menu@npm:4.2.2"
dependencies: dependencies:
prop-types: ^15.7.2 prop-types: ^15.7.2
react-transition-state: ^1.1.3 react-transition-state: ^2.1.0
peerDependencies: peerDependencies:
react: ">=16.8.0" react: ">=16.14.0"
react-dom: ">=16.8.0" react-dom: ">=16.14.0"
checksum: 94d8b78166a69816852b53e1cf7929ffbbbb54010958d9124e48fcea4a72bc0572b242efb176d3c3cec003014ef7d26b9d191f5baf11825bedabf13ff1c525a9 checksum: b65c231e5a5fb258aa3211c6acc93b805df2992b55dcbd791535745b1a1670ce4ee3ecdf83e271621cfc3f78fed5e8768c32004fc0fe3d1ef4f93c6a53b41086
languageName: node languageName: node
linkType: hard linkType: hard
@ -13364,13 +13364,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"react-transition-state@npm:^1.1.3": "react-transition-state@npm:^2.1.0":
version: 1.1.5 version: 2.1.3
resolution: "react-transition-state@npm:1.1.5" resolution: "react-transition-state@npm:2.1.3"
peerDependencies: peerDependencies:
react: ">=16.8.0" react: ">=16.8.0"
react-dom: ">=16.8.0" react-dom: ">=16.8.0"
checksum: 4ca616583cd12825706be94886cf1512e0995170709435971787c7d5adf3d95d6349df17f45d74e805453e338a220e2ebe1b54a5d696bcad4617a71e24e02c59 checksum: 6a5fd4d729695b42fc220903f0ea6faf19fe2ed576350cf58fdfcffb98e838ed1ea789b707996297fcf13b7e4b052cfc84004d90e5b9667fe01538226aa2cec6
languageName: node languageName: node
linkType: hard linkType: hard
@ -13824,7 +13824,7 @@ __metadata:
"@projectstorm/react-diagrams": ^7.0.4 "@projectstorm/react-diagrams": ^7.0.4
"@simonwep/pickr": ^1.5.1 "@simonwep/pickr": ^1.5.1
"@svgr/webpack": ^8.1.0 "@svgr/webpack": ^8.1.0
"@szhsin/react-menu": ^2.2.0 "@szhsin/react-menu": ^4.2.2
"@tanstack/react-query": 5.37.1 "@tanstack/react-query": 5.37.1
"@tanstack/react-table": ^8.16.0 "@tanstack/react-table": ^8.16.0
"@tanstack/react-virtual": ^3.8.4 "@tanstack/react-virtual": ^3.8.4