@szhsin/react-menu
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -156,3 +156,3 @@ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
if (portal) { | ||
if (portal && typeof document !== 'undefined') { | ||
return /*#__PURE__*/createPortal(menuList, document.body); | ||
@@ -159,0 +159,0 @@ } else { |
@@ -160,3 +160,3 @@ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
throw new Error('[React-Menu] Menu cannot be positioned properly as container ref is null. If you initialise isOpen prop to true for ControlledMenu, please see this link for a solution: https://github.com/szhsin/react-menu/issues/2#issuecomment-719166062'); | ||
console.error('[React-Menu] Menu cannot be positioned properly as container ref is null. If you need to initialise `state` prop to "open" for ControlledMenu, please see this solution: https://codesandbox.io/s/initial-open-sp10wn'); | ||
} | ||
@@ -163,0 +163,0 @@ |
@@ -209,3 +209,4 @@ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
return isPortal ? /*#__PURE__*/createPortal(menuList, rootMenuRef.current) : menuList; | ||
var container = rootMenuRef.current; | ||
return isPortal && container ? /*#__PURE__*/createPortal(menuList, container) : menuList; | ||
}; | ||
@@ -212,0 +213,0 @@ |
{ | ||
"name": "@szhsin/react-menu", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "React component for building accessible menu, dropdown, submenu, context menu and more.", | ||
@@ -49,27 +49,27 @@ "author": "Zheng Song", | ||
"devDependencies": { | ||
"@babel/core": "^7.17.5", | ||
"@babel/core": "^7.17.9", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-react": "^7.16.7", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@testing-library/jest-dom": "^5.16.1", | ||
"@testing-library/react": "^12.1.2", | ||
"@types/react": "^17.0.39", | ||
"@rollup/plugin-node-resolve": "^13.2.1", | ||
"@testing-library/jest-dom": "^5.16.4", | ||
"@testing-library/react": "^13.1.1", | ||
"@types/react": "^18.0.7", | ||
"babel-plugin-pure-annotations": "^0.1.2", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
"dtslint": "^4.2.1", | ||
"eslint": "^8.9.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-jest": "^25.7.0", | ||
"eslint-plugin-react": "^7.27.1", | ||
"eslint-plugin-react-hooks": "^4.3.0", | ||
"eslint": "^8.13.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-jest": "^26.1.5", | ||
"eslint-plugin-react": "^7.29.4", | ||
"eslint-plugin-react-hooks": "^4.4.0", | ||
"eslint-plugin-react-hooks-addons": "^0.3.1", | ||
"jest": "^27.4.7", | ||
"jest": "^27.5.1", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.5.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"rollup": "^2.69.1", | ||
"sass": "^1.48.0", | ||
"typescript": "^4.5.5" | ||
"prettier": "^2.6.2", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"rollup": "^2.70.1", | ||
"sass": "^1.50.0", | ||
"typescript": "^4.6.3" | ||
}, | ||
@@ -76,0 +76,0 @@ "keywords": [ |
@@ -26,3 +26,4 @@ import React = require('react'); | ||
interface BaseProps<M = undefined> extends Omit<React.HTMLAttributes<HTMLElement>, 'className'> { | ||
interface BaseProps<M = undefined> | ||
extends Omit<React.HTMLAttributes<HTMLElement>, 'className' | 'children'> { | ||
ref?: React.Ref<any>; | ||
@@ -180,2 +181,5 @@ /** | ||
menuClassName?: ClassNameProp<MenuModifiers>; | ||
/** | ||
* This prop is forwarded to the `style` prop of menu DOM element. | ||
*/ | ||
menuStyle?: React.CSSProperties; | ||
@@ -186,2 +190,5 @@ /** | ||
arrowClassName?: ClassNameProp<MenuArrowModifiers>; | ||
/** | ||
* This prop is forwarded to the `style` prop of menu arrow DOM element. | ||
*/ | ||
arrowStyle?: React.CSSProperties; | ||
@@ -269,3 +276,3 @@ /** | ||
* *Note: for the best user experience, if the `overflow` prop is set to a value | ||
* other than 'visible', an 'auto' `viewScroll` will behave as 'close'*. | ||
* other than 'visible', an 'auto' `viewScroll` will behave as 'initial'*. | ||
* | ||
@@ -272,0 +279,0 @@ * @default 'initial' |
Sorry, the diff of this file is too big to display
189614
5259