diff --git a/.gitattributes b/.gitattributes index 0dd26ee2c3..31d27a0985 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ amd/* linguist-generated=true -es/* linguist-generated=true +es/**/* linguist-generated=true dist/* linguist-generated=true -lib/* linguist-generated=true +lib/**/* linguist-generated=true diff --git a/karma.conf.js b/karma.conf.js index f26089096a..65b9cbf1ad 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -68,7 +68,7 @@ module.exports = config => { } }, - browsers: env.BROWSER ? env.BROWSER.split(',') : ['Chrome'], + browsers: env.BROWSER ? env.BROWSER.split(',') : ['ChromeHeadless'], singleRun: env.CONTINUOUS_INTEGRATION === 'true' }); diff --git a/package.json b/package.json index c2dc55bad4..0ff24ea394 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", "@babel/register": "^7.0.0", - "@cfaester/enzyme-adapter-react-18": "^0.8.0", "@testing-library/dom": "^10.4.1", "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^14.6.1", @@ -82,7 +81,6 @@ "colors": "^1.2.1", "create-react-class": "^15.6.3", "cross-env": "^5.2.0", - "enzyme": "^3.1.0", "eslint": "^4.19.1", "eslint-config-airbnb": "^16.1.0", "eslint-config-prettier": "^2.9.0", @@ -110,9 +108,9 @@ "mocha": "^5.2.0", "patch-package": "^8.0.0", "prettier": "^1.12.1", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "react-test-renderer": "^18.3.1", + "react": "19.2.7", + "react-dom": "19.2.7", + "react-test-renderer": "19.2.7", "release-script": "^1.0.2", "sinon": "^2.3.2", "sinon-chai": "^2.8.0", @@ -126,9 +124,9 @@ "keycode": "^2.2.0", "prop-types": "^15.6.1", "prop-types-extra": "^1.0.1", - "react-overlays": "^0.9.3", + "react-overlays": "^5.2.0", "react-prop-types": "^0.4.0", - "react-transition-group": "^2.0.0", + "react-transition-group": "^4.4.0", "uncontrollable": "^5.0.0", "warning": "^3.0.0" }, diff --git a/patches/react-overlays+0.9.3.patch b/patches/react-overlays+0.9.3.patch deleted file mode 100644 index 5539968862..0000000000 --- a/patches/react-overlays+0.9.3.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/node_modules/react-overlays/lib/Modal.js b/node_modules/react-overlays/lib/Modal.js -index 9fbba3b..c876341 100644 ---- a/node_modules/react-overlays/lib/Modal.js -+++ b/node_modules/react-overlays/lib/Modal.js -@@ -576,7 +576,7 @@ var _initialiseProps = function _initialiseProps() { - }; - - this.handleDocumentKeyDown = function (e) { -- if (_this2.props.keyboard && e.keyCode === 27 && _this2.isTopModal()) { -+ if (_this2.props.keyboard && (e.keyCode === 27 || e.key === 'Escape') && _this2.isTopModal()) { - if (_this2.props.onEscapeKeyDown) { - _this2.props.onEscapeKeyDown(e); - } -@@ -586,7 +586,7 @@ var _initialiseProps = function _initialiseProps() { - }; - - this.handleDocumentKeyUp = function (e) { -- if (_this2.props.keyboard && e.keyCode === 27 && _this2.isTopModal()) { -+ if (_this2.props.keyboard && (e.keyCode === 27 || e.key === 'Escape') && _this2.isTopModal()) { - if (_this2.props.onEscapeKeyUp) { - _this2.props.onEscapeKeyUp(e); - } -diff --git a/node_modules/react-overlays/lib/RootCloseWrapper.js b/node_modules/react-overlays/lib/RootCloseWrapper.js -index 683e1cf..c561092 100644 ---- a/node_modules/react-overlays/lib/RootCloseWrapper.js -+++ b/node_modules/react-overlays/lib/RootCloseWrapper.js -@@ -115,7 +115,7 @@ var RootCloseWrapper = function (_React$Component) { - return; - } - -- if (e.keyCode === escapeKeyCode && _this.props.onRootClose) { -+ if ((e.keyCode === escapeKeyCode || e.key === 'Escape') && _this.props.onRootClose) { - _this.props.onRootClose(e); - } - }; diff --git a/patches/react-overlays+5.2.1.patch b/patches/react-overlays+5.2.1.patch new file mode 100644 index 0000000000..3789e904b2 --- /dev/null +++ b/patches/react-overlays+5.2.1.patch @@ -0,0 +1,52 @@ +diff --git a/node_modules/react-overlays/cjs/Modal.js b/node_modules/react-overlays/cjs/Modal.js +index 2247ad0..71c9f4a 100644 +--- a/node_modules/react-overlays/cjs/Modal.js ++++ b/node_modules/react-overlays/cjs/Modal.js +@@ -215,7 +215,7 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) { + } + }); + var handleDocumentKeyDown = (0, _useEventCallback["default"])(function (e) { +- if (keyboard && e.keyCode === 27 && modal.isTopModal()) { ++ if (keyboard && (e.keyCode === 27 || e.key === 'Escape') && modal.isTopModal()) { + onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(e); + + if (!e.defaultPrevented) { +diff --git a/node_modules/react-overlays/cjs/useRootClose.js b/node_modules/react-overlays/cjs/useRootClose.js +index 3fc40a7..cc16674 100644 +--- a/node_modules/react-overlays/cjs/useRootClose.js ++++ b/node_modules/react-overlays/cjs/useRootClose.js +@@ -66,7 +66,7 @@ function useRootClose(ref, onRootClose, _temp) { + } + }); + var handleKeyUp = (0, _useEventCallback["default"])(function (e) { +- if (e.keyCode === escapeKeyCode) { ++ if (e.keyCode === escapeKeyCode || e.key === 'Escape') { + onClose(e); + } + }); +diff --git a/node_modules/react-overlays/esm/Modal.js b/node_modules/react-overlays/esm/Modal.js +index 42f79e4..a12ebac 100644 +--- a/node_modules/react-overlays/esm/Modal.js ++++ b/node_modules/react-overlays/esm/Modal.js +@@ -193,7 +193,7 @@ var Modal = /*#__PURE__*/forwardRef(function (_ref, ref) { + } + }); + var handleDocumentKeyDown = useEventCallback(function (e) { +- if (keyboard && e.keyCode === 27 && modal.isTopModal()) { ++ if (keyboard && (e.keyCode === 27 || e.key === 'Escape') && modal.isTopModal()) { + onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(e); + + if (!e.defaultPrevented) { +diff --git a/node_modules/react-overlays/esm/useRootClose.js b/node_modules/react-overlays/esm/useRootClose.js +index 8c7882c..30d0d56 100644 +--- a/node_modules/react-overlays/esm/useRootClose.js ++++ b/node_modules/react-overlays/esm/useRootClose.js +@@ -53,7 +53,7 @@ function useRootClose(ref, onRootClose, _temp) { + } + }); + var handleKeyUp = useEventCallback(function (e) { +- if (e.keyCode === escapeKeyCode) { ++ if (e.keyCode === escapeKeyCode || e.key === 'Escape') { + onClose(e); + } + }); diff --git a/src/ButtonGroup.js b/src/ButtonGroup.js index 1ea2a68845..84229f5b17 100644 --- a/src/ButtonGroup.js +++ b/src/ButtonGroup.js @@ -1,7 +1,7 @@ import classNames from 'classnames'; import React from 'react'; import PropTypes from 'prop-types'; -import all from 'prop-types-extra/lib/all'; +import warning from 'warning'; import Button from './Button'; import { @@ -19,13 +19,7 @@ const propTypes = { * Display block buttons; only useful when used with the "vertical" prop. * @type {bool} */ - block: all( - PropTypes.bool, - ({ block, vertical }) => - block && !vertical - ? new Error('`block` requires `vertical` to be set to have any effect') - : null - ) + block: PropTypes.bool }; const defaultProps = { @@ -39,6 +33,11 @@ class ButtonGroup extends React.Component { const { block, justified, vertical, className, ...props } = this.props; const [bsProps, elementProps] = splitBsProps(props); + warning( + !(block && !vertical), + '`block` requires `vertical` to be set to have any effect' + ); + const classes = { ...getClassSet(bsProps), [prefix(bsProps)]: !vertical, diff --git a/src/CarouselItem.js b/src/CarouselItem.js index 4c7d0eeda1..e4a11abbf8 100644 --- a/src/CarouselItem.js +++ b/src/CarouselItem.js @@ -1,7 +1,6 @@ import classNames from 'classnames'; import React from 'react'; import PropTypes from 'prop-types'; -import ReactDOM from 'react-dom'; import transition from 'dom-helpers/transition'; const propTypes = { @@ -29,6 +28,7 @@ class CarouselItem extends React.Component { direction: null }; + this.containerRef = React.createRef(); this.isUnmounted = false; } @@ -43,7 +43,7 @@ class CarouselItem extends React.Component { const prevActive = prevProps.active; if (!active && prevActive) { - transition.end(ReactDOM.findDOMNode(this), this.handleAnimateOutEnd); + transition.end(this.containerRef.current, this.handleAnimateOutEnd); } if (active !== prevActive) { @@ -99,7 +99,13 @@ class CarouselItem extends React.Component { classes[this.state.direction] = true; } - return