From 56b0f9be34c62c9ec11be535136c291804bad26c Mon Sep 17 00:00:00 2001 From: Ugo Stephant Date: Thu, 28 May 2020 09:17:47 +0200 Subject: [PATCH] fix(core): compatibility with react-popper v2 & @popperjs monorepo BREAKING CHANGES: - DropdownMenu: `modifiers` prop is now required to be an array - Added @popperjs/core as peerdep as it is a peerdep of react-popper v2 --- package.json | 6 ++-- src/DropdownMenu.js | 18 ++++++++--- src/Tooltip.js | 13 ++++++-- src/theme/components/Dropdown.styl | 2 -- src/theme/components/Tooltip.styl | 4 --- yarn.lock | 52 ++++++++++-------------------- 6 files changed, 45 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index a71d9a5ee..678df9a08 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "peerDependencies": { "react": "^16.0.0", "react-dom": "^16.0.0", - "react-popper": "^1.3.0" + "react-popper": "^2.2.0", + "@popperjs/core": "^2.4.0" }, "devDependencies": { "@babel/cli": "7.10.1", @@ -33,6 +34,7 @@ "@babel/preset-react": "7.10.1", "@poool/eslint-config": "0.0.1-alpha.6", "@poool/eslint-config-react": "0.0.1-alpha.6", + "@popperjs/core": "^2.4.0", "@rollup/plugin-babel": "5.0.2", "@rollup/plugin-commonjs": "12.0.0", "@rollup/plugin-node-resolve": "8.0.0", @@ -63,7 +65,7 @@ "react": "16.13.1", "react-dom": "16.13.1", "react-intl-tel-input": "8.0.2", - "react-popper": "1.3.7", + "react-popper": "2.2.3", "react-redux": "7.2.0", "react-router-dom": "5.2.0", "react-transition-group": "4.4.1", diff --git a/src/DropdownMenu.js b/src/DropdownMenu.js index faa54e3c2..53d0d713a 100644 --- a/src/DropdownMenu.js +++ b/src/DropdownMenu.js @@ -10,7 +10,7 @@ export default class DropdownMenu extends React.Component { static propTypes = { apparition: PropTypes.oneOf(['insert', 'css']), container: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), - modifiers: PropTypes.object, + modifiers: PropTypes.array, tag: PropTypes.oneOfType([ PropTypes.func, PropTypes.string, @@ -22,7 +22,7 @@ export default class DropdownMenu extends React.Component { static defaultProps = { apparition: 'insert', - modifiers: {}, + modifiers: [], tag: 'div', } @@ -63,11 +63,19 @@ export default class DropdownMenu extends React.Component { const menu = ( { this.innerRef = ref; }} > - { ({ ref, style, placement_, scheduleUpdate }) => { - this.scheduleUpdate = scheduleUpdate; + { ({ ref, style, placement_, update }) => { + this.scheduleUpdate = update; return ( - { ({ ref, style, placement, arrowProps, scheduleUpdate }) => { - this.scheduleUpdate = scheduleUpdate; + { ({ ref, style, placement, arrowProps, update }) => { + this.scheduleUpdate = update; return (