Skip to content

Commit d278c49

Browse files
committed
Merge branch 'master' into v5-merge-master
2 parents 8a7e095 + 09d7bb3 commit d278c49

File tree

14 files changed

+1122
-443
lines changed

14 files changed

+1122
-443
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,16 @@ desired change easier.
4646

4747
## Documentation
4848

49-
Please update the docs with any API changes, the code and docs should always be
50-
in sync.
49+
Please update the docs with any API changes, the code and docs should always be in sync.
5150

52-
Component prop documentation is generated automatically from the React components
53-
and their leading comments. Please make sure to provide comments for any `propTypes` you add
54-
or change in a Component.
51+
The main documentation lives in the `www` folder which is a Gatsby project that uses [MDX](https://www.gatsbyjs.com/docs/how-to/routing/mdx/). The long-form documentation for components, including interactive examples and guides, is found within the `pages/components` directory.
52+
53+
Separately, component prop API documentation is generated automatically from the React components in the `src` directory and their leading comments. This is the documentation that shows up in the tables at the bottom of component doc pages, e.g. [here](https://react-bootstrap.github.io/components/accordion/#api). Please make sure to provide [TSDOC-style](https://tsdoc.org/) comments\* for any `propTypes` you add or change in a component.
54+
55+
Here's an example of well-documented `propTypes`:
5556

5657
```js
57-
propTypes: {
58+
const propTypes = {
5859
/**
5960
* Sets the visibility of the Component
6061
*/
@@ -65,15 +66,15 @@ propTypes: {
6566
* @type {func}
6667
* @required
6768
*/
68-
onHide: myCustomPropType
69-
}
69+
onHide: myCustomPropType,
70+
};
7071
```
7172

72-
There are a few caveats to this format that differ from conventional JSDoc comments.
73+
\*Note: there are a few caveats to this format that differ from conventional TSDoc comments:
7374

74-
- Only specific doclets (the @ things) should be used, and only when the data cannot be parsed from the component itself
75-
- `@type`: Override the "type", use the same names as the default React PropTypes: string, func, bool, number, object. You can express enum and oneOfType types, Like `{("optionA"|"optionB")}`.
76-
- `@required`: to mark a prop as required (use the normal React isRequired if possible)
75+
- Only specific doclets (the @ things, a.k.a Block Tags) should be used, and only when the data cannot be parsed from the component itself.
76+
- `@type`: An optional type override. Use the same names as the default React PropTypes: string, func, bool, number, object. This can be helpful to express enums and `oneOfType` types, e.g. `{("optionA"|"optionB")}`.
77+
- `@required`: Mark a prop as required (use the normal React `isRequired` if possible)
7778
- `@private`: Will hide the prop in the documentation
7879
- All description text should be above the doclets.
7980

package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"url": "git+https://github.com/react-bootstrap/react-bootstrap.git"
3333
},
3434
"scripts": {
35-
"bootstrap": "yarn && yarn --cwd www",
35+
"bootstrap": "yarn --network-timeout 100000 && yarn --cwd www --network-timeout 100000",
3636
"build": "node tools/build.js",
3737
"build-docs": "yarn --cwd www build",
3838
"build-types": "yarn tsc -d --emitDeclarationOnly --outDir types",
@@ -77,42 +77,42 @@
7777
"warning": "^4.0.3"
7878
},
7979
"devDependencies": {
80-
"@4c/rollout": "^2.2.0",
80+
"@4c/rollout": "^2.2.1",
8181
"@4c/tsconfig": "^0.3.1",
82-
"@babel/cli": "^7.13.10",
83-
"@babel/core": "^7.13.10",
82+
"@babel/cli": "^7.13.16",
83+
"@babel/core": "^7.14.0",
8484
"@babel/preset-typescript": "^7.13.0",
85-
"@babel/register": "^7.13.8",
85+
"@babel/register": "^7.13.16",
8686
"@react-bootstrap/babel-preset": "^2.0.0",
8787
"@react-bootstrap/eslint-config": "^2.0.0",
88-
"@typescript-eslint/eslint-plugin": "^4.17.0",
89-
"@typescript-eslint/parser": "^4.17.0",
88+
"@typescript-eslint/eslint-plugin": "^4.22.1",
89+
"@typescript-eslint/parser": "^4.22.1",
9090
"babel-eslint": "^10.1.0",
9191
"babel-loader": "^8.2.2",
9292
"babel-plugin-istanbul": "^6.0.0",
93-
"chai": "^4.3.3",
94-
"chalk": "^4.1.0",
93+
"chai": "^4.3.4",
94+
"chalk": "^4.1.1",
9595
"cherry-pick": "^0.5.0",
96-
"codecov": "^3.8.1",
96+
"codecov": "^3.8.2",
9797
"conventional-changelog-cli": "^2.1.1",
9898
"cpy-cli": "^3.1.1",
9999
"cross-env": "^7.0.3",
100-
"dtslint": "^4.0.7",
100+
"dtslint": "^4.0.9",
101101
"enzyme": "^3.11.0",
102102
"enzyme-adapter-react-16": "^1.15.6",
103-
"eslint": "^7.21.0",
103+
"eslint": "^7.26.0",
104104
"eslint-config-4catalyzer-typescript": "^3.0.3",
105105
"eslint-import-resolver-node": "^0.3.4",
106106
"eslint-import-resolver-webpack": "^0.13.0",
107107
"eslint-plugin-import": "^2.22.1",
108108
"eslint-plugin-jsx-a11y": "^6.4.1",
109109
"eslint-plugin-mocha": "^8.1.0",
110-
"eslint-plugin-prettier": "^3.3.1",
111-
"eslint-plugin-react": "^7.22.0",
110+
"eslint-plugin-prettier": "^3.4.0",
111+
"eslint-plugin-react": "^7.23.2",
112112
"execa": "^5.0.0",
113-
"fs-extra": "^9.1.0",
114-
"husky": "^5.1.3",
115-
"karma": "^6.2.0",
113+
"fs-extra": "^10.0.0",
114+
"husky": "^6.0.0",
115+
"karma": "^6.3.2",
116116
"karma-chrome-launcher": "^3.1.0",
117117
"karma-cli": "^2.0.0",
118118
"karma-coverage": "^2.0.3",
@@ -122,19 +122,19 @@
122122
"karma-sinon-chai": "^2.0.2",
123123
"karma-sourcemap-loader": "^0.3.8",
124124
"karma-webpack": "^5.0.0",
125-
"lint-staged": "^10.5.4",
125+
"lint-staged": "^11.0.0",
126126
"lodash": "^4.17.21",
127-
"mocha": "^8.3.1",
128-
"prettier": "^2.2.1",
127+
"mocha": "^8.4.0",
128+
"prettier": "^2.3.0",
129129
"react": "^16.14.0",
130130
"react-dom": "^16.14.0",
131131
"react-test-renderer": "^16.14.0",
132132
"simulant": "^0.2.2",
133133
"sinon": "^9.2.4",
134-
"sinon-chai": "^3.5.0",
134+
"sinon-chai": "^3.6.0",
135135
"stream-browserify": "^3.0.0",
136-
"typescript": "^4.2.3",
137-
"webpack": "^5.24.4"
136+
"typescript": "^4.2.4",
137+
"webpack": "^5.36.2"
138138
},
139139
"peerDependencies": {
140140
"react": ">=16.14.0",

src/Nav.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface NavProps
3131
justify?: boolean;
3232
onSelect?: SelectCallback;
3333
navbar?: boolean;
34+
navbarScroll?: boolean;
3435
}
3536

3637
const propTypes = {
@@ -98,6 +99,11 @@ const propTypes = {
9899
*/
99100
navbar: PropTypes.bool,
100101

102+
/**
103+
* Enable vertical scrolling within the toggleable contents of a collapsed Navbar.
104+
*/
105+
navbarScroll: PropTypes.bool,
106+
101107
as: PropTypes.elementType,
102108

103109
/** @private */
@@ -120,6 +126,7 @@ const Nav: BsPrefixRefForwardingComponent<'div', NavProps> = React.forwardRef<
120126
fill,
121127
justify,
122128
navbar,
129+
navbarScroll,
123130
className,
124131
activeKey,
125132
...props
@@ -149,6 +156,7 @@ const Nav: BsPrefixRefForwardingComponent<'div', NavProps> = React.forwardRef<
149156
className={classNames(className, {
150157
[bsPrefix]: !isNavbar,
151158
[`${navbarBsPrefix}-nav`]: isNavbar,
159+
[`${navbarBsPrefix}-nav-scroll`]: isNavbar && navbarScroll,
152160
[`${cardHeaderBsPrefix}-${variant}`]: !!cardHeaderBsPrefix,
153161
[`${bsPrefix}-${variant}`]: !!variant,
154162
[`${bsPrefix}-fill`]: fill,

test/NavSpec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ describe('<Nav>', () => {
7373
).assertSingle('div.navbar-nav');
7474
});
7575

76+
it('should handle navbarScroll only if within navbar', () => {
77+
mount(
78+
<Navbar>
79+
<Nav navbarScroll />
80+
</Navbar>,
81+
).assertSingle('div.navbar-nav.navbar-nav-scroll');
82+
});
83+
84+
it('should not add navbarScroll when not within navbar', () => {
85+
const wrapper = mount(<Nav navbarScroll />);
86+
87+
const nav = wrapper.find('div.nav');
88+
expect(nav.hasClass('navbar-nav-scroll')).to.not.be.true;
89+
});
90+
7691
it('should be card header aware', () => {
7792
mount(
7893
<CardHeader>

www/gatsby-config.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const { cleanDoclets } = require('gatsby-transformer-react-docgen/doclets');
22
const path = require('path');
33
const remarkSlug = require('remark-slug');
4-
const Fiber = require('fibers');
54

65
const defaultDescriptions = require('./src/defaultPropDescriptions');
76

@@ -63,14 +62,7 @@ module.exports = {
6362
},
6463
},
6564
'gatsby-plugin-catch-links',
66-
{
67-
resolve: 'gatsby-plugin-sass',
68-
options: {
69-
sassOptions: {
70-
fiber: Fiber,
71-
},
72-
},
73-
},
65+
'gatsby-plugin-sass',
7466
{
7567
resolve: 'gatsby-plugin-astroturf',
7668
options: { extension: '.module.scss' },

www/package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
}
3131
},
3232
"devDependencies": {
33-
"@fortawesome/fontawesome-svg-core": "^1.2.34",
34-
"@fortawesome/free-brands-svg-icons": "^5.15.2",
35-
"@fortawesome/free-solid-svg-icons": "^5.15.2",
33+
"@fortawesome/fontawesome-svg-core": "^1.2.35",
34+
"@fortawesome/free-brands-svg-icons": "^5.15.3",
35+
"@fortawesome/free-solid-svg-icons": "^5.15.3",
3636
"@fortawesome/react-fontawesome": "^0.1.14",
3737
"@mdx-js/mdx": "^1.6.22",
3838
"@mdx-js/react": "^1.6.22",
@@ -45,10 +45,9 @@
4545
"common-tags": "^1.8.0",
4646
"copy-text-to-clipboard": "^3.0.1",
4747
"docsearch.js": "^2.6.3",
48-
"dom-helpers": "^5.2.0",
49-
"fibers": "^5.0.0",
48+
"dom-helpers": "^5.2.1",
5049
"formik": "^2.2.6",
51-
"gatsby": "^2.32.11",
50+
"gatsby": "^2.32.13",
5251
"gatsby-plugin-astroturf": "^0.2.1",
5352
"gatsby-plugin-catch-links": "^2.10.0",
5453
"gatsby-plugin-mdx": "^1.10.1",
@@ -67,12 +66,12 @@
6766
"prismjs": "^1.23.0",
6867
"prop-types": "^15.7.2",
6968
"react": "^16.14.0",
70-
"react-docgen": "^5.3.1",
69+
"react-docgen": "^5.4.0",
7170
"react-dom": "^16.14.0",
7271
"react-helmet": "^6.1.0",
7372
"react-live": "^2.2.3",
7473
"remark-slug": "^6.0.0",
75-
"sass": "^1.32.8",
74+
"sass": "^1.32.12",
7675
"shakespeare-data": "^3.0.0",
7776
"yup": "^0.32.9"
7877
}

www/plugins/gatsby-plugin-sorted-assets/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"main": "index.js",
55
"license": "MIT",
66
"dependencies": {
7-
"fs-extra": "^9.0.0",
8-
"lodash": "^4.17.11",
7+
"fs-extra": "^10.0.0",
8+
"lodash": "^4.17.21",
99
"toposort": "^2.0.2"
1010
},
1111
"peerDependencies": {

www/plugins/gatsby-plugin-sorted-assets/yarn.lock

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
# yarn lockfile v1
33

44

5-
at-least-node@^1.0.0:
6-
version "1.0.0"
7-
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
8-
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
9-
10-
fs-extra@^9.0.0:
11-
version "9.0.0"
12-
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3"
13-
integrity sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==
5+
fs-extra@^10.0.0:
6+
version "10.0.0"
7+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1"
8+
integrity sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==
149
dependencies:
15-
at-least-node "^1.0.0"
1610
graceful-fs "^4.2.0"
1711
jsonfile "^6.0.1"
18-
universalify "^1.0.0"
12+
universalify "^2.0.0"
1913

2014
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
2115
version "4.2.3"
@@ -31,10 +25,10 @@ jsonfile@^6.0.1:
3125
optionalDependencies:
3226
graceful-fs "^4.1.6"
3327

34-
lodash@^4.17.11:
35-
version "4.17.15"
36-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
37-
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
28+
lodash@^4.17.21:
29+
version "4.17.21"
30+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
31+
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
3832

3933
toposort@^2.0.2:
4034
version "2.0.2"
@@ -44,3 +38,8 @@ universalify@^1.0.0:
4438
version "1.0.0"
4539
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
4640
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==
41+
42+
universalify@^2.0.0:
43+
version "2.0.0"
44+
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
45+
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

www/src/examples/Form/CheckInline.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
<Form>
22
{['checkbox', 'radio'].map((type) => (
33
<div key={`inline-${type}`} className="mb-3">
4-
<Form.Check inline label="1" type={type} id={`inline-${type}-1`} />
5-
<Form.Check inline label="2" type={type} id={`inline-${type}-2`} />
4+
<Form.Check
5+
inline
6+
label="1"
7+
name="group1"
8+
type={type}
9+
id={`inline-${type}-1`}
10+
/>
11+
<Form.Check
12+
inline
13+
label="2"
14+
name="group1"
15+
type={type}
16+
id={`inline-${type}-2`}
17+
/>
618
<Form.Check
719
inline
820
disabled

www/src/examples/Navbar/NavScroll.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Navbar bg="light" expand="lg">
2+
<Navbar.Brand href="#">Navbar scroll</Navbar.Brand>
3+
<Navbar.Toggle aria-controls="navbarScroll" />
4+
<Navbar.Collapse id="navbarScroll">
5+
<Nav
6+
className="mr-auto my-2 my-lg-0"
7+
style={{ maxHeight: '100px' }}
8+
navbarScroll
9+
>
10+
<Nav.Link href="#action1">Home</Nav.Link>
11+
<Nav.Link href="#action2">Link</Nav.Link>
12+
<NavDropdown title="Link" id="navbarScrollingDropdown">
13+
<NavDropdown.Item href="#action3">Action</NavDropdown.Item>
14+
<NavDropdown.Item href="#action4">Another action</NavDropdown.Item>
15+
<NavDropdown.Divider />
16+
<NavDropdown.Item href="#action5">Something else here</NavDropdown.Item>
17+
</NavDropdown>
18+
<Nav.Link href="#" disabled>
19+
Link
20+
</Nav.Link>
21+
</Nav>
22+
<Form className="d-flex">
23+
<FormControl
24+
type="search"
25+
placeholder="Search"
26+
className="mr-2"
27+
aria-label="Search"
28+
/>
29+
<Button variant="outline-success">Search</Button>
30+
</Form>
31+
</Navbar.Collapse>
32+
</Navbar>;

0 commit comments

Comments
 (0)