Skip to content

Commit 84737f3

Browse files
authored
Merge pull request react-bootstrap#5698 from react-bootstrap/v5-merge
Merge master into bs5-dev
2 parents 3b23ced + 7898f5e commit 84737f3

File tree

17 files changed

+1044
-1542
lines changed

17 files changed

+1044
-1542
lines changed

.eslintrc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
{
2-
"extends": [
3-
"@react-bootstrap",
4-
"4catalyzer-typescript",
5-
"prettier",
6-
"prettier/react",
7-
"prettier/@typescript-eslint"
8-
],
9-
"plugins": [
10-
"prettier"
11-
],
2+
"extends": ["@react-bootstrap", "4catalyzer-typescript", "prettier"],
3+
"plugins": ["prettier"],
124
"rules": {
135
"import/extensions": "off",
146
"prettier/prettier": "warn"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.5.1](https://github.com/react-bootstrap/react-bootstrap/compare/v1.5.0...v1.5.1) (2021-03-02)
2+
3+
4+
5+
6+
17
# [1.5.0](https://github.com/react-bootstrap/react-bootstrap/compare/v1.4.3...v1.5.0) (2021-02-16)
28

39

karma.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ module.exports = (config) => {
3232
resolve: {
3333
symlinks: false,
3434
extensions: ['.js', '.jsx', '.ts', '.tsx'],
35+
// for Enzyme/Cheerio
36+
fallback: { stream: require.resolve('stream-browserify') },
3537
},
3638
plugins: [
3739
new DefinePlugin({
3840
__DEV__: true,
3941
'process.env.NODE_ENV': JSON.stringify('test'),
4042
}),
4143
],
42-
devtool: 'cheap-module-inline-source-map',
44+
devtool: 'inline-cheap-module-source-map',
4345
stats: 'minimal',
4446
},
4547

package.json

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-bootstrap",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "Bootstrap 4 components built with React",
55
"keywords": [
66
"react",
@@ -61,51 +61,51 @@
6161
"trailingComma": "all"
6262
},
6363
"dependencies": {
64-
"@babel/runtime": "^7.4.2",
64+
"@babel/runtime": "^7.13.8",
6565
"@restart/context": "^2.1.4",
66-
"@restart/hooks": "^0.3.21",
66+
"@restart/hooks": "^0.3.26",
6767
"@types/classnames": "^2.2.10",
6868
"@types/invariant": "^2.2.33",
6969
"@types/prop-types": "^15.7.3",
7070
"@types/react": ">=16.9.35",
71-
"@types/react-transition-group": "^4.4.0",
71+
"@types/react-transition-group": "^4.4.1",
7272
"@types/warning": "^3.0.0",
7373
"classnames": "^2.2.6",
7474
"dom-helpers": "^5.1.2",
7575
"invariant": "^2.2.4",
7676
"prop-types": "^15.7.2",
7777
"prop-types-extra": "^1.1.0",
78-
"react-overlays": "^4.1.1",
78+
"react-overlays": "^5.0.0",
7979
"react-transition-group": "^4.4.1",
80-
"uncontrollable": "^7.0.0",
80+
"uncontrollable": "^7.2.1",
8181
"warning": "^4.0.3"
8282
},
8383
"devDependencies": {
8484
"@4c/rollout": "^2.2.0",
8585
"@4c/tsconfig": "^0.3.1",
86-
"@babel/cli": "^7.12.13",
87-
"@babel/core": "^7.12.13",
88-
"@babel/preset-typescript": "^7.12.13",
89-
"@babel/register": "^7.12.13",
86+
"@babel/cli": "^7.13.0",
87+
"@babel/core": "^7.13.8",
88+
"@babel/preset-typescript": "^7.13.0",
89+
"@babel/register": "^7.13.8",
9090
"@react-bootstrap/babel-preset": "^1.2.0",
9191
"@react-bootstrap/eslint-config": "^1.3.2",
92-
"@typescript-eslint/eslint-plugin": "^3.10.1",
93-
"@typescript-eslint/parser": "^3.10.1",
92+
"@typescript-eslint/eslint-plugin": "^4.16.1",
93+
"@typescript-eslint/parser": "^4.16.1",
9494
"babel-eslint": "^10.1.0",
9595
"babel-loader": "^8.2.2",
9696
"babel-plugin-istanbul": "^6.0.0",
97-
"chai": "^4.3.0",
97+
"chai": "^4.3.3",
9898
"chalk": "^4.1.0",
9999
"cherry-pick": "^0.5.0",
100100
"codecov": "^3.8.1",
101101
"conventional-changelog-cli": "^2.1.1",
102102
"cpy-cli": "^3.1.1",
103103
"cross-env": "^7.0.3",
104-
"dtslint": "^4.0.6",
104+
"dtslint": "^4.0.7",
105105
"enzyme": "^3.11.0",
106106
"enzyme-adapter-react-16": "^1.15.6",
107-
"eslint": "^7.19.0",
108-
"eslint-config-4catalyzer-typescript": "^2.0.4",
107+
"eslint": "^7.21.0",
108+
"eslint-config-4catalyzer-typescript": "^3.0.3",
109109
"eslint-import-resolver-node": "^0.3.4",
110110
"eslint-import-resolver-webpack": "^0.13.0",
111111
"eslint-plugin-import": "^2.22.1",
@@ -116,7 +116,7 @@
116116
"execa": "^5.0.0",
117117
"fs-extra": "^9.1.0",
118118
"husky": "^4.3.8",
119-
"karma": "^5.2.3",
119+
"karma": "^6.1.1",
120120
"karma-chrome-launcher": "^3.1.0",
121121
"karma-cli": "^2.0.0",
122122
"karma-coverage": "^2.0.3",
@@ -125,18 +125,20 @@
125125
"karma-mocha-reporter": "^2.2.5",
126126
"karma-sinon-chai": "^2.0.2",
127127
"karma-sourcemap-loader": "^0.3.8",
128-
"karma-webpack": "^4.0.2",
128+
"karma-webpack": "^5.0.0",
129129
"lint-staged": "^10.5.4",
130-
"lodash": "^4.17.20",
131-
"mocha": "^8.2.1",
130+
"lodash": "^4.17.21",
131+
"mocha": "^8.3.0",
132132
"prettier": "^2.2.1",
133133
"react": "^16.14.0",
134134
"react-dom": "^16.14.0",
135135
"react-test-renderer": "^16.14.0",
136+
"simulant": "^0.2.2",
136137
"sinon": "^9.2.4",
137138
"sinon-chai": "^3.5.0",
138-
"typescript": "^4.1.3",
139-
"webpack": "^4.46.0"
139+
"stream-browserify": "^3.0.0",
140+
"typescript": "^4.2.2",
141+
"webpack": "^5.24.3"
140142
},
141143
"peerDependencies": {
142144
"react": ">=16.8.0",

src/Carousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const propTypes = {
7070
*/
7171
slide: PropTypes.bool,
7272

73-
/** Cross fade slides instead of the default slide animation */
73+
/** Animates slides with a crossfade animation instead of the default slide animation */
7474
fade: PropTypes.bool,
7575

7676
/**

src/Dropdown.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ const Dropdown: BsPrefixRefForwardingComponent<
143143

144144
const handleToggle = useEventCallback(
145145
(nextShow, event, source = event.type) => {
146-
if (event.currentTarget === document) source = 'rootClose';
146+
if (
147+
event.currentTarget === document &&
148+
(source !== 'keydown' || event.key === 'Escape')
149+
)
150+
source = 'rootClose';
147151
onToggle?.(nextShow, event, { source });
148152
},
149153
);
@@ -172,21 +176,18 @@ const Dropdown: BsPrefixRefForwardingComponent<
172176
focusFirstItemOnShow={focusFirstItemOnShow}
173177
itemSelector={`.${prefix}-item:not(.disabled):not(:disabled)`}
174178
>
175-
{({ props: dropdownProps }) => (
176-
<Component
177-
{...props}
178-
{...dropdownProps}
179-
ref={ref}
180-
className={classNames(
181-
className,
182-
show && 'show',
183-
(!drop || drop === 'down') && prefix,
184-
drop === 'up' && 'dropup',
185-
drop === 'end' && 'dropend',
186-
drop === 'start' && 'dropstart',
187-
)}
188-
/>
189-
)}
179+
<Component
180+
{...props}
181+
ref={ref}
182+
className={classNames(
183+
className,
184+
show && 'show',
185+
(!drop || drop === 'down') && prefix,
186+
drop === 'up' && 'dropup',
187+
drop === 'end' && 'dropend',
188+
drop === 'start' && 'dropstart',
189+
)}
190+
/>
190191
</BaseDropdown>
191192
</SelectableContext.Provider>
192193
);

src/DropdownMenu.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
33
import React, { useContext } from 'react';
44
import {
55
useDropdownMenu,
6-
UseDropdownMenuValue,
76
UseDropdownMenuOptions,
87
} from 'react-overlays/DropdownMenu';
98
import useMergedRefs from '@restart/hooks/useMergedRefs';
@@ -125,9 +124,6 @@ const defaultProps: Partial<DropdownMenuProps> = {
125124
flip: true,
126125
};
127126

128-
// TODO: remove this hack
129-
type UseDropdownMenuValueHack = UseDropdownMenuValue & { placement: any };
130-
131127
const DropdownMenu: BsPrefixRefForwardingComponent<
132128
'div',
133129
DropdownMenuProps
@@ -180,22 +176,18 @@ const DropdownMenu: BsPrefixRefForwardingComponent<
180176
}
181177
}
182178

183-
const {
184-
hasShown,
185-
placement,
186-
show,
187-
alignEnd,
188-
close,
189-
props: menuProps,
190-
} = useDropdownMenu({
179+
const [
180+
menuProps,
181+
{ hasShown, popper, show, alignEnd, toggle },
182+
] = useDropdownMenu({
191183
flip,
192184
rootCloseEvent,
193185
show: showProps,
194186
alignEnd: alignRight,
195187
usePopper: !isNavbar && alignClasses.length === 0,
196188
offset: [0, 2],
197189
popperConfig,
198-
}) as UseDropdownMenuValueHack;
190+
});
199191

200192
menuProps.ref = useMergedRefs(
201193
useWrappedRefWithWarning(ref, 'DropdownMenu'),
@@ -207,16 +199,16 @@ const DropdownMenu: BsPrefixRefForwardingComponent<
207199
// For custom components provide additional, non-DOM, props;
208200
if (typeof Component !== 'string') {
209201
(menuProps as any).show = show;
210-
(menuProps as any).close = close;
202+
(menuProps as any).close = () => toggle?.(false);
211203
(menuProps as any).alignRight = alignEnd;
212204
}
213205

214206
let style = props.style;
215-
if (placement) {
207+
if (popper?.placement) {
216208
// we don't need the default popper style,
217209
// menus are display: none when not shown.
218210
style = { ...props.style, ...menuProps.style };
219-
props['x-placement'] = placement;
211+
props['x-placement'] = popper.placement;
220212
}
221213

222214
return (

src/DropdownToggle.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const DropdownToggle: DropdownToggleComponent = React.forwardRef(
6767
(props as any).bsPrefix = childBsPrefix;
6868
}
6969

70-
const [toggleProps, { toggle }] = useDropdownToggle();
70+
const [toggleProps] = useDropdownToggle();
7171

7272
toggleProps.ref = useMergedRefs(
7373
toggleProps.ref,
@@ -78,7 +78,6 @@ const DropdownToggle: DropdownToggleComponent = React.forwardRef(
7878
// underlying component, to allow it to render size and style variants.
7979
return (
8080
<Component
81-
onClick={toggle}
8281
className={classNames(className, prefix, split && `${prefix}-split`)}
8382
{...toggleProps}
8483
{...props}

src/OverlayTrigger.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function normalizeDelay(delay?: OverlayDelay) {
5656
// for cases when the trigger is disabled and mouseOut/Over can cause flicker
5757
// moving from one child element to another.
5858
function handleMouseOverOut(
59+
// eslint-disable-next-line @typescript-eslint/no-shadow
5960
handler: (...args: [React.MouseEvent, ...any[]]) => any,
6061
args: [React.MouseEvent, ...any[]],
6162
relatedNative: 'fromElement' | 'toElement',

src/ProgressBar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function onlyProgressBar(props, propName, componentName): Error | null {
4545
*
4646
* see https://github.com/gaearon/react-hot-loader#checking-element-types
4747
*/
48+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
4849
const element = <ProgressBar />;
4950
if (child.type === element.type) return;
5051

test/DropdownSpec.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { mount } from 'enzyme';
22
import React from 'react';
33
import ReactDOM from 'react-dom';
4+
import simulant from 'simulant';
45
import Dropdown from '../src/Dropdown';
56

67
describe('<Dropdown>', () => {
@@ -247,14 +248,17 @@ describe('<Dropdown>', () => {
247248
const spy = sinon.spy();
248249
const wrapper = mount(
249250
<Dropdown onToggle={spy}>{dropdownChildren}</Dropdown>,
251+
{ attachTo: focusableContainer },
250252
);
251253

252-
wrapper.find('button').simulate('keyDown', { key: 'ArrowDown' });
254+
simulant.fire(wrapper.find('button').getDOMNode(), 'keydown', {
255+
key: 'ArrowDown',
256+
});
253257

254258
expect(spy).to.have.been.calledOnce;
255259
expect(spy.getCall(0).args.length).to.equal(3);
256260
expect(spy.getCall(0).args[0]).to.equal(true);
257-
expect(spy.getCall(0).args[1]).to.be.an('object');
261+
expect(spy.getCall(0).args[1]).to.be.an('event');
258262
assert.deepEqual(spy.getCall(0).args[2], { source: 'keydown' });
259263
});
260264
});

www/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,27 @@
4343
"bootstrap": "^5.0.0-beta2",
4444
"classnames": "^2.2.6",
4545
"common-tags": "^1.8.0",
46-
"copy-text-to-clipboard": "^3.0.0",
46+
"copy-text-to-clipboard": "^3.0.1",
4747
"docsearch.js": "^2.6.3",
4848
"dom-helpers": "^5.2.0",
4949
"fibers": "^5.0.0",
5050
"formik": "^2.2.6",
51-
"gatsby": "^2.32.3",
51+
"gatsby": "^2.32.9",
5252
"gatsby-plugin-astroturf": "^0.2.1",
5353
"gatsby-plugin-catch-links": "^2.10.0",
54-
"gatsby-plugin-mdx": "^1.10.0",
54+
"gatsby-plugin-mdx": "^1.10.1",
5555
"gatsby-plugin-react-helmet": "^3.10.0",
5656
"gatsby-plugin-sass": "^3.2.0",
5757
"gatsby-remark-prismjs": "^3.13.0",
58-
"gatsby-source-filesystem": "2.11.0",
58+
"gatsby-source-filesystem": "2.11.1",
5959
"gatsby-transformer-react-docgen": "^5.9.0",
60-
"gatsby-transformer-remark": "^2.16.0",
60+
"gatsby-transformer-remark": "^2.16.1",
6161
"gh-pages": "^3.1.0",
6262
"holderjs": "^2.9.9",
6363
"import-sort-cli": "^6.0.0",
6464
"import-sort-parser-4catalyzer": "^4.0.1",
6565
"import-sort-style-module": "^6.0.0",
66-
"lodash": "^4.17.20",
66+
"lodash": "^4.17.21",
6767
"prismjs": "^1.23.0",
6868
"prop-types": "^15.7.2",
6969
"react": "^16.14.0",
@@ -72,8 +72,8 @@
7272
"react-helmet": "^6.1.0",
7373
"react-live": "^2.2.3",
7474
"remark-slug": "^6.0.0",
75-
"sass": "^1.32.5",
75+
"sass": "^1.32.8",
7676
"shakespeare-data": "^3.0.0",
77-
"yup": "^0.32.8"
77+
"yup": "^0.32.9"
7878
}
7979
}

www/src/components/CssCodeBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function CssCodeBlock() {
1111
codeText={`
1212
<link
1313
rel="stylesheet"
14-
href="https://maxcdn.bootstrapcdn.com/bootstrap/${bootstrapVersion}/css/bootstrap.min.css"
14+
href="https://cdn.jsdelivr.net/npm/bootstrap@${bootstrapVersion}/dist/css/bootstrap.min.css"
1515
integrity="${cssHash}"
1616
crossorigin="anonymous"
1717
/>

0 commit comments

Comments
 (0)